Inventory Web Page - 'Native' embedded DLL 
I have a new Inventory Web Browser plugin based on Microsoft.WebView2 (chrome) instead of IE.
It's working well, except that it has a native DLL that it seems needs to be available to the plugin at compile-time.
If the DLL is in the Jiwa folder, or I put it into the "compiler" and "runtime" folders, then the plugin runs, but I can't add it to the "embedded assemblies" list, because it's not a .NET assembly.
I've attached it as a document and have this code to copy it to the compile-time and run-time plugin folders, which seems to do the trick:
Is there a better way?
edited subject to be more useful to other punters.
It's working well, except that it has a native DLL that it seems needs to be available to the plugin at compile-time.
If the DLL is in the Jiwa folder, or I put it into the "compiler" and "runtime" folders, then the plugin runs, but I can't add it to the "embedded assemblies" list, because it's not a .NET assembly.
I've attached it as a document and have this code to copy it to the compile-time and run-time plugin folders, which seems to do the trick:
- Code: Select all
Public Sub SetupBeforeHandlers(ByVal JiwaForm As IJiwaForm, ByVal Plugin As Plugin.Plugin) Implements IJiwaFormPlugin.SetupBeforeHandlers
For Each doc As Documents.Document In Plugin.Documents ' should only be one
' grab the native DLL and put it into the runtime folder.
If doc.PhysicalFileName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) Then
Dim dllName As String = IO.Path.Combine(Plugin.CompilationFolder, doc.PhysicalFileName)
If Not My.Computer.FileSystem.FileExists(dllName) OrElse My.Computer.FileSystem.GetFileInfo(dllName).CreationTime < Plugin.LastWriteDateTime Then
My.Computer.FileSystem.WriteAllBytes(dllName, doc.FileBinary, False)
End If
dllName = IO.Path.Combine(Plugin.RuntimeFolder, doc.PhysicalFileName)
If Not My.Computer.FileSystem.FileExists(dllName) OrElse My.Computer.FileSystem.GetFileInfo(dllName).CreationTime < Plugin.LastWriteDateTime Then
My.Computer.FileSystem.WriteAllBytes(dllName, doc.FileBinary, False)
End If
End If
Next
End Sub
Is there a better way?
edited subject to be more useful to other punters.