public static SvgDocument LoadSymbol(string filename) { SvgDocument fadde2; if (!File.Exists(filename)) { return null; } SvgDocument doc = new SvgDocument(); try { doc.XmlResolver = null; doc.Load(filename); doc.AcceptChanges=false; doc.FilePath = filename; fadde2 = doc; } catch (Exception exception1) { Console.Write(exception1.Message); fadde2 = null; } return fadde2; }
public static SvgDocument CreateDocumentFromFile(string filename) { Stream stream1 = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); SvgDocument document1 = new SvgDocument(); XmlTextReader reader1 = new XmlTextReader(stream1, XmlNodeType.Document, document1.XmlParserContext); try { reader1.XmlResolver = null; document1.PreserveWhitespace = true; document1.XmlResolver = null; document1.FilePath = filename; document1.Load(reader1); //document1.DealLast(); reader1.Close(); stream1.Close(); document1.FileName = Path.GetFileNameWithoutExtension(filename); document1.Update = true; return document1; } catch (Exception exception1) { reader1.Close(); stream1.Close(); MessageBox.Show("���Ϸ��ĵ���" + exception1.Message); } return null; }