示例#1
0
        private static async Task BackupAsync(IEnumerable <string> args)
        {
            if (args.Any() && args.First() == "-h")
            {
                DisplayBackupHelp();
            }
            else
            {
                var command    = new BackupCommand();
                var parameters = command.ReadParameters(args);

                if (parameters.ConfigPath == null)
                {
                    throw new CosbakException("Switch 'c' not specified, i.e. path to configuration");
                }
                else
                {
                    var configuration = await LoadBackupConfigurationAsync(parameters.ConfigPath);

                    var metaController = new MetaController();

                    await metaController.BackupAsync(configuration, parameters.Mode);
                }
            }
        }
示例#2
0
 internal override void EvaluateViewState()
 {
     IsPhoneDisconnected  = PhoneNotifier.CurrentInterface == null;
     IsPhoneInMassStorage = PhoneNotifier.CurrentInterface == PhoneInterfaces.Lumia_MassStorage;
     IsPhoneInOtherMode   = !IsPhoneDisconnected && !IsPhoneInMassStorage;
     BackupCommand.RaiseCanExecuteChanged();
     BackupArchiveCommand.RaiseCanExecuteChanged();
     BackupArchiveProvisioningCommand.RaiseCanExecuteChanged();
 }
 public void TableBackupTest()
 {
     var backupCommand = new BackupCommand();
     var options = new TableCommandOptions
     {
         Mode = "backup",
         Source = DevelopmentStorage,
         Destination = BackupLocation,
         TableNamePrefix = "azTest"
     };
     backupCommand.Run(options);
 }
示例#4
0
        public void Backup(IEnumerable <string> items, Guid backupId)
        {
            var callback = OperationContext.Current.GetCallbackChannel <IBackupServiceCallback>();
            var backup   = new BackupCommand
            {
                SendBackupItem     = item => callback.SendBackupItem(item),
                SendWarningLog     = message => callback.SendWarningLog(message),
                SendBackupComplete = callback.SendBackupCompleted
            };

            backup.Initialize(files);

            backups.TryAdd(backupId, backup);
            backup.RunBackup(items);
        }
        public async void Execute_Works() {
                var connectionInfo = new DbConnectionInfo() {
                Uri = new Uri(BaseUri),
                Host = "",
                DatabaseName = "",
                UserName = "",
                Password = ""
            };
            var loginCommand = new LoginCommand(connectionInfo);

            var httpClient = new HttpClient();
            await loginCommand.Execute(httpClient);

            using (var fileStream = File.Create("c:\\backup\\12345.bak")) {
                var backupCommand = new BackupCommand(connectionInfo);

                await backupCommand.Execute(httpClient, fileStream);
            }
        }
        public async void Execute_Works()
        {
            var connectionInfo = new DbConnectionInfo()
            {
                Uri          = new Uri(BaseUri),
                Host         = "",
                DatabaseName = "",
                UserName     = "",
                Password     = ""
            };
            var loginCommand = new LoginCommand(connectionInfo);

            var httpClient = new HttpClient();
            await loginCommand.Execute(httpClient);

            using (var fileStream = File.Create("c:\\backup\\12345.bak")) {
                var backupCommand = new BackupCommand(connectionInfo);

                await backupCommand.Execute(httpClient, fileStream);
            }
        }
示例#7
0
        /// <summary>
        /// Handle a command from the CLI.
        /// Commands for the server manager are prefixed with the command-character.
        /// </summary>
        /// <param name="serverMessage">The command to parse.</param>
        public bool ParseCommand(EMMServerMessage serverMessage)
        {
            Command command;
            bool    executed = true;

            string[] args;

            if (serverMessage.Data.ContainsKey("command"))
            {
                args = serverMessage.Data["command"].Split(' ');
            }
            else
            {
                args = serverMessage.Message.Split(' ');
            }
            switch (args[0])
            {
            case ("start"):
                mMinecraft.StartServer();
                break;

            case ("restart"):
                mMinecraft.RestartServer(true);
                break;

            case ("restart now"):
                mMinecraft.StopServer(false);
                mMinecraft.StartServer();
                break;

            case ("stop"):
                mMinecraft.StopServer(true);
                break;

            case ("stop now"):
                mMinecraft.StopServer(false);
                break;

            case ("abort"):
                mMinecraft.AbortPendingOperations();
                break;

            case ("maps"):
                command = new MapsCommand();
                command.Execute(serverMessage);
                break;

            case ("backup"):
                command = new BackupCommand();
                command.Execute(serverMessage);
                break;

            case ("get"):
                command = new GetCommand();
                command.Execute(serverMessage);
                break;

            default:
                executed = false;
                break;
            }
            return(executed);
        }
 public MainWindowViewModel()
 {
     backupCommand = new BackupCommand(this);
     selectFolderCommand = new SelectFolderCommand(this);
 }