public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType)
        {
            XPathNavigator xPathNavigator = new XPathDocument(new StringReader(ass.text)).CreateNavigator();

            xPathNavigator.MoveToFirst();
            xPathNavigator.MoveToFirstChild();
            foreach (XPathNavigator item2 in xPathNavigator.Select("Node"))
            {
                try
                {
                    TextReader  textReader  = new StringReader(item2.OuterXml);
                    DiaNodeMold diaNodeMold = (DiaNodeMold) new XmlSerializer(typeof(DiaNodeMold)).Deserialize(textReader);
                    diaNodeMold.nodeType = NodesType;
                    NodeListToFill.Add(diaNodeMold);
                    textReader.Dispose();
                }
                catch (Exception ex)
                {
                    Log.Message("Exception deserializing " + item2.OuterXml + ":\n" + ex.InnerException);
                }
            }
            foreach (XPathNavigator item3 in xPathNavigator.Select("NodeList"))
            {
                try
                {
                    TextReader  textReader2 = new StringReader(item3.OuterXml);
                    DiaNodeList item        = (DiaNodeList) new XmlSerializer(typeof(DiaNodeList)).Deserialize(textReader2);
                    ListListToFill.Add(item);
                }
                catch (Exception ex2)
                {
                    Log.Message("Exception deserializing " + item3.OuterXml + ":\n" + ex2.InnerException);
                }
            }
        }
		public DiaOption(DiaOptionMold def)
		{
			this.text = def.Text;
			DiaNodeMold diaNodeMold = def.RandomLinkNode();
			if (diaNodeMold != null)
			{
				this.link = new DiaNode(diaNodeMold);
			}
		}
 private static void RecursiveSetIsRootFalse(DiaNodeMold d)
 {
     foreach (DiaOptionMold current in d.optionList)
     {
         foreach (DiaNodeMold current2 in current.ChildNodes)
         {
             current2.isRoot = false;
             LayerLoader.RecursiveSetIsRootFalse(current2);
         }
     }
 }
 private static void RecursiveSetIsRootFalse(DiaNodeMold d)
 {
     foreach (DiaOptionMold diaOptionMold in d.optionList)
     {
         foreach (DiaNodeMold diaNodeMold in diaOptionMold.ChildNodes)
         {
             diaNodeMold.isRoot = false;
             LayerLoader.RecursiveSetIsRootFalse(diaNodeMold);
         }
     }
 }
 private static void RecursiveSetIsRootFalse(DiaNodeMold d)
 {
     foreach (DiaOptionMold option in d.optionList)
     {
         foreach (DiaNodeMold childNode in option.ChildNodes)
         {
             childNode.isRoot = false;
             LayerLoader.RecursiveSetIsRootFalse(childNode);
         }
     }
 }
        public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType)
        {
            TextReader     textReader     = new StringReader(ass.text);
            XPathDocument  xPathDocument  = new XPathDocument(textReader);
            XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();

            xPathNavigator.MoveToFirst();
            xPathNavigator.MoveToFirstChild();
            foreach (XPathNavigator xPathNavigator2 in xPathNavigator.Select("Node"))
            {
                try
                {
                    TextReader    textReader2   = new StringReader(xPathNavigator2.OuterXml);
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(DiaNodeMold));
                    DiaNodeMold   diaNodeMold   = (DiaNodeMold)xmlSerializer.Deserialize(textReader2);
                    diaNodeMold.nodeType = NodesType;
                    NodeListToFill.Add(diaNodeMold);
                    textReader2.Dispose();
                }
                catch (Exception ex)
                {
                    Log.Message(string.Concat(new object[]
                    {
                        "Exception deserializing ",
                        xPathNavigator2.OuterXml,
                        ":\n",
                        ex.InnerException
                    }), false);
                }
            }
            foreach (XPathNavigator xPathNavigator3 in xPathNavigator.Select("NodeList"))
            {
                try
                {
                    TextReader    textReader3    = new StringReader(xPathNavigator3.OuterXml);
                    XmlSerializer xmlSerializer2 = new XmlSerializer(typeof(DiaNodeList));
                    DiaNodeList   item           = (DiaNodeList)xmlSerializer2.Deserialize(textReader3);
                    ListListToFill.Add(item);
                }
                catch (Exception ex2)
                {
                    Log.Message(string.Concat(new object[]
                    {
                        "Exception deserializing ",
                        xPathNavigator3.OuterXml,
                        ":\n",
                        ex2.InnerException
                    }), false);
                }
            }
        }
Exemple #7
0
 public DiaNode(DiaNodeMold newDef)
 {
     this.def      = newDef;
     this.def.used = true;
     this.text     = this.def.texts.RandomElement <string>();
     if (this.def.optionList.Count > 0)
     {
         foreach (DiaOptionMold current in this.def.optionList)
         {
             this.options.Add(new DiaOption(current));
         }
     }
     else
     {
         this.options.Add(new DiaOption("OK".Translate()));
     }
 }
 public DiaNode(DiaNodeMold newDef)
 {
     def      = newDef;
     def.used = true;
     text     = def.texts.RandomElement();
     if (def.optionList.Count > 0)
     {
         foreach (DiaOptionMold option in def.optionList)
         {
             options.Add(new DiaOption(option));
         }
     }
     else
     {
         options.Add(new DiaOption("OK".Translate()));
     }
 }
Exemple #9
0
 public static DiaNodeMold GetNodeNamed(string NodeName)
 {
     foreach (DiaNodeMold current in DialogDatabase.Nodes)
     {
         if (current.name == NodeName)
         {
             DiaNodeMold result = current;
             return(result);
         }
     }
     foreach (DiaNodeList current2 in DialogDatabase.NodeLists)
     {
         if (current2.Name == NodeName)
         {
             DiaNodeMold result = current2.RandomNodeFromList();
             return(result);
         }
     }
     Log.Error("Did not find node named '" + NodeName + "'.", false);
     return(null);
 }
        public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType)
        {
            TextReader     reader         = new StringReader(ass.text);
            XPathDocument  xpathDocument  = new XPathDocument(reader);
            XPathNavigator xpathNavigator = xpathDocument.CreateNavigator();

            xpathNavigator.MoveToFirst();
            xpathNavigator.MoveToFirstChild();
            IEnumerator enumerator = xpathNavigator.Select("Node").GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object         obj             = enumerator.Current;
                    XPathNavigator xpathNavigator2 = (XPathNavigator)obj;
                    try
                    {
                        TextReader    textReader    = new StringReader(xpathNavigator2.OuterXml);
                        XmlSerializer xmlSerializer = new XmlSerializer(typeof(DiaNodeMold));
                        DiaNodeMold   diaNodeMold   = (DiaNodeMold)xmlSerializer.Deserialize(textReader);
                        diaNodeMold.nodeType = NodesType;
                        NodeListToFill.Add(diaNodeMold);
                        textReader.Dispose();
                    }
                    catch (Exception ex)
                    {
                        Log.Message(string.Concat(new object[]
                        {
                            "Exception deserializing ",
                            xpathNavigator2.OuterXml,
                            ":\n",
                            ex.InnerException
                        }), false);
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            IEnumerator enumerator2 = xpathNavigator.Select("NodeList").GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    object         obj2            = enumerator2.Current;
                    XPathNavigator xpathNavigator3 = (XPathNavigator)obj2;
                    try
                    {
                        TextReader    textReader2    = new StringReader(xpathNavigator3.OuterXml);
                        XmlSerializer xmlSerializer2 = new XmlSerializer(typeof(DiaNodeList));
                        DiaNodeList   item           = (DiaNodeList)xmlSerializer2.Deserialize(textReader2);
                        ListListToFill.Add(item);
                    }
                    catch (Exception ex2)
                    {
                        Log.Message(string.Concat(new object[]
                        {
                            "Exception deserializing ",
                            xpathNavigator3.OuterXml,
                            ":\n",
                            ex2.InnerException
                        }), false);
                    }
                }
            }
            finally
            {
                IDisposable disposable2;
                if ((disposable2 = (enumerator2 as IDisposable)) != null)
                {
                    disposable2.Dispose();
                }
            }
        }