예제 #1
0
        private async void RunBackupRestore(string backupFile)
        {
            List <string> restoreArguments = new List <string>();

            restoreArguments.Add(backupFile);

            var progressController = await HostWindow.ShowProgressAsync("Restoring Backup", $"Please wait while the backup is restored.");

            progressController.SetIndeterminate();

            //Start backup process
            var restoreProcess = new CommandLineAdbExecutor(Properties.Settings.Default.adbExecutablePath);

            var processController = restoreProcess.ExecuteCommand("restore", restoreArguments.ToArray());
            int exitCode          = await processController.WaitForCompletion();

            await progressController.CloseAsync();

            if (exitCode == 0)
            {
                await HostWindow.ShowMessageAsync("Success", "The operation completed successfully.");
            }
            else
            {
                await HostWindow.ShowMessageAsync("Error", $"The process exited with error code {exitCode}.");
            }
        }
예제 #2
0
        private async void RunApplicationBackup(bool apk, bool obb, string outputFile)
        {
            //Create arguments for backup
            List <string> backupArguments = new List <string>();

            if (apk)
            {
                backupArguments.Add("-apk");
            }
            else
            {
                backupArguments.Add("-noapk");
            }
            if (obb)
            {
                backupArguments.Add("-obb");
            }
            else
            {
                backupArguments.Add("-noobb");
            }
            backupArguments.Add("-f");
            backupArguments.Add(outputFile);
            backupArguments.Add(SelectedPackageId);

            var progressController = await HostWindow.ShowProgressAsync("Creating Backup", $"Please wait while {SelectedPackageId} is backed up.");

            progressController.SetIndeterminate();

            //Start backup process
            var backupProcess = new CommandLineAdbExecutor(Properties.Settings.Default.adbExecutablePath);

            var processController = backupProcess.ExecuteCommand("backup", backupArguments.ToArray());
            int exitCode          = await processController.WaitForCompletion();

            await progressController.CloseAsync();

            if (exitCode == 0)
            {
                await HostWindow.ShowMessageAsync("Success", "The operation completed successfully.");
            }
            else
            {
                await HostWindow.ShowMessageAsync("Error", $"The process exited with error code {exitCode}.");
            }
        }
예제 #3
0
        private async void RunRestore(object obj)
        {
            string restoreBackupPath = BackupLocation;

            if (string.IsNullOrWhiteSpace(restoreBackupPath))
            {
                restoreBackupPath = await HostViewWindow.ShowInputAsync("Select backup", "Enter the full file path to a backup to restore to your device");

                if (string.IsNullOrWhiteSpace(restoreBackupPath))
                {
                    await HostViewWindow.ShowMessageAsync("Invalid parameters", "The existing backup path is invalid.");

                    return;
                }
            }
            var dialogResult = await HostViewWindow.ShowMessageAsync("Confirm action", "You are about to begin a restore. Are you absolutely sure you want to proceed?", MessageDialogStyle.AffirmativeAndNegative);

            if (dialogResult == MessageDialogResult.Affirmative)
            {
                //Run restore operation
                var progressController = await HostViewWindow.ShowProgressAsync("Restoring Backup", "Please wait while the backup is being restored to your device.");

                progressController.SetIndeterminate();
                //Start restore process
                string[] restoreCommandArguments = { restoreBackupPath };
                var      backupProcess           = new CommandLineAdbExecutor(Properties.Settings.Default.adbExecutablePath);
                var      processController       = backupProcess.ExecuteCommand("restore", restoreCommandArguments);
                int      exitCode = await processController.WaitForCompletion();

                await progressController.CloseAsync();

                if (exitCode == 0)
                {
                    await HostViewWindow.ShowMessageAsync("Success", "The operation completed successfully.");
                }
                else
                {
                    await HostViewWindow.ShowMessageAsync("Error", $"The process exited with error code {exitCode}.");
                }
            }
        }
예제 #4
0
        private async void RunBackup(object obj)
        {
            if (string.IsNullOrWhiteSpace(BackupLocation))
            {
                await HostViewWindow.ShowMessageAsync("Invalid parameters", "The backup output path is invalid.");

                return;
            }
            var dialogResult = await HostViewWindow.ShowMessageAsync("Confirm action", "You are about to begin a backup. Are you sure you want to proceed?", MessageDialogStyle.AffirmativeAndNegative);

            if (dialogResult == MessageDialogResult.Affirmative)
            {
                //Create arguments for backup
                List <string> backupArguments = new List <string>();
                if (BackupIncludeApk)
                {
                    backupArguments.Add("-apk");
                }
                else
                {
                    backupArguments.Add("-noapk");
                }
                if (BackupIncludeShared)
                {
                    backupArguments.Add("-shared");
                }
                else
                {
                    backupArguments.Add("-noshared");
                }
                if (BackupIncludeSystem)
                {
                    backupArguments.Add("-system");
                }
                else
                {
                    backupArguments.Add("-nosystem");
                }
                backupArguments.Add("-all");
                backupArguments.Add("-f");
                backupArguments.Add(BackupLocation);
                //Run backup operation
                var progressController = await HostViewWindow.ShowProgressAsync("Creating Backup", "Please wait while your device is being backed up.");

                progressController.SetIndeterminate();
                //Start backup process
                var backupProcess     = new CommandLineAdbExecutor(Properties.Settings.Default.adbExecutablePath);
                var processController = backupProcess.ExecuteCommand("backup", backupArguments.ToArray());
                int exitCode          = await processController.WaitForCompletion();

                await progressController.CloseAsync();

                if (exitCode == 0)
                {
                    await HostViewWindow.ShowMessageAsync("Success", "The operation completed successfully.");
                }
                else
                {
                    await HostViewWindow.ShowMessageAsync("Error", $"The process exited with error code {exitCode}.");
                }
            }
        }