Exemplo n.º 1
0
        private void SetConnectionFields(KConnection kConnection)
        {
            // Load the dropdown and text boxes
            textBoxPath.Text     = kConnection.Path;
            textBoxHost.Text     = kConnection.Host;
            textBoxService.Text  = kConnection.Service;
            textBoxPort.Text     = kConnection.Port;
            textBoxUser.Text     = kConnection.User;
            textBoxPassword.Text = kConnection.Password;
            textBoxHome.Text     = kConnection.Home;
            //Nacho Load the icon
            textIcon.Text = kConnection.IconR;

            comboBoxActions.Items.Clear();
            comboBoxActions.Items.Add("");
            comboBoxActions.Items.AddRange(
                actions.FindAll(c => ((kConnection.CvsSystem == true && (c.CvsOnly == true || c.CvsOnly == false) ||
                                       (kConnection.CvsSystem == false && c.CvsOnly == false)))).ToArray());

            buttonLaunch.Enabled    = true;
            menuItemLaunch.Enabled  = true;
            buttonFtpClient.Enabled = true;

            SetNotes();
        }
Exemplo n.º 2
0
        private void SetNotes()
        {
            textBoxNotes.Clear();

            KConnection kConnection = (KConnection)comboBoxConnections.SelectedItem;
            Action      action      = null;

            if (comboBoxActions.SelectedItem != null && !comboBoxActions.SelectedItem.ToString().Equals(""))
            {
                action = (Action)comboBoxActions.SelectedItem;
            }

            textBoxNotes.Text = "Connection: " + kConnection.GetNotes();
            if (action != null && action.Script != null)
            {
                textBoxNotes.Text = textBoxNotes.Text + Environment.NewLine + Environment.NewLine + "Action: " + action.Script.GetNotes();
            }
        }
Exemplo n.º 3
0
        private void comboBoxConnections_SelectedIndexChanged(object sender, EventArgs e)
        {
            KConnection kConnection = (KConnection)((ComboBox)sender).SelectedItem;

            SetConnectionFields(kConnection);
        }
Exemplo n.º 4
0
        public void Run(int hWnd, Automate automate, KConnection connection, KConnection destination, Form parent)
        {
            //int hash = Get16BitHash("26/10/18");

            StringBuilder result = new StringBuilder();

            // Get the object used to communicate with the server.
            FtpWebRequest requestDir = (FtpWebRequest)WebRequest.Create("ftp://172.31.49.13/");

            requestDir.Method = WebRequestMethods.Ftp.ListDirectory;

            // This example assumes the FTP site uses anonymous logon.
            requestDir.Credentials = new NetworkCredential("kccjapt", "kccjapt123");
            FtpWebResponse response = (FtpWebResponse)requestDir.GetResponse();

            Stream       responseStream = response.GetResponseStream();
            StreamReader reader         = new StreamReader(responseStream);

            string line = reader.ReadLine();

            while (line != null)
            {
                result.Append(line);
                result.Append("\n");
                line = reader.ReadLine();
            }

            // Get the object used to communicate with the server.
            FtpWebRequest requestFile = (FtpWebRequest)WebRequest.Create("ftp://172.31.49.13/%2fuser1/RMD/R9304EHAC/work/ScriptFileName.txt");

            requestFile.Method = WebRequestMethods.Ftp.DownloadFile;

            // This example assumes the FTP site uses anonymous logon.
            requestFile.Credentials = new NetworkCredential("kccjapt", "kccjapt123");
            FtpWebResponse responseFile = (FtpWebResponse)requestFile.GetResponse();

            Stream       responseStreamFile = responseFile.GetResponseStream();
            StreamReader readerFile         = new StreamReader(responseStreamFile);

            line = readerFile.ReadLine();
            if (line != null)
            {
                string           test    = line.Substring(1);
                StringCollection result2 = new StringCollection();

                FtpWebRequest requestFile2 = (FtpWebRequest)WebRequest.Create("ftp://172.31.49.13/%2f" + line.Substring(1));
                requestFile2.Method = WebRequestMethods.Ftp.DownloadFile;

                // This example assumes the FTP site uses anonymous logon.
                requestFile2.Credentials = new NetworkCredential("kccjapt", "kccjapt123");
                FtpWebResponse responseFile2 = (FtpWebResponse)requestFile2.GetResponse();

                Stream       responseStreamFile2 = responseFile2.GetResponseStream();
                StreamReader readerFile2         = new StreamReader(responseStreamFile2);

                line = readerFile2.ReadLine();
                while (line != null)
                {
                    result2.Add(line);
                    line = readerFile2.ReadLine();
                }

                readerFile2.Close();

                int firstIndex = result2.IndexOf("CLEAR P");
                int lastIndex  = 0;

                foreach (string s in result2)
                {
                    if (s.Contains("SAVE <G>"))
                    {
                        lastIndex = result2.IndexOf(s);
                    }
                }

                for (int index = firstIndex; index <= lastIndex; index++)
                {
                    string lineCommand = result2[index];
                }
            }

            readerFile.Close();
            reader.Close();
            response.Close();
        }