Example #1
0
        private void btn_run_Click(object sender, EventArgs e)
        {
            str_path = this.tb_path.Text;
            l_fileList.Clear();

            if (Directory.Exists(str_path))
            {
                ClassLib_RML.GetFilesListOfFolder(str_path, b_subF, l_fileList);
                if (l_fileList.Count > 0)
                {
                    this.panel_set.Enabled    = false;
                    this.btn_run.Enabled      = false;
                    this.timer_Change.Enabled = true;
                }
                else
                {
                    MessageBox.Show("No file exists in the path:\r\n" + str_path, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.tb_path.Text = "";
                }
            }
            else
            {
                MessageBox.Show("The path does not exist.\r\n" + str_path, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.tb_path.Text = "";
            }
        }
Example #2
0
        private void timer_listFiles_Tick(object sender, EventArgs e)
        {
            this.timer_listFiles.Enabled = false;
            addMsgToLab(this.lab_msg, "Filtering files......", Color.Blue);
            List <FileInfo> l_tmp = new List <FileInfo>();

            ClassLib_RML.GetFilesListOfFolder(str_FilePath, b_subFolder, l_tmp);
            foreach (FileInfo fInfo in l_tmp)
            {
                if (Regex.IsMatch(fInfo.Extension, @"(?i)^\.xml$"))
                {
                    l_fileList.Add(fInfo);
                }
            }

            if (l_fileList.Count < 1)
            {
                MessageBox.Show("No file need to check!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                addMsgToLab(this.lab_msg, "No XML type files found.", Color.Black);
                this.panel_setting.Enabled = true;
                this.tb_filePath.Text      = "";
            }
            else
            {
                addMsgToLab(this.lab_msg, "Please wait! Checking files......", Color.Blue);
                this.timer_check.Enabled = true;
            }
        }
        private void timer_listFiles_Tick(object sender, EventArgs e)
        {
            this.timer_listFiles.Enabled = false;
            List <FileInfo> l_tmp = new List <FileInfo>();

            ClassLib_RML.GetFilesListOfFolder(str_filePath, b_subfolder, l_tmp);
            foreach (FileInfo fInfo in l_tmp)
            {
                if (Regex.IsMatch(fInfo.Extension, @"(?i)^\.xml$"))
                {
                    l_fileList.Add(fInfo);
                }
            }
            proBar_step.Value++;
            if (l_fileList.Count < 1)
            {
                MessageBox.Show("No XML type files found!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.panel_set.Enabled = true;
                this.tb_filepath.Text  = "";
                this.panel_progress.Controls.Clear();
            }
            else
            {
                this.timer_check.Enabled = true;
                proBar_step.Value++;
            }
        }
Example #4
0
        private void timer_listFiles_Tick(object sender, EventArgs e)
        {
            this.timer_listFiles.Enabled = false;
            List <FileInfo> l_files     = new List <FileInfo>();
            ArrayList       al_fileType = new ArrayList();

            al_fileType = ClassLib_RML.SplitString(str_fileType, ";");
            ClassLib_RML.GetFilesListOfFolder(str_path, true, l_files);

            foreach (FileInfo finfo in l_files)
            {
                for (int index = 0; index < al_fileType.Count; index++)
                {
                    if (finfo.Extension == "." + al_fileType[index])
                    {
                        lfi_fileList.Add(finfo);
                    }
                }
            }

            if (lfi_fileList.Count > 0)
            {
                this.timer_move.Enabled = true;
            }
            else
            {
                MessageBox.Show("Can not find file to move!\r\nPlease check your file type setting.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 private void timer_listFile_Tick(object sender, EventArgs e)
 {
     this.timer_listFile.Enabled = false;
     Form_Main.AddTextToListbox(this.lb_info, "Getting files list......");
     ClassLib_RML.GetFilesListOfFolder(str_filepath, b_subfolder, l_listfiles);
     if (l_listfiles.Count > 0)
     {
         this.timer_remove.Enabled = true;
     }
     else
     {
         MessageBox.Show("No file found!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         Form_Main.AddTextToListbox(this.lb_info, "Can not find any file in the path: " + str_filepath);
         this.grpBox_settings.Enabled = true;
         this.tb_filepath.Text        = "";
     }
 }
Example #6
0
        private void timer_listfiles_Tick(object sender, EventArgs e)
        {
            this.timer_listfiles.Enabled = false;
            addLabInfo(this.lab_info, "Getting files list......", Color.White);
            String          str_tmppath = "";
            List <FileInfo> l_tmplist   = new List <FileInfo>();

            str_tmppath = Path.Combine(str_filepath, "programassets");
            if (Directory.Exists(str_tmppath))
            {
                ClassLib_RML.GetFilesListOfFolder(str_tmppath, true, l_tmplist);
            }

            str_tmppath = "";
            str_tmppath = Path.Combine(str_filepath, "seed");
            if (Directory.Exists(str_tmppath))
            {
                ClassLib_RML.GetFilesListOfFolder(str_tmppath, true, l_tmplist);
            }

            addLabInfo(this.lab_info, "Filtering files......", Color.White);
            foreach (FileInfo finfo in l_tmplist)
            {
                for (int idx = 0; idx < al_filetype.Count; idx++)
                {
                    if (finfo.Extension == "." + al_filetype[idx])
                    {
                        l_filelist.Add(finfo);
                    }
                }
            }

            if (l_filelist.Count > 0)
            {
                this.timer_check.Enabled = true;
            }
            else
            {
                MessageBox.Show("Can not find the file need to check.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.grpBox_settings.Enabled = true;
                this.tb_filePath.Text        = "";
                addLabInfo(this.lab_info, "Failed operation.", Color.Red);
            }
        }
Example #7
0
        private void btn_run_Click(object sender, EventArgs e)
        {
            int    int_moveCount  = 0;
            int    int_stillCount = 0;
            String str_basePath   = this.tb_basePath.Text;

            if (Directory.Exists(str_basePath))
            {
                List <FileInfo> l_fi = new List <FileInfo>();
                ClassLib_RML.GetFilesListOfFolder(str_basePath, true, l_fi);
                if (l_fi.Count > 0)
                {
                    ProgressBar pb_move = new ProgressBar();
                    this.panel_Progress.Controls.Add(pb_move);
                    pb_move.Dock    = DockStyle.Fill;
                    pb_move.Value   = 0;
                    pb_move.Minimum = 0;
                    pb_move.Maximum = l_fi.Count;

                    this.grpBox_settings.Enabled = false;
                    this.btn_run.Enabled         = false;
                    foreach (FileInfo fInfo in l_fi)
                    {
                        for (int idx = 0; idx < al_Bundles.Count; idx++)
                        {
                            String str_bundleName = al_Bundles[idx].ToString();
                            String str_folderName = al_Folders[idx].ToString();
                            if (fInfo.Name == str_bundleName)
                            {
                                if (str_folderName != "N/A")
                                {
                                    String str_newPath = Path.Combine(fInfo.DirectoryName, str_folderName);
                                    str_newPath = Path.Combine(str_newPath, "ForTrans");
                                    if (!Directory.Exists(str_newPath))
                                    {
                                        Directory.CreateDirectory(str_newPath);
                                    }

                                    str_newPath = Path.Combine(str_newPath, fInfo.Name);
                                    if (File.Exists(str_newPath))
                                    {
                                        File.Delete(str_newPath);
                                    }

                                    fInfo.MoveTo(str_newPath);
                                    int_moveCount++;
                                    break;
                                }
                            }
                        }
                        pb_move.Value += 1;
                    }
                    int_stillCount = l_fi.Count - int_moveCount;
                    MessageBox.Show("Total Count: " + l_fi.Count.ToString() + "\r\nMoved Count: " + int_moveCount.ToString() + "\r\nNot Moved Count: " + int_stillCount.ToString(), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.grpBox_settings.Enabled = true;
                    this.panel_Progress.Controls.Clear();
                }
                else
                {
                    MessageBox.Show("Can not find files in the Base Path!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("Can not find the path:\r\n" + str_basePath, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }