/// /// <summary> /// Method used to start the test connection status Thread. /// Makes a series of calls to test the connection on the server. /// </summary> /// <param name="_ts"> TargetInfo of an individual target </param> private void testAllTargets(object targetSettings) { ThreadObject tObj = (ThreadObject)targetSettings; string strProName = tObj.StrProName; TargetSettings ts = tObj.Ts; string strTarget = ts.TargetServer; CheckConnection cc = new CheckConnection(ts); if (cc.pingConnections() == true) { _tabInterface.updateStatus(strProName, strTarget, "Testing FTP Settings"); if (cc.checkFTP() == true) { _tabInterface.updateStatus(strProName, strTarget, "Retrieving Site Name"); if (cc.checkSiteName() == true) { _tabInterface.updateStatus(strProName, strTarget, "Ready"); } else { _tabInterface.updateStatus(strProName, strTarget, "Could not retrieve site name"); } } else { _tabInterface.updateStatus(strProName, strTarget, "FTP settings error"); } } else { _tabInterface.updateStatus(strProName, strTarget, "Could not contact server"); //Target IP is not reachable, set status to 'Connection Failed' } }
/// /// <summary> /// Starts a single upload. /// </summary> /// <param name="strTarget">Target IP address</param> private void uploadSingle(string strTarget) { if (this.dicActiveUploads.ContainsKey(strTarget) == false) //Checks to see if target is currently being uploaded { TargetSettings targetInfo = null; foreach (TargetSettings ti in this.lstTargets) //Searches for matching target in the list { if (ti.TargetServer == strTarget) { targetInfo = ti; break; } } CheckConnection cc = new CheckConnection(targetInfo); if (cc.testAll() == true) { TargetUpload tu = new TargetUpload(this.pSettings, targetInfo, this.tabInt); tu.ProcessExit += processExitEvent; //Subscribes to Process exit event tu.ProcessComplete += processCompleteEvent; this.dicActiveUploads.Add(strTarget, tu); Thread uploadThread = new Thread(tu.startProcess); //Creates Thread uploadThread.IsBackground = true; //The Thread/Process ends when the _Main Thread ends uploadThread.Name = strTarget; //Sets name of Thread uploadThread.Start(); //Starts Thread this.lstThreads.Add(uploadThread); //Adds Thread to list } else { tabInt.OnConnectionFail(pSettings.ProjectName, targetInfo.TargetServer, "Connection Failed"); } } }
/// /// <summary> /// Creates and starts a Thread for each Target Address. /// </summary> private void uploadAll() { try { foreach (TargetSettings ts in lstTargets) { if (lstStopped.Contains(ts.TargetServer) != true) { if (dicActiveUploads.ContainsKey(ts.TargetServer) == false) { CheckConnection cc = new CheckConnection(ts); if (cc.testAll() == true) { TargetUpload tu = new TargetUpload(this.pSettings, ts, this.tabInt); //New target upload tu.ProcessExit += new TargetUpload.ProcessExitHandler(processExitEvent); //Subscribes to Process exit event tu.ProcessComplete += new TargetUpload.ProcessCompleteHandler(processCompleteEvent); dicActiveUploads.Add(ts.TargetServer, tu); Thread uploadThread = new Thread(tu.startProcess); //Creates Thread uploadThread.IsBackground = true; //The Thread/Process ends when the _Main Thread ends uploadThread.Name = ts.TargetServer; //Sets name of Thread uploadThread.Start(); //Starts Thread lstThreads.Add(uploadThread); //Adds Thread to list } else { tabInt.OnConnectionFail(pSettings.ProjectName, ts.TargetServer, "Connection Failed"); } } } else { tabInt.OnConnectionFail(pSettings.ProjectName, ts.TargetServer, "Please Wait"); } } } catch { } }
/// /// <summary> /// Starts a single upload. /// </summary> /// <param name="strTarget">Target IP address</param> private void uploadSingle(string strTarget) { if(this.dicActiveUploads.ContainsKey(strTarget) == false) //Checks to see if target is currently being uploaded { TargetSettings targetInfo = null; foreach(TargetSettings ti in this.lstTargets) //Searches for matching target in the list { if(ti.TargetServer == strTarget) { targetInfo = ti; break; } } CheckConnection cc = new CheckConnection(targetInfo); if(cc.testAll() == true) { TargetUpload tu = new TargetUpload(this.pSettings, targetInfo, this.tabInt); tu.ProcessExit += processExitEvent; //Subscribes to Process exit event tu.ProcessComplete += processCompleteEvent; this.dicActiveUploads.Add(strTarget, tu); Thread uploadThread = new Thread(tu.startProcess); //Creates Thread uploadThread.IsBackground = true; //The Thread/Process ends when the _Main Thread ends uploadThread.Name = strTarget; //Sets name of Thread uploadThread.Start(); //Starts Thread this.lstThreads.Add(uploadThread); //Adds Thread to list } else { tabInt.OnConnectionFail(pSettings.ProjectName, targetInfo.TargetServer, "Connection Failed"); } } }
/// /// <summary> /// Creates and starts a Thread for each Target Address. /// </summary> private void uploadAll() { try { foreach(TargetSettings ts in lstTargets) { if(lstStopped.Contains(ts.TargetServer) != true) { if(dicActiveUploads.ContainsKey(ts.TargetServer) == false) { CheckConnection cc = new CheckConnection(ts); if(cc.testAll() == true) { TargetUpload tu = new TargetUpload(this.pSettings, ts, this.tabInt); //New target upload tu.ProcessExit += new TargetUpload.ProcessExitHandler(processExitEvent); //Subscribes to Process exit event tu.ProcessComplete += new TargetUpload.ProcessCompleteHandler(processCompleteEvent); dicActiveUploads.Add(ts.TargetServer, tu); Thread uploadThread = new Thread(tu.startProcess); //Creates Thread uploadThread.IsBackground = true; //The Thread/Process ends when the _Main Thread ends uploadThread.Name = ts.TargetServer; //Sets name of Thread uploadThread.Start(); //Starts Thread lstThreads.Add(uploadThread); //Adds Thread to list } else { tabInt.OnConnectionFail(pSettings.ProjectName, ts.TargetServer, "Connection Failed"); } } } else { tabInt.OnConnectionFail(pSettings.ProjectName, ts.TargetServer, "Please Wait"); } } } catch { } }
/// /// <summary> /// Method used to start the test connection status Thread. /// Makes a series of calls to test the connection on the server. /// </summary> /// <param name="_ts"> TargetInfo of an individual target </param> private void testAllTargets(object targetSettings) { ThreadObject tObj = (ThreadObject)targetSettings; string strProName = tObj.StrProName; TargetSettings ts = tObj.Ts; string strTarget = ts.TargetServer; CheckConnection cc = new CheckConnection(ts); if(cc.pingConnections() == true) { _tabInterface.updateStatus(strProName, strTarget, "Testing FTP Settings"); if(cc.checkFTP() == true) { _tabInterface.updateStatus(strProName, strTarget, "Retrieving Site Name"); if(cc.checkSiteName() == true) { _tabInterface.updateStatus(strProName, strTarget, "Ready"); } else { _tabInterface.updateStatus(strProName, strTarget, "Could not retrieve site name"); } } else { _tabInterface.updateStatus(strProName, strTarget, "FTP settings error"); } } else { _tabInterface.updateStatus(strProName, strTarget, "Could not contact server"); //Target IP is not reachable, set status to 'Connection Failed' } }