コード例 #1
0
ファイル: UserCommand.cs プロジェクト: Davudi2134/Karuta
 public UserCommand() : base("user", "Allows you to change the username.")
 {
     RegisterOption('s', s =>
     {
         Karuta.Say("Setting username to:" + s);
         Karuta.USER = s;
     });
 }
コード例 #2
0
        public override void Run(string[] args)
        {
            if (args.Length == 1)
            {
                Karuta.Say("The current username is: " + Karuta.user);
                return;
            }
            if (args.Length < 3)
            {
                Karuta.Write("Not enough parameters");
                Karuta.Write(usageMessage);
                return;
            }
            string user = GetValueOfOption(args, 's');

            if (user == null)
            {
                Karuta.Write("Username must be specified");
                Karuta.Write(usageMessage);
                return;
            }
            Karuta.Say("Setting username to: " + user);
            Karuta.user = user;
        }