public void WriteXML(XmlWriter writer) { writer.WriteElementString("TimecodeFormat", timecodeFormat.ToString()); writer.WriteElementString("SpeedUnit", speedUnit.ToString()); writer.WriteElementString("AccelerationUnit", accelerationUnit.ToString()); writer.WriteElementString("AngleUnit", angleUnit.ToString()); writer.WriteElementString("AngularVelocityUnit", angularVelocityUnit.ToString()); writer.WriteElementString("AngularAccelerationUnit", angularAccelerationUnit.ToString()); writer.WriteElementString("CustomLengthUnit", customLengthUnit); writer.WriteElementString("CustomLengthAbbreviation", customLengthAbbreviation); writer.WriteElementString("AspectRatio", aspectRatio.ToString()); writer.WriteElementString("DeinterlaceByDefault", deinterlaceByDefault ? "true" : "false"); writer.WriteElementString("InteractiveFrameTracker", interactiveFrameTracker ? "true" : "false"); writer.WriteElementString("WorkingZoneMemory", workingZoneMemory.ToString()); writer.WriteElementString("SyncLockSpeed", syncLockSpeed ? "true" : "false"); writer.WriteElementString("SyncByMotion", syncByMotion ? "true" : "false"); writer.WriteElementString("ImageFormat", imageFormat.ToString()); writer.WriteElementString("VideoFormat", videoFormat.ToString()); writer.WriteElementString("Background", XmlHelper.WriteColor(backgroundColor, true)); writer.WriteStartElement("InfoFading"); defaultFading.WriteXml(writer); writer.WriteEndElement(); writer.WriteElementString("DrawOnPlay", drawOnPlay ? "true" : "false"); if (recentColors.Count > 0) { writer.WriteStartElement("RecentColors"); for (int i = 0; i < maxRecentColors; i++) { if (i >= recentColors.Count) { break; } writer.WriteElementString("RecentColor", string.Format("{0};{1};{2}", recentColors[i].R.ToString(), recentColors[i].G.ToString(), recentColors[i].B.ToString())); } writer.WriteEndElement(); } writer.WriteElementString("MaxRecentColors", maxRecentColors.ToString()); writer.WriteStartElement("TrackingProfile"); trackingProfile.WriteXml(writer); writer.WriteEndElement(); writer.WriteElementString("EnableFiltering", enableFiltering ? "true" : "false"); writer.WriteElementString("EnableCustomToolsDebugMode", enableCustomToolsDebugMode ? "true" : "false"); writer.WriteElementString("DefaultReplaySpeed", defaultReplaySpeed.ToString("0", CultureInfo.InvariantCulture)); writer.WriteElementString("DetectImageSequences", detectImageSequences ? "true" : "false"); writer.WriteElementString("PreloadKeyframes", preloadKeyframes.ToString()); writer.WriteElementString("PlaybackKVA", playbackKVA); }
public void WriteXML(XmlWriter writer) { writer.WriteElementString("TimecodeFormat", timecodeFormat.ToString()); writer.WriteElementString("SpeedUnit", speedUnit.ToString()); writer.WriteElementString("AccelerationUnit", accelerationUnit.ToString()); writer.WriteElementString("AngleUnit", angleUnit.ToString()); writer.WriteElementString("AngularVelocityUnit", angularVelocityUnit.ToString()); writer.WriteElementString("AngularAccelerationUnit", angularAccelerationUnit.ToString()); writer.WriteElementString("CustomLengthUnit", customLengthUnit); writer.WriteElementString("CustomLengthAbbreviation", customLengthAbbreviation); writer.WriteElementString("AspectRatio", aspectRatio.ToString()); writer.WriteElementString("DeinterlaceByDefault", deinterlaceByDefault ? "true" : "false"); writer.WriteElementString("InteractiveFrameTracker", interactiveFrameTracker ? "true" : "false"); writer.WriteElementString("WorkingZoneSeconds", workingZoneSeconds.ToString()); writer.WriteElementString("WorkingZoneMemory", workingZoneMemory.ToString()); writer.WriteElementString("SyncLockSpeed", syncLockSpeed ? "true" : "false"); writer.WriteElementString("ImageFormat", imageFormat.ToString()); writer.WriteElementString("VideoFormat", videoFormat.ToString()); writer.WriteStartElement("InfoFading"); defaultFading.WriteXml(writer); writer.WriteEndElement(); writer.WriteElementString("MaxFading", maxFading.ToString()); writer.WriteElementString("DrawOnPlay", drawOnPlay ? "true" : "false"); if (recentColors.Count > 0) { writer.WriteStartElement("RecentColors"); for (int i = 0; i < maxRecentColors; i++) { if (i >= recentColors.Count) { break; } writer.WriteElementString("RecentColor", string.Format("{0};{1};{2}", recentColors[i].R.ToString(), recentColors[i].G.ToString(), recentColors[i].B.ToString())); } writer.WriteEndElement(); } writer.WriteElementString("MaxRecentColors", maxRecentColors.ToString()); writer.WriteStartElement("TrackingProfile"); trackingProfile.WriteXml(writer); writer.WriteEndElement(); }
private void FlushToDisk(string filePath) { try { XmlTextWriter PreferencesWriter = new XmlTextWriter(filePath, null); PreferencesWriter.Formatting = Formatting.Indented; PreferencesWriter.WriteStartDocument(); PreferencesWriter.WriteStartElement("KinoveaPreferences"); // Format version PreferencesWriter.WriteStartElement("FormatVersion"); PreferencesWriter.WriteString("1.2"); PreferencesWriter.WriteEndElement(); // Preferences PreferencesWriter.WriteElementString("HistoryCount", m_iFilesToSave.ToString()); PreferencesWriter.WriteElementString("Language", m_UICultureName); PreferencesWriter.WriteElementString("TimeCodeFormat", m_TimeCodeFormat.ToString()); PreferencesWriter.WriteElementString("SpeedUnit", m_SpeedUnit.ToString()); PreferencesWriter.WriteElementString("ImageAspectRatio", m_AspectRatio.ToString()); PreferencesWriter.WriteElementString("DeinterlaceByDefault", m_bDeinterlaceByDefault.ToString()); PreferencesWriter.WriteElementString("WorkingZoneSeconds", m_iWorkingZoneSeconds.ToString()); PreferencesWriter.WriteElementString("WorkingZoneMemory", m_iWorkingZoneMemory.ToString()); //m_DefaultFading.ToXml(PreferencesWriter, true); PreferencesWriter.WriteElementString("MaxFading", m_iMaxFading.ToString()); PreferencesWriter.WriteElementString("DrawOnPlay", m_bDrawOnPlay.ToString()); PreferencesWriter.WriteElementString("ExplorerThumbnailsSize", m_iExplorerThumbsSize.ToString()); PreferencesWriter.WriteElementString("ExplorerVisible", m_bIsExplorerVisible.ToString()); PreferencesWriter.WriteElementString("ExplorerSplitterDistance", m_iExplorerSplitterDistance.ToString()); PreferencesWriter.WriteElementString("ActiveFileBrowserTab", m_ActiveFileBrowserTab.ToString()); PreferencesWriter.WriteElementString("ExplorerFilesSplitterDistance", m_iExplorerFilesSplitterDistance.ToString()); PreferencesWriter.WriteElementString("ShortcutsFilesSplitterDistance", m_iShortcutsFilesSplitterDistance.ToString()); if (m_ShortcutFolders.Count > 0) { PreferencesWriter.WriteStartElement("Shortcuts"); foreach (ShortcutFolder sf in m_ShortcutFolders) { sf.ToXml(PreferencesWriter); } PreferencesWriter.WriteEndElement(); } if (m_RecentColors.Count > 0) { PreferencesWriter.WriteStartElement("RecentColors"); foreach (Color col in m_RecentColors) { PreferencesWriter.WriteStartElement("Color"); PreferencesWriter.WriteString(col.R.ToString() + ";" + col.G.ToString() + ";" + col.B.ToString()); PreferencesWriter.WriteEndElement(); } PreferencesWriter.WriteEndElement(); } if (m_CaptureImageDirectory != null && m_CaptureImageDirectory != "") { PreferencesWriter.WriteElementString("CaptureImageDirectory", m_CaptureImageDirectory); } if (m_CaptureImageDirectory != null && m_CaptureImageFile != "") { PreferencesWriter.WriteElementString("CaptureImageFile", m_CaptureImageFile); } if (m_CaptureImageDirectory != null && m_CaptureVideoDirectory != "") { PreferencesWriter.WriteElementString("CaptureVideoDirectory", m_CaptureVideoDirectory); } if (m_CaptureImageDirectory != null && m_CaptureVideoFile != "") { PreferencesWriter.WriteElementString("CaptureVideoFile", m_CaptureVideoFile); } PreferencesWriter.WriteElementString("CaptureImageFormat", m_CaptureImageFormat.ToString()); PreferencesWriter.WriteElementString("CaptureVideoFormat", m_CaptureVideoFormat.ToString()); PreferencesWriter.WriteElementString("CaptureUsePattern", m_bCaptureUsePattern.ToString()); PreferencesWriter.WriteElementString("CapturePattern", m_CapturePattern); PreferencesWriter.WriteElementString("CaptureImageCounter", m_iCaptureImageCounter.ToString()); PreferencesWriter.WriteElementString("CaptureVideoCounter", m_iCaptureVideoCounter.ToString()); PreferencesWriter.WriteElementString("CaptureMemoryBuffer", m_iCaptureMemoryBuffer.ToString()); if (m_DeviceConfigurations.Count > 0) { PreferencesWriter.WriteStartElement("DeviceConfigurations"); foreach (DeviceConfiguration conf in m_DeviceConfigurations) { conf.ToXml(PreferencesWriter); } PreferencesWriter.WriteEndElement(); } // Network cameras : url, format, list of recent url. PreferencesWriter.WriteElementString("NetworkCameraUrl", m_NetworkCameraUrl); PreferencesWriter.WriteElementString("NetworkCameraFormat", m_NetworkCameraFormat.ToString()); if (m_RecentNetworkCameras.Count > 0) { PreferencesWriter.WriteStartElement("RecentNetworkCameras"); foreach (string url in m_RecentNetworkCameras) { PreferencesWriter.WriteStartElement("NetworkCamera"); PreferencesWriter.WriteString(url); PreferencesWriter.WriteEndElement(); } PreferencesWriter.WriteEndElement(); } PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteEndDocument(); PreferencesWriter.Flush(); PreferencesWriter.Close(); } catch (Exception) { log.Error("Error happenned while writing preferences."); } }