void OnGZipExtractEvent(GZipExtract gzipExtract, ESimpleEvent gzipExtractEvent) { lock (this) { switch (gzipExtractEvent) { case ESimpleEvent.started: OnStateChanged(ESourceState.GzExtractStarted); break; case ESimpleEvent.failed: case ESimpleEvent.canceled: OnStateChanged(ESourceState.GzFailed); break; case ESimpleEvent.finished: OnStateChanged(ESourceState.GzFinished); break; } } OnSubTaskEvent(gzipExtractEvent); }
private void StartExtractA() { NeedGoodGonfigData(); string url = URL; string GzFileName = ""; string GzFullFileName = ""; string XMLFileName = ""; string XMLFullFileName = ""; GzFileName = Utils.GetFileNameFromURL(url); GzFullFileName = TopManager.DownloadFolder + "\\" + GzFileName; XMLFileName = Utils.RemoveExt(GzFileName) + ".xml"; XMLFullFileName = TopManager.TempFolder + "\\" + XMLFileName; if (!File.Exists(GzFullFileName)) { DoError("File [" + GzFileName + "] not found"); return; } if (Utils.GetExt(GzFileName).ToLower() == "xml") { File.Copy(GzFullFileName, XMLFullFileName, true); OnGZipExtractEvent(null, ESimpleEvent.finished); return; } GzipExtract = new GZipExtract(GzFullFileName, XMLFullFileName, OnGZipExtractEvent); }
public void ClearState() { lock (this) { if (TaskState == ESimpleEvent.started) { DoError("busy"); } ScheduledTasks.Clear(); CancelToken = false; State = ESourceState.None; TaskState = ESimpleEvent.none; SubTaskState = ESimpleEvent.none; Downloader = null; GzipExtract = null; Progress = 0; } }