237 lines
9.0 KiB
Plaintext
237 lines
9.0 KiB
Plaintext
@page "/TestHwInfo"
|
|
@using DeviceId
|
|
@using EgwCoreLib.Utils
|
|
|
|
@if (isLoading)
|
|
{
|
|
<LoadingData DisplaySize="LoadingData.CtrlSize.Large" DisplayMode="LoadingData.SpinMode.BounceLine"></LoadingData>
|
|
}
|
|
else
|
|
{
|
|
<div class="row small" style="font-size: 0.8rem;">
|
|
<div class="col-6">
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
Device ID
|
|
</li>
|
|
@if (ListDevId != null && ListDevId.Count > 0)
|
|
{
|
|
@foreach (var item in ListDevId)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
}
|
|
</ul>
|
|
</div>
|
|
<div class="col-6">
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
Sublicense
|
|
</li>
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">CodImpiego</div>
|
|
<div class="px-1">@codImpiego</div>
|
|
</li>
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">Payload</div>
|
|
<div class="px-1">@decVal</div>
|
|
</li>
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">AppKey</div>
|
|
<div class="px-1">@appKey</div>
|
|
</li>
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<button class="btn btn-info btn-sm w-100" @onclick="Regenerate">ReGen</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="col-4">
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
Machine Info
|
|
</li>
|
|
@if (ListAllMacInfo != null && ListAllMacInfo.Count > 0)
|
|
{
|
|
@foreach (var item in ListAllMacInfo)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
}
|
|
</ul>
|
|
</div>
|
|
<div class="col-4">
|
|
@if (ListUserInfo != null && ListUserInfo.Count > 0)
|
|
{
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
UserInfo
|
|
</li>
|
|
@foreach (var item in ListUserInfo)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
@if (ListNetInfo != null && ListNetInfo.Count > 0)
|
|
{
|
|
<br />
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
NetInfo
|
|
</li>
|
|
@foreach (var item in ListNetInfo)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
</div>
|
|
<div class="col-4">
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
CpuInfo
|
|
</li>
|
|
@foreach (var item in ListOsInfo)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
<br />
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
OsInfo
|
|
</li>
|
|
@foreach (var item in ListOsInfo)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
<br />
|
|
<ul class="list-group">
|
|
<li class="list-group-item active">
|
|
VolInfo
|
|
</li>
|
|
@foreach (var item in ListVolInfo)
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between">
|
|
<div class="px-1">@item.Key</div>
|
|
<div class="px-1">@item.Value</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
}
|
|
|
|
@code {
|
|
protected Dictionary<string, string> ListAllMacInfo { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, string> ListCpuInfo { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, string> ListDevId { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, string> ListNetInfo { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, string> ListOsInfo { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, string> ListUserInfo { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, string> ListVolInfo { get; set; } = new Dictionary<string, string>();
|
|
|
|
protected MachineDataValidator MDValidator { get; set; } = new MachineDataValidator();
|
|
|
|
protected SubLicManager SubLicManager { get; set; } = new SubLicManager();
|
|
|
|
protected string codImpiego = "";
|
|
protected string appKey = "";
|
|
protected string decVal = "";
|
|
|
|
private bool isLoading { get; set; } = true;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
isLoading = true;
|
|
await InvokeAsync(StateHasChanged);
|
|
await Task.Run(() =>
|
|
{
|
|
GetInfo();
|
|
});
|
|
Regenerate();
|
|
isLoading = false;
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
protected void GetInfo()
|
|
{
|
|
string deviceId = "";
|
|
deviceId = new DeviceIdBuilder()
|
|
.OnWindows(windows => windows.AddWindowsDeviceId())
|
|
.ToString();
|
|
ListDevId.Add("DevId_01", deviceId);
|
|
|
|
deviceId = new DeviceIdBuilder()
|
|
.AddMachineName()
|
|
.AddOsVersion()
|
|
// .AddFileToken("machine.uid")
|
|
.ToString();
|
|
ListDevId.Add("DevId_02", deviceId);
|
|
|
|
deviceId = new DeviceIdBuilder()
|
|
.AddMachineName()
|
|
.AddUserName()
|
|
.AddOsVersion()
|
|
.OnWindows(windows => windows
|
|
.AddMacAddressFromWmi(excludeWireless: true, excludeNonPhysical: true)
|
|
.AddProcessorId()
|
|
.AddMotherboardSerialNumber()
|
|
.AddSystemDriveSerialNumber())
|
|
// .OnLinux(linux => linux
|
|
// .AddMotherboardSerialNumber()
|
|
// .AddSystemDriveSerialNumber())
|
|
// .OnMac(mac => mac
|
|
// .AddSystemDriveSerialNumber()
|
|
// .AddPlatformSerialNumber())
|
|
.ToString();
|
|
ListDevId.Add("DevId_03", deviceId);
|
|
|
|
ListNetInfo = new Dictionary<string, string>(MachineDataValidator.netInfo);
|
|
ListOsInfo = new Dictionary<string, string>(MachineDataValidator.osInfo);
|
|
ListUserInfo = new Dictionary<string, string>(MachineDataValidator.userInfo);
|
|
ListCpuInfo = new Dictionary<string, string>(MachineDataValidator.cpuInfo);
|
|
ListVolInfo = new Dictionary<string, string>(MachineDataValidator.volInfo);
|
|
|
|
ListAllMacInfo = new Dictionary<string, string>(MachineDataValidator.userInfo);
|
|
foreach (var item in MachineDataValidator.netInfo)
|
|
{
|
|
if (!ListAllMacInfo.ContainsKey(item.Key))
|
|
{
|
|
ListAllMacInfo.Add(item.Key, item.Value);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
protected void Regenerate()
|
|
{
|
|
isLoading = true;
|
|
codImpiego = SubLicManager.CodImpiego();
|
|
appKey = SubLicManager.GenKey(passphrase, false);
|
|
decVal = SteamCrypto.DecryptString(appKey, passphrase);
|
|
isLoading = false;
|
|
}
|
|
|
|
private string passphrase = "SaltPass";
|
|
} |