From 5f5512dce6cf3afc5eb262ad4f910d64d4c7a6f6 Mon Sep 17 00:00:00 2001 From: Lluis Sanchez Date: Thu, 1 Jul 2010 16:25:55 +0000 Subject: * Mono.Addins.csproj: * Mono.Addins.Description/Extension.cs: * Mono.Addins.Description/Dependency.cs: * Mono.Addins.Description/AddinFlags.cs: * Mono.Addins.Description/ExtensionPoint.cs: * Mono.Addins.Description/AddinDependency.cs: * Mono.Addins.Description/AddinDescription.cs: * Mono.Addins.Description/ExtensionNodeSet.cs: * Mono.Addins.Description/NativeDependency.cs: * Mono.Addins.Localization/IAddinLocalizer.cs: * Mono.Addins.Description/ObjectDescription.cs: * Mono.Addins.Description/ModuleDescription.cs: * Mono.Addins.Description/ExtensionNodeType.cs: * Mono.Addins.Description/NodeTypeAttribute.cs: * Mono.Addins.Description/AssemblyDependency.cs: * Mono.Addins.Description/ExtensionCollection.cs: * Mono.Addins.Description/DependencyCollection.cs: * Mono.Addins.Localization/IPluralAddinLocalizer.cs: * Mono.Addins.Localization/IAddinLocalizerFactory.cs: * Mono.Addins.Description/ExtensionNodeDescription.cs: * Mono.Addins.Description/ExtensionPointCollection.cs: * Mono.Addins.Description/ConditionTypeDescription.cs: * Mono.Addins.Description/ExtensionNodeSetCollection.cs: * Mono.Addins.Description/ModuleDescriptionCollection.cs: * Mono.Addins.Description/NodeTypeAttributeCollection.cs: * Mono.Addins.Description/ExtensionNodeTypeCollection.cs: * Mono.Addins.Description/ObjectDescriptionCollection.cs: * Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs: * Mono.Addins.Description/ConditionTypeDescriptionCollection.cs: Added documentation. svn path=/trunk/mono-addins/; revision=159783 --- .../Mono.Addins.Description/AddinDescription.cs | 258 ++++++++++++++++++++- 1 file changed, 256 insertions(+), 2 deletions(-) (limited to 'Mono.Addins/Mono.Addins.Description/AddinDescription.cs') diff --git a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs index e7e93fd..3d589e9 100644 --- a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs @@ -37,8 +37,13 @@ using Mono.Addins.Database; namespace Mono.Addins.Description { - // This class represent an add-in configuration file. It has properties for getting - // all information, and methods for loading and saving files. + /// + /// An add-in description + /// + /// + /// This class represent an add-in manifest. It has properties for getting + /// all information, and methods for loading and saving files. + /// public class AddinDescription: IBinaryXmlElement { XmlDocument configDoc; @@ -97,25 +102,58 @@ namespace Mono.Addins.Description set { ownerDatabase = value; } } + /// + /// Gets or sets the path to the main addin file. + /// + /// + /// The addin file. + /// + /// + /// The add-in file can be either the main assembly of an add-in or an xml manifest. + /// public string AddinFile { get { return sourceAddinFile; } set { sourceAddinFile = value; } } + /// + /// Gets the addin identifier. + /// + /// + /// The addin identifier. + /// public string AddinId { get { return Addin.GetFullId (Namespace, LocalId, Version); } } + /// + /// Gets or sets the local identifier. + /// + /// + /// The local identifier. + /// public string LocalId { get { return id != null ? id : string.Empty; } set { id = value; hasUserId = true; } } + /// + /// Gets or sets the namespace. + /// + /// + /// The namespace. + /// public string Namespace { get { return ns != null ? ns : string.Empty; } set { ns = value; } } + /// + /// Gets or sets the display name of the add-in. + /// + /// + /// The name. + /// public string Name { get { if (name != null && name.Length > 0) @@ -130,41 +168,89 @@ namespace Mono.Addins.Description set { name = value; } } + /// + /// Gets or sets the version. + /// + /// + /// The version. + /// public string Version { get { return version != null ? version : string.Empty; } set { version = value; } } + /// + /// Gets or sets the version of the add-in with which this add-in is backwards compatible. + /// + /// + /// The compat version. + /// public string CompatVersion { get { return compatVersion != null ? compatVersion : string.Empty; } set { compatVersion = value; } } + /// + /// Gets or sets the author. + /// + /// + /// The author. + /// public string Author { get { return author != null ? author : string.Empty; } set { author = value; } } + /// + /// Gets or sets the Url where more information about the add-in can be found. + /// + /// + /// The URL. + /// public string Url { get { return url != null ? url : string.Empty; } set { url = value; } } + /// + /// Gets or sets the copyright. + /// + /// + /// The copyright. + /// public string Copyright { get { return copyright != null ? copyright : string.Empty; } set { copyright = value; } } + /// + /// Gets or sets the description of the add-in. + /// + /// + /// The description. + /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } + /// + /// Gets or sets the category of the add-in. + /// + /// + /// The category. + /// public string Category { get { return category != null ? category : string.Empty; } set { category = value; } } + /// + /// Gets the base path for locating external files relative to the add-in. + /// + /// + /// The base path. + /// public string BasePath { get { return basePath != null ? basePath : string.Empty; } } @@ -174,16 +260,34 @@ namespace Mono.Addins.Description basePath = path; } + /// + /// Gets or sets a value indicating whether this instance is an add-in root. + /// + /// + /// true if this instance is an add-in root; otherwise, false. + /// public bool IsRoot { get { return isroot; } set { isroot = value; } } + /// + /// Gets or sets a value indicating whether this add-in is enabled by default. + /// + /// + /// true if enabled by default; otherwise, false. + /// public bool EnabledByDefault { get { return defaultEnabled; } set { defaultEnabled = value; } } + /// + /// Gets or sets the add-in flags. + /// + /// + /// The flags. + /// public AddinFlags Flags { get { return flags; } set { flags = value; } @@ -194,14 +298,32 @@ namespace Mono.Addins.Description set { hasUserId = value; } } + /// + /// Gets a value indicating whether this add-in can be disabled. + /// + /// + /// true if this add-in can be disabled; otherwise, false. + /// public bool CanDisable { get { return (flags & AddinFlags.CantDisable) == 0 && !IsHidden; } } + /// + /// Gets a value indicating whether this add-in can be uninstalled. + /// + /// + /// true if this instance can be uninstalled; otherwise, false. + /// public bool CanUninstall { get { return (flags & AddinFlags.CantUninstall) == 0 && !IsHidden; } } + /// + /// Gets a value indicating whether this add-in is hidden. + /// + /// + /// true if this add-in is hidden; otherwise, false. + /// public bool IsHidden { get { return (flags & AddinFlags.Hidden) != 0; } } @@ -212,6 +334,15 @@ namespace Mono.Addins.Description (CompatVersion.Length == 0 || Addin.CompareVersions (ver, CompatVersion) <= 0); } + /// + /// Gets all external files + /// + /// + /// All files. + /// + /// + /// External files are data files and assemblies explicitly referenced in the Runtime section of the add-in manifest. + /// public StringCollection AllFiles { get { StringCollection col = new StringCollection (); @@ -226,6 +357,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets all paths to be ignored by the add-in scanner. + /// + /// + /// All paths to be ignored. + /// public StringCollection AllIgnorePaths { get { StringCollection col = new StringCollection (); @@ -240,6 +377,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets the main module. + /// + /// + /// The main module. + /// public ModuleDescription MainModule { get { if (mainModule == null) { @@ -253,6 +396,17 @@ namespace Mono.Addins.Description } } + /// + /// Gets the optional modules. + /// + /// + /// The optional modules. + /// + /// + /// Optional modules can be used to declare extensions which will be registered only if some specified + /// add-in dependencies can be satisfied. Dependencies specified in optional modules are 'soft dependencies', + /// which means that they don't need to be satisfied in order to load the add-in. + /// public ModuleCollection OptionalModules { get { if (optionalModules == null) { @@ -266,6 +420,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets all modules (including the main module and all optional modules) + /// + /// + /// All modules. + /// public ModuleCollection AllModules { get { ModuleCollection col = new ModuleCollection (this); @@ -276,6 +436,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets the extension node sets. + /// + /// + /// The extension node sets. + /// public ExtensionNodeSetCollection ExtensionNodeSets { get { if (nodeSets == null) { @@ -289,6 +455,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets the extension points. + /// + /// + /// The extension points. + /// public ExtensionPointCollection ExtensionPoints { get { if (extensionPoints == null) { @@ -302,6 +474,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets the condition types. + /// + /// + /// The condition types. + /// public ConditionTypeDescriptionCollection ConditionTypes { get { if (conditionTypes == null) { @@ -315,11 +493,26 @@ namespace Mono.Addins.Description } } + /// + /// Gets or sets the add-in localizer. + /// + /// + /// The description of the add-in localizer for this add-in. + /// public ExtensionNodeDescription Localizer { get { return localizer; } set { localizer = value; } } + /// + /// Adds an extension point. + /// + /// + /// The extension point. + /// + /// + /// Path that identifies the new extension point. + /// public ExtensionPoint AddExtensionPoint (string path) { ExtensionPoint ep = new ExtensionPoint (); @@ -376,6 +569,12 @@ namespace Mono.Addins.Description } } + /// + /// Gets or sets file where this description is stored + /// + /// + /// The file path. + /// public string FileName { get { return configFile; } set { configFile = value; } @@ -416,12 +615,30 @@ namespace Mono.Addins.Description return false; } + /// + /// Saves the add-in description. + /// + /// + /// File name where to save this instance + /// + /// + /// Saves the add-in description to the specified file and sets the FileName property. + /// public void Save (string fileName) { configFile = fileName; Save (); } + /// + /// Saves the add-in description. + /// + /// + /// It is thrown if FileName is not set + /// + /// + /// The description is saved to the file specified in the FileName property. + /// public void Save () { if (configFile == null) @@ -436,6 +653,12 @@ namespace Mono.Addins.Description } } + /// + /// Generates an XML representation of the add-in description + /// + /// + /// An XML manifest. + /// public XmlDocument SaveToXml () { SaveXml (); @@ -540,6 +763,12 @@ namespace Mono.Addins.Description } + /// + /// Load an add-in description from a file + /// + /// + /// The file. + /// public static AddinDescription Read (string configFile) { AddinDescription config; @@ -550,11 +779,29 @@ namespace Mono.Addins.Description return config; } + /// + /// Load an add-in description from a stream + /// + /// + /// The stream + /// + /// + /// The path to be used to resolve relative file paths. + /// public static AddinDescription Read (Stream stream, string basePath) { return Read (new StreamReader (stream), basePath); } + /// + /// Load an add-in description from a text reader + /// + /// + /// The text reader + /// + /// + /// The path to be used to resolve relative file paths. + /// public static AddinDescription Read (TextReader reader, string basePath) { AddinDescription config = new AddinDescription (); @@ -637,6 +884,13 @@ namespace Mono.Addins.Description // BinaryXmlReader.DumpFile (configFile); } + /// + /// Verify this instance. + /// + /// + /// This method checks all the definitions in the description and returns a list of errors. + /// If the returned list is empty, it means that the description is valid. + /// public StringCollection Verify () { StringCollection errors = new StringCollection (); -- cgit v1.2.3