diff --git a/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj b/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj index 9072081a..9cca0c5a 100644 --- a/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj +++ b/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj @@ -60,6 +60,12 @@ RibbonButton.cs + + Form + + + OpenProjectScreen.cs + Form @@ -123,6 +129,9 @@ RibbonButton.cs + + OpenProjectScreen.cs + NewProjectSummaryScreen.cs diff --git a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs new file mode 100644 index 00000000..263c01ab --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs @@ -0,0 +1,213 @@ +namespace ANX.ContentCompiler.GUI.Dialogues +{ + partial class OpenProjectScreen + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonNext = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.buttonBrowse = new System.Windows.Forms.Button(); + this.textBoxLocation = new System.Windows.Forms.TextBox(); + this.labelManualSearch = new System.Windows.Forms.Label(); + this.labelHeading = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.listBoxRecentProjects = new System.Windows.Forms.ListBox(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.buttonCancel.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.buttonCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonCancel.Location = new System.Drawing.Point(12, 317); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 30); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // buttonNext + // + this.buttonNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonNext.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.buttonNext.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.buttonNext.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.buttonNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonNext.Location = new System.Drawing.Point(504, 317); + this.buttonNext.Name = "buttonNext"; + this.buttonNext.Size = new System.Drawing.Size(84, 30); + this.buttonNext.TabIndex = 6; + this.buttonNext.Text = "Open"; + this.buttonNext.UseVisualStyleBackColor = true; + this.buttonNext.Click += new System.EventHandler(this.ButtonNextClick); + // + // button3 + // + this.button3.DialogResult = System.Windows.Forms.DialogResult.Abort; + this.button3.FlatAppearance.BorderSize = 0; + this.button3.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.button3.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button3.Location = new System.Drawing.Point(572, -1); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(26, 23); + this.button3.TabIndex = 7; + this.button3.Text = "X"; + this.button3.UseVisualStyleBackColor = true; + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.listBoxRecentProjects); + this.panel1.Controls.Add(this.buttonBrowse); + this.panel1.Controls.Add(this.textBoxLocation); + this.panel1.Controls.Add(this.labelManualSearch); + this.panel1.Controls.Add(this.labelHeading); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.buttonNext); + this.panel1.Controls.Add(this.button3); + this.panel1.Controls.Add(this.buttonCancel); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(600, 359); + this.panel1.TabIndex = 14; + // + // buttonBrowse + // + this.buttonBrowse.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonBrowse.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.buttonBrowse.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.buttonBrowse.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.buttonBrowse.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonBrowse.Location = new System.Drawing.Point(479, 249); + this.buttonBrowse.Name = "buttonBrowse"; + this.buttonBrowse.Size = new System.Drawing.Size(87, 23); + this.buttonBrowse.TabIndex = 20; + this.buttonBrowse.Text = "Browse"; + this.buttonBrowse.UseVisualStyleBackColor = true; + this.buttonBrowse.Click += new System.EventHandler(this.ButtonBrowseClick); + // + // textBoxLocation + // + this.textBoxLocation.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.textBoxLocation.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBoxLocation.ForeColor = System.Drawing.Color.White; + this.textBoxLocation.Location = new System.Drawing.Point(71, 249); + this.textBoxLocation.Name = "textBoxLocation"; + this.textBoxLocation.Size = new System.Drawing.Size(402, 22); + this.textBoxLocation.TabIndex = 19; + // + // labelManualSearch + // + this.labelManualSearch.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelManualSearch.Location = new System.Drawing.Point(22, 219); + this.labelManualSearch.Name = "labelManualSearch"; + this.labelManualSearch.Size = new System.Drawing.Size(554, 27); + this.labelManualSearch.TabIndex = 18; + this.labelManualSearch.Text = "Not in there? No problem!"; + this.labelManualSearch.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // labelHeading + // + this.labelHeading.Font = new System.Drawing.Font("Segoe UI Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelHeading.Location = new System.Drawing.Point(85, 55); + this.labelHeading.Name = "labelHeading"; + this.labelHeading.Size = new System.Drawing.Size(429, 38); + this.labelHeading.TabIndex = 15; + this.labelHeading.Text = "Do you look for one of these?"; + this.labelHeading.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(-4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(570, 22); + this.label1.TabIndex = 14; + this.label1.Text = "New Project"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // listBoxRecentProjects + // + this.listBoxRecentProjects.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.listBoxRecentProjects.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.listBoxRecentProjects.ForeColor = System.Drawing.Color.LightGray; + this.listBoxRecentProjects.FormattingEnabled = true; + this.listBoxRecentProjects.Items.AddRange(new object[] { + "Test", + "Blubb", + "Put", + "Recent", + "Projects", + "here"}); + this.listBoxRecentProjects.Location = new System.Drawing.Point(71, 96); + this.listBoxRecentProjects.Name = "listBoxRecentProjects"; + this.listBoxRecentProjects.Size = new System.Drawing.Size(443, 119); + this.listBoxRecentProjects.TabIndex = 21; + // + // OpenProjectScreen + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.ClientSize = new System.Drawing.Size(600, 359); + this.Controls.Add(this.panel1); + this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ForeColor = System.Drawing.Color.White; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "OpenProjectScreen"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "FirstStartScreen"; + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonNext; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label labelHeading; + private System.Windows.Forms.Button buttonBrowse; + private System.Windows.Forms.Label labelManualSearch; + public System.Windows.Forms.TextBox textBoxLocation; + private System.Windows.Forms.ListBox listBoxRecentProjects; + } +} \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs new file mode 100644 index 00000000..0bc7cf05 --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; +using System.Windows.Forms; + +namespace ANX.ContentCompiler.GUI.Dialogues +{ + public partial class OpenProjectScreen : Form + { + public OpenProjectScreen() + { + InitializeComponent(); + SetUpColors(); + } + + private void SetUpColors() + { + BackColor = Settings.MainColor; + ForeColor = Settings.ForeColor; + button3.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + buttonBrowse.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + buttonCancel.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + buttonNext.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + button3.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonBrowse.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonCancel.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonNext.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonNext.FlatAppearance.BorderColor = Settings.LightMainColor; + button3.FlatAppearance.BorderColor = Settings.LightMainColor; + buttonBrowse.FlatAppearance.BorderColor = Settings.LightMainColor; + buttonCancel.FlatAppearance.BorderColor = Settings.LightMainColor; + listBoxRecentProjects.BackColor = Settings.DarkMainColor; + textBoxLocation.BackColor = Settings.DarkMainColor; + listBoxRecentProjects.ForeColor = Settings.LightMainColor; + textBoxLocation.ForeColor = Settings.ForeColor; + } + + private void ButtonBrowseClick(object sender, EventArgs e) + { + using (var dlg = new OpenFileDialog()) + { + dlg.Filter = "ANX Content Project (*.cproj)|*.cproj|Compressed Content Projekt (*.ccproj)|*.ccproj"; + dlg.Multiselect = false; + dlg.Title = "Select project to open"; + if (dlg.ShowDialog() == DialogResult.OK) + { + textBoxLocation.Text = dlg.SafeFileName; + } + } + DialogResult = DialogResult.None; + } + + private void ButtonNextClick(object sender, EventArgs e) + { + if (String.IsNullOrEmpty(textBoxLocation.Text) || listBoxRecentProjects.SelectedItem == null) + MessageBox.Show("You need to select a project!", "Missing value", MessageBoxButtons.OK, MessageBoxIcon.Warning); + else + DialogResult = DialogResult.OK; + } + } +} \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.resx b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.resx new file mode 100644 index 00000000..5ea0895e --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs b/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs index 1cc3ae64..36361cfe 100644 --- a/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs +++ b/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs @@ -97,10 +97,8 @@ namespace ANX.ContentCompiler.GUI // // ribbonButtonHelp // - this.ribbonButtonHelp.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ribbonButtonHelp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ribbonButtonHelp.Content = "Help"; - this.ribbonButtonHelp.ForeColor = System.Drawing.Color.White; this.ribbonButtonHelp.Image = null; this.ribbonButtonHelp.Location = new System.Drawing.Point(299, 26); this.ribbonButtonHelp.Name = "ribbonButtonHelp"; @@ -109,10 +107,8 @@ namespace ANX.ContentCompiler.GUI // // ribbonButtonWeb // - this.ribbonButtonWeb.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ribbonButtonWeb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ribbonButtonWeb.Content = "Website"; - this.ribbonButtonWeb.ForeColor = System.Drawing.Color.White; this.ribbonButtonWeb.Image = null; this.ribbonButtonWeb.Location = new System.Drawing.Point(237, 26); this.ribbonButtonWeb.Name = "ribbonButtonWeb"; @@ -121,10 +117,8 @@ namespace ANX.ContentCompiler.GUI // // ribbonButtonClean // - this.ribbonButtonClean.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ribbonButtonClean.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ribbonButtonClean.Content = "Clean"; - this.ribbonButtonClean.ForeColor = System.Drawing.Color.White; this.ribbonButtonClean.Image = null; this.ribbonButtonClean.Location = new System.Drawing.Point(186, 26); this.ribbonButtonClean.Name = "ribbonButtonClean"; @@ -133,10 +127,8 @@ namespace ANX.ContentCompiler.GUI // // ribbonButtonSave // - this.ribbonButtonSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ribbonButtonSave.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ribbonButtonSave.Content = "Save"; - this.ribbonButtonSave.ForeColor = System.Drawing.Color.White; this.ribbonButtonSave.Image = null; this.ribbonButtonSave.Location = new System.Drawing.Point(105, 26); this.ribbonButtonSave.Name = "ribbonButtonSave"; @@ -145,22 +137,19 @@ namespace ANX.ContentCompiler.GUI // // ribbonButtonLoad // - this.ribbonButtonLoad.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ribbonButtonLoad.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ribbonButtonLoad.Content = "Open"; - this.ribbonButtonLoad.ForeColor = System.Drawing.Color.White; this.ribbonButtonLoad.Image = null; this.ribbonButtonLoad.Location = new System.Drawing.Point(54, 26); this.ribbonButtonLoad.Name = "ribbonButtonLoad"; this.ribbonButtonLoad.Size = new System.Drawing.Size(52, 68); this.ribbonButtonLoad.TabIndex = 4; + this.ribbonButtonLoad.Click += new System.EventHandler(this.RibbonButtonLoadClick); // // ribbonButtonNew // - this.ribbonButtonNew.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ribbonButtonNew.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ribbonButtonNew.Content = "New"; - this.ribbonButtonNew.ForeColor = System.Drawing.Color.White; this.ribbonButtonNew.Image = null; this.ribbonButtonNew.Location = new System.Drawing.Point(3, 26); this.ribbonButtonNew.Name = "ribbonButtonNew"; @@ -330,10 +319,8 @@ namespace ANX.ContentCompiler.GUI // // editingState // - this.editingState.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.editingState.Dock = System.Windows.Forms.DockStyle.Fill; this.editingState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.editingState.ForeColor = System.Drawing.Color.White; this.editingState.Location = new System.Drawing.Point(0, 0); this.editingState.Name = "editingState"; this.editingState.Size = new System.Drawing.Size(407, 547); @@ -342,10 +329,8 @@ namespace ANX.ContentCompiler.GUI // // startState // - this.startState.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.startState.Dock = System.Windows.Forms.DockStyle.Fill; this.startState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.startState.ForeColor = System.Drawing.Color.White; this.startState.Location = new System.Drawing.Point(0, 0); this.startState.Name = "startState"; this.startState.Size = new System.Drawing.Size(407, 547); @@ -391,10 +376,8 @@ namespace ANX.ContentCompiler.GUI this.menuState.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.menuState.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.menuState.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.menuState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.menuState.ForeColor = System.Drawing.Color.White; this.menuState.Location = new System.Drawing.Point(-2, 23); this.menuState.Name = "menuState"; this.menuState.Size = new System.Drawing.Size(865, 630); diff --git a/Tools/ANXContentCompilerGUI/MainWindow.cs b/Tools/ANXContentCompilerGUI/MainWindow.cs index 49dedeca..0f64b996 100644 --- a/Tools/ANXContentCompilerGUI/MainWindow.cs +++ b/Tools/ANXContentCompilerGUI/MainWindow.cs @@ -10,7 +10,7 @@ namespace ANX.ContentCompiler.GUI { #region Fields public static String DefaultOutputPath = "bin"; - public static String SettingsFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ANX Content Compiler" + Path.PathSeparator + "settings.ees"); + public static String SettingsFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ANX Content Compiler" + Path.DirectorySeparatorChar + "settings.ees"); private Point _lastPos; private bool _mouseDown; @@ -35,7 +35,10 @@ namespace ANX.ContentCompiler.GUI Instance = this; _firstStart = !File.Exists(SettingsFile); if (_firstStart) + { Settings.Defaults(); + Settings.Save(SettingsFile); + } else Settings.Load(SettingsFile); treeViewItemAddFolder.MouseEnter += TreeViewItemMouseEnter; @@ -96,6 +99,19 @@ namespace ANX.ContentCompiler.GUI } #endregion + #region OpenProject + private void RibbonButtonLoadClick(object sender, EventArgs e) + { + using (var dlg = new OpenProjectScreen()) + { + if (dlg.ShowDialog() == DialogResult.OK) + { + + } + } + } + #endregion + #region EnvironmentStates public void ChangeEnvironmentStartState() { diff --git a/Tools/ANXContentCompilerGUI/Settings.cs b/Tools/ANXContentCompilerGUI/Settings.cs index 4b0ce20b..36b8ebd9 100644 --- a/Tools/ANXContentCompilerGUI/Settings.cs +++ b/Tools/ANXContentCompilerGUI/Settings.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Drawing; using System.IO; -using System.Linq; using System.Text; +using System.Xml; namespace ANX.ContentCompiler.GUI { @@ -17,12 +17,13 @@ namespace ANX.ContentCompiler.GUI public static Color AccentColor { get; set; } public static Color AccentColor2 { get; set; } public static Color AccentColor3 { get; set; } + public static List RecentProjects { get; set; } public static void Defaults() { - DefaultProjectPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ANX Content Compiler" + Path.DirectorySeparatorChar + "4.0" + Path.DirectorySeparatorChar); + RecentProjects = new List(); MainColor = Color.FromArgb(64, 64, 64); //MainColor = Color.Goldenrod; DarkMainColor = Color.FromArgb(42, 42, 42); @@ -40,12 +41,107 @@ namespace ANX.ContentCompiler.GUI public static void Load(string path) { - + DefaultProjectPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), + "ANX Content Compiler" + Path.DirectorySeparatorChar + "4.0" + Path.DirectorySeparatorChar); + RecentProjects = new List(); + if (!File.Exists(path)) return; + XmlReader reader = new XmlTextReader(path); + while (!reader.EOF) + { + switch (reader.Name) + { + case "MainColor": + if (reader.NodeType == XmlNodeType.Element) + MainColor = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "DarkMainColor": + if (reader.NodeType == XmlNodeType.Element) + DarkMainColor = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "LightMainColor": + if (reader.NodeType == XmlNodeType.Element) + LightMainColor = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "ForeColor": + if (reader.NodeType == XmlNodeType.Element) + ForeColor = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "AccentColor": + if (reader.NodeType == XmlNodeType.Element) + AccentColor = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "AccentColor2": + if (reader.NodeType == XmlNodeType.Element) + AccentColor2 = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "AccentColor3": + if (reader.NodeType == XmlNodeType.Element) + AccentColor3 = GetColorFromXmlCompatible(reader.ReadElementContentAsString()); + break; + case "Path": + if (reader.NodeType == XmlNodeType.Element) + RecentProjects.Add(reader.ReadElementContentAsString()); + break; + default: + reader.Read(); + break; + } + } + reader.Close(); } public static void Save(string path) { - + if (!Directory.Exists(Path.GetDirectoryName(path))) + Directory.CreateDirectory(Path.GetDirectoryName(path)); + + XmlWriter writer = new XmlTextWriter(path, Encoding.Unicode); + writer.WriteStartDocument(); + writer.WriteStartElement("CCompiler4Settings"); + writer.WriteStartElement("MainColor"); + writer.WriteValue(GetXmlCompatibleColor(MainColor)); + writer.WriteFullEndElement(); + writer.WriteStartElement("DarkMainColor"); + writer.WriteValue(GetXmlCompatibleColor(DarkMainColor)); + writer.WriteFullEndElement(); + writer.WriteStartElement("LightMainColor"); + writer.WriteValue(GetXmlCompatibleColor(LightMainColor)); + writer.WriteFullEndElement(); + writer.WriteStartElement("ForeColor"); + writer.WriteValue(GetXmlCompatibleColor(ForeColor)); + writer.WriteFullEndElement(); + writer.WriteStartElement("AccentColor"); + writer.WriteValue(GetXmlCompatibleColor(AccentColor)); + writer.WriteFullEndElement(); + writer.WriteStartElement("AccentColor2"); + writer.WriteValue(GetXmlCompatibleColor(AccentColor2)); + writer.WriteFullEndElement(); + writer.WriteStartElement("AccentColor3"); + writer.WriteValue(GetXmlCompatibleColor(AccentColor3)); + writer.WriteFullEndElement(); + writer.WriteStartElement("RecentProjects"); + foreach (var recentProject in RecentProjects) + { + writer.WriteStartElement("Path"); + writer.WriteString(recentProject); + writer.WriteEndElement(); + } + writer.WriteEndElement(); + writer.WriteEndElement(); + writer.WriteEndDocument(); + writer.Flush(); + writer.Close(); + } + + private static string GetXmlCompatibleColor(Color color) + { + return color.R + "," + color.G + "," + color.B; + } + + private static Color GetColorFromXmlCompatible(string xml) + { + var s = xml.Split(new[] {','}, 3); + return Color.FromArgb(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), Convert.ToInt32(s[2])); } } }