/// <summary> /// 将配置写入存盘文件 /// </summary> public static void SaveParam() { isDirty = false; string path = GetSavePath(); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("AntiShakeBeforeTime", AntiShakeBeforeTime.ToString()); data.Add("AntiShakeAfterTime", AntiShakeAfterTime.ToString()); data.Add("Alpha", Alpha.ToString()); data.Add("SyncDelayTime", SyncDelayTime.ToString()); data.Add("SoundVolume", SoundVolume.ToString()); data.Add("AuthorId", AuthorId); data.Add("AuthorPass", AuthorPass); Debug.Log("Save file [" + path + "]"); AppConfig.SaveConfigFile(path, data); }
private void WriteSettings(XmlWriter writer) { writer.WriteStartElement("Settings"); writer.WriteAttributeString("Version", 1.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteElementString("MusicDirectory", MusicDirectory); writer.WriteElementString("SoundsDirectory", SoundDirectory); writer.WriteElementString("LastDownloadLocation", LastDownloadLocation); writer.WriteStartElement("WindowLayout"); writer.WriteRaw(WindowLayout); writer.WriteEndElement(); writer.WriteStartElement("Volumes"); writer.WriteAttributeString("Overall", GlobalVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Music", MusicVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Sound", SoundVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Network"); writer.WriteAttributeString("TcpPort", TcpPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("UdpPort", UdpPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("IPAddress", IPAddress); writer.WriteAttributeString("CheckForUpdate", CheckForUpdate ? "true" : "false"); writer.WriteAttributeString("Enabled", UseLegacyNetwork ? "true" : "false"); writer.WriteAttributeString("WebTcpPort", WebTcpPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("UseWebNetwork", UseWebNetwork ? "true" : "false"); writer.WriteEndElement(); RecentFiles.WriteFiles(writer); writer.WriteStartElement("Tools"); writer.WriteElementString("SoundFileEditor", SoundFileEditor); writer.WriteElementString("ExternalMusicPlayer", ExternalMusicPlayer); writer.WriteEndElement(); writer.WriteStartElement("Options"); writer.WriteAttributeString("MessageFilterLevel", MessageFilterLevel.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("ShowKeys", ShowKeysInButtons ? "true" : "false"); writer.WriteAttributeString("GlobalKeyHook", GlobalKeyHook ? "true" : "false"); writer.WriteAttributeString("OutputDevice", OutputDeviceIndex.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Streaming"); writer.WriteAttributeString("Active", UseStreaming ? "true" : "false"); writer.WriteAttributeString("Address", StreamingServerAddress); writer.WriteAttributeString("Port", StreamingServerPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Password", StreamingPassword); writer.WriteAttributeString("Encoding", StreamingEncoder.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("StreamName", StreamingStreamName); writer.WriteAttributeString("Bitrate", StreamingBitrate.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("UserName", StreamingUserName); writer.WriteEndElement(); writer.WriteStartElement("OnlineDB"); writer.WriteAttributeString("UserId", OnlineDBUserId); writer.WriteAttributeString("DialogAfterDownload", ShowDialogAfterDownload ? "true" : "false"); writer.WriteAttributeString("DialogAfterUpload", ShowDialogAfterUpload ? "true" : "false"); writer.WriteEndElement(); writer.WriteStartElement("TagMusicFading"); writer.WriteAttributeString("FadeTime", TagMusicFadeTime.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("FadeOnlyOnChange", TagMusicFadeOnlyOnChange ? "true" : "false"); writer.WriteEndElement(); writer.WriteStartElement("Music"); writer.WriteAttributeString("PlayOnAllSpeakers", PlayMusicOnAllSpeakers ? "true" : "false"); writer.WriteAttributeString("ButtonFadeMode", ButtonMusicFadeMode.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("ButtonFadeTime", ButtonMusicFadeTime.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Controllers"); writer.WriteAttributeString("LocalPlayerPath", LocalPlayerPath); writer.WriteEndElement(); writer.WriteStartElement("TipOfTheDay"); writer.WriteAttributeString("ShowTip", ShowTipOfTheDay ? "true" : "false"); writer.WriteAttributeString("LastTip", LastTipOfTheDay.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Tpm2NetTarget"); writer.WriteAttributeString("Host", Tpm2NetTargetHost); writer.WriteAttributeString("Port", Tpm2NetTargetPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteEndElement(); }