Ejemplo n.º 1
0
        public Batch(Document document, Build build, BuildProfile profile)
        {
            Document = document;
            Game = document.Game;
            Build = build;
            Profile = profile;

            var workingDir = Path.GetDirectoryName(document.MapFile);
            if (build.WorkingDirectory == CompileWorkingDirectory.SubDirectory && workingDir != null)
            {
                workingDir = Path.Combine(workingDir,  Path.GetFileNameWithoutExtension(document.MapFileName));
            }
            else if (build.WorkingDirectory == CompileWorkingDirectory.TemporaryDirectory || workingDir == null)
            {
                workingDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            }

            if (!Directory.Exists(workingDir)) Directory.CreateDirectory(workingDir);
            TargetFile = SaveCordonMap(document, workingDir);
            OriginalFile = document.MapFile;

            var fileFlag = '"' + TargetFile + '"';

            Steps = new List<BatchCompileStep>();
            if (profile.RunCsg)
            {
                Steps.Add(new BatchCompileStep
                {
                    Operation = Path.Combine(build.Path, build.Csg),
                    Flags = (profile.FullCsgParameters + ' ' + fileFlag).Trim()
                });
            }
            if (profile.RunBsp)
            {
                Steps.Add(new BatchCompileStep
                {
                    Operation = Path.Combine(build.Path, build.Bsp),
                    Flags = (profile.FullBspParameters + ' ' + fileFlag).Trim()
                });
            }
            if (profile.RunVis)
            {
                Steps.Add(new BatchCompileStep
                {
                    Operation = Path.Combine(build.Path, build.Vis),
                    Flags = (profile.FullVisParameters + ' ' + fileFlag).Trim()
                });
            }
            if (profile.RunRad)
            {
                Steps.Add(new BatchCompileStep
                {
                    Operation = Path.Combine(build.Path, build.Rad),
                    Flags = (profile.FullRadParameters + ' ' + fileFlag).Trim()
                });
            }
        }
Ejemplo n.º 2
0
 public Batch(Game game, Build build, string targetFile, string originalFile)
 {
     // TODO: this properly
     BeforeExecute = "";
     AfterExecute = "";
     BeforeExecuteStep = "";
     AfterExecuteStep = "";
     TargetFile = targetFile;
     var fileFlag = '"' + targetFile + '"';
     var bspFile = '"' + Path.ChangeExtension(targetFile, "bsp") + '"';
     var copyBsp = '"' + Path.ChangeExtension(originalFile, "bsp") + '"';
     Steps = new List<BatchCompileStep>
                 {
                     new BatchCompileStep { Operation = Path.Combine(build.Path, build.Csg), Flags = fileFlag },
                     new BatchCompileStep { Operation = Path.Combine(build.Path, build.Bsp), Flags = fileFlag },
                     new BatchCompileStep { Operation = Path.Combine(build.Path, build.Vis), Flags = fileFlag },
                     new BatchCompileStep { Operation = Path.Combine(build.Path, build.Rad), Flags = fileFlag },
                     new BatchCompileStep { Operation = "move", SystemCommand = true, Flags = bspFile + " " + copyBsp }
                     //new BatchCompileStep { Operation = "copy"}
                 };
 }
Ejemplo n.º 3
0
        public CompileDialog(Build build)
        {
            InitializeComponent();

            // Hide the panels
            AdvancedPanel.Size = Size.Empty;
            SimplePanel.Size = Size.Empty;

            // Open the default mode
            (Sledge.Settings.View.CompileDefaultAdvanced ? AdvancedPanel : SimplePanel).Dock = DockStyle.Fill;
            Size = (Sledge.Settings.View.CompileDefaultAdvanced ? _advancedSize : _simpleSize);

            _build = build;
            _specification = CompileSpecification.Specifications.FirstOrDefault(x => x.ID == build.Specification) ??
                             CompileSpecification.Specifications.FirstOrDefault() ??
                             new CompileSpecification {ID = "", Name = "No Specification Found"};

            Text = "Compile Map - " + _specification.Name;
            AddParameters();
            UpdateProfiles();
        }
Ejemplo n.º 4
0
        public static void Read()
        {
            Builds.Clear();
            Games.Clear();
            RecentFiles.Clear();
            Settings.Clear();

            var root = ReadSettingsFile();

            if (root == null) return;

            var settings = root.Children.FirstOrDefault(x => x.Name == "Settings");
            if (settings != null)
            {
                foreach (var key in settings.GetPropertyKeys())
                {
                    Settings.Add(new Setting {Key = key, Value = settings[key]});
                }
            }
            var recents = root.Children.FirstOrDefault(x => x.Name == "RecentFiles");
            if (recents != null)
            {
                foreach (var key in recents.GetPropertyKeys())
                {
                    int i;
                    if (int.TryParse(key, out i))
                    {
                        RecentFiles.Add(new RecentFile {Location = recents[key], Order = i});
                    }
                }
            }
            var games = root.Children.Where(x => x.Name == "Game");
            foreach (var game in games)
            {
                var g = new Game();
                g.Read(game);
                Games.Add(g);
            }
            var builds = root.Children.Where(x => x.Name == "Build");
            foreach (var build in builds)
            {
                var b = new Build();
                b.Read(build);
                Builds.Add(b);
            }
            Serialise.DeserialiseSettings(Settings.ToDictionary(x => x.Key, x => x.Value));

            if (!File.Exists(SettingsFile))
            {
                Write();
            }
        }