コード例 #1
0
        public virtual void DeleteResults(List <LabClient> clients)
        {
            ThreadStart ts = delegate()
            {
                //----del tests files from client computers
                int i = 0;
                foreach (LabClient client in clients)
                {
                    string copyPathRemote = Path.Combine(tempPath, "remoteTestDel" + client.ComputerName + ".bat");
                    using (System.IO.StreamWriter file = new System.IO.StreamWriter(copyPathRemote))
                    {
                        Debug.WriteLine(copyPathRemote);
                        string path = Path.Combine(service.TestFolder, applicationName);

                        string line = @"C:\PSTools\PsExec.exe -d -i 1 \\" + client.ComputerName + @" -u " + service.Credentials.DomainSlashUser + @" -p " + service.Credentials.Password + @" cmd /c (rmdir /s /q """ + path + @""")";
                        file.WriteLine(line);
                    }
                    service.StartNewCmdThread(copyPathRemote);
                    i++;
                }
                //----end

                //----del results from client computers
                i = 0;
                foreach (LabClient client in clients)
                {
                    string copyPathRemote = Path.Combine(tempPath, "remoteResultDel" + client.ComputerName + ".bat");
                    using (System.IO.StreamWriter file = new System.IO.StreamWriter(copyPathRemote))
                    {
                        Debug.WriteLine(copyPathRemote);
                        string path = Path.Combine(service.TestFolder, applicationName);

                        string line = @"C:\PSTools\PsExec.exe -d -i 1 \\" + client.ComputerName + @" -u " + service.Credentials.DomainSlashUser + @" -p " + service.Credentials.Password + @" cmd /c (rmdir /s /q """ + path + @""")";
                        file.WriteLine(line);
                    }
                    service.StartNewCmdThread(copyPathRemote);
                    i++;
                }
                //----end

                //----del results from local
                string pathDel = Path.Combine(tempPath, "delResultsFromLocal.bat");
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(pathDel))
                {
                    file.WriteLine("@echo off");
                    string line = @"rmdir /s /q """ + Path.Combine(service.TestFolder, resultsFolderName, projectName) + @"""";
                    file.WriteLine(line);
                }
                service.ExecuteCommandNoOutput(pathDel, true);
                //----end

                //-----notify ui
                service.notifyStatus("Local cleaning complete. Request sent to delete from Labclients");
                //-----end
            };

            service.RunInNewThread(ts);
        }
コード例 #2
0
ファイル: TestApp.cs プロジェクト: futtrup91/LabRun
        public virtual void DeleteResults(List <LabClient> clients)
        {
            ThreadStart ts = delegate
            {
                //----del tests files from client computers
                var i = 0;
                foreach (var client in clients)
                {
                    var copyPathRemote = Path.Combine(tempPath, "remoteTestDel" + client.ComputerName + ".bat");
                    using (var file = new StreamWriter(copyPathRemote))
                    {
                        Debug.WriteLine(copyPathRemote);
                        var path = Path.Combine(service.Config.Computerinstallpath, applicationName);

                        var line = @service.Config.PsTools + @"\PsExec.exe -d -i 1 \\" + client.ComputerName + @" -u " +
                                   service.Credentials.DomainSlashUser + @" -p " + service.Credentials.Password +
                                   @" cmd /c (rmdir /s /q """ + path + @""")";
                        file.WriteLine(line);
                    }
                    service.StartNewCmdThread(copyPathRemote);
                    i++;
                }
                //----end

                //----del results from client computers
                i = 0;
                foreach (var client in clients)
                {
                    var copyPathRemote = Path.Combine(tempPath, "remoteResultDel" + client.ComputerName + ".bat");
                    using (var file = new StreamWriter(copyPathRemote))
                    {
                        Debug.WriteLine(copyPathRemote);
                        var path = Path.Combine(service.Config.Computerinstallpath, applicationName);

                        var line = @service.Config.PsTools + @"\PsExec.exe -d -i 1 \\" + client.ComputerName + @" -u " +
                                   service.Credentials.DomainSlashUser + @" -p " + service.Credentials.Password +
                                   @" cmd /c (rmdir /s /q """ + path + @""")";
                        file.WriteLine(line);
                    }
                    service.StartNewCmdThread(copyPathRemote);
                    i++;
                }
                //----end

                //----del results from local
                var pathDel = Path.Combine(tempPath, "delResultsFromLocal.bat");
                using (var file = new StreamWriter(pathDel))
                {
                    file.WriteLine("@echo off");
                    var line = @"rmdir /s /q """ +
                               Path.Combine(service.Config.Computerinstallpath, resultsFolderName, projectName) + @"""";
                    file.WriteLine(line);
                }
                service.StartNewCmdThread(pathDel);
                //----end

                //-----notify ui
                service.NotifyStatus("Local cleaning complete. Request sent to delete from Labclients");
                //-----end
            };

            service.RunInNewThread(ts);
        }