Example #1
0
        public static AssetsBundleFile CreateBlankBundle(string engineVersion, int contentSize)
        {
            AssetsBundleHeader06 header = new AssetsBundleHeader06()
            {
                signature         = "UnityFS",
                fileVersion       = 6,
                minPlayerVersion  = "5.x.x",
                fileEngineVersion = engineVersion,
                totalFileSize     = (ulong)(0x82 + engineVersion.Length + contentSize),
                compressedSize    = 0x5B,
                decompressedSize  = 0x5B,
                flags             = 0x40
            };
            AssetsBundleBlockInfo06 blockInf = new AssetsBundleBlockInfo06
            {
                decompressedSize = (uint)contentSize,
                compressedSize   = (uint)contentSize,
                flags            = 0x0040
            };
            AssetsBundleDirectoryInfo06 dirInf = new AssetsBundleDirectoryInfo06
            {
                offset           = 0,
                decompressedSize = (uint)contentSize,
                flags            = 4,
                name             = GenerateCabName()
            };
            AssetsBundleBlockAndDirectoryList06 info = new AssetsBundleBlockAndDirectoryList06()
            {
                checksumLow  = 0,
                checksumHigh = 0,
                blockCount   = 1,
                blockInf     = new AssetsBundleBlockInfo06[]
                {
                    blockInf
                },
                directoryCount = 1,
                dirInf         = new AssetsBundleDirectoryInfo06[]
                {
                    dirInf
                }
            };
            AssetsBundleFile bundle = new AssetsBundleFile()
            {
                bundleHeader6 = header,
                bundleInf6    = info
            };

            return(bundle);
        }
Example #2
0
        public static AssetsBundleFile CreateBlankBundle(string engineVersion, int contentSize, int contentSizeSA, string sceneName)
        {
            uint infSize = (uint)(0x7B + sceneName.Length * 2);
            AssetsBundleHeader06 header = new AssetsBundleHeader06()
            {
                signature         = "UnityFS",
                fileVersion       = 6,
                minPlayerVersion  = "5.x.x",
                fileEngineVersion = engineVersion,
                totalFileSize     = (ulong)(0x82 + engineVersion.Length + contentSize + contentSizeSA),
                compressedSize    = infSize, //0x5B,
                decompressedSize  = infSize, //0x5B,
                flags             = 0x40
            };
            AssetsBundleBlockInfo06 blockInfSharedAssets = new AssetsBundleBlockInfo06
            {
                decompressedSize = (uint)contentSizeSA,
                compressedSize   = (uint)contentSizeSA,
                flags            = 0x0040
            };
            AssetsBundleDirectoryInfo06 dirInfSharedAssets = new AssetsBundleDirectoryInfo06
            {
                offset           = 0,
                decompressedSize = (uint)contentSizeSA,
                flags            = 4,
                name             = "BuildPlayer-" + sceneName + ".sharedAssets"
            };
            AssetsBundleBlockInfo06 blockInf = new AssetsBundleBlockInfo06
            {
                decompressedSize = (uint)contentSize,
                compressedSize   = (uint)contentSize,
                flags            = 0x0040
            };
            AssetsBundleDirectoryInfo06 dirInf = new AssetsBundleDirectoryInfo06
            {
                offset           = (ulong)contentSizeSA,
                decompressedSize = (uint)contentSize,
                flags            = 4,
                name             = "BuildPlayer-" + sceneName
            };
            AssetsBundleBlockAndDirectoryList06 info = new AssetsBundleBlockAndDirectoryList06()
            {
                checksumLow  = 0,
                checksumHigh = 0,
                blockCount   = 2,
                blockInf     = new AssetsBundleBlockInfo06[]
                {
                    blockInfSharedAssets,
                    blockInf
                },
                directoryCount = 2,
                dirInf         = new AssetsBundleDirectoryInfo06[]
                {
                    dirInfSharedAssets,
                    dirInf
                }
            };
            AssetsBundleFile bundle = new AssetsBundleFile()
            {
                bundleHeader6 = header,
                bundleInf6    = info
            };

            return(bundle);
        }