impl: license generator
This commit is contained in:
parent
152b10093c
commit
c0a37003ad
6 changed files with 81 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
.idea
|
||||
generator/.idea
|
||||
generator/obj
|
||||
generator/bin
|
34
generator/Program.cs
Normal file
34
generator/Program.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Reflection;
|
||||
using CoreLogic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
if (args.Length != 2)
|
||||
{
|
||||
Console.WriteLine("Usage: dotnet run <uuid> <email>");
|
||||
return;
|
||||
}
|
||||
|
||||
var uuid = args[0];
|
||||
var email = args[1];
|
||||
|
||||
var appendTokenField = typeof(Statics).GetField("appendToken", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (appendTokenField == null)
|
||||
{
|
||||
Console.WriteLine("Failed to find appendToken field");
|
||||
return;
|
||||
}
|
||||
|
||||
var appendToken = (string) appendTokenField.GetValue(null)!;
|
||||
Console.WriteLine($"appendToken: {appendToken}");
|
||||
|
||||
var encrypted = EncDec.EncryptData(
|
||||
JsonConvert.SerializeObject(new License { UniqueId = uuid, Email = email }),
|
||||
uuid.Trim().ToUpperInvariant() + appendToken);
|
||||
|
||||
Console.WriteLine($"License:\n{encrypted}");
|
||||
|
||||
internal struct License
|
||||
{
|
||||
[JsonProperty("uniqueid")] public string UniqueId;
|
||||
[JsonProperty("email")] public string Email;
|
||||
}
|
20
generator/generator.csproj
Normal file
20
generator/generator.csproj
Normal file
|
@ -0,0 +1,20 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="CoreLogic">
|
||||
<HintPath>lib\CoreLogic.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
16
generator/generator.sln
Normal file
16
generator/generator.sln
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator", "generator.csproj", "{6A20249C-8538-44E8-9963-9E4EFA62703A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6A20249C-8538-44E8-9963-9E4EFA62703A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6A20249C-8538-44E8-9963-9E4EFA62703A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6A20249C-8538-44E8-9963-9E4EFA62703A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6A20249C-8538-44E8-9963-9E4EFA62703A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
7
generator/global.json
Normal file
7
generator/global.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "7.0.0",
|
||||
"rollForward": "latestMinor",
|
||||
"allowPrerelease": false
|
||||
}
|
||||
}
|
BIN
generator/lib/CoreLogic.dll
Normal file
BIN
generator/lib/CoreLogic.dll
Normal file
Binary file not shown.
Loading…
Reference in a new issue