MCLawl.Group.concatList C# (CSharp) Method

concatList() public static method

public static concatList ( bool includeColor = true, bool skipExtra = false, bool permissions = false ) : string
includeColor bool
skipExtra bool
permissions bool
return string
        public static string concatList(bool includeColor = true, bool skipExtra = false, bool permissions = false)
        {
            string returnString = "";
            foreach (Group grp in Group.GroupList)
            {
                if (!skipExtra || (grp.Permission > LevelPermission.Guest && grp.Permission < LevelPermission.Nobody))
                    if (includeColor) {
                        returnString += ", " + grp.color + grp.name + Server.DefaultColor;
                    } else if (permissions) {
                        returnString += ", " + ((int)grp.Permission).ToString();
                    } else
                        returnString += ", " + grp.name;
            }

            if (includeColor) returnString = returnString.Remove(returnString.Length - 2);

            return returnString.Remove(0, 2);
        }

Usage Example

Beispiel #1
0
 public static void Save(List <rankAllowance> givenList)
 {
     try
     {
         StreamWriter w = new StreamWriter(File.Create("properties/command.properties"));
         w.WriteLine("#Version 2");
         w.WriteLine("#   This file contains a reference to every command found in the server software");
         w.WriteLine("#   Use this file to specify which ranks get which commands");
         w.WriteLine("#   Current ranks: " + Group.concatList(false, false, true));
         w.WriteLine("#   Disallow and allow can be left empty, just make sure there's 2 spaces between the colons");
         w.WriteLine("#   This works entirely on permission values, not names. Do not enter a rank name. Use it's permission value");
         w.WriteLine("#   CommandName : LowestRank : Disallow : Allow");
         w.WriteLine("");
         foreach (rankAllowance aV in givenList)
         {
             w.WriteLine(aV.commandName + " : " + (int)aV.lowestRank + " : " + getInts(aV.disallow) + " : " + getInts(aV.allow));
         }
         w.Flush();
         w.Close();
     }
     catch
     {
         Server.s.Log("SAVE FAILED! command.properties");
     }
 }
All Usage Examples Of MCLawl.Group::concatList