Esempio n. 1
0
 /// <summary>
 /// Writes an xml representation of this NamedArea to \a out_stream.
 /// </summary>
 /// <param name="xml_stream">
 /// Stream where xml data should be output.
 /// </param>
 public void WriteXMLToStream(XMLSerializer xml_stream)
 {
     xml_stream.OpenTag("NamedArea")
     .Attribute("name", d_name);
     d_area.WriteXMLToStream(xml_stream);
     xml_stream.CloseTag();
 }
Esempio n. 2
0
        /*!
         * \brief
         *  Write out any xml attributes added in a sub-class.  Note that you
         *  should not write the closing '/>' character sequence, nor any other
         *  information in this function.  You should always call the base class
         *  implementation of this function when overriding.
         *
         * \param xml_stream
         *  XMLSerializer where xml data should be output.
         */

        public virtual void WriteDefinitionXMLAttributes(XMLSerializer xml_stream)
        {
            xml_stream.Attribute("name", d_propertyName);

            if (!String.IsNullOrEmpty(d_initialValue))
            {
                xml_stream.Attribute("initialValue", d_initialValue);
            }

            if (!String.IsNullOrEmpty(d_helpString))
            {
                xml_stream.Attribute("help", d_helpString);
            }

            if (d_writeCausesRedraw)
            {
                xml_stream.Attribute("redrawOnWrite", "true");
            }

            if (d_writeCausesLayout)
            {
                xml_stream.Attribute("layoutOnWrite", "true");
            }

            if (!String.IsNullOrEmpty(d_eventFiredOnWrite))
            {
                xml_stream.Attribute("fireEvent", d_eventFiredOnWrite);
            }
        }
Esempio n. 3
0
        /*!
         * \brief
         *  Writes a full XML font file for the specified Font to the given
         *  OutStream.
         *
         * \param name
         *  String holding the name of the Font to be written to the stream.
         *
         * \param out_stream
         *  OutStream (std::ostream based) object where data is to be sent.
         */
        public void WriteFontToStream(string name, StreamWriter outStream)
        {
            var xml = new XMLSerializer(outStream);

            // output font data
            Get(name).WriteXMLToStream(xml);
        }
Esempio n. 4
0
        /// <summary>
        /// Writes an xml representation of this ComponentArea to \a out_stream.
        /// </summary>
        /// <param name="xmlStream">
        /// XMLSerializer where xml data should be output.
        /// </param>
        public void WriteXMLToStream(XMLSerializer xmlStream)
        {
            xmlStream.OpenTag("Area");

            // see if we should write an AreaProperty element
            if (IsAreaFetchedFromProperty())
            {
                xmlStream.OpenTag("AreaProperty")
                .Attribute("name", _namedSource)
                .CloseTag();
            }
            else if (IsAreaFetchedFromNamedArea())
            {
                xmlStream.OpenTag("NamedAreaSource")
                .Attribute("look", _namedAreaSourceLook)
                .Attribute("name", _namedSource)
                .CloseTag();
            }
            else
            {
                // not a property, write out individual dimensions explicitly.

                d_left.WriteXmlToStream(xmlStream);
                d_top.WriteXmlToStream(xmlStream);
                d_right_or_width.WriteXmlToStream(xmlStream);
                d_bottom_or_height.WriteXmlToStream(xmlStream);
            }
            xmlStream.CloseTag();
        }
Esempio n. 5
0
        protected override void WriteXmlElementAttributesImpl(XMLSerializer xmlStream)
        {
            if (!String.IsNullOrEmpty(d_widgetName))
            {
                xmlStream.Attribute("widget", d_widgetName);
            }

            xmlStream.Attribute("dimension", /*FalagardXMLHelper*/ PropertyHelper.ToString <DimensionType>(d_what));
        }
Esempio n. 6
0
        /*!
         * \brief
         *  Writes a full XML window layout, starting at the given Window to the given OutStream.
         *
         * \param window
         *  Window object to become the root of the layout.
         *
         * \param out_stream
         *  OutStream (std::ostream based) object where data is to be sent.
         *
         * \return
         *  Nothing.
         */

        public void WriteLayoutToStream(Window window, StreamWriter outStream)
        {
            var xml = new XMLSerializer(outStream);

            // output GUILayout start element
            xml.OpenTag(GuiLayoutXmlHandler.GuiLayoutElement);
            xml.Attribute(GuiLayoutXmlHandler.GuiLayoutVersionAttribute,
                          GuiLayoutXmlHandler.NativeVersion);

            // write windows
            window.WriteXMLToStream(xml);
            // write closing GUILayout element
            xml.CloseTag();
        }
Esempio n. 7
0
        protected override void WriteXmlElementAttributesImpl(XMLSerializer xmlStream)
        {
            if (Math.Abs(d_value.d_scale - 0) > float.Epsilon)
            {
                xmlStream.Attribute("scale", d_value.d_scale.ToString(CultureInfo.InvariantCulture));
            }

            if (Math.Abs(d_value.d_offset - 0) > float.Epsilon)
            {
                xmlStream.Attribute("offset", d_value.d_offset.ToString(CultureInfo.InvariantCulture));
            }

            xmlStream.Attribute("type", d_what.ToString());
        }
Esempio n. 8
0
        // required to sort layers according to priority
        // TODO: bool operator<(const LayerSpecification& other) const; { return d_layerPriority < otherLayerSpec.getLayerPriority(); }

        /// <summary>
        /// Writes an xml representation of this Layer to \a out_stream.
        /// </summary>
        /// <param name="xml_stream">
        /// Stream where xml data should be output.
        /// </param>
        public void WriteXMLToStream(XMLSerializer xml_stream)
        {
            //xml_stream.openTag(Falagard_xmlHandler::LayerElement);

            //if (d_layerPriority != 0)
            //    xml_stream.attribute(Falagard_xmlHandler::PriorityAttribute, PropertyHelper<uint>::toString(d_layerPriority));

            //// ouput all sections in this layer
            //for(SectionSpecificationList::const_iterator curr = d_sections.begin(); curr != d_sections.end(); ++curr)
            //{
            //    (*curr).writeXMLToStream(xml_stream);
            //}

            //xml_stream.closeTag();
            throw new NotImplementedException();
        }
        protected void WriteFalagardXMLAttributes(XMLSerializer xml_stream)
        {
            base.WriteDefinitionXMLAttributes(xml_stream);

            // HACK: Here we abuse some intimate knowledge in that we know it's
            // safe to write our sub-elements out although the function is named
            // for writing attributes.  The alternative was to repeat code from the
            // base class, also demonstrating intimate knowledge ;)

            // if there is one target only, write it out as attributes
            if (d_targets.Count == 1)
            {
                var i = d_targets[0];
                if (!String.IsNullOrEmpty(i.Item1))
                {
                    xml_stream.Attribute("widget", i.Item1);
                }

                if (!String.IsNullOrEmpty(i.Item2))
                {
                    xml_stream.Attribute("targetProperty", i.Item2);
                }
            }
            // we have multiple targets, so write them as PropertyLinkTarget tags
            else
            {
                foreach (var i in d_targets)
                {
                    xml_stream.OpenTag("PropertyLinkTarget");

                    if (!String.IsNullOrEmpty(i.Item1))
                    {
                        xml_stream.Attribute("widget", i.Item1);
                    }

                    if (!String.IsNullOrEmpty(i.Item2))
                    {
                        xml_stream.Attribute("property", i.Item2);
                    }

                    xml_stream.CloseTag();
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Writes an xml representation of this WidgetComponent to \a out_stream.
        /// </summary>
        /// <param name="xmlStream">
        /// Stream where xml data should be output.
        /// </param>
        public void WriteXMLToStream(XMLSerializer xmlStream)
        {
            // output opening tag
            xmlStream.OpenTag("Child")
            .Attribute("type", _baseType)
            .Attribute("name", _name);

            if (!String.IsNullOrEmpty(_imageryName))
            {
                xmlStream.Attribute("look", _imageryName);
            }

            if (!String.IsNullOrEmpty(_rendererType))
            {
                xmlStream.Attribute("renderer", _rendererType);
            }

            if (!_autoWindow)
            {
                xmlStream.Attribute("autoWindow", "false");
            }

            // Output <EventAction> elements
            _eventActions.ForEach(x => x.WriteXMLToStream(xmlStream));

            // output target area
            _area.WriteXMLToStream(xmlStream);

            // output vertical alignment
            xmlStream.OpenTag("VertAlignment")
            .Attribute("type", /*FalagardXMLHelper*/ PropertyHelper.ToString <VerticalAlignment>(_vertAlign))
            .CloseTag();

            // output horizontal alignment
            xmlStream.OpenTag("HorzAlignment")
            .Attribute("type", /*FalagardXMLHelper*/ PropertyHelper.ToString <HorizontalAlignment>(_horzAlign))
            .CloseTag();

            //output property initialisers
            _properties.ForEach(x => x.WriteXMLToStream(xmlStream));

            // output closing tag
            xmlStream.CloseTag();
        }
Esempio n. 11
0
 /*!
  * \brief
  *  Writes out an XML representation of this class to the given stream.
  *
  * \note
  *  This would normally have been implemented via XMLGenerator base class, but in this
  *  case we require the target PropertyReceiver in order to obtain the property value.
  */
 public virtual void WriteXMLToStream(PropertyReceiver receiver, XMLSerializer xml_stream)
 {
     if (d_writeXML)
     {
         xml_stream.OpenTag(XMLElementName)
         .Attribute(NameXMLAttributeName, d_name);
         // Detect wether it is a long property or not
         // Long property are needed if
         var value = Get(receiver);
         if (value.Contains("\n"))
         {
             xml_stream.Text(value);
         }
         else
         {
             xml_stream.Attribute(ValueXMLAttributeName, Get(receiver));
         }
         xml_stream.CloseTag();
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Writes an xml representation of this Affector to \a out_stream.
        /// </summary>
        /// <param name="xmlStream">
        /// Stream where xml data should be output.
        /// </param>
        public void WriteXmlToStream(XMLSerializer xmlStream)
        {
            xmlStream.OpenTag(AnimationAffectorHandler.ElementName);

            var applicationMethod = String.Empty;

            switch (GetApplicationMethod())
            {
            case ApplicationMethod.Absolute:
                applicationMethod = AnimationAffectorHandler.ApplicationMethodAbsolute;
                break;

            case ApplicationMethod.Relative:
                applicationMethod = AnimationAffectorHandler.ApplicationMethodRelative;
                break;

            case ApplicationMethod.RelativeMultiply:
                applicationMethod = AnimationAffectorHandler.ApplicationMethodRelativeMultiply;
                break;

            default:
                global::System.Diagnostics.Debug.Assert(false, "How did we get here?");
                break;
            }

            xmlStream.Attribute(AnimationAffectorHandler.ApplicationMethodAttribute, applicationMethod);

            xmlStream.Attribute(AnimationAffectorHandler.TargetPropertyAttribute, GetTargetProperty());

            if (GetInterpolator() != null)
            {
                xmlStream.Attribute(AnimationAffectorHandler.InterpolatorAttribute, GetInterpolator().GetInterpolatorType());
            }

            foreach (var it in _keyFrames)
            {
                it.Value.WriteXMLToStream(xmlStream);
            }

            xmlStream.CloseTag();
        }
Esempio n. 13
0
        protected override void WriteXmlElementAttributesImpl(XMLSerializer xmlStream)
        {
            if (!String.IsNullOrEmpty(_childName))
            {
                xmlStream.Attribute("widget", _childName);
            }

            if (!String.IsNullOrEmpty(_font))
            {
                xmlStream.Attribute("font", _font);
            }

            if (!String.IsNullOrEmpty(_text))
            {
                xmlStream.Attribute("string", _text);
            }

            if (Math.Abs(_padding - 0) > float.Epsilon)
            {
                xmlStream.Attribute("padding", PropertyHelper.ToString(_padding));
            }

            xmlStream.Attribute("type", /*FalagardXMLHelper*/ PropertyHelper.ToString(_metric));
        }
Esempio n. 14
0
        /*!
         * \brief
         *  Writes an xml representation of this ImagerySection to \a out_stream.
         *
         * \param xml_stream
         *  Stream where xml data should be output.
         *
         *
         * \return
         *  Nothing.
         */

        public void WriteXMLToStream(XMLSerializer xml_stream)
        {
            throw new NotImplementedException();
        }
Esempio n. 15
0
 protected override void WriteXMLToStreamImpl(XMLSerializer xml_stream)
 {
     throw new global::System.NotImplementedException();
 }
Esempio n. 16
0
 public virtual void WriteXmlAttributesToStream(XMLSerializer xmlStream)
 {
     // This does nothing and needs to be specialised or overridden
 }
Esempio n. 17
0
 public void WriteXmlToStream(XMLSerializer xmlStream)
 {
     WriteXmlTagToStream(xmlStream);
     WriteXmlAttributesToStream(xmlStream);
     xmlStream.CloseTag();
 }
Esempio n. 18
0
 /// <summary>
 /// implementaion version of writeXMLToStream.
 /// </summary>
 /// <param name="xml_stream"></param>
 protected abstract void WriteXMLToStreamImpl(XMLSerializer xml_stream);
Esempio n. 19
0
        /// <summary>
        /// Writes given animation definition to the given OutStream.
        /// </summary>
        /// <param name="animation">
        /// Animation definition to write
        /// </param>
        /// <param name="outStream">
        /// OutStream (std::ostream based) object where data is to be sent.
        /// </param>
        public void WriteAnimationDefinitionToStream(Animation animation, StreamWriter outStream)
        {
            var xml = new XMLSerializer(outStream);

            animation.WriteXmlToStream(xml);
        }
Esempio n. 20
0
 /*!
  * \brief
  *  Write out the text of the XML element type.  Note that you should
  *  not write the opening '<' character, nor any other information such
  *  as attributes in this function.  The writeExtraAttributes function
  *  can be used for writing attributes.
  *
  * \param xml_stream
  *  XMLSerializer where xml data should be output.
  */
 public abstract void WriteDefinitionXMLElementType(XMLSerializer xml_stream);
Esempio n. 21
0
 /// <summary>
 /// Writes an xml representation of the PropertyDefinitionBase based
 /// object to \a out_stream.
 /// </summary>
 /// <param name="xml_stream">
 /// XMLSerializer where xml data should be output.
 /// </param>
 public virtual void WriteDefinitionXMLToStream(XMLSerializer xml_stream)
 {
     WriteDefinitionXMLElementType(xml_stream);
     WriteDefinitionXMLAttributes(xml_stream);
     xml_stream.CloseTag();
 }
Esempio n. 22
0
 protected override void WriteXmlElementAttributesImpl(XMLSerializer xmlStream)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
 /*!
  * \brief
  *  Writes xml for the colours to a OutStream.
  *  Will prefer property colours before explicit.
  *
  * \note
  *  This is intended as a helper function for sub-classes when outputting
  *  xml to a stream.
  *
  * \return
  *  - true if xml element was written.
  *  - false if nothing was output due to the formatting not being set
  *    (sub-class may then choose to do something else.)
  */
 protected bool WriteColoursXML(XMLSerializer xml_stream)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
 // Implementation of the base class interface
 protected override void WriteXmlElementNameImpl(XMLSerializer xmlStream)
 {
     xmlStream.OpenTag("UnifiedDim");
 }
Esempio n. 25
0
 /// <summary>
 /// Writes an xml representation of this Animation definition to \a out_stream.
 /// </summary>
 /// <param name="xml_stream">
 /// Stream where xml data should be output.
 /// </param>
 /// <param name="name_override">
 /// If given, this value overrides the name attribute written to the stream.
 /// This is useful when writing out looknfeels
 /// </param>
 public void WriteXmlToStream(XMLSerializer xml_stream, string name_override = "")
 {
     throw new NotImplementedException();
 }
 // TODO: ...
 public override void WriteDefinitionXMLElementType(XMLSerializer xml_stream)
 {
     xml_stream.OpenTag("PropertyDefinition");
 }