CNCMaps.FileFormats.Map.MapFile.ReadStructures C# (CSharp) Method

ReadStructures() private method

Reads the structures.
private ReadStructures ( ) : void
return void
        private void ReadStructures()
        {
            IniSection structsSection = GetSection("Structures");
            if (structsSection == null) {
                Logger.Info("Structures section unavailable in {0}", Path.GetFileName(FileName));
                return;
            }
            foreach (var v in structsSection.OrderedEntries) {
                try {
                    string[] entries = ((string)v.Value).Split(',');
                    if (entries.Length <= 15) continue;
                    string owner = entries[0];
                    string name = entries[1];
                    short health = short.Parse(entries[2]);
                    int rx = int.Parse(entries[3]);
                    int ry = int.Parse(entries[4]);
                    short direction = short.Parse(entries[5]);
                    var s = new Structure(owner, name, health, direction);
                    s.Upgrade1 = entries[12];
                    s.Upgrade2 = entries[13];
                    s.Upgrade3 = entries[14];
                    s.Tile = Tiles.GetTileR(rx, ry);

                    if (s.Tile != null)
                        Structures.Add(s);
                }
                catch (IndexOutOfRangeException) {
                } // catch invalid entries
                catch (FormatException) {
                }
            }
            Logger.Trace("Read {0} structures", Structures.Count);
        }