/// <summary>
 /// Initializes a new instance of the <see cref="LinkResolver"/> class.
 /// </summary>
 /// <param name="input">The input to parse.</param>
 /// <param name="duplicates">Allow duplicates or not.</param>
 public LinkResolver(TextReader input, bool duplicates)
 {
     this.duplicates = duplicates;
     Parser parser = new Parser();
     parser.ElementAdded += this.OnElementAdded;
     parser.Parse(input);
 }
Beispiel #2
0
        private void BUT_loadkml_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();
            fd.Filter = "Google Earth KML (*.kml)|*.kml";
            fd.DefaultExt = ".kml";
            DialogResult result = fd.ShowDialog();
            string file = fd.FileName;
            if (file != "")
            {
                try
                {
                    kmlpolygons.Polygons.Clear();

                    var parser = new SharpKml.Base.Parser();

                    parser.ElementAdded += new EventHandler<SharpKml.Base.ElementEventArgs>(parser_ElementAdded);
                    parser.Parse(File.OpenRead(file));
                }
                catch (Exception ex) { MessageBox.Show("Bad KML File :" + ex.ToString()); }
            }
        }