Closed peacho10 closed 1 year ago
What would this add to spacewarp that adding it as just another library for BepInEx or KSP2 would not add.
(For reference) To do as stated above just make another BepInEx plugin that your mod is dependant on that just calls Assembly.Load on the System.Ports dll
What would this add to spacewarp that adding it as just another library for BepInEx or KSP2 would not add.
Do BepInEx or KSP2 have the ability to read a serial port via usb??
No, but you can use bepinex to make a plugin to load the System.IO.Ports DLL
[BepInPlugin(GUID,NAME,VERSION)]
public class PortsForBepInEx : BaseUnityPlugin {
private void Awake() {
Assembly.LoadFile("System.IO.Ports.dll")
}
}
And resolve references and fill in the guid, name, and version And put the dll right next to the plugin after its compiled
Thank you so much!! I'm going to try it!!
Hi. I try this, but not working yet.
I do this:
Then, i put the dll generate and System.IO.Ports.dll in same folder:
And my mod in:
And get this errors:
[Warning:Space Warp] System.TypeLoadException: Could not load type of field 'Project1.Project1Plugin:serialPort' (25) due to: Could not resolve type with token 01000025 (from typeref, class/assembly System.ComponentModel.Component, System.ComponentModel.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) assembly:System.ComponentModel.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:System.ComponentModel.Component member:(null) signature:
[Warning:Space Warp] Types failed to load from assembly System.IO.Ports, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 due to the reasons below, continuing anyway.
Might also need : System.ComponentModel.Component and System.ComponentModel.Primitives?? In bepinex pluguin, can add more than one dll??
Thank you so much!!
Loader.dll
should go in a subfolder of plugins
like the mod you made (but separate), and System.IO.Ports.dll
should be next to Loader.dll
in that subfolder
Hello. Finally I managed to solve the problem by changing the TargetFramework to "net472".
Many thanks for everything!!
Closing this then, since the issue was resolved.
Hello. First of all I'm new to mods, sorry for the inconvenience. I'm trying to make a mod that can read data via usb, to control the vessel. I have added the library to my project. But I don't know where I have to add the dll for spacewarp to find it.
Spacewarp log error:
[Warning:Space Warp] System.TypeLoadException: Could not load type of field 'Project1.Project1Plugin:puertoSerial' (26) due to: Could not load file or assembly 'System.IO.Ports, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. assembly:System.IO.Ports, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type: member:(null) signature:
[Warning:Space Warp] System.TypeLoadException: Could not load type of field 'Project1.Project1Plugin+<>O:<1>__PuertoSerial_DataReceived' (1) due to: Could not load file or assembly 'System.IO.Ports, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. assembly:System.IO.Ports, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type: member:(null) signature:
[Warning:Space Warp] Types failed to load from assembly com.github.peacho.mimod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null due to the reasons below, continuing anyway.
Thank you so much!!