Content Compiler:

- implemented Settings system to save user customization (XmlFile to LocalAppData)
- added Screen for opening projects
This commit is contained in:
SND\eagleeyestudios_cp 2012-08-28 21:14:49 +00:00
parent 1ecc704c16
commit 286ffe38c1
7 changed files with 520 additions and 23 deletions

View File

@ -60,6 +60,12 @@
<Compile Include="Controls\RibbonButton.Designer.cs">
<DependentUpon>RibbonButton.cs</DependentUpon>
</Compile>
<Compile Include="Dialogues\OpenProjectScreen.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialogues\OpenProjectScreen.Designer.cs">
<DependentUpon>OpenProjectScreen.cs</DependentUpon>
</Compile>
<Compile Include="Dialogues\NewProjectSummaryScreen.cs">
<SubType>Form</SubType>
</Compile>
@ -123,6 +129,9 @@
<EmbeddedResource Include="Controls\RibbonButton.resx">
<DependentUpon>RibbonButton.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialogues\OpenProjectScreen.resx">
<DependentUpon>OpenProjectScreen.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialogues\NewProjectSummaryScreen.resx">
<DependentUpon>NewProjectSummaryScreen.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,213 @@
namespace ANX.ContentCompiler.GUI.Dialogues
{
partial class OpenProjectScreen
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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);

View File

@ -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()
{

View File

@ -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<String> 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<string>();
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<string>();
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]));
}
}
}