RocksmithToolkitLib.Sng2014HSL.Sng2014File.UnpackSng C# (CSharp) Method

UnpackSng() public static method

public static UnpackSng ( Stream input, Stream output, System.Platform platform ) : void
input Stream
output Stream
platform System.Platform
return void
        public static void UnpackSng(Stream input, Stream output, Platform platform)
        {
            EndianBitConverter conv = platform.GetBitConverter;

            using (var decrypted = new MemoryStream())
            using (var ebrDec = new EndianBinaryReader(conv, decrypted)) {
                byte[] key;
                switch (platform.platform) {
                    case GamePlatform.Mac:
                        key = RijndaelEncryptor.SngKeyMac;
                        break;
                    case GamePlatform.Pc:
                        key = RijndaelEncryptor.SngKeyPC;
                        break;
                    default:
                        key = null;
                        break;
                }
                if (key != null)
                    RijndaelEncryptor.DecryptSngData(input, decrypted, key, conv);
                else {
                    input.CopyTo(decrypted);
                    decrypted.Seek(8, SeekOrigin.Begin);
                }
                //unZip
                long plainLen = ebrDec.ReadUInt32();
                ushort xU = ebrDec.ReadUInt16();
                decrypted.Position -= 2;
                if (xU == 0x78DA || xU == 0xDA78) {//LE 55928 //BE 30938
                    RijndaelEncryptor.Unzip(decrypted, output, false);
                }
            }
        }