Beispiel #1
0
        public override string Read(Serialization.ISerializer serializer)
        {
            if (serializer.GetType() == typeof(Arch.CFramework.AppInternals.Serialization.XMLSerializer))
            {
                XmlDocument xml = new XmlDocument();
                xml.AppendChild(xml.CreateXmlDeclaration("1.0", Encoding.UTF8.BodyName, null));
                var node = xml.CreateElement("HealthCheck");
                xml.AppendChild(node);
                var node1 = xml.CreateElement("Healthies");
                node.AppendChild(node1);
                foreach (var hcb in list.ToList())
                {
                    var n = xml.CreateElement(hcb.GetType().Name);
                    node1.AppendChild(n);
                    var n1 = xml.CreateElement("IsHealthy");
                    n1.InnerText = hcb.Healthy.IsHealthy.ToString();
                    n.AppendChild(n1);
                    n1 = xml.CreateElement("Message");
                    n1.InnerText = hcb.Healthy.Message;
                    n.AppendChild(n1);
                    n1 = xml.CreateElement("Error");
                    if (hcb.Healthy.Error != null)
                        n1.InnerText = hcb.Healthy.Error.ToString();
                    else
                        n1.InnerText = string.Empty;
                    n.AppendChild(n1);
                }

                return xml.OuterXml;
            }
            return base.Read(serializer);
        }
Beispiel #2
0
 public override string Read(Serialization.ISerializer serializer)
 {
     Guard.ArgumentNotNull(serializer, "serializer");
     if (serializer.GetType().Name.ToLowerInvariant() == "htmlserializer")
     {
         return "{\"Message\":\"" + this.Message + "\",\"IsSuccess\":\"" + this.IsSuccess + "\"}";
     }
     return base.Read(serializer);
 }