コード例 #1
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    if (this.defPackages.Count != 0)
                    {
                        Log.ErrorOnce("LoadDefs called with already existing def packages", 39029405, false);
                    }
                    enumerator = DirectXmlLoader.XmlAssetsInModFolder(this, "Defs/").GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        asset      = enumerator.Current;
                        defPackage = new DefPackage(asset.name, GenFilePaths.FolderPathRelativeToDefsFolder(asset.fullFolderPath, this));
                        base.AddDefPackage(defPackage);
                        asset.defPackage = defPackage;
                        this.$current    = asset;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                this.$PC = -1;
                return(false);
            }
コード例 #2
0
 public IEnumerable <LoadableXmlAsset> LoadDefs()
 {
     if (this.defPackages.Count != 0)
     {
         Log.ErrorOnce("LoadDefs called with already existing def packages", 39029405, false);
     }
     foreach (LoadableXmlAsset asset in DirectXmlLoader.XmlAssetsInModFolder(this, "Defs/"))
     {
         DefPackage defPackage = new DefPackage(asset.name, GenFilePaths.FolderPathRelativeToDefsFolder(asset.fullFolderPath, this));
         this.AddDefPackage(defPackage);
         asset.defPackage = defPackage;
         yield return(asset);
     }
 }
コード例 #3
0
ファイル: ModContentPack.cs プロジェクト: potsh/RimWorld
        public IEnumerable <LoadableXmlAsset> LoadDefs()
        {
            if (defPackages.Count != 0)
            {
                Log.ErrorOnce("LoadDefs called with already existing def packages", 39029405);
            }
            using (IEnumerator <LoadableXmlAsset> enumerator = DirectXmlLoader.XmlAssetsInModFolder(this, "Defs/").GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    LoadableXmlAsset asset      = enumerator.Current;
                    DefPackage       defPackage = new DefPackage(asset.name, GenFilePaths.FolderPathRelativeToDefsFolder(asset.fullFolderPath, this));
                    AddDefPackage(defPackage);
                    asset.defPackage = defPackage;
                    yield return(asset);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_0131:
            /*Error near IL_0132: Unexpected return in MoveNext()*/;
        }
コード例 #4
0
        public void LoadDefs(IEnumerable <PatchOperation> patches)
        {
            DeepProfiler.Start("Loading all defs");
            List <LoadableXmlAsset> list = DirectXmlLoader.XmlAssetsInModFolder(this, "Defs/").ToList <LoadableXmlAsset>();

            foreach (LoadableXmlAsset current in list)
            {
                foreach (PatchOperation current2 in patches)
                {
                    current2.Apply(current.xmlDoc);
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i] == null || list[i].xmlDoc == null || list[i].xmlDoc.DocumentElement == null)
                {
                    Log.Error(string.Format("{0}: unknown parse failure", list[i].fullFolderPath + "/" + list[i].name));
                }
                else if (list[i].xmlDoc.DocumentElement.Name != "Defs")
                {
                    Log.Error(string.Format("{0}: root element named {1}; should be named Defs", list[i].fullFolderPath + "/" + list[i].name, list[i].xmlDoc.DocumentElement.Name));
                }
                XmlInheritance.TryRegisterAllFrom(list[i], this);
            }
            XmlInheritance.Resolve();
            for (int j = 0; j < list.Count; j++)
            {
                string     relFolder  = GenFilePaths.FolderPathRelativeToDefsFolder(list[j].fullFolderPath, this);
                DefPackage defPackage = new DefPackage(list[j].name, relFolder);
                foreach (Def current3 in DirectXmlLoader.AllDefsFromAsset(list[j]))
                {
                    defPackage.defs.Add(current3);
                }
                this.defPackages.Add(defPackage);
            }
            DeepProfiler.End();
        }