Content Compiler:

- Added missing FakeBuildLogger.cs
- changed the preview implementation to support previewing while working in the main window (handy for multiple screens!)
- Did some cleaning and added #region tags and copyright text
This commit is contained in:
SND\eagleeyestudios_cp 2012-10-19 20:04:05 +00:00 committed by Konstantin Koch
parent 93c729e31f
commit 01cac2c358
23 changed files with 335 additions and 91 deletions

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using ANX.Framework.Content.Pipeline; using ANX.Framework.Content.Pipeline;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI namespace ANX.ContentCompiler.GUI
{ {

View File

@ -1,7 +1,14 @@
using System; #region Using Statements
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Controls namespace ANX.ContentCompiler.GUI.Controls
{ {
@ -15,13 +22,16 @@ namespace ANX.ContentCompiler.GUI.Controls
InitializeComponent(); InitializeComponent();
} }
#region Properties
[EditorBrowsable(EditorBrowsableState.Always)] [EditorBrowsable(EditorBrowsableState.Always)]
public String Content public String Content
{ {
get { return labelText.Text; } get { return labelText.Text; }
set { labelText.Text = value; } set { labelText.Text = value; }
} }
#endregion
#region Private
private void ArrowButtonMouseEnter(object sender, EventArgs e) private void ArrowButtonMouseEnter(object sender, EventArgs e)
{ {
BorderStyle = BorderStyle.FixedSingle; BorderStyle = BorderStyle.FixedSingle;
@ -62,5 +72,6 @@ namespace ANX.ContentCompiler.GUI.Controls
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
ForeColor = Settings.ForeColor; ForeColor = Settings.ForeColor;
} }
#endregion
} }
} }

View File

@ -1,8 +1,15 @@
using System; #region Using Statements
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Controls namespace ANX.ContentCompiler.GUI.Controls
{ {
@ -11,25 +18,31 @@ namespace ANX.ContentCompiler.GUI.Controls
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class RibbonButton : UserControl public partial class RibbonButton : UserControl
{ {
#region Constructor
public RibbonButton() public RibbonButton()
{ {
InitializeComponent(); InitializeComponent();
} }
#endregion
[Category("Content"), Description("Text der auf dem Button gezeigt werden soll.")] #region Properties
[Category("Content"), Description("Text that will be displayed on the button.")]
public String Content public String Content
{ {
get { return labelText.Text; } get { return labelText.Text; }
set { labelText.Text = value; } set { labelText.Text = value; }
} }
[Category("Design"), Description("Das Bild, das als Icon dienen soll. (60x60)")] [Category("Design"), Description("Picture that will be the icon. (60x60)")]
public Image Image public Image Image
{ {
get { return pictureBox.Image; } get { return pictureBox.Image; }
set { pictureBox.Image = value; } set { pictureBox.Image = value; }
} }
#endregion
#region Private
private void RibbonButtonMouseEnter(object sender, EventArgs e) private void RibbonButtonMouseEnter(object sender, EventArgs e)
{ {
BackColor = Settings.LightMainColor; BackColor = Settings.LightMainColor;
@ -62,5 +75,6 @@ namespace ANX.ContentCompiler.GUI.Controls
ForeColor = Settings.ForeColor; ForeColor = Settings.ForeColor;
Refresh(); Refresh();
} }
#endregion
} }
} }

View File

