示例#1
0
        public GUIMainController(GUIMainView view)
        {
            Serializer = new Serializer(this);
            Model = Serializer.Deserialize();
            if(Model == null) Model = new GUIModel();

            View = view;
            View.UpdateView(Model);
        }
示例#2
0
文件: Serializer.cs 项目: Needix/CFU
        /// <summary>
        /// Serializes the GUIModel
        /// </summary>
        /// <param name="model">The model to serialize</param>
        public void Serialize(GUIModel model)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(GUIModel));

            if(File.Exists(SAVE_PATH)) File.Delete(SAVE_PATH);
            FileStream stream = new FileStream(SAVE_PATH, FileMode.Create);

            serializer.Serialize(stream, model);
            stream.Close();
        }