Content Compiler:

- Fixed some resource issues
- Implemented RecentProjects Feature
- Implemented build process
- Added a Logger implementation for BuildContent Class
- Added a displayable log to the MainWindow UI
- Fixed a bug that occured when adding files to the content root
- Trying to open a not existing project no longer throws an exception

ContentPipeline:
- Added missing property "Profile" to ContentProject
This commit is contained in:
SND\eagleeyestudios_cp 2012-09-09 15:44:49 +00:00
parent bf14329432
commit 9b842c7fd8
21 changed files with 900 additions and 107 deletions

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.Development;
#endregion
@ -34,7 +35,7 @@ namespace ANX.Framework.Content.Pipeline.Tasks
/// Minor version of the project format.
/// Used to keep backwards compatibility
/// </summary>
public int VersionMinor { get { return 1; } } //before you commit your changes, please increase this value by one (and if you added stuff, please check the version before you read anything out of a file).
public int VersionMinor { get { return 2; } } //before you commit your changes, please increase this value by one (and if you added stuff, please check the version before you read anything out of a file).
/// <summary>
/// The directory where the compiled output will be placed
@ -72,6 +73,11 @@ namespace ANX.Framework.Content.Pipeline.Tasks
/// </summary>
public String Creator { get; set; }
/// <summary>
/// Target Graphics Profile
/// </summary>
public GraphicsProfile Profile { get; set; }
/// <summary>
/// The configuration. Can be "Debug" or "Release".
/// </summary>
@ -126,6 +132,11 @@ namespace ANX.Framework.Content.Pipeline.Tasks
writer.WriteValue(Configuration);
writer.WriteEndElement();
//<Profile>Reach</Profile>
writer.WriteStartElement("Profile");
writer.WriteValue(Profile.ToString());
writer.WriteEndElement();
//<Platform>Windows</Platform>
writer.WriteStartElement("Platform");
writer.WriteValue(Platform.ToString());
@ -245,6 +256,25 @@ namespace ANX.Framework.Content.Pipeline.Tasks
if (versionMajor == 1 && versionMinor >= 0)
project.Configuration = reader.ReadElementContentAsString();
break;
case "Profile":
if (reader.NodeType == XmlNodeType.Element)
{
if (versionMinor < 2)
project.Profile = GraphicsProfile.Reach;
else
{
switch (reader.ReadElementContentAsString())
{
case "Reach":
project.Profile = GraphicsProfile.Reach;
break;
case "HiDef":
project.Profile = GraphicsProfile.HiDef;
break;
}
}
}
break;
case "Platform":
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -49,6 +49,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CCompilerBuildLogger.cs" />
<Compile Include="Controls\ArrowButton.cs">
<SubType>UserControl</SubType>
</Compile>
@ -61,6 +62,18 @@
<Compile Include="Controls\RibbonButton.Designer.cs">
<DependentUpon>RibbonButton.cs</DependentUpon>
</Compile>
<Compile Include="Controls\RibbonTextBox.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\RibbonTextBox.Designer.cs">
<DependentUpon>RibbonTextBox.cs</DependentUpon>
</Compile>
<Compile Include="Dialogues\ErrorLogScreen.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialogues\ErrorLogScreen.Designer.cs">
<DependentUpon>ErrorLogScreen.cs</DependentUpon>
</Compile>
<Compile Include="Dialogues\NewFolderScreen.cs">
<SubType>Form</SubType>
</Compile>
@ -103,6 +116,7 @@
<Compile Include="Dialogues\FirstStartScreen.Designer.cs">
<DependentUpon>FirstStartScreen.cs</DependentUpon>
</Compile>
<Compile Include="RecentProjects.cs" />
<Compile Include="Settings.cs" />
<Compile Include="States\EditingState.cs">
<SubType>UserControl</SubType>
@ -131,6 +145,12 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TreeViewExtensions.cs" />
<EmbeddedResource Include="Controls\RibbonTextBox.resx">
<DependentUpon>RibbonTextBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialogues\ErrorLogScreen.resx">
<DependentUpon>ErrorLogScreen.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainWindow.resx">
<DependentUpon>MainWindow.cs</DependentUpon>
</EmbeddedResource>
@ -177,6 +197,10 @@
<Project>{2DAFDFC1-223B-4741-87BB-BE3D0A7617DB}</Project>
<Name>ANX.Framework.Content.Pipeline</Name>
</ProjectReference>
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
<Name>ANX.Framework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -0,0 +1,24 @@
using System;
using ANX.Framework.Content.Pipeline;
namespace ANX.ContentCompiler.GUI
{
public class CCompilerBuildLogger : ContentBuildLogger
{
public override void LogImportantMessage(string message, params object[] messageArgs)
{
MainWindow.Instance.ribbonTextBox.AddMessage("[IMPORTANT] " + String.Format(message, messageArgs));
}
public override void LogMessage(string message, params object[] messageArgs)
{
MainWindow.Instance.ribbonTextBox.AddMessage("[Info] " + String.Format(message, messageArgs));
}
public override void LogWarning(string helpLink, ContentIdentity contentIdentity, string message,
params object[] messageArgs)
{
MainWindow.Instance.ribbonTextBox.AddMessage("[WARNING] " + String.Format(message, messageArgs));
}
}
}

