Exemple #1
0
 private void btnIncludeBoth_Click(object sender, EventArgs e)
 {
     // save the existing one by copying it to the left side
     foreach (var item in IterateListViewItems(true /*only selected*/))
     {
         if (item.IsInRight())
         {
             var nameOnLeft = Path.GetDirectoryName(item.GetLeftPath(m_results.config)) + "\\" + Path.GetFileNameWithoutExtension(item.GetLeftPath(m_results.config)) + RunImplementation.GetRandomNumbersInString() +
                              Path.GetExtension(item.GetLeftPath(m_results.config));
             if (MessageBox.Show("Confirm copy from " + item.GetRightPath(m_results.config) + " to " + nameOnLeft + "?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 File.Copy(item.GetRightPath(m_results.config), nameOnLeft, false /*okToOverwrite*/);
             }
         }
     }
 }
Exemple #2
0
        private void ManualCopyFileImpl(string s1, string s2)
        {
            try
            {
                if (File.Exists(s2) && !String.IsNullOrEmpty(this.m_globalSettings.m_directoryForDeletedFiles))
                {
                    var newName = m_globalSettings.m_directoryForDeletedFiles + "\\" + Path.GetFileName(s2) + RunImplementation.GetRandomNumbersInString();
                    File.Copy(s2, newName, true /*okOverwrite*/);
                }

                File.Copy(s1, s2, true /*okOverwrite*/);
            }
            catch (Exception e)
            {
                MessageBox.Show("Copying " + s1 + " to " + s2 + ". Exception " + e);
            }
        }