Exemplo n.º 1
0
 public CommandData(Command command, string arguments, string commandMessage, PermissionsLevel permissions)
 {
     this.command        = command;
     this.arguments      = arguments;
     this.commandMessage = commandMessage;
     this.permissions    = permissions;
 }
Exemplo n.º 2
0
        public void TryExecute(string argsStr, PermissionsLevel permissions)
        {
            if (permissions < requiredPermissions)
            {
                throw new InvalidCommandExecutionException("You're not allowed to use this command");
            }

            if (requireEnabled && !Plugin.instance.enabled)
            {
                throw new InvalidCommandExecutionException("TwitchFX is currently disabled");
            }

            if (requireInLevel && !Plugin.instance.inLevel)
            {
                throw new InvalidCommandExecutionException("Please use this command during a song");
            }

            string[] args = argsStr.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            int length = args.Length;

            if (argsCount != -1 && length != argsCount || minArgsCount != -1 && length < minArgsCount || maxArgsCount != -1 && length > maxArgsCount)
            {
                throw CreateInvalidArgs();
            }

            Execute(args);
        }
Exemplo n.º 3
0
 public Student(string idNumber, string firstName, string lastName, string password, Guid classId, string address,
                PermissionsLevel permissions = PermissionsLevel.Watch, StudentBehavior behavior = StudentBehavior.Good) : base(idNumber, firstName, lastName, password, address, permissions)
 {
     Lessons  = new List <Lesson>();
     ClassId  = classId;
     Behavior = behavior;
 }
Exemplo n.º 4
0
 protected User(UserViewModel userViewModel, PermissionsLevel permissions)
 {
     IdNumber         = userViewModel.IdNumber;
     FirstName        = userViewModel.FirstName;
     LastName         = userViewModel.LastName;
     Password         = userViewModel.Password;
     Address          = userViewModel.Address;
     permissionsLevel = permissions;
 }
Exemplo n.º 5
0
 protected User(string idNumber, string firstName, string lastName, string password, string address, PermissionsLevel permissions)
 {
     IdNumber         = idNumber;
     FirstName        = firstName;
     LastName         = lastName;
     Password         = password;
     Address          = address;
     permissionsLevel = permissions;
 }
Exemplo n.º 6
0
        protected Command()
        {
            string command = GetType().Name.Substring(7, GetType().Name.Length - 7).ToLower();

            if (!Plugin.config.commands.ContainsKey(command))
            {
                Plugin.config.commands[command] = command;
            }

            name = Plugin.config.commands[command];

            commands[name.ToLower()] = this;

            if (!Plugin.config.commandsRequiredPermissions.TryGetValue(command, out requiredPermissions))
            {
                Plugin.config.commandsRequiredPermissions[command] = requiredPermissions = PermissionsLevel.Everyone;
            }
        }