Compare commits

...

3 Commits

9 changed files with 54 additions and 43 deletions

1
.gitignore vendored
View File

@ -29,3 +29,4 @@ private/
doxygen_sqlite3.db
Backup/
.vs/
publish/

View File

@ -78,9 +78,6 @@
<Reference Include="System.Xaml" />
<Reference Include="System.XML" />
<Reference Include="WindowsBase" />
<Reference Include="YamlDotNet, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.5.2.1\lib\net35\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">

View File

@ -3,5 +3,4 @@
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
<package id="NLog" version="4.5.11" targetFramework="net40" />
<package id="NUnit" version="3.11.0" targetFramework="net40" />
<package id="YamlDotNet" version="5.2.1" targetFramework="net40" />
</packages>

View File

@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using zaaReloaded2;
using zaaReloaded2.Formatter;
using zaaReloaded2.Controller.Elements;
using System.IO;
@ -38,33 +39,14 @@ namespace zaaReloaded2.Controller
public static ISerializer BuildSerializer()
{
SerializerBuilder builder = new SerializerBuilder()
.WithTagMapping("!Settings", typeof(Settings))
.WithTagMapping("!ElementsList", typeof(List<ElementBase>))
.WithTagMapping("!FormatElementsList", typeof(List<FormatElementBase>))
.WithTagMapping("!Items", typeof(Items))
.WithTagMapping("!CustomText", typeof(CustomText))
.WithTagMapping("!SelectFirstDay", typeof(SelectFirstDay))
.WithTagMapping("!SelectEachDay", typeof(SelectEachDay))
.WithTagMapping("!SelectLastDay", typeof(SelectLastDay))
.WithTagMapping("!TwoColumns", typeof(TwoColumns))
.WithTagMapping("!NextColumn", typeof(NextColumn))
.WithCommonTagMappings()
.EnsureRoundtrip();
return builder.Build();
}
public static IDeserializer BuildDeserializer()
{
DeserializerBuilder builder = new DeserializerBuilder()
.WithTagMapping("!Settings", typeof(Settings))
.WithTagMapping("!ElementsList", typeof(List<ElementBase>))
.WithTagMapping("!FormatElementsList", typeof(List<FormatElementBase>))
.WithTagMapping("!Items", typeof(Items))
.WithTagMapping("!CustomText", typeof(CustomText))
.WithTagMapping("!SelectFirstDay", typeof(SelectFirstDay))
.WithTagMapping("!SelectEachDay", typeof(SelectEachDay))
.WithTagMapping("!SelectLastDay", typeof(SelectLastDay))
.WithTagMapping("!TwoColumns", typeof(TwoColumns))
.WithTagMapping("!NextColumn", typeof(NextColumn));
DeserializerBuilder builder = new DeserializerBuilder().WithCommonTagMappings();
return builder.Build();
}

View File

@ -55,7 +55,11 @@ namespace zaaReloaded2
private static Lazy<UserSettings> _lazy = new Lazy<UserSettings>(() =>
{
// Logger.Info("Initializing singleton instance");
UserSettings s = FromFileOrDefault<UserSettings>(UserSettingsFile);
YamlDotNet.Serialization.DeserializerBuilder builder = ConstructDeserializerBuilder<UserSettings>();
UserSettings s = FromFileOrDefault<UserSettings>(
UserSettingsFile,
builder.WithCommonTagMappings()
);
Bovender.UserSettings.UserSettingsBase.Default = s;
return s;
});
@ -176,7 +180,7 @@ namespace zaaReloaded2
protected override YamlDotNet.Serialization.SerializerBuilder ConstructSerializerBuilder()
{
return base.ConstructSerializerBuilder().EnsureRoundtrip();
return new YamlDotNet.Serialization.SerializerBuilder().WithCommonTagMappings().EnsureRoundtrip();
}
#endregion

View File

