示例#1
0
文件: XmlHelper.cs 项目: kidaa/Pulse
        public static XmlElement LoadDocument(string xmlPath)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(xmlPath);

            return doc.GetDocumentElement();
        }
示例#2
0
文件: XmlHelper.cs 项目: kidaa/Pulse
        public static XmlElement TryLoadDocument(string xmlPath)
        {
            if (!File.Exists(xmlPath))
                return null;

            XmlDocument doc = new XmlDocument();
            doc.Load(xmlPath);

            return doc.GetDocumentElement();
        }
示例#3
0
        private FFXIIITextEncoding ReadEncoding(BinaryReader br)
        {
            int length = br.ReadInt32();
            OnProgress(4);

            using (MemoryStream ms = new MemoryStream(length))
            {
                byte[] buff = new byte[4096];
                br.BaseStream.CopyToStream(ms, length, buff);
                ms.Position = 0;

                XmlDocument doc = new XmlDocument();
                doc.Load(ms);

                OnProgress(length);

                FFXIIICodePage codepage = FFXIIICodePageHelper.FromXml(doc.GetDocumentElement());
                return new FFXIIITextEncoding(codepage);
            }
        }