/// <summary>
        /// Deserializes an XML representation of a <see cref="Microsoft.MetadirectoryServices.CSEntryChange">CSEntryChange</see>
        /// </summary>
        /// <param name="element">An <c ref="System.Linq.Xml.XElement">XElement</c> containing a cs-entry element</param>
        /// <returns>a <see cref="Microsoft.MetadirectoryServices.CSEntryChange">CSEntryChange</see> object</returns>
        public static CSEntryChange Deserialize(XElement element)
        {
            CSEntryChange csentry = CSEntryChange.Create();

            CSEntryChangeDeserializer.Deserialize(element, csentry);
            return(csentry);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the queue from the specified file
        /// </summary>
        /// <param name="filename">The name of the file</param>
        public static void LoadQueue(string filename)
        {
            lock (CSEntryChangeQueue.queue)
            {
                CSEntryChangeQueue.queue.Clear();

                foreach (CSEntryChange csentry in CSEntryChangeDeserializer.Deserialize(filename))
                {
                    CSEntryChangeQueue.Add(csentry);
                }
            }
        }
        /// <summary>
        /// Deserializes a file into a list of <see cref="Microsoft.MetadirectoryServices.CSEntryChange">CSEntryChange</see> objects
        /// </summary>
        /// <param name="file">The file of <see ref="Microsoft.MetadirectoryServices.CSEntryChange">CSEntryChanges</see> to deserialize</param>
        /// <returns>A list of <see cref="Microsoft.MetadirectoryServices.CSEntryChange">CSEntryChanges</see></returns>
        public static IList <CSEntryChange> Deserialize(string file)
        {
            List <CSEntryChange> csentries = new List <CSEntryChange>();

            using (StreamReader r = new StreamReader(file))
            {
                using (XmlReader reader = XmlReader.Create(r))
                {
                    XDocument doc = XDocument.Load(reader);

                    foreach (XElement node in doc.Root.Elements("object-change"))
                    {
                        CSEntryChange csentry = CSEntryChangeDeserializer.Deserialize(node);
                        csentries.Add(csentry);
                    }

                    reader.Close();
                }
                return(csentries);
            }
        }