示例#1
0
        private void move(String path)
        {
            Configuration c = DataManagerConf.read().FirstOrDefault();

            c.LastFolder = path;
            string newName = this.fileInfo.Name;
            string newpath = c.LastFolder + "\\" + newName;

            bool moved = false;

            try {
                if (File.Exists(newpath))
                {
                    newName = DateTime.Now.ToString("yyyyMMddHHmmss") + newName;
                    newpath = c.LastFolder + "\\" + newName;
                }
                File.Move(this.fileInfo.FullPath, newpath);
                moved = true;
            } catch (Exception ex) {
                moved = false;
                MessageBox.Show("Error during move file operation : " + ex.Message);
            }
            if (moved)
            {
                this.mainForm.f.Remove(this.fileInfo.FullPath);
                this.fileInfo = new FileSystemEventArgs(this.fileInfo.ChangeType, c.LastFolder, newName);
                bind();
                DataManagerConf.write(c);
            }
        }
示例#2
0
 private void btnSearchDirectory_Click(object sender, EventArgs e)
 {
     if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
     {
         var           folder = folderBrowserDialog1.SelectedPath;
         Configuration c      = DataManagerConf.read().FirstOrDefault();
         if (c == null)
         {
             c = new Configuration();
         }
         c.PathToWatch  = folder;
         txtFolder.Text = folder;
         List <Configuration> cc = new List <Configuration>();
         cc.Add(c);
         DataManagerConf.write(cc);
     }
 }