public bool CheckDownloaded(ResourceFetcher fetcher, Action <string> setStatus) { if (Done) { return(true); } for (int i = 0; i < identifiers.Length; i++) { DownloadedItem item; if (fetcher.downloader.TryGetItem(identifiers[i], out item)) { Console.WriteLine("got sound " + identifiers[i]); if (item.Data == null) { setStatus("&cFailed to download " + identifiers[i]); } else { DecodeSound(files[i].Substring(1), (byte[])item.Data); } // TODO: setStatus(next); if (i == identifiers.Length - 1) { Done = true; setStatus(fetcher.MakeNext(nextAction)); } else { setStatus(fetcher.MakeNext(identifiers[i + 1])); } } } return(true); }
public bool CheckDownloaded(ResourceFetcher fetcher, Action <string> setStatus) { if (Done) { return(true); } for (int i = 0; i < identifiers.Length; i++) { Request item; if (fetcher.downloader.TryGetItem(identifiers[i], out item)) { fetcher.FilesToDownload.RemoveAt(0); Utils.LogDebug("got sound " + identifiers[i]); if (item.Data == null) { setStatus("&cFailed to download " + identifiers[i]); } else { DecodeSound(files[i].Substring(1), (byte[])item.Data); } if (i == identifiers.Length - 1) { Done = true; } setStatus(fetcher.MakeNext()); } } return(true); }
public bool CheckDownloaded( ResourceFetcher fetcher, Action<string> setStatus ) { if( Done ) return true; for( int i = 0; i < identifiers.Length; i++ ) { DownloadedItem item; if( fetcher.downloader.TryGetItem( identifiers[i], out item ) ) { Console.WriteLine( "got sound " + identifiers[i] ); if( item.Data == null ) { setStatus( "&cFailed to download " + identifiers[i] ); return false; } DecodeSound( files[i].Substring( 1 ), (byte[])item.Data ); // TODO: setStatus( next ); if( i == identifiers.Length - 1 ) { Done = true; setStatus( fetcher.MakeNext( nextAction ) ); } else { setStatus( fetcher.MakeNext( identifiers[i + 1] ) ); } } } return true; }