Beispiel #1
0
        public void SaveContext(IStructuredWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            using (ISharedDictionaryWriter dw = _dic.RegisterWriter(writer))
            {
                XmlWriter w = writer.Xml;
                w.WriteStartElement("CKContext");
                writer.WriteInlineObjectStructuredElement("RequirementLayer", _reqLayer);
                dw.WritePluginsDataElement("PluginData", _proxifiedContext);
                w.WriteEndElement();
            }
        }
Beispiel #2
0
 public static void Write(string testName, string path, ISharedDictionary dic, object o, Action <XmlDocument> afterWrite)
 {
     using (Stream wrt = new FileStream(path, FileMode.Create))
     {
         using (IStructuredWriter sw = SimpleStructuredWriter.CreateWriter(wrt, ServiceProvider))
         {
             using (ISharedDictionaryWriter w = dic.RegisterWriter(sw))
             {
                 w.WritePluginsDataElement(testName, o);
             }
         }
     }
     if (afterWrite != null)
     {
         XmlDocument d = new XmlDocument();
         d.Load(path);
         afterWrite(d);
         d.Save(path);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Writes plugins data for an object.
 /// Even if no data exists, the element is written as an empty &lt;<paramref name="elemenName"/> /&gt; element.
 /// </summary>
 /// <param name="w">This <see cref="ISharedDictionaryWriter"/> object.</param>
 /// <param name="elementName">Name of the element that will contain the configuration.</param>
 /// <param name="o">Object for which configuration must be written.</param>
 /// <returns>The number of plugins for which data has been written.</returns>
 static public int WritePluginsDataElement(this ISharedDictionaryWriter w, string elementName, object o)
 {
     return(w.WritePluginsDataElement(elementName, o, false));
 }