private static void List(BackupJobContext context, string[] args)
        {
            var function = new ListFunction(context);

            if (args != null && args.Length > 0)
            {
                if (args[0].Equals("help", StringComparison.CurrentCultureIgnoreCase))
                {
                    function.Help();
                }
            }
            else
            {
                function.Execute();
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Database.SetInitializer<BackupJobContext>(new DropCreateDatabaseIfModelChanges<BackupJobContext>());

            using (var context = new BackupJobContext())
            {
                // Welcome the user
                Console.WriteLine(ConfigurationManager.AppSettings["WelcomeMessage"]);

                string userEntry = string.Empty;
                do
                {
                    // Await the user's command
                    userEntry = Console.ReadLine();

                    var splitEntry = userEntry.Split(' ');

                    // Command was given
                    if (splitEntry.Length > 0)
                    {
                        string command = splitEntry[0];
                        string[] arguments = null;

                        // Arguments were given
                        if (splitEntry.Length > 1)
                        {
                            arguments = splitEntry.GetRange(1, splitEntry.Length - 1);

                        }

                        BackupJobController.RunCommand(context, command, arguments);
                    }
                    
                } while (!userEntry.Equals("exit", StringComparison.OrdinalIgnoreCase));
            }
        }
        public static void RunCommand(BackupJobContext context, string command, string[] args)
        {
            switch (command.ToLower())
            {
                case "create":

                    break;
                case "list":
                    List(context, args);
                    break;

                case "select":

                    break;

                case "delete":

                    break;

                case "edit":

                    break;

                case "run":

                    break;

                case "help":
                    Help();
                    break;

                default:
                    Console.WriteLine("Command not found please try again, type help for a list of available commands");
                    break;
            }
        }
Beispiel #4
0
 public Function(string name, BackupJobContext context)
 {
     this.Name = name;
     this.Context = context;
 }
 public ListFunction(BackupJobContext context)
     : base("list", context)
 {
 }