public DataTerminalSession(TcpClient MyTCPClient, NetworkStream MyTCPStream, CloseConnectionDelegate MyCloseConnectionMethod, UpdateCompleteDelegate InformAboutUpdateComplete, ReceiveMessage receiveMessage, Guid sessionId) { TCPClient = MyTCPClient; TCPStream = MyTCPStream; DeleteConnection = MyCloseConnectionMethod; this.receiveMessage = receiveMessage; this.SessionId = sessionId; //Server1CAgent = new HandlingVia1CServer(@"Srvr=""localhost""; Ref=""newwms"";"); //Server1CAgent = new HandlingVia1CServer(@"Srvr=""localhost""; Ref=""iboya81""; Usr=""Оборский Д.В.""; Pwd=""123456"""); //Server1CAgent = new HandlingVia1CServer(@"File=""C:\Documents and Settings\Reshifa\My Documents\InfoBase9""; Usr=""Denis.V.O""; Pwd=""123"""); this.InformAboutUpdateComplete = InformAboutUpdateComplete; }
public static void Check(UpdateCompleteDelegate callback = null, ReleaseStream stream = ReleaseStream.Stable40, ThreadPriority priority = ThreadPriority.Normal) { lock (UpdateLock) { if (updateThread != null) { return; } ReleaseStream = stream; completeCallback = callback; setCallbackStatus(UpdateStates.Checking); updateThread = new Thread(() => { try { Log(); Log(@"Beginning update thread"); Log(@"Stream: " + ReleaseStream.ToString()); Log(); UpdateStates state = doUpdate(); Log(); Log(@"Ending update thread with result: " + state); Log(); setCallbackStatus(state); } catch (ThreadAbortException) { setCallbackStatus(UpdateStates.NoUpdate); } catch (Exception e) { Log(@"Serious error occurred in update thread: " + e.ToString()); Log(@"Returning NoUpdate state to caller"); setCallbackStatus(UpdateStates.EmergencyFallback); } completeCallback = null; updateThread = null; }); updateThread.IsBackground = true; updateThread.Priority = priority; updateThread.Start(); } }
public CatchingConnections(TcpListener MyTCPServer, ArrayList allowIpList, ArrayList NeedToUpdateIpList, UpdateCompleteDelegate InformAboutUpdateComplete, string FullUpdatePath, string Server1CConnectionString, ReceiveMessage receiveMessage) { TCPServer = MyTCPServer; StorekeeperSessions = new List<DataTerminalSession>(); this.AllowIpList = new Dictionary<string, string>(); this.NeedToUpdateIpList = NeedToUpdateIpList; this.InformAboutUpdateComplete = InformAboutUpdateComplete; this.FullUpdatePath = FullUpdatePath; this.receiveMessage = receiveMessage; foreach (string allowIPAddress in allowIpList) { AllowIpList.Add(allowIPAddress, Guid.NewGuid().ToString()); } Console.WriteLine(); }
public CatchingConnections(TcpListener MyTCPServer, ArrayList allowIpList, ArrayList NeedToUpdateIpList, UpdateCompleteDelegate InformAboutUpdateComplete, string FullUpdatePath, string Server1CConnectionString, ReceiveMessage receiveMessage) { TCPServer = MyTCPServer; StorekeeperSessions = new List <DataTerminalSession>(); this.AllowIpList = new Dictionary <string, string>(); this.NeedToUpdateIpList = NeedToUpdateIpList; this.InformAboutUpdateComplete = InformAboutUpdateComplete; this.FullUpdatePath = FullUpdatePath; this.receiveMessage = receiveMessage; foreach (string allowIPAddress in allowIpList) { AllowIpList.Add(allowIPAddress, Guid.NewGuid().ToString()); } Console.WriteLine(); }