Ejemplo n.º 1
0
        private IEnumerable<FolderInfo> ProcessKey(RegistryKey key)
        {
            var l = new List<FolderInfo>();

            try
            {
                var mruList = key.Values.Single(t => t.ValueName == "MRUListEx");

                var mruPositions = new Dictionary<uint, int>();

                var i = 0;

                var index = 0;

                var mruPos = BitConverter.ToUInt32(mruList.ValueDataRaw, index);
                index += 4;

                while (mruPos != 0xFFFFFFFF)
                {
                    mruPositions.Add(mruPos, i);
                    i++;
                    mruPos = BitConverter.ToUInt32(mruList.ValueDataRaw, index);
                    index += 4;
                }

                //mruPositions now contains a map of positions (the key) to the order it was opened (the value)

                foreach (var keyValue in key.Values)
                {
                    if (keyValue.ValueName == "MRUListEx")
                    {
                        continue;
                    }

                    var mru = mruPositions[uint.Parse(keyValue.ValueName)];

                    var chunks = Encoding.Unicode.GetString(keyValue.ValueDataRaw).Split('\0');

                    var exeName = chunks[0];

                    var folder = string.Empty;

                    if (chunks.Length > 1)
                    {
                        folder = chunks[1];
                    }

                    DateTimeOffset? openedOn = null;

                    if (mru == 0)
                    {
                        openedOn = key.LastWriteTime;
                    }

                    var ff = new FolderInfo(exeName, folder, mru, openedOn);

                    l.Add(ff);
                }
            }
            catch (Exception ex)
            {
                Errors.Add($"Error processing FirstFolder key: {ex.Message}");
            }

            if (Errors.Count > 0)
            {
                AlertMessage = "Errors detected. See Errors information in lower right corner of plugin window";
            }

            return l.OrderBy(t => t.MRUPosition);
        }
Ejemplo n.º 2
0
        private IEnumerable <FolderInfo> ProcessKey(RegistryKey key)
        {
            var l = new List <FolderInfo>();


            try
            {
                var mruList = key.Values.Single(t => t.ValueName == "MRUListEx");

                var mruPositions = new Dictionary <uint, int>();

                var i = 0;

                var index = 0;

                var mruPos = BitConverter.ToUInt32(mruList.ValueDataRaw, index);
                index += 4;

                while (mruPos != 0xFFFFFFFF)
                {
                    mruPositions.Add(mruPos, i);
                    i++;
                    mruPos = BitConverter.ToUInt32(mruList.ValueDataRaw, index);
                    index += 4;
                }

                //mruPositions now contains a map of positions (the key) to the order it was opened (the value)

                foreach (var keyValue in key.Values)
                {
                    if (keyValue.ValueName == "MRUListEx")
                    {
                        continue;
                    }

                    var mru = mruPositions[uint.Parse(keyValue.ValueName)];

                    var chunks = Encoding.Unicode.GetString(keyValue.ValueDataRaw).Split('\0');

                    var exeName = chunks[0];

                    var folder = string.Empty;

                    if (chunks.Length > 1)
                    {
                        folder = chunks[1];
                    }

                    DateTimeOffset?openedOn = null;

                    if (mru == 0)
                    {
                        openedOn = key.LastWriteTime;
                    }

                    var ff = new FolderInfo(exeName, folder, mru, openedOn);

                    l.Add(ff);
                }
            }
            catch (Exception ex)
            {
                Errors.Add($"Error processing FirstFolder key: {ex.Message}");
            }


            if (Errors.Count > 0)
            {
                AlertMessage = "Errors detected. See Errors information in lower right corner of plugin window";
            }

            return(l.OrderBy(t => t.MRUPosition));
        }