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(); }
        }
        public CompileProcess(string metadataFile)
        {
            var lines = File.ReadAllLines(metadataFile);

            Name           = lines[0];
            Path           = GameConfigurationManager.SubstituteValues(lines[1]);
            ParameterFile  = lines[2];
            baseParameters = lines[3];
            Order          = float.Parse(lines[4], CultureInfo.InvariantCulture);
            DoRun          = bool.Parse(lines[5]);
            ReadOutput     = bool.Parse(lines[6]);
            if (lines.Count() > 7)
            {
                Warning = lines[7];
            }
            if (lines.Count() > 8)
            {
                Description = lines[8];
            }


            CompilePalLogger.LogLine("Loaded {0} from {1} with {2} at order {3}", Name, metadataFile, ParameterFile, Order);

            ParameterList = ConfigurationManager.GetParameters(ParameterFile);

            MetadataFile = metadataFile;
        }
Exemple #3
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(); }
        }