diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 7d093e9..e60743c 100755 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -78,9 +78,6 @@ - - ..\packages\YamlDotNet.5.2.1\lib\net35\YamlDotNet.dll - diff --git a/Tests/packages.config b/Tests/packages.config index d2a52b3..33ef283 100755 --- a/Tests/packages.config +++ b/Tests/packages.config @@ -3,5 +3,4 @@ - \ No newline at end of file diff --git a/zaaReloaded2/Controller/Settings.cs b/zaaReloaded2/Controller/Settings.cs index 627a4ae..5bcb5b4 100755 --- a/zaaReloaded2/Controller/Settings.cs +++ b/zaaReloaded2/Controller/Settings.cs @@ -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)) - .WithTagMapping("!FormatElementsList", typeof(List)) - .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)) - .WithTagMapping("!FormatElementsList", typeof(List)) - .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(); } diff --git a/zaaReloaded2/UserSettings.cs b/zaaReloaded2/UserSettings.cs index c95a44b..2ebb05e 100755 --- a/zaaReloaded2/UserSettings.cs +++ b/zaaReloaded2/UserSettings.cs @@ -55,7 +55,11 @@ namespace zaaReloaded2 private static Lazy _lazy = new Lazy(() => { // Logger.Info("Initializing singleton instance"); - UserSettings s = FromFileOrDefault(UserSettingsFile); + YamlDotNet.Serialization.DeserializerBuilder builder = ConstructDeserializerBuilder(); + UserSettings s = FromFileOrDefault( + 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 diff --git a/zaaReloaded2/YamlTagMappingExtension.cs b/zaaReloaded2/YamlTagMappingExtension.cs new file mode 100755 index 0000000..d6dae1d --- /dev/null +++ b/zaaReloaded2/YamlTagMappingExtension.cs @@ -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(this TBuilder builder) + where TBuilder : BuilderSkeleton + { + return builder + .WithTagMapping("!UserSettings", typeof(UserSettings)) + .WithTagMapping("!Settings", typeof(Settings)) + .WithTagMapping("!SettingsList", typeof(List)) + .WithTagMapping("!ElementsList", typeof(List)) + .WithTagMapping("!FormatElementsList", typeof(List)) + .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)); + } + } +} diff --git a/zaaReloaded2/packages.config b/zaaReloaded2/packages.config index 2ce4bb0..17ea278 100755 --- a/zaaReloaded2/packages.config +++ b/zaaReloaded2/packages.config @@ -2,5 +2,4 @@ - \ No newline at end of file diff --git a/zaaReloaded2/zaaReloaded2.csproj b/zaaReloaded2/zaaReloaded2.csproj index efb5948..7eff616 100755 --- a/zaaReloaded2/zaaReloaded2.csproj +++ b/zaaReloaded2/zaaReloaded2.csproj @@ -37,21 +37,21 @@ 12.0 true - true + false publish\ - en - 1.0.0.0 + de + 2.5.0.1 true true - 7 + 1 days zaaReloaded2 - - + Daniel Kraus + https://git.bovender.de/daniel/zaaReloaded2 zaaReloaded2 - - 3 + Pimp my Arztbrief + 16 @@ -202,8 +202,8 @@ - - ..\packages\YamlDotNet.5.2.1\lib\net35\YamlDotNet.dll + + ..\..\YamlDotNet\YamlDotNet\bin\Debug\net40\YamlDotNet.dll @@ -339,6 +339,7 @@ + ResXFileCodeGenerator Resources.Designer.cs @@ -375,6 +376,7 @@ + @@ -507,11 +509,10 @@ true - - + zaaReloaded2_TemporaryKey.pfx - F20396CB288028D87B0A781625F2E41675ECC16A + 8994EF923FFA620E49E0985F38504CAA1EDD9969 false @@ -528,8 +529,8 @@ - - + +