Exemplo n.º 1
0
 public TeamSpawn(Main game)
     : base(game)
 {
     config = Config.Read(savepath);
     config.Write(savepath);
     deadplayers = new Dictionary<int,int>(255);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Reads a configuration file from a given path
        /// </summary>
        /// <param name="path">string path</param>
        /// <returns>ConfigFile object</returns>
        public static Config Read(string path)
        {
            if (!File.Exists(path))
            {
                var c = new Config();
                c.Spawns.spawns = new List<Point>(4)
                {
                    new Point(-1, -1),
                    new Point(-1, -1),
                    new Point(-1, -1),
                    new Point(-1, -1)
                };
                c.Spawns.GroupIds = new Dictionary<string, int>();
                c.Spawns.forceSpawn = false;

                return c;
            }
            using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                return Read(fs);
            }
        }