public WorkerProcess(IHostObject hostObject) { if (hostObject == null) { throw new ArgumentNullException("hostObject"); } this.hostObject = hostObject; }
/// <summary> /// Unload the host and free up all resources used by it /// </summary> protected void UnloadHost() { if (this.HostObject != null) { this.HostObject.Dispose(); this.HostObject = null; } }
/// <summary> /// Extract length from host object /// </summary> /// <param name="stegoObject"></param> /// <returns></returns> protected int ExtractLength(IHostObject hostObject) { ///32 bytes of stego object will contain 4 bytes of legth information. ///We will read it byte by byte byte[] lengthInfo = new byte[4]; for (int i = 0; i < 4; i++) { byte[] lengthBytes = new byte[8]; hostObject.Read(lengthBytes, 0, lengthBytes.Length); ///The first byte in this array will contain LSB information. We will have to ///read MSB first for (int j = lengthBytes.Length; j > 0; j--) { ///Shift one bit to right side so the next bit can be set lengthInfo[i] <<= 0x1; lengthInfo[i] |= Substitution.LsbValue(lengthBytes[j - 1]); } } return(AppUtil.FromByteArray(lengthInfo)); }
private void TryStartHost(AutoResetEvent startedEvent, out Exception exception) { exception = null; try { host = factory.CreateObject(address, this); host.Closed += Host_Closed; host.Closing += Host_Closing; host.Faulted += Host_Faulted; host.Opened += Host_Opened; host.Opening += Host_Opening; host.Open(); Logger.Debug($"Successfully started communication host for endpoint '{address}'."); startedEvent.Set(); } catch (Exception e) { exception = e; } }
public WorkerProcess(IHostObject hostObject) { if (hostObject == null) throw new ArgumentNullException("hostObject"); this.hostObject = hostObject; }