Browse Source

Added File templates for ConfigurationElement ConfigurationElementCollection and ConfigurationSection

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2036 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Justin Dearing 19 years ago
parent
commit
62979f29b7
  1. 55
      data/templates/file/CSharp/CSharp.ConfigurationElement.xft
  2. 150
      data/templates/file/CSharp/CSharp.ConfigurationElementCollection.xft
  3. 174
      data/templates/file/CSharp/CSharp.ConfigurationSection.xft
  4. 3
      src/Setup/Files.wxs
  5. 6
      src/Setup/SharpDevelop.Setup.wixproj.user

55
data/templates/file/CSharp/CSharp.ConfigurationElement.xft

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
<?xml version="1.0"?>
<Template author="Justin Dearing" version="1.0">
<Config
name = "${res:Templates.File.ConfigurationElement.Name}"
icon = "C#.File.Form"
category = "C#"
defaultname = "Class${Number}.cs"
language = "C#"/>
<Description>${res:Templates.File.ConfigurationElement.Description}</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
${ClassName} -> Class name (generally FileNameWithoutExtension w/o 'bad' characters)
-->
<Files>
<File name="${Path}/${FileNameWithoutExtension}.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Configuration;
namespace ${StandardNamespace}
{
public sealed class ${ClassName}Element : ConfigurationElement
{
/// <summary>
/// The attribute <c>name</c> of a <c>${ClassName}Element</c>.
/// </summary>
[ConfigurationProperty("name", IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)this["name"]; }
set { this["name"] = value; }
}
/// <summary>
/// A demonstration of how to use a boolean property.
/// </summary>
[ConfigurationProperty("special")]
public bool IsSpecial {
get { return (bool)this["special"]; }
set { this["special"] = value; }
}
}
}
]]></File>
</Files>
<AdditionalOptions/>
</Template>

150
data/templates/file/CSharp/CSharp.ConfigurationElementCollection.xft

@ -0,0 +1,150 @@ @@ -0,0 +1,150 @@
<?xml version="1.0"?>
<Template author="Justin Dearing" version="1.0">
<Config
name = "${res:Templates.File.ConfigurationElementCollection.Name}"
icon = "C#.File.Form"
category = "C#"
defaultname = "Class${Number}.cs"
language = "C#"/>
<Description>${res:Templates.File.ConfigurationElementCollection.Description}</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
${ClassName} -> Class name (generally FileNameWithoutExtension w/o 'bad' characters)
-->
<Files>
<File name="${Path}/${FileNameWithoutExtension}Element.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Configuration;
namespace ${StandardNamespace}
{
public sealed class ${ClassName}Element : ConfigurationElement
{
/// <summary>
/// The attribute <c>name</c> of a <c>${ClassName}Element</c>.
/// </summary>
[ConfigurationProperty("name", IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)this["name"]; }
set { this["name"] = value; }
}
/// <summary>
/// A demonstration of how to use a boolean property.
/// </summary>
[ConfigurationProperty("special")]
public bool IsSpecial {
get { return (bool)this["special"]; }
set { this["special"] = value; }
}
}
}
]]></File>
<File name="${Path}/${FileNameWithoutExtension}Collection.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Configuration;
namespace ${StandardNamespace}
{
/// <summary>
/// Description of ${ClassName}.
/// </summary>
public sealed class ${ClassName}Collection : ConfigurationElementCollection
{
#region Properties
/// <summary>
/// Gets the CollectionType of the ConfigurationElementCollection.
/// </summary>
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMap; }
}
/// <summary>
/// Gets the Name of Elements of the collection.
/// </summary>
protected override string ElementName
{
get { return "${ClassName}"; }
}
/// <summary>
/// Retrieve and item in the collection by index.
/// </summary>
public ${ClassName}Element this[int index]
{
get { return (${ClassName}Element)BaseGet(index); }
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
#endregion
/// <summary>
/// Adds a ${ClassName}Element to the configuration file.
/// </summary>
/// <param name="element">The ${ClassName}Element to add.</param>
public void Add(${ClassName}Element element)
{
BaseAdd(element);
}
/// <summary>
/// Creates a new ${ClassName}Element.
/// </summary>
/// <returns>A new <c>${ClassName}Element</c></returns>
protected override ConfigurationElement CreateNewElement()
{
return new ${ClassName}Element();
}
/// <summary>
/// Gets the key of an element based on it's Id.
/// </summary>
/// <param name="element">Element to get the key of.</param>
/// <returns>The key of <c>element</c>.</returns>
protected override object GetElementKey(ConfigurationElement element)
{
return ((${ClassName}Element)element).Name;
}
/// <summary>
/// Removes a ${ClassName}Element with the given name.
/// </summary>
/// <param name="name">The name of the ${ClassName}Element to remove.</param>
public void Remove (string name) {
base.BaseRemove(name);
}
}
}
]]></File>
</Files>
<AdditionalOptions/>
</Template>

