コード例 #1
0
ファイル: Program.cs プロジェクト: yarivat/Admin
        static void Backup(BackupArgs backupArgs)
        {
            try
            {
                Backup backup = new Backup();

                backup.StorageCred = new StorageCred()
                {
                    Name = backupArgs.StorageName, Key = backupArgs.StorageKey
                };
                backup.BackupStorageCred = new StorageCred()
                {
                    Name = backupArgs.BackupStorageName, Key = backupArgs.BackupStorageKey
                };
                backup.Copies = backupArgs.Copies;

                backup.BackupStarted          += backup_BackupStarted;
                backup.BackupContainerStarted += backup_BackupContainerStarted;
                backup.BackupContainerEnded   += backup_BackupContainerEnded;
                backup.BackupEnded            += backup_BackupEnded;
                backup.All();
            }
            catch (Exception exception)
            {
                Send(backupArgs.Emails, "Backup Ended with unhandled exception: {0}", Environment.NewLine + Environment.NewLine + exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace);
            }
            finally
            {
                Application.Exit();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: yarivat/Admin
        static void Backup(string[] args)
        {
            try
            {
                backupArgs = GetBackupArgs(args);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }

            try
            {
                Backup(backupArgs);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
コード例 #3
0
        public override ProcessorArgs ToProcessorArgs()
        {
            var backupArgs = new BackupArgs(this.Instance, FileSystem.FileSystem.Local.Path.EscapePath(this.BackupName, "."), this.Files, this.Databases, this.ExcludeClient, this.MongoDatabases);

            return(backupArgs);
        }
コード例 #4
0
        public override ProcessorArgs ToProcessorArgs()
        {
            var backupArgs = new BackupArgs(Instance, ProfileManager.GetConnectionString(), PathUtils.EscapePath(BackupName.Trim(), "."), _Files, _Databases, _ExcludeClient, _MongoDatabases);

            return(backupArgs);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: yarivat/Admin
        private static BackupArgs GetBackupArgs(string[] args)
        {
            BackupArgs backupArgs = new BackupArgs();

            backupArgs.WriteToConsole    = true;
            backupArgs.StorageName       = args[1];
            backupArgs.StorageKey        = args[2];
            backupArgs.BackupStorageName = args[3];
            backupArgs.BackupStorageKey  = args[4];
            if (args.Length > 5)
            {
                backupArgs.Copies = Convert.ToInt32(args[5]);
            }
            else
            {
                backupArgs.Copies = 14;
            }
            if (args.Length > 6)
            {
                backupArgs.SendEmailOnSuccess = Convert.ToBoolean(args[6]);
            }
            else
            {
                backupArgs.SendEmailOnSuccess = true;
            }
            if (args.Length > 7)
            {
                backupArgs.SendEmailOnFailure = Convert.ToBoolean(args[7]);
            }
            else
            {
                backupArgs.SendEmailOnFailure = true;
            }
            if (args.Length > 8)
            {
                backupArgs.Emails = Convert.ToString(args[8]).Split('|');
            }
            else
            {
                backupArgs.Emails = new string[2] {
                    "*****@*****.**", "*****@*****.**"
                }
            };
            if (args.Length > 9)
            {
                backupArgs.SmtpHost = args[9];
            }
            else
            {
                backupArgs.SmtpHost = "smtp.mandrillapp.com";
            }
            if (args.Length > 10)
            {
                backupArgs.SmtpUsername = args[10];
            }
            else
            {
                backupArgs.SmtpUsername = "******";
            }
            if (args.Length > 11)
            {
                backupArgs.SmtpPassword = args[11];
            }
            else
            {
                backupArgs.SmtpPassword = "******";
            }
            if (args.Length > 12)
            {
                backupArgs.SmtpPort = Convert.ToInt32(args[12]);
            }
            else
            {
                backupArgs.SmtpPort = 587;
            }
            if (args.Length > 13)
            {
                backupArgs.SmtpFrom = args[13];
            }
            else
            {
                backupArgs.SmtpFrom = "*****@*****.**";
            }

            return(backupArgs);
        }