/// <summary> /// Rod.xmlに登録内容を書き出す /// </summary> /// <param name="iRodDB">RodDBModel</param> /// <returns>True:成功</returns> private bool putRodDB(RodDBModel iRodDB) { string xmlFilename = PATH_FISHDB + @"\" + FILENAME_RODDB; StreamWriter sw = new StreamWriter(xmlFilename, false, new UTF8Encoding(false)); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add(String.Empty, String.Empty); XmlSerializer serializer = new XmlSerializer(typeof(RodDBModel)); serializer.Serialize(sw, iRodDB, ns); //書き込み sw.Flush(); sw.Close(); sw = null; return true; }
/// <summary> /// Rod.xmlの内容を全て取得する /// </summary> /// <returns>RodDBModel</returns> private RodDBModel getRodDB() { string xmlFilename = PATH_FISHDB + @"\" + FILENAME_RODDB; RodDBModel roddb = new RodDBModel(); if (File.Exists(xmlFilename)) { FileStream fs = new FileStream(xmlFilename, System.IO.FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(RodDBModel)); roddb = (RodDBModel)serializer.Deserialize(fs); fs.Close(); } return roddb; }