コード例 #1
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();
        }
コード例 #2
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();
 }
コード例 #3
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();
        }
コード例 #4
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();
        }
コード例 #5
0
        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();
                }
            }
        }
コード例 #6
0
ファイル: Property.cs プロジェクト: xdinos/SDL2Experiments
 /*!
  * \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();
     }
 }
コード例 #7
0
ファイル: Affector.cs プロジェクト: xdinos/SDL2Experiments
        /// <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();
        }
コード例 #8
0
ファイル: UnifiedDim.cs プロジェクト: xdinos/SDL2Experiments
 // Implementation of the base class interface
 protected override void WriteXmlElementNameImpl(XMLSerializer xmlStream)
 {
     xmlStream.OpenTag("UnifiedDim");
 }
コード例 #9
0
 // TODO: ...
 public override void WriteDefinitionXMLElementType(XMLSerializer xml_stream)
 {
     xml_stream.OpenTag("PropertyDefinition");
 }