From cd96c852b25d9f56a9cbbc8873c5b21de510890e Mon Sep 17 00:00:00 2001 From: Ruhrpottpatriot Date: Thu, 13 Aug 2015 16:43:28 +0200 Subject: [PATCH 1/5] - Updated UI to allow for all possible compiler options. --- Compiler/Compiler.cs | 14 +-- .../ViewModels/SolutionViewModel.cs | 38 ++++++-- SkyrimCompileHelper/Views/SolutionView.xaml | 89 ++++++++++++++----- 3 files changed, 105 insertions(+), 36 deletions(-) diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index a2a440d..1aae4be 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -29,7 +29,7 @@ public class Compiler /// The path to the compiler. private readonly string skyrimPath; - /// Initializes a new instance of the class. + /// Initialises a new instance of the class. /// The absolute path to skyrims main folder. /// The log writer. public Compiler(string skyrimPath, LogWriter logWriter) @@ -59,7 +59,7 @@ public Compiler(string skyrimPath, LogWriter logWriter) public bool Optimize { get; set; } /// Gets or sets the assembly options. - public AssemblyOptions AssemblyOptions { get; set; } + public string AssemblyOptions { get; set; } /// Gets or sets the input folders. /// This property lists all folders that the compiler gets the script files from. @@ -163,15 +163,17 @@ private string GenerateArgumentString() // Check what we want to do with the assembly files afterwards. switch (this.AssemblyOptions) { - case AssemblyOptions.NoAssembly: + case "Assemble and Delete": argumentsBuilder.Append(" -noasm"); break; - case AssemblyOptions.AssembleAndKeep: + case "Assemble and Keep": argumentsBuilder.Append(" -keepasm"); break; - case AssemblyOptions.GenerateOnly: + case "Generate only": argumentsBuilder.Append(" -asmonly"); break; + case "No Assembly": + break; } // Append all import folders. Skyrims data folder is appended by default. @@ -188,7 +190,7 @@ private string GenerateArgumentString() argumentsBuilder.Append(" -flags= \"" + this.Flags + "\""); argumentsBuilder.Append(" -output=\"" + this.OutputFolder + "\""); - + return argumentsBuilder.ToString(); } diff --git a/SkyrimCompileHelper/ViewModels/SolutionViewModel.cs b/SkyrimCompileHelper/ViewModels/SolutionViewModel.cs index f5cf3ac..d88cf7a 100644 --- a/SkyrimCompileHelper/ViewModels/SolutionViewModel.cs +++ b/SkyrimCompileHelper/ViewModels/SolutionViewModel.cs @@ -50,7 +50,7 @@ public SolutionViewModel() { this.SolutionName = "Outfits of Skyrim"; this.Version = new SemVersion(0, 1); - this.CompilerFlags = "Flags"; + this.FlagsFile = "Flags"; this.SolutionPath = @"C:\Test"; this.Configurations = new List { @@ -78,6 +78,14 @@ public SolutionViewModel(IWindowManager windowManager, ISettingsRepository setti this.SolutionName = solution.Name; this.SolutionPath = solution.Path; this.Version = solution.Version; + this.CompilerAll = true; + this.CompilerAssemblyOptions = new List + { + "Assemble and Delete", + "Assemble and Keep", + "Generate only", + "No Assembly" + }; } /// Gets or sets the solution name. @@ -89,15 +97,27 @@ public SolutionViewModel(IWindowManager windowManager, ISettingsRepository setti /// Gets or sets the solution version. public SemVersion Version { get; set; } - /// Gets or sets the compiler flags. - public string CompilerFlags { get; set; } - /// Gets or sets the compile configurations. public IList Configurations { get; set; } /// Gets or sets the selected configuration. public CompileConfiguration SelectedConfiguration { get; set; } + /// Gets or sets the compiler flags. + public string FlagsFile { get; set; } + + public bool CompilerAll { get; set; } + + public bool CompilerQuiet { get; set; } + + public bool CompilerDebug { get; set; } + + public bool CompilerOptimize { get; set; } + + public IList CompilerAssemblyOptions { get; set; } + + public string SelectedAssemblyOption { get; set; } + /// Opens the solution folder in the windows explorer. /// Not yet implemented public void OpenSolutionFolder() @@ -155,7 +175,7 @@ public void ChangeConfiguration(ComboBox sender) } CompileConfiguration configuration = this.Configurations.SingleOrDefault(c => c.Name == configurationName); - this.CompilerFlags = configuration != null ? configuration.CompilerFlags : string.Empty; + this.FlagsFile = configuration != null ? configuration.CompilerFlags : string.Empty; this.SaveSolution(); } @@ -170,10 +190,14 @@ public void Compile() Compiler compiler = new Compiler(this.settingsRepository.Read()["SkyrimPath"].ToString(), this.logWriter) { - Flags = this.CompilerFlags, + Flags = this.FlagsFile, InputFolders = inputFolders.ToList(), OutputFolder = Path.Combine(this.SolutionPath, "bin", this.SelectedConfiguration.Name), - All = true + All = this.CompilerAll, + Quiet = this.CompilerQuiet, + Debug = this.CompilerDebug, + Optimize = this.CompilerOptimize, + AssemblyOptions = this.SelectedAssemblyOption }; int build = Convert.ToInt32(string.IsNullOrEmpty(this.Version.Build) ? "0" : this.Version.Build) + 1; diff --git a/SkyrimCompileHelper/Views/SolutionView.xaml b/SkyrimCompileHelper/Views/SolutionView.xaml index a031bfa..bb314fa 100644 --- a/SkyrimCompileHelper/Views/SolutionView.xaml +++ b/SkyrimCompileHelper/Views/SolutionView.xaml @@ -21,11 +21,11 @@ - - - - - + + + + + - - - - - @@ -56,11 +52,11 @@ Margin="0,3,0,3" Grid.ColumnSpan="2"> - +