View File

@ -0,0 +1,89 @@
namespace ANX.ContentCompiler.GUI.Controls
{
partial class RibbonTextBox
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.buttonDown = new System.Windows.Forms.Button();
this.textBox = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.FlatAppearance.BorderColor = System.Drawing.Color.Gray;
this.buttonDown.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green;
this.buttonDown.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
this.buttonDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonDown.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonDown.ForeColor = System.Drawing.Color.White;
this.buttonDown.Location = new System.Drawing.Point(324, 3);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(23, 73);
this.buttonDown.TabIndex = 1;
this.buttonDown.Text = "V";
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonDownClick);
//
// textBox
//
this.textBox.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.textBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox.ForeColor = System.Drawing.Color.White;
this.textBox.Location = new System.Drawing.Point(3, 3);
this.textBox.Name = "textBox";
this.textBox.ReadOnly = true;
this.textBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
this.textBox.Size = new System.Drawing.Size(315, 73);
this.textBox.TabIndex = 2;
this.textBox.Text = "";
this.textBox.WordWrap = false;
//
// RibbonTextBox
//
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.Controls.Add(this.textBox);
this.Controls.Add(this.buttonDown);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "RibbonTextBox";
this.Size = new System.Drawing.Size(353, 79);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button buttonDown;
private System.Windows.Forms.RichTextBox textBox;
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ANX.ContentCompiler.GUI.Dialogues;
namespace ANX.ContentCompiler.GUI.Controls
{
public partial class RibbonTextBox : UserControl
{
public RibbonTextBox()
{
InitializeComponent();
}
public void AddMessage(string msg)
{
List<string> contents = textBox.Lines.ToList();
contents.Add(msg);
textBox.Lines = contents.ToArray();
}
private void ButtonDownClick(object sender, EventArgs e)
{
using (var dlg = new ErrorLogScreen(textBox.Lines))
{
dlg.ShowDialog();
}
}
}
}

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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,165 @@
namespace ANX.ContentCompiler.GUI.Dialogues
{
partial class ErrorLogScreen
{
/// <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.buttonNext = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.textBox = new System.Windows.Forms.TextBox();
this.labelHeading = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.buttonCancel = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// 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 = "OK";
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.textBox);
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;
//
// textBox
//
this.textBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox.ForeColor = System.Drawing.Color.White;
this.textBox.Location = new System.Drawing.Point(41, 77);
this.textBox.Multiline = true;
this.textBox.Name = "textBox";
this.textBox.ReadOnly = true;
this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox.Size = new System.Drawing.Size(497, 221);
this.textBox.TabIndex = 16;
//
// 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, 36);
this.labelHeading.Name = "labelHeading";
this.labelHeading.Size = new System.Drawing.Size(429, 38);
this.labelHeading.TabIndex = 15;
this.labelHeading.Text = "Here\'s the log of the build process:";
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 = "Build Log";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
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 = "Copy";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick);
//
// ErrorLogScreen
//
this.AcceptButton = this.buttonNext;
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 = "ErrorLogScreen";
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 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 buttonCancel;
private System.Windows.Forms.TextBox textBox;
}
}

