Lnk.ShellItems.ShellBag0X2E.ShellBag0X2E C# (CSharp) Method

ShellBag0X2E() public method

public ShellBag0X2E ( byte rawBytes ) : System
rawBytes byte
return System
        public ShellBag0X2E(byte[] rawBytes)
        {
            ExtensionBlocks = new List<IExtensionBlock>();

            var index = 0;

            var postSig = BitConverter.ToInt64(rawBytes, rawBytes.Length - 8);

            if (postSig == 0x0000ee306bfe9555)
            {
                FriendlyName = "User profile";

                var la = Utils.ExtractDateTimeOffsetFromBytes(rawBytes.Skip(rawBytes.Length - 14).Take(4).ToArray());

                LastAccessTime = la;

                index = 10;

                var tempString = Encoding.Unicode.GetString(rawBytes.Skip(index).ToArray()).Split('\0')[0];

                Value = tempString;

                return;
            }

            //this needs to change to be the default
            if (rawBytes[0] == 20 || rawBytes[0] == 50 || rawBytes[0] == 0x3a)
            {
                ProcessGuid(rawBytes);
                return;
            }

            //this needs to change to be the default
            if (rawBytes[2] == 0x53)
            {
                ProcessGuid2(rawBytes);
                return;
            }

            //zip file contents check
            if (rawBytes[0x28] == 0x2f || (rawBytes[0x24] == 0x4e && rawBytes[0x26] == 0x2f && rawBytes[0x28] == 0x41))
            {
                //we have a good date

                var zip = new ShellBagZipContents( rawBytes);
                FriendlyName = zip.FriendlyName;
                LastAccessTime = zip.LastAccessTime;

                Value = zip.Value;

                return;
            }


            try
            {
                ProcessPropertyViewDefault(rawBytes);

                return;
            }
            catch (Exception)
            {
            }

            //this is a different animal,

            FriendlyName = "Root folder: MPT device";

            index = 0x1e;

            var storageStringNameLen = BitConverter.ToInt32(rawBytes, index);

            index += 4;

            var storageIdStringLen = BitConverter.ToInt32(rawBytes, index);

            index += 4;

            var fileSystemNameLen = BitConverter.ToInt32(rawBytes, index);

            index = 0x28;

            var storageName = Encoding.Unicode.GetString(rawBytes, index, storageStringNameLen*2 - 2);

            index += storageStringNameLen*2;

            var storageIdName = Encoding.Unicode.GetString(rawBytes, index, storageIdStringLen*2 - 2);

            index += storageIdStringLen*2;

            Value = storageName;
        }