MCDawn.PlayerGroupList.Load C# (CSharp) Method

Load() public static method

public static Load ( string path, PlayerGroup groupName ) : PlayerGroupList
path string
groupName PlayerGroup
return PlayerGroupList
        public static PlayerGroupList Load(string path, PlayerGroup groupName)
        {
            if (!Directory.Exists("groups")) { Directory.CreateDirectory("groups"); }
            path = "groups/" + path;
            PlayerGroupList list = new PlayerGroupList();
            list.group = groupName;
            if (File.Exists(path))
            {
                foreach (string line in File.ReadAllLines(path)) { list.Add(line); }
            }
            else
            {
                File.Create(path).Close();
                Server.s.Log("CREATED NEW: " + path);
            } return list;
        }

Usage Example

Example #1
0
 public PlayerGroup(string Name, bool Public)
 {
     name     = Name;
     fileName = name;
     players  = PlayerGroupList.Load(fileName, this);
     pub      = Public;
     allPlayerGroups.Add(new PlayerGroup(name, pub));
 }