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

Update license file #2978

Merged
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
Binary file modified targets/netcore/nanoFramework.nanoCLR.CLI/License/vspt.vsptlic
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
using System.Reflection;
using System.Text.RegularExpressions;

// TODO: Add IsInstalled method that does the following:
// A) Get the guid from SerialPortLibraryClass
// B) Checks registry for the existence of the library ex: HKEY_CLASSES_ROOT\CLSID\{e13da62c-3a88-45a4-a5d0-224dea7bf4ff}
CoryCharlton marked this conversation as resolved.
Show resolved Hide resolved
// TODO: Check license AFTER confirming installation so a more specific error can be displayed
namespace nanoFramework.nanoCLR.CLI
{
public class VirtualSerialDeviceManager
Expand Down Expand Up @@ -190,16 +194,26 @@ private void InstallLicense()
{
var assembly = typeof(VirtualSerialDeviceManager).GetTypeInfo().Assembly;

Stream resource = assembly.GetManifestResourceStream(_licenseResourceName);
MemoryStream memoryStream = new MemoryStream();
using var resource = assembly.GetManifestResourceStream(_licenseResourceName);
if (resource is null)
{
// TODO: Should probably return an error
return;
CoryCharlton marked this conversation as resolved.
Show resolved Hide resolved
}

using var memoryStream = new MemoryStream();

resource.CopyTo(memoryStream);
var bytes = memoryStream.ToArray();

if (bytes.Length > 0)
if (bytes.Length <= 0)
{
_serialPortLibrary.installLicenseInMemory(bytes);
// TODO: Should probably return an error
return;
CoryCharlton marked this conversation as resolved.
Show resolved Hide resolved
}

// This appears to be a misleading name as the license appears to be persisted
_serialPortLibrary.installLicenseInMemory(bytes);
}
}
}