174
data/templates/file/CSharp/CSharp.ConfigurationSection.xft

@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
<?xml version="1.0"?>
<Template author="Justin Dearing" version="1.0">
<Config
name = "${res:Templates.File.ConfigurationSection.Name}"
icon = "C#.File.Form"
category = "C#"
defaultname = "Class${Number}.cs"
language = "C#"/>
<Description>${res:Templates.File.ConfigurationSection.Description}</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
${ClassName} -> Class name (generally FileNameWithoutExtension w/o 'bad' characters)
-->
<Files>
<File name="${Path}/${FileNameWithoutExtension}Element.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Configuration;
namespace ${StandardNamespace}
{
public sealed class ${ClassName}Element : ConfigurationElement
{
/// <summary>
/// The attribute <c>name</c> of a <c>${ClassName}Element</c>.
/// </summary>
[ConfigurationProperty("name", IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)this["name"]; }
set { this["name"] = value; }
}
/// <summary>
/// A demonstration of how to use a boolean property.
/// </summary>
[ConfigurationProperty("special")]
public bool IsSpecial {
get { return (bool)this["special"]; }
set { this["special"] = value; }
}
}
}
]]></File>
<File name="${Path}/${FileNameWithoutExtension}Collection.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Configuration;
namespace ${StandardNamespace}
{
/// <summary>
/// Description of ${ClassName}.
/// </summary>
public sealed class ${ClassName}Collection : ConfigurationElementCollection
{
#region Properties
/// <summary>
/// Gets the CollectionType of the ConfigurationElementCollection.
/// </summary>
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMap; }
}
/// <summary>
/// Gets the Name of Elements of the collection.
/// </summary>
protected override string ElementName
{
get { return "${ClassName}"; }
}
/// <summary>
/// Retrieve and item in the collection by index.
/// </summary>
public ${ClassName}Element this[int index]
{
get { return (${ClassName}Element)BaseGet(index); }
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
#endregion
/// <summary>
/// Adds a ${ClassName}Element to the configuration file.
/// </summary>
/// <param name="element">The ${ClassName}Element to add.</param>
public void Add(${ClassName}Element element)
{
BaseAdd(element);
}
/// <summary>
/// Creates a new ${ClassName}Element.
/// </summary>
/// <returns>A new <c>${ClassName}Element</c></returns>
protected override ConfigurationElement CreateNewElement()
{
return new ${ClassName}Element();
}
/// <summary>
/// Gets the key of an element based on it's Id.
/// </summary>
/// <param name="element">Element to get the key of.</param>
/// <returns>The key of <c>element</c>.</returns>
protected override object GetElementKey(ConfigurationElement element)
{
return ((${ClassName}Element)element).Name;
}
/// <summary>
/// Removes a ${ClassName}Element with the given name.
/// </summary>
/// <param name="name">The name of the ${ClassName}Element to remove.</param>
public void Remove (string name) {
base.BaseRemove(name);
}
}
}
]]></File>
<File name="${Path}/${FileNameWithoutExtension}Section.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Configuration;
namespace ${StandardNamespace}
{
/// <summary>
/// Configuration settings for ${ClassName}.
/// </summary>
public class ${ClassName}Section : ConfigurationSection
{
/// <summary>
/// Collection of tables (auctually views) to generate
/// reports from.
/// </summary>
[ConfigurationProperty("customSection", IsDefaultCollection = true)]
public ${ClassName}Collection ${ClassName}
{
get { return (${ClassName}Collection) base["customSection"]; }
}
}
}
]]></File>
</Files>
<AdditionalOptions/>
</Template>

