public static PListRoot Load(Stream stream) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(PListRoot)); byte[] numArray = new byte[8]; stream.Read(numArray, 0, numArray.Length); stream.Seek(0L, SeekOrigin.Begin); PListRoot plistRoot; if (Encoding.Default.GetString(numArray) == "bplist00") { PListBinaryReader plistBinaryReader = new PListBinaryReader(); plistRoot = new PListRoot(); plistRoot.Format = PListFormat.Binary; plistRoot.Root = plistBinaryReader.Read(stream); } else { plistRoot = (PListRoot)xmlSerializer.Deserialize(stream); plistRoot.Format = PListFormat.Xml; } return(plistRoot); }
public static PListRoot Load(string fileName) { using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) return(PListRoot.Load((Stream)fileStream)); }