View File

@ -0,0 +1,42 @@
using System;
using System.IO;
using System.Windows.Forms;
namespace ANX.ContentCompiler.GUI.Dialogues
{
public partial class ErrorLogScreen : Form
{
public ErrorLogScreen(string[] errorLog)
{
InitializeComponent();
SetUpColors();
textBox.Lines = errorLog;
}
private void SetUpColors()
{
BackColor = Settings.MainColor;
ForeColor = Settings.ForeColor;
button3.FlatAppearance.MouseOverBackColor = Settings.LightMainColor;
buttonCancel.FlatAppearance.MouseOverBackColor = Settings.LightMainColor;
buttonNext.FlatAppearance.MouseOverBackColor = Settings.LightMainColor;
button3.FlatAppearance.MouseDownBackColor = Settings.AccentColor3;
buttonCancel.FlatAppearance.MouseDownBackColor = Settings.AccentColor3;
buttonNext.FlatAppearance.MouseDownBackColor = Settings.AccentColor3;
buttonNext.FlatAppearance.BorderColor = Settings.LightMainColor;
button3.FlatAppearance.BorderColor = Settings.LightMainColor;
buttonCancel.FlatAppearance.BorderColor = Settings.LightMainColor;
}
private void ButtonNextClick(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void ButtonCancelClick(object sender, EventArgs e)
{
Clipboard.SetText(textBox.Text);
buttonCancel.Text = "Copied.";
}
}
}

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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,4 +1,6 @@
namespace ANX.ContentCompiler.GUI.Dialogues
using ANX.ContentCompiler.GUI.Properties;
namespace ANX.ContentCompiler.GUI.Dialogues
{
partial class FirstStartScreen
{
@ -124,7 +126,7 @@
//
// pictureBoxArrowLeft
//
this.pictureBoxArrowLeft.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxArrowLeft.Image")));
this.pictureBoxArrowLeft.Image = ((System.Drawing.Image)(Resources.arrow_left));
this.pictureBoxArrowLeft.Location = new System.Drawing.Point(176, 274);
this.pictureBoxArrowLeft.Name = "pictureBoxArrowLeft";
this.pictureBoxArrowLeft.Size = new System.Drawing.Size(118, 114);
@ -134,7 +136,7 @@
//
// pictureBoxArrowRight
//
this.pictureBoxArrowRight.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxArrowRight.Image")));
this.pictureBoxArrowRight.Image = ((System.Drawing.Image)(Resources.arrow_right));
this.pictureBoxArrowRight.Location = new System.Drawing.Point(317, 274);
this.pictureBoxArrowRight.Name = "pictureBoxArrowRight";
this.pictureBoxArrowRight.Size = new System.Drawing.Size(119, 114);

View File

@ -80,7 +80,7 @@
this.textBox.ReadOnly = true;
this.textBox.Size = new System.Drawing.Size(424, 198);
this.textBox.TabIndex = 17;
this.textBox.Text = resources.GetString("textBox.Text");
this.textBox.Text = "";
//
// label2
//

View File

@ -209,6 +209,6 @@
private System.Windows.Forms.Button buttonBrowse;
private System.Windows.Forms.Label labelManualSearch;
public System.Windows.Forms.TextBox textBoxLocation;
private System.Windows.Forms.ListBox listBoxRecentProjects;
public System.Windows.Forms.ListBox listBoxRecentProjects;
}
}

View File

@ -10,6 +10,11 @@ namespace ANX.ContentCompiler.GUI.Dialogues
{
InitializeComponent();
SetUpColors();
listBoxRecentProjects.Items.Clear();
foreach(var project in MainWindow.Instance.RecentProjects)
{
listBoxRecentProjects.Items.Add(project);
}
}
private void SetUpColors()

View File

@ -32,6 +32,13 @@ namespace ANX.ContentCompiler.GUI
{
this.components = new System.ComponentModel.Container();
this.splitContainerMenuLayout = new System.Windows.Forms.SplitContainer();
this.ribbonTextBox = new ANX.ContentCompiler.GUI.Controls.RibbonTextBox();
this.ribbonButtonHelp = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonWeb = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonClean = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonSave = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonLoad = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonNew = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.buttonQuit = new System.Windows.Forms.Button();
this.buttonMenu = new System.Windows.Forms.Button();
this.labelTitle = new System.Windows.Forms.Label();
@ -43,17 +50,11 @@ namespace ANX.ContentCompiler.GUI
this.treeViewItemRename = new System.Windows.Forms.ToolStripMenuItem();
this.treeViewItemDelete = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainerProperties = new System.Windows.Forms.SplitContainer();
this.editingState = new ANX.ContentCompiler.GUI.States.EditingState();
this.startState = new ANX.ContentCompiler.GUI.States.StartState();
this.labelProperties = new System.Windows.Forms.Label();
this.propertyGrid = new System.Windows.Forms.PropertyGrid();
this.menuState = new ANX.ContentCompiler.GUI.States.MenuState();
this.ribbonButtonHelp = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonWeb = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonClean = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonSave = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonLoad = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.ribbonButtonNew = new ANX.ContentCompiler.GUI.Controls.RibbonButton();
this.editingState = new ANX.ContentCompiler.GUI.States.EditingState();
this.startState = new ANX.ContentCompiler.GUI.States.StartState();
((System.ComponentModel.ISupportInitialize)(this.splitContainerMenuLayout)).BeginInit();
this.splitContainerMenuLayout.Panel1.SuspendLayout();
this.splitContainerMenuLayout.Panel2.SuspendLayout();
@ -81,6 +82,7 @@ namespace ANX.ContentCompiler.GUI
//
// splitContainerMenuLayout.Panel1
//
this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonTextBox);
this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonButtonHelp);
this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonButtonWeb);
this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonButtonClean);
@ -98,6 +100,79 @@ namespace ANX.ContentCompiler.GUI
this.splitContainerMenuLayout.SplitterDistance = 99;
this.splitContainerMenuLayout.TabIndex = 0;
//
// ribbonTextBox
//
this.ribbonTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ribbonTextBox.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ribbonTextBox.Location = new System.Drawing.Point(532, 26);
this.ribbonTextBox.Name = "ribbonTextBox";
this.ribbonTextBox.Size = new System.Drawing.Size(320, 70);
this.ribbonTextBox.TabIndex = 9;
//
// ribbonButtonHelp
//
this.ribbonButtonHelp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonHelp.Content = "Help";
this.ribbonButtonHelp.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_question;
this.ribbonButtonHelp.Location = new System.Drawing.Point(299, 26);
this.ribbonButtonHelp.Name = "ribbonButtonHelp";
this.ribbonButtonHelp.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonHelp.TabIndex = 8;
//
// ribbonButtonWeb
//
this.ribbonButtonWeb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonWeb.Content = "Website";
this.ribbonButtonWeb.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_globe;
this.ribbonButtonWeb.Location = new System.Drawing.Point(237, 26);
this.ribbonButtonWeb.Name = "ribbonButtonWeb";
this.ribbonButtonWeb.Size = new System.Drawing.Size(63, 68);
this.ribbonButtonWeb.TabIndex = 7;
//
// ribbonButtonClean
//
this.ribbonButtonClean.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ribbonButtonClean.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonClean.Content = "Clean";
this.ribbonButtonClean.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_clean;
this.ribbonButtonClean.Location = new System.Drawing.Point(186, 26);
this.ribbonButtonClean.Name = "ribbonButtonClean";
this.ribbonButtonClean.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonClean.TabIndex = 6;
//
// ribbonButtonSave
//
this.ribbonButtonSave.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonSave.Content = "Save";
this.ribbonButtonSave.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_save;
this.ribbonButtonSave.Location = new System.Drawing.Point(105, 26);
this.ribbonButtonSave.Name = "ribbonButtonSave";
this.ribbonButtonSave.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonSave.TabIndex = 5;
this.ribbonButtonSave.Click += new System.EventHandler(this.SaveProject);
//
// ribbonButtonLoad
//
this.ribbonButtonLoad.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonLoad.Content = "Open";
this.ribbonButtonLoad.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_folder_open;
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.OpenProjectDialog);
//
// ribbonButtonNew
//
this.ribbonButtonNew.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonNew.Content = "New";
this.ribbonButtonNew.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_page_multiple;
this.ribbonButtonNew.Location = new System.Drawing.Point(3, 26);
this.ribbonButtonNew.Name = "ribbonButtonNew";
this.ribbonButtonNew.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonNew.TabIndex = 3;
this.ribbonButtonNew.Click += new System.EventHandler(this.NewProject);
//
// buttonQuit
//
this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -259,6 +334,26 @@ namespace ANX.ContentCompiler.GUI
this.splitContainerProperties.SplitterDistance = 366;
this.splitContainerProperties.TabIndex = 0;
//
// editingState
//
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.Location = new System.Drawing.Point(0, 0);
this.editingState.Name = "editingState";
this.editingState.Size = new System.Drawing.Size(364, 547);
this.editingState.TabIndex = 1;
this.editingState.Visible = false;
//
// startState
//
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.Location = new System.Drawing.Point(0, 0);
this.startState.Name = "startState";
this.startState.Size = new System.Drawing.Size(364, 547);
this.startState.TabIndex = 0;
this.startState.Visible = false;
//
// labelProperties
//
this.labelProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -307,90 +402,6 @@ namespace ANX.ContentCompiler.GUI
this.menuState.TabIndex = 1;
this.menuState.Visible = false;
//
// ribbonButtonHelp
//
this.ribbonButtonHelp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonHelp.Content = "Help";
this.ribbonButtonHelp.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_question;
this.ribbonButtonHelp.Location = new System.Drawing.Point(299, 26);
this.ribbonButtonHelp.Name = "ribbonButtonHelp";
this.ribbonButtonHelp.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonHelp.TabIndex = 8;
//
// ribbonButtonWeb
//
this.ribbonButtonWeb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonWeb.Content = "Website";
this.ribbonButtonWeb.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_globe;
this.ribbonButtonWeb.Location = new System.Drawing.Point(237, 26);
this.ribbonButtonWeb.Name = "ribbonButtonWeb";
this.ribbonButtonWeb.Size = new System.Drawing.Size(63, 68);
this.ribbonButtonWeb.TabIndex = 7;
//
// ribbonButtonClean
//
this.ribbonButtonClean.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ribbonButtonClean.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonClean.Content = "Clean";
this.ribbonButtonClean.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_clean;
this.ribbonButtonClean.Location = new System.Drawing.Point(186, 26);
this.ribbonButtonClean.Name = "ribbonButtonClean";
this.ribbonButtonClean.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonClean.TabIndex = 6;
//
// ribbonButtonSave
//
this.ribbonButtonSave.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonSave.Content = "Save";
this.ribbonButtonSave.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_save;
this.ribbonButtonSave.Location = new System.Drawing.Point(105, 26);
this.ribbonButtonSave.Name = "ribbonButtonSave";
this.ribbonButtonSave.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonSave.TabIndex = 5;
this.ribbonButtonSave.Click += new System.EventHandler(this.SaveProject);
//
// ribbonButtonLoad
//
this.ribbonButtonLoad.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonLoad.Content = "Open";
this.ribbonButtonLoad.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_folder_open;
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.OpenProjectDialog);
//
// ribbonButtonNew
//
this.ribbonButtonNew.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ribbonButtonNew.Content = "New";
this.ribbonButtonNew.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_page_multiple;
this.ribbonButtonNew.Location = new System.Drawing.Point(3, 26);
this.ribbonButtonNew.Name = "ribbonButtonNew";
this.ribbonButtonNew.Size = new System.Drawing.Size(52, 68);
this.ribbonButtonNew.TabIndex = 3;
this.ribbonButtonNew.Click += new System.EventHandler(this.NewProject);
//
// editingState
//
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.Location = new System.Drawing.Point(0, 0);
this.editingState.Name = "editingState";
this.editingState.Size = new System.Drawing.Size(364, 547);
this.editingState.TabIndex = 1;
this.editingState.Visible = false;
//
// startState
//
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.Location = new System.Drawing.Point(0, 0);
this.startState.Name = "startState";
this.startState.Size = new System.Drawing.Size(364, 547);
this.startState.TabIndex = 0;
this.startState.Visible = false;
//
// MainWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -450,6 +461,7 @@ namespace ANX.ContentCompiler.GUI
private EditingState editingState;
private MenuState menuState;
private System.Windows.Forms.Button buttonMenu;
public Controls.RibbonTextBox ribbonTextBox;
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using ANX.ContentCompiler.GUI.Dialogues;
using ANX.Framework.Content.Pipeline;
@ -32,6 +33,7 @@ namespace ANX.ContentCompiler.GUI
public String ProjectFolder { get; set; }
public String ProjectOutputDir { get; set; }
public String ProjectImportersDir { get; set; }
public RecentProjects RecentProjects { get; set; }
#endregion
#region Init
@ -44,9 +46,14 @@ namespace ANX.ContentCompiler.GUI
{
Settings.Defaults();
Settings.Save(SettingsFile);
RecentProjects = new RecentProjects();
RecentProjects.Save();
}
else
{
Settings.Load(SettingsFile);
RecentProjects = RecentProjects.Load();
}
treeViewItemAddFolder.MouseEnter += TreeViewItemMouseEnter;
treeViewItemAddFolder.MouseLeave += TreeViewItemeLeave;
treeViewItemDelete.MouseEnter += TreeViewItemMouseEnter;
@ -120,16 +127,21 @@ namespace ANX.ContentCompiler.GUI
{
using (var dlg = new OpenProjectScreen())
{
if (dlg.ShowDialog() == DialogResult.OK)
{
if (dlg.ShowDialog() != DialogResult.OK) return;
if (dlg.listBoxRecentProjects.SelectedItem == null)
OpenProject(dlg.textBoxLocation.Text);
}
else
OpenProject((string)dlg.listBoxRecentProjects.SelectedItem);
}
}
public void OpenProject(string path)
{
if (!File.Exists(path))
throw new FileNotFoundException("No file found at the given location:", path);
{
MessageBox.Show("No file found at this location: " + path, "Project not found");
return;
}
_contentProject = ContentProject.Load(path);
ProjectName = _contentProject.Name;
ProjectOutputDir = _contentProject.OutputDirectory;
@ -150,6 +162,9 @@ namespace ANX.ContentCompiler.GUI
SaveProjectAs(sender, e);
_contentProject.Save(ProjectPath);
if (RecentProjects.Contains(ProjectPath))
RecentProjects.Remove(ProjectPath);
RecentProjects.Add(ProjectPath);
}
#endregion
@ -170,6 +185,55 @@ namespace ANX.ContentCompiler.GUI
}
#endregion
#region BuildProject
public void BuildProject(object sender, EventArgs e)
{
DisableUI();
BuildContent builderTask = new BuildContent();
builderTask.BuildLogger = new CCompilerBuildLogger();
builderTask.OutputDirectory = _contentProject.OutputDirectory;
builderTask.TargetPlatform = _contentProject.Platform;
builderTask.TargetProfile = _contentProject.Profile;
builderTask.CompressContent = false;
try
{
builderTask.Execute(_contentProject.BuildItems);
}
catch(Exception ex)
{
ribbonTextBox.AddMessage("[ERROR] " + ex.ToString() + "\n Stack: " + ex.StackTrace);
EnableUI();
}
EnableUI();
}
private void DisableUI()
{
buttonMenu.Enabled = false;
buttonQuit.Enabled = false;
editingState.Enabled = false;
treeView.Enabled = false;
propertyGrid.Enabled = false;
ribbonButtonNew.Enabled = false;
ribbonButtonSave.Enabled = false;
ribbonButtonLoad.Enabled = false;
ribbonButtonClean.Enabled = false;
}
private void EnableUI()
{
buttonMenu.Enabled = true;
buttonQuit.Enabled = true;
editingState.Enabled = true;
treeView.Enabled = true;
propertyGrid.Enabled = true;
ribbonButtonNew.Enabled = true;
ribbonButtonSave.Enabled = true;
ribbonButtonLoad.Enabled = true;
ribbonButtonClean.Enabled = true;
}
#endregion
#region FileMethods
private void AddFile(string file)
{
@ -180,15 +244,13 @@ namespace ANX.ContentCompiler.GUI
var node = treeView.SelectedNode;
if (node != null)
folder = node.Name;
else
node = treeView.Nodes[0];
var absPath = ProjectFolder + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + Path.GetFileName(file);
if (!Directory.Exists(Path.Combine(ProjectFolder, folder)))
Directory.CreateDirectory(Path.Combine(ProjectFolder, folder));
File.Copy(file, absPath, true);
var item = new BuildItem
{
AssetName = !String.IsNullOrEmpty(folder) ? folder.Replace(_contentProject.ContentRoot + Path.DirectorySeparatorChar, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file) : Path.GetFileNameWithoutExtension(file),
AssetName = folder.Equals(_contentProject.ContentRoot) ? Path.GetFileNameWithoutExtension(file) : folder.Replace(_contentProject.ContentRoot + Path.DirectorySeparatorChar, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file),
SourceFilename = absPath,
OutputFilename = ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + Path.GetFileName(file),
ImporterName = ImporterManager.GuessImporterByFileExtension(file)
@ -430,6 +492,7 @@ namespace ANX.ContentCompiler.GUI
private void MainWindowFormClosed(object sender, FormClosedEventArgs e)
{
Settings.Save(SettingsFile);
RecentProjects.Save();
}
private void MainWindowFormClosing(object sender, FormClosingEventArgs e)

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace ANX.ContentCompiler.GUI
{
public class RecentProjects : List<String>
{
private static readonly string Path =
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + System.IO.Path.DirectorySeparatorChar + "ANX Content Compiler" + System.IO.Path.DirectorySeparatorChar + "recentProjects.ees";
public RecentProjects()
: base(10)
{
}
public void Save()
{
XmlWriter writer = XmlWriter.Create(Path,
new XmlWriterSettings
{
Encoding = Encoding.UTF8,
Indent = true,
NewLineHandling = NewLineHandling.Entitize
});
writer.WriteStartDocument();
writer.WriteStartElement("RecentProjects");
foreach (string project in this)
{
writer.WriteStartElement("ContentProject");
writer.WriteValue(project);
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
public static RecentProjects Load()
{
var instance = new RecentProjects();
XmlReader reader = XmlReader.Create(Path);
while (!reader.EOF)
{
if (reader.Name == "ContentProject")
instance.Add(reader.ReadElementContentAsString());
reader.Read();
}
reader.Close();
return instance;
}
}
}

View File

@ -95,7 +95,7 @@ namespace ANX.ContentCompiler.GUI
if (!Directory.Exists(Path.GetDirectoryName(path)))
Directory.CreateDirectory(Path.GetDirectoryName(path));
XmlWriter writer = new XmlTextWriter(path, Encoding.Unicode);
XmlWriter writer = XmlWriter.Create(path, new XmlWriterSettings() { Encoding = Encoding.UTF8, Indent = true, NewLineHandling = NewLineHandling.Entitize });
writer.WriteStartDocument();
writer.WriteStartElement("CCompiler4Settings");
writer.WriteStartElement("MainColor");

View File

@ -96,6 +96,7 @@
this.arrowButtonBuild.Name = "arrowButtonBuild";
this.arrowButtonBuild.Size = new System.Drawing.Size(348, 64);
this.arrowButtonBuild.TabIndex = 8;
this.arrowButtonBuild.Click += new System.EventHandler(this.ArrowButtonBuildClick);
//
// EditingState
//

View File

@ -39,5 +39,10 @@ namespace ANX.ContentCompiler.GUI.States
}
}
private void ArrowButtonBuildClick(object sender, EventArgs e)
{
MainWindow.Instance.BuildProject(sender, e);
}
}
}

View File

@ -263,7 +263,7 @@
this.labelOpenDesc.Name = "labelOpenDesc";
this.labelOpenDesc.Size = new System.Drawing.Size(687, 70);
this.labelOpenDesc.TabIndex = 3;
this.labelOpenDesc.Text = resources.GetString("labelOpenDesc.Text");
this.labelOpenDesc.Text = "If you want to import Content Projects from XNA or previous Content Compiler versions, you can do that by clicking the import button.";
//
// arrowButtonImport
//