static void ThreadedCheck() { try { CompilePalLogger.LogLine("Fetching update information..."); var c = new WebClient(); string newVersion = c.DownloadString(new Uri(UpdateURL)); LatestVersion = int.Parse(newVersion); if (CurrentVersion < LatestVersion) { MainWindow.ActiveDispatcher.Invoke(OnUpdateFound); CompilePalLogger.LogLine("Updater found that Compile Pal is outdated."); } else { CompilePalLogger.LogLine("Updater found that Compile Pal is up to date."); } ProgressManager.SetProgress(ProgressManager.Progress); } catch (WebException e) { CompilePalLogger.LogLine("Failed to find update information as an error was returned:"); CompilePalLogger.LogLine(e.ToString()); } }
public static void CancelCompile() { try { compileThread.Abort(); } catch { } IsCompiling = false; foreach (var compileProcess in ConfigurationManager.CompileProcesses.Where(cP => cP.Process != null)) { try { compileProcess.Cancel(); compileProcess.Process.Kill(); CompilePalLogger.LogLineColor("Killed {0}.", Brushes.OrangeRed, compileProcess.Metadata.Name); } catch (InvalidOperationException) { } catch (Exception e) { ExceptionHandler.LogException(e); } } ProgressManager.SetProgress(0); CompilePalLogger.LogLineColor("Compile forcefully ended.", Brushes.OrangeRed); postCompile(null); }
private static void CompileThreaded() { try { ProgressManager.SetProgress(0); var compileErrors = new List <Error>(); foreach (string mapFile in MapFiles) { CompilePalLogger.LogLine(string.Format("Starting compilation of {0}", mapFile)); foreach (var compileProcess in ConfigurationManager.CompileProcesses.Where(c => c.DoRun && c.PresetDictionary.ContainsKey(ConfigurationManager.CurrentPreset))) { compileProcess.Run(GameConfigurationManager.BuildContext(mapFile)); if (compileProcess is CompileExecutable) { var executable = compileProcess as CompileExecutable; compileErrors.AddRange(executable.CompileErrors); } ProgressManager.Progress += (1d / ConfigurationManager.CompileProcesses.Count(c => c.DoRun && c.PresetDictionary.ContainsKey(ConfigurationManager.CurrentPreset))) / MapFiles.Count; } } MainWindow.ActiveDispatcher.Invoke(() => postCompile(compileErrors)); } catch (ThreadAbortException) { ProgressManager.ErrorProgress(); } }
private void CompilingManager_OnFinish() { //If process grid is enabled, disable config grid ConfigDataGrid.IsEnabled = !processModeEnabled; ProcessDataGrid.IsEnabled = processModeEnabled; AddParameterButton.IsEnabled = true; RemoveParameterButton.IsEnabled = true; AddProcessesButton.IsEnabled = true; RemoveProcessesButton.IsEnabled = true; CompileProcessesListBox.IsEnabled = true; AddPresetButton.IsEnabled = true; RemovePresetButton.IsEnabled = true; ClonePresetButton.IsEnabled = true; PresetConfigListBox.IsEnabled = true; AddMapButton.IsEnabled = true; RemoveMapButton.IsEnabled = true; string logName = DateTime.Now.ToString("s").Replace(":", "-") + ".txt"; string textLog = new TextRange(CompileOutputTextbox.Document.ContentStart, CompileOutputTextbox.Document.ContentEnd).Text; if (!Directory.Exists("CompileLogs")) { Directory.CreateDirectory("CompileLogs"); } File.WriteAllText(System.IO.Path.Combine("CompileLogs", logName), textLog); CompileStartStopButton.Content = "Compile"; ProgressManager.SetProgress(1); }
static void ThreadedCheck() { try { CompilePalLogger.LogLine("Fetching update information..."); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var c = new WebClient(); string newVersion = GetValidVersionString(c.DownloadString(new Uri(isPrerelease ? LatestPrereleaseVersionURL : LatestVersionURL))); latestVersion = Version.Parse(newVersion); if (currentVersion < latestVersion) { MainWindow.ActiveDispatcher.Invoke(OnUpdateFound); CompilePalLogger.LogLine("Updater found that Compile Pal Multi is outdated."); } else { CompilePalLogger.LogLine("Updater found that Compile Pal Multi is up to date."); } ProgressManager.SetProgress(ProgressManager.Progress); } catch (WebException e) { CompilePalLogger.LogLine("Failed to find update information as an error was returned:"); CompilePalLogger.LogLine(e.ToString()); } }
private static void CompileThreaded() { try { ProgressManager.SetProgress(0); var mapErrors = new List <MapErrors>(); foreach (string mapFile in MapFiles) { string cleanMapName = Path.GetFileNameWithoutExtension(mapFile); var compileErrors = new List <Error>(); CompilePalLogger.LogLine($"Starting compilation of {cleanMapName}"); //Update the grid so we have the most up to date order OrderManager.UpdateOrder(); GameConfigurationManager.BackupCurrentContext(); foreach (var compileProcess in OrderManager.CurrentOrder) { currentCompileProcess = compileProcess; compileProcess.Run(GameConfigurationManager.BuildContext(mapFile)); if (compileProcess is CompileExecutable executable) { compileErrors.AddRange(executable.CompileErrors); //Portal 2 cannot work with leaks, stop compiling if we do get a leak. if (GameConfigurationManager.GameConfiguration.Name == "Portal 2") { if (executable.Name == "VBSP" && executable.CompileErrors.Count > 0) { //we have a VBSP error, aka a leak -> stop compiling; break; } } } ProgressManager.Progress += (1d / ConfigurationManager.CompileProcesses.Count(c => c.Metadata.DoRun && c.PresetDictionary.ContainsKey(ConfigurationManager.CurrentPreset))) / MapFiles.Count; } mapErrors.Add(new MapErrors { MapName = cleanMapName, Errors = compileErrors }); GameConfigurationManager.RestoreCurrentContext(); } MainWindow.ActiveDispatcher.Invoke(() => postCompile(mapErrors)); } catch (ThreadAbortException) { ProgressManager.ErrorProgress(); } }
private void CompilingManager_OnFinish() { string logName = DateTime.Now.ToString("s").Replace(":", "-") + ".txt"; string textLog = new TextRange(CompileOutputTextbox.Document.ContentStart, CompileOutputTextbox.Document.ContentEnd).Text; if (!Directory.Exists("CompileLogs")) { Directory.CreateDirectory("CompileLogs"); } File.WriteAllText(System.IO.Path.Combine("CompileLogs", logName), textLog); CompileStartStopButton.Content = "Compile"; ProgressManager.SetProgress(1); }
private static void CompileThreaded() { try { ProgressManager.SetProgress(0); var mapErrors = new List <MapErrors>(); foreach (string mapFile in MapFiles) { string cleanMapName = Path.GetFileNameWithoutExtension(mapFile); var compileErrors = new List <Error>(); CompilePalLogger.LogLine(string.Format("Starting compilation of {0}", cleanMapName)); //Update the grid so we have the most up to date order OrderManager.UpdateOrder(); foreach (var compileProcess in OrderManager.CurrentOrder) { currentCompileProcess = compileProcess; compileProcess.Run(GameConfigurationManager.BuildContext(mapFile)); if (compileProcess is CompileExecutable) { var executable = compileProcess as CompileExecutable; compileErrors.AddRange(executable.CompileErrors); } ProgressManager.Progress += (1d / ConfigurationManager.CompileProcesses.Count(c => c.Metadata.DoRun && c.PresetDictionary.ContainsKey(ConfigurationManager.CurrentPreset))) / MapFiles.Count; } mapErrors.Add(new MapErrors { MapName = cleanMapName, Errors = compileErrors }); } MainWindow.ActiveDispatcher.Invoke(() => postCompile(mapErrors)); } catch (ThreadAbortException) { ProgressManager.ErrorProgress(); } }