ModuleConfiguration.cs :  » Content-Management-Systems-CMS » Kooboo » Everest » CmsServices » Extension » Module » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Content Management Systems CMS » Kooboo 
Kooboo » Everest » CmsServices » Extension » Module » ModuleConfiguration.cs
/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.

This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Everest.CmsServices.Extension.Module{
    /// <summary>
    /// 
    /// </summary>
    public class ModuleConfiguration
    {
        public ModuleConfiguration()
        {
            Settings = new ModuleSettingEditor[0];
            Assemblies = new ModuleAssembly[0];
            Schemas = new IncludeFile[0];
            InstallSqlFiles = new IncludeFile[0];
            UnstallSqlFiles = new IncludeFile[0];
            Folders = new FolderInfo[0];
        }
        /// <summary>
        /// Gets or sets the version.
        /// </summary>
        /// <value>The version.</value>
        public string Version { get; set; }

        /// <summary>
        /// Gets or sets the framework version.
        /// </summary>
        /// <value>The framework version.</value>
        public string FrameworkVersion { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="ModuleConfiguration"/> is installed.
        /// </summary>
        /// <value><c>true</c> if installed; otherwise, <c>false</c>.</value>
        public bool Installed { get; set; }

        /// <summary>
        /// Gets or sets the admin URL.
        /// </summary>
        /// <value>The admin URL.</value>
        public string AdminUrl { get; set; }

        /// <summary>
        /// Gets or sets the module settings.
        /// </summary>
        /// <value>The module settings.</value>
        public ModuleSettingEditor[] Settings { get; set; }

        /// <summary>
        /// Gets or sets the assemblies.
        /// </summary>
        /// <value>The assemblies.</value>
        public ModuleAssembly[] Assemblies { get; set; }

        /// <summary>
        /// Gets or sets the schemas.
        /// </summary>
        /// <value>The schemas.</value>
        public IncludeFile[] Schemas { get; set; }

        /// <summary>
        /// Gets or sets the SQL files.
        /// </summary>
        /// <value>The SQL files.</value>
        public IncludeFile[] InstallSqlFiles { get; set; }

        /// <summary>
        /// Gets or sets the unstall SQL files.
        /// </summary>
        /// <value>The unstall SQL files.</value>
        public IncludeFile[] UnstallSqlFiles { get; set; }

        /// <summary>
        /// Gets or sets the folders.
        /// </summary>
        /// <value>The folders.</value>
        public FolderInfo[] Folders { get; set; }

        [System.Xml.Serialization.XmlIgnore]
        public ModuleSettingEditor this[string key]
        {
            get
            {
                if (Settings.Length > 0)
                {
                    return Settings.Where(m => m.Key == key).FirstOrDefault();
                }
                return null;
            }
        }


    }
    /// <summary>
    /// 
    /// </summary>
    public class ModuleSetting : ICloneable
    {
        public string Key { get; set; }
        public string Value { get; set; }

        #region ICloneable Members

        public object Clone()
        {
            return new ModuleSetting() { Key = this.Key, Value = this.Value };
        }

        #endregion
    }

    /// <summary>
    /// 
    /// </summary>
    //public enum SettingEditorType
    //{
    //    /// <summary>
    //    /// Text box
    //    /// </summary>
    //    Textfield,
    //    /// <summary>
    //    /// Date 
    //    /// </summary>
    //    Datefield,
    //    /// <summary>
    //    /// Combobox
    //    /// </summary>
    //    Combo,
    //    /// <summary>
    //    /// Multi-Select combobox.
    //    /// </summary>
    //    Lovcombo
    //}
    public class ModuleSettingEditorCollection : List<ModuleSettingEditor>
    {
        /// <summary>
        /// Adds the setting.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// <param name="items">The items.</param>
        public void AddSetting(string name, string value, params string[] items)
        {
            var settingEditor = new ModuleSettingEditor() { Key = name, Value = value };
            if (items != null && items.Length > 0)
            {
                settingEditor.Items = string.Join("|", items);
            }
            this.Add(settingEditor);
        }

        /// <summary>
        /// Sets the theme.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="themes">The themes.</param>
        public void SetTheme(string value, params string[] themes)
        {
            this.AddSetting("Theme", value, themes);
        }

        /// <summary>
        /// Sets the unauthorized URL.
        /// </summary>
        /// <param name="value">The value.</param>
        public void SetUnauthorizedUrl(string value)
        {
            this.AddSetting("UnauthorizedUrl", value);
        }

        /// <summary>
        /// Sets the entry URL.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="entryUrls">The entry urls.</param>
        public void SetEntryUrl(string value, params string[] entryUrls)
        {
            this.AddSetting("EntryUrl", value, entryUrls);
        }

        /// <summary>
        /// Enableds the page title.
        /// </summary>
        /// <param name="value">if set to <c>true</c> [value].</param>
        public void SetEnabledPageTitle(bool value)
        {
            this.AddSetting("EnabledPageTitle", value.ToString().ToLower(), "true", "false");
        }

        /// <summary>
        /// Sets the page title format.
        /// </summary>
        /// <param name="format">The format.</param>
        public void SetPageTitleFormat(string format)
        {
            this.AddSetting("PageTitleFormat", format);
        }
    }
    /// <summary>
    /// 
    /// </summary>
    public class ModuleSettingEditor : ModuleSetting
    {
        /// <summary>
        /// Gets or sets the editor.
        /// </summary>
        /// <value>The editor.</value>
        //public SettingEditorType Editor { get; set; }
        /// <summary>
        /// Gets or sets the items. For Combobox and Lovcombo editor control. e.g: Value1|Value2|Value3
        /// </summary>
        /// <value>The items.</value>
        public string Items { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class ModuleAssembly
    {
        /// <summary>
        /// Gets or sets the name of the assembly.
        /// </summary>
        /// <value>The name of the assembly.</value>
        public string AssemblyName { get; set; }
        /// <summary>
        /// Gets or sets the path.
        /// </summary>
        /// <value>The path.</value>
        public string Path { get; set; }
        /// <summary>
        /// Gets or sets a value indicating whether [contains controller].
        /// </summary>
        /// <value><c>true</c> if [contains controller]; otherwise, <c>false</c>.</value>
        public bool ContainsController { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class IncludeFile
    {
        public string Path { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class FolderInfo
    {
        public string FolderName { get; set; }
        public string SchemaName { get; set; }

        public FolderInfo[] Children { get; set; }
    }
}

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.