コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            Application.DoEvents();

            m_progressDlg             = new BRProgressDlg();
            m_progressDlg.lblMsg.Text = Properties.Resources.kstidReadingBackupFileMsg;
            m_progressDlg.CenterInParent(this);
            m_progressDlg.Show();
            Application.DoEvents();

            UnpackToTempFolder();

            if (m_origPaths.Count == 0 || string.IsNullOrEmpty(m_papPath) || !File.Exists(m_papPath))
            {
                m_progressDlg.Close();
                m_progressDlg.Dispose();
                m_progressDlg = null;
                Hide();

                MessageBox.Show(this, Properties.Resources.kstidNoPrjInZipFileMsg,
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                Close();
                return;
            }

            GetDataSourcePathsFromPap();
            lblProject.Text = string.Format(m_fmtProjMsg, m_prjName);

            m_progressDlg.Hide();
            m_progressDlg.prgressBar.Value = 0;
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void btnBkup_Click(object sender, EventArgs e)
        {
            // I'm not sure what I was doing with all these changes. This version of the click
            // event is very different from version 1.0.0 of the release version of this DLL.
            // Apparently, I started working on some changes and stopped before they were
            // finished, and upon returning to the code, I don't recall what I was doing. I
            // will have to get into the code later to see if I can figure it all out.

            m_progressDlg                    = new BRProgressDlg();
            m_progressDlg.lblMsg.Text        = string.Empty;
            m_progressDlg.prgressBar.Maximum = m_prjFiles.Count + m_dsFiles.Count;
            m_progressDlg.CenterInParent(this);
            m_progressDlg.Show();
            Hide();
            Application.DoEvents();
            //RestoreProjectFiles();
            //RestoreDataSources();
            //m_progressDlg.prgressBar.Value = m_progressDlg.prgressBar.Maximum;
            //ModifyDataSourcePathsInRestoredProject();
            m_progressDlg.Hide();
            //LoadRestoredProject();


            if (!chkIncludeDataSources.Checked)
            {
                m_dsFiles.Clear();
            }

            m_dsFiles.Add(STUtils.GetLocalPath(DataUtils.IPACharCache.CacheFileName, true));

            string normalizationExceptionFile = ReflectionHelper.GetField(
                typeof(FFNormalizer), "kstidNormalizationExceptionsFile") as string;

            if (!string.IsNullOrEmpty(normalizationExceptionFile))
            {
                m_dsFiles.Add(Path.Combine(Application.StartupPath, normalizationExceptionFile));
            }

            lblInfo.Visible = false;
            chkIncludeDataSources.Visible = false;
            btnBkup.Visible   = false;
            btnCancel.Enabled = false;

            lblProgress.Text    = string.Empty;
            lblProgress.Visible = true;
            //prgBar.Maximum = m_prjFiles.Count + m_dsFiles.Count;
            //prgBar.Visible = true;

            ZipFile zip = ZipFile.Create(m_backupFile);

            BackupFileList(zip, m_prjFiles);
            BackupFileList(zip, m_dsFiles);
            prgBar.Value = m_prjFiles.Count + m_dsFiles.Count;
            Application.DoEvents();
            zip.Close();

            btnCancel.Enabled = true;
            btnCancel.Text    = Properties.Resources.kstidCloseButtonText;
            //prgBar.Visible = false;
            //lblProgress.Visible = false;
            //lblInfo.Text = Properties.Resources.kstidBackupCompleteMsg;
            //lblInfo.Visible = true;
        }