public void SelectTse() { TseSerialNumberList serialNumbers; int err = worm_lantse_listConnectedTses(tse_context, 0, out serialNumbers); if (err != 0) { throw new Exception("Failed to list connected TSEs: " + err); } if (serialNumbers.amount == 0) { throw new Exception("No TSE available on LAN TSE."); } // The serialNumbers.serialNumbers variable is a flattened representation of a // two dimensional byte array. Each entry is 32 bytes big and can be parsed by // skipping to the correct offset and then taking the next 32 bytes. //byte[] serialNumber = serialNumbers.serialNumbers.Skip(0).Take(32).ToArray(); byte[] serialNumber = serialNumbers.serialNumbers.Skip(0 * 32).Take(32).ToArray(); worm_lantse_select(tse_context, serialNumber, serialNumber.Length); // Update currently in use info object to the now selected TSE. info = new TseInfo(tse_context); }
public TseAccess(char driveletter) { string mountPoint = driveletter + ":"; int err = worm_init(out tse_context, mountPoint); if (err != 0) { throw new Exception("Failed to initialize: " + err); } info = new TseInfo(tse_context); }
protected virtual void Dispose(bool disposeManagedObjects) { if (alreadyDisposed) { return; } if (disposeManagedObjects) { info = null; } if (tse_context != IntPtr.Zero) { worm_cleanup(tse_context); tse_context = IntPtr.Zero; } alreadyDisposed = true; }