private void ReadSegmentDefinitions() { StreamReader s = new StreamReader(@"gfx/maps.zdx"); String t = ""; int n; int currentTex = 0; int curDef = -1; Rectangle tRect = new Rectangle(); String[] split; t = s.ReadLine(); while (!s.EndOfStream) { t = s.ReadLine(); if (t.StartsWith("#")) { if (t.StartsWith("#src")) { split = t.Split(' '); if (split.Length > 1) { n = Convert.ToInt32(split[1]); currentTex = n - 1; } } } else { curDef++; String name = t; t = s.ReadLine(); split = t.Split(' '); if (split.Length > 3) { tRect.X = Convert.ToInt32(split[0]); tRect.Y = Convert.ToInt32(split[1]); tRect.Width = Convert.ToInt32(split[2]) - tRect.X; tRect.Height = Convert.ToInt32(split[3]) - tRect.Y; } else { Console.WriteLine("read fail: " + name); } int tex = currentTex; t = s.ReadLine(); int flags = Convert.ToInt32(t); segDef[curDef] = new SegmentDefinition(name, tex, tRect, flags); } } }