Esempio n. 1
0
        private static bool ClearFolder(BackgroundWorker backgroundWorker)
        {
            try
            {
                FileMg.DirectoryDelete(FileMg.AutoTmtOutputFileDir, true);
                FileMg.DeleteTmtCacheFile(FileMg.AutoTmtDataFileDir);
            }
            catch
            { }

            if (Configures.GetAutoIsDeleteExistingFile())
            {
                OutputMg.OutputHeader1(backgroundWorker, "Step 0", "Clear output folder");
                OutputMg.OutputContent(backgroundWorker, "Start to clear");
                try
                {
                    FileMg.ClearAutoFolder();
                    FileMg.InitDataFolder();
                }
                catch
                {
                    OutputMg.OutputHeader1(backgroundWorker, "Failed", "Clear folder failed. Please try to run this tool as Administrator.");
                    return(false);
                }

                OutputMg.OutputContent(backgroundWorker, "Finished clearing");
            }

            return(true);
        }
Esempio n. 2
0
        private void CopyFile_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                FileMg.DirectoryDelete(FileMg.AutoTmtOutputFileDir, true);
                FileMg.DeleteTmtCacheFile(FileMg.AutoTmtDataFileDir);
            }
            catch
            { }

            if (cbIsDelDestFile.Checked)
            {
                FileMg.ClearAutoFolder();
                FileMg.InitDataFolder();
            }

            e.Result = FileMg.DirectoryCopy(tbRawFileFolder.Text, FileMg.AutoSourceFileDir, true, false, backgroundWorker);
        }