示例#1
0
文件: Service.cs 项目: cobelab/LabRun
        private Service()
        {
            var domainName = "";
            var userName = "";
            var userPassword = "";
            try
            {
                using (var file = new StreamReader(AuthFile))
                {
                    string line;
                    while ((line = file.ReadLine()) != null)
                    {
                        if (line.StartsWith("domainName="))
                        {
                            domainName = Path.Combine(line.Remove(0, "domainName=".Length));
                        }

                        if (line.StartsWith("userName="******"userName="******"userPassword="******"userPassword="******"Results";
                    AppActive = true;

                    WindowSizes.Add(new WindowSize("Full Screen", null, null));
                    WindowSizes.Add(new WindowSize("Half Screen Left", 960, 1080));
                    var size = new WindowSize("Half Screen Right", 960, 1080);
                    size.XPos = 960;
                    size.YPos = 0;
                    WindowSizes.Add(size);
                }
            }
            // If auth.ini doesnt exist, this method creates the file with the correct input variables.
            catch (FileNotFoundException ex)
            {
                MessageBox.Show("Please close the program, and enter your credentials into auth.ini", ex.Message,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                using (var file = new StreamWriter("auth.ini"))
                {
                    file.WriteLine("domainName=");
                    file.WriteLine("userName="******"userPassword="******"clients.txt"))
            {
                File.Create("clients.txt");
            }
            Config = new Config(ConfigFile);
        }
示例#2
0
文件: ZTree.cs 项目: cobelab/LabRun
        private void xcopy(List<LabClient> selectedClients, WindowSize windowSize)
        {
            //----run leaves with proper args
            var i = 0;
            foreach (var client in selectedClients)
            {
                var batFileName = Path.Combine(tempPath, "ztreeLeaves" + client.ComputerName + ".bat");
                using (var file = new StreamWriter(batFileName))
                {
                    file.WriteLine("@echo off");
                    var adminCompName = Environment.MachineName;

                    //adds zero in front for <10no leaves
                    var zleafNo = client.BoothNo + "";
                    if (client.BoothNo < 9)
                        zleafNo = "0" + zleafNo;

                    //window setting
                    var windSize = "/size " + windowSize.Width + "x" + windowSize.Height;
                    var windPos = "/position " + windowSize.XPos + "," + windowSize.YPos;

                    var line = @"cmdkey.exe /add:" + client.ComputerName + @" /user:"******" /pass:"******"""" + ApplicationExecutableName + @""" /name Zleaf_" + zleafNo + @" /server " +
                                 adminCompName + @" /language en " + windSize + " " + windPos;
                    line = @service.Config.PsTools + @"\PsExec.exe -d -i 1 \\" + client.ComputerName + @" -u " +
                           service.Credentials.DomainSlashUser + @" -p " + service.Credentials.Password + @" " + runCmd;
                    file.WriteLine(line);
                }
                service.StartNewCmdThread(batFileName);
                i++;
            }
            //----end

            //-----notify ui
            service.NotifyStatus("Request Sent");
            //-----end
        }
示例#3
0
文件: ZTree.cs 项目: cobelab/LabRun
 public Thread TransferAndRun(List<LabClient> selectedClients, WindowSize windowSize)
 {
     var t = new Thread(() => xcopy(selectedClients, windowSize));
     t.Start();
     return t;
 }