/// <summary> /// 設定をファイルに保存 /// </summary> public static void SaveSetting() { FileStream fs = null; XmlTextWriter writer = null; try { fs = new FileStream(SettingPath, FileMode.Create, FileAccess.Write); writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8")); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(true); writer.WriteStartElement("Setting"); writer.WriteStartElement("Header"); writer.WriteStartElement("Name"); writer.WriteAttributeString("name", PodcasCoInfo.ApplicationName); writer.WriteEndElement(); // End of Name. writer.WriteStartElement("Version"); writer.WriteAttributeString("version", PodcasCoInfo.VersionNumber); writer.WriteEndElement(); // End of Version. writer.WriteStartElement("Date"); writer.WriteAttributeString("date", DateTime.Now.ToString()); writer.WriteEndElement(); // End of Date. writer.WriteEndElement(); // End of Header. writer.WriteStartElement("Content"); writer.WriteStartElement("StationList"); foreach (Station station in StationList.GetStationList()) { writer.WriteStartElement("Station"); writer.WriteAttributeString("id", station.Id); writer.WriteAttributeString("name", station.Name); writer.WriteAttributeString("kind", station.Kind.ToString()); writer.WriteAttributeString("startupDownload", station.StartupDownload.ToString()); writer.WriteAttributeString("startupDownloadNum", station.StartupDownloadNum.ToString()); writer.WriteAttributeString("startupDelete", station.StartupDelete.ToString()); writer.WriteAttributeString("startupDeleteRemainDay", station.StartupDeleteRemainDay.ToString()); writer.WriteEndElement(); // End of Station } writer.WriteEndElement(); // End of StationList writer.WriteStartElement("PodcastClipDirectoryPath"); writer.WriteAttributeString("path", PodcastClipDirectoryPath); writer.WriteEndElement(); // End of PodcastClipDirectoryPath writer.WriteStartElement("MediaPlayerPath"); writer.WriteAttributeString("path", MediaPlayerPath); writer.WriteEndElement(); // End of MediaPlayerPath writer.WriteStartElement("BrowserPath"); writer.WriteAttributeString("path", BrowserPath); writer.WriteEndElement(); // End of BrowserPath writer.WriteStartElement("Proxy"); writer.WriteAttributeString("use", ProxyUse.ToString()); writer.WriteAttributeString("server", ProxyServer); writer.WriteAttributeString("port", ProxyPort.ToString()); writer.WriteEndElement(); // End of Porxy writer.WriteStartElement("ChannelSort"); writer.WriteAttributeString("sort", ChannelSort.ToString()); writer.WriteEndElement(); // End of ChannelSort writer.WriteEndElement(); // End of Content. writer.WriteEndElement(); // End of Setting. writer.WriteEndDocument(); } finally { writer.Close(); fs.Close(); } }
/// <summary> /// 設定をファイルに保存 /// </summary> public static void SaveSetting() { FileStream fs = null; XmlTextWriter writer = null; try { fs = new FileStream(SettingPath, FileMode.Create, FileAccess.Write); writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8")); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(true); writer.WriteStartElement("Setting"); writer.WriteStartElement("Header"); writer.WriteStartElement("Name"); writer.WriteAttributeString("name", TwitterAwayInfo.ApplicationName); writer.WriteEndElement(); // End of Name. writer.WriteStartElement("Version"); writer.WriteAttributeString("version", TwitterAwayInfo.VersionNumber); writer.WriteEndElement(); // End of Version. writer.WriteStartElement("Date"); writer.WriteAttributeString("date", DateTime.Now.ToString()); writer.WriteEndElement(); // End of Date. writer.WriteEndElement(); // End of Header. writer.WriteStartElement("Content"); writer.WriteStartElement("User"); writer.WriteAttributeString("name", UserName); writer.WriteAttributeString("password", Password); writer.WriteEndElement(); // End of User writer.WriteStartElement("CheckList"); writer.WriteAttributeString("list", CheckList.ToString()); writer.WriteEndElement(); // End of CheckList writer.WriteStartElement("UpdateTimer"); writer.WriteAttributeString("check", UpdateTimerCheck.ToString()); writer.WriteAttributeString("millsecond", UpdateTimerMillSecond.ToString()); writer.WriteEndElement(); // End of UpdateTimer writer.WriteStartElement("Proxy"); writer.WriteAttributeString("use", ProxyUse.ToString()); writer.WriteAttributeString("server", ProxyServer); writer.WriteAttributeString("port", ProxyPort.ToString()); writer.WriteEndElement(); // End of Porxy writer.WriteStartElement("TwitterListViewColumnWidth"); writer.WriteAttributeString("name", TwitterListViewNameColumnWidth.ToString()); writer.WriteAttributeString("doing", TwitterListViewDoingColumnWidth.ToString()); writer.WriteAttributeString("date", TwitterListViewDateColumnWidth.ToString()); writer.WriteEndElement(); // End of TwitterListViewColumnWidth writer.WriteEndElement(); // End of Content. writer.WriteEndElement(); // End of Setting. writer.WriteEndDocument(); } catch (IOException) { throw; } finally { writer.Close(); fs.Close(); } }
/// <summary> /// 設定をファイルに保存 /// </summary> public static void SaveSetting() { FileStream fs = null; XmlTextWriter writer = null; try { fs = new FileStream(SettingPath, FileMode.Create, FileAccess.Write); writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8")); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(true); writer.WriteStartElement("Setting"); writer.WriteStartElement("Header"); writer.WriteStartElement("Name"); writer.WriteAttributeString("name", PocketLadioInfo.ApplicationName); writer.WriteEndElement(); // End of Name. writer.WriteStartElement("Version"); writer.WriteAttributeString("version", PocketLadioInfo.VersionNumber); writer.WriteEndElement(); // End of Version. writer.WriteStartElement("Date"); writer.WriteAttributeString("date", DateTime.Now.ToString()); writer.WriteEndElement(); // End of Date. writer.WriteEndElement(); // End of Header. writer.WriteStartElement("Content"); writer.WriteStartElement("StationList"); foreach (Station station in StationList.GetStationList()) { writer.WriteStartElement("Station"); writer.WriteAttributeString("id", station.Id); writer.WriteAttributeString("name", station.Name); writer.WriteAttributeString("kind", station.Kind.ToString()); writer.WriteEndElement(); // End of Station } writer.WriteEndElement(); // End of StationList writer.WriteStartElement("FilterEnable"); writer.WriteAttributeString("enable", FilterEnable.ToString()); writer.WriteEndElement(); // End of FilterEnable writer.WriteStartElement("HeadlineTimer"); writer.WriteAttributeString("check", HeadlineTimerCheck.ToString()); writer.WriteAttributeString("millsecond", HeadlineTimerMillSecond.ToString()); writer.WriteEndElement(); // End of HeadlineTimer writer.WriteStartElement("MediaPlayerPath"); writer.WriteAttributeString("path", MediaPlayerPath); writer.WriteEndElement(); // End of MediaPlayerPath writer.WriteStartElement("BrowserPath"); writer.WriteAttributeString("path", BrowserPath); writer.WriteEndElement(); // End of BrowserPath writer.WriteStartElement("PlayListSave"); writer.WriteAttributeString("save", PlayListSave.ToString()); writer.WriteEndElement(); // End of PlayListSave writer.WriteStartElement("HeadlineListBoxFont"); writer.WriteAttributeString("change", HeadlineListBoxFontSizeChange.ToString()); writer.WriteAttributeString("size", HeadlineListBoxFontSize.ToString()); writer.WriteEndElement(); // End of HeadlineListBoxFont writer.WriteStartElement("Proxy"); writer.WriteAttributeString("use", ProxyUse.ToString()); writer.WriteAttributeString("server", ProxyServer); writer.WriteAttributeString("port", ProxyPort.ToString()); writer.WriteEndElement(); // End of Porxy writer.WriteEndElement(); // End of Content. writer.WriteEndElement(); // End of Setting. writer.WriteEndDocument(); } finally { writer.Close(); fs.Close(); } }