Lnk.ShellItems.ShellBag0X00.ProcessPropertyViewGuid C# (CSharp) Method

ProcessPropertyViewGuid() private method

private ProcessPropertyViewGuid ( byte rawBytes ) : void
rawBytes byte
return void
        private void ProcessPropertyViewGuid(byte[] rawBytes)
        {
            // this is a guid

            var index = 4;

            var dataSize = BitConverter.ToUInt16(rawBytes, index);
            index += 2;

            index += 4; // move past signature

            var propertyStoreSize = BitConverter.ToUInt16(rawBytes, index);
            index += 2;

            Trace.Assert(propertyStoreSize == 0, "propertyStoreSize size > 0!");

            var identifierSize = BitConverter.ToUInt16(rawBytes, index);
            index += 2;

            if (identifierSize > 0)
            {
                var raw00Guid = new byte[16];

                Array.Copy(rawBytes, index, raw00Guid, 0, 16);


                var preguid = Utils.ExtractGuidFromShellItem(raw00Guid);


                var tempString = Utils.GetFolderNameFromGuid(preguid);

                Value = tempString;

                index += 16;
            }

            index += 2; // skip 2 unknown in common

            if (index >= rawBytes.Length)
            {
                return;
            }

            var extBlockSize = BitConverter.ToInt16(rawBytes, index);

            if (extBlockSize > 0)
            {
                //process extension blocks

                while (extBlockSize > 0)
                {
                    var extBytes = rawBytes.Skip(index).Take(extBlockSize).ToArray();

                    index += extBlockSize;

                    var signature1 = BitConverter.ToUInt32(extBytes, 4);

                    var block1 = Utils.GetExtensionBlockFromBytes(signature1, extBytes);

                    ExtensionBlocks.Add(block1);

                    if (index >= rawBytes.Length)
                    {
                        break;
                    }
                    extBlockSize = BitConverter.ToInt16(rawBytes, index);
                }
            }
//
//            int terminator = BitConverter.ToInt16(rawBytes, index);
//
//            if (terminator > 0)
//            {
//                throw new Exception($"Expected terminator of 0, but got {terminator}");
//            }
        }