diff --git a/RainmeterStudio/Documents/DocumentEditorFeatures/ICustomDocumentTitleProvider.cs b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/ICustomDocumentTitleProvider.cs similarity index 74% rename from RainmeterStudio/Documents/DocumentEditorFeatures/ICustomDocumentTitleProvider.cs rename to RainmeterStudio.Core/Documents/DocumentEditorFeatures/ICustomDocumentTitleProvider.cs index 832673c2..3d742db8 100644 --- a/RainmeterStudio/Documents/DocumentEditorFeatures/ICustomDocumentTitleProvider.cs +++ b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/ICustomDocumentTitleProvider.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace RainmeterStudio.Documents.DocumentEditorFeatures +namespace RainmeterStudio.Core.Documents.DocumentEditorFeatures { public interface ICustomDocumentTitleProvider { diff --git a/RainmeterStudio/Documents/DocumentEditorFeatures/ISelectionPropertiesProvider.cs b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/ISelectionPropertiesProvider.cs similarity index 71% rename from RainmeterStudio/Documents/DocumentEditorFeatures/ISelectionPropertiesProvider.cs rename to RainmeterStudio.Core/Documents/DocumentEditorFeatures/ISelectionPropertiesProvider.cs index 2d912322..6acb1453 100644 --- a/RainmeterStudio/Documents/DocumentEditorFeatures/ISelectionPropertiesProvider.cs +++ b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/ISelectionPropertiesProvider.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents.DocumentEditorFeatures +namespace RainmeterStudio.Core.Documents.DocumentEditorFeatures { interface ISelectionPropertiesProvider { diff --git a/RainmeterStudio/Documents/DocumentEditorFeatures/IToolboxProvider.cs b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/IToolboxProvider.cs similarity index 78% rename from RainmeterStudio/Documents/DocumentEditorFeatures/IToolboxProvider.cs rename to RainmeterStudio.Core/Documents/DocumentEditorFeatures/IToolboxProvider.cs index 8946ad90..9b88a87c 100644 --- a/RainmeterStudio/Documents/DocumentEditorFeatures/IToolboxProvider.cs +++ b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/IToolboxProvider.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace RainmeterStudio.Documents.DocumentEditorFeatures +namespace RainmeterStudio.Core.Documents.DocumentEditorFeatures { public interface IToolboxProvider { diff --git a/RainmeterStudio/Documents/DocumentEditorFeatures/IUndoSupport.cs b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/IUndoSupport.cs similarity index 67% rename from RainmeterStudio/Documents/DocumentEditorFeatures/IUndoSupport.cs rename to RainmeterStudio.Core/Documents/DocumentEditorFeatures/IUndoSupport.cs index 7db25a2a..3a2cab60 100644 --- a/RainmeterStudio/Documents/DocumentEditorFeatures/IUndoSupport.cs +++ b/RainmeterStudio.Core/Documents/DocumentEditorFeatures/IUndoSupport.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace RainmeterStudio.Documents.DocumentEditorFeatures +namespace RainmeterStudio.Core.Documents.DocumentEditorFeatures { public interface IUndoSupport { diff --git a/RainmeterStudio/Documents/DocumentTemplate_.cs b/RainmeterStudio.Core/Documents/DocumentTemplate.cs similarity index 89% rename from RainmeterStudio/Documents/DocumentTemplate_.cs rename to RainmeterStudio.Core/Documents/DocumentTemplate.cs index 96de8c20..6085aba9 100644 --- a/RainmeterStudio/Documents/DocumentTemplate_.cs +++ b/RainmeterStudio.Core/Documents/DocumentTemplate.cs @@ -1,5 +1,6 @@ -using RainmeterStudio.Model; -namespace RainmeterStudio.Documents +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.Core.Documents { /// /// Represents a document template diff --git a/RainmeterStudio.Core/Documents/IDocumentEditor.cs b/RainmeterStudio.Core/Documents/IDocumentEditor.cs new file mode 100644 index 00000000..f4f33cfc --- /dev/null +++ b/RainmeterStudio.Core/Documents/IDocumentEditor.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.Core.Documents +{ + /// + /// A document editor + /// + public interface IDocumentEditor + { + /// + /// Gets the document attached to this editor instance + /// + IDocument AttachedDocument { get; } + + /// + /// Gets the UI control to display for this editor + /// + UIElement EditorUI { get; } + } +} diff --git a/RainmeterStudio/Documents/IDocumentEditorFactory.cs b/RainmeterStudio.Core/Documents/IDocumentEditorFactory.cs similarity index 87% rename from RainmeterStudio/Documents/IDocumentEditorFactory.cs rename to RainmeterStudio.Core/Documents/IDocumentEditorFactory.cs index fc2ca33d..514c97e2 100644 --- a/RainmeterStudio/Documents/IDocumentEditorFactory.cs +++ b/RainmeterStudio.Core/Documents/IDocumentEditorFactory.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents +namespace RainmeterStudio.Core.Documents { public interface IDocumentEditorFactory { diff --git a/RainmeterStudio/Model/Events/DocumentOpenedEventArgs.cs b/RainmeterStudio.Core/Model/Events/DocumentOpenedEventArgs.cs similarity index 91% rename from RainmeterStudio/Model/Events/DocumentOpenedEventArgs.cs rename to RainmeterStudio.Core/Model/Events/DocumentOpenedEventArgs.cs index 16960dce..f5519e7b 100644 --- a/RainmeterStudio/Model/Events/DocumentOpenedEventArgs.cs +++ b/RainmeterStudio.Core/Model/Events/DocumentOpenedEventArgs.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RainmeterStudio.Documents; +using RainmeterStudio.Core.Documents; -namespace RainmeterStudio.Model.Events +namespace RainmeterStudio.Core.Model.Events { public abstract class DocumentEventArgsBase : EventArgs { diff --git a/RainmeterStudio/Model/IDocument.cs b/RainmeterStudio.Core/Model/IDocument.cs similarity index 83% rename from RainmeterStudio/Model/IDocument.cs rename to RainmeterStudio.Core/Model/IDocument.cs index 2588d756..b0df2577 100644 --- a/RainmeterStudio/Model/IDocument.cs +++ b/RainmeterStudio.Core/Model/IDocument.cs @@ -4,7 +4,7 @@ using System.ComponentModel; using System.Linq; using System.Text; -namespace RainmeterStudio.Model +namespace RainmeterStudio.Core.Model { public interface IDocument : INotifyPropertyChanged { diff --git a/RainmeterStudio/Model/Project.cs b/RainmeterStudio.Core/Model/Project.cs similarity index 95% rename from RainmeterStudio/Model/Project.cs rename to RainmeterStudio.Core/Model/Project.cs index aba7f634..e7b4fcf0 100644 --- a/RainmeterStudio/Model/Project.cs +++ b/RainmeterStudio.Core/Model/Project.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Serialization; -using RainmeterStudio.Storage; +using RainmeterStudio.Core.Storage; -namespace RainmeterStudio.Model +namespace RainmeterStudio.Core.Model { /// /// Defines a Rainmeter Studio project diff --git a/RainmeterStudio.Core/Model/Property.cs b/RainmeterStudio.Core/Model/Property.cs new file mode 100644 index 00000000..64562843 --- /dev/null +++ b/RainmeterStudio.Core/Model/Property.cs @@ -0,0 +1,254 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; + +namespace RainmeterStudio.Core.Model +{ + public interface IProperty : INotifyPropertyChanged + { + /// + /// Gets the name of the property + /// + string Name { get; } + + /// + /// Gets or sets the value of the property + /// + object Value { get; set; } + + /// + /// Gets the data type of the property + /// + Type Type { get; } + + /// + /// Gets the children of this property + /// + ObservableCollection Children { get; } + } + + /// + /// Represents a property + /// + public class Property : IProperty + { + #region Name property + + /// + /// Gets the name of the property + /// + public virtual string Name { get; private set; } + + #endregion + + #region Value property + + private object _value; + + /// + /// Gets or sets the value of the property + /// + public virtual object Value + { + get + { + return _value; + } + set + { + // Test if type changed + bool typeChanged = (_value.GetType() != value.GetType()); + + // Set value + _value = value; + + // Trigger event + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("Value")); + + if (typeChanged) + PropertyChanged(this, new PropertyChangedEventArgs("Type")); + } + } + } + + #endregion + + #region Type property + + /// + /// Gets the type of the property + /// + public virtual Type Type + { + get + { + return Value.GetType(); + } + } + + #endregion + + #region Children property + + /// + /// Gets the children of this property + /// + public ObservableCollection Children { get; private set; } + + #endregion + + #region Property changed event + + /// + /// Triggered when a property changes + /// + public virtual event PropertyChangedEventHandler PropertyChanged; + + #endregion + + #region Constructors + + /// + /// Initializes this property + /// + /// Name of the property + public Property(string name) + { + Name = name; + Value = null; + Children = new ObservableCollection(); + } + + /// + /// Initializes this property + /// + /// Name of the property + /// Value of the property + public Property(string name, object value) + { + Name = name; + Value = value; + Children = new ObservableCollection(); + } + + #endregion + } + + namespace Generic + { + /// + /// Generic property + /// + /// Type of property + public class Property : IProperty + { + #region Value property + + private T _value; + + /// + /// Gets or sets the value of this property + /// + public T Value + { + get + { + return _value; + } + set + { + // Set value + _value = value; + + // Trigger event + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs("Value")); + } + } + + /// + /// Gets or sets the value of this property. Overriden from the generic property. + /// + /// Thrown if value is not of the right type. + object IProperty.Value + { + get + { + return _value; + } + set + { + this.Value = (T)value; + } + } + + #endregion + + #region Type property + + /// + /// Gets the type of this property + /// + public Type Type + { + get + { + return typeof(T); + } + } + + #endregion + + #region Property changed event + + /// + /// Triggered when a property changes + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + #region Constructors + + /// + /// Initializes this property + /// + /// Name of the property + public Property(string name) + { + Name = name; + Value = default(T); + Children = new ObservableCollection(); + } + + /// + /// Initializes this property + /// + /// Name of the property + /// Value of the property + public Property(string name, T value) + { + Name = name; + Value = value; + Children = new ObservableCollection(); + } + + #endregion + + /// + /// Gets the name of the property + /// + public string Name { get; private set; } + + /// + /// Gets the children of this property + /// + public ObservableCollection Children { get; private set; } + } + } +} diff --git a/RainmeterStudio/Model/Reference.cs b/RainmeterStudio.Core/Model/Reference.cs similarity index 92% rename from RainmeterStudio/Model/Reference.cs rename to RainmeterStudio.Core/Model/Reference.cs index c1270971..2f9e14b0 100644 --- a/RainmeterStudio/Model/Reference.cs +++ b/RainmeterStudio.Core/Model/Reference.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Xml.Serialization; -namespace RainmeterStudio.Model +namespace RainmeterStudio.Core.Model { /// /// Reference to a file or folder diff --git a/RainmeterStudio/Model/Tree.cs b/RainmeterStudio.Core/Model/Tree.cs similarity index 94% rename from RainmeterStudio/Model/Tree.cs rename to RainmeterStudio.Core/Model/Tree.cs index ac2ae0d6..1e85d411 100644 --- a/RainmeterStudio/Model/Tree.cs +++ b/RainmeterStudio.Core/Model/Tree.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Xml.Serialization; -namespace RainmeterStudio.Model +namespace RainmeterStudio.Core.Model { public class Tree : IList> { diff --git a/RainmeterStudio.Core/PluginExportAttribute.cs b/RainmeterStudio.Core/PluginExportAttribute.cs new file mode 100644 index 00000000..67c07a0c --- /dev/null +++ b/RainmeterStudio.Core/PluginExportAttribute.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RainmeterStudio.Core +{ + /// + /// Exports a class + /// + /// + /// This attribute should be used to export factories, templates etc. + /// If not used, these will have to be manually exported. + /// The class marked with this flag must have a default constructor! + /// + [AttributeUsage(AttributeTargets.Class)] + public class PluginExportAttribute : Attribute + { + } +} diff --git a/RainmeterStudio.Core/Properties/AssemblyInfo.cs b/RainmeterStudio.Core/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..15f34ed4 --- /dev/null +++ b/RainmeterStudio.Core/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("RainmeterStudio.Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RainmeterStudio.Core")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2a3ee1f8-6844-43d8-8af5-b3e1173462c2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RainmeterStudio.Core/RainmeterStudio.Core.csproj b/RainmeterStudio.Core/RainmeterStudio.Core.csproj new file mode 100644 index 00000000..695d6818 --- /dev/null +++ b/RainmeterStudio.Core/RainmeterStudio.Core.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {1D2A4896-AF31-4E82-A84F-4E218067701F} + Library + Properties + RainmeterStudio.Core + RainmeterStudio.Core + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RainmeterStudio/Documents/IDocumentStorage.cs b/RainmeterStudio.Core/Storage/IDocumentStorage.cs similarity index 91% rename from RainmeterStudio/Documents/IDocumentStorage.cs rename to RainmeterStudio.Core/Storage/IDocumentStorage.cs index 427be2fd..f6d8f1e1 100644 --- a/RainmeterStudio/Documents/IDocumentStorage.cs +++ b/RainmeterStudio.Core/Storage/IDocumentStorage.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents +namespace RainmeterStudio.Core.Storage { public interface IDocumentStorage { diff --git a/RainmeterStudio/Storage/SerializableTree.cs b/RainmeterStudio.Core/Storage/SerializableTree.cs similarity index 94% rename from RainmeterStudio/Storage/SerializableTree.cs rename to RainmeterStudio.Core/Storage/SerializableTree.cs index 369cd8bc..0ba038e5 100644 --- a/RainmeterStudio/Storage/SerializableTree.cs +++ b/RainmeterStudio.Core/Storage/SerializableTree.cs @@ -4,9 +4,9 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Xml.Serialization; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Storage +namespace RainmeterStudio.Core.Storage { /// /// A special type of tree that implements a very small subset of tree operations, and can be serialized diff --git a/RainmeterStudio/Utils/DirectoryHelper.cs b/RainmeterStudio.Core/Utils/DirectoryHelper.cs similarity index 92% rename from RainmeterStudio/Utils/DirectoryHelper.cs rename to RainmeterStudio.Core/Utils/DirectoryHelper.cs index 141c2107..4744b227 100644 --- a/RainmeterStudio/Utils/DirectoryHelper.cs +++ b/RainmeterStudio.Core/Utils/DirectoryHelper.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Utils +namespace RainmeterStudio.Core.Utils { public static class DirectoryHelper { diff --git a/RainmeterStudio/Utils/LinqExtension.cs b/RainmeterStudio.Core/Utils/LinqExtension.cs similarity index 91% rename from RainmeterStudio/Utils/LinqExtension.cs rename to RainmeterStudio.Core/Utils/LinqExtension.cs index a6d3ee94..b0dda7bb 100644 --- a/RainmeterStudio/Utils/LinqExtension.cs +++ b/RainmeterStudio.Core/Utils/LinqExtension.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace RainmeterStudio.Utils +namespace RainmeterStudio.Core.Utils { /// /// Linq extensions diff --git a/RainmeterStudio/Utils/TreeExtensions.cs b/RainmeterStudio.Core/Utils/TreeExtensions.cs similarity index 96% rename from RainmeterStudio/Utils/TreeExtensions.cs rename to RainmeterStudio.Core/Utils/TreeExtensions.cs index fe437848..29ccd246 100644 --- a/RainmeterStudio/Utils/TreeExtensions.cs +++ b/RainmeterStudio.Core/Utils/TreeExtensions.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Utils +namespace RainmeterStudio.Core.Utils { /// /// Extension methods for trees diff --git a/RainmeterStudio.SkinDesigner/Properties/AssemblyInfo.cs b/RainmeterStudio.SkinDesigner/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..e6ec8595 --- /dev/null +++ b/RainmeterStudio.SkinDesigner/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("RainmeterStudio.SkinDesigner")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RainmeterStudio.SkinDesigner")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d4aa7c80-76e6-484d-8766-7cd75f6d9e18")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RainmeterStudio.SkinDesigner/RainmeterStudio.SkinDesignerPlugin.csproj b/RainmeterStudio.SkinDesigner/RainmeterStudio.SkinDesignerPlugin.csproj new file mode 100644 index 00000000..05fba84f --- /dev/null +++ b/RainmeterStudio.SkinDesigner/RainmeterStudio.SkinDesignerPlugin.csproj @@ -0,0 +1,78 @@ + + + + + Debug + AnyCPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6} + Library + Properties + RainmeterStudio.SkinDesignerPlugin + RainmeterStudio.SkinDesignerPlugin + v4.0 + 512 + + + true + full + false + bin\Debug\Plugins\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\Plugins\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + SkinDesignerControl.xaml + + + + + + + + + + MSBuild:Compile + Designer + + + + + {1d2a4896-af31-4e82-a84f-4e218067701f} + RainmeterStudio.Core + + + + + \ No newline at end of file diff --git a/RainmeterStudio.SkinDesigner/SkinDesigner.cs b/RainmeterStudio.SkinDesigner/SkinDesigner.cs new file mode 100644 index 00000000..8b2ca122 --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinDesigner.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.SkinDesignerPlugin +{ + /// + /// Skin designer document editor + /// + public class SkinDesigner : IDocumentEditor + { + /// + /// Gets the document attached to this editor instance + /// + public SkinDocument AttachedDocument { get; private set; } + + /// + /// Gets the document attached to this editor instance + /// + IDocument IDocumentEditor.AttachedDocument + { + get { return AttachedDocument; } + } + + /// + /// Gets the UI control to display for this editor + /// + public SkinDesignerControl EditorUI { get; private set; } + + /// + /// Gets the UI control to display for this editor + /// + UIElement IDocumentEditor.EditorUI + { + get { return EditorUI; } + } + + /// + /// Initializes this editor + /// + /// The document + public SkinDesigner(SkinDocument document) + { + AttachedDocument = document; + } + } +} diff --git a/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml b/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml new file mode 100644 index 00000000..46c16fa0 --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml @@ -0,0 +1,13 @@ + + + + + + diff --git a/RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml.cs b/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml.cs similarity index 67% rename from RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml.cs rename to RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml.cs index c854d10a..f5a5b636 100644 --- a/RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml.cs +++ b/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml.cs @@ -12,14 +12,14 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace RainmeterStudio.Documents.Ini +namespace RainmeterStudio.SkinDesignerPlugin { /// - /// Interaction logic for IniSkinDesignerControl.xaml + /// Interaction logic for SkinDesignerControl.xaml /// - public partial class IniSkinDesignerControl : UserControl + public partial class SkinDesignerControl : Page { - public IniSkinDesignerControl() + public SkinDesignerControl() { InitializeComponent(); } diff --git a/RainmeterStudio.SkinDesigner/SkinDesignerFactory.cs b/RainmeterStudio.SkinDesigner/SkinDesignerFactory.cs new file mode 100644 index 00000000..572408c3 --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinDesignerFactory.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.SkinDesignerPlugin +{ + /// + /// Skin designer factory + /// + [PluginExport] + public class SkinDesignerFactory : IDocumentEditorFactory + { + /// + /// Creates a new editor object + /// + /// Document to be edited by the editor + /// A new document editor + public IDocumentEditor CreateEditor(IDocument document) + { + return new SkinDesigner(document as SkinDocument); + } + + /// + /// Tests if this editor can edit this document type + /// + /// Document type + /// True if the editor can edit the document type + public bool CanEdit(Type type) + { + return (type == typeof(SkinDocument)); + } + } +} diff --git a/RainmeterStudio.SkinDesigner/SkinDocument.cs b/RainmeterStudio.SkinDesigner/SkinDocument.cs new file mode 100644 index 00000000..b1eb42e4 --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinDocument.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.SkinDesignerPlugin +{ + /// + /// Skin document + /// + public class SkinDocument : IDocument + { + private Reference _reference; + + public Reference Reference + { + get + { + return _reference; + } + set + { + _reference = value; + + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs("Reference")); + } + } + + public bool IsDirty { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; + + public SkinMetadata Metadata { get; private set; } + + /// + /// Initializes this skin document + /// + public SkinDocument() + { + IsDirty = false; + Metadata = new SkinMetadata(); + } + } +} diff --git a/RainmeterStudio.SkinDesigner/SkinMetadata.cs b/RainmeterStudio.SkinDesigner/SkinMetadata.cs new file mode 100644 index 00000000..ed8c6b6b --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinMetadata.cs @@ -0,0 +1,57 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using RainmeterStudio.Core.Model; +using RainmeterStudio.Core.Model.Generic; + +namespace RainmeterStudio.SkinDesignerPlugin +{ + public class SkinMetadata : Property + { + /// + /// Gets a property indicating the name of the skin + /// + public Property SkinName { get; private set; } + + /// + /// Gets a property indicating the author of the skin + /// + public Property Author { get; private set; } + + /// + /// Gets a property containing information about this skin (credits, usage instructions, setup etc) + /// + public Property Information { get; private set; } + + /// + /// Gets a property indicating the version of this skin + /// + public Property Version { get; private set; } + + /// + /// Gets a property containing licensing information + /// + public Property License { get; private set; } + + /// + /// Initializes this metadata property + /// + public SkinMetadata() : + base("Metadata") + { + SkinName = new Property("Name"); + Author = new Property("Author"); + Information = new Property("Information"); + Version = new Property("Version"); + License = new Property("License"); + + Children.Add(SkinName); + Children.Add(Author); + Children.Add(Information); + Children.Add(Version); + Children.Add(License); + } + } +} diff --git a/RainmeterStudio.SkinDesigner/SkinStorage.cs b/RainmeterStudio.SkinDesigner/SkinStorage.cs new file mode 100644 index 00000000..a5804b07 --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinStorage.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using RainmeterStudio.Core.Model; +using RainmeterStudio.Core.Storage; + +namespace RainmeterStudio.SkinDesignerPlugin +{ + public class SkinStorage : IDocumentStorage + { + public IDocument Read(string path) + { + throw new NotImplementedException(); + } + + public void Write(string path, IDocument document) + { + throw new NotImplementedException(); + } + + public bool CanRead(string path) + { + throw new NotImplementedException(); + } + + public bool CanWrite(Type documentType) + { + throw new NotImplementedException(); + } + } +} diff --git a/RainmeterStudio.SkinDesigner/SkinTemplate.cs b/RainmeterStudio.SkinDesigner/SkinTemplate.cs new file mode 100644 index 00000000..1cfd353c --- /dev/null +++ b/RainmeterStudio.SkinDesigner/SkinTemplate.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.SkinDesignerPlugin +{ + /// + /// Template of a skin which will be opened in the designer + /// + public class SkinTemplate : DocumentTemplate + { + /// + /// Initializes this skin template + /// + public SkinTemplate() + : base("Skin", "ini") + { + } + + /// + /// Creates a new document using this template + /// + /// Newly created document + public override IDocument CreateDocument() + { + return new SkinDocument(); + } + } +} diff --git a/RainmeterStudio.Tests/RainmeterStudio.Tests.csproj b/RainmeterStudio.Tests/RainmeterStudio.Tests.csproj index 47efa5b9..f485728f 100644 --- a/RainmeterStudio.Tests/RainmeterStudio.Tests.csproj +++ b/RainmeterStudio.Tests/RainmeterStudio.Tests.csproj @@ -61,6 +61,10 @@ + + {1d2a4896-af31-4e82-a84f-4e218067701f} + RainmeterStudio.Core + {438d0136-4a27-4e4d-a617-fface4554236} RainmeterStudio diff --git a/RainmeterStudio.Tests/Storage/ProjectStorageTest.cs b/RainmeterStudio.Tests/Storage/ProjectStorageTest.cs index fdd834b8..dfabe986 100644 --- a/RainmeterStudio.Tests/Storage/ProjectStorageTest.cs +++ b/RainmeterStudio.Tests/Storage/ProjectStorageTest.cs @@ -4,8 +4,8 @@ using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using RainmeterStudio.Storage; -using RainmeterStudio.Model; using System.IO; +using RainmeterStudio.Core.Model; namespace RainmeterStudio.Tests.Storage { diff --git a/RainmeterStudio.TextEditor/Properties/AssemblyInfo.cs b/RainmeterStudio.TextEditor/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..f1a24cba --- /dev/null +++ b/RainmeterStudio.TextEditor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("RainmeterStudio.TextEditor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RainmeterStudio.TextEditor")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("61e147ab-2bdd-4f7a-a610-60617d7e31d3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RainmeterStudio.TextEditor/RainmeterStudio.TextEditorPlugin.csproj b/RainmeterStudio.TextEditor/RainmeterStudio.TextEditorPlugin.csproj new file mode 100644 index 00000000..5a4a9670 --- /dev/null +++ b/RainmeterStudio.TextEditor/RainmeterStudio.TextEditorPlugin.csproj @@ -0,0 +1,77 @@ + + + + + Debug + AnyCPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38} + Library + Properties + RainmeterStudio.TextEditorPlugin + RainmeterStudio.TextEditorPlugin + v4.0 + 512 + + + true + full + false + bin\Debug\Plugins\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\Plugins\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + TextEditorControl.xaml + + + + + + + {1d2a4896-af31-4e82-a84f-4e218067701f} + RainmeterStudio.Core + + + + + MSBuild:Compile + Designer + + + + + \ No newline at end of file diff --git a/RainmeterStudio/Documents/Text/TextDocument.cs b/RainmeterStudio.TextEditor/TextDocument.cs similarity index 91% rename from RainmeterStudio/Documents/Text/TextDocument.cs rename to RainmeterStudio.TextEditor/TextDocument.cs index 9c500726..e2e6375c 100644 --- a/RainmeterStudio/Documents/Text/TextDocument.cs +++ b/RainmeterStudio.TextEditor/TextDocument.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using RainmeterStudio.Model; using System.ComponentModel; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents.Text +namespace RainmeterStudio.TextEditorPlugin { public class TextDocument : IDocument { diff --git a/RainmeterStudio/Documents/Text/TextDocumentTemplate.cs b/RainmeterStudio.TextEditor/TextDocumentTemplate.cs similarity index 70% rename from RainmeterStudio/Documents/Text/TextDocumentTemplate.cs rename to RainmeterStudio.TextEditor/TextDocumentTemplate.cs index 6ed131a4..721ecbe0 100644 --- a/RainmeterStudio/Documents/Text/TextDocumentTemplate.cs +++ b/RainmeterStudio.TextEditor/TextDocumentTemplate.cs @@ -2,14 +2,16 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents.Text +namespace RainmeterStudio.TextEditorPlugin { /// /// A blank text document template /// - [AutoRegister] + [PluginExport] public class TextDocumentTemplate : DocumentTemplate { public TextDocumentTemplate() diff --git a/RainmeterStudio/Documents/Text/TextEditor.cs b/RainmeterStudio.TextEditor/TextEditor.cs similarity index 80% rename from RainmeterStudio/Documents/Text/TextEditor.cs rename to RainmeterStudio.TextEditor/TextEditor.cs index 6ed5318a..1835fbe6 100644 --- a/RainmeterStudio/Documents/Text/TextEditor.cs +++ b/RainmeterStudio.TextEditor/TextEditor.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents.Text +namespace RainmeterStudio.TextEditorPlugin { public class TextEditor : IDocumentEditor { diff --git a/RainmeterStudio/Documents/Text/TextEditorControl.xaml b/RainmeterStudio.TextEditor/TextEditorControl.xaml similarity index 84% rename from RainmeterStudio/Documents/Text/TextEditorControl.xaml rename to RainmeterStudio.TextEditor/TextEditorControl.xaml index 41b4a98f..2fcd014e 100644 --- a/RainmeterStudio/Documents/Text/TextEditorControl.xaml +++ b/RainmeterStudio.TextEditor/TextEditorControl.xaml @@ -1,4 +1,4 @@ - /// Interaction logic for TextEditorControl.xaml diff --git a/RainmeterStudio/Documents/Text/TextEditorFactory.cs b/RainmeterStudio.TextEditor/TextEditorFactory.cs similarity index 70% rename from RainmeterStudio/Documents/Text/TextEditorFactory.cs rename to RainmeterStudio.TextEditor/TextEditorFactory.cs index 823dfca4..2fad25de 100644 --- a/RainmeterStudio/Documents/Text/TextEditorFactory.cs +++ b/RainmeterStudio.TextEditor/TextEditorFactory.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using RainmeterStudio.Business; -using RainmeterStudio.Model; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; -namespace RainmeterStudio.Documents.Text +namespace RainmeterStudio.TextEditorPlugin { - [AutoRegister] + [PluginExport] public class TextEditorFactory : IDocumentEditorFactory { public IDocumentEditor CreateEditor(IDocument document) diff --git a/RainmeterStudio/Documents/Text/TextStorage.cs b/RainmeterStudio.TextEditor/TextStorage.cs similarity index 88% rename from RainmeterStudio/Documents/Text/TextStorage.cs rename to RainmeterStudio.TextEditor/TextStorage.cs index c12caede..445334fe 100644 --- a/RainmeterStudio/Documents/Text/TextStorage.cs +++ b/RainmeterStudio.TextEditor/TextStorage.cs @@ -1,13 +1,15 @@ using System; using System.IO; -using RainmeterStudio.Model; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Model; +using RainmeterStudio.Core.Storage; -namespace RainmeterStudio.Documents.Text +namespace RainmeterStudio.TextEditorPlugin { /// /// Storage for text files /// - [AutoRegister] + [PluginExport] public class TextStorage : IDocumentStorage { /// diff --git a/RainmeterStudio.sln b/RainmeterStudio.sln index 9566f702..ec30b7f5 100644 --- a/RainmeterStudio.sln +++ b/RainmeterStudio.sln @@ -7,11 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "Common\Common.vcx EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Installer", "Installer\Installer.vcxproj", "{2FCFBFD2-2720-4BDD-B620-4BDD3DBB8D3D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Language", "Language\Language.vcxproj", "{6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "Library\Library.vcxproj", "{BE9D2400-7F1C-49D6-8498-5CE495491AD6}" ProjectSection(ProjectDependencies) = postProject - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A} = {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A} {19312085-AA51-4BD6-BE92-4B6098CCA539} = {19312085-AA51-4BD6-BE92-4B6098CCA539} {BC25C5DC-AEFB-49F9-8188-3C1B8C8929E6} = {BC25C5DC-AEFB-49F9-8188-3C1B8C8929E6} {6D61FBE9-6913-4885-A95D-1A8C0C223D82} = {6D61FBE9-6913-4885-A95D-1A8C0C223D82} @@ -76,6 +73,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainmeterStudio", "Rainmete EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainmeterStudio.Tests", "RainmeterStudio.Tests\RainmeterStudio.Tests.csproj", "{845F4BD4-6822-4D92-9DDB-15FD18A47E5A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainmeterStudio.SkinDesignerPlugin", "RainmeterStudio.SkinDesigner\RainmeterStudio.SkinDesignerPlugin.csproj", "{E8BD25E9-3055-4688-9E83-ECF684EF30C6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainmeterStudio.Core", "RainmeterStudio.Core\RainmeterStudio.Core.csproj", "{1D2A4896-AF31-4E82-A84F-4E218067701F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainmeterStudio.TextEditorPlugin", "RainmeterStudio.TextEditor\RainmeterStudio.TextEditorPlugin.csproj", "{9A644478-2F1B-4145-8B31-6F8DBD42EC38}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8469BE7E-BCDB-4AA8-9541-719E8BFB19A7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{4CCE6052-F43E-4360-B3E2-C046C6C0D86C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RainmeterPlugins", "RainmeterPlugins", "{53D952E0-CFD2-4EFF-BAD4-5969E760EFA1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -112,20 +121,6 @@ Global {2FCFBFD2-2720-4BDD-B620-4BDD3DBB8D3D}.Release|Mixed Platforms.Build.0 = Release|Win32 {2FCFBFD2-2720-4BDD-B620-4BDD3DBB8D3D}.Release|Win32.ActiveCfg = Release|Win32 {2FCFBFD2-2720-4BDD-B620-4BDD3DBB8D3D}.Release|x64.ActiveCfg = Release|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|Win32.ActiveCfg = Debug|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|Win32.Build.0 = Debug|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|x64.ActiveCfg = Debug|x64 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Debug|x64.Build.0 = Debug|x64 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|Any CPU.ActiveCfg = Release|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|Win32.ActiveCfg = Release|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|Win32.Build.0 = Release|Win32 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|x64.ActiveCfg = Release|x64 - {6BE6F228-B741-4DA9-9FBC-E9F2A7BD483A}.Release|x64.Build.0 = Release|x64 {BE9D2400-7F1C-49D6-8498-5CE495491AD6}.Debug|Any CPU.ActiveCfg = Debug|Win32 {BE9D2400-7F1C-49D6-8498-5CE495491AD6}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {BE9D2400-7F1C-49D6-8498-5CE495491AD6}.Debug|Mixed Platforms.Build.0 = Debug|Win32 @@ -528,8 +523,71 @@ Global {845F4BD4-6822-4D92-9DDB-15FD18A47E5A}.Release|Mixed Platforms.Build.0 = Release|Any CPU {845F4BD4-6822-4D92-9DDB-15FD18A47E5A}.Release|Win32.ActiveCfg = Release|Any CPU {845F4BD4-6822-4D92-9DDB-15FD18A47E5A}.Release|x64.ActiveCfg = Release|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Debug|Win32.ActiveCfg = Debug|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Debug|x64.ActiveCfg = Debug|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Release|Any CPU.Build.0 = Release|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Release|Win32.ActiveCfg = Release|Any CPU + {E8BD25E9-3055-4688-9E83-ECF684EF30C6}.Release|x64.ActiveCfg = Release|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Debug|Win32.ActiveCfg = Debug|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Debug|x64.ActiveCfg = Debug|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Release|Any CPU.Build.0 = Release|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Release|Win32.ActiveCfg = Release|Any CPU + {1D2A4896-AF31-4E82-A84F-4E218067701F}.Release|x64.ActiveCfg = Release|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Debug|Win32.ActiveCfg = Debug|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Debug|x64.ActiveCfg = Debug|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Release|Any CPU.Build.0 = Release|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Release|Win32.ActiveCfg = Release|Any CPU + {9A644478-2F1B-4145-8B31-6F8DBD42EC38}.Release|x64.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {845F4BD4-6822-4D92-9DDB-15FD18A47E5A} = {8469BE7E-BCDB-4AA8-9541-719E8BFB19A7} + {E8BD25E9-3055-4688-9E83-ECF684EF30C6} = {4CCE6052-F43E-4360-B3E2-C046C6C0D86C} + {9A644478-2F1B-4145-8B31-6F8DBD42EC38} = {4CCE6052-F43E-4360-B3E2-C046C6C0D86C} + {EE8EC522-8430-4B46-86A3-D943D77F9E4B} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {F32FA418-8DF4-4E94-B92B-EBD502F5DC07} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {64FDEE97-6B7E-40E5-A489-ECA322825BC8} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {A221819D-4263-42AA-B22A-C022924842A7} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {2CFEC79A-E39E-4FFD-ABC2-C4A69DD1E44D} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {A2DD3CBE-B140-4892-A875-24107FA52518} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {C7FECFCD-E6C6-4F95-BB9A-E1762B043969} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {5344B52B-BAC3-479C-B41D-D465B8BDA1AD} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {C862B662-5CC6-4E79-B1B3-905E0B98D627} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {C30E7EB6-9655-4AF4-98AE-D6E6B14631AF} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {05203741-CD80-4060-8218-EC5D1120FE3E} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {C029E0CF-F203-41D0-9608-A3EA2CF0ED1F} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {4F8C4C09-431C-45C4-830B-32006E783C3A} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {17D3BD92-6F5D-438C-A89B-88F4CE06DB94} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {D10AB316-0F7A-4551-BE4F-385E04CCF1E8} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {6EBCA4DA-8CC7-42FE-8F45-878ABE165078} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {4640AB3A-5A8B-2DA0-980C-A70BCAB3A7F1} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {8B820B9F-C154-417C-A090-42198F2AF496} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {45A34285-56DD-4521-912B-3F884D36FA35} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {6D032D6B-7656-4743-B454-3388E2921EB0} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + {B9184DBA-C6B7-44FE-8BBD-0852DB22D2E4} = {53D952E0-CFD2-4EFF-BAD4-5969E760EFA1} + EndGlobalSection EndGlobal diff --git a/RainmeterStudio/Business/DocumentManager.cs b/RainmeterStudio/Business/DocumentManager.cs index 7b7b5ea1..5e9b60c8 100644 --- a/RainmeterStudio/Business/DocumentManager.cs +++ b/RainmeterStudio/Business/DocumentManager.cs @@ -4,10 +4,10 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text; -using RainmeterStudio.Documents; -using RainmeterStudio.Model; -using RainmeterStudio.Model.Events; -using RainmeterStudio.Utils; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Model; +using RainmeterStudio.Core.Model.Events; +using RainmeterStudio.Core.Storage; namespace RainmeterStudio.Business { @@ -67,61 +67,6 @@ namespace RainmeterStudio.Business { } - /// - /// Registers all classes with the auto register flag - /// - /// We love linq - public void PerformAutoRegister() - { - // Get all assemblies - AppDomain.CurrentDomain.GetAssemblies() - - // Get all types - .SelectMany(assembly => assembly.GetTypes()) - - // Select only the classes - .Where(type => type.IsClass) - - // That have the AutoRegister attribute - .Where(type => type.GetCustomAttributes(typeof(AutoRegisterAttribute), false).Length > 0) - - // That implement any of the types that can be registered - .Where((type) => - { - bool res = false; - res |= typeof(IDocumentEditorFactory).IsAssignableFrom(type); - res |= typeof(IDocumentStorage).IsAssignableFrom(type); - res |= typeof(DocumentTemplate).IsAssignableFrom(type); - - return res; - }) - - // Obtain their default constructor - .Select(type => type.GetConstructor(new Type[0])) - - // Invoke the default constructor - .Select(constructor => constructor.Invoke(new object[0])) - - // Register - .ForEach(obj => - { - // Try to register factory - var factory = obj as IDocumentEditorFactory; - if (factory != null) - RegisterEditorFactory(factory); - - // Try to register as storage - var storage = obj as IDocumentStorage; - if (storage != null) - RegisterStorage(storage); - - // Try to register as document template - var doctemplate = obj as DocumentTemplate; - if (doctemplate != null) - RegisterTemplate(doctemplate); - }); - } - /// /// Registers a document editor factory /// diff --git a/RainmeterStudio/Business/PluginManager.cs b/RainmeterStudio/Business/PluginManager.cs new file mode 100644 index 00000000..f4682e03 --- /dev/null +++ b/RainmeterStudio/Business/PluginManager.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Utils; + +namespace RainmeterStudio.Business +{ + /// + /// Manages RainmeterStudio plugins + /// + public class PluginManager + { + public delegate void RegisterMethod(object objectToRegister); + + List _loadedPlugins = new List(); + Dictionary _registerTypes = new Dictionary(); + + public PluginManager() + { + } + + public void AddRegisterType(Type interfaceType, RegisterMethod method) + { + _registerTypes.Add(interfaceType, method); + } + + public void LoadPlugins() + { + // Get "Plugins" folder path + var location = Assembly.GetExecutingAssembly().Location; + var pluginsPath = Path.Combine(Path.GetDirectoryName(location), "Plugins"); + + // Load all DLLs from "Plugins" folder + foreach (var file in Directory.EnumerateFiles(pluginsPath, "*.dll")) + LoadPlugin(file); + } + + public void LoadPlugin(string file) + { + Assembly assembly = null; + + // Try to load assembly + try + { + assembly = Assembly.LoadFile(file); + } + catch (Exception ex) + { + Debug.WriteLine("Failed to load assembly {0}: {1}", file, ex); + } + + // Loaded, do initialization stuff + if (assembly != null) + { + _loadedPlugins.Add(assembly); + + Initialize(assembly); + + Debug.WriteLine("Loaded plugin: {0}", assembly.FullName); + } + } + + private void Initialize(Assembly assembly) + { + // Register factories and stuff + assembly.GetTypes() + + // Select only the classes + .Where(type => type.IsClass) + + // That have the AutoRegister attribute + .Where(type => type.GetCustomAttributes(typeof(PluginExportAttribute), false).Length > 0) + + // Perform register + .ForEach((type) => + { + foreach (var pair in _registerTypes) + { + if (pair.Key.IsAssignableFrom(type)) + { + var constructor = type.GetConstructor(new Type[0]); + var obj = constructor.Invoke(new object[0]); + + pair.Value(obj); + } + } + }); + } + + public IEnumerable LoadedPlugins + { + get + { + return _loadedPlugins; + } + } + } +} diff --git a/RainmeterStudio/Business/ProjectManager.cs b/RainmeterStudio/Business/ProjectManager.cs index a44f0374..45d8fecf 100644 --- a/RainmeterStudio/Business/ProjectManager.cs +++ b/RainmeterStudio/Business/ProjectManager.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using RainmeterStudio.Model; +using RainmeterStudio.Core.Model; +using RainmeterStudio.Core.Storage; using RainmeterStudio.Storage; namespace RainmeterStudio.Business diff --git a/RainmeterStudio/Documents/IDocumentEditor.cs b/RainmeterStudio/Documents/IDocumentEditor.cs deleted file mode 100644 index 0318e14e..00000000 --- a/RainmeterStudio/Documents/IDocumentEditor.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using RainmeterStudio.Model; - -namespace RainmeterStudio.Documents -{ - public interface IDocumentEditor - { - IDocument AttachedDocument { get; } - UIElement EditorUI { get; } - } -} diff --git a/RainmeterStudio/Documents/Ini/IniDocument.cs b/RainmeterStudio/Documents/Ini/IniDocument.cs deleted file mode 100644 index 927171ca..00000000 --- a/RainmeterStudio/Documents/Ini/IniDocument.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using RainmeterStudio.Model; - -namespace RainmeterStudio.Documents.Ini -{ - /*public class IniDocument : IDocument - { - }*/ -} diff --git a/RainmeterStudio/Documents/Ini/IniSkinDesigner.cs b/RainmeterStudio/Documents/Ini/IniSkinDesigner.cs deleted file mode 100644 index dda2d27c..00000000 --- a/RainmeterStudio/Documents/Ini/IniSkinDesigner.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using RainmeterStudio.Model; - -namespace RainmeterStudio.Documents.Ini -{ - /*public class IniSkinDesigner : IDocumentEditor - { - public override IDocument Document - { - get { throw new NotImplementedException(); } - } - - public override string Title - { - get { throw new NotImplementedException(); } - } - - public override System.Windows.UIElement EditorUI - { - get { throw new NotImplementedException(); } - } - - public override EventHandler SelectionChanged - { - get { throw new NotImplementedException(); } - } - }*/ -} diff --git a/RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml b/RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml deleted file mode 100644 index b4c5c6df..00000000 --- a/RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/RainmeterStudio/Documents/Ini/IniSkinDesignerFactory.cs b/RainmeterStudio/Documents/Ini/IniSkinDesignerFactory.cs deleted file mode 100644 index ee89b656..00000000 --- a/RainmeterStudio/Documents/Ini/IniSkinDesignerFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using RainmeterStudio.Model; - -namespace RainmeterStudio.Documents.Ini -{ - /*public class IniSkinDesignerFactory : IDocumentEditorFactory - { - - }*/ -} diff --git a/RainmeterStudio/LICENSE b/RainmeterStudio/LICENSE deleted file mode 100644 index fe5f7ed6..00000000 --- a/RainmeterStudio/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2008 Ricardo Amores Hernández - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/RainmeterStudio/MainClass.cs b/RainmeterStudio/MainClass.cs index 30b5fc5b..ef750981 100644 --- a/RainmeterStudio/MainClass.cs +++ b/RainmeterStudio/MainClass.cs @@ -5,7 +5,8 @@ using System.Reflection; using System.Text; using System.Windows; using RainmeterStudio.Business; -using RainmeterStudio.Documents; +using RainmeterStudio.Core.Documents; +using RainmeterStudio.Core.Storage; using RainmeterStudio.Storage; using RainmeterStudio.UI; using RainmeterStudio.UI.Controller; @@ -21,12 +22,19 @@ namespace RainmeterStudio SplashScreen splash = new SplashScreen("Resources/splash.png"); splash.Show(true); - // Initialize managers + // Initialize project manager ProjectStorage projectStorage = new ProjectStorage(); ProjectManager projectManager = new ProjectManager(projectStorage); + // Initialize document manager DocumentManager documentManager = new DocumentManager(); - documentManager.PerformAutoRegister(); + + // Initialize plugin manager + PluginManager pluginManager = new PluginManager(); + pluginManager.AddRegisterType(typeof(IDocumentStorage), obj => documentManager.RegisterStorage((IDocumentStorage)obj)); + pluginManager.AddRegisterType(typeof(DocumentTemplate), obj => documentManager.RegisterTemplate((DocumentTemplate)obj)); + pluginManager.AddRegisterType(typeof(IDocumentEditorFactory), obj => documentManager.RegisterEditorFactory((IDocumentEditorFactory)obj)); + pluginManager.LoadPlugins(); // Create & run app var uiManager = new UIManager(projectManager, documentManager); diff --git a/RainmeterStudio/Model/Property.cs b/RainmeterStudio/Model/Property.cs deleted file mode 100644 index b50510c5..00000000 --- a/RainmeterStudio/Model/Property.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; - -namespace RainmeterStudio.Model -{ - public class Property : INotifyPropertyChanged - { - /// - /// Gets or sets the name of the property - /// - public string Name { get; private set; } - - private object _value; - - /// - /// Gets or sets the value of the property - /// - public object Value - { - get - { - return _value; - } - set - { - _value = value; - - if (PropertyChanged != null) - PropertyChanged(this, new PropertyChangedEventArgs("Value")); - } - } - - /// - /// Triggered when the value changes - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Initializes this property - /// - /// Name of the property - /// Value of the property - public Property(string name, object value = null) - { - Name = name; - Value = value; - } - } -} diff --git a/RainmeterStudio/Rainmeter.cs b/RainmeterStudio/Rainmeter.cs index 9784d15b..5ce98fae 100644 --- a/RainmeterStudio/Rainmeter.cs +++ b/RainmeterStudio/Rainmeter.cs @@ -7,7 +7,7 @@ using RainmeterStudio.Interop; namespace RainmeterStudio { - class Rainmeter + class RainmeterContext { #region Imports @@ -19,17 +19,17 @@ namespace RainmeterStudio #endregion - private static Rainmeter _instance = null; + private static RainmeterContext _instance = null; /// /// Gets the single instance of this class /// - public static Rainmeter Instance + public static RainmeterContext Instance { get { if (_instance == null) - _instance = new Rainmeter(); + _instance = new RainmeterContext(); return _instance; } @@ -39,7 +39,7 @@ namespace RainmeterStudio #region Constructor, finalizer - private Rainmeter() + private RainmeterContext() { _handle = Rainmeter_Initialize(); @@ -47,7 +47,7 @@ namespace RainmeterStudio throw new Exception("Failed to initialize native library."); } - ~Rainmeter() + ~RainmeterContext() { Rainmeter_Finalize(_handle); } diff --git a/RainmeterStudio/Documents/AutoRegisterAttribute.cs b/RainmeterStudio/Rainmeter/DataTypes/Action.cs similarity index 51% rename from RainmeterStudio/Documents/AutoRegisterAttribute.cs rename to RainmeterStudio/Rainmeter/DataTypes/Action.cs index c1482965..91ef1748 100644 --- a/RainmeterStudio/Documents/AutoRegisterAttribute.cs +++ b/RainmeterStudio/Rainmeter/DataTypes/Action.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace RainmeterStudio.Documents +namespace RainmeterStudio.Rainmeter.DataTypes { - public class AutoRegisterAttribute : Attribute + public class Action { } } diff --git a/RainmeterStudio/Rainmeter/DataTypes/Bang.cs b/RainmeterStudio/Rainmeter/DataTypes/Bang.cs new file mode 100644 index 00000000..e7c14050 --- /dev/null +++ b/RainmeterStudio/Rainmeter/DataTypes/Bang.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RainmeterStudio.Rainmeter.DataTypes +{ + public abstract class Bang + { + /// + /// Argument info + /// + public class ArgumentInfo + { + public string Name { get; set; } + public Type DataType { get; set; } + + public ArgumentInfo(string name, Type dataType) + { + Name = name; + DataType = dataType; + } + } + + /// + /// Gets the function name of the bang + /// + public abstract string FunctionName { get; } + + /// + /// Gets the list of arguments + /// + public abstract IEnumerable Arguments { get; } + + /// + /// Executes the bang + /// + public void Execute(params object[] args) + { + + } + + /// + /// Gets the string representation of this bang + /// + /// String representation + public override string ToString() + { + StringBuilder builder = new StringBuilder(); + builder.AppendFormat("!{0}", FunctionName); + + foreach (var arg in Arguments.Select(x => x.ToString())) + { + if (arg.Any(Char.IsWhiteSpace)) + builder.AppendFormat(@" ""{0}""", arg); + + else builder.AppendFormat(" {0}", arg); + } + + return builder.ToString(); + } + } +} diff --git a/RainmeterStudio/Rainmeter/Group.cs b/RainmeterStudio/Rainmeter/Group.cs new file mode 100644 index 00000000..ea15bff0 --- /dev/null +++ b/RainmeterStudio/Rainmeter/Group.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace RainmeterStudio.Rainmeter +{ + /// + /// Represents a group + /// + /// + /// Skins, meters, and measures can be categorized into groups to allow + /// easier control with group bangs. For example, the !HideMeterGroup + /// bang may be used to hide multiple meters in a single bang (compared + /// to !HideMeter statements for each meter). + /// + public abstract class Group + { + #region Imports + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + private static extern bool Group_BelongsToGroup(out bool result, Int32 handle, string group); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + private static extern bool Group_Destroy(Int32 handle); + + #endregion + + /// + /// Gets or sets the associated handle of this object + /// + protected Int32 Handle { get; private set; } + + /// + /// Tests if belongs to a group + /// + /// Group name + /// True if belongs + public bool BelongsToGroup(string group) + { + bool result; + + if (!Group_BelongsToGroup(out result, Handle, group)) + throw new ExternalException("Belongs to group failed."); + + return result; + } + + /// + /// Initializes this group + /// + /// The handle + protected Group(Int32 handle) + { + Handle = handle; + } + + /// + /// Finalizer + /// + ~Group() + { + Group_Destroy(Handle); + } + } +} diff --git a/RainmeterStudio/Model/RainmeterConfig.cs b/RainmeterStudio/Rainmeter/Measure.cs similarity index 58% rename from RainmeterStudio/Model/RainmeterConfig.cs rename to RainmeterStudio/Rainmeter/Measure.cs index 5d67763c..d0689761 100644 --- a/RainmeterStudio/Model/RainmeterConfig.cs +++ b/RainmeterStudio/Rainmeter/Measure.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace RainmeterStudio.Model +namespace RainmeterStudio.Rainmeter { - public class RainmeterConfig + public class Measure { } } diff --git a/RainmeterStudio/Rainmeter/Meter.cs b/RainmeterStudio/Rainmeter/Meter.cs new file mode 100644 index 00000000..0ae41df5 --- /dev/null +++ b/RainmeterStudio/Rainmeter/Meter.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RainmeterStudio.Rainmeter +{ + public abstract class Meter : Group + { + public Meter(int handle) + : base(handle) + { + } + } +} diff --git a/RainmeterStudio/Rainmeter/Section.cs b/RainmeterStudio/Rainmeter/Section.cs new file mode 100644 index 00000000..7622e8c0 --- /dev/null +++ b/RainmeterStudio/Rainmeter/Section.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace RainmeterStudio.Rainmeter +{ + public abstract class Section : Group + { + #region Imports + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_GetName(out string result, Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_GetOriginalName(out string result, Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_HasDynamicVariables(out bool result, Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_SetDynamicVariables(Int32 handle, bool value); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_ResetUpdateCounter(Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_GetUpdateCounter(out int result, Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_GetUpdateDivider(out int result, Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_GetOnUpdateAction(out string result, Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_DoUpdateAction(Int32 handle); + + [DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool Section_Destroy(Int32 handle); + + #endregion + + protected Section(Int32 handle) + : base(handle) + { + } + + ~Section() + { + Section_Destroy(Handle); + } + + /// + /// Gets the name of the section + /// + public string Name + { + get + { + string name; + + if (!Section_GetName(out name, Handle)) + throw new ExternalException("Get name failed."); + + return name; + } + } + + /// + /// Gets the original name of the section + /// + public string OriginalName + { + get + { + string name; + + if (!Section_GetOriginalName(out name, Handle)) + throw new ExternalException("Get original name failed."); + + return name; + } + } + + /// + /// Gets a value indicating if this section has dynamic variables + /// + public bool HasDynamicVariables + { + get + { + bool result; + + if (!Section_HasDynamicVariables(out result, Handle)) + throw new ExternalException("Get dynamic variables has failed."); + + return result; + } + set + { + if (!Section_SetDynamicVariables(Handle, value)) + throw new ExternalException("Set dynamic variables has failed."); + } + } + + /// + /// Resets the update counter + /// + public void ResetUpdateCounter() + { + if (!Section_ResetUpdateCounter(Handle)) + throw new ExternalException("Reset update counter has failed."); + } + + /// + /// Gets the update counter + /// + public int UpdateCounter + { + get + { + int result; + + if (!Section_GetUpdateCounter(out result, Handle)) + throw new ExternalException("Get update counter has failed."); + + return result; + } + } + + /// + /// Gets the update divider + /// + public int UpdateDivider + { + get + { + int result; + + if (!Section_GetUpdateDivider(out result, Handle)) + throw new ExternalException("Get update divider has failed."); + + return result; + } + } + + /// + /// Gets the update divider + /// + public string OnUpdateAction + { + get + { + string result; + + if (!Section_GetOnUpdateAction(out result, Handle)) + throw new ExternalException("Get on update action has failed."); + + return result; + } + } + + /// + /// Executes the update action + /// + public void DoUpdateAction() + { + if (!Section_DoUpdateAction(Handle)) + throw new ExternalException("Do update action has failed."); + } + } +} diff --git a/RainmeterStudio/RainmeterStudio.csproj b/RainmeterStudio/RainmeterStudio.csproj index f1b542c2..f8a2ca54 100644 --- a/RainmeterStudio/RainmeterStudio.csproj +++ b/RainmeterStudio/RainmeterStudio.csproj @@ -35,9 +35,6 @@ 4 - - ..\packages\ini-parser.2.1.1\lib\INIFileParser.dll - @@ -71,39 +68,17 @@ Designer + - - - - - - - - - - - - TextEditorControl.xaml - - - - - - - - IniSkinDesignerControl.xaml - - - - - - - - - + + + + + + True True @@ -115,8 +90,6 @@ Strings.resx - - @@ -125,7 +98,6 @@ CreateDocumentDialog.xaml - CreateProjectDialog.xaml @@ -135,17 +107,6 @@ - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - Designer MSBuild:Compile @@ -206,7 +167,6 @@ Strings.Designer.cs - SettingsSingleFileGenerator @@ -265,6 +225,15 @@ + + + + + + {1d2a4896-af31-4e82-a84f-4e218067701f} + RainmeterStudio.Core + +