Click here to Skip to main content
15,892,059 members
Articles / Programming Languages / C#

DataStorage: Store settings type-safe

Rate me:
Please Sign up or sign in to vote.
4.50/5 (3 votes)
8 Aug 2012GPL33 min read 26.2K   234   9  
Shows how to use the DataStorage classes to generate type-safe settings classes.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{55FF16BB-C5E9-4AB8-A723-EF0852ABFE0F}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>pdfforge.DataStorageGenerator</RootNamespace>
    <AssemblyName>DataStorageGenerator</AssemblyName>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="DataStorage, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>bin\Release\DataStorage.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AboutBox.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="AboutBox.Designer.cs">
      <DependentUpon>AboutBox.cs</DependentUpon>
    </Compile>
    <Compile Include="ClassGenerator.cs" />
    <Compile Include="ClassStringBuilder.cs" />
    <Compile Include="DataGeneration\ClassContainer.cs" />
    <Compile Include="DataGeneration\DataClass.cs" />
    <Compile Include="DataGeneration\IDataElement.cs" />
    <Compile Include="DataGeneration\DataValue.cs" />
    <Compile Include="DataGeneration\SimpleValue.cs" />
    <Compile Include="frmGeneratorOptions.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="frmGeneratorOptions.Designer.cs">
      <DependentUpon>frmGeneratorOptions.cs</DependentUpon>
    </Compile>
    <Compile Include="frmMainGenerator.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="frmMainGenerator.Designer.cs">
      <DependentUpon>frmMainGenerator.cs</DependentUpon>
    </Compile>
    <Compile Include="InputBox.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="AboutBox.resx">
      <SubType>Designer</SubType>
      <DependentUpon>AboutBox.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="frmGeneratorOptions.resx">
      <SubType>Designer</SubType>
      <DependentUpon>frmGeneratorOptions.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="frmMainGenerator.resx">
      <SubType>Designer</SubType>
      <DependentUpon>frmMainGenerator.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="InputBox.resx">
      <DependentUpon>InputBox.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <None Include="app.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <Compile Include="XmlHelper.cs" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Aga.Controls\Aga.Controls.csproj">
      <Project>{E73BB233-D88B-44A7-A98F-D71EE158381D}</Project>
      <Name>Aga.Controls</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\FileSaveAs.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\FileSave.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\FileOpen.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\GenerateAll.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\AddClass.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\AddProperty.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\Delete.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\Class.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\Property.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyBool.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyDouble.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyEnum.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyFloat.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyInt.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyLong.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyString.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyDateTime.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyVersion.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Images\PropertyColor.png" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
pdfforge GbR
Germany Germany
Philip is a Software Architect with severaly years of experience. He studied business IT in the University of Wedel, Germany, and has reached his Masters degree in 2010. Back in 2002, he started his so far best-known software PDFCreator. The second developer joined two years later and since then, both constantly improve this piece of open source software.

Comments and Discussions