private void DoUnrarFiles() { stopEvent.Reset(); OnUnrarStart(); try { foreach (var fileInfo in FileInfoList.Where(fileInfo => fileInfo.Checked)) { UnRarFile(fileInfo); } } /*catch (StopException) * { * //ex.ToString(); * // do nothing, it's normal * }*/ /*catch * { * //if (stopEvent.WaitOne(0)) ; * //ex.ToString(); * // do nothing, it's normal * }*/ finally { OnUnrarComplete(); } }
private void DoDownloadFiles() { if (OnDownloadStart != null) { OnDownloadStart(); } try { stopEvent.Reset(); foreach (var fi in FileInfoList.Where(fi => fi.Checked)) { DownloadFile(fi); } } catch (StopException ex) { ex.ToString();// do nothing, it's normal } finally { if (OnDownloadComplete != null) { OnDownloadComplete(); } } }
// プロセスの終了を捕捉する Exited イベントハンドラ private void Process_Exited(object sender, EventArgs e) { var proc = (System.Diagnostics.Process)sender; var process = DisplayFileInfoList.Where(x => x?.Process?.Id == proc?.Id); if (process.Any()) { foreach (var item in process) { item.Process = null; item.Processing = false; } } process = FileInfoList.Where(x => x?.Process?.Id == proc?.Id); if (!process.Any()) { return; } foreach (var item in process) { item.Process = null; item.Processing = false; } }
private void DoUpdate() { stopEvent.Reset(); if (OnUpdateStart != null) { OnUpdateStart(); } try { dbCache.RebuildCache(); //var databaseMap = FiasDatabaseMap.LoadFromFile(RootFolder + "\\Fias.Mapping.xml"); foreach (var fInfo in from date in FileInfoList.Select(a => a.Description).Distinct() from fInfo in FileInfoList.Where(a => (a.Description == date) && (a.Url == string.Empty) && (a.Checked)).OrderBy(a => a.Length) where !stopEvent.WaitOne(0) select fInfo) { ProcessXmlFile(fInfo); } } catch (StopException ex) { ex.ToString();// do nothing, it's normal } finally { if (OnUpdateComplete != null) { OnUpdateComplete(); } } }