示例#1
0
            private Writer(XmlTextWriter xtw, IEnumerable <KeyValuePair <IManager, SerializationData> > managerInfo)
            {
                xtw.Formatting = Formatting.Indented;
                xtw.WriteStartDocument();
                xtw.WriteComment("AUTOMATICALLY GENERATED - DO NOT EDIT THIS FILE");

                this.currentDoc = new XElement(
                    "Miyagi",
                    new XAttribute("Version", Assembly.GetExecutingAssembly().GetName().Version.ToString()));
                this.redirects = new XElement("Redirects");

                foreach (var managerData in managerInfo)
                {
                    if (managerData.Value.HasData)
                    {
                        var managerElement     = new XElement("Manager", new XAttribute("Type", managerData.Key.Type));
                        SerializationData data = managerData.Value;
                        if (data.HasData)
                        {
                            foreach (var entry in data.Where(entry => entry.Value != null))
                            {
                                this.AddObjectToXmlDoc(managerElement, entry.Value, entry.Key);
                            }
                        }

                        this.currentDoc.Add(managerElement);
                    }
                }

                this.currentDoc.Add(this.redirects);
                this.currentDoc.WriteTo(xtw);
            }
示例#2
0
            private void ReadManagers()
            {
                foreach (var managerElement in this.currentDoc.Descendants("Manager"))
                {
                    string managerType = managerElement.Attribute("Type").Value;
                    var    data        = new SerializationData();
                    var    manager     = this.system.GetManager(managerType);

                    foreach (var element in managerElement.Elements())
                    {
                        data.Add(element.Name.ToString(), this.GetObjectFromXmlDoc(element, manager));
                    }

                    manager.LoadSerializationData(data);
                }
            }
 void IManager.SaveSerializationData(SerializationData info)
 {
 }
 void IManager.LoadSerializationData(SerializationData data)
 {
 }