mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed line endings and applied gitignore
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class DocumentFormat
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ImageSource Icon { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DefaultExtension { get; set; }
|
||||
public IDocumentEditorFactory Factory { get; set; }
|
||||
public string Category { get; set; }
|
||||
}
|
||||
}
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class DocumentFormat
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ImageSource Icon { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DefaultExtension { get; set; }
|
||||
public IDocumentEditorFactory Factory { get; set; }
|
||||
public string Category { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model.Events
|
||||
{
|
||||
public class DocumentOpenedEventArgs : EventArgs
|
||||
{
|
||||
public IDocumentEditor Editor { get; private set; }
|
||||
|
||||
public DocumentOpenedEventArgs(IDocumentEditor editor)
|
||||
{
|
||||
Editor = editor;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model.Events
|
||||
{
|
||||
public class DocumentOpenedEventArgs : EventArgs
|
||||
{
|
||||
public IDocumentEditor Editor { get; private set; }
|
||||
|
||||
public DocumentOpenedEventArgs(IDocumentEditor editor)
|
||||
{
|
||||
Editor = editor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public interface IDocument
|
||||
{
|
||||
string Name { get; }
|
||||
string FilePath { get; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public interface IDocument
|
||||
{
|
||||
string Name { get; }
|
||||
string FilePath { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,136 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public abstract class IDocumentEditor : IDisposable
|
||||
{
|
||||
#region Dirty flag
|
||||
|
||||
private bool _dirty = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a flag indicating if the active document is dirty (modified and not saved)
|
||||
/// </summary>
|
||||
public virtual bool Dirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dirty;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
_dirty = value;
|
||||
if (DirtyChanged != null)
|
||||
DirtyChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the dirty flag changes
|
||||
/// </summary>
|
||||
public event EventHandler DirtyChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Document
|
||||
|
||||
/// <summary>
|
||||
/// Gets the opened document
|
||||
/// </summary>
|
||||
public abstract IDocument Document { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title to be displayed in the title bar
|
||||
/// </summary>
|
||||
public abstract string Title { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the title changes
|
||||
/// </summary>
|
||||
public event EventHandler TitleChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorUI
|
||||
|
||||
/// <summary>
|
||||
/// Gets the editor UI
|
||||
/// </summary>
|
||||
public abstract UIElement EditorUI { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Selection properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating if this editor uses the selection properties window
|
||||
/// </summary>
|
||||
public virtual bool UsesSelectionProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the selected object
|
||||
/// </summary>
|
||||
public virtual string SelectionName
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of properties for the currently selected object
|
||||
/// </summary>
|
||||
public virtual IEnumerable<string> SelectionProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the selected object changes (used to update properties)
|
||||
/// </summary>
|
||||
public event EventHandler SelectionChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Toolbox
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of items to populate the toolbox
|
||||
/// </summary>
|
||||
public virtual IEnumerable<string> ToolboxItems
|
||||
{
|
||||
get
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ToolboxChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public abstract class IDocumentEditor : IDisposable
|
||||
{
|
||||
#region Dirty flag
|
||||
|
||||
private bool _dirty = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a flag indicating if the active document is dirty (modified and not saved)
|
||||
/// </summary>
|
||||
public virtual bool Dirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dirty;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
_dirty = value;
|
||||
if (DirtyChanged != null)
|
||||
DirtyChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the dirty flag changes
|
||||
/// </summary>
|
||||
public event EventHandler DirtyChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Document
|
||||
|
||||
/// <summary>
|
||||
/// Gets the opened document
|
||||
/// </summary>
|
||||
public abstract IDocument Document { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title to be displayed in the title bar
|
||||
/// </summary>
|
||||
public abstract string Title { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the title changes
|
||||
/// </summary>
|
||||
public event EventHandler TitleChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorUI
|
||||
|
||||
/// <summary>
|
||||
/// Gets the editor UI
|
||||
/// </summary>
|
||||
public abstract UIElement EditorUI { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Selection properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating if this editor uses the selection properties window
|
||||
/// </summary>
|
||||
public virtual bool UsesSelectionProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the selected object
|
||||
/// </summary>
|
||||
public virtual string SelectionName
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of properties for the currently selected object
|
||||
/// </summary>
|
||||
public virtual IEnumerable<string> SelectionProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the selected object changes (used to update properties)
|
||||
/// </summary>
|
||||
public event EventHandler SelectionChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Toolbox
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of items to populate the toolbox
|
||||
/// </summary>
|
||||
public virtual IEnumerable<string> ToolboxItems
|
||||
{
|
||||
get
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ToolboxChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterEditor.Storage;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public interface IDocumentEditorFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the editor
|
||||
/// </summary>
|
||||
string EditorName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Formats that will be used to populate the 'create document' dialog
|
||||
/// </summary>
|
||||
IEnumerable<DocumentFormat> CreateDocumentFormats { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new editor object
|
||||
/// </summary>
|
||||
/// <param name="document">Document to be edited by the editor</param>
|
||||
/// <returns>A new document editor</returns>
|
||||
IDocumentEditor CreateEditor(IDocument document);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new document
|
||||
/// </summary>
|
||||
/// <returns>A new document</returns>
|
||||
IDocument CreateDocument(DocumentFormat format, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the storage of this factory
|
||||
/// </summary>
|
||||
IDocumentStorage Storage { get; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterEditor.Storage;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public interface IDocumentEditorFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the editor
|
||||
/// </summary>
|
||||
string EditorName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Formats that will be used to populate the 'create document' dialog
|
||||
/// </summary>
|
||||
IEnumerable<DocumentFormat> CreateDocumentFormats { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new editor object
|
||||
/// </summary>
|
||||
/// <param name="document">Document to be edited by the editor</param>
|
||||
/// <returns>A new document editor</returns>
|
||||
IDocumentEditor CreateEditor(IDocument document);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new document
|
||||
/// </summary>
|
||||
/// <returns>A new document</returns>
|
||||
IDocument CreateDocument(DocumentFormat format, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the storage of this factory
|
||||
/// </summary>
|
||||
IDocumentStorage Storage { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public interface IDocumentStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads a document from file
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <returns>Read document</returns>
|
||||
IDocument Read(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a document to a file
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <param name="document">Document to write</param>
|
||||
void Write(string path, IDocument document);
|
||||
|
||||
/// <summary>
|
||||
/// Tests if the file can be read by this storage
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <returns>True if file can be read</returns>
|
||||
bool CanRead(string path);
|
||||
}
|
||||
}
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public interface IDocumentStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads a document from file
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <returns>Read document</returns>
|
||||
IDocument Read(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a document to a file
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <param name="document">Document to write</param>
|
||||
void Write(string path, IDocument document);
|
||||
|
||||
/// <summary>
|
||||
/// Tests if the file can be read by this storage
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <returns>True if file can be read</returns>
|
||||
bool CanRead(string path);
|
||||
}
|
||||
}
|
||||
|
@ -1,114 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class Project
|
||||
{
|
||||
[XmlElement("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlElement("author")]
|
||||
public string Author { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Version Version { get; set; }
|
||||
|
||||
[XmlElement("version")]
|
||||
public string VersionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return Version.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
Version = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("autoLoadFile")]
|
||||
public Reference AutoLoadFile { get; set; }
|
||||
|
||||
[XmlArray("variableFiles")]
|
||||
public List<Reference> VariableFiles { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Version MinimumRainmeter { get; set; }
|
||||
|
||||
[XmlElement("minimumRainmeter")]
|
||||
public string MinimumRainmeterString
|
||||
{
|
||||
get
|
||||
{
|
||||
return MinimumRainmeter.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
MinimumRainmeter = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Version MinimumWindows { get; set; }
|
||||
|
||||
[XmlElement("minimumWindows")]
|
||||
public string MinimumWindowsString
|
||||
{
|
||||
get
|
||||
{
|
||||
return MinimumWindows.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
MinimumWindows = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("root")]
|
||||
public Tree<Reference> Root { get; set; }
|
||||
|
||||
public Project()
|
||||
{
|
||||
Root = new Tree<Reference>();
|
||||
VariableFiles = new List<Reference>();
|
||||
Version = new Version();
|
||||
MinimumRainmeter = new Version("3.1");
|
||||
MinimumWindows = new Version("5.1");
|
||||
}
|
||||
|
||||
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);
|
||||
res &= Version.Equals(MinimumWindows, other.MinimumWindows);
|
||||
res &= String.Equals(Name, other.Name);
|
||||
res &= Tree<Reference>.Equals(Root, other.Root);
|
||||
res &= Version.Equals(Version, other.Version);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = (Author == null) ? 0 : Author.GetHashCode();
|
||||
hash = hash * 7 + ((AutoLoadFile == null) ? 0 : AutoLoadFile.GetHashCode());
|
||||
hash = hash * 7 + ((MinimumRainmeter == null) ? 0 : MinimumRainmeter.GetHashCode());
|
||||
hash = hash * 7 + ((MinimumWindows == null) ? 0 : MinimumWindows.GetHashCode());
|
||||
hash = hash * 7 + ((Name == null) ? 0 : Name.GetHashCode());
|
||||
hash = hash * 7 + ((Root == null) ? 0 : Root.GetHashCode());
|
||||
hash = hash * 7 + ((Version == null) ? 0 : Version.GetHashCode());
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class Project
|
||||
{
|
||||
[XmlElement("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlElement("author")]
|
||||
public string Author { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Version Version { get; set; }
|
||||
|
||||
[XmlElement("version")]
|
||||
public string VersionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return Version.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
Version = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("autoLoadFile")]
|
||||
public Reference AutoLoadFile { get; set; }
|
||||
|
||||
[XmlArray("variableFiles")]
|
||||
public List<Reference> VariableFiles { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Version MinimumRainmeter { get; set; }
|
||||
|
||||
[XmlElement("minimumRainmeter")]
|
||||
public string MinimumRainmeterString
|
||||
{
|
||||
get
|
||||
{
|
||||
return MinimumRainmeter.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
MinimumRainmeter = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Version MinimumWindows { get; set; }
|
||||
|
||||
[XmlElement("minimumWindows")]
|
||||
public string MinimumWindowsString
|
||||
{
|
||||
get
|
||||
{
|
||||
return MinimumWindows.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
MinimumWindows = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("root")]
|
||||
public Tree<Reference> Root { get; set; }
|
||||
|
||||
public Project()
|
||||
{
|
||||
Root = new Tree<Reference>();
|
||||
VariableFiles = new List<Reference>();
|
||||
Version = new Version();
|
||||
MinimumRainmeter = new Version("3.1");
|
||||
MinimumWindows = new Version("5.1");
|
||||
}
|
||||
|
||||
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);
|
||||
res &= Version.Equals(MinimumWindows, other.MinimumWindows);
|
||||
res &= String.Equals(Name, other.Name);
|
||||
res &= Tree<Reference>.Equals(Root, other.Root);
|
||||
res &= Version.Equals(Version, other.Version);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = (Author == null) ? 0 : Author.GetHashCode();
|
||||
hash = hash * 7 + ((AutoLoadFile == null) ? 0 : AutoLoadFile.GetHashCode());
|
||||
hash = hash * 7 + ((MinimumRainmeter == null) ? 0 : MinimumRainmeter.GetHashCode());
|
||||
hash = hash * 7 + ((MinimumWindows == null) ? 0 : MinimumWindows.GetHashCode());
|
||||
hash = hash * 7 + ((Name == null) ? 0 : Name.GetHashCode());
|
||||
hash = hash * 7 + ((Root == null) ? 0 : Root.GetHashCode());
|
||||
hash = hash * 7 + ((Version == null) ? 0 : Version.GetHashCode());
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class Property
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
private object _value;
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
|
||||
if (ValueChanged != null)
|
||||
ValueChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ValueChanged;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class Property
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
private object _value;
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
|
||||
if (ValueChanged != null)
|
||||
ValueChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ValueChanged;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class RainmeterConfig
|
||||
{
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class RainmeterConfig
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to a file or folder
|
||||
/// </summary>
|
||||
public class Reference
|
||||
{
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute("path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
public Reference()
|
||||
{
|
||||
}
|
||||
|
||||
public Reference(string name, string path = null)
|
||||
{
|
||||
Name = name;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var other = obj as Reference;
|
||||
|
||||
// Types are different, so not equal
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare using string equals
|
||||
return String.Equals(Name, other.Name) && String.Equals(Path, other.Path);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = (Name == null) ? 0 : Name.GetHashCode();
|
||||
hash = hash * 7 + ((Path == null) ? 0 : Path.GetHashCode());
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to a file or folder
|
||||
/// </summary>
|
||||
public class Reference
|
||||
{
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute("path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
public Reference()
|
||||
{
|
||||
}
|
||||
|
||||
public Reference(string name, string path = null)
|
||||
{
|
||||
Name = name;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var other = obj as Reference;
|
||||
|
||||
// Types are different, so not equal
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare using string equals
|
||||
return String.Equals(Name, other.Name) && String.Equals(Path, other.Path);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = (Name == null) ? 0 : Name.GetHashCode();
|
||||
hash = hash * 7 + ((Path == null) ? 0 : Path.GetHashCode());
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,153 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class Tree<T>
|
||||
{
|
||||
[XmlElement("data")]
|
||||
public T Data { get; set; }
|
||||
|
||||
[XmlArray("children"), XmlArrayItem("child")]
|
||||
public List<Tree<T>> Children { get; set; }
|
||||
|
||||
public Tree()
|
||||
{
|
||||
Children = new List<Tree<T>>();
|
||||
Data = default(T);
|
||||
}
|
||||
|
||||
public Tree(T data)
|
||||
{
|
||||
Children = new List<Tree<T>>();
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public int IndexOf(Tree<T> item)
|
||||
{
|
||||
return Children.IndexOf(item);
|
||||
}
|
||||
|
||||
public void Insert(int index, Tree<T> item)
|
||||
{
|
||||
Children.Insert(index, item);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
Children.RemoveAt(index);
|
||||
}
|
||||
|
||||
public Tree<T> this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Children[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
Children[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Tree<T> item)
|
||||
{
|
||||
Children.Add(item);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Children.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(Tree<T> item)
|
||||
{
|
||||
return Children.Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(Tree<T>[] array, int arrayIndex)
|
||||
{
|
||||
Children.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return Children.Count; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Remove(Tree<T> item)
|
||||
{
|
||||
return Children.Remove(item);
|
||||
}
|
||||
|
||||
public IEnumerator<Tree<T>> GetEnumerator()
|
||||
{
|
||||
return Children.GetEnumerator();
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
return Children.IndexOf(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
Children.Insert(index, new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
Children.Add(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
return Children.Contains(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
foreach (var node in Children)
|
||||
array[arrayIndex++] = node.Data;
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
return Children.Remove(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Tree<T> other = obj as Tree<T>;
|
||||
|
||||
// Types are different, so not equal
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare data
|
||||
if (!object.Equals(Data, other.Data))
|
||||
return false;
|
||||
|
||||
// Compare children array
|
||||
return Children.SequenceEqual(other.Children);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = ((Data == null) ? 0 : Data.GetHashCode());
|
||||
|
||||
foreach (var c in Children)
|
||||
hash = hash * 7 + c.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterEditor.Model
|
||||
{
|
||||
public class Tree<T>
|
||||
{
|
||||
[XmlElement("data")]
|
||||
public T Data { get; set; }
|
||||
|
||||
[XmlArray("children"), XmlArrayItem("child")]
|
||||
public List<Tree<T>> Children { get; set; }
|
||||
|
||||
public Tree()
|
||||
{
|
||||
Children = new List<Tree<T>>();
|
||||
Data = default(T);
|
||||
}
|
||||
|
||||
public Tree(T data)
|
||||
{
|
||||
Children = new List<Tree<T>>();
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public int IndexOf(Tree<T> item)
|
||||
{
|
||||
return Children.IndexOf(item);
|
||||
}
|
||||
|
||||
public void Insert(int index, Tree<T> item)
|
||||
{
|
||||
Children.Insert(index, item);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
Children.RemoveAt(index);
|
||||
}
|
||||
|
||||
public Tree<T> this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Children[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
Children[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Tree<T> item)
|
||||
{
|
||||
Children.Add(item);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Children.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(Tree<T> item)
|
||||
{
|
||||
return Children.Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(Tree<T>[] array, int arrayIndex)
|
||||
{
|
||||
Children.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return Children.Count; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Remove(Tree<T> item)
|
||||
{
|
||||
return Children.Remove(item);
|
||||
}
|
||||
|
||||
public IEnumerator<Tree<T>> GetEnumerator()
|
||||
{
|
||||
return Children.GetEnumerator();
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
return Children.IndexOf(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
Children.Insert(index, new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
Children.Add(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
return Children.Contains(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
foreach (var node in Children)
|
||||
array[arrayIndex++] = node.Data;
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
return Children.Remove(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Tree<T> other = obj as Tree<T>;
|
||||
|
||||
// Types are different, so not equal
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare data
|
||||
if (!object.Equals(Data, other.Data))
|
||||
return false;
|
||||
|
||||
// Compare children array
|
||||
return Children.SequenceEqual(other.Children);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = ((Data == null) ? 0 : Data.GetHashCode());
|
||||
|
||||
foreach (var c in Children)
|
||||
hash = hash * 7 + c.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user