Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GetMachineCode method for certain cases #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cryptolens.Licensing/Cryptolens.Licensing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Cryptolens AB</Company>
<Authors>Cryptolens AB</Authors>
<Version>4.0.25</Version>
<AssemblyVersion>4.0.25.1</AssemblyVersion>
<FileVersion>4.0.25.1</FileVersion>
<Version>4.0.26-beta</Version>
<AssemblyVersion>4.0.26.1</AssemblyVersion>
<FileVersion>4.0.26.1</FileVersion>
<Description>An API documentation can be found at https://help.cryptolens.io/api/dotnet/.

This is a client API that serves as an interface to Cryptolens Web API (app.cryptolens.io/docs/api/).
Expand All @@ -23,7 +23,7 @@ NB: There is also one for C++ (https://github.com/Cryptolens/cryptolens-cpp)</De
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>certifikat.pfx</AssemblyOriginatorKeyFile>
<PackageTags>licensing system, SKGL, serial key management, http://app.cryptolens.io/ , skgl extension, SKM Client API, cryptolens</PackageTags>
<PackageReleaseNotes>Release notes available at https://help.cryptolens.io/api/dotnet/articles/v4025.html</PackageReleaseNotes>
<PackageReleaseNotes>Release notes available at https://help.cryptolens.io/api/dotnet/articles/v4026.html</PackageReleaseNotes>

<DefineConstants>SYSTEM_MANAGEMENT</DefineConstants>

Expand Down
41 changes: 28 additions & 13 deletions Cryptolens.Licensing/SKMv3/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,37 @@ public enum OSType {
public static OSType GetPlatform()
{
#if (NETSTANDARD2_0 || NET46 || NET47 || NET471) && SYSTEM_MANAGEMENT
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux))
{
return OSType.Linux;
}
else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX))
{
return OSType.Mac;
}
else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))

try
{
return OSType.Windows;
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux))
{
return OSType.Linux;
}
else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX))
{
return OSType.Mac;
}
else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
{
return OSType.Windows;
}
else
{
return OSType.Undefined;
}
}
else
catch(Exception ex)
{
return OSType.Undefined;
int p = (int)Environment.OSVersion.Platform;
if ((p == 4) || (p == 6) || (p == 128))
{
return OSType.Unix;
}
else
{
return OSType.Windows;
}
}

#else
Expand Down Expand Up @@ -361,7 +377,6 @@ public static string GetMachineCodePI(int v=1)
public static string GetMachineCode(bool platformIndependent = false, int v = 1/*bool includeProcessId = false*/)
{

int p = (int)Environment.OSVersion.Platform;
OSType os = GetPlatform();

#if !SYSTEM_MANAGEMENT
Expand Down