Example #1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            Uri ftp = new Uri("ftp://" + AppCon.HostName);
            //TODO : create a list to handle the Documents paths.
            string doc = "Permissions.config.xml";//get from list;

            inFullPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)).FullName.ToString() + "\\RocketApp\\";

            string path = AppCon.DirPath + "/";

            FtpHandler ftpHandler = new FtpHandler(ftp, path + doc, AppCon, inFullPath + doc);
            //Thread reamains un-touched.
            Thread downloadFilesThread = new Thread(new ThreadStart(ftpHandler.DownloadFilesFromServer));

            lblStatus.Text = "Downloading files!";
            //inisiate download.
            downloadFilesThread.Start();
            downloadFilesThread.Join();
            //download completed.
            lblStatus.Text = "Complete!";
            // downloadFilesThread.Abort();
            FtpHandler ftpHandlerp = new FtpHandler(ftp, "", AppCon, "");

            downloadFilesThread.Abort();
            foreach (Plugin item in plugins)
            {
                if (!Directory.Exists(inFullPath + "Plugins\\" + item.Name))
                {
                    Directory.CreateDirectory(inFullPath + "Plugins\\" + item.Name);
                }
                ftpHandlerp.Path   = path + "Plugins/" + item.Name + "/" + item.ConfigFile;
                ftpHandlerp.InPath = inFullPath + "Plugins\\" + item.Name + "\\" + item.ConfigFile;

                if (item.Enabled)
                {
                    downloadFilesThread = new Thread(new ThreadStart(ftpHandlerp.DownloadFilesFromServer));
                    lblStatus.Text      = "Downloading files!";
                    //inisiate download.
                    downloadFilesThread.Start();
                    downloadFilesThread.Join();
                    //download completed.
                    lblStatus.Text = "Complete!";
                    downloadFilesThread.Abort();
                }
            }
            cbPlugins.Enabled = true;
        }
Example #2
0
        private void btnSaveAll_Click(object sender, EventArgs e)
        {
            Uri ftp = new Uri("ftp://" + AppCon.HostName);
            //TODO : create a list to handle the Documents paths.
            string doc = "Permissions.config.xml";//get from list;

            inFullPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)).FullName.ToString() + "\\RocketApp\\" + doc;

            string path = "/" + AppCon.DirPath + "/" + doc;

            FtpHandler ftpHandler = new FtpHandler(ftp, path, AppCon, inFullPath);
            //Thread reamains un touched.
            Thread UploadFilesThread = new Thread(new ThreadStart(ftpHandler.UploadFilesToServer));

            lblStatus.Text = "Uploading files!";
            //inisiate Upload.
            UploadFilesThread.Start();
            UploadFilesThread.Join();
            //Upload completed.
            lblStatus.Text = "Complete!";

            foreach (Plugin item in plugins)
            {
                ftpHandler.Path   = path + "Plugins/" + item.Name + "/" + item.ConfigFile;
                ftpHandler.InPath = inFullPath + "Plugins\\" + item.Name + "\\" + item.ConfigFile;
                if (item.Enabled)
                {
                    UploadFilesThread = new Thread(new ThreadStart(ftpHandler.DownloadFilesFromServer));
                    lblStatus.Text    = "Downloading files!";
                    //inisiate download.
                    UploadFilesThread.Start();
                    UploadFilesThread.Join();
                    //download completed.
                    lblStatus.Text = "Complete!";
                    UploadFilesThread.Abort();
                }
            }
        }