public static GiftSendSaveFile Load(string path) { if (File.Exists(path)) { #if UNITY_WINRT string line = readFile(path); GiftSendSaveFile data = UnityPluginForWindowsPhone.FileIO.DeserializeObject <GiftSendSaveFile>(line); if (data == null) { data = new GiftSendSaveFile(); } return(data); #else XmlSerializer serializer = new XmlSerializer(typeof(GiftSendSaveFile)); using (XmlReader reader = XmlReader.Create(path)) { return(serializer.Deserialize(reader) as GiftSendSaveFile); } #endif } else { return(new GiftSendSaveFile()); } }
public static void Initialize(string message) #endif { pGlobal = GiftSentGlobal.Instance(); pGlobal.filePath = Application.persistentDataPath + "/" + "GiftList.xml"; pGlobal.file = GiftSendSaveFile.Load(pGlobal.filePath); if (pGlobal.file.SendItem != null) { pGlobal.sentList = new List <GiftSend>(pGlobal.file.SendItem); } else { pGlobal.sentList = new List <GiftSend>(); } }