示例#1
0
        public UserCommand(string commandString, IDashSystem dashSystem)
        {
            CommandString = commandString;
            Argv          = commandString.Split(' ');
            DashSystem    = dashSystem;

            if (string.IsNullOrEmpty(commandString))
            {
                throw new ArgumentException("Empty command provided as argument");
            }

            switch (Argv.Length)
            {
            case 3: PurchaseAmount = ParseAmount(Argv[2]);
                goto case 2;

            case 2: Product = ParseProduct(Argv[1]);
                goto case 1;

            case 1: User = ParseUser(Argv[0]);
                break;
            }
        }
示例#2
0
        public DashSystemController(IDashSystemUI ui, IDashSystem dashSystem)
        {
            UI         = ui;
            DashSystem = dashSystem;

            ui.CommandEnteredEvent += OnCommandEntered;

            AdminCommands ac = new AdminCommands(UI, DashSystem);

            AdminCommandLookup = new Dictionary <string, Action <string[]> >
            {
                { ":q", ac.Quit },
                { ":quit", ac.Quit },
                { ":activate", ac.Activate },
                { ":deactivate", ac.Deactivate },
                { ":crediton", ac.CreditOn },
                { ":creditoff", ac.CreditOff },
                { ":addcredits", ac.AddCredits },
                { ":debug", ac.SetDebug },
                { ":critical", ac.GetUsersWithCriticalBalance },
                { ":getuser", ac.GetUserByUsername }
            };
        }
示例#3
0
 public DashSystemCLI(IDashSystem dashSystem)
 {
     DashSystem = dashSystem;
     DashSystem.UserBalanceWarning += DisplayUserBalanceWarning;
 }
 public AdminCommands(IDashSystemUI ui, IDashSystem dashSystem)
 {
     UI         = ui;
     DashSystem = dashSystem;
 }