public DownloadMeta(DownloadStringStep step, string selectedregion, string selectedlanguage, DateTime?version) { this.VersionDate = version; this._step = step; this.SelectedLanguage = selectedlanguage; this.SelectedRegion = selectedregion; }
private void MyWebClient_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e) { DownloadMeta meta = e.UserState as DownloadMeta; if (e.Error != null) { if (meta != null) { } else { DownloadStringStep step = (DownloadStringStep)e.UserState; switch (step) { case DownloadStringStep.CheckForUpdate: this.CheckForTranslationVersionCompleted?.Invoke(this, new CheckForTranslationVersionCompletedEventArgs(e.Error, e.Cancelled, new TranslationVersions(e.Result))); break; } } } else if (e.Cancelled) { if (meta != null) { } else { DownloadStringStep step = (DownloadStringStep)e.UserState; switch (step) { case DownloadStringStep.CheckForUpdate: this.CheckForTranslationVersionCompleted?.Invoke(this, new CheckForTranslationVersionCompletedEventArgs(e.Error, e.Cancelled, new TranslationVersions(e.Result))); break; } } } else { if (meta != null) { switch (meta.Step) { case DownloadStringStep.GetLanguagesData: meta.SetDataEncryption(e.Result); meta.SetStep(DownloadStringStep.GetLanguageDescription); this.myWebClient.DownloadStringAsync(new Uri(Leayal.UriHelper.URLConcat(RootURL, meta.SelectedRegion, meta.SelectedLanguage, "TranslationPackData.ini")), meta); break; case DownloadStringStep.GetLanguageDescription: meta.SetTranslationDescription(e.Result); meta.SetStep(DownloadStringStep.DownloadTXTs); this.DownloadTXTs(meta); break; } } else { DownloadStringStep step = (DownloadStringStep)e.UserState; switch (step) { case DownloadStringStep.CheckForUpdate: this.CheckForTranslationVersionCompleted?.Invoke(this, new CheckForTranslationVersionCompletedEventArgs(e.Error, e.Cancelled, new TranslationVersions(e.Result))); break; } } } }
internal void SetStep(DownloadStringStep step) { this._step = step; }