コード例 #1
0
    void LoadERF(ERFObject obj, string resRef, ResourceType resType, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn)
    {
        if (!gffTypes.Contains(resType))
        {
            return;
        }

        string className = "Aurora" + resType.ToString().ToUpper().Replace(" ", "");

        if (!defs.ContainsKey(className))
        {
            defs[className] = new ClassDefinition();
        }

        Stream stream = obj.GetResource(resRef, resType);

        if (resType == ResourceType.ERF || resType == ResourceType.SAV)
        {
            // ERFs can contain ERFs themselves!
            //Debug.Log("Loading nested ERF file " + resRef);
            LoadERFObj(new ERFObject(stream), defs, compat, existsIn);
            //Debug.Log("Finished loading nested ERF file " + resRef);
        }
        else
        {
            // Load the resource from the ERF
            GFFObject gffObject = new GFFLoader(stream).GetObject();
            // Update the class definition
            LoadGFF(gffObject, defs, className, compat, existsIn);
        }
    }
コード例 #2
0
    void LoadBIF(BIFObject obj, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn)
    {
        List <BIFObject.Resource> resources = obj.resources.ToList();

        //Debug.Log(resources.Count());

        for (int i = 0; i < resources.Count(); i++)
        {
            BIFObject.Resource resource = resources[i];
            ResourceType       resType  = (ResourceType)resource.ResType;
            if (!gffTypes.Contains(resType))
            {
                continue;
            }

            try
            {
                //Debug.Log("Loading resource " + resource.ResRef);
                string className = "Aurora" + resType.ToString().ToUpper().Replace(" ", "");

                // Load the resource from the RIM
                Stream    stream    = obj.GetResourceData(resource);
                GFFObject gffObject = new GFFLoader(stream).GetObject();
                LoadGFF(gffObject, defs, className, compat, existsIn);
            }
            catch
            {
                // Just keep going
                Debug.LogWarning("Failed to load " + resource.ID);
            }
        }
    }
コード例 #3
0
    void BIFItems()
    {
        List <string> objects = new List <string>();
        ResourceType  curType = TypeMap[curItemType];

        foreach (AuroraArchive archive in AuroraEngine.Resources.data.bifObjects)
        {
            if (archive.GetType() == typeof(RIMObject))
            {
                RIMObject rim = (RIMObject)archive;

                foreach ((string name, ResourceType rt) in rim.resources.Keys)
                {
                    if (rt != curType)
                    {
                        continue;
                    }
                    using (Stream stream = rim.GetResource(name, rt))
                    {
                        GFFObject obj = new GFFLoader(stream).GetObject();
                        objects.Add((string)obj["TemplateResRef"].Value);
                    }
                }
            }
            else if (archive.GetType() == typeof(FolderObject))
            {
                FolderObject folder = (FolderObject)archive;

                foreach ((string name, ResourceType rt) in folder.resources.Keys)
                {
                    if (rt != curType)
                    {
                        continue;
                    }
                    using (Stream stream = folder.GetResource(name, rt))
                    {
                        GFFObject obj = new GFFLoader(stream).GetObject();
                        objects.Add((string)obj["TemplateResRef"].Value);
                    }
                }
            }
        }

        bifItems = objects.ToArray();
    }
コード例 #4
0
    void LoadRIM(RIMObject obj, RIMObject.Resource resource, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn)
    {
        if (!gffTypes.Contains(resource.ResType))
        {
            return;
        }

        try
        {
            //Debug.Log("Loading resource " + resource.ResRef);
            string className = "Aurora" + resource.ResType.ToString().ToUpper().Replace(" ", "");

            // Load the resource from the RIM
            Stream    stream    = obj.GetResource(resource.ResRef, resource.ResType);
            GFFObject gffObject = new GFFLoader(stream).GetObject();
            LoadGFF(gffObject, defs, className, compat, existsIn);
        }
        catch
        {
            // Just keep going
            Debug.LogWarning("Failed to load " + resource.ResRef);
        }
    }