bladecoding / BoIRResourceDecryption

GNU General Public License v3.0
25 stars 10 forks source link

Audio/video files are saved as .png #9

Closed TychoHenzen closed 10 years ago

TychoHenzen commented 10 years ago

the first characters of the audio/video files contain "ogg", so i wrote this tweak to ensure they're saved correctly:

if (compressed)
            {
                var rec = new CompressedRecord();
                rec.Read(s);
                File.WriteAllText(Path.Combine(dir, i + ".xml"), rec.Data);
                Console.WriteLine("saved file " + Path.Combine(dir, i + ".xml"));
            }
            else
            {
                var rec = new EncryptedRecord();
                rec.Read(s);
                byte[] subarray = SubArray(rec.Data, 0, 64);

                if ( Encoding.Default.GetString ( subarray ).ToLower().Contains ( "ogg" ) )
                {
                    File.WriteAllBytes ( Path.Combine ( dir, i + ".ogg" ), rec.Data );

                    Console.WriteLine("saved file " + Path.Combine(dir, i + ".ogg"));
                }
                else
                {
                    File.WriteAllBytes(Path.Combine(dir, i + ".png"), rec.Data);
                    Console.WriteLine("saved file " + Path.Combine(dir, i + ".png"));
                }
            }
nainslie commented 10 years ago

I used this example code and created a pull request with this change in it. Verified that ogg files are being written out correctly.

flying-sheep commented 10 years ago

fixed with e7163c76e8392cbf402ece4d94b753ae0d3bdf4b and d407ac5021aa7683ff470e44c56a48da22b8356c