private static bool AreFilesEqual(string file, AssetBundle bundle1, AssetBundle bundle2) { using (var stream1 = bundle1.OpenFileRaw(file)) { using (var stream2 = bundle2.OpenFileRaw(file)) { var reader1 = new BinaryReader(stream1); var reader2 = new BinaryReader(stream2); for (;;) { var c1 = reader1.Read(buffer1, 0, buffer1.Length); var c2 = reader2.Read(buffer2, 0, buffer2.Length); if (c1 != c2) { return(false); } if (c1 == 0) { return(true); } if (!AreByteArraysEqual(buffer1, buffer2)) { return(false); } } } } }
private static void ImportAsset(string file, AssetBundle sourceBundle, AssetBundle destinationBundle) { using (var stream = sourceBundle.OpenFileRaw(file)) { destinationBundle.ImportFileRaw( file, stream, 0, sourceBundle.GetSourceExtension(file), sourceBundle.GetFileLastWriteTime(file), sourceBundle.GetAttributes(file), sourceBundle.GetCookingRulesSHA1(file)); } }
public override Stream OpenFileRaw(string path, FileMode mode = FileMode.Open) => Bundle.OpenFileRaw(path, mode);