Ejemplo n.º 1
0
        DataCollection ICustomDataItem.Serialize(ITypeSerializer handler)
        {
            if (policies == null)
            {
                return(null);
            }

            DataCollection dc = new DataCollection();

            foreach (KeyValuePair <PolicyKey, object> p in policies)
            {
                dc.Add(PolicyService.DiffSerialize(p.Key.PolicyType, p.Value, p.Key.Scope));
            }
            return(dc);
        }
Ejemplo n.º 2
0
        internal void SaveToFile(StreamWriter writer)
        {
            XmlWriterSettings xws = new XmlWriterSettings();

            xws.Indent = true;
            XmlConfigurationWriter cw = new XmlConfigurationWriter();

            cw.StoreAllInElements       = true;
            cw.StoreInElementExceptions = new String[] { "scope", "inheritsSet", "inheritsScope" };
            using (XmlWriter xw = XmlTextWriter.Create(writer, xws)) {
                xw.WriteStartElement("PolicySet");
                if (policies != null)
                {
                    foreach (KeyValuePair <PolicyKey, object> policyPair in policies)
                    {
                        cw.Write(xw, PolicyService.DiffSerialize(policyPair.Key.PolicyType, policyPair.Value, policyPair.Key.Scope));
                    }
                }
                xw.WriteEndElement();
            }
        }
Ejemplo n.º 3
0
        internal void SaveToXml(XmlWriter xw)
        {
            XmlConfigurationWriter cw = new XmlConfigurationWriter();

            cw.StoreAllInElements       = true;
            cw.StoreInElementExceptions = new String[] { "scope", "inheritsSet", "inheritsScope" };
            xw.WriteStartElement("PolicySet");
            if (!string.IsNullOrEmpty(Name))
            {
                xw.WriteAttributeString("name", Name);
            }
            if (!string.IsNullOrEmpty(Id))
            {
                xw.WriteAttributeString("id", Id);
            }
            if (policies != null)
            {
                foreach (KeyValuePair <PolicyKey, object> policyPair in policies)
                {
                    cw.Write(xw, PolicyService.DiffSerialize(policyPair.Key.PolicyType, policyPair.Value, policyPair.Key.Scope));
                }
            }
            xw.WriteEndElement();
        }