stylistic fixes

This commit is contained in:
Wither OrNot 2025-04-07 18:12:53 -04:00
parent 103981762f
commit 91e8508848
5 changed files with 16 additions and 21 deletions

View File

@ -50,8 +50,7 @@ namespace LibTSforge.Activators
ulong time1 = (ulong)(creationTime + tickCount + deltaTime); ulong time1 = (ulong)(creationTime + tickCount + deltaTime);
ulong crcBindTime = (ulong)DateTime.UtcNow.ToFileTime(); ulong crcBindTime = (ulong)DateTime.UtcNow.ToFileTime();
ulong timerTime = crcBindTime / 10000; ulong timerTime = crcBindTime / 10000;
ulong expiry = Constants.TimerMax; ulong expiry = Constants.TimerMax / 10000;
expiry /= 10000;
VariableBag avmaBinding = new VariableBag(version); VariableBag avmaBinding = new VariableBag(version);

View File

@ -4,6 +4,7 @@ namespace LibTSforge.Modifiers
using SPP; using SPP;
using System.IO; using System.IO;
using System; using System;
public static class SetIIDParams public static class SetIIDParams
{ {
public static void SetParams(PSVersion version, bool production, Guid actId, PKeyAlgorithm algorithm, int group, int serial, ulong security) public static void SetParams(PSVersion version, bool production, Guid actId, PKeyAlgorithm algorithm, int group, int serial, ulong security)

View File

@ -4,9 +4,9 @@ namespace LibTSforge.PhysicalStore
public enum BlockType : uint public enum BlockType : uint
{ {
NONE, // unused NONE,
NAMED, NAMED,
ATTRIBUTE, //unused ATTRIBUTE,
TIMER TIMER
} }

View File

@ -18,16 +18,16 @@ namespace LibTSforge.SPP
public ulong Security; public ulong Security;
public bool Upgrade; public bool Upgrade;
public PKeyAlgorithm Algorithm; public PKeyAlgorithm Algorithm;
private readonly string EulaType; public readonly string EulaType;
private readonly string PartNumber; public readonly string PartNumber;
public readonly string Edition; public readonly string Edition;
public readonly string Channel; public readonly string Channel;
private readonly Guid ActivationId; public readonly Guid ActivationId;
private string mpc; private string mpc;
private string pid2; private string pid2;
private byte[] KeyBytes public byte[] KeyBytes
{ {
get { return BitConverter.GetBytes(klow).Concat(BitConverter.GetBytes(khigh)).ToArray(); } get { return BitConverter.GetBytes(klow).Concat(BitConverter.GetBytes(khigh)).ToArray(); }
} }
@ -91,16 +91,6 @@ namespace LibTSforge.SPP
return new Guid(CryptoUtils.SHA256Hash(pkb.Serialize()).Take(16).ToArray()); return new Guid(CryptoUtils.SHA256Hash(pkb.Serialize()).Take(16).ToArray());
} }
private string GetDefaultMPC()
{
int build = Environment.OSVersion.Version.Build;
string defaultMPC = build >= 10240 ? "03612" :
build >= 9600 ? "06401" :
build >= 9200 ? "05426" :
"55041";
return defaultMPC;
}
public string GetMPC() public string GetMPC()
{ {
if (mpc != null) if (mpc != null)
@ -108,7 +98,12 @@ namespace LibTSforge.SPP
return mpc; return mpc;
} }
mpc = GetDefaultMPC(); int build = Environment.OSVersion.Version.Build;
mpc = build >= 10240 ? "03612" :
build >= 9600 ? "06401" :
build >= 9200 ? "05426" :
"55041";
// setup.cfg doesn't exist in Windows 8+ // setup.cfg doesn't exist in Windows 8+
string setupcfg = string.Format(@"{0}\oobe\{1}", Environment.SystemDirectory, "setup.cfg"); string setupcfg = string.Format(@"{0}\oobe\{1}", Environment.SystemDirectory, "setup.cfg");
@ -205,7 +200,7 @@ namespace LibTSforge.SPP
return writer.GetBytes(); return writer.GetBytes();
} }
private string GetExtendedPid() public string GetExtendedPid()
{ {
string mpc = GetMPC(); string mpc = GetMPC();
int serialHigh = Serial / 1000000; int serialHigh = Serial / 1000000;

View File

@ -148,7 +148,7 @@ namespace LibTSforge.SPP
throw new FileNotFoundException("Failed to autodetect key type, specify physical store key with /prod or /test arguments."); throw new FileNotFoundException("Failed to autodetect key type, specify physical store key with /prod or /test arguments.");
} }
private static string GetPSPath(PSVersion version) public static string GetPSPath(PSVersion version)
{ {
switch (version) switch (version)
{ {