static byte[] GetConstantsFromCode(Stream shaderCode, uint offset, uint length)
 {
     using (var reader = new Toolbox.Core.IO.FileReader(shaderCode, true))
     {
         reader.SeekBegin(offset);
         return(reader.ReadBytes((int)length));
     }
 }
        static byte[] GetConstants(BfshaLibrary.ShaderCodeData shaderData)
        {
            var data = ((BfshaLibrary.ShaderCodeDataBinary)shaderData).BinaryData;

            //Bnsh has 2 shader code sections. The first section has block info for constants
            using (var reader = new Toolbox.Core.IO.FileReader(data[0])) {
                reader.SeekBegin(1776);
                ulong ofsUnk                 = reader.ReadUInt64();
                uint  lenByteCode            = reader.ReadUInt32();
                uint  lenConstData           = reader.ReadUInt32();
                uint  ofsConstBlockDataStart = reader.ReadUInt32();
                uint  ofsConstBlockDataEnd   = reader.ReadUInt32();
                return(GetConstantsFromCode(data[1], ofsConstBlockDataStart, lenConstData));
            }
        }