public void Load(string filename) { StreamReader reader = new StreamReader(Path.Combine("/users/jack/Desktop/", filename)); try { Background = Color.FromArgb(reader.ReadInteger()); int count = reader.ReadInteger(); for (int i = 0; i < count; i++) { Shape s = Shape.CreateShape(reader.ReadLine()); s.LoadFrom(reader); _shapes.Add(s); } } finally { reader.Close(); } }
public void Load(string filename) { int _count, i; Shape s = default(Shape); string kind; StreamReader reader = new StreamReader(FilePath + filename); try{ BackgroundColor = Color.FromArgb(reader.ReadInteger()); _count = reader.ReadInteger(); for (i = 0; i < _count; i++) { kind = reader.ReadLine(); s = Shape.CreateShape(kind); s.LoadFrom(reader); AddShape(s); } } finally { reader.Close(); } }