diff --git a/Launcher/ResourceFetcher.cs b/Launcher/ResourceFetcher.cs index 4a89411a8..45f4b6a64 100644 --- a/Launcher/ResourceFetcher.cs +++ b/Launcher/ResourceFetcher.cs @@ -8,29 +8,32 @@ namespace Launcher { public class ResourceFetcher { const string resUri = "https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/master/src/main/resources/"; - static readonly string[] coreList = { "char.png", "clouds.png", "terrain.png" }; + static readonly string[] coreList = { "char.png", "clouds.png", "terrain.png", "rain.png", "snow.png" }; static readonly string[] mobsList = { "chicken.png", "creeper.png", "pig.png", "sheep.png", "sheep_fur.png", "skeleton.png", "spider.png", "zombie.png" }; + static int resourcesCount = coreList.Length + mobsList.Length; public void Run( MainForm form ) { using( WebClient client = new WebClient() ) { client.Proxy = null; - if( DownloadResources( "", client, form, coreList ) ) { - DownloadResources( "mob/", client, form, mobsList ); + int i = 0; + if( DownloadResources( "", client, form, ref i, coreList ) ) { + DownloadResources( "mob/", client, form, ref i, mobsList ); } } } - static bool DownloadResources( string prefix, WebClient client, MainForm form, params string[] resources ) { + static bool DownloadResources( string prefix, WebClient client, MainForm form, ref int i, params string[] resources ) { foreach( string resource in resources ) { - if( !DownloadData( prefix + resource, client, resource, form ) ) return false; + if( !DownloadData( prefix + resource, client, resource, form, ref i ) ) return false; } return true; } - static bool DownloadData( string uri, WebClient client, string output, MainForm form ) { + static bool DownloadData( string uri, WebClient client, string output, MainForm form, ref int i ) { + i++; if( File.Exists( output ) ) return true; - form.Text = MainForm.AppName + " - fetching " + output; + form.Text = MainForm.AppName + " - fetching " + output + "(" + i + "/" + resourcesCount + ")"; try { client.DownloadFile( resUri + uri, output );