public void CloseProject() { if (!ProjectOpen) { return; } // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) { return; } if (watcher != null) { watcher.Dispose(); watcher = null; } ProjectOpen = false; ProjectDirty = false; _project = null; _actionStack.Clear(); View.OutputClear(); History.Default.StartupProject = null; History.Default.Save(); Selection.Clear(this); UpdateTree(); }
public void CloseProject() { if (!ProjectOpen) { return; } // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) { return; } _watcher.Stop(); ProjectOpen = false; ProjectDirty = false; _project = null; _actionStack.Clear(); View.OutputClear(); PipelineSettings.Default.StartupProject = null; PipelineSettings.Default.Save(); UpdateTree(); UpdateMenu(); }
public UpdateProjectAction(IView view, IController con, PipelineProject item, PropertyDescriptor property, object previousValue) { _view = view; _con = con; _state = ProjectState.Get(item); switch (property.Name) { case "OutputDir": _state.OutputDir = (string)previousValue; break; case "IntermediateDir": _state.IntermediateDir = (string)previousValue; break; case "References": _state.References = new List<string>((List<string>)previousValue); _referencesChanged = true; break; case "Platform": _state.Platform = (TargetPlatform)previousValue; break; case "Profile": _state.Profile = (GraphicsProfile)previousValue; break; case "Config": _state.Config = (string)previousValue; break; case "OriginalPath": _state.OriginalPath = (string)previousValue; break; } }
static void Main(string [] args) { #if WINDOWS Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); History.Default.Load(); var view = new MainView(); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); view.OpenProjectPath = projectFilePath; } var model = new PipelineProject(); var controller = new PipelineController(view, model); Application.Run(view); #endif #if LINUX || MONOMAC Gtk.Application.Init (); MainWindow win = new MainWindow (); win.Show (); var model = new PipelineProject(); new PipelineController(win, model); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); win.OpenProjectPath = projectFilePath; } win.OnShowEvent (); Gtk.Application.Run (); #endif }
static void Main(string [] args) { #if WINDOWS Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); History.Default.Load(); var view = new MainView(); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); view.OpenProjectPath = projectFilePath; } var model = new PipelineProject(); var controller = new PipelineController(view, model); Application.Run(view); #endif #if LINUX || MONOMAC Gtk.Application.Init(); MainWindow win = new MainWindow(); win.Show(); var model = new PipelineProject(); new PipelineController(win, model); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); win.OpenProjectPath = projectFilePath; } win.OnShowEvent(); Gtk.Application.Run(); #endif }
/// <summary> /// Set a PipelineProject's member values from this state object. /// </summary> public void Apply(PipelineProject proj) { proj.OutputDir = OutputDir; proj.IntermediateDir = IntermediateDir; proj.References = new List <string>(References); proj.Platform = Platform; proj.Profile = Profile; proj.Config = Config; }
/// <summary> /// Set a PipelineProject's member values from this state object. /// </summary> public void Apply(PipelineProject proj) { proj.OutputDir = OutputDir; proj.IntermediateDir = IntermediateDir; proj.References = new List<string>(References); proj.Platform = Platform; proj.Profile = Profile; proj.Config = Config; }
public void ImportProject() { // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) { return; } string projectFilePath; if (!View.AskImportProject(out projectFilePath)) { return; } CloseProject(); if (OnProjectLoading != null) { OnProjectLoading(); } #if SHIPPING try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); parser.ImportProject(projectFilePath); ResolveTypes(); ProjectOpen = true; ProjectDirty = true; } #if SHIPPING catch (Exception e) { View.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); View.UpdateTreeItem(_project); if (OnProjectLoaded != null) { OnProjectLoaded(); } UpdateMenu(); }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) { OnProjectLoading(); } var errortext = "Failed to open the project due to an unknown error."; try { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => { errortext = string.Format(msg, args); throw new Exception(); }); parser.OpenProject(projectFilePath, errorCallback); ResolveTypes(); ProjectOpen = true; ProjectDirty = false; PipelineSettings.Default.AddProjectHistory(projectFilePath); PipelineSettings.Default.StartupProject = projectFilePath; PipelineSettings.Default.Save(); View.UpdateRecentList(PipelineSettings.Default.ProjectHistory); } catch (Exception) { View.ShowError("Error Opening Project", Path.GetFileName(projectFilePath) + ": " + errortext); return; } UpdateTree(); View.UpdateTreeItem(_project); if (OnProjectLoaded != null) { OnProjectLoaded(); } _watcher.Run(); UpdateMenu(); }
public PipelineController(IView view, PipelineProject project) { _actionStack = new ActionStack(); Selection = new Selection(); View = view; View.Attach(this); _project = project; ProjectOpen = false; _templateItems = new List <ContentItemTemplate>(); LoadTemplates(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Templates")); }
public PipelineController(IView view, PipelineProject project) { _actionStack = new ActionStack(); Selection = new Selection(); View = view; View.Attach(this); _project = project; ProjectOpen = false; _templateItems = new List<ContentItemTemplate>(); LoadTemplates(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Templates")); }
public PipelineController(IView view, PipelineProject project) { _actionStack = new ActionStack(); Selection = new Selection(); _view = view; _view.Attach(this); _project = project; ProjectOpen = false; _templateItems = new List <ContentItemTemplate>(); LoadTemplates(Environment.CurrentDirectory + "\\Templates"); }
public PipelineController(IView view, PipelineProject project) { _actionStack = new ActionStack(); Selection = new Selection(); _view = view; _view.Attach(this); _project = project; _project.Controller = this; ProjectOpen = false; _templateItems = new List<ContentItemTemplate>(); LoadTemplates(Environment.CurrentDirectory + "\\Templates"); }
/// <summary> /// Create a ProjectState storing member values of the passed PipelineProject. /// </summary> public static ProjectState Get(PipelineProject proj) { var state = new ProjectState() { OriginalPath = proj.OriginalPath, OutputDir = proj.OutputDir, IntermediateDir = proj.IntermediateDir, References = new List<string>(proj.References), Platform = proj.Platform, Profile = proj.Profile, Config = proj.Config, }; return state; }
/// <summary> /// Create a ProjectState storing member values of the passed PipelineProject. /// </summary> public static ProjectState Get(PipelineProject proj) { var state = new ProjectState() { OriginalPath = proj.OriginalPath, OutputDir = proj.OutputDir, IntermediateDir = proj.IntermediateDir, References = new List <string>(proj.References), Platform = proj.Platform, Profile = proj.Profile, Config = proj.Config, }; return(state); }
static void Main(string [] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var view = new MainView(); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); view.OpenProjectPath = projectFilePath; } var model = new PipelineProject(); var controller = new PipelineController(view, model); Application.Run(view); }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) { OnProjectLoading(); } try { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args))); parser.OpenProject(projectFilePath, errorCallback); ResolveTypes(); ProjectOpen = true; ProjectDirty = false; PipelineSettings.Default.AddProjectHistory(projectFilePath); PipelineSettings.Default.StartupProject = projectFilePath; PipelineSettings.Default.Save(); View.UpdateRecentList(PipelineSettings.Default.ProjectHistory); } catch (Exception e) { View.ShowError("Open Project", "Failed to open project!"); return; } UpdateTree(); View.UpdateTreeItem(_project); if (OnProjectLoaded != null) { OnProjectLoaded(); } _watcher.Run(); UpdateMenu(); }
public void NewProject() { // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) { return; } // A project needs a root directory or it is impossible to resolve relative paths. // So we need the user to choose that location even though the project has not // yet actually been saved to disk. var projectFilePath = Environment.CurrentDirectory; if (!View.AskSaveName(ref projectFilePath, "New Project")) { return; } CloseProject(); if (OnProjectLoading != null) { OnProjectLoading(); } // Clear existing project data, initialize to a new blank project. _actionStack.Clear(); _project = new PipelineProject(); PipelineTypes.Load(_project); // Save the new project. _project.OriginalPath = projectFilePath; ProjectOpen = true; ProjectDirty = true; UpdateTree(); if (OnProjectLoaded != null) { OnProjectLoaded(); } UpdateMenu(); }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) { OnProjectLoading(); } #if SHIPPING try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args))); parser.OpenProject(projectFilePath, errorCallback); ResolveTypes(); ProjectOpen = true; ProjectDirty = false; History.Default.AddProjectHistory(projectFilePath); History.Default.StartupProject = projectFilePath; History.Default.Save(); } #if SHIPPING catch (Exception e) { _view.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); if (OnProjectLoaded != null) { OnProjectLoaded(); } }
static void Main(string [] args) { #if WINDOWS Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); History.Default.Load(); var view = new MainView(); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); view.OpenProjectPath = projectFilePath; } var model = new PipelineProject(); var controller = new PipelineController(view, model); Application.Run(view); #endif #if XWT #if MONOMAC Application.Initialize(ToolkitType.Cocoa); #endif #if LINUX Application.Initialize(ToolkitType.Gtk); #endif var view = new XwtView(); if (args != null && args.Length > 0) { var projectFilePath = string.Join(" ", args); view.OpenProjectPath = projectFilePath; } var model = new PipelineProject(); new PipelineController(view, model); view.Show(); Application.Run(); #endif }
public UpdateProjectAction(IView view, IController con, PipelineProject item, PropertyDescriptor property, object previousValue) { _view = view; _con = con; _state = ProjectState.Get(item); switch (property.Name) { case "OutputDir": _state.OutputDir = (string)previousValue; break; case "IntermediateDir": _state.IntermediateDir = (string)previousValue; break; case "References": _state.References = new List <string>((List <string>)previousValue); _referencesChanged = true; break; case "Platform": _state.Platform = (TargetPlatform)previousValue; break; case "Profile": _state.Profile = (GraphicsProfile)previousValue; break; case "Config": _state.Config = (string)previousValue; break; case "OriginalPath": _state.OriginalPath = (string)previousValue; break; } }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) OnProjectLoading(); #if !DEBUG try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args))); parser.OpenProject(projectFilePath, errorCallback); ResolveTypes(); ProjectOpen = true; ProjectDirty = false; PipelineSettings.Default.AddProjectHistory(projectFilePath); PipelineSettings.Default.StartupProject = projectFilePath; PipelineSettings.Default.Save(); } #if !DEBUG catch (Exception e) { View.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); if (OnProjectLoaded != null) OnProjectLoaded(); _watcher.Run(); }
public PipelineProjectProxy(PipelineProject project) { _project = project; }
public PipelineProjectParser(IContentItemObserver observer, PipelineProject project) { _observer = observer; _project = project; }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) { OnProjectLoading(); } #if SHIPPING try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args))); parser.OpenProject(projectFilePath, errorCallback); ResolveTypes(); ProjectOpen = true; ProjectDirty = false; watcher = new FileSystemWatcher(Path.GetDirectoryName(projectFilePath)); watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.FileName; watcher.Filter = "*.*"; watcher.IncludeSubdirectories = true; watcher.Created += delegate(object sender, FileSystemEventArgs e) { HandleCreated(e.FullPath); }; watcher.Deleted += delegate(object sender, FileSystemEventArgs e) { HandleDeleted(e.FullPath); }; watcher.Renamed += delegate(object sender, RenamedEventArgs e) { HandleDeleted(e.OldFullPath); HandleCreated(e.FullPath); }; watcher.EnableRaisingEvents = true; History.Default.AddProjectHistory(projectFilePath); History.Default.StartupProject = projectFilePath; History.Default.Save(); } #if SHIPPING catch (Exception e) { View.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); if (OnProjectLoaded != null) { OnProjectLoaded(); } }
public void NewProject() { // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) return; // A project needs a root directory or it is impossible to resolve relative paths. // So we need the user to choose that location even though the project has not // yet actually been saved to disk. var projectFilePath = Environment.CurrentDirectory; if (!View.AskSaveName(ref projectFilePath, "New Project")) return; CloseProject(); if (OnProjectLoading != null) OnProjectLoading(); // Clear existing project data, initialize to a new blank project. _actionStack.Clear(); _project = new PipelineProject(); PipelineTypes.Load(_project); // Save the new project. _project.OriginalPath = projectFilePath; ProjectOpen = true; ProjectDirty = true; UpdateTree(); if (OnProjectLoaded != null) OnProjectLoaded(); }
public static void Load(PipelineProject project) { Unload(); var assemblyPaths = new List <string>(); var projectRoot = project.Location; foreach (var i in project.References) { var path = Path.Combine(projectRoot, i); if (string.IsNullOrEmpty(path)) { throw new ArgumentException("assemblyFilePath cannot be null!"); } if (!Path.IsPathRooted(path)) { throw new ArgumentException("assemblyFilePath must be absolute!"); } // Make sure we're not adding the same assembly twice. path = PathHelper.Normalize(path); if (!assemblyPaths.Contains(path)) { assemblyPaths.Add(path); } } ResolveAssemblies(assemblyPaths); var importerDescriptions = new ImporterTypeDescription[_importers.Count]; var cur = 0; foreach (var item in _importers) { // Find the abstract base class ContentImporter<T>. var baseType = item.Type.BaseType; while (!baseType.IsAbstract) { baseType = baseType.BaseType; } var outputType = baseType.GetGenericArguments()[0]; var desc = new ImporterTypeDescription() { TypeName = item.Type.Name, DisplayName = item.Attribute.DisplayName, DefaultProcessor = item.Attribute.DefaultProcessor, FileExtensions = item.Attribute.FileExtensions, OutputType = outputType, }; importerDescriptions[cur] = desc; cur++; } Importers = importerDescriptions; ImportersStandardValuesCollection = new TypeConverter.StandardValuesCollection(Importers); var processorDescriptions = new ProcessorTypeDescription[_processors.Count]; const BindingFlags bindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; cur = 0; foreach (var item in _processors) { var obj = Activator.CreateInstance(item.Type); var typeProperties = item.Type.GetProperties(bindings); var properties = new List <ProcessorTypeDescription.Property>(); foreach (var i in typeProperties) { // TODO: //p.GetCustomAttribute(typeof(ContentPipelineIgnore)) var p = new ProcessorTypeDescription.Property() { Name = i.Name, Type = i.PropertyType, DefaultValue = i.GetValue(obj, null), }; properties.Add(p); } var inputType = (obj as IContentProcessor).InputType; var desc = new ProcessorTypeDescription() { TypeName = item.Type.Name, DisplayName = item.Attribute.DisplayName, Properties = new ProcessorTypeDescription.ProcessorPropertyCollection(properties), InputType = inputType, }; if (string.IsNullOrEmpty(desc.DisplayName)) { desc.DisplayName = desc.TypeName; } processorDescriptions[cur] = desc; cur++; } Processors = processorDescriptions; ProcessorsStandardValuesCollection = new TypeConverter.StandardValuesCollection(Processors); }
public PipelineProjectParser(IContentItemObserver observer, PipelineProject project) { _observer = observer; _project = project; }
public PipelineProjectProxy(PipelineProject project) { _project = project; }
public void CloseProject() { if (!ProjectOpen) return; // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) return; _watcher.Stop(); ProjectOpen = false; ProjectDirty = false; _project = null; _actionStack.Clear(); View.OutputClear(); PipelineSettings.Default.StartupProject = null; PipelineSettings.Default.Save(); Selection.Clear(this); UpdateTree(); }
public void CloseProject() { // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) return; ProjectOpen = false; ProjectDiry = false; _project = null; _actionStack.Clear(); Selection.Clear(this); UpdateTree(); }
public void ImportProject() { // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) return; string projectFilePath; if (!_view.AskImportProject(out projectFilePath)) return; CloseProject(); if (OnProjectLoading != null) OnProjectLoading(); #if SHIPPING try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); parser.ImportProject(projectFilePath); ResolveTypes(); ProjectOpen = true; ProjectDiry = true; } #if SHIPPING catch (Exception e) { _view.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); if (OnProjectLoaded != null) OnProjectLoaded(); }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) OnProjectLoading(); #if SHIPPING try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args))); parser.OpenProject(projectFilePath, errorCallback); ResolveTypes(); ProjectOpen = true; ProjectDirty = false; watcher = new FileSystemWatcher (Path.GetDirectoryName (projectFilePath)); watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.FileName; watcher.Filter = "*.*"; watcher.IncludeSubdirectories = true; watcher.Created += delegate(object sender, FileSystemEventArgs e) { HandleCreated(e.FullPath); }; watcher.Deleted += delegate(object sender, FileSystemEventArgs e) { HandleDeleted(e.FullPath); }; watcher.Renamed += delegate(object sender, RenamedEventArgs e) { HandleDeleted(e.OldFullPath); HandleCreated(e.FullPath); }; watcher.EnableRaisingEvents = true; History.Default.AddProjectHistory(projectFilePath); History.Default.StartupProject = projectFilePath; History.Default.Save(); } #if SHIPPING catch (Exception e) { View.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); if (OnProjectLoaded != null) OnProjectLoaded(); }
public void OpenProject(string projectFilePath) { CloseProject(); if (OnProjectLoading != null) OnProjectLoading(); #if SHIPPING try #endif { _actionStack.Clear(); _project = new PipelineProject(); var parser = new PipelineProjectParser(this, _project); parser.OpenProject(projectFilePath); ResolveTypes(); ProjectOpen = true; ProjectDiry = false; } #if SHIPPING catch (Exception e) { _view.ShowError("Open Project", "Failed to open project!"); return; } #endif UpdateTree(); if (OnProjectLoaded != null) OnProjectLoaded(); }
public void CloseProject() { if (!ProjectOpen) return; // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) return; if (watcher != null) { watcher.Dispose (); watcher = null; } ProjectOpen = false; ProjectDirty = false; _project = null; _actionStack.Clear(); View.OutputClear(); History.Default.StartupProject = null; History.Default.Save(); Selection.Clear(this); UpdateTree(); }
public void NewProject() { // Make sure we give the user a chance to // save the project if they need too. if (!AskSaveProject()) return; // Ask user to choose a location on disk for the new project. // Note: It is impossible to have a project without a project root directory, hence it has to be saved immediately. var projectFilePath = Environment.CurrentDirectory; if (!_view.AskSaveName(ref projectFilePath, "New Project")) return; CloseProject(); if (OnProjectLoading != null) OnProjectLoading(); // Clear existing project data, initialize to a new blank project. _actionStack.Clear(); _project = new PipelineProject(); PipelineTypes.Load(_project); // Save the new project. _project.OriginalPath = projectFilePath; ProjectOpen = true; UpdateTree(); if (OnProjectLoaded != null) OnProjectLoaded(); }
public PipelineProjectParser(IController controller, PipelineProject project) { _controller = controller; _project = project; }