Ejemplo n.º 1
0
        private void button_ChangeUserDef_DoWork_Click(object sender, RoutedEventArgs e)
        {
            this.buttonChangeUserDef_DoWork.IsEnabled = false;

            this.m_strDirectoryFrom_UserInput = this.textBox_DirectoryFrom.Text;
            this.m_strDirectoryTo_UserInput   = this.textBox_DirectoryTo.Text;
            this.m_strFindWhat_UserInput      = this.textBox_FindWhat.Text;    //"10.2.0";
            this.m_strReplaceWith_UserInput   = this.textBox_ReplaceWith.Text; //"11.2.0";
            this.m_strFileExtenion_UserInput  = this.textBox_FileExten.Text;
            //this.m_bProcessSubDir_UserInput

            /*
             * //TODO lsl -- test
             * this.m_strDirectoryFrom_UserInput = "C:\\work_changelongtype\\WPFToolChangeUserDefType\\pathsrc";
             * this.m_strDirectoryTo_UserInput = "C:\\work_changelongtype\\WPFToolChangeUserDefType\\pathdest";
             * this.m_strFindWhat_UserInput = "1.1.0";
             * this.m_strReplaceWith_UserInput = "1.1.5";
             * this.m_strFileExtenion_UserInput = ".vcproj";
             * //this.m_strFileExtenion_UserInput = "";
             * this.m_bProcessSubDir_UserInput = true;
             * //this.m_bProcessSubDir_UserInput = false;
             */


            //check params
            if (this.m_strDirectoryFrom_UserInput.Length <= 0)
            {
                log4net.LogManager.GetLogger("ExeLogger").Info(System.String.Format("DataSrcPath error!"));
                //MessageBox.Show("DataSrcPath error!");
                this.buttonChangeUserDef_DoWork.IsEnabled = true;
                return;
            }

            if (this.m_strDirectoryTo_UserInput.Length <= 0)
            {
                log4net.LogManager.GetLogger("ExeLogger").Info(System.String.Format("DataDestPath use default value ./DataDest"));
                //MessageBox.Show("DataDestPath use default value ./DataDest");
                this.m_strDirectoryTo_UserInput = "./DataDest";;
            }
            System.String strLogFormat = System.String.Format("m_strDataSrcPath={0} m_strDataDestPath={1} m_strSrc={2} m_strDest={3}",
                                                              this.m_strDirectoryFrom_UserInput,
                                                              this.m_strDirectoryTo_UserInput,
                                                              this.m_strFindWhat_UserInput,
                                                              this.m_strReplaceWith_UserInput);
            log4net.LogManager.GetLogger("ExeLogger").Info(strLogFormat);

            m_pDataChangeUserDefType.resetDirectoryValue(
                this.m_strDirectoryFrom_UserInput,
                this.m_strDirectoryTo_UserInput,
                this.m_strFindWhat_UserInput,
                this.m_strReplaceWith_UserInput,
                this.m_strFileExtenion_UserInput,
                this.m_bProcessSubDir_UserInput);

            this.m_pBackgroundWorker.RunWorkerAsync();//functon_BackgroundWorker_DoWork

            //_DoWork_BackgroundWorker_DoWork();
        }//button_DoWork_Click
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private void _InitializeData()
        {
            this.m_strDirectoryFrom_UserInput = "./DataSrc";
            this.m_strDirectoryTo_UserInput   = "./DataDest";
            this.m_strFindWhat_UserInput      = "10.2.0";
            this.m_strReplaceWith_UserInput   = "11.2.0";
            this.m_strFileExtenion_UserInput  = "";
            this.m_bProcessSubDir_UserInput   = true;

            m_pDataChangeUserDefType = new DataChangeUserDefType();
            m_pDataChangeUserDefType.resetDirectoryValue(
                this.m_strDirectoryFrom_UserInput,
                this.m_strDirectoryTo_UserInput,
                this.m_strFindWhat_UserInput,
                this.m_strReplaceWith_UserInput,
                this.m_strFileExtenion_UserInput,
                this.m_bProcessSubDir_UserInput);
            this.m_pBackgroundWorker = new System.ComponentModel.BackgroundWorker();

            m_pDirectoryOper             = new DirectoryOper();
            m_pFileOperChangeUserDefType = new FileOperChangeUserDefType();
        }//InitializeData