public void ToXml(XmlTextWriter _xmlWriter, long _iBeginTimeStamp) { _xmlWriter.WriteStartElement("KeyframeLabel"); _xmlWriter.WriteStartElement("SpacePosition"); _xmlWriter.WriteString(Background.Left.ToString() + ";" + Background.Top.ToString()); _xmlWriter.WriteEndElement(); _xmlWriter.WriteStartElement("TimePosition"); // For regular Keyframes labels, the time position saved in the xml is absolute. long ts = 0; if (!m_bBackgroundIsRelative) { //ts = m_Location.T + _iBeginTimeStamp; ts = m_iTimestamp; } _xmlWriter.WriteString(ts.ToString()); _xmlWriter.WriteEndElement(); m_TextDecoration.ToXml(_xmlWriter); // </KeyframeLabel> _xmlWriter.WriteEndElement(); }
public override void ToXmlString(XmlTextWriter _xmlWriter) { _xmlWriter.WriteStartElement("Drawing"); _xmlWriter.WriteAttributeString("Type", "DrawingAngle2D"); // PointO _xmlWriter.WriteStartElement("PointO"); _xmlWriter.WriteString(PointO.X.ToString() + ";" + PointO.Y.ToString()); _xmlWriter.WriteEndElement(); // PointA _xmlWriter.WriteStartElement("PointA"); _xmlWriter.WriteString(PointA.X.ToString() + ";" + PointA.Y.ToString()); _xmlWriter.WriteEndElement(); // PointB _xmlWriter.WriteStartElement("PointB"); _xmlWriter.WriteString(PointB.X.ToString() + ";" + PointB.Y.ToString()); _xmlWriter.WriteEndElement(); m_InfosStyle.ToXml(_xmlWriter); m_InfosFading.ToXml(_xmlWriter, false); // This is only for spreadsheet export support. These values are not read at import. _xmlWriter.WriteStartElement("Measure"); int angle = (int)Math.Floor(-m_fSweepAngle); _xmlWriter.WriteAttributeString("UserAngle", angle.ToString()); _xmlWriter.WriteEndElement(); // </Drawing> _xmlWriter.WriteEndElement(); }
public override void ToXmlString(XmlTextWriter _xmlWriter) { _xmlWriter.WriteStartElement("Drawing"); _xmlWriter.WriteAttributeString("Type", "DrawingText"); // Text _xmlWriter.WriteStartElement("Text"); _xmlWriter.WriteString(m_Text); _xmlWriter.WriteEndElement(); // Background StartPoint _xmlWriter.WriteStartElement("Position"); _xmlWriter.WriteString(m_BackgroundRectangle.Left.ToString() + ";" + m_BackgroundRectangle.Top.ToString()); _xmlWriter.WriteEndElement(); // Textbox Color _xmlWriter.WriteStartElement("TextboxColor"); _xmlWriter.WriteStartElement("ColorRGB"); _xmlWriter.WriteString(m_TextboxColor.R.ToString() + ";" + m_TextboxColor.G.ToString() + ";" + m_TextboxColor.B.ToString()); _xmlWriter.WriteEndElement(); _xmlWriter.WriteEndElement(); m_TextStyle.ToXml(_xmlWriter); m_InfosFading.ToXml(_xmlWriter, false); // </Drawing> _xmlWriter.WriteEndElement(); }
public void Save(string _filePath) { log.Debug("Exporting color profile to xml file."); try { // Save to XML file XmlTextWriter PreferencesWriter = new XmlTextWriter(_filePath, null); PreferencesWriter.Formatting = Formatting.Indented; PreferencesWriter.WriteStartDocument(); PreferencesWriter.WriteStartElement("KinoveaColorProfile"); // Format version. PreferencesWriter.WriteStartElement("FormatVersion"); PreferencesWriter.WriteString("2.0"); PreferencesWriter.WriteEndElement(); // Data. PreferencesWriter.WriteStartElement("Angle2D"); m_DecorationAngle2D.ToXml(PreferencesWriter); PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteStartElement("Chrono"); m_DecorationChrono.ToXml(PreferencesWriter); PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteStartElement("Cross2D"); m_DecorationCross2D.ToXml(PreferencesWriter); PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteStartElement("Line2D"); m_DecorationLine2D.ToXml(PreferencesWriter); PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteStartElement("Pencil"); m_DecorationPencil.ToXml(PreferencesWriter); PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteStartElement("Text"); m_DecorationText.ToXml(PreferencesWriter); PreferencesWriter.WriteEndElement(); PreferencesWriter.WriteEndElement();// </KinoveaColorProfile> PreferencesWriter.WriteEndDocument(); PreferencesWriter.Flush(); PreferencesWriter.Close(); #region Old 1.1 format /* * // Colors * PreferencesWriter.WriteStartElement("TextColorRGB"); * PreferencesWriter.WriteString(m_ColorText.R.ToString() + ";" + m_ColorText.G.ToString() + ";" + m_ColorText.B.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("PencilColorRGB"); * PreferencesWriter.WriteString(m_ColorPencil.R.ToString() + ";" + m_ColorPencil.G.ToString() + ";" + m_ColorPencil.B.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("PencilSize"); * PreferencesWriter.WriteString(m_StylePencil.Size.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("Cross2DColorRGB"); * PreferencesWriter.WriteString(m_ColorCross2D.R.ToString() + ";" + m_ColorCross2D.G.ToString() + ";" + m_ColorCross2D.B.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("Line2DColorRGB"); * PreferencesWriter.WriteString(m_ColorLine2D.R.ToString() + ";" + m_ColorLine2D.G.ToString() + ";" + m_ColorLine2D.B.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("Line2DSize"); * PreferencesWriter.WriteString(m_StyleLine2D.Size.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("Line2DStartArrow"); * PreferencesWriter.WriteString(m_StyleLine2D.StartArrow.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("Line2DEndArrow"); * PreferencesWriter.WriteString(m_StyleLine2D.EndArrow.ToString()); * PreferencesWriter.WriteEndElement(); * * * PreferencesWriter.WriteStartElement("Angle2DColorRGB"); * PreferencesWriter.WriteString(m_ColorAngle2D.R.ToString() + ";" + m_ColorAngle2D.G.ToString() + ";" + m_ColorAngle2D.B.ToString()); * PreferencesWriter.WriteEndElement(); * * PreferencesWriter.WriteStartElement("ChronoColorRGB"); * PreferencesWriter.WriteString(m_ColorChrono.R.ToString() + ";" + m_ColorChrono.G.ToString() + ";" + m_ColorChrono.B.ToString()); * PreferencesWriter.WriteEndElement(); */ #endregion } catch { // Most probable cause : Folder not found. // Other cause: doesn't have rights to write. log.Error("Error while saving color profile file."); log.Error("Tried to write to : " + _filePath); } }