@ -1,9 +1,16 @@
using System; #region Using Statements
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.ContentCompiler.GUI.Dialogues; using ANX.ContentCompiler.GUI.Dialogues;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Controls namespace ANX.ContentCompiler.GUI.Controls
{ {
@ -12,18 +19,23 @@ namespace ANX.ContentCompiler.GUI.Controls
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class RibbonTextBox : UserControl public partial class RibbonTextBox : UserControl
{ {
#region Constructor
public RibbonTextBox() public RibbonTextBox()
{ {
InitializeComponent(); InitializeComponent();
} }
#endregion
#region Public
public void AddMessage(string msg) public void AddMessage(string msg)
{ {
List<string> contents = textBox.Lines.ToList(); List<string> contents = textBox.Lines.ToList();
contents.Add(msg); contents.Add(msg);
textBox.Lines = contents.ToArray(); textBox.Lines = contents.ToArray();
} }
#endregion
#region Private
private void ButtonDownClick(object sender, EventArgs e) private void ButtonDownClick(object sender, EventArgs e)
{ {
using (var dlg = new ErrorLogScreen(textBox.Lines)) using (var dlg = new ErrorLogScreen(textBox.Lines))
@ -31,5 +43,6 @@ namespace ANX.ContentCompiler.GUI.Controls
dlg.ShowDialog(); dlg.ShowDialog();
} }
} }
#endregion
} }
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -9,13 +16,16 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class ErrorLogScreen : Form public partial class ErrorLogScreen : Form
{ {
#region Constructor
public ErrorLogScreen(string[] errorLog) public ErrorLogScreen(string[] errorLog)
{ {
InitializeComponent(); InitializeComponent();
SetUpColors(); SetUpColors();
textBox.Lines = errorLog; textBox.Lines = errorLog;
} }
#endregion
#region Private Methods
private void SetUpColors() private void SetUpColors()
{ {
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
@ -31,6 +41,7 @@ namespace ANX.ContentCompiler.GUI.Dialogues
buttonCancel.FlatAppearance.BorderColor = Settings.LightMainColor; buttonCancel.FlatAppearance.BorderColor = Settings.LightMainColor;
} }
#region Events
private void ButtonNextClick(object sender, EventArgs e) private void ButtonNextClick(object sender, EventArgs e)
{ {
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
@ -41,5 +52,7 @@ namespace ANX.ContentCompiler.GUI.Dialogues
Clipboard.SetText(textBox.Text); Clipboard.SetText(textBox.Text);
buttonCancel.Text = "Copied."; buttonCancel.Text = "Copied.";
} }
#endregion
#endregion
} }
} }

View File

@ -1,13 +1,21 @@
using System.Windows.Forms; #region Using Statements
using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
[Developer("SilentWarrior/Eagle Eye Studios")] [Developer("SilentWarrior/Eagle Eye Studios")]
[PercentageComplete(100)] //TODO: Implement tour in MainWindow and launch it from here! [PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class FirstStartScreen : Form public partial class FirstStartScreen : Form
{ {
#region Constructor
public FirstStartScreen() public FirstStartScreen()
{ {
InitializeComponent(); InitializeComponent();
@ -20,10 +28,13 @@ namespace ANX.ContentCompiler.GUI.Dialogues
button2.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; button2.FlatAppearance.MouseDownBackColor = Settings.AccentColor3;
button3.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; button3.FlatAppearance.MouseDownBackColor = Settings.AccentColor3;
} }
#endregion
#region Private Methods
private void Button2Click(object sender, System.EventArgs e) private void Button2Click(object sender, System.EventArgs e)
{ {
MainWindow.Instance.StartShow(); MainWindow.Instance.StartShow();
} }
#endregion
} }
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -9,12 +16,15 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class NewFolderScreen : Form public partial class NewFolderScreen : Form
{ {
#region Constructor
public NewFolderScreen() public NewFolderScreen()
{ {
InitializeComponent(); InitializeComponent();
SetUpColors(); SetUpColors();
} }
#endregion
#region Private Methods
private void SetUpColors() private void SetUpColors()
{ {
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
@ -40,5 +50,6 @@ namespace ANX.ContentCompiler.GUI.Dialogues
else else
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
#endregion
} }
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -9,12 +16,15 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.InProgress)] [TestState(TestStateAttribute.TestState.InProgress)]
public partial class NewProjectImportersScreen : Form public partial class NewProjectImportersScreen : Form
{ {
#region Constructor
public NewProjectImportersScreen() public NewProjectImportersScreen()
{ {
InitializeComponent(); InitializeComponent();
SetUpColors(); SetUpColors();
} }
#endregion
#region Private Methods
private void SetUpColors() private void SetUpColors()
{ {
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
@ -71,5 +81,6 @@ namespace ANX.ContentCompiler.GUI.Dialogues
else else
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
#endregion
} }
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -9,12 +16,15 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.InProgress)] [TestState(TestStateAttribute.TestState.InProgress)]
public partial class NewProjectOutputScreen : Form public partial class NewProjectOutputScreen : Form
{ {
#region Constructor
public NewProjectOutputScreen() public NewProjectOutputScreen()
{ {
InitializeComponent(); InitializeComponent();
SetUpColors(); SetUpColors();
} }
#endregion
#region Private Methods
private void ArrowButtonYesClick(object sender, EventArgs e) private void ArrowButtonYesClick(object sender, EventArgs e)
{ {
labelLocation.Visible = true; labelLocation.Visible = true;
@ -63,5 +73,6 @@ namespace ANX.ContentCompiler.GUI.Dialogues
} }
DialogResult = DialogResult.None; DialogResult = DialogResult.None;
} }
#endregion
} }
} }

View File