3
src/Setup/Files.wxs

@ -627,6 +627,9 @@ @@ -627,6 +627,9 @@
<Directory Id="CSharpFileTemplatesFolder" Name="CSharp">
<Component Guid="178B7A4B-FEE8-432D-A014-256FAA5441BE" Id="CSharpFileTemplates" DiskId="1">
<File Source="..\..\data\templates\file\CSharp\FileCategorySortOrder.xml" Name="FILECA_1.XML" Id="CSharpFileCategorySortOrder.xml" LongName="FileCategorySortOrder.xml" />
<File Source="..\..\data\templates\file\CSharp\CSharp.ConfigurationElement.xft" Name="CSCONFIG.XFT" Id="CSharp.ConfigurationElement.xft" LongName="CSharp.ConfigurationElement.xft" />
<File Source="..\..\data\templates\file\CSharp\CSharp.ConfigurationElementCollection.xft" Name="CSCONFIG.XFT" Id="CSharp.ConfigurationElementCollection.xft" LongName="CSharp.ConfigurationElementCollection.xft" />
<File Source="..\..\data\templates\file\CSharp\CSharp.ConfigurationSection.xft" Name="CSCONFIG.XFT" Id="CSharp.ConfigurationSection.xft" LongName="CSharp.ConfigurationSection.xft" />
<File Source="..\..\data\templates\file\CSharp\CSharp.Empty.xft" Name="CSHARP_1.XFT" Id="CSharp.Empty.xft" LongName="CSharp.Empty.xft" />
<File Source="..\..\data\templates\file\CSharp\CSharp.EmptyClass.xft" Name="CSHARP_2.XFT" Id="CSharp.EmptyClass.xft" LongName="CSharp.EmptyClass.xft" />
<File Source="..\..\data\templates\file\CSharp\CSharp.Forms.Form.xft" Name="CSHARP_3.XFT" Id="CSharp.Forms.Form.xft" LongName="CSharp.Forms.Form.xft" />

6
src/Setup/SharpDevelop.Setup.wixproj.user

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SetupProductBuildVersion>1</SetupProductBuildVersion>
<SetupProductCodeGuid>A0AB2551-A579-42D3-9A90-D6424B3AC2CD</SetupProductCodeGuid>
<SetupPackageCodeGuid>DFC87BE9-A5A6-434D-97BA-F34BB1C1C1A7</SetupPackageCodeGuid>
<SetupProductBuildVersion>2035</SetupProductBuildVersion>
<SetupProductCodeGuid>91D535F9-0EB3-4C12-BE79-3DC17D4EA9A8</SetupProductCodeGuid>
<SetupPackageCodeGuid>9D95DFA7-F496-4482-9830-059797D3D678</SetupPackageCodeGuid>
<OutputName>SharpDevelop2_2.1.0.$(SetupProductBuildVersion)</OutputName>
<DefineConstants>PACKAGECODEGUID=$(SetupPackageCodeGuid);PRODUCTCODEGUID=$(SetupProductCodeGuid);PRODUCTBUILDVERSION=$(SetupProductBuildVersion)</DefineConstants>
</PropertyGroup>

Loading…
Cancel
Save