57 lines
1.7 KiB
Plaintext
57 lines
1.7 KiB
Plaintext
@using Core
|
|
|
|
|
|
<div class="row">
|
|
@if (!string.IsNullOrEmpty(@rawData))
|
|
{
|
|
@if (!string.IsNullOrEmpty(@keyGen))
|
|
{
|
|
<div class="col-12">
|
|
<CopyToClipboard Text="@keyGen" ShowText="true" />
|
|
</div>
|
|
}
|
|
<div class="col-8">
|
|
@if (!string.IsNullOrEmpty(@keyGen))
|
|
{
|
|
<p>Click to Copy Generated Key to Clipboard</p>
|
|
}
|
|
</div>
|
|
<div class="col-4 text-right">
|
|
<button class="btn btn-outline-success" type="button" @onclick="() => GenerateKey()">Generate Key from data <i class="fas fa-key"></i></button>
|
|
</div>
|
|
}
|
|
<div class="col-12">
|
|
Paste File Content Here
|
|
<div class="input-group mb-2">
|
|
<textarea @bind="rawData" @bind:event="oninput" rows="12" class="form-control" placeholder="paste machine data here" aria-label="paste machine data here" @onchange="() => GenerateKey()" />
|
|
</div>
|
|
<p class="text-danger">@errorMsg</p>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private string rawData { get; set; } = "";
|
|
private string keyGen { get; set; } = "";
|
|
private string errorMsg { get; set; } = "";
|
|
|
|
private async Task GenerateKey()
|
|
{
|
|
// recupero dati..
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
var cMDV = new MachineDataValidator(rawData);
|
|
if (cMDV.hasValidData)
|
|
{
|
|
keyGen = cMDV.machineKeyHash;
|
|
errorMsg = "";
|
|
}
|
|
else
|
|
{
|
|
keyGen = "";
|
|
errorMsg = "Invalid Content Value!!!";
|
|
}
|
|
}
|
|
await Task.Delay(1);
|
|
}
|
|
}
|