@ -1,7 +1,14 @@
using System; #region Using Statements
using System;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -10,13 +17,16 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class NewProjectScreen : Form public partial class NewProjectScreen : Form
{ {
#region Constructor
public NewProjectScreen() public NewProjectScreen()
{ {
InitializeComponent(); InitializeComponent();
textBoxLocation.Text = Settings.DefaultProjectPath; textBoxLocation.Text = Settings.DefaultProjectPath;
SetUpColors(); SetUpColors();
} }
#endregion
#region Private Methods
private void SetUpColors() private void SetUpColors()
{ {
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
@ -69,5 +79,7 @@ namespace ANX.ContentCompiler.GUI.Dialogues
else else
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
#endregion
} }
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -9,6 +16,7 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.InProgress)] [TestState(TestStateAttribute.TestState.InProgress)]
public partial class NewProjectSummaryScreen : Form public partial class NewProjectSummaryScreen : Form
{ {
#region Contructor
public NewProjectSummaryScreen(String projectName, String projectDir, String outputDir, bool customImporters, public NewProjectSummaryScreen(String projectName, String projectDir, String outputDir, bool customImporters,
String customImportersDir, int customImportersFound, int customProcessorsFound) String customImportersDir, int customImportersFound, int customProcessorsFound)
{ {
@ -31,7 +39,9 @@ namespace ANX.ContentCompiler.GUI.Dialogues
"Processors: " + customProcessorsFound; "Processors: " + customProcessorsFound;
} }
} }
#endregion
#region Private Methods
private void SetUpColors() private void SetUpColors()
{ {
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
@ -50,5 +60,6 @@ namespace ANX.ContentCompiler.GUI.Dialogues
{ {
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
#endregion
} }
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
@ -9,6 +16,7 @@ namespace ANX.ContentCompiler.GUI.Dialogues
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public partial class OpenProjectScreen : Form public partial class OpenProjectScreen : Form
{ {
#region Constructor
public OpenProjectScreen() public OpenProjectScreen()
{ {
InitializeComponent(); InitializeComponent();
@ -19,7 +27,9 @@ namespace ANX.ContentCompiler.GUI.Dialogues
listBoxRecentProjects.Items.Add(project); listBoxRecentProjects.Items.Add(project);
} }
} }
#endregion
#region Private Methods
private void SetUpColors() private void SetUpColors()
{ {
BackColor = Settings.MainColor; BackColor = Settings.MainColor;
@ -65,5 +75,6 @@ namespace ANX.ContentCompiler.GUI.Dialogues
else else
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
#endregion
} }
} }

View File

