WIP on new elemens

master
Valeriy Mironov 2019-02-02 23:22:00 +02:00
parent 1c3663b65d
commit 948fd521cc
12 changed files with 119 additions and 4 deletions

View File

@ -4,6 +4,7 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/PsiConfigurationSettingsKey/CustomLocation/@EntryValue">C:\Users\valeronm\AppData\Local\JetBrains\Transient\ReSharperPlatformVs15\v11_048a238b\SolutionCaches</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>

View File

@ -15,5 +15,8 @@ namespace WatchFace.Parser.Elements.ActivityElements
[ParameterId(3)]
[ParameterImageIndex]
public long? DecimalPointImageIndex { get; set; }
[ParameterId(4)]
public long? SuffixMilesImageIndex { get; set; }
}
}

View File

@ -0,0 +1,29 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using WatchFace.Parser.Attributes;
using WatchFace.Parser.Models;
namespace WatchFace.Parser.Elements.BasicElements
{
public class UnknownType
{
[ParameterId(1)]
public long TopLeftX { get; set; }
[ParameterId(2)]
public long TopLeftY { get; set; }
[ParameterId(3)]
public long BottomRightX { get; set; }
[ParameterId(4)]
public long BottomRightY { get; set; }
[ParameterId(5)]
[JsonConverter(typeof(StringEnumConverter))]
public TextAlignment Alignment { get; set; }
[ParameterId(6)]
public long Spacing { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using WatchFace.Parser.Attributes;
using WatchFace.Parser.Models;
namespace WatchFace.Parser.Elements.BasicElements
{
public class UnknownType14d6
{
[ParameterId(1)]
public Coordinates Unknown1 { get; set; }
[ParameterId(2)]
public Coordinates Unknown2 { get; set; }
[ParameterId(3)]
public long? Unknown3 { get; set; }
}
}

View File

@ -13,5 +13,11 @@ namespace WatchFace.Parser.Elements
[ParameterId(3)]
public Scale Scale { get; set; }
[ParameterId(5)]
public long? Unknown5 { get; set; }
[ParameterId(6)]
public long? Unknown6 { get; set; }
}
}

View File

@ -11,5 +11,11 @@ namespace WatchFace.Parser.Elements
[ParameterId(2)]
public ImageSet WeekDay { get; set; }
[ParameterId(3)]
public DateUnknown3 Unknown3 { get; set; }
[ParameterId(4)]
public Coordinates Unknown4 { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using WatchFace.Parser.Attributes;
using WatchFace.Parser.Elements.BasicElements;
namespace WatchFace.Parser.Elements.DateElements
{
public class DateUnknown3
{
[ParameterId(2)]
public UnknownType Unknown2 { get; set; }
}
}

View File

@ -22,5 +22,8 @@ namespace WatchFace.Parser.Elements
[JsonConverter(typeof(DrawingOrderJsonConverter))]
[ParameterId(5)]
public long? DrawingOrder { get; set; }
[ParameterId(9)]
public long? Unknown9 { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using Newtonsoft.Json;
using WatchFace.Parser.Attributes;
using WatchFace.Parser.Elements.BasicElements;
using WatchFace.Parser.Elements.TimeElements;
using WatchFace.Parser.JsonConverters;
namespace WatchFace.Parser.Elements
{
public class UnknownType14
{
[ParameterId(1)]
public TwoDigits Unknown1 { get; set; }
[ParameterId(2)]
public TwoDigits Unknown2 { get; set; }
[ParameterId(6)]
public UnknownType14d6 Unknown6 { get; set; }
[ParameterId(7)]
public UnknownType14d6 Unknown7 { get; set; }
[ParameterId(8)]
public UnknownType14d6 Unknown8 { get; set; }
}
}

View File

@ -15,8 +15,6 @@ namespace WatchFace.Parser.Utils
var result = new List<Parameter>();
var currentType = typeof(T);
if (!string.IsNullOrEmpty(path))
Logger.Trace("{0} '{1}'", path, currentType.Name);
foreach (var kv in ElementsHelper.SortedProperties<T>())
{
var id = kv.Key;
@ -52,13 +50,19 @@ namespace WatchFace.Parser.Utils
else if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(List<>))
{
foreach (var item in propertyValue)
{
Logger.Trace("{0} '{1}'", currentPath, propertyInfo.Name);
result.Add(new Parameter(id, Build(item, currentPath)));
}
}
else
{
var innerParameters = Build(propertyValue, currentPath);
if (innerParameters.Count > 0)
{
Logger.Trace("{0} '{1}'", currentPath, propertyInfo.Name);
result.Add(new Parameter(id, innerParameters));
}
else
Logger.Trace("{0} '{1}': Skipped because of empty", currentPath, propertyInfo.Name);
}
@ -75,8 +79,6 @@ namespace WatchFace.Parser.Utils
var thisMethod = typeof(ParametersConverter).GetMethod(nameof(Parse));
if (!string.IsNullOrEmpty(path))
Logger.Trace("{0} '{1}'", path, currentType.Name);
foreach (var parameter in descriptor)
{
var currentPath = string.IsNullOrEmpty(path)
@ -111,6 +113,7 @@ namespace WatchFace.Parser.Utils
}
else if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(List<>))
{
Logger.Trace("{0} '{1}'", currentPath, propertyInfo.Name);
dynamic propertyValue = propertyInfo.GetValue(result, null);
if (propertyValue == null)
{
@ -132,6 +135,7 @@ namespace WatchFace.Parser.Utils
}
else
{
Logger.Trace("{0} '{1}'", currentPath, propertyInfo.Name);
dynamic propertyValue = propertyInfo.GetValue(result, null);
if (propertyValue != null)
throw new ArgumentException($"Parameter {parameter.Id} is already set for {currentType.Name}");

View File

@ -59,16 +59,20 @@
<Compile Include="Elements\BasicElements\Coordinates.cs" />
<Compile Include="Elements\BasicElements\Image.cs" />
<Compile Include="Elements\BasicElements\ImageSet.cs" />
<Compile Include="Elements\BasicElements\UnknownType14d6.cs" />
<Compile Include="Elements\BasicElements\UnknownType.cs" />
<Compile Include="Elements\BasicElements\Number.cs" />
<Compile Include="Elements\BasicElements\Scale.cs" />
<Compile Include="Elements\Battery.cs" />
<Compile Include="Elements\Date.cs" />
<Compile Include="Elements\DateElements\DateUnknown3.cs" />
<Compile Include="Elements\DateElements\MonthAndDay.cs" />
<Compile Include="Elements\DateElements\OneLineMonthAndDay.cs" />
<Compile Include="Elements\DateElements\SeparateMonthAndDay.cs" />
<Compile Include="Elements\StepsProgress.cs" />
<Compile Include="Elements\Status.cs" />
<Compile Include="Elements\StatusElements\Switch.cs" />
<Compile Include="Elements\UnknownType14.cs" />
<Compile Include="Elements\Time.cs" />
<Compile Include="Elements\TimeElements\AmPm.cs" />
<Compile Include="Elements\TimeElements\TwoDigits.cs" />

View File

@ -31,5 +31,8 @@ namespace WatchFace.Parser
[ParameterId(10)]
public AnalogDialFace AnalogDialFace { get; set; }
[ParameterId(14)]
public UnknownType14 Unknown14 { get; set; }
}
}