Exemplo n.º 1
0
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
 public override Stream OpenFileRaw(string path, FileMode mode = FileMode.Open) => Bundle.OpenFileRaw(path, mode);