From 7c56126985864b63e36c9bdc0dd7d38ab82f7745 Mon Sep 17 00:00:00 2001 From: Cory Charlton Date: Wed, 10 Jul 2024 12:25:41 -0700 Subject: [PATCH] Update license file --- .../License/vspt.vsptlic | Bin 986 -> 938 bytes .../VirtualSerialDeviceManager.cs | 22 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/targets/netcore/nanoFramework.nanoCLR.CLI/License/vspt.vsptlic b/targets/netcore/nanoFramework.nanoCLR.CLI/License/vspt.vsptlic index beae16db976f8f32129127e4f862cb6e2e5425d3..5f555676e4fc1e781312becf1129ec1a0479a9f2 100644 GIT binary patch literal 938 zcmV;b16BO)-Kzfqp#uN_Jy9qPAOZNXq3-lN z$D|eG)k8sW$Q~+f2q9J)uFA5+`X&!5$ocyd@itj=v7NLX`=?pvA=O+-H`Rb~=h`u^ zmxBW7DVfZz+UmdL+2P4Xm)`EJF7p(s^zd&%BQM4ozZ%zoj!Bb8!E3VK6VBffXKV}W z*=z|Cw;^ zV-yJ*Q?`wj-D{^tugHE^Uh;^a^2OYoFcru`@vK;#4(a(?BbL2y`_V}?5_`HC0n7Dt zFlYdNPz-Ac!5_|{GM~>vep;R^#?u9}0-ADt8xQ(6x6CBme4~(=T0n~l%R?;c-IHd@ zn8D8~Q{YG{D}$eEwCpUr!Fc(xUy<|aGa>yNRs{%}df8pZ$Qvz`+g86v4-tUhC*Kc7 z5=d5X`@Uqb)mJ8H$hD5(5wIivZ|-YbgHlL0@-gaSig*f4$iV?@Sv9=}ZETdlL)yt~ z-oti|ZOT5sis>MTWqInMA&=qT-`KlXj9HWTRR9sX@;1;|Hh+~LNwOV(Mj__uKU9Em zc+cvB=?2-stD&$q^-E+3KhIC9d)YT^eXI+j%np3%n+_y*F=s;3-FJB8_HF@+yOgaB0 z%Kyt#zQ}gT&f6+9+TH-%W(qZg!ZONu)hy=wp7Q*Mm>KAJCAE< zw`A={%2vm1iDxG7-tBzcUKkz&=%zCqkJumoxO;5DZ*E!dMAb<@a_DUg#-+F=gV>L< zOZvn6*e@K0H6-1=c*GWWH)eF#MQzT>%1%s07^3w_%1t8QRU(AK-T;R+mLsPRaR?ra z{~};D>D?itYh=%(n&*_B(N<tHvEACF-(W^!4($_yphiO5tH<1)wa&c{kvrb6w+#cq& zBe51VxXa5zv?A0^+vOJp4?RRbi)QuUh5cx>c87Jhn(dSTXUvy80SKi4zPTUX4cqf4 MA>O&$xSy9e_gwL6YAv`lbUV~B%?^w zV~y?CKMQy=^BVHzpF7MEvt;wvL|Oy9G_T3TT|z|iD3*08v2h(2GGg*)Yr0|1MErU! zczq0!=CVK0K|%b-J1X&aKP_kGtkbnp!_N;F>i+D~MFLe=UDI~!Nj@(Ww@;W$2t*;2 zUnj-Oy7%63mP{aXr*%k~l!}`5eAB8a&fp=UU+WhUn|cJ$h4?xzR6a6Bd@cl^d{=S0 z(W_@Mzac+CZg#!j;iS>PQuZY7dz!m~_?7=%w^G=T!vth-iuP@&2th?se>*XP4F@o)Az$Q)xz z>SSrhY!uzBk4KDMgGA0zB$wY!#~wLfY%IA80dGH z140fhfDqmum-TG#nW~YiuB(!=Atq?ivslc8@SEMn4}MVZIS((#dSh5k1L3V}QC^1& zGb$Z`=gx0+2Bh{H&RRg$tr&bpGkx|_6HL$sWh#G&U>hfu#>^(J@_+vqk)!vP~VzXSYbgk IjVv2YBXy1DasU7T diff --git a/targets/netcore/nanoFramework.nanoCLR.CLI/VirtualSerialBrige/VirtualSerialDeviceManager.cs b/targets/netcore/nanoFramework.nanoCLR.CLI/VirtualSerialBrige/VirtualSerialDeviceManager.cs index d08bf9fa46..6ea73a73fa 100644 --- a/targets/netcore/nanoFramework.nanoCLR.CLI/VirtualSerialBrige/VirtualSerialDeviceManager.cs +++ b/targets/netcore/nanoFramework.nanoCLR.CLI/VirtualSerialBrige/VirtualSerialDeviceManager.cs @@ -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} +// TODO: Check license AFTER confirming installation so a more specific error can be displayed namespace nanoFramework.nanoCLR.CLI { public class VirtualSerialDeviceManager @@ -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; + } + + 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; } + + // This appears to be a misleading name as the license appears to be persisted + _serialPortLibrary.installLicenseInMemory(bytes); } } }