コード例 #1
0
        // ATTENTION: Use ConsoleWriter instead of Console.WriteLine to use Colors

        /// <summary>
        /// Starts the backup program initiating all required actions like profile choosing, parsing and running
        /// the backup.
        /// </summary>
        /// <param name="args">unused command line arguments</param>
        static void Main(string[] args)
        {
            // change to English for testing
            //Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en");

            try
            {
                // init profile selector (might throw BackupException if "../backup_profiles" does not exist)
                BackupProfileSelector profileSelector = new BackupProfileSelector();
                profileSelector.InitProfilePaths();

                // create necessary instances
                BackupProfileConverter profileConverter = new BackupProfileConverter();
                ExcludeUtil            excludeUtil      = new ExcludeUtil();

                // execute main loop (might forward BackupException if the backup cannot be processed)
                Start starter = new Start();
                starter.DoMainLoop(profileSelector, profileConverter, excludeUtil);
            }
            catch (BackupException e)
            {
                // all BackupExceptions are forwarded here to provide a single exit point when an error occurs
                ExitUtil.ExitAfterError(e);
            }

            // backup was successful or regularly cancelled by user, so exit the application in the default way
            ExitUtil.ExitWithoutError();
        }