コード例 #1
0
 private void openSelectedRemote()
 {
     if (lstConfigs.SelectedItems.Count > 0 && !String.IsNullOrEmpty(lstConfigs.SelectedItems[0].Text))
     {
         //write newly selected config to ini
         iniSettings.Write("rcloneRemote", lstConfigs.SelectedItems[0].Text.ToString());
         //not doing first time setup so the main form DOES EXIST, can clear the CD and refresh view
         if (!rcloneExplorer.initialSetup)
         {
             //set current path to root
             rcloneExplorer.remoteCD = "";
             //refresh the explorer lst
             exploreHandler.refreshlstExplorer();
         }
         else //finished with first time setup
         {
             //end init setup
             rcloneExplorer.initialSetup = false;
         }
         //close config screen
         this.Close();
     }
 }
コード例 #2
0
        public void transferTimer_Tick(object sender, EventArgs e)
        {
            ListView   lstDownloads = rcloneExplorer.myform.Controls.Find("lstDownloads", true)[0] as ListView;
            ListView   lstUploads   = rcloneExplorer.myform.Controls.Find("lstUploads", true)[0] as ListView;
            TabPage    tabDownloads = rcloneExplorer.myform.Controls.Find("tabDownloads", true)[0] as TabPage;
            TabPage    tabUploads   = rcloneExplorer.myform.Controls.Find("tabUploads", true)[0] as TabPage;
            TextBox    txtSyncLog   = rcloneExplorer.myform.Controls.Find("txtSyncLog", true)[0] as TextBox;
            TextBox    txtRawOut    = rcloneExplorer.myform.Controls.Find("txtRawOut", true)[0] as TextBox;
            NotifyIcon notifyIcon   = rcloneExplorer.notifyIconPub;

            if (!notifyIcon.Visible)
            {
                if (downloadsHandler.downloading.Count > 0)
                {
                    for (var i = 0; i < downloadsHandler.downloading.Count; i++)
                    {
                        {
                            //check downloadPId proces.exists to see if uploadis complete yet
                            int PID = Convert.ToInt32(downloadsHandler.downloading[i][0]);
                            if (miscContainer.ProcessExists(PID))
                            {
                                //download still in progress
                                lstDownloads.Items[i].SubItems[0].Text = downloadsHandler.downloading[i][0].ToString();
                                lstDownloads.Items[i].SubItems[2].Text = downloadsHandler.downloading[i][2];
                                lstDownloads.Items[i].SubItems[3].Text = downloadsHandler.downloading[i][3];
                            }
                            else
                            {
                                if (lstDownloads.Items[i].SubItems[2].Text != "Done!")
                                {
                                    //download complete (guessing! probs best to validate this)
                                    lstDownloads.Items[i].SubItems[2].Text = "100!";
                                }
                            }
                        }
                    }
                    if (tabDownloads.Text != "Downloads (" + lstDownloads.Items.Count + ")")
                    {
                        tabDownloads.Text = "Downloads (" + lstDownloads.Items.Count + ")";
                    }
                }
                if (uploadsHandler.uploading.Count > 0)
                {
                    for (var i = 0; i < uploadsHandler.uploading.Count; i++)
                    {
                        {
                            //store current iteration from list
                            string[] entry = uploadsHandler.uploading[i];
                            //entry filename
                            string uploadedFilename = entry[1];

                            //check downloadPId proces.exists to see if uploadis complete yet
                            int PID = Convert.ToInt32(uploadsHandler.uploading[i][0]);
                            if (miscContainer.ProcessExists(PID))
                            {
                                //upload still in progress
                                //upload list should be {PID, Name, Percent, Speed}
                                lstUploads.Items[i].SubItems[0].Text = uploadsHandler.uploading[i][0].ToString();
                                lstUploads.Items[i].SubItems[2].Text = uploadsHandler.uploading[i][2];
                                lstUploads.Items[i].SubItems[3].Text = uploadsHandler.uploading[i][3];
                            }
                            else
                            {
                                if (lstUploads.Items[i].SubItems[2].Text != "Done!")
                                {
                                    //upload complete (guessing! probs best to validate this)
                                    lstUploads.Items[i].SubItems[2].Text = "Done!";
                                    if (iniSettings.Read("refreshAutomatically") == "true")
                                    {
                                        exploreHandler.refreshlstExplorer();
                                    }
                                }
                            }
                        }
                    }
                    if (tabUploads.Text != "Uploads (" + lstUploads.Items.Count + ")")
                    {
                        tabUploads.Text = "Uploads (" + lstUploads.Items.Count + ")";
                    }
                }
                if (syncingHandler.syncingPID > 0)
                {
                    if (File.Exists("sync.log"))
                    {
                        using (var fs = new FileStream("sync.log", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                            using (var sr = new StreamReader(fs, Encoding.Default))
                            {
                                string tmp = sr.ReadToEnd();
                                txtSyncLog.AppendText(tmp.Replace("\n", Environment.NewLine));
                            }
                    }
                }
                if (rcloneExplorer.consoleEnabled)
                {
                    txtRawOut.AppendText(rcloneExplorer.rawOutputBuffer);
                    rcloneExplorer.rawOutputBuffer = "";
                }
            }
        }
コード例 #3
0
 private void menuStripView_Refresh_Click(object sender, EventArgs e)
 {
     exploreHandler.refreshlstExplorer();
 }