// // ProjectObjectModel.cs - provides an ObjectModel for manipulating projects (collections of files and settings) // // Author: // Michael Becker // // Copyright (c) 2019-2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; using UniversalEditor.ObjectModels.PropertyList; namespace UniversalEditor.ObjectModels.Project { /// /// Provides an for manipulating projects (collections of files and settings). /// public class ProjectObjectModel : ObjectModel { public class ProjectObjectModelCollection : System.Collections.ObjectModel.Collection { } private static ObjectModelReference _omr = null; protected override ObjectModelReference MakeReferenceInternal() { if (_omr == null) { _omr = base.MakeReferenceInternal(); _omr.Path = new string[] { "General", "Project" }; _omr.Description = "Stores a set of related files and folders with an accompanying configuration."; } return _omr; } public override void Clear() { Configuration.Clear(); FileSystem.Clear(); ID = Guid.Empty; ProjectTypes.Clear(); References.Clear(); RelativeFileName = String.Empty; Title = String.Empty; } public override void CopyTo(ObjectModel where) { ProjectObjectModel clone = (where as ProjectObjectModel); Configuration.CopyTo(clone.Configuration); FileSystem.CopyTo(clone.FileSystem); clone.ID = ID; for (int i = 0; i < ProjectTypes.Count; i++) { clone.ProjectTypes.Add(ProjectTypes[i]); } foreach (Reference _ref in References) { clone.References.Add(_ref); } clone.RelativeFileName = (RelativeFileName.Clone() as string); clone.Title = (Title.Clone() as string); } public string BasePath { get; set; } = null; /// /// Gets or sets the globally-unique identifier (GUID) for this . /// /// The globally-unique identifier (GUID) for this . public Guid ID { get; set; } = Guid.Empty; /// /// Gets or sets the title of this . /// /// The title of this . public string Title { get; set; } = String.Empty; /// /// Gets a representing the configuration settings for this . /// /// The configuration settings for this . public PropertyListObjectModel Configuration { get; } = new PropertyListObjectModel(); /// /// Gets a collection of instances representing the references to other projects and libraries used by this . /// /// The references to other projects and libraries used by this . public Reference.ReferenceCollection References { get; } = new Reference.ReferenceCollection(); /// /// Gets a containing the s and s referenced by this . /// /// The file system containing the s and s referenced by this . public ProjectFileSystem FileSystem { get; } = new ProjectFileSystem(); /// /// Gets a collection of s containing common settings and build actions shared between multiple projects of the /// same . /// /// A collection of s containing common settings and build actions shared between multiple projects of the /// same . public ProjectType.ProjectTypeCollection ProjectTypes { get; } = new ProjectType.ProjectTypeCollection(); /// /// Gets or sets the relative path to the . /// /// The relative path to the . public string RelativeFileName { get; set; } = String.Empty; private System.Collections.Generic.Dictionary _projectSettings = new System.Collections.Generic.Dictionary(); public object GetProjectSetting(Guid id, object defaultValue = null) { if (_projectSettings.ContainsKey(id)) { return _projectSettings[id]; } return defaultValue; } public void SetProjectSetting(Guid id, object value) { _projectSettings[id] = value; } } }