Key von Syncfusion wird aus der Dongle nun gelesen
This commit is contained in:
@@ -1,166 +0,0 @@
|
||||
using CodeMeter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* 4e 6a 41 77 4e 6a 51 7a 51 44 4d 78 4d 7a 6b 79 5a 54 4d 30 4d 6d 55 7a 4d 47 35 4c 61 32 55 7a 51 31 46 30 52 33 64 46 5a 45 68 35 56 57 74 47 61 7a 5a 30 61 48 70 55 57 69 39 58 64 6b 78 4a 54 32 78 43 62 6b 74 58 52 58 46 57 63 30 5a 73 64 7a 41 39
|
||||
*/
|
||||
namespace SanSystem
|
||||
{
|
||||
class Dongle: IDisposable
|
||||
{
|
||||
uint FirmCode;
|
||||
uint ProductCode;
|
||||
public string SyncfusionKey ="";
|
||||
|
||||
Api cmApi;
|
||||
CmCredential cmCred;
|
||||
CmAccess2 cmAcc;
|
||||
HCMSysEntry hcmse;
|
||||
CmBoxInfo cmBoxInfo;
|
||||
CmBoxEntry2 BoxContent;
|
||||
|
||||
public Dongle(uint ProductCode)
|
||||
{
|
||||
#if !DEBUG
|
||||
this.FirmCode = 103086;
|
||||
this.ProductCode = ProductCode;
|
||||
#else
|
||||
this.FirmCode = 10;
|
||||
this.ProductCode = 1;
|
||||
#endif
|
||||
|
||||
|
||||
cmApi = new Api();
|
||||
cmCred = new CmCredential();
|
||||
cmAcc = new CmAccess2();
|
||||
|
||||
cmAcc.Credential = cmCred;
|
||||
|
||||
cmAcc.Ctrl |= CmAccess.Option.UserLimit;
|
||||
cmAcc.FirmCode = this.FirmCode;
|
||||
cmAcc.ProductCode = this.ProductCode;
|
||||
|
||||
|
||||
hcmse = cmApi.CmAccess2(CmAccessOption.Local, cmAcc);
|
||||
if(hcmse == null)
|
||||
{
|
||||
ErrorCodes2 code = cmApi.CmGetLastErrorCode2();
|
||||
string output = string.Format("{0}", code);
|
||||
|
||||
}
|
||||
|
||||
if (!CheckDongleVorhanden())
|
||||
Trace.WriteLine("Dongle nicht vorhanden");
|
||||
|
||||
cmBoxInfo = new CmBoxInfo();
|
||||
|
||||
CmGetBoxContentsOption boxOptions = new CmGetBoxContentsOption();
|
||||
boxOptions = CmGetBoxContentsOption.AllEntries;
|
||||
|
||||
CmBoxEntry2[] tmpBoxContent;
|
||||
|
||||
tmpBoxContent = cmApi.CmGetBoxContents2(hcmse, boxOptions, this.FirmCode, cmBoxInfo);
|
||||
|
||||
CmEntryData[] pCmBoxEntry = (CmEntryData[])cmApi.CmGetInfo(hcmse, CmGetInfoOption.EntryData);
|
||||
|
||||
for(int i = 0; i < pCmBoxEntry.Length; i++)
|
||||
{
|
||||
switch(pCmBoxEntry[i].Ctrl & 0x0ffff)
|
||||
{
|
||||
case (uint)CodeMeter.GlobalEntryOption.ProtectedData:
|
||||
//var s = pCmBoxEntry[i].Data;
|
||||
SyncfusionKey = Encoding.ASCII.GetString(pCmBoxEntry[i].Data);
|
||||
//var len = pCmBoxEntry[i].DataLen;
|
||||
//var stringer = Encoding.ASCII.GetString(s);
|
||||
//Debugger.Break();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CmBoxEntry2 boxes in tmpBoxContent)
|
||||
{
|
||||
if (boxes.ProductCode == this.ProductCode)
|
||||
{
|
||||
this.BoxContent = boxes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
~Dongle()
|
||||
{
|
||||
CleanDongle();
|
||||
}
|
||||
|
||||
public void CleanDongle()
|
||||
{
|
||||
cmApi.CmRelease(hcmse);
|
||||
}
|
||||
|
||||
public bool CheckDongleVorhanden()
|
||||
{
|
||||
#if LAPTOP
|
||||
return true;
|
||||
#else
|
||||
if (hcmse == null)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public string GetDongleSerial()
|
||||
{
|
||||
|
||||
CmBoxInfo res = (CmBoxInfo)cmApi.CmGetInfo(hcmse, CmGetInfoOption.BoxInfo);
|
||||
if (null != res)
|
||||
{
|
||||
return res.SerialNumber.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Fehler beim aufrufen der Seriennummer");
|
||||
}
|
||||
}
|
||||
|
||||
public uint GetFeatureMap()
|
||||
{
|
||||
return BoxContent.FeatureMap;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool IsLicensed(byte neededMask)
|
||||
{
|
||||
#if LAPTOP
|
||||
return true;
|
||||
#else
|
||||
uint DongleFeature = GetFeatureMap();
|
||||
|
||||
//Trace.WriteLine("DongleFeature: " + DongleFeature);
|
||||
|
||||
byte DongleFeatureB = (byte)DongleFeature;
|
||||
|
||||
if ((DongleFeatureB & neededMask) == neededMask)
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
CleanDongle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SanShared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define LAPTOP
|
||||
using SanShared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -6,6 +7,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace SanSystem
|
||||
{
|
||||
static class Program
|
||||
|
||||
@@ -104,22 +104,9 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WibuCmNET, Version=6.80.274.500, Culture=neutral, PublicKeyToken=01d86e1eb0c69c23, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\3rdPackage\WibuCmNET.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="wupi.net, Version=9.20.8.500, Culture=neutral, PublicKeyToken=5f399135ee0c35d4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\3rdPackage\wupi.net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WupiEngineNet, Version=9.20.11.500, Culture=neutral, PublicKeyToken=8d0bd6872db0b9bb, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\3rdPackage\WupiEngineNet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BüroExporter.cs" />
|
||||
<Compile Include="Dongle.cs" />
|
||||
<Compile Include="Einstellungen\ObjecteListSetting.cs" />
|
||||
<Compile Include="Einstellungen\Settings.cs" />
|
||||
<Compile Include="Einstellungen\StreetListSettings.cs" />
|
||||
|
||||
@@ -15,7 +15,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WupiEngine;
|
||||
|
||||
namespace SanSystem
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user