Implemented reading structure of watch face and reading images
parent
9be932fcee
commit
3ce62f8446
|
@ -3,18 +3,72 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.27004.2009
|
VisualStudioVersion = 15.0.27004.2009
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmazfitWFReader", "AmazfitWFReader\AmazfitWFReader.csproj", "{20EDCAB3-CCDD-4170-80E0-73E30DD9FC85}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UI", "UI\UI.csproj", "{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchFace", "WatchFace\WatchFace.csproj", "{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cmd", "Cmd\Cmd.csproj", "{A599B50E-754E-4C8F-A078-867B26E3DD09}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|ARM = Debug|ARM
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|ARM = Release|ARM
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{20EDCAB3-CCDD-4170-80E0-73E30DD9FC85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{20EDCAB3-CCDD-4170-80E0-73E30DD9FC85}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{20EDCAB3-CCDD-4170-80E0-73E30DD9FC85}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||||
{20EDCAB3-CCDD-4170-80E0-73E30DD9FC85}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|ARM.Build.0 = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|ARM.Build.0 = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{8D2E0224-DE7F-4EC9-AD23-9904B9D7B409}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|ARM.Build.0 = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{A599B50E-754E-4C8F-A078-867B26E3DD09}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
namespace AmazfitWFReader
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace AmazfitWFReader
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace AmazfitWFReader
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new Form1());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{A599B50E-754E-4C8F-A078-867B26E3DD09}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>Cmd</RootNamespace>
|
||||||
|
<AssemblyName>Cmd</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<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' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="SixLabors.Core, Version=0.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\SixLabors.Core.1.0.0-beta0004\lib\netstandard1.1\SixLabors.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\SixLabors.ImageSharp.1.0.0-beta0002\lib\netstandard2.0\SixLabors.ImageSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ComponentModel.Composition" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
|
<Reference Include="System.Memory, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Memory.4.4.0-preview2-25405-01\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WatchFace\WatchFace.csproj">
|
||||||
|
<Project>{8d2e0224-de7f-4ec9-ad23-9904b9d7b409}</Project>
|
||||||
|
<Name>WatchFace</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,52 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using WatchFace;
|
||||||
|
using WatchFace.Models;
|
||||||
|
|
||||||
|
namespace Cmd
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var fileName = args[0];
|
||||||
|
Reader reader;
|
||||||
|
Console.WriteLine("Opening watch face: {0}", fileName);
|
||||||
|
using (var fileStream = File.OpenRead(fileName))
|
||||||
|
{
|
||||||
|
reader = new Reader(fileStream);
|
||||||
|
reader.Parse();
|
||||||
|
}
|
||||||
|
foreach (var resource in reader.Resources)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0:D}: ", resource.Id);
|
||||||
|
foreach (var descriptor in resource.Descriptor)
|
||||||
|
{
|
||||||
|
WriteParameter(4, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.ReadKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WriteParameter(int offset, Parameter parameter)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < offset; i++)
|
||||||
|
Console.Write(' ');
|
||||||
|
Console.Write("{0:D}: ", parameter.Id);
|
||||||
|
if (parameter.IsList)
|
||||||
|
{
|
||||||
|
Console.WriteLine();
|
||||||
|
foreach (var parameter1 in parameter.List)
|
||||||
|
{
|
||||||
|
WriteParameter(offset + 4, parameter1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0:D} (0x{0:x})", parameter.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("AmazfitWFReader")]
|
[assembly: AssemblyTitle("Cmd")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("AmazfitWFReader")]
|
[assembly: AssemblyProduct("Cmd")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
[assembly: Guid("20edcab3-ccdd-4170-80e0-73e30dd9fc85")]
|
[assembly: Guid("a599b50e-754e-4c8f-a078-867b26e3dd09")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="NETStandard.Library" version="1.6.1" targetFramework="net461" />
|
||||||
|
<package id="SixLabors.Core" version="1.0.0-beta0004" targetFramework="net461" />
|
||||||
|
<package id="SixLabors.ImageSharp" version="1.0.0-beta0002" targetFramework="net461" />
|
||||||
|
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Buffers" version="4.4.0" targetFramework="net461" />
|
||||||
|
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Console" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Globalization" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.IO" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Memory" version="4.4.0-preview2-25405-01" targetFramework="net461" />
|
||||||
|
<package id="System.Net.Http" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
|
||||||
|
<package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.4.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
|
||||||
|
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
|
||||||
|
</packages>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="UI.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:UI"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<Window x:Class="UI.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:UI"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="MainWindow" Height="350" Width="525">
|
||||||
|
<Grid Margin="8">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Margin="0,0,0,8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox IsReadOnly="True" Margin="0,0,8,0"/>
|
||||||
|
<Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Grid.Column="1"/>
|
||||||
|
</Grid>
|
||||||
|
<TextBox AcceptsReturn="True" Grid.Row="1" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("UI")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("UI")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -8,7 +8,7 @@
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace AmazfitWFReader.Properties
|
namespace UI.Properties
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace AmazfitWFReader.Properties
|
||||||
{
|
{
|
||||||
if ((resourceMan == null))
|
if ((resourceMan == null))
|
||||||
{
|
{
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AmazfitWFReader.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UI.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
|
@ -8,7 +8,7 @@
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace AmazfitWFReader.Properties
|
namespace UI.Properties
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
|
@ -4,12 +4,14 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{20EDCAB3-CCDD-4170-80E0-73E30DD9FC85}</ProjectGuid>
|
<ProjectGuid>{B05BAE0A-2C09-4910-924D-CA3DA0FA1CFD}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>AmazfitWFReader</RootNamespace>
|
<RootNamespace>UI</RootNamespace>
|
||||||
<AssemblyName>AmazfitWFReader</AssemblyName>
|
<AssemblyName>UI</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
@ -33,47 +35,69 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Deployment" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Xaml">
|
||||||
<Reference Include="System.Xml" />
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Form1.cs">
|
<ApplicationDefinition Include="App.xaml">
|
||||||
<SubType>Form</SubType>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Compile>
|
|
||||||
<Compile Include="Form1.Designer.cs">
|
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WatchFace\WatchFace.csproj">
|
||||||
|
<Project>{8d2e0224-de7f-4ec9-ad23-9904b9d7b409}</Project>
|
||||||
|
<Name>WatchFace</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Activity
|
||||||
|
{
|
||||||
|
private Number _calories;
|
||||||
|
private Number _pulse;
|
||||||
|
private Number _steps;
|
||||||
|
|
||||||
|
public Activity(Number steps, Number calories, Number pulse)
|
||||||
|
{
|
||||||
|
_steps = steps;
|
||||||
|
_calories = calories;
|
||||||
|
_pulse = pulse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Background
|
||||||
|
{
|
||||||
|
private Image _image;
|
||||||
|
|
||||||
|
public Background(Image image)
|
||||||
|
{
|
||||||
|
_image = image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Digit
|
||||||
|
{
|
||||||
|
private int _imageIndex;
|
||||||
|
private int _imagesCount;
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
|
||||||
|
public Digit(int x, int y, int imageIndex, int imagesCount)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_imageIndex = imageIndex;
|
||||||
|
_imagesCount = imagesCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Image
|
||||||
|
{
|
||||||
|
private int _imageIndex;
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
|
||||||
|
public Image(int x, int y, int imageIndex)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_imageIndex = imageIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Number
|
||||||
|
{
|
||||||
|
private int _bottomRightX;
|
||||||
|
private int _bottomRightY;
|
||||||
|
private int _imageIndex;
|
||||||
|
private int _imagesCount;
|
||||||
|
private int _topLeftX;
|
||||||
|
private int _topLeftY;
|
||||||
|
private int _unknown1;
|
||||||
|
private int _unknown2;
|
||||||
|
|
||||||
|
public Number(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY, int unknown1, int unknown2,
|
||||||
|
int imageIndex, int imagesCount)
|
||||||
|
{
|
||||||
|
_topLeftX = topLeftX;
|
||||||
|
_topLeftY = topLeftY;
|
||||||
|
_bottomRightX = bottomRightX;
|
||||||
|
_bottomRightY = bottomRightY;
|
||||||
|
_unknown1 = unknown1;
|
||||||
|
_unknown2 = unknown2;
|
||||||
|
_imageIndex = imageIndex;
|
||||||
|
_imagesCount = imagesCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Switch
|
||||||
|
{
|
||||||
|
private int _imageIndexOff;
|
||||||
|
private int _imageIndexOn;
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
|
||||||
|
public Switch(int x, int y, int imageIndexOff, int imageIndexOn)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_imageIndexOff = imageIndexOff;
|
||||||
|
_imageIndexOn = imageIndexOn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class Time
|
||||||
|
{
|
||||||
|
private Switch _amPm;
|
||||||
|
private TwoDigits _hours;
|
||||||
|
private TwoDigits _minutes;
|
||||||
|
private TwoDigits _seconds;
|
||||||
|
|
||||||
|
public Time(TwoDigits hours, TwoDigits minutes, TwoDigits seconds, Switch amPm)
|
||||||
|
{
|
||||||
|
_hours = hours;
|
||||||
|
_minutes = minutes;
|
||||||
|
_seconds = seconds;
|
||||||
|
_amPm = amPm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace WatchFace.Elements
|
||||||
|
{
|
||||||
|
public class TwoDigits
|
||||||
|
{
|
||||||
|
private Digit _tens;
|
||||||
|
private Digit _ones;
|
||||||
|
|
||||||
|
public TwoDigits(Digit tens, Digit ones)
|
||||||
|
{
|
||||||
|
_tens = tens;
|
||||||
|
_ones = ones;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WatchFace.Models
|
||||||
|
{
|
||||||
|
public class Header
|
||||||
|
{
|
||||||
|
public const int HeaderSize = 40;
|
||||||
|
private const string DialSignature = "HMDIAL\0";
|
||||||
|
private readonly byte[] _header;
|
||||||
|
|
||||||
|
public Header(byte[] header)
|
||||||
|
{
|
||||||
|
_header = header;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Signature => Encoding.ASCII.GetString(_header, 0, 7);
|
||||||
|
public bool IsValid => Signature == DialSignature;
|
||||||
|
public uint Unknown => BitConverter.ToUInt32(_header, 32);
|
||||||
|
public uint ParametersSize => BitConverter.ToUInt32(_header, 36);
|
||||||
|
|
||||||
|
public static Header ReadFrom(Stream fileStream)
|
||||||
|
{
|
||||||
|
var buffer = new byte[HeaderSize];
|
||||||
|
fileStream.Read(buffer, 0, HeaderSize);
|
||||||
|
return new Header(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using SixLabors.ImageSharp;
|
||||||
|
using WatchFace.Utils;
|
||||||
|
|
||||||
|
namespace WatchFace.Models
|
||||||
|
{
|
||||||
|
public class ImageReader
|
||||||
|
{
|
||||||
|
private readonly BinaryReader _reader;
|
||||||
|
private ushort _paletteColors;
|
||||||
|
private ushort _bitsPerPixel;
|
||||||
|
private ushort _height;
|
||||||
|
private List<Rgba32> _palette;
|
||||||
|
private ushort _rowLengthInBytes;
|
||||||
|
private ushort _transp;
|
||||||
|
private ushort _width;
|
||||||
|
|
||||||
|
public ImageReader(Stream stream)
|
||||||
|
{
|
||||||
|
_reader = new BinaryReader(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image<Rgba32> Read()
|
||||||
|
{
|
||||||
|
var signature = _reader.ReadChars(4);
|
||||||
|
if (signature[0] != 'B' || signature[1] != 'M')
|
||||||
|
throw new ArgumentOutOfRangeException("signature", "Signature doesn't match.");
|
||||||
|
|
||||||
|
ReadHeader();
|
||||||
|
ReadPalette();
|
||||||
|
return ReadImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadHeader()
|
||||||
|
{
|
||||||
|
_width = _reader.ReadUInt16();
|
||||||
|
_height = _reader.ReadUInt16();
|
||||||
|
_rowLengthInBytes = _reader.ReadUInt16();
|
||||||
|
_bitsPerPixel = _reader.ReadUInt16();
|
||||||
|
_paletteColors = _reader.ReadUInt16();
|
||||||
|
_transp = _reader.ReadUInt16();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadPalette()
|
||||||
|
{
|
||||||
|
_palette = new List<Rgba32>(_paletteColors);
|
||||||
|
for (var i = 0; i < _paletteColors; i++)
|
||||||
|
{
|
||||||
|
var r = _reader.ReadByte();
|
||||||
|
var g = _reader.ReadByte();
|
||||||
|
var b = _reader.ReadByte();
|
||||||
|
var a = _reader.ReadByte();
|
||||||
|
|
||||||
|
_palette.Add(new Rgba32 {A = a, R = r, G = g, B = b});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Image<Rgba32> ReadImage()
|
||||||
|
{
|
||||||
|
var image = new Image<Rgba32>(_width, _height);
|
||||||
|
|
||||||
|
for (var i = 0; i < _height; i++)
|
||||||
|
{
|
||||||
|
var row = _reader.ReadBytes(_rowLengthInBytes);
|
||||||
|
var bitReader = new BitReader(row);
|
||||||
|
for (var j = 0; j < _width; j++)
|
||||||
|
{
|
||||||
|
var pixelColorIndex = bitReader.ReadBits(_bitsPerPixel);
|
||||||
|
var color = _palette[(int) pixelColorIndex];
|
||||||
|
image[j, i] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace WatchFace.Models
|
||||||
|
{
|
||||||
|
public class Parameter
|
||||||
|
{
|
||||||
|
private Parameter(byte id, long value)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Parameter(byte id, List<Parameter> value)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
List = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte Id { get; }
|
||||||
|
public long Value { get; }
|
||||||
|
public List<Parameter> List { get; }
|
||||||
|
public bool IsList => List != null;
|
||||||
|
|
||||||
|
|
||||||
|
public static Parameter ReadFrom(Stream fileStream)
|
||||||
|
{
|
||||||
|
var rawId = fileStream.ReadByte();
|
||||||
|
var id = (byte)((rawId & 0xf8) >> 3);
|
||||||
|
var flags = (ParameterFlags) (rawId & 0x7);
|
||||||
|
|
||||||
|
if (flags.HasFlag(ParameterFlags.List))
|
||||||
|
{
|
||||||
|
var readBytes = fileStream.ReadByte();
|
||||||
|
var buffer = new byte[readBytes];
|
||||||
|
fileStream.Read(buffer, 0, readBytes);
|
||||||
|
var stream = new MemoryStream(buffer);
|
||||||
|
|
||||||
|
var list = ReadList(stream);
|
||||||
|
return new Parameter(id, list);
|
||||||
|
}
|
||||||
|
var value = ReadValue(fileStream);
|
||||||
|
return new Parameter(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Parameter> ReadList(Stream stream)
|
||||||
|
{
|
||||||
|
var result = new List<Parameter>();
|
||||||
|
while (stream.Position < stream.Length)
|
||||||
|
{
|
||||||
|
var parameter = ReadFrom(stream);
|
||||||
|
result.Add(parameter);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long ReadValue(Stream fileStream)
|
||||||
|
{
|
||||||
|
long value = 0;
|
||||||
|
var offset = 0;
|
||||||
|
|
||||||
|
var currentByte = fileStream.ReadByte();
|
||||||
|
while ((currentByte & 0x80) > 0)
|
||||||
|
{
|
||||||
|
value = value | ((long) (currentByte & 0x7f) << offset);
|
||||||
|
offset += 7;
|
||||||
|
currentByte = fileStream.ReadByte();
|
||||||
|
}
|
||||||
|
value = value | ((long) (currentByte & 0x7f) << offset);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace WatchFace.Models
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum ParameterFlags
|
||||||
|
{
|
||||||
|
Unknown = 1,
|
||||||
|
List = 2,
|
||||||
|
Unknown2 = 4
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace WatchFace.Models
|
||||||
|
{
|
||||||
|
public class Resource
|
||||||
|
{
|
||||||
|
public Resource(byte id, List<Parameter> descriptor)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
Descriptor = descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Id { get; }
|
||||||
|
public List<Parameter> Descriptor { get; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using SixLabors.ImageSharp;
|
||||||
|
using WatchFace.Models;
|
||||||
|
|
||||||
|
namespace WatchFace
|
||||||
|
{
|
||||||
|
public class Reader
|
||||||
|
{
|
||||||
|
private readonly FileStream _fileStream;
|
||||||
|
|
||||||
|
public Reader(FileStream streamReader)
|
||||||
|
{
|
||||||
|
_fileStream = streamReader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Resource> Resources { get; private set; }
|
||||||
|
public List<Image<Rgba32>> Images { get; private set; }
|
||||||
|
|
||||||
|
public void Parse()
|
||||||
|
{
|
||||||
|
var header = Header.ReadFrom(_fileStream);
|
||||||
|
if (!header.IsValid) return;
|
||||||
|
|
||||||
|
var parametersStream = StreamBlock(_fileStream, (int) header.ParametersSize);
|
||||||
|
|
||||||
|
var mainParam = Parameter.ReadFrom(parametersStream);
|
||||||
|
var parameters = Parameter.ReadList(parametersStream);
|
||||||
|
var coordinatesTableSize = mainParam.List[0].Value;
|
||||||
|
var imagesTableLength = mainParam.List[1].Value;
|
||||||
|
|
||||||
|
ParseResources(coordinatesTableSize, parameters);
|
||||||
|
ParseImages(imagesTableLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ParseResources(long coordinatesTableSize, IReadOnlyCollection<Parameter> parameters)
|
||||||
|
{
|
||||||
|
var coordsStream = StreamBlock(_fileStream, (int) coordinatesTableSize);
|
||||||
|
|
||||||
|
Resources = new List<Resource>(parameters.Count);
|
||||||
|
foreach (var parameter in parameters)
|
||||||
|
{
|
||||||
|
var descriptorOffset = parameter.List[0].Value;
|
||||||
|
var descriptorLength = parameter.List[1].Value;
|
||||||
|
coordsStream.Seek((long) descriptorOffset, SeekOrigin.Begin);
|
||||||
|
var descriptorStream = StreamBlock(coordsStream, (int) descriptorLength);
|
||||||
|
Resources.Add(new Resource(parameter.Id, Parameter.ReadList(descriptorStream)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ParseImages(long imagesTableLength)
|
||||||
|
{
|
||||||
|
var imagesOffsets = new byte[imagesTableLength * 4];
|
||||||
|
_fileStream.Read(imagesOffsets, 0, imagesOffsets.Length);
|
||||||
|
|
||||||
|
var imagesOffset = _fileStream.Position;
|
||||||
|
|
||||||
|
Images = new List<Image<Rgba32>>((int) imagesTableLength);
|
||||||
|
for (var i = 0; i < (int) imagesTableLength; i++)
|
||||||
|
{
|
||||||
|
var imageOffset = BitConverter.ToUInt32(imagesOffsets, i * 4) + imagesOffset;
|
||||||
|
_fileStream.Seek(imageOffset, SeekOrigin.Begin);
|
||||||
|
var image = new ImageReader(_fileStream).Read();
|
||||||
|
image.Save($"{i}.bmp");
|
||||||
|
Images.Add(image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Stream StreamBlock(Stream stream, int size)
|
||||||
|
{
|
||||||
|
var buffer = new byte[size];
|
||||||
|
stream.Read(buffer, 0, buffer.Length);
|
||||||
|
return new MemoryStream(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace WatchFace.Utils
|
||||||
|
{
|
||||||
|
public class BitReader
|
||||||
|
{
|
||||||
|
private readonly byte[] _masks = {128, 192, 224, 240, 248, 252, 254, 255};
|
||||||
|
private readonly Stream _stream;
|
||||||
|
|
||||||
|
private int _bitsRemaining;
|
||||||
|
private int _currentByte;
|
||||||
|
private bool _isDataPresent = true;
|
||||||
|
|
||||||
|
public BitReader(Stream stream)
|
||||||
|
{
|
||||||
|
_stream = stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BitReader(byte[] arrayBytes)
|
||||||
|
{
|
||||||
|
_stream = new MemoryStream(arrayBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsDataPresent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_bitsRemaining > 0) return true;
|
||||||
|
|
||||||
|
TryReadNext();
|
||||||
|
return _isDataPresent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ReadBit()
|
||||||
|
{
|
||||||
|
return ReadBits(1) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte ReadByte()
|
||||||
|
{
|
||||||
|
return (byte) ReadBits(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ulong ReadBits(int length)
|
||||||
|
{
|
||||||
|
ulong data = 0;
|
||||||
|
while (length > 0)
|
||||||
|
{
|
||||||
|
if (_bitsRemaining == 0 && _isDataPresent)
|
||||||
|
TryReadNext();
|
||||||
|
|
||||||
|
var dataLength = Math.Min(length, _bitsRemaining);
|
||||||
|
|
||||||
|
var currentData = (ulong) (_currentByte & _masks[dataLength - 1]);
|
||||||
|
if (length > 8)
|
||||||
|
currentData = currentData << (length - 8);
|
||||||
|
else
|
||||||
|
currentData = currentData >> (8 - length);
|
||||||
|
data = data | currentData;
|
||||||
|
|
||||||
|
_currentByte = _currentByte << dataLength;
|
||||||
|
length -= dataLength;
|
||||||
|
_bitsRemaining -= dataLength;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TryReadNext()
|
||||||
|
{
|
||||||
|
_currentByte = _stream.ReadByte();
|
||||||
|
_isDataPresent = _currentByte > -1;
|
||||||
|
if (_isDataPresent)
|
||||||
|
_bitsRemaining = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard1.6</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0002" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System.Drawing">
|
||||||
|
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Drawing.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue