示例#1
0
        public virtual void WriteXml(System.Xml.XmlWriter writer)
        {
            if (!string.IsNullOrWhiteSpace(Title))
            {
                writer.WriteAttributeString("Title", Title);
            }

            //BodyArchitect Start
            if (IconSource != null)
            {
                writer.WriteAttributeString("IconSource", IconSource.ToString());
            }
            //BodyArchitect End

            if (IsSelected)
            {
                writer.WriteAttributeString("IsSelected", IsSelected.ToString());
            }

            if (IsLastFocusedDocument)
            {
                writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString());
            }

            if (!string.IsNullOrWhiteSpace(ContentId))
            {
                writer.WriteAttributeString("ContentId", ContentId);
            }


            if (ToolTip != null && ToolTip is string)
            {
                if (!string.IsNullOrWhiteSpace((string)ToolTip))
                {
                    writer.WriteAttributeString("ToolTip", (string)ToolTip);
                }
            }

            if (FloatingLeft != 0.0)
            {
                writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingTop != 0.0)
            {
                writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingWidth != 0.0)
            {
                writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingHeight != 0.0)
            {
                writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture));
            }

            if (IsMaximized)
            {
                writer.WriteAttributeString("IsMaximized", IsMaximized.ToString());
            }
            if (!CanClose)
            {
                writer.WriteAttributeString("CanClose", CanClose.ToString());
            }
            if (!CanFloat)
            {
                writer.WriteAttributeString("CanFloat", CanFloat.ToString());
            }

            if (LastActivationTimeStamp != null)
            {
                writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (_previousContainer != null)
            {
                var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                if (paneSerializable != null)
                {
                    writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
                    writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString());
                }
            }
        }
示例#2
0
 public void WriteAttributeString(string name, string value)
 {
     _writer.WriteAttributeString(name, value);
 }
示例#3
0
 public override void WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("Orientation", Orientation.ToString());
     base.WriteXml(writer);
 }
示例#4
0
 public override void WriterAddAttribute(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("NActionID", NActionID);
     base.WriterAddAttribute(writer);
 }
示例#5
0
 public virtual void DumpTreeAttribs(System.Xml.XmlWriter xml)
 {
     xml.WriteAttributeString("name", _name);
     xml.WriteAttributeString("sourceFileName", _filePos.FileName);
     xml.WriteAttributeString("sourceStartPos", _filePos.Position.ToString());
 }
        public static void Write(System.Xml.XmlWriter writer, object element)
        {
            NotificationXmlElementAttribute elAttr = GetElementAttribute(element.GetType());

            // If it isn't an element attribute, don't write anything
            if (elAttr == null)
            {
                return;
            }

            writer.WriteStartElement(elAttr.Name);

            IEnumerable <PropertyInfo> properties = GetProperties(element.GetType());

            List <object> elements = new List <object>();
            object        content  = null;

            // Write the attributes first
            foreach (PropertyInfo p in properties)
            {
                IEnumerable <Attribute> attributes = GetCustomAttributes(p);

                NotificationXmlAttributeAttribute attr = attributes.OfType <NotificationXmlAttributeAttribute>().FirstOrDefault();

                object propertyValue = GetPropertyValue(p, element);

                // If it's an attribute
                if (attr != null)
                {
                    object defaultValue = attr.DefaultValue;

                    // If the value is not the default value (and it's not null) we'll write it
                    if (!object.Equals(propertyValue, defaultValue) && propertyValue != null)
                    {
                        writer.WriteAttributeString(attr.Name, PropertyValueToString(propertyValue));
                    }
                }

                // If it's a content attribute
                else if (attributes.OfType <NotificationXmlContentAttribute>().Any())
                {
                    content = propertyValue;
                }

                // Otherwise it's an element or collection of elements
                else
                {
                    if (propertyValue != null)
                    {
                        elements.Add(propertyValue);
                    }
                }
            }

            // Then write children
            foreach (object el in elements)
            {
                // If it's a collection of children
                if (el is IEnumerable)
                {
                    foreach (object child in el as IEnumerable)
                    {
                        Write(writer, child);
                    }

                    continue;
                }

                // Otherwise just write the single element
                Write(writer, el);
            }

            // Then write any content if there is content
            if (content != null)
            {
                string contentString = content.ToString();
                if (!string.IsNullOrWhiteSpace(contentString))
                {
                    writer.WriteString(contentString);
                }
            }

            writer.WriteEndElement();
        }
示例#7
0
 void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("Type", TypeName != null ? TypeName.AssemblyQualifiedName : "");
     writer.WriteAttributeString("Version", Version.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-US")));
 }
示例#8
0
 public override void DumpTreeInner(System.Xml.XmlWriter xml)
 {
     xml.WriteAttributeString("text", _text);
     base.DumpTreeInner(xml);
 }
示例#9
0
 void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("AssemblyQualifiedName", AssemblyQualifiedName);
 }
示例#10
0
 public override void WriteXml(System.Xml.XmlWriter writer)
 {
     base.WriteXml(writer);
     writer.WriteAttributeString("Algorithm", Algorithm.Method.Name);
 }
示例#11
0
 /// <summary>
 /// Writes GameObject specific attributes to the Xml writer.
 /// </summary>
 /// <param name="writer">An XmlWriter to write attributes to.</param>
 public virtual void WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("coordsX", this.coords.X.ToString());
     writer.WriteAttributeString("coordsY", this.coords.Y.ToString());
 }
示例#12
0
 public override void WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("type", this.GetType().GetTraceLabQualifiedName());
     writer.WriteAttributeString("Label", Label);
 }
示例#13
0
        public static void ExportToXML <T>(System.Xml.XmlWriter writer, IList <T> objects, Siaqodb siaqodb)
        {
            SqoTypeInfo ti = siaqodb.GetSqoTypeInfo <T>();

            writer.WriteStartElement("SiaqodbObjects");

            writer.WriteStartElement("TypeDefinition");
            foreach (FieldSqoInfo fi in ti.Fields)
            {
                writer.WriteStartElement("member");
                writer.WriteAttributeString("type", fi.AttributeType.FullName);
                writer.WriteString(fi.Name);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteStartElement("objects");
            foreach (T obj in objects)
            {
                writer.WriteStartElement("object");
                ObjectInfo oi = MetaExtractor.GetObjectInfo(obj, ti, siaqodb.metaCache);
                foreach (FieldSqoInfo fi in ti.Fields)
                {
                    writer.WriteStartElement("memberValue");
                    Type typeElement = fi.AttributeType;
                    if (typeElement == typeof(char))
                    {
                        writer.WriteValue(oi.AtInfo[fi].ToString());
                    }
                    else if (typeElement == typeof(Guid))
                    {
                        writer.WriteValue(oi.AtInfo[fi].ToString());
                    }
                    else if (typeElement.IsEnum())
                    {
                        //writer.WriteValue(oi.AtInfo[fi]);
                        Type enumType = Enum.GetUnderlyingType(typeElement);

                        object realObject = Convertor.ChangeType(oi.AtInfo[fi], enumType);

                        writer.WriteValue(realObject);
                    }
                    else if (oi.AtInfo[fi] != null && oi.AtInfo[fi].GetType().IsEnum())
                    {
                        Type   enumType   = Enum.GetUnderlyingType(oi.AtInfo[fi].GetType());
                        object realObject = Convertor.ChangeType(oi.AtInfo[fi], enumType);
                        writer.WriteValue(realObject);
                    }
                    else
                    {
                        if (oi.AtInfo[fi] != null)
                        {
                            writer.WriteValue(oi.AtInfo[fi]);
                        }
                    }
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
示例#14
0
 public void WriteXmlAttributes(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("name", "" + name);
 }
示例#15
0
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            ANYFormatter anyFormatter = new ANYFormatter();

            anyFormatter.Graph(s, o, result);

            // Now graph the attributes
            Type   pivlType                  = o.GetType();
            object valueValue                = pivlType.GetProperty("Value").GetValue(o, null),
                   operatorValue             = pivlType.GetProperty("Operator").GetValue(o, null),
                   alignmentValue            = pivlType.GetProperty("Alignment").GetValue(o, null),
                   phaseValue                = pivlType.GetProperty("Phase").GetValue(o, null),
                   periodValue               = pivlType.GetProperty("Period").GetValue(o, null),
                   institutionSpecifiedValue = pivlType.GetProperty("InstitutionSpecified").GetValue(o, null),
                   countValue                = pivlType.GetProperty("Count").GetValue(o, null),
                   frequencyValue            = pivlType.GetProperty("Frequency").GetValue(o, null);

            // Append the attributes to the writer
            if ((o as ANY).NullFlavor != null)
            {
                return; // Nothing to report
            }
            if (valueValue != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Value", "PIVL", s.ToString()));
            }
            //s.WriteAttributeString("value", Util.ToWireFormat(valueValue));
            if (operatorValue != null)
            {
                s.WriteAttributeString("operator", Util.ToWireFormat(operatorValue));
            }
            if (alignmentValue != null)
            {
                s.WriteAttributeString("alignment", Util.ToWireFormat(alignmentValue));
            }
            if (institutionSpecifiedValue != null)
            {
                s.WriteAttributeString("institutionSpecified", Util.ToWireFormat(institutionSpecifiedValue));
            }

            if (countValue != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Count", "PIVL", s.ToString()));
            }

            // Write elements
            if (phaseValue != null)
            {
                s.WriteStartElement("phase", "urn:hl7-org:v3");
                Host.GraphObject(s, (IGraphable)phaseValue);
                s.WriteEndElement();
            }

            if (frequencyValue != null)
            {
                // JF - Frequency is not supported by UV R1
                if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian)
                {
                    s.WriteStartElement("frequency", "urn:hl7-org:v3");
                    var hostResult = this.Host.Graph(s, (IGraphable)frequencyValue);
                    result.AddResultDetail(hostResult.Details);
                    result.Code = hostResult.Code;
                    s.WriteEndElement();
                }
                else
                {
                    RTO <INT, PQ> rto = frequencyValue as RTO <INT, PQ>;
                    periodValue = rto.Denominator / rto.Numerator;
                    result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Frequency", "Period", periodValue, s.ToString()));
                    s.WriteStartElement("period", "urn:hl7-org:v3");
                    var hostResult = Host.Graph(s, (IGraphable)periodValue);
                    result.AddResultDetail(hostResult.Details);
                    result.Code = hostResult.Code;
                    s.WriteEndElement();
                }
            }
            else if (periodValue != null)
            {
                s.WriteStartElement("period", "urn:hl7-org:v3");
                var hostResult = Host.Graph(s, (IGraphable)periodValue);
                result.AddResultDetail(hostResult.Details);
                result.Code = hostResult.Code;
                s.WriteEndElement();
            }
        }
示例#16
0
 public override void DumpTreeInner(System.Xml.XmlWriter xml)
 {
     xml.WriteAttributeString("open", _open.ToString());
     base.DumpTreeInner(xml);
 }
示例#17
0
        private System.IO.MemoryStream WriteSettingsToMemoryStream(String AppServerURL, bool IncludeXMLDeclaration)
        {
            Trace.TraceInformation("Enter.");

            try
            {
                if (_Queues == null)
                {
                    Trace.TraceWarning("_Queues is null.");
                    return(null);
                }

                System.IO.Stream ms = new System.IO.MemoryStream();

                System.Xml.XmlWriterSettings _XMLSettings = new System.Xml.XmlWriterSettings();

                _XMLSettings.Indent             = true;
                _XMLSettings.OmitXmlDeclaration = !IncludeXMLDeclaration;

                System.Xml.XmlWriter _XMLWriter = System.Xml.XmlWriter.Create(ms, _XMLSettings);

                _XMLWriter.WriteStartDocument();

                _XMLWriter.WriteStartElement("callback");
                _XMLWriter.WriteStartElement("csqs");

                foreach (CallbackContactServiceQueue csq in _Queues)
                {
                    _XMLWriter.WriteStartElement("csq");
                    _XMLWriter.WriteAttributeString("name", csq.Name);

                    _XMLWriter.WriteStartElement("CallbackEnabled");
                    _XMLWriter.WriteValue(csq.CallbackEnabled.ToString());
                    _XMLWriter.WriteFullEndElement();//CallbackEnabled

                    if (csq.Profile != null)
                    {
                        _XMLWriter.WriteStartElement("CallerRecording");
                        _XMLWriter.WriteValue(csq.Profile.CallerRecording.ToString());
                        _XMLWriter.WriteFullEndElement();//CallerRecording

                        _XMLWriter.WriteStartElement("RetentionPeriod");
                        _XMLWriter.WriteValue(csq.Profile.RetentionPeriod.ToString());
                        _XMLWriter.WriteFullEndElement();//RetentionPeriod

                        _XMLWriter.WriteStartElement("AppServerURLPrefix");
                        _XMLWriter.WriteValue(AppServerURL);
                        _XMLWriter.WriteFullEndElement();//AppServerURLPrefix


                        _XMLWriter.WriteStartElement("EmailAlerts");
                        _XMLWriter.WriteValue(csq.Profile.EmailAlerts.ToString());
                        _XMLWriter.WriteFullEndElement();//EmailAlerts

                        _XMLWriter.WriteStartElement("AdminEmail");
                        _XMLWriter.WriteValue(csq.Profile.AdminEmail);
                        _XMLWriter.WriteFullEndElement();//AdminEmail

                        _XMLWriter.WriteStartElement("CallerIDVerify");
                        _XMLWriter.WriteValue(csq.Profile.CallerIDVerify);
                        _XMLWriter.WriteFullEndElement();//CallerIDVerify

                        _XMLWriter.WriteStartElement("AbandonCallback");
                        _XMLWriter.WriteValue(csq.Profile.AbandonCallback);
                        _XMLWriter.WriteFullEndElement();//AbandonCallback

                        _XMLWriter.WriteStartElement("AbandonCBMinQTime");
                        _XMLWriter.WriteValue(csq.Profile.AbandonCBMinQTime);
                        _XMLWriter.WriteFullEndElement();//AbandonCBMinQTime

                        _XMLWriter.WriteStartElement("AbandonCBMinInterCallTime");
                        _XMLWriter.WriteValue(csq.Profile.AbandonCBMinInterCallTime);
                        _XMLWriter.WriteFullEndElement();//AbandonCBMinInterCallTime

                        foreach (CallbackBackupCSQ bckCSQ in csq.Profile.BackupCSQs)
                        {
                            _XMLWriter.WriteStartElement("CBQueue");
                            _XMLWriter.WriteAttributeString("csq", bckCSQ.Name);
                            _XMLWriter.WriteAttributeString("overflowtime", bckCSQ.OverflowTime.ToString());
                            _XMLWriter.WriteFullEndElement();//CBQueue
                        }//foreach (CallbackBackupCSQ bckCSQ in csq.Profile.BackupCSQs)

                        _XMLWriter.WriteStartElement("AcceptCallbacksTimeframe");
                        _XMLWriter.WriteStartElement("Begin");
                        _XMLWriter.WriteValue(csq.Profile.AcceptCallbacksTimeframeBegin);
                        _XMLWriter.WriteFullEndElement();//Begin
                        _XMLWriter.WriteStartElement("End");
                        _XMLWriter.WriteValue(csq.Profile.AcceptCallbacksTimeframeEnd);
                        _XMLWriter.WriteFullEndElement(); //End
                        _XMLWriter.WriteFullEndElement(); //AcceptCallbacksTimeframe

                        _XMLWriter.WriteStartElement("CallbackOfferedAlgorithm");

                        foreach (CallbackAlgorithmFilter filter in csq.Profile.OfferedAlgorithmFilters)
                        {
                            _XMLWriter.WriteStartElement(filter.Name);
                            _XMLWriter.WriteAttributeString("Enabled", filter.Enabled.ToString());
                            _XMLWriter.WriteAttributeString("Operation", filter.Operation);
                            _XMLWriter.WriteAttributeString("Value", filter.Value.ToString());
                            _XMLWriter.WriteFullEndElement();
                        }//foreach (CallbackAlgorithmFilter filter in csq.Profile.OfferedAlgorithmFilters)

                        _XMLWriter.WriteFullEndElement();//CallbackOfferedAlgorithm

                        _XMLWriter.WriteStartElement("CallbackReentryAlgorithm");

                        foreach (CallbackAlgorithmFilter filter in csq.Profile.ReentryAlgorithmFilters)
                        {
                            _XMLWriter.WriteStartElement(filter.Name);
                            _XMLWriter.WriteAttributeString("Enabled", filter.Enabled.ToString());
                            _XMLWriter.WriteAttributeString("Operation", filter.Operation);
                            _XMLWriter.WriteAttributeString("Value", filter.Value.ToString());
                            _XMLWriter.WriteFullEndElement();
                        }//foreach (CallbackReentryAlgorithmFilter filter in csq.Profile.AlgorithmFilters)

                        _XMLWriter.WriteStartElement("CallbackProcessingTimeframe");
                        _XMLWriter.WriteStartElement("Begin");
                        _XMLWriter.WriteValue(csq.Profile.CallbackProcessingTimeframeBegin);
                        _XMLWriter.WriteFullEndElement();//Begin
                        _XMLWriter.WriteStartElement("End");
                        _XMLWriter.WriteValue(csq.Profile.CallbackProcessingTimeframeEnd);
                        _XMLWriter.WriteFullEndElement(); //End
                        _XMLWriter.WriteFullEndElement(); //CallbackProcessingTimeframe


                        _XMLWriter.WriteStartElement("EndOfDayPurgeCallbackRequests");
                        _XMLWriter.WriteValue(csq.Profile.EndOfDayPurgeCallbackRequests);
                        _XMLWriter.WriteFullEndElement(); //EndOfDayPurgeCallbackRequests

                        _XMLWriter.WriteFullEndElement(); //CallbackReentryAlgorithm
                    }

                    _XMLWriter.WriteFullEndElement();//CSQ
                }//foreach (CallbackContactServiceQueue csq in _Queues)

                _XMLWriter.WriteFullEndElement(); //csqs
                _XMLWriter.WriteFullEndElement(); //callback

                _XMLWriter.WriteEndDocument();

                _XMLWriter.Flush();
                _XMLWriter.Close();
                _XMLWriter = null;

                _XMLSettings = null;

                return((System.IO.MemoryStream)ms);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
                xmlDoc = null;
                return(null);
            }
        }
示例#18
0
 /// <summary>
 /// Serializa os dados.
 /// </summary>
 /// <param name="writer"></param>
 void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("All", _all.ToString());
     ((System.Xml.Serialization.IXmlSerializable)_query).WriteXml(writer);
 }
示例#19
0
        private string CreateHtmlReport()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<html>");
            sb.AppendLine("<head>");
            sb.AppendLine("<style>");
            sb.AppendLine("body { font-family: Verdana, Arial, Helvetica; font-size: 8pt; }");
            sb.AppendLine("h1 { font-size: 20pt; margin-bottom: 12pt; border-bottom: solid 1px lightblue;}");
            //sb.AppendLine("div.projectName { font-size: 12pt; }");
            sb.AppendLine("div.projectDescription { margin-top: 12pt; margin-bottom: 12pt; }");
            //sb.AppendLine("div.projectTimeContainer { margin-top: 12pt; }");
            sb.AppendLine("span.projectTimeLabel { font-weight: bold; }");
            sb.AppendLine("div.targetContainer { margin-top: 16pt; }");
            sb.AppendLine("div.targetSectionCaption { border-bottom: solid 1px lightblue; font-size: 12pt; font-weight: bold; margin-bottom: 4pt; }");
            sb.AppendLine("div.targetContents { margin-left: 10pt; }");
            sb.AppendLine("div.targetDescription { margin-top: 8pt; }");
            sb.AppendLine("div.targetPathContainer { margin-top: 12pt; }");
            sb.AppendLine("span.targetPathLabel { font-weight: bold; }");
            //sb.AppendLine("span.targetPath { }");
            //sb.AppendLine("div.testSectionCaption { border-bottom: solid 1px lightblue; font-size: 8pt; font-weight: bold; margin-top: 6pt; margin-bottom: 6pt; }");
            sb.AppendLine("table.testsTable { margin-top: 12pt; border: solid 1px silver; }");
            sb.AppendLine("table.testsTable td { border-bottom: solid 1px #E0E0E0; vertical-align: top; }");
            sb.AppendLine("thead { font-family: Verdana, Arial, Helvetica; font-size: 8pt; font-weight: bold; background-color: whitesmoke; }");
            sb.AppendLine("tbody { font-family: Verdana, Arial, Helvetica; font-size: 8pt; }");
            sb.AppendLine("</style>");
            sb.AppendLine("</head>");

            System.Xml.XmlWriterSettings xws = new System.Xml.XmlWriterSettings();
            xws.OmitXmlDeclaration = true;
            xws.Indent             = true;

            using (System.Xml.XmlWriter xw = System.Xml.XmlWriter.Create(sb, xws))
            {
                xw.WriteStartElement("body");

                // 1. Project display name
                xw.WriteStartElement("h1");
                //xw.WriteAttributeString("class", "projectName");
                xw.WriteString(project.DisplayName);
                xw.WriteEndElement(); // h1

                // 2. Project description
                if (!string.IsNullOrEmpty(project.Description))
                {
                    xw.WriteStartElement("div");
                    xw.WriteAttributeString("class", "projectDescription");
                    xw.WriteString(project.Description);
                    xw.WriteEndElement(); // div
                }

                // 3. Test start and end times
                xw.WriteStartElement("div");
                xw.WriteAttributeString("class", "projectTimeContainer");
                xw.WriteStartElement("span");
                xw.WriteAttributeString("class", "projectTimeLabel");
                xw.WriteString("Tests started: ");
                xw.WriteEndElement(); // span
                xw.WriteStartElement("span");
                xw.WriteAttributeString("class", "projectTime");
                xw.WriteString(timeTestsStarted.ToString());
                xw.WriteEndElement(); // span
                xw.WriteEndElement(); // div

                xw.WriteStartElement("div");
                xw.WriteAttributeString("class", "projectTimeContainer");
                xw.WriteStartElement("span");
                xw.WriteAttributeString("class", "projectTimeLabel");
                xw.WriteString("Tests finished: ");
                xw.WriteEndElement(); // span
                xw.WriteStartElement("span");
                xw.WriteAttributeString("class", "projectTime");
                xw.WriteString(timeTestsCompleted.ToString());
                xw.WriteEndElement(); // span
                xw.WriteEndElement(); // div

                // 4. Targets
                Document.Target target;
                TargetControl   targetControl;

                foreach (Control ctl in targetsPanel.Controls)
                {
                    //if (!(ctl is TargetControl)) break;

                    targetControl = ctl as TargetControl;
                    target        = targetControl.Target;

                    xw.WriteStartElement("div");
                    xw.WriteAttributeString("class", "targetContainer");

                    // 4.1 Name
                    xw.WriteStartElement("div");
                    xw.WriteAttributeString("class", "targetSectionCaption");
                    xw.WriteString(target.DisplayName);
                    xw.WriteEndElement(); // div

                    xw.WriteStartElement("div");
                    xw.WriteAttributeString("class", "targetContents");

                    // 4.2 Path
                    xw.WriteStartElement("div");
                    xw.WriteAttributeString("class", "targetPathContainer");

                    xw.WriteStartElement("span");
                    xw.WriteAttributeString("class", "targetPathLabel");
                    xw.WriteString("Path: ");
                    xw.WriteEndElement(); // div.targetPathLabel

                    xw.WriteStartElement("span");
                    xw.WriteAttributeString("class", "targetPath");
                    xw.WriteString(target.Path);
                    xw.WriteEndElement(); // div.targetPath

                    xw.WriteEndElement(); // div.targetPathContainer

                    // 4.3 Description
                    if (!string.IsNullOrEmpty(target.Description))
                    {
                        xw.WriteStartElement("div");
                        xw.WriteAttributeString("class", "targetDescription");
                        xw.WriteString(target.Description);
                        xw.WriteEndElement(); // div.targetDescription
                    }

                    // 4.4 Tests
                    if (target.AutomatedTests.Count != 0)
                    {
                        xw.WriteStartElement("table");
                        xw.WriteAttributeString("class", "testsTable");
                        xw.WriteAttributeString("cellspacing", "0");
                        xw.WriteAttributeString("cellpadding", "3");

                        xw.WriteStartElement("thead");
                        xw.WriteStartElement("tr");

                        xw.WriteStartElement("td");
                        xw.WriteAttributeString("style", "width: 20px");
                        xw.WriteRaw("&nbsp;");
                        xw.WriteEndElement(); // td

                        xw.WriteStartElement("td");
                        //xw.WriteAttributeString("style", "width: 20px");
                        xw.WriteString("Test");
                        xw.WriteEndElement(); // td

                        xw.WriteStartElement("td");
                        //xw.WriteAttributeString("style", "width: 20px");
                        xw.WriteString("Message");
                        xw.WriteEndElement(); // td

                        xw.WriteEndElement(); // tr
                        xw.WriteEndElement(); // thead

                        xw.WriteStartElement("tbody");

                        //TargetControl tctl = ctl as TargetControl;
                        foreach (Control ctl2 in targetControl.automatedTestsPanel.Controls)
                        {
                            if (ctl2 is AutomatedTestControl)
                            {
                                AutomatedTestControl actl = ctl2 as AutomatedTestControl;
                                xw.WriteStartElement("tr");

                                xw.WriteStartElement("td");
                                xw.WriteStartElement("img");
                                xw.WriteAttributeString("src", System.IO.Path.Combine(GetReportArtworkFolderPath(), actl.StatusImageFileName));
                                xw.WriteEndElement(); // img
                                xw.WriteEndElement(); // td

                                xw.WriteElementString("td", actl.AutomatedTest.DisplayName);
                                xw.WriteElementString("td", actl.FinalStatusMessage);
                                xw.WriteEndElement(); // tr
                            }
                        }

                        xw.WriteEndElement(); // tbody
                        xw.WriteEndElement(); // table.testsTable
                    }

                    //
                    xw.WriteEndElement(); // div.targetContents
                    xw.WriteEndElement(); // div.targetContainer
                }

                // body
                xw.WriteEndElement(); // body
            }

            sb.AppendLine();
            sb.AppendLine("</html>");

            return(sb.ToString());
        }
示例#20
0
 public void WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString(TreeAttributes.nodeID.ToString(), this.m_nodeID);
     writer.WriteAttributeString(TreeAttributes.text.ToString(), this.m_text);
     writer.WriteAttributeString(TreeAttributes.iconClass.ToString(), this.m_iconClass);
     writer.WriteAttributeString(TreeAttributes.action.ToString(), this.m_action);
     writer.WriteAttributeString(TreeAttributes.menu.ToString(), (this.m_menu != null && this.m_menu.Count > 0 ? umbraco.BusinessLogic.Actions.Action.ToString(this.m_menu) : ""));
     writer.WriteAttributeString(TreeAttributes.rootSrc.ToString(), this.m_rootSrc);
     writer.WriteAttributeString(TreeAttributes.src.ToString(), this.m_src);
     writer.WriteAttributeString(TreeAttributes.icon.ToString(), this.m_icon);
     writer.WriteAttributeString(TreeAttributes.openIcon.ToString(), this.m_openIcon);
     writer.WriteAttributeString(TreeAttributes.nodeType.ToString(), this.m_nodeType);
     writer.WriteAttributeString(TreeAttributes.hasChildren.ToString(), HasChildren.ToString().ToLower());
     if (m_notPublished.HasValue)
     {
         writer.WriteAttributeString(TreeAttributes.notPublished.ToString(), this.m_notPublished.Value.ToString().ToLower());
     }
     if (m_isProtected.HasValue)
     {
         writer.WriteAttributeString(TreeAttributes.isProtected.ToString(), this.m_isProtected.Value.ToString().ToLower());
     }
 }
示例#21
0
 /// <summary>
 /// <see cref="Field.ExportContent"/>
 /// </summary>
 protected override void ExportContent(System.Xml.XmlWriter w)
 {
     w.WriteAttributeString("value", this.value.ToString());
 }
示例#22
0
 /// <summary>
 /// Converts an object into its XML representation.
 /// </summary>
 /// <param name="writer">
 /// The <see cref="T:System.Xml.XmlWriter"></see> stream
 /// to which the object is serialized.
 /// </param>
 public override void WriteXml(System.Xml.XmlWriter writer)
 {
     base.WriteXml(writer);
     writer.WriteAttributeString("bindingId", _bindingId);
 }
示例#23
0
        private static void LargeDataToXML(
            string table_schema
            , string table_name
            , System.Xml.XmlWriter writer
            , System.Data.IDataReader dr)
        {
            writer.WriteStartDocument(true);
            writer.WriteStartElement("table");
            // writer.WriteStartElement(table_name);
            writer.WriteAttributeString(null, "table_schema", null, table_schema);
            writer.WriteAttributeString(null, "table_name", null, table_name);

            writer.WriteAttributeString("xmlns", "xsi", null, System.Xml.Schema.XmlSchema.InstanceNamespace);
            // writer.WriteAttributeString("xsi", "schemaLocation", null, System.Xml.Schema.XmlSchema.InstanceNamespace);

            int fc = dr.FieldCount;

            string[]      columnNames = new string[fc];
            System.Type[] columnTypes = new System.Type[fc];

            for (int i = 0; i < dr.FieldCount; ++i)
            {
                columnNames[i] = dr.GetName(i);
                columnTypes[i] = dr.GetFieldType(i);
            } // Next i

            while (dr.Read())
            {
                writer.WriteStartElement("row");

                for (int i = 0; i < fc; ++i)
                {
                    writer.WriteStartElement(columnNames[i]);
                    object obj = dr.GetValue(i);

                    if (obj != System.DBNull.Value)
                    {
                        if (object.ReferenceEquals(columnTypes[i], typeof(System.DateTime)))
                        {
                            System.DateTime dt = (System.DateTime)obj;
                            writer.WriteValue(dt.ToString("yyyy-MM-dd'T'HH':'mm':'ss'.'fff",
                                                          System.Globalization.CultureInfo.InvariantCulture));
                        }
                        else
                        {
                            writer.WriteValue(System.Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture));
                        }
                    }
                    else
                    {
                        writer.WriteAttributeString("xsi", "nil", System.Xml.Schema.XmlSchema.InstanceNamespace, "true");
                    }

                    writer.WriteEndElement();
                } // Next i

                writer.WriteEndElement();
            } // Whend

            writer.WriteEndElement();
        } // End Sub LargeDataToXML
示例#24
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (PaletteColors.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("paletteColors", PaletteColors);
            }
            if (ShowPlotBorder.HasValue)
            {
                writer.WriteAttributeString("showPlotBorder", ShowPlotBorder.GetHashCode().ToString());
            }
            if (PlotBorderColor.HasValue)
            {
                writer.WriteAttributeString("plotBorderColor", PlotBorderColor.Value.ToHexString());
            }
            if (PlotBorderThickness.HasValue)
            {
                writer.WriteAttributeString("plotBorderThickness", PlotBorderThickness.ToString());
            }
            if (PlotBorderAlpha.HasValue)
            {
                writer.WriteAttributeString("plotBorderAlpha", PlotBorderAlpha.ToString());
            }
            if (PlotFillAlpha.HasValue)
            {
                writer.WriteAttributeString("plotFillAlpha", PlotFillAlpha.ToString());
            }
            if (PlotFillColor.HasValue)
            {
                writer.WriteAttributeString("plotFillColor", PlotFillColor.Value.ToHexString());
            }
            if (PieRadius.HasValue)
            {
                writer.WriteAttributeString("pieRadius", PieRadius.ToString());
            }

            if (PieFillAlpha.HasValue)
            {
                writer.WriteAttributeString("PieFillAlpha", PieFillAlpha.ToString());
            }
            if (PieBorderThickness.HasValue)
            {
                writer.WriteAttributeString("PieBorderThickness", PieBorderThickness.ToString());
            }
            if (HoverFillColor.HasValue)
            {
                writer.WriteAttributeString("HoverFillColor", HoverFillColor.Value.ToHexString());
            }
            if (PieBorderColor.HasValue)
            {
                writer.WriteAttributeString("PieBorderColor", PieBorderColor.Value.ToHexString());
            }
            if (UseHoverColor.HasValue)
            {
                writer.WriteAttributeString("useHoverColor", UseHoverColor.GetHashCode().ToString());
            }
        }
示例#25
0
 /// <summary>
 /// Converte o objeto em XML
 /// </summary>
 /// <param name="writer">Objeto a ser escrito</param>
 public void WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("Name", this.Name);
 }
示例#26
0
        public override void WriteToXML(System.Xml.XmlWriter writer, object obj)
        {
            XHeightMap heightmap = (XHeightMap)obj;

            writer.WriteStartElement("sceneitem");
            writer.WriteAttributeString("Type", this.type.ToString());
            writer.WriteAttributeString("AutoDraw", heightmap.AutoDraw.ToString());
            writer.WriteAttributeString("BTexture", heightmap.BTexture);
            writer.WriteAttributeString("ComponentID", heightmap.ComponentID.ToString());
            writer.WriteAttributeString("DrawOrder", heightmap.DrawOrder.ToString());
            writer.WriteAttributeString("GTexture", heightmap.GTexture);
            writer.WriteAttributeString("HeightMap", heightmap.HeightMap);
            writer.WriteAttributeString("Name", heightmap.Name);
            writer.WriteAttributeString("Params", heightmap.Params.ComponentID.ToString());
            writer.WriteAttributeString("RTexture", heightmap.RTexture);
            writer.WriteAttributeString("TextureMap", heightmap.TextureMap);

            writer.WriteEndElement();
        }
示例#27
0
        public override void WriteParams(System.Xml.XmlWriter writer, Dictionary <HavokClassNode, int> classNodes)
        {
            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "name");
            writer.WriteString(Name);
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "parent");
            writer.WriteString(_parent is HavokClassNode ? HavokXML.GetObjectName(classNodes, _parent as HavokClassNode) : "null");
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "objectSize");
            writer.WriteString(Size.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "numImplementedInterfaces");
            writer.WriteString(InterfaceCount.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            ResourceNode enums = FindChild("Enums", false);

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "declaredEnums");
            writer.WriteAttributeString("numelements", enums == null ? "0" : enums.Children.Count.ToString());
            {
                if (enums != null)
                {
                    foreach (hkClassEnumNode e in enums.Children)
                    {
                        e.WriteParams(writer, classNodes);
                    }
                }
            }
            writer.WriteEndElement();

            ResourceNode members = FindChild("Members", false);

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "declaredMembers");
            writer.WriteAttributeString("numelements", members == null ? "0" : members.Children.Count.ToString());
            {
                if (members != null)
                {
                    foreach (hkClassMemberNode e in members.Children)
                    {
                        e.WriteParams(writer, classNodes);
                    }
                }
            }
            writer.WriteEndElement();

            writer.WriteComment(" defaults SERIALIZE_IGNORED ");
            writer.WriteComment(" attributes SERIALIZE_IGNORED ");

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "flags");
            writer.WriteString(Flags.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "describedVersion");
            writer.WriteString(Version.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();
        }
示例#28
0
        public void WriteXml(System.Xml.XmlWriter writer)
        {
            lock (SERIALIZE_LOCK)
            {
                // Initialization
                if (XmlExportFrameNumbersAsFilenames &&
                    (XmlExportFilenamePrefix == null ||
                     XmlExportFilenameSuffix == null) &&
                    XmlExportFrameFileList == null)
                {
                    throw new InvalidOperationException(
                              "Trying to serialize skeleton to xml for a file without providing file information.");
                }
                String exportFormatString = "d";
                if (XmlExportFrameNumbersAsFilenames && XmlExportFrames != null &&
                    XmlExportFrameFileList == null)
                {
                    XmlExportFrames.Sort();
                    int max        = XmlExportFrames[XmlExportFrames.Count - 1];
                    int characters = (int)Math.Ceiling(Math.Log10(max));
                    exportFormatString = "d" + characters;
                }

                XmlSerializer valueSerializer = new XmlSerializer(typeof(JointDictionary));


                // Export
                // Write the data type.
                writer.WriteAttributeString(__3DDataAttributeName, Is3DData.ToString());

                // Write the data.
                foreach (int key in this.Keys)
                {
                    if (XmlExportFrames == null && XmlExportFrameFileList == null ||
                        (XmlExportFrames != null && XmlExportFrames.Contains(key)) ||
                        (XmlExportFrameFileList != null && XmlExportFrameFileList.ContainsKey(key)))
                    {
                        writer.WriteStartElement("annotation");

                        if (XmlExportFrameNumbersAsFilenames ||
                            XmlExportFrameFileList != null)
                        {
                            writer.WriteStartElement("image");
                            writer.WriteStartElement("name");
                            if (XmlExportFrameFileList != null)
                            {
                                writer.WriteString(XmlExportFrameFileList[key]);
                            }
                            else
                            {
                                writer.WriteString(
                                    Path.Combine(XmlExportFilenamePrefix,
                                                 key.ToString(exportFormatString) + XmlExportFilenameSuffix));
                            }
                            writer.WriteEndElement();
                            writer.WriteEndElement();
                        }
                        else
                        {
                            writer.WriteStartElement("frame-number");
                            writer.WriteString(key.ToString());
                            writer.WriteEndElement();
                        }

                        if (!XmlOmitPoints)
                        {
                            foreach (int user in this[key].Keys)
                            {
                                writer.WriteStartElement("annorect");
                                writer.WriteAttributeString("UserID", user.ToString());

                                JointDictionary joints = this[key][user];
                                valueSerializer.Serialize(writer, joints);
                                writer.WriteEndElement();
                            }
                        }

                        writer.WriteEndElement();
                    }
                }
            }
        }
示例#29
0
 public override void WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("type", this.GetType().GetTraceLabQualifiedName());
     writer.WriteAttributeString("Label", Label);
     writer.WriteAttributeString("WaitsForAllPredecessors", WaitsForAllPredecessors.ToString());
 }
示例#30
0
        void IXmlExportable.ToXml(XmlWriter writer)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");

            if (this.Count == 0)
            {
                return;
            }

            //
            // Write out a named multi-value collection as follows
            // (example here is the ServerVariables collection):
            //
            //      <item name="HTTP_URL">
            //          <value string="/myapp/somewhere/page.aspx" />
            //      </item>
            //      <item name="QUERY_STRING">
            //          <value string="a=1&amp;b=2" />
            //      </item>
            //      ...
            //

            foreach (string key in this.Keys)
            {
                writer.WriteStartElement("item");
                writer.WriteAttributeString("name", key);

                string[] values = GetValues(key);

                if (values != null)
                {
                    foreach (string value in values)
                    {
                        writer.WriteStartElement("value");
                        writer.WriteAttributeString("string", value);
                        writer.WriteEndElement();
                    }
                }

                writer.WriteEndElement();
            }
        }
示例#31
0
		public virtual void WriteXml (System.Xml.XmlWriter writer)
		{
			foreach (PropertyInfo pi in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
				if (pi.GetSetMethod () == null)
					continue;

				bool isAttribute = false;
				bool hasDefaultValue = false;
				bool ignore = false;
				string name = "";
				object value = null;
				Type valueType = null;


				MemberInfo mi = pi.GetGetMethod ();

				if (mi == null)
					continue;

				value = pi.GetValue (this, null);
				valueType = pi.PropertyType;
				name = pi.Name;



				object[] att = pi.GetCustomAttributes (false);

				foreach (object o in att) {
					XmlAttributeAttribute xaa = o as XmlAttributeAttribute;
					if (xaa != null) {
						isAttribute = true;
						if (string.IsNullOrEmpty (xaa.AttributeName))
							name = pi.Name;
						else
							name = xaa.AttributeName;
						continue;
					}

					XmlIgnoreAttribute xia = o as XmlIgnoreAttribute;
					if (xia != null) {
						ignore = true;
						continue;
					}

					DefaultValueAttribute dv = o as DefaultValueAttribute;
					if (dv != null) {
						if (dv.Value.Equals (value))
							hasDefaultValue = true;
						if (dv.Value.ToString () == value.ToString ())
							hasDefaultValue = true;

						continue;
					}


				}

				if (hasDefaultValue || ignore || value==null)
					continue;

				if (isAttribute)
					writer.WriteAttributeString (name, value.ToString ());
				else {
					if (valueType.GetInterface ("IXmlSerializable") == null)
						continue;

					(pi.GetValue (this, null) as IXmlSerializable).WriteXml (writer);
				}
			}
			foreach (EventInfo ei in this.GetType().GetEvents()) {
				FieldInfo fi = this.GetType().GetField(ei.Name,
					BindingFlags.NonPublic |
					BindingFlags.Instance |
					BindingFlags.GetField);

				Delegate dg = (System.Delegate)fi.GetValue (this);

				if (dg == null)
					continue;

				foreach (Delegate d in dg.GetInvocationList()) {
					if (!d.Method.Name.StartsWith ("<"))//Skipping empty handler, not clear it's trikky
						writer.WriteAttributeString (ei.Name, d.Method.Name);
				}
			}
		}