Beispiel #1
0
        public FormSyncItems(CCreateSyncResultsSet results, RbcpyGlobalSettings globalSettings, bool bPreview)
        {
            InitializeComponent();
            m_results        = results;
            m_globalSettings = globalSettings;
            m_bPreview       = bPreview;

            if (bPreview)
            {
                this.Text = "Preview";
                this.lblNameOfAction.Text = "Preview:";
            }
            else
            {
                this.Text = "Results";
                this.lblNameOfAction.Text = "Results:";
                btnRun.Text                = "Sync Complete";
                btnRun.Enabled             = false;
                btnIncludeBoth.Enabled     = false;
                btnCompareWinmerge.Enabled = false;
                btnLeftToRight.Enabled     = btnRightToLeft.Enabled = false;
                btnShowLeft.Enabled        = btnShowRight.Enabled = false;
            }

            listView.UseCompatibleStateImageBehavior = false;
            listView.SmallImageList = imageList1;
            txtSummary.ReadOnly     = true;
            txtSummary.Text         = results.sSummary;
            ReAddItems();
            ShowSummary();
            txtSummary.Select(0, 0);
            listView.Focus();
        }
        public static void Serialize(RbcpyGlobalSettings config, string sFilename)
        {
            XmlWriterSettings ws = new XmlWriterSettings();

            ws.NewLineHandling = NewLineHandling.Entitize;
            XmlSerializer serializer = new XmlSerializer(typeof(RbcpyGlobalSettings));

            using (XmlWriter wr = XmlWriter.Create(sFilename, ws))
            {
                serializer.Serialize(wr, config);
            }
        }
        private void mnuWinMergePath_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.DefaultExt = ".exe";
            dialog.Filter     = "Exe files (*.exe)|*.exe";
            dialog.Title      = "Please point to WinMerge";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.m_globalSettings.m_winMergeDir = dialog.FileName;
                RbcpyGlobalSettings.Serialize(this.m_globalSettings, "configs/globalconfig.xml");
            }
        }
        public FormSyncMain()
        {
            InitializeComponent();
            m_mapTextItems = new Dictionary <string, TextBox> {
                { "m_src", this.txtSrc },
                { "m_destination", this.txtDest },
                { "m_excludeDirs", this.txtExcludeDirs },
                { "m_excludeFiles", this.txtExcludeFiles },
                { "m_copyFlags", this.txtCopyFlags },
                { "m_directoryCopyFlags", this.txtDirCopyFlags },
                { "m_ipg", this.txtIpg },
                { "m_nRetries", this.txtnRetries },
                { "m_waitBetweenRetries", this.txtnWaitBetweenRetries },
                { "m_nThreads", this.txtnThreads },
                { "m_custom", this.txtCustom },
            };

            m_mapCheckItems = new Dictionary <string, CheckBox> {
                { "m_mirror", this.chkMirror },
                { "m_copySubDirsAndEmptySubdirs", this.chkCopySubdirs },
                { "m_symlinkNotTarget", this.chkSymlinkNotTarget },
                { "m_fatTimes", this.chkFatTimes },
                { "m_compensateDst", this.chkCompensateDST },
            };

            try
            {
                var directory = AppDomain.CurrentDomain.BaseDirectory.ToLowerInvariant();
                Directory.SetCurrentDirectory(directory);
                if (!Directory.Exists("configs"))
                {
                    Directory.CreateDirectory("configs");
                }

                if (File.Exists("configs/globalconfig.xml"))
                {
                    m_globalSettings = RbcpyGlobalSettings.Deserialize("configs/globalconfig.xml");
                }
            }
            catch
            {
                MessageBox.Show("Error loading. Please place in a writable directory.");
                m_globalSettings = new RbcpyGlobalSettings();
            }
        }
        private void mnuSetDeletedPath_Click(object sender, EventArgs e)
        {
            var prevDir  = this.m_globalSettings.m_directoryForDeletedFiles ?? "c:\\";
            var sNewName = InputBoxForm.GetStrInput("Please enter a directory where manually deleted files will be moved, or enter no text to disable this feature:", prevDir);

            if (string.IsNullOrEmpty(sNewName))
            {
                return;
            }
            else if (!Directory.Exists(sNewName))
            {
                MessageBox.Show("Directory does not exist");
                return;
            }
            else
            {
                this.m_globalSettings.m_directoryForDeletedFiles = sNewName;
                RbcpyGlobalSettings.Serialize(this.m_globalSettings, "configs/globalconfig.xml");
            }
        }