Exemple #1
0
        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(); }
        }
Exemple #2
0
        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 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(); }
        }