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

ReadUnits() private method

Reads the units.
private ReadUnits ( ) : void
return void
        private void ReadUnits()
        {
            IniSection unitsSection = GetSection("Units");
            if (unitsSection == null) {
                Logger.Info("Units section unavailable in {0}", Path.GetFileName(FileName));
                return;
            }
            foreach (var v in unitsSection.OrderedEntries) {
                try {
                    string[] entries = ((string)v.Value).Split(',');
                    if (entries.Length <= 11) 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]);
                    bool onBridge = entries[10] == "1";
                    var u = new Unit(owner, name, health, direction, onBridge);
                        u.Tile = Tiles.GetTileR(rx, ry);
                    if (u.Tile != null)
                        Units.Add(u);
                }
                catch (FormatException) {
                }
                catch (IndexOutOfRangeException) {
                }
            }
            Logger.Trace("Read {0} units", Units.Count);
        }