static MainForm() { var T = new ShapeFileFormat[] { new Type1ShapeFileFormat(), new Type2ShapeFileFormat() }; ShapeFileFormatKeys = new String[T.Length]; ShapeFileFormats = new Dictionary<String, ShapeFileFormat>(); var I = 0; foreach (var i in T) { ShapeFileFormatKeys[I] = i.Name; ShapeFileFormats.Add(i.Name, i); I++; } }
private void LoadShape(String Path, ShapeFileFormat Format) { try { using (var Reader = new IO.StreamReader(IO.File.Open(Path, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read))) { this.Project.Shape.Shapes.Add(Format.ReadShape(Reader)); } this.AddShapeRecent(Path, Format); this.SaveProject(); } catch (Exception ex) { ErrorDialog.Show("Could not load file.", ex, new StackTrace(true)); } }
private void AddShapeRecent(String Item, ShapeFileFormat Format) { this.AddShapeRecent(Item, Array.IndexOf(ShapeFileFormatKeys, Format.Name)); }