2012-08-26 19:03:12 +00:00
|
|
|
|
using System;
|
2012-09-01 16:30:35 +00:00
|
|
|
|
using System.Collections.Generic;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
2012-09-01 16:30:35 +00:00
|
|
|
|
using System.Linq;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using ANX.ContentCompiler.GUI.Dialogues;
|
2012-08-29 19:02:13 +00:00
|
|
|
|
using ANX.Framework.Content.Pipeline;
|
|
|
|
|
using ANX.Framework.Content.Pipeline.Tasks;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
|
|
|
|
|
namespace ANX.ContentCompiler.GUI
|
|
|
|
|
{
|
|
|
|
|
public partial class MainWindow : Form
|
|
|
|
|
{
|
|
|
|
|
#region Fields
|
|
|
|
|
public static String DefaultOutputPath = "bin";
|
2012-08-28 21:14:49 +00:00
|
|
|
|
public static String SettingsFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ANX Content Compiler" + Path.DirectorySeparatorChar + "settings.ees");
|
2012-08-26 19:03:12 +00:00
|
|
|
|
|
2012-08-27 19:09:10 +00:00
|
|
|
|
private Point _lastPos;
|
|
|
|
|
private bool _mouseDown;
|
|
|
|
|
private bool _menuMode;
|
|
|
|
|
private readonly bool _firstStart = true;
|
2012-08-29 19:02:13 +00:00
|
|
|
|
|
|
|
|
|
private ContentProject _contentProject;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Properties
|
|
|
|
|
public static MainWindow Instance { get; private set; }
|
|
|
|
|
|
|
|
|
|
public String ProjectName { get; set; }
|
|
|
|
|
public String ProjectPath { get; set; }
|
|
|
|
|
public String ProjectFolder { get; set; }
|
|
|
|
|
public String ProjectOutputDir { get; set; }
|
|
|
|
|
public String ProjectImportersDir { get; set; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-08-27 19:09:10 +00:00
|
|
|
|
#region Init
|
2012-08-26 19:03:12 +00:00
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
Instance = this;
|
2012-08-27 19:09:10 +00:00
|
|
|
|
_firstStart = !File.Exists(SettingsFile);
|
|
|
|
|
if (_firstStart)
|
2012-08-28 21:14:49 +00:00
|
|
|
|
{
|
2012-08-27 19:09:10 +00:00
|
|
|
|
Settings.Defaults();
|
2012-08-28 21:14:49 +00:00
|
|
|
|
Settings.Save(SettingsFile);
|
|
|
|
|
}
|
2012-08-27 19:09:10 +00:00
|
|
|
|
else
|
|
|
|
|
Settings.Load(SettingsFile);
|
2012-08-26 19:03:12 +00:00
|
|
|
|
treeViewItemAddFolder.MouseEnter += TreeViewItemMouseEnter;
|
|
|
|
|
treeViewItemAddFolder.MouseLeave += TreeViewItemeLeave;
|
|
|
|
|
treeViewItemDelete.MouseEnter += TreeViewItemMouseEnter;
|
|
|
|
|
treeViewItemRename.MouseEnter += TreeViewItemMouseEnter;
|
2012-08-27 19:09:10 +00:00
|
|
|
|
SetUpColors();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MainWindowShown(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (_firstStart)
|
|
|
|
|
ShowFirstStartStuff();
|
|
|
|
|
ChangeEnvironmentStartState();
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region NewProject
|
2012-08-29 15:57:35 +00:00
|
|
|
|
public void NewProject(object sender, EventArgs e)
|
2012-08-26 19:03:12 +00:00
|
|
|
|
{
|
|
|
|
|
using (var dlg = new NewProjectScreen())
|
|
|
|
|
{
|
|
|
|
|
if (dlg.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
ProjectName = dlg.textBoxName.Text;
|
2012-08-27 19:09:10 +00:00
|
|
|
|
ProjectFolder = !String.IsNullOrEmpty(dlg.textBoxLocation.Text) ? dlg.textBoxLocation.Text : Path.Combine(Settings.DefaultProjectPath, ProjectName);
|
2012-08-29 19:02:13 +00:00
|
|
|
|
ProjectPath = Path.Combine(ProjectFolder, ProjectName + ".cproj");
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
using (var dlg2 = new NewProjectOutputScreen())
|
|
|
|
|
{
|
|
|
|
|
if (dlg2.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
ProjectOutputDir = !String.IsNullOrEmpty(dlg2.textBoxLocation.Text) ? dlg2.textBoxLocation.Text : Path.Combine(ProjectFolder, DefaultOutputPath);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
using (var dlg3 = new NewProjectImportersScreen())
|
|
|
|
|
{
|
|
|
|
|
if (dlg3.ShowDialog() == DialogResult.OK)
|
|
|
|
|
ProjectImportersDir = dlg3.textBoxLocation.Text;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var importersEnabled = !String.IsNullOrEmpty(ProjectImportersDir);
|
|
|
|
|
var importers = 0;
|
|
|
|
|
var processors = 0;
|
|
|
|
|
|
|
|
|
|
using (var dlg4 = new NewProjectSummaryScreen(ProjectName, ProjectFolder, ProjectOutputDir, importersEnabled, ProjectImportersDir, importers, processors))
|
|
|
|
|
{
|
|
|
|
|
dlg4.ShowDialog();
|
|
|
|
|
}
|
2012-08-29 19:02:13 +00:00
|
|
|
|
_contentProject = new ContentProject(ProjectName)
|
|
|
|
|
{
|
|
|
|
|
OutputDirectory = ProjectOutputDir,
|
2012-09-01 16:30:35 +00:00
|
|
|
|
InputDirectory = ProjectFolder,
|
2012-08-29 19:02:13 +00:00
|
|
|
|
Configuration = "Release",
|
|
|
|
|
Creator = "ANX Content Compiler (4.0)",
|
|
|
|
|
ContentRoot = "Content",
|
|
|
|
|
Platform = TargetPlatform.Windows
|
|
|
|
|
};
|
2012-08-26 19:03:12 +00:00
|
|
|
|
ChangeEnvironmentOpenProject();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-08-28 21:14:49 +00:00
|
|
|
|
#region OpenProject
|
2012-08-30 22:02:16 +00:00
|
|
|
|
public void OpenProjectDialog(object sender, EventArgs e)
|
2012-08-28 21:14:49 +00:00
|
|
|
|
{
|
|
|
|
|
using (var dlg = new OpenProjectScreen())
|
|
|
|
|
{
|
|
|
|
|
if (dlg.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
2012-08-30 22:02:16 +00:00
|
|
|
|
OpenProject(dlg.textBoxLocation.Text);
|
2012-08-28 21:14:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-08-30 22:02:16 +00:00
|
|
|
|
public void OpenProject(string path)
|
|
|
|
|
{
|
|
|
|
|
if (!File.Exists(path))
|
|
|
|
|
throw new FileNotFoundException("No file found at the given location:", path);
|
|
|
|
|
_contentProject = ContentProject.Load(path);
|
|
|
|
|
ProjectName = _contentProject.Name;
|
|
|
|
|
ProjectOutputDir = _contentProject.OutputDirectory;
|
|
|
|
|
ProjectFolder = _contentProject.InputDirectory;
|
|
|
|
|
ProjectImportersDir = _contentProject.ReferenceIncludeDirectory;
|
|
|
|
|
ProjectPath = path;
|
|
|
|
|
if (string.IsNullOrEmpty(_contentProject.Creator))
|
|
|
|
|
_contentProject.Creator = "ANX Content Compiler (4.0)";
|
|
|
|
|
ChangeEnvironmentOpenProject();
|
|
|
|
|
}
|
2012-08-28 21:14:49 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2012-08-29 19:02:13 +00:00
|
|
|
|
#region SaveProject
|
|
|
|
|
public void SaveProject(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrEmpty(ProjectPath))
|
|
|
|
|
SaveProjectAs(sender, e);
|
|
|
|
|
|
|
|
|
|
_contentProject.Save(ProjectPath);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region SaveProjectAs
|
|
|
|
|
public void SaveProjectAs(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
using (var dlg = new SaveFileDialog())
|
|
|
|
|
{
|
|
|
|
|
dlg.Title = "Save project as";
|
|
|
|
|
dlg.AddExtension = true;
|
|
|
|
|
dlg.Filter = "ANX Content Project (*.cproj)|*.cproj|Compressed Content Project (*.ccproj)|*.ccproj";
|
|
|
|
|
if (dlg.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
ProjectPath = dlg.FileName;
|
|
|
|
|
SaveProject(sender, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-09-01 16:30:35 +00:00
|
|
|
|
#region FileMethods
|
|
|
|
|
private void AddFile(string file)
|
|
|
|
|
{
|
|
|
|
|
if (!File.Exists(file))
|
|
|
|
|
throw new FileNotFoundException();
|
|
|
|
|
|
|
|
|
|
var folder = _contentProject.ContentRoot;
|
|
|
|
|
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));
|
2012-09-08 22:03:13 +00:00
|
|
|
|
File.Copy(file, absPath, true);
|
2012-09-01 16:30:35 +00:00
|
|
|
|
var item = new BuildItem
|
|
|
|
|
{
|
2012-09-08 22:03:13 +00:00
|
|
|
|
AssetName = !String.IsNullOrEmpty(folder) ? folder.Replace(_contentProject.ContentRoot + Path.DirectorySeparatorChar, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file) : Path.GetFileNameWithoutExtension(file),
|
2012-09-01 16:30:35 +00:00
|
|
|
|
SourceFilename = absPath,
|
|
|
|
|
OutputFilename = ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + Path.GetFileName(file),
|
|
|
|
|
ImporterName = ImporterManager.GuessImporterByFileExtension(file)
|
|
|
|
|
};
|
|
|
|
|
_contentProject.BuildItems.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddFiles(string[] files)
|
|
|
|
|
{
|
|
|
|
|
foreach (var file in files)
|
|
|
|
|
{
|
|
|
|
|
AddFile(file);
|
|
|
|
|
}
|
|
|
|
|
ChangeEnvironmentOpenProject();
|
|
|
|
|
}
|
2012-09-08 22:03:13 +00:00
|
|
|
|
|
|
|
|
|
public void AddFolder(string name)
|
|
|
|
|
{
|
|
|
|
|
string folder = _contentProject.ContentRoot;
|
|
|
|
|
var node = treeView.SelectedNode;
|
|
|
|
|
if (node != null)
|
|
|
|
|
folder = node.Name;
|
|
|
|
|
else
|
|
|
|
|
node = treeView.Nodes[0];
|
|
|
|
|
|
|
|
|
|
var newFolder = new TreeNode(name) { Name = folder + Path.DirectorySeparatorChar + name};
|
|
|
|
|
node.Nodes.Add(newFolder);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveFile(string name)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveFiles(string[] files)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveFolder(string name)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2012-09-01 16:30:35 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2012-08-26 19:03:12 +00:00
|
|
|
|
#region EnvironmentStates
|
2012-08-27 19:09:10 +00:00
|
|
|
|
public void ChangeEnvironmentStartState()
|
2012-08-26 19:03:12 +00:00
|
|
|
|
{
|
|
|
|
|
editingState.Visible = false;
|
|
|
|
|
startState.Visible = true;
|
|
|
|
|
Text = "ANX Content Compiler 4";
|
|
|
|
|
labelTitle.Text = "ANX Content Compiler 4";
|
2012-09-01 16:30:35 +00:00
|
|
|
|
treeView.Nodes.Clear();
|
|
|
|
|
propertyGrid.SelectedObject = null;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-27 19:09:10 +00:00
|
|
|
|
public void ChangeEnvironmentOpenProject()
|
2012-08-26 19:03:12 +00:00
|
|
|
|
{
|
|
|
|
|
startState.Visible = false;
|
|
|
|
|
editingState.Visible = true;
|
|
|
|
|
Text = ProjectName + " - ANX Content Compiler 4";
|
|
|
|
|
labelTitle.Text = "ANX Content Compiler 4 - " + ProjectName;
|
2012-09-01 16:30:35 +00:00
|
|
|
|
|
|
|
|
|
ProjectFolder = _contentProject.InputDirectory;
|
|
|
|
|
treeView.Nodes.Clear();
|
|
|
|
|
var rootNode = new TreeNode(ProjectName + "(" + _contentProject.ContentRoot + ")") {Name = _contentProject.ContentRoot};
|
|
|
|
|
treeView.Nodes.Add(rootNode);
|
|
|
|
|
var lastNode = rootNode;
|
2012-09-08 22:03:13 +00:00
|
|
|
|
foreach (var parts in _contentProject.BuildItems.Select(buildItem => buildItem.AssetName.Split(Path.DirectorySeparatorChar)).Where(parts => parts.Length >= 2))
|
2012-09-01 16:30:35 +00:00
|
|
|
|
{
|
2012-09-08 22:03:13 +00:00
|
|
|
|
string folder = "";
|
|
|
|
|
string parent = _contentProject.ContentRoot;
|
2012-09-01 16:30:35 +00:00
|
|
|
|
for (int i=0; i < parts.Length - 1; i++)
|
|
|
|
|
{
|
2012-09-08 22:03:13 +00:00
|
|
|
|
if (parts[i] == null) continue;
|
|
|
|
|
if (i > 0)
|
|
|
|
|
folder += Path.DirectorySeparatorChar + parts[i];
|
2012-09-01 16:30:35 +00:00
|
|
|
|
else
|
2012-09-08 22:03:13 +00:00
|
|
|
|
folder = parts[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parts.Length > 2 && i < parts.Length -2)
|
|
|
|
|
parent += Path.DirectorySeparatorChar + parts[i];
|
|
|
|
|
//else if (parts.Length == 2)
|
|
|
|
|
// parent += Path.DirectorySeparatorChar + parts[0];
|
|
|
|
|
}
|
|
|
|
|
lastNode = treeView.RecursiveSearch(parent);
|
|
|
|
|
var node = new TreeNode(parts[parts.Length - 2]) { Name = _contentProject.ContentRoot + Path.DirectorySeparatorChar + folder };
|
|
|
|
|
if (!ContainsTreeNode(lastNode, node))
|
|
|
|
|
{
|
|
|
|
|
lastNode.Nodes.Add(node);
|
2012-09-01 16:30:35 +00:00
|
|
|
|
}
|
|
|
|
|
lastNode = rootNode;
|
|
|
|
|
}
|
|
|
|
|
if (_contentProject.BuildItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var buildItem in _contentProject.BuildItems)
|
|
|
|
|
{
|
|
|
|
|
String[] parts = null;
|
|
|
|
|
if (buildItem.AssetName.Contains("\\"))
|
|
|
|
|
parts = buildItem.AssetName.Split('\\');
|
|
|
|
|
else if (buildItem.AssetName.Contains("/"))
|
|
|
|
|
parts = buildItem.AssetName.Split('/');
|
|
|
|
|
/*if (parts.Length >= 2)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < parts.Length - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
lastNode = lastNode.Nodes[parts[i]];
|
|
|
|
|
}
|
|
|
|
|
}*/
|
2012-09-08 22:03:13 +00:00
|
|
|
|
string path = _contentProject.ContentRoot;
|
2012-09-01 16:30:35 +00:00
|
|
|
|
if (parts != null)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < parts.Length - 1; i++)
|
|
|
|
|
{
|
2012-09-08 22:03:13 +00:00
|
|
|
|
path += String.IsNullOrEmpty(path) ? parts[i] : Path.DirectorySeparatorChar + parts[i];
|
2012-09-01 16:30:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-08 22:03:13 +00:00
|
|
|
|
if (parts != null)
|
2012-09-01 16:30:35 +00:00
|
|
|
|
{
|
|
|
|
|
var node = treeView.RecursiveSearch(path);
|
|
|
|
|
if (node == null) throw new ArgumentNullException("Node not found!");
|
|
|
|
|
var item = new TreeNode(parts[parts.Length - 1]) {Name = buildItem.AssetName};
|
|
|
|
|
node.Nodes.Add(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var item = new TreeNode(buildItem.AssetName) {Name = buildItem.AssetName};
|
|
|
|
|
treeView.Nodes[0].Nodes.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ButtonHandlers
|
|
|
|
|
private void ButtonQuitClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Application.Exit();
|
|
|
|
|
}
|
2012-08-27 19:09:10 +00:00
|
|
|
|
private void ButtonMenuClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ToggleMenuMode();
|
|
|
|
|
}
|
2012-08-26 19:03:12 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region WindowMoveMethods
|
|
|
|
|
private void LabelTitleMouseMove(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
2012-08-27 19:09:10 +00:00
|
|
|
|
if (!_mouseDown) return;
|
|
|
|
|
var xoffset = MousePosition.X - _lastPos.X;
|
|
|
|
|
var yoffset = MousePosition.Y - _lastPos.Y;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
Left += xoffset;
|
|
|
|
|
Top += yoffset;
|
2012-08-27 19:09:10 +00:00
|
|
|
|
_lastPos = MousePosition;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LabelTitleMouseDown(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
2012-08-27 19:09:10 +00:00
|
|
|
|
_mouseDown = true;
|
|
|
|
|
_lastPos = MousePosition;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LabelTitleMouseUp(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
2012-08-27 19:09:10 +00:00
|
|
|
|
_mouseDown = false;
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region TreeVieItemDesignMethods
|
|
|
|
|
void TreeViewItemeLeave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
((ToolStripItem)sender).BackColor = Color.FromArgb(0, 64, 64, 64);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TreeViewItemMouseEnter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
((ToolStripItem)sender).BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2012-08-27 19:09:10 +00:00
|
|
|
|
|
|
|
|
|
#region MenuMethods
|
|
|
|
|
public void ToggleMenuMode()
|
|
|
|
|
{
|
|
|
|
|
_menuMode = !_menuMode;
|
|
|
|
|
if (_menuMode)
|
|
|
|
|
{
|
|
|
|
|
buttonMenu.BackColor = Settings.AccentColor3;
|
|
|
|
|
menuState.Visible = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
menuState.Visible = false;
|
|
|
|
|
buttonMenu.BackColor = Settings.AccentColor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ShowFirstStartStuff
|
|
|
|
|
private void ShowFirstStartStuff()
|
|
|
|
|
{
|
|
|
|
|
using (var dlg = new FirstStartScreen())
|
|
|
|
|
{
|
|
|
|
|
if (dlg.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region SetUpColors
|
|
|
|
|
private void SetUpColors()
|
|
|
|
|
{
|
|
|
|
|
BackColor = Settings.MainColor;
|
|
|
|
|
ForeColor = Settings.ForeColor;
|
|
|
|
|
buttonQuit.FlatAppearance.MouseOverBackColor = Settings.LightMainColor;
|
|
|
|
|
buttonQuit.FlatAppearance.MouseDownBackColor = Settings.AccentColor;
|
|
|
|
|
buttonMenu.BackColor = Settings.AccentColor;
|
|
|
|
|
buttonMenu.FlatAppearance.MouseOverBackColor = Settings.AccentColor2;
|
|
|
|
|
buttonMenu.FlatAppearance.MouseDownBackColor = Settings.AccentColor3;
|
|
|
|
|
labelTitle.ForeColor = Settings.ForeColor;
|
|
|
|
|
labelProperties.ForeColor = Settings.ForeColor;
|
|
|
|
|
labelFileTree.ForeColor = Settings.ForeColor;
|
|
|
|
|
treeView.BackColor = Settings.DarkMainColor;
|
|
|
|
|
propertyGrid.BackColor = Settings.DarkMainColor;
|
|
|
|
|
propertyGrid.ForeColor = Settings.ForeColor;
|
|
|
|
|
propertyGrid.HelpBackColor = Settings.MainColor;
|
|
|
|
|
propertyGrid.LineColor = Settings.MainColor;
|
|
|
|
|
propertyGrid.ViewBackColor = Settings.DarkMainColor;
|
|
|
|
|
propertyGrid.ViewForeColor = Settings.ForeColor;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2012-08-29 15:57:35 +00:00
|
|
|
|
|
|
|
|
|
#region Exit
|
|
|
|
|
private void MainWindowFormClosed(object sender, FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Settings.Save(SettingsFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MainWindowFormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2012-09-01 16:30:35 +00:00
|
|
|
|
|
|
|
|
|
#region TreeViewEvents
|
|
|
|
|
private void TreeViewAfterSelect(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (treeView.SelectedNode == treeView.TopNode)
|
|
|
|
|
propertyGrid.SelectedObject = _contentProject;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (var buildItem in _contentProject.BuildItems.Where(buildItem => buildItem.AssetName.Equals(treeView.SelectedNode.Name)))
|
|
|
|
|
{
|
|
|
|
|
propertyGrid.SelectedObject = buildItem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-08 22:03:13 +00:00
|
|
|
|
|
|
|
|
|
private bool ContainsTreeNode(TreeNode haystack, TreeNode needle)
|
|
|
|
|
{
|
|
|
|
|
return haystack.Nodes.Cast<TreeNode>().Any(node => node.Name.Equals(needle.Name));
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-01 16:30:35 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region PropertyGridEvents
|
|
|
|
|
private void PropertyGridPropertyValueChanged(object s, PropertyValueChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ProjectName = _contentProject.Name;
|
|
|
|
|
ProjectImportersDir = _contentProject.ReferenceIncludeDirectory;
|
|
|
|
|
ProjectFolder = _contentProject.InputDirectory;
|
|
|
|
|
ProjectOutputDir = _contentProject.OutputDirectory;
|
|
|
|
|
if (e.ChangedItem.Label.Equals("ContentRoot"))
|
|
|
|
|
{
|
|
|
|
|
foreach (BuildItem buildItem in _contentProject.BuildItems)
|
|
|
|
|
{
|
|
|
|
|
buildItem.AssetName = buildItem.AssetName.Replace((string)e.OldValue, _contentProject.ContentRoot);
|
|
|
|
|
}
|
|
|
|
|
treeView.Nodes[0].RecursivelyReplacePartOfName((string)e.OldValue, _contentProject.ContentRoot);
|
|
|
|
|
}
|
|
|
|
|
ChangeEnvironmentOpenProject();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2012-08-26 19:03:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|