Ejemplo n.º 1
0
 /// <summary>
 /// Add an extra permission for a command
 /// </summary>
 /// <param name="command">The command that the permission will be assigned to</param>
 /// <param name="name">The name of the permission</param>
 /// <param name="permission">Permission you want to be used</param>
 /// <param name="number">The number of the permission for the command</param>
 /// <param name="description">Description of the permission</param>
 public static bool Add(ICommand command, string name, byte permission, int number, string description)
 {
     byte o; int o1;
     if (command == null || String.IsNullOrWhiteSpace(name.Trim()) || !byte.TryParse(permission.ToString(), out o) || !int.TryParse(number.ToString(), out o1) || String.IsNullOrWhiteSpace(description)) { return false; }
     ExtraCommandPerm ecp = new ExtraCommandPerm();
     ecp.Command = command;
     ecp.Name = name;
     ecp.Permission = permission;
     ecp.Number = number;
     ecp.Description = description;
     extraperms.Add(ecp);
     return true;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Add an extra permission for a command
        /// </summary>
        /// <param name="command">The command that the permission will be assigned to</param>
        /// <param name="name">The name of the permission</param>
        /// <param name="permission">Permission you want to be used</param>
        /// <param name="number">The number of the permission for the command</param>
        /// <param name="description">Description of the permission</param>
        public static bool Add(ICommand command, string name, byte permission, int number, string description)
        {
            byte o; int o1;

            if (command == null || String.IsNullOrWhiteSpace(name.Trim()) || !byte.TryParse(permission.ToString(), out o) || !int.TryParse(number.ToString(), out o1) || String.IsNullOrWhiteSpace(description))
            {
                return(false);
            }
            ExtraCommandPerm ecp = new ExtraCommandPerm();

            ecp.Command     = command;
            ecp.Name        = name;
            ecp.Permission  = permission;
            ecp.Number      = number;
            ecp.Description = description;
            extraperms.Add(ecp);
            return(true);
        }