示例#1
0
        private void archive_Click(object sender, EventArgs e)
        {
            try
            {
                Origin myOrigins = new Origin();
                Exclusion myExclusions = new Exclusion();

                ArchiverChooser chooser = new ArchiverChooser(myOrigins, myExclusions);

                ArchiverConfiguration config = new ArchiverConfiguration();
                Archiver myArchiver = new Archiver(config);

                myArchiver.Archive(chooser.GetProcessedFileSystemInfos());

                myArchiver.CleanOldDirectories();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            bool _logAtctive = false;
            bool _waitKeyPress = false;

            // Interperto as opcoes de rotina
            GetVariables(args, ref _logAtctive, ref _waitKeyPress);

            try
            {
                // Carrego as origens e exclusoes
                Origin myOrigins = new Origin();
                Exclusion myExclusions = new Exclusion();

                // Carrego a classe responsavel por fazer a escolha de arquivos
                ArchiverChooser chooser = new ArchiverChooser(myOrigins, myExclusions);

                // Carrego a configuracao basica de diretorios
                ArchiverConfiguration config = new ArchiverConfiguration();

                // Carrego a classe responsavel pelo arquivamento.
                Archiver myArchiver = new Archiver(config);

                // Arquivo os itens selecionados
                myArchiver.Archive(chooser.GetProcessedFileSystemInfos());

                // Limpo diretorios antigos
                myArchiver.CleanOldDirectories();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                if (_logAtctive)
                { System.IO.File.WriteAllText("Log_" + DateTime.Now.ToString("yyyy-MM-dd_hhmmss") + ".txt", ex.Message); }
            }

            if (_waitKeyPress)
            { Console.ReadKey(); }
        }