Exemple #1
0
        // ADDING TO VERSION MANIFEST
        private static bool AddModEntry(VersionManifest manifest, ModDef.ManifestEntry modEntry)
        {
            if (modEntry.Path == null)
            {
                return(false);
            }

            VersionManifestAddendum addendum = null;

            if (!string.IsNullOrEmpty(modEntry.AddToAddendum))
            {
                addendum = manifest.GetAddendumByName(modEntry.AddToAddendum);

                // create the addendum if it doesn't exist
                if (addendum == null)
                {
                    Log($"\t\tCreated addendum: {modEntry.AddToAddendum}");
                    addendum = new VersionManifestAddendum(modEntry.AddToAddendum);
                    manifest.ApplyAddendum(addendum);
                }
            }

            // add special handling for particular types
            switch (modEntry.Type)
            {
            case "AssetBundle":
                ModAssetBundlePaths[modEntry.Id] = modEntry.Path;
                break;

            case "Texture2D":
                ModTexture2Ds.Add(modEntry.Id);
                break;
            }

            // add to addendum instead of adding to manifest
            if (addendum != null)
            {
                Log($"\t\tAddOrUpdate => {modEntry.Id} ({modEntry.Type}) to addendum {addendum.Name}");
                addendum.AddOrUpdate(modEntry.Id, modEntry.Path, modEntry.Type, DateTime.Now, modEntry.AssetBundleName, modEntry.AssetBundlePersistent);
                return(true);
            }

            // not added to addendum, not added to jsonmerges
            Log($"\t\tAddOrUpdate => {modEntry.Id} ({modEntry.Type})");
            manifest.AddOrUpdate(modEntry.Id, modEntry.Path, modEntry.Type, DateTime.Now, modEntry.AssetBundleName, modEntry.AssetBundlePersistent);
            return(true);
        }
Exemple #2
0
        // ADDING MOD CONTENT TO THE GAME
        private static void AddModEntry(VersionManifest manifest, ModDef.ManifestEntry modEntry)
        {
            if (modEntry.Path == null)
            {
                return;
            }

            VersionManifestAddendum addendum = null;

            if (!string.IsNullOrEmpty(modEntry.AddToAddendum))
            {
                addendum = manifest.GetAddendumByName(modEntry.AddToAddendum);

                if (addendum == null)
                {
                    Log($"\tCannot add {modEntry.Id} to {modEntry.AddToAddendum} because addendum doesn't exist in the manifest.");
                    return;
                }
            }

            // add special handling for particular types
            switch (modEntry.Type)
            {
            case "AssetBundle":
                ModAssetBundlePaths[modEntry.Id] = modEntry.Path;
                break;

            case "Texture2D":
                ModTexture2Ds.Add(modEntry.Id);
                break;
            }

            // add to addendum instead of adding to manifest
            if (addendum != null)
            {
                Log($"\tAdd/Replace: \"{GetRelativePath(modEntry.Path, ModsDirectory)}\" ({modEntry.Type}) [{addendum.Name}]");
            }
            else
            {
                Log($"\tAdd/Replace: \"{GetRelativePath(modEntry.Path, ModsDirectory)}\" ({modEntry.Type})");
            }

            // not added to addendum, not added to jsonmerges
            BTRLEntries.Add(modEntry);
            return;
        }