anx.framework/Tools/ANXContentCompilerGUI/Nodes/ContentProjectNodeProperties.cs
Konstantin Koch a8588a30a5 Update ContentCompiler, make Visual Studio Extension work without having Anx Framework installed.
Make ContentCompilerGui compatible to recent changes in pipeline and did
some usability changes.
Make the Visual Studio Extension work even if the ANX Framework is not
installed additionally..
Improve that the path for assembly refernces in a content project
doesn't get automatically updated, only if the reference is actually
saved, this is so you can specify a relative path yourself.
Fix missing icon for ContentProject when it was opened with Visual
Studio.
Made create_shaders.bat directly executable under windows by fixing the
directory separators.
2015-09-03 23:43:55 +02:00

120 lines
3.6 KiB
C#

using ANX.ContentCompiler.GUI.Converters;
using ANX.Framework.Content.Pipeline;
using ANX.Framework.Content.Pipeline.Tasks;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
namespace ANX.ContentCompiler.GUI.Nodes
{
public class ContentProjectNodeProperties : NodeProperties, INotifyPropertyChanged
{
private ContentProject _contentProject;
private string _activeConfiguration;
private TargetPlatform _activePlatform;
public ContentProjectNodeProperties(ContentProject contentProject)
{
if (contentProject == null)
throw new ArgumentNullException("contentProject");
this._contentProject = contentProject;
}
[Browsable(false)]
internal ContentProject ContentProject
{
get { return _contentProject; }
}
public string Name
{
get { return _contentProject.Name; }
set
{
if (_contentProject.Name != value)
{
if (value != null)
{
foreach (var c in Path.GetInvalidFileNameChars())
{
if (value.Contains(c))
return;
}
}
_contentProject.Name = value;
OnPropertyChanged(new PropertyChangedEventArgs("Name"));
}
}
}
[DisplayName("Output Directory")]
public string OutputDirectory
{
get
{
Configuration config;
if (!_contentProject.Configurations.TryGetConfiguration(ActiveConfiguration, ActivePlatform, out config))
return null;
else
return config.OutputDirectory;
}
set
{
Configuration config;
if (_contentProject.Configurations.TryGetConfiguration(ActiveConfiguration, ActivePlatform, out config))
{
if (config.OutputDirectory != value)
{
config.OutputDirectory = value;
OnPropertyChanged(new PropertyChangedEventArgs("OutputDirectory"));
}
}
}
}
[TypeConverter(typeof(ActiveConfigurationConverter))]
[DisplayName("Active Configuration")]
public string ActiveConfiguration
{
get { return _activeConfiguration; }
set
{
if (_activeConfiguration != value)
{
_activeConfiguration = value;
OnPropertyChanged(new PropertyChangedEventArgs("ActiveConfiguration"));
}
}
}
[TypeConverter(typeof(ActivePlatformConverter))]
[DisplayName("Active Platform")]
public TargetPlatform ActivePlatform
{
get { return _activePlatform; }
set
{
if (_activePlatform != value)
{
_activePlatform = value;
OnPropertyChanged(new PropertyChangedEventArgs("ActivePlatform"));
}
}
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
PropertyChanged(this, e);
}
[Browsable(false)]
public event PropertyChangedEventHandler PropertyChanged;
}
}