Example #1
0
        public static void InitAll()
        {
            allPlayerGroups = new List <PlayerGroup>();

            if (File.Exists("properties/groups.properties"))
            {
                string[] lines = File.ReadAllLines("properties/groups.properties");

                PlayerGroup thisGroup = new PlayerGroup();
                //int gots = 0;

                foreach (string s in lines)
                {
                    try
                    {
                        if (s != "" && s[0] != '#')
                        {
                            if (s.Split('=').Length == 2)
                            {
                                string property = s.Split('=')[0].Trim();
                                string value    = s.Split('-')[1].Trim();
                                allPlayerGroups.Add(new PlayerGroup(thisGroup.name, thisGroup.pub));
                            }
                            else
                            {
                                Server.s.Log("The property file groups.properties is wrongly formatted."); return;
                            }
                        }
                    }
                    catch { }
                }
            }

            List <PlayerGroup> pgs = new List <PlayerGroup>(); int count = 0;

            foreach (Player pl in Player.players)
            {
                foreach (PlayerGroup pg in pl.playerGroup)
                {
                    if (pg != null)
                    {
                        count++;
                        pgs.Add(pg);
                        pl.playerGroup[count] = allPlayerGroups.Find(g => g.name.ToLower() == pl.playerGroup[count].name.ToLower());
                    }
                }
            }

            saveGroups(allPlayerGroups);
        }
Example #2
0
        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);
        }
Example #3
0
        public static void InitAll()
        {
            allPlayerGroups = new List<PlayerGroup>();

            if (File.Exists("properties/groups.properties"))
            {
                string[] lines = File.ReadAllLines("properties/groups.properties");

                PlayerGroup thisGroup = new PlayerGroup();
                //int gots = 0;

                foreach (string s in lines)
                {
                    try
                    {
                        if (s != "" && s[0] != '#')
                        {
                            if (s.Split('=').Length == 2)
                            {
                                string property = s.Split('=')[0].Trim();
                                string value = s.Split('-')[1].Trim();
                                allPlayerGroups.Add(new PlayerGroup(thisGroup.name, thisGroup.pub));
                            }
                            else { Server.s.Log("The property file groups.properties is wrongly formatted."); return; }
                        }
                    }
                    catch { }
                }
            }

            List<PlayerGroup> pgs = new List<PlayerGroup>(); int count = 0;
            foreach (Player pl in Player.players)
            {
                foreach (PlayerGroup pg in pl.playerGroup)
                {
                    if (pg != null)
                    {
                        count++;
                        pgs.Add(pg);
                        pl.playerGroup[count] = allPlayerGroups.Find(g => g.name.ToLower() == pl.playerGroup[count].name.ToLower());
                    }
                }
            }

            saveGroups(allPlayerGroups);
        }
Example #4
0
 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;
 }