@ -0,0 +1,28 @@
using zaaReloaded2.Controller;
using zaaReloaded2.Controller.Elements;
using YamlDotNet.Serialization;
using System.Collections.Generic;
namespace zaaReloaded2
{
static class YamlTagMappingExtension
{
public static TBuilder WithCommonTagMappings<TBuilder>(this TBuilder builder)
where TBuilder : BuilderSkeleton<TBuilder>
{
return builder
.WithTagMapping("!UserSettings", typeof(UserSettings))
.WithTagMapping("!Settings", typeof(Settings))
.WithTagMapping("!SettingsList", typeof(List<Settings>))
.WithTagMapping("!ElementsList", typeof(List<ElementBase>))
.WithTagMapping("!FormatElementsList", typeof(List<FormatElementBase>))
.WithTagMapping("!Items", typeof(Items))
.WithTagMapping("!CustomText", typeof(CustomText))
.WithTagMapping("!SelectFirstDay", typeof(SelectFirstDay))
.WithTagMapping("!SelectEachDay", typeof(SelectEachDay))
.WithTagMapping("!SelectLastDay", typeof(SelectLastDay))
.WithTagMapping("!TwoColumns", typeof(TwoColumns))
.WithTagMapping("!NextColumn", typeof(NextColumn));
}
}
}

View File

@ -2,5 +2,4 @@
<packages>
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
<package id="NLog" version="4.5.11" targetFramework="net40" />
<package id="YamlDotNet" version="5.2.1" targetFramework="net40" />
</packages>

View File

@ -37,21 +37,21 @@
<OldToolsVersion>12.0</OldToolsVersion>
<VSTO_TrustAssembliesLocation>true</VSTO_TrustAssembliesLocation>
<TargetFrameworkProfile />
<BootstrapperEnabled>true</BootstrapperEnabled>
<BootstrapperEnabled>false</BootstrapperEnabled>
<PublishUrl>publish\</PublishUrl>
<InstallUrl />
<TargetCulture>en</TargetCulture>
<ApplicationVersion>1.0.0.0</ApplicationVersion>
<TargetCulture>de</TargetCulture>
<ApplicationVersion>2.5.0.1</ApplicationVersion>
<AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
<UpdateEnabled>true</UpdateEnabled>
<UpdateInterval>7</UpdateInterval>
<UpdateInterval>1</UpdateInterval>
<UpdateIntervalUnits>days</UpdateIntervalUnits>
<ProductName>zaaReloaded2</ProductName>
<PublisherName />
<SupportUrl />
<PublisherName>Daniel Kraus</PublisherName>
<SupportUrl>https://git.bovender.de/daniel/zaaReloaded2</SupportUrl>
<FriendlyName>zaaReloaded2</FriendlyName>
<OfficeApplicationDescription />
<LoadBehavior>3</LoadBehavior>
<OfficeApplicationDescription>Pimp my Arztbrief</OfficeApplicationDescription>
<LoadBehavior>16</LoadBehavior>
</PropertyGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
@ -202,8 +202,8 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="WindowsBase" />
<Reference Include="YamlDotNet, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.5.2.1\lib\net35\YamlDotNet.dll</HintPath>
<Reference Include="YamlDotNet">
<HintPath>..\..\YamlDotNet\YamlDotNet\bin\Debug\net40\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -339,6 +339,7 @@
</Compile>
<Compile Include="Updater\Version.cs" />
<Compile Include="ViewModels\SettingsViewModel.cs" />
<Compile Include="YamlTagMappingExtension.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -375,6 +376,7 @@
<AppDesigner Include="Properties\" />
<None Include="zaaReloaded2.licenseheader" />
<None Include="zaaReloaded2.pfx" />
<None Include="zaaReloaded2_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Defaults\parameters.txt" />
@ -507,11 +509,10 @@
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
<ManifestKeyFile>zaaReloaded2_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>F20396CB288028D87B0A781625F2E41675ECC16A</ManifestCertificateThumbprint>
<ManifestCertificateThumbprint>8994EF923FFA620E49E0985F38504CAA1EDD9969</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
@ -528,8 +529,8 @@
<VisualStudio>
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
<ProjectProperties HostName="Word" HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="Word" Language="cs" TemplatesPath="VSTOTemplates" DebugInfoExeName="#Software\Microsoft\Office\16.0\Word\InstallRoot\Path#WINWORD.EXE" DebugInfoCommandLine="/w" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
<Host Name="Word" GeneratedCodeNamespace="zaaReloaded2" IconIndex="0">
<HostItem Name="ThisAddIn" Code="ThisAddIn.cs" CanonicalName="AddIn" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.cs" />
<Host Name="Word" GeneratedCodeNamespace="zaaReloaded2" PublishedHash="69C324AB27932AA2FBF2B7EA72250886FF164DE6" IconIndex="0">
<HostItem Name="ThisAddIn" Code="ThisAddIn.cs" CanonicalName="AddIn" PublishedHash="0C530AAEE76F26D28CEC634B01B3D6BC88E00089" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.cs" />
</Host>
</FlavorProperties>
</VisualStudio>

Binary file not shown.