From 3a8d699c2bb5b3f8b82ffa5cb5fc3fdb81fd4b8c Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 16 Apr 2016 20:41:39 +1000 Subject: [PATCH] Now don't show the 'missing files XYZ' for all the sound files. --- Launcher2/Patcher/ResourceFetcher.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Launcher2/Patcher/ResourceFetcher.cs b/Launcher2/Patcher/ResourceFetcher.cs index 4e77d9872..8b139245f 100644 --- a/Launcher2/Patcher/ResourceFetcher.cs +++ b/Launcher2/Patcher/ResourceFetcher.cs @@ -110,8 +110,7 @@ namespace Launcher { string audioPath = Path.Combine( Program.AppDirectory, "audio" ); if( !Directory.Exists( audioPath ) ) Directory.CreateDirectory( audioPath ); - AllResourcesExist = File.Exists( digPath + ".bin" ) - && File.Exists( stepPath + ".bin" ); + AllResourcesExist = CheckSoundsExist(); string texDir = Path.Combine( Program.AppDirectory, "texpacks" ); string zipPath = Path.Combine( texDir, "default.zip" ); @@ -172,12 +171,10 @@ namespace Launcher { bool CheckMusicFiles( Action setStatus ) { for( int i = 0; i < musicFiles.Length; i++ ) { - string next = i < musicFiles.Length - 1 ? - musicFiles[i + 1] : "dig_cloth1"; + string next = i < musicFiles.Length - 1 ? musicFiles[i + 1] : "dig_cloth1"; string name = musicFiles[i]; byte[] data = null; - if( !DownloadItem( name, name, next, - ref data, setStatus ) ) + if( !DownloadItem( name, name, next, ref data, setStatus ) ) return false; if( data == null ) continue; @@ -197,6 +194,20 @@ namespace Launcher { } } + bool CheckSoundsExist() { + string path = Path.Combine( Program.AppDirectory, "audio" ); + for( int i = 0; i < digSounds.Length; i++ ) { + string file = "dig_" + digSounds[i].Substring( 1 ) + ".wav"; + if( !File.Exists( Path.Combine( path, file ) ) ) return false; + } + + for( int i = 0; i < stepSounds.Length; i++ ) { + string file = "step_" + stepSounds[i].Substring( 1 ) + ".wav"; + if( !File.Exists( Path.Combine( path, file ) ) ) return false; + } + return true; + } + string digPath, stepPath; string[] digSounds = new [] { "Acloth1", "Acloth2", "Acloth3", "Acloth4", "Bglass1", "Bglass2", "Bglass3", "Agrass1", "Agrass2", "Agrass3", "Agrass4", "Agravel1", "Agravel2",