Ejemplo n.º 1
0
    static void CheckFile(string fileName, string filePath, string bundlePath)
    {
        SimpleAssetBundle sab = LoadFromFile(bundlePath);

        if (sab == null)
        {
            Console.WriteLine("Bundle 包不存在");
            return;
        }
        if (sab.isExists(fileName))
        {
            Console.WriteLine("文件存在");
            using (BinaryWriter bw = new BinaryWriter(File.Open(filePath, FileMode.Create)))
            {
                int    len   = sab.FileLength(fileName);
                byte[] bytes = new byte[len];//sab.GetData(fileName);
                sab.Read(fileName, bytes, 0, len);
                bw.Write(bytes);
            }
        }
        else
        {
            Console.WriteLine("文件不存在");
        }
    }
Ejemplo n.º 2
0
    void TestLoadAsset()
    {
        SimpleAssetBundle sab = LoadFromFile(bundlePath);

        if (sab.isExists(fileName))
        {
            Debug.LogError("文件存在");
            using (BinaryWriter bw = new BinaryWriter(File.Open(filePath, FileMode.Create)))
            {
                int    len   = sab.FileLength(fileName);
                byte[] bytes = new byte[len];
                sab.Read(fileName, bytes, 0, len);
                bw.Write(bytes);
            }
        }
    }