internal static void DsrInitialize() { DebugFileCtrl debug = new DebugFileCtrl(false); if (bInitializing) { return; } bInitializing = true; try { if (Program.LogEvents) { debug.WriteLog("About to create DSR main COM object (Pre-Initialization)"); } instanceID = Guid.NewGuid(); _dsr = new DSRSERVERClass(); if (Program.LogEvents) { debug.WriteLog("DSR main COM object created successfully (Pre-Initialization). Guid: " + instanceID.ToString()); } } finally { bInitializing = false; } }
public static IDSRSERVER WithDSR() { int lCounter = 0; DebugFileCtrl debug = new DebugFileCtrl(false); if (bInitializing) { while (bInitializing) { System.Threading.Thread.Sleep(500); lCounter = lCounter + 1; if (lCounter >= 180) { if (Program.LogEvents) { debug.WriteLog("DSR did not respond in a timely fashion"); } throw new Exception("DSR did not respond in a timely fashion"); } } } if (_dsr == null) { if (Program.LogEvents) { debug.WriteLog("About to create DSR main COM object"); } instanceID = Guid.NewGuid(); try { _dsr = new DSRSERVERClass(); if (Program.LogEvents) { debug.WriteLog("DSR main COM object created successfully. Guid: " + instanceID.ToString()); } return(_dsr); } catch (System.Exception err) { debug.WriteLog("EXCEPTION (WrapperDSR ctor): " + err.Message); return(null); } } else { if (Program.LogEvents) { debug.WriteLog("Returning instance of DSR COM object. Guid: " + instanceID.ToString()); } return(_dsr); } }