GetName() private méthode

private GetName ( [ color ) : string
color [
Résultat string
Exemple #1
0
        public XElement Serialize()
        {
            XElement rankTag = new XElement("Rank");

            rankTag.Add(new XAttribute("name", Name));
            rankTag.Add(new XAttribute("id", Id));
            string colorName = ChatColor.GetName(Color);

            if (colorName != null)
            {
                rankTag.Add(new XAttribute("color", colorName));
            }
            if (Prefix.Length > 0)
            {
                rankTag.Add(new XAttribute("prefix", Prefix));
            }
            rankTag.Add(new XAttribute("antiGriefBlocks", AntiGriefBlocks));
            rankTag.Add(new XAttribute("antiGriefSeconds", AntiGriefSeconds));
            if (DrawLimit > 0)
            {
                rankTag.Add(new XAttribute("drawLimit", DrawLimit));
            }
            if (IdleKickTimer > 0)
            {
                rankTag.Add(new XAttribute("idleKickAfter", IdleKickTimer));
            }
            if (HasReservedSlot)
            {
                rankTag.Add(new XAttribute("reserveSlot", true));
            }
            if (AllowSecurityCircumvention)
            {
                rankTag.Add(new XAttribute("allowSecurityCircumvention", true));
            }
            rankTag.Add(new XAttribute("copySlots", CopySlots));
            rankTag.Add(new XAttribute("fillLimit", FillLimit));

            for (int i = 0; i < PermissionNames.Length; i++)
            {
                if (Permissions[i])
                {
                    XElement temp = new XElement(PermissionNames[i]);

                    if (PermissionLimits[i] != null)
                    {
                        temp.Add(new XAttribute("max", GetLimit((Permission)i).FullName));
                    }
                    rankTag.Add(temp);
                }
            }
            return(rankTag);
        }
Exemple #2
0
        public ColorKeyAttribute(ConfigSection section, [NotNull] string defaultColor, [NotNull] string description)
            : base(section, typeof(string), ChatColor.White, description)
        {
            if (defaultColor == null)
            {
                throw new ArgumentNullException("defaultColor");
            }
            string defaultColorName = ChatColor.GetName(defaultColor);

            if (defaultColorName == null)
            {
                throw new ArgumentException("Default color must be a valid color name.");
            }
            DefaultValue = defaultColorName;
        }