Exemplo n.º 1
0
        public static void loadCategoryFile(TextAsset a)
        {
            XmlDocument xmlDocument = new XmlDocument();

            XMLHelpers.currentFileName = a.name;
            try
            {
                if (!File.Exists(string.Concat(FileOperations.getWorldStoragePathPrefix(), "/", a.name, ".xml")))
                {
                    xmlDocument.LoadXml(a.text);
                }
                else
                {
                    xmlDocument.Load(string.Concat(FileOperations.getWorldStoragePathPrefix(), "/", a.name, ".xml"));
                }
            }
            catch (XmlException xmlException1)
            {
                XmlException xmlException = xmlException1;
                PopupDialog.showDeferredBootError(string.Concat("Error parsing category file ", a.name, " : ", xmlException.Message));
                DebugConsole.LogError(string.Concat("Error parsing category file ", a.name, " : ", xmlException.Message));
            }
            System.Collections.IEnumerator enumerator = xmlDocument.ChildNodes.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    XmlNode current = (XmlNode)enumerator.Current;
                    if (current.Name != "categories")
                    {
                        continue;
                    }
                    System.Collections.IEnumerator enumerator1 = current.ChildNodes.GetEnumerator();
                    try
                    {
                        while (enumerator1.MoveNext())
                        {
                            XmlNode xmlNodes = (XmlNode)enumerator1.Current;
                            if (xmlNodes.Name != "category")
                            {
                                continue;
                            }
                            CategoryReader.loadCategory(a.name, xmlNodes);
                        }
                    }
                    finally
                    {
                        IDisposable disposable = enumerator1 as IDisposable;
                        if (disposable == null)
                        {
                        }
                        disposable.Dispose();
                    }
                }
            }
            finally
            {
                IDisposable disposable1 = enumerator as IDisposable;
                if (disposable1 == null)
                {
                }
                disposable1.Dispose();
            }
        }