Esempio n. 1
0
        Main(
            string[] args
            )
        {
            const string usageToggleIncemental = "Usage: Backup toggle-incremental <hostMachine> <vmName>";
            const string usageCreateRecoverySnapshot = "Usage: Backup create-recovery-snapshot <hostMachine> <vmName>";
            const string usageListRecoverySnapshot = "Usage: Backup list-recovery-snapshot <hostMachine> <vmName>";

            try
            {
                BackupOperations backupOper = new BackupOperations();

                if (args == null || args.Length == 0)
                {
                    Console.WriteLine(usageToggleIncemental);
                    Console.WriteLine(usageCreateRecoverySnapshot);
                    Console.WriteLine(usageListRecoverySnapshot);
                }
                else if (args[0].Equals("toggle-incremental", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine(usageToggleIncemental);
                    }
                    else
                    {
                        backupOper.ToggleIncrementalBackup(args[1], args[2]);
                    }
                }
                else if (args[0].Equals("create-recovery-snapshot", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine(usageCreateRecoverySnapshot);
                    }
                    else
                    {
                        backupOper.CreateRecoverySnapshot(args[1], args[2]);
                    }
                }
                else if (args[0].Equals("list-recovery-snapshot", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine(usageListRecoverySnapshot);
                    }
                    else
                    {
                        backupOper.ListRecoverySnapshots(args[1], args[2]);
                    }
                }
                else
                {
                    Console.WriteLine("Incorrect option");
                }

                Console.WriteLine("Please press ENTER to exit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
        Main(
            string[] args
            )
        {
            const string usageToggleIncemental       = "Usage: Backup toggle-incremental <hostMachine> <vmName>";
            const string usageCreateRecoverySnapshot = "Usage: Backup create-recovery-snapshot <hostMachine> <vmName>";
            const string usageListRecoverySnapshot   = "Usage: Backup list-recovery-snapshot <hostMachine> <vmName>";

            try
            {
                BackupOperations backupOper = new BackupOperations();

                if (args == null || args.Length == 0)
                {
                    Console.WriteLine(usageToggleIncemental);
                    Console.WriteLine(usageCreateRecoverySnapshot);
                    Console.WriteLine(usageListRecoverySnapshot);
                }
                else if (args[0].Equals("toggle-incremental", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine(usageToggleIncemental);
                    }
                    else
                    {
                        backupOper.ToggleIncrementalBackup(args[1], args[2]);
                    }
                }
                else if (args[0].Equals("create-recovery-snapshot", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine(usageCreateRecoverySnapshot);
                    }
                    else
                    {
                        backupOper.CreateRecoverySnapshot(args[1], args[2]);
                    }
                }
                else if (args[0].Equals("list-recovery-snapshot", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine(usageListRecoverySnapshot);
                    }
                    else
                    {
                        backupOper.ListRecoverySnapshots(args[1], args[2]);
                    }
                }
                else
                {
                    Console.WriteLine("Incorrect option");
                }

                Console.WriteLine("Please press ENTER to exit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }