private void Stage_4() { Data.Session.Stage = 4; Thread.Sleep(250); ColorLabels(FormDesign.Design); PGB_SecondPass.Percentage = 100; Invoke(new Action(() => { if (Data.Session.SecondPassFolders.Count > 0) { L_SecondPass_Info.Text = $"Done, {Data.Session.SecondPassFolders.Where(x => x.Match != null).Count()} / {Data.Session.SecondPassFolders.Count} matches found."; } else { L_SecondPass_Info.Text = $"Done, no need for Second Pass."; } L_ApplyChanges_Info.ForeColor = FormDesign.Design.InfoColor; if (Data.Session.StageErrors[3] > 0) { L_SecondPass_Info.ForeColor = FormDesign.Design.RedColor; } L_SecondPass_Info.Text += Data.Session.StageErrors[3] == 0 ? "." : $", {Data.Session.StageErrors[3]} errors occurred."; PB_SecondPass.Hide(); PB_Final.Show(); })); try { BackEndWorker.CloseExplorerWindows(); } catch (Exception) { } for (int i = 0; i < (Data.Session.Files.Count / 500).Between(1, MAX_RUNS); i++) { WorkingThreads.Add(new Action(S4_Work).RunInBackground(THREAD_PRIORITY)); } }
private void End() { Data.Session.Stage = 5; try { BackEndWorker.RefreshIcons(); } catch (Exception) { } Thread.Sleep(250); Invoke(new Action(() => { PGB_ApplyChanges.Percentage = 100; if (Data.Session.Errors == 0) { L_ApplyChanges_Info.Text = "Done"; } else { L_ApplyChanges_Info.Text = $"Done, {Data.Session.Errors}{(Data.Session.Errors == Data.Session.StageErrors[4] ? "" : " total")} errors occurred."; } if (Data.Session.Errors > 0) { L_ApplyChanges_Info.ForeColor = FormDesign.Design.RedColor; } B_Abort.HueShade = null; B_Abort.Text = "Done"; B_Abort.Image = Properties.Resources.Icon_Checkmark; PB_Final.Hide(); TaskbarProgress.SetState(Handle, TaskbarProgress.TaskbarStates.NoProgress); if (!FormIsActive) { FlashWindow.Flash(this, 5); } })); #if DEBUG try { File.WriteAllText(@"C:\Users\DotCa\Desktop\AIC_LastMatches.txt", Data.Session.Files.Where(x => x.Match != null).Convert(x => "{\r\n" + $" {x.ToString()}\r\n {(x.Match == null ? "NULL" : x.Match.ToString())}" + "\r\n}\r\n").ListStrings()); File.WriteAllText(@"C:\Users\DotCa\Desktop\AIC_Errors.txt", Data.Session.Exceptions.Where(x => x != null).Convert(x => $"--------------------------------------\r\n{x.ToString()}\r\n--------------------------------------\r\n\r\n").ListStrings()); } catch (Exception) { } #endif }