@ -100,9 +100,8 @@
this.Name = "PreviewScreen"; this.Name = "PreviewScreen";
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Preview"; this.Text = "Preview";
this.Load += new System.EventHandler(this.PreviewScreenLoad);
this.drawSurface.ResumeLayout(false); this.drawSurface.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -1,30 +1,35 @@
using System; #region Using Statements
using System.Collections.Generic; using System;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.Content;
using ANX.Framework.Content.Pipeline; using ANX.Framework.Content.Pipeline;
using ANX.Framework.Content.Pipeline.Tasks; using ANX.Framework.Content.Pipeline.Tasks;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.Development;
using Timer = System.Windows.Forms.Timer; using Timer = System.Windows.Forms.Timer;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.Dialogues namespace ANX.ContentCompiler.GUI.Dialogues
{ {
[PercentageComplete(50)]
[Developer("SilentWarrior/Eagle Eye Studios")]
[TestState(TestStateAttribute.TestState.InProgress)]
public partial class PreviewScreen : Form public partial class PreviewScreen : Form
{ {
#region Fields #region Fields
private Point _lastPos; private Point _lastPos;
private bool _mouseDown; private bool _mouseDown;
private readonly BuildItem _item; private BuildItem _item;
private Thread _loaderThread; private Thread _loaderThread;
private readonly string _outputFile; private string _outputFile;
private readonly string _outputDir; private string _outputDir;
private volatile bool _started; private volatile bool _started;
private volatile bool _error; private volatile bool _error;
private volatile string _errorMessage; private volatile string _errorMessage;
@ -35,12 +40,10 @@ namespace ANX.ContentCompiler.GUI.Dialogues
private SpriteBatch _batch; private SpriteBatch _batch;
#endregion #endregion
public PreviewScreen(BuildItem item) #region Constructor
public PreviewScreen()
{ {
InitializeComponent(); InitializeComponent();
_item = item;
_outputFile = Path.GetTempFileName();
_outputDir = Path.GetTempPath();
_graphicsDevice = new GraphicsDevice( _graphicsDevice = new GraphicsDevice(
GraphicsAdapter.DefaultAdapter, GraphicsAdapter.DefaultAdapter,
GraphicsProfile.HiDef, GraphicsProfile.HiDef,
@ -53,6 +56,7 @@ namespace ANX.ContentCompiler.GUI.Dialogues
PresentationInterval = PresentInterval.Default, PresentationInterval = PresentInterval.Default,
}); });
} }
#endregion
#region WindowMoveMethods #region WindowMoveMethods
@ -79,12 +83,54 @@ namespace ANX.ContentCompiler.GUI.Dialogues
#endregion #endregion
#region Events
private void ButtonQuitClick(object sender, EventArgs e) private void ButtonQuitClick(object sender, EventArgs e)
{ {
Close(); Close();
DialogResult = DialogResult.Cancel; DialogResult = DialogResult.Cancel;
} }
void CheckThread(object sender, EventArgs e)
{
if (!_started)
{
((Timer)sender).Interval = 100;
_loaderThread = new Thread(CompileFile);
_loaderThread.Start();
_started = true;
}
else
{
if (_loaderThread.IsAlive)
return;
if (_error)
{
labelStatus.Text = "Loading of Preview failed with: \n" + _errorMessage;
return;
}
labelStatus.Text = "Loading successful";
labelStatus.Hide();
_tickTimer = new Timer { Interval = 120 };
_tickTimer.Tick += Tick;
_batch = new SpriteBatch(_graphicsDevice);
_tickTimer.Start();
}
}
void Tick(object sender, EventArgs e)
{
_graphicsDevice.Clear(Framework.Color.CornflowerBlue);
if (_processor == "TextureProcessor")
{
_batch.Begin();
_batch.End();
}
}
#endregion
#region Public methods
public void CompileFile() public void CompileFile()
{ {
var builderTask = new BuildContent var builderTask = new BuildContent
@ -117,49 +163,16 @@ namespace ANX.ContentCompiler.GUI.Dialogues
} }
} }
private void PreviewScreenLoad(object sender, EventArgs e) public void SetFile(BuildItem item)
{ {
_checkTimer = new Timer {Interval = 1000}; labelStatus.Text = "Loading Preview...";
_item = item;
_outputFile = Path.GetTempFileName();
_outputDir = Path.GetTempPath();
_checkTimer = new Timer { Interval = 1000 };
_checkTimer.Tick += CheckThread; _checkTimer.Tick += CheckThread;
_checkTimer.Start(); _checkTimer.Start();
} }
#endregion
void CheckThread(object sender, EventArgs e)
{
if (!_started)
{
((Timer) sender).Interval = 100;
_loaderThread = new Thread(CompileFile);
_loaderThread.Start();
_started = true;
}
else
{
if (_loaderThread.IsAlive)
return;
if (_error)
{
labelStatus.Text = "Loading of Preview failed with: \n" + _errorMessage;
return;
}
labelStatus.Text = "Loading successful";
labelStatus.Hide();
_tickTimer = new Timer {Interval = 120};
_tickTimer.Tick += Tick;
_batch = new SpriteBatch(_graphicsDevice);
_tickTimer.Start();
}
}
void Tick(object sender, EventArgs e)
{
_graphicsDevice.Clear(Framework.Color.CornflowerBlue);
if (_processor == "TextureProcessor")
{
_batch.Begin();
_batch.End();
}
}
} }
} }

View File

@ -0,0 +1,35 @@
using ANX.Framework.Content.Pipeline;
using ANX.Framework.NonXNA.Development;
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI
{
[PercentageComplete(100)]
[Developer("SilentWarrior/Eagle Eye Studios")]
[TestState(TestStateAttribute.TestState.Tested)]
public class FakeBuildLogger : ContentBuildLogger
{
#region Overrides of ContentBuildLogger
public override void LogImportantMessage(string message, params object[] messageArgs)
{
}
public override void LogMessage(string message, params object[] messageArgs)
{
}
public override void LogWarning(string helpLink, ContentIdentity contentIdentity, string message, params object[] messageArgs)
{
}
#endregion
}
}

View File

@ -1,5 +1,5 @@
using System; #region Using Statements
using System.Collections.Generic; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
@ -10,6 +10,12 @@ using ANX.ContentCompiler.GUI.Properties;
using ANX.Framework.Content.Pipeline; using ANX.Framework.Content.Pipeline;
using ANX.Framework.Content.Pipeline.Tasks; using ANX.Framework.Content.Pipeline.Tasks;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI namespace ANX.ContentCompiler.GUI
{ {
@ -35,8 +41,9 @@ namespace ANX.ContentCompiler.GUI
private readonly string[] _args; private readonly string[] _args;
private int _showCounter = 0; private int _showCounter = 0;
private ImporterManager iManager; private readonly ImporterManager _iManager;
private ProcessorManager pManager; private readonly ProcessorManager _pManager;
private PreviewScreen _previewScreen;
#endregion #endregion
#region Properties #region Properties
@ -78,8 +85,8 @@ namespace ANX.ContentCompiler.GUI
treeViewItemDelete.MouseEnter += TreeViewItemMouseEnter; treeViewItemDelete.MouseEnter += TreeViewItemMouseEnter;
treeViewItemRename.MouseEnter += TreeViewItemMouseEnter; treeViewItemRename.MouseEnter += TreeViewItemMouseEnter;
SetUpColors(); SetUpColors();
iManager = new ImporterManager(); _iManager = new ImporterManager();
pManager = new ProcessorManager(); _pManager = new ProcessorManager();
} }
private void MainWindowShown(object sender, EventArgs e) private void MainWindowShown(object sender, EventArgs e)
@ -273,7 +280,7 @@ namespace ANX.ContentCompiler.GUI
if (String.IsNullOrEmpty(bI.ProcessorName)) if (String.IsNullOrEmpty(bI.ProcessorName))
{ {
bI.ProcessorName = pManager.GetProcessorForImporter(iManager.GetInstance(bI.ImporterName)); bI.ProcessorName = _pManager.GetProcessorForImporter(_iManager.GetInstance(bI.ImporterName));
} }
} }
try try
@ -352,7 +359,7 @@ namespace ANX.ContentCompiler.GUI
ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(file) + ".xnb", //<- Change this if you want some other extension (i.e. to annoy modders or whatever) Path.GetFileNameWithoutExtension(file) + ".xnb", //<- Change this if you want some other extension (i.e. to annoy modders or whatever)
ImporterName = ImporterManager.GuessImporterByFileExtension(file), ImporterName = ImporterManager.GuessImporterByFileExtension(file),
ProcessorName = pManager.GetProcessorForImporter(iManager.GetInstance(ImporterManager.GuessImporterByFileExtension(file))) ProcessorName = _pManager.GetProcessorForImporter(_iManager.GetInstance(ImporterManager.GuessImporterByFileExtension(file)))
}; };
_contentProject.BuildItems.Add(item); _contentProject.BuildItems.Add(item);
} }
@ -687,6 +694,11 @@ namespace ANX.ContentCompiler.GUI
buildItem => buildItem.AssetName.Equals(treeView.SelectedNode.Name))) buildItem => buildItem.AssetName.Equals(treeView.SelectedNode.Name)))
{ {
propertyGrid.SelectedObject = buildItem; propertyGrid.SelectedObject = buildItem;
if (_previewScreen != null)
{
_previewScreen.SetFile(buildItem);
}
} }
} }
} }
@ -882,11 +894,11 @@ namespace ANX.ContentCompiler.GUI
buildItem = item; buildItem = item;
} }
using (var preview = new PreviewScreen(buildItem)) if (_previewScreen == null)
{ _previewScreen = new PreviewScreen();
if ((string)treeView.SelectedNode.Tag == "File") if ((string) treeView.SelectedNode.Tag != "File") return;
preview.ShowDialog(); _previewScreen.Show();
} _previewScreen.SetFile(buildItem);
} }
#endregion #endregion
} }

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI namespace ANX.ContentCompiler.GUI
{ {

View File

@ -1,9 +1,16 @@
using System; #region Using Statements
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI namespace ANX.ContentCompiler.GUI
{ {

View File

@ -1,10 +1,17 @@
using System; #region Using Statements
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI namespace ANX.ContentCompiler.GUI
{ {

View File

@ -1,7 +1,14 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.ContentCompiler.GUI.Dialogues; using ANX.ContentCompiler.GUI.Dialogues;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.States namespace ANX.ContentCompiler.GUI.States
{ {

View File

@ -1,8 +1,15 @@
using System; #region Using Statements
using System;
using System.Reflection; using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.ContentCompiler.GUI.Dialogues; using ANX.ContentCompiler.GUI.Dialogues;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.States namespace ANX.ContentCompiler.GUI.States
{ {

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI.States namespace ANX.ContentCompiler.GUI.States
{ {

View File

@ -1,6 +1,13 @@
using System; #region Using Statements
using System;
using System.Windows.Forms; using System.Windows.Forms;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
#endregion
// This file is part of the EES Content Compiler 4,
// © 2008 - 2012 by Eagle Eye Studios.
// The EES Content Compiler 4 is released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.ContentCompiler.GUI namespace ANX.ContentCompiler.GUI
{ {