public PostItList DeserializeXML(string file) { FileStream fs = new FileStream(file, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(PostItList)); PostItList postItList = (PostItList)serializer.Deserialize(fs); fs.Close(); return(postItList); }
public void SerializeXML(PostItList postItList) { //string path = EditorUtility.SaveFilePanel("newList", "", "", "xml"); //StreamWriter writer = new StreamWriter(path); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); if (!Directory.Exists(path + "/POSTITDATA")) { Directory.CreateDirectory(path + "/POSTITDATA"); } StreamWriter writer = new StreamWriter(path + "/POSTITDATA/PostItListXML.xml"); XmlSerializer serializer = new XmlSerializer(typeof(PostItList)); serializer.Serialize(writer, postItList); writer.Close(); }
private void Start() { try { string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); if (!Directory.Exists(path + "/POSTITDATA")) { Directory.CreateDirectory(path + "/POSTITDATA"); } else if (Directory.Exists(path + "/POSTITDATA")) { xmlPostItList = SerializerManager.Instance.DeserializeXML(path + "/POSTITDATA/PostItListXML.xml"); } loadElements(); } catch (System.Exception e) { Debug.LogError(e.Message); throw; } }
private void Awake() { xmlPostItList = new PostItList(); //xmlPostItList.listtoSave = new List<PostIt>(); xmlPostItList.arrayPostItData = new List <PostItData>(); }