/// <summary> /// 全体的な情報を保存します。 /// </summary> public void SaveInfo() { try { var writer = new StringWriter(); var serializer = new XmlSerializer(AssetXML.GetType()); var namespaces = new XmlSerializerNamespaces(); namespaces.Add(string.Empty, string.Empty); AssetXML.WriteAction(); serializer.Serialize(writer, AssetXML, namespaces); StreamWriter swriter = new StreamWriter(CAPYCSS_INFO_PATH, false); swriter.WriteLine(writer.ToString()); swriter.Close(); } catch (Exception ex) { ControlTools.ShowErrorMessage(ex.Message); } }
/// <summary> /// 全体的な情報を読み込みます。 /// </summary> /// <param name="filename">保存ファイル名</param> public void LoadInfo(string filename) { try { StreamReader reader = new StreamReader(filename); XmlSerializer serializer = new XmlSerializer(AssetXML.GetType()); XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.Load(reader); XmlNodeReader nodeReader = new XmlNodeReader(doc.DocumentElement); object data = (CommandCanvasList._AssetXML <CommandCanvasList>)serializer.Deserialize(nodeReader); AssetXML = (CommandCanvasList._AssetXML <CommandCanvasList>)data; reader.Close(); AssetXML.ReadAction(this); } catch (Exception ex) { ControlTools.ShowErrorMessage(ex.Message); } }