mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Work on project manager and project panel
This commit is contained in:
		@@ -6,21 +6,86 @@ using System.Xml.Serialization;
 | 
			
		||||
 | 
			
		||||
namespace RainmeterStudio.Model
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Defines a Rainmeter Studio project
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class Project
 | 
			
		||||
    {
 | 
			
		||||
        [XmlElement("name")]
 | 
			
		||||
        public string Name { get; set; }
 | 
			
		||||
        #region Name property
 | 
			
		||||
 | 
			
		||||
        private string _name;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the name of the project
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("name")]
 | 
			
		||||
        public string Name
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return _name;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                _name = value;
 | 
			
		||||
 | 
			
		||||
                if (Root != null)
 | 
			
		||||
                    Root.Data = new Reference(Name, Path);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private string _path;
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Path property
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the file path of this project
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlIgnore]
 | 
			
		||||
        public string Path
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return _path;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                _path = value;
 | 
			
		||||
 | 
			
		||||
                if (Root != null)
 | 
			
		||||
                    Root.Data = new Reference(Name, Path);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Author property
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the author of the project
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("author")]
 | 
			
		||||
        public string Author { get; set; }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Version property
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the version of the project
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlIgnore]
 | 
			
		||||
        public Version Version { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the string representation of the project version
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("version")]
 | 
			
		||||
        public string VersionString
 | 
			
		||||
        {
 | 
			
		||||
            get 
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return Version.ToString();
 | 
			
		||||
            }
 | 
			
		||||
@@ -30,15 +95,39 @@ namespace RainmeterStudio.Model
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Auto-load file property
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the reference to the file to automatically load at package installation
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("autoLoadFile")]
 | 
			
		||||
        public Reference AutoLoadFile { get; set; }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Variable files property
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the list of variable files
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlArray("variableFiles")]
 | 
			
		||||
        public List<Reference> VariableFiles { get; set; }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Minimum rainmeter & windows properties
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the minimum rainmeter version
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlIgnore]
 | 
			
		||||
        public Version MinimumRainmeter { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the string representation of the minimum rainmeter version
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("minimumRainmeter")]
 | 
			
		||||
        public string MinimumRainmeterString
 | 
			
		||||
        {
 | 
			
		||||
@@ -52,9 +141,15 @@ namespace RainmeterStudio.Model
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the minimum Windows version
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlIgnore]
 | 
			
		||||
        public Version MinimumWindows { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the string representation of the minimum Windows version
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("minimumWindows")]
 | 
			
		||||
        public string MinimumWindowsString
 | 
			
		||||
        {
 | 
			
		||||
@@ -68,9 +163,23 @@ namespace RainmeterStudio.Model
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Root property
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the root node
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [XmlElement("root")]
 | 
			
		||||
        public Tree<Reference> Root { get; set; }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Constructor
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes a project
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public Project()
 | 
			
		||||
        {
 | 
			
		||||
            Root = new Tree<Reference>();
 | 
			
		||||
@@ -80,13 +189,17 @@ namespace RainmeterStudio.Model
 | 
			
		||||
            MinimumWindows = new Version("5.1");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Equals
 | 
			
		||||
 | 
			
		||||
        public override bool Equals(object obj)
 | 
			
		||||
        {
 | 
			
		||||
            Project other = obj as Project;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            if (other == null)
 | 
			
		||||
                return false;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            bool res = String.Equals(Author, other.Author);
 | 
			
		||||
            res &= Reference.Equals(AutoLoadFile, other.AutoLoadFile);
 | 
			
		||||
            res &= Version.Equals(MinimumRainmeter, other.MinimumRainmeter);
 | 
			
		||||
@@ -110,5 +223,7 @@ namespace RainmeterStudio.Model
 | 
			
		||||
 | 
			
		||||
            return hash;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Xml.Serialization;
 | 
			
		||||
@@ -12,17 +13,17 @@ namespace RainmeterStudio.Model
 | 
			
		||||
        public T Data { get; set; }
 | 
			
		||||
 | 
			
		||||
        [XmlArray("children"), XmlArrayItem("child")]
 | 
			
		||||
        public List<Tree<T>> Children { get; set; }
 | 
			
		||||
        public ObservableCollection<Tree<T>> Children { get; set; }
 | 
			
		||||
 | 
			
		||||
        public Tree()
 | 
			
		||||
        {
 | 
			
		||||
            Children = new List<Tree<T>>();
 | 
			
		||||
            Children = new ObservableCollection<Tree<T>>();
 | 
			
		||||
            Data = default(T);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Tree(T data)
 | 
			
		||||
        {
 | 
			
		||||
            Children = new List<Tree<T>>();
 | 
			
		||||
            Children = new ObservableCollection<Tree<T>>();
 | 
			
		||||
            Data = data;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user