예제 #1
0
        public void ProcessValues(RegistryKey key)
        {
            _values.Clear();
            Errors.Clear();

            var valuesList = new List <ValuesOut>();

            var currentKey = string.Empty;


            try
            {
                //this key has folders stored in the root as well

                var mruVal1 = key.Values.SingleOrDefault(t => t.ValueName == "MRUList");

                var mruListOrder1 = new ArrayList();

                if (mruVal1 != null)
                {
                    foreach (var c in mruVal1.ValueData.ToCharArray())
                    {
                        mruListOrder1.Add(c.ToString());
                    }
                }

                foreach (var keyValue in key.Values)
                {
                    if (keyValue.ValueName == "MRUList")
                    {
                        continue;
                    }
                    var mru1 = mruListOrder1.IndexOf(keyValue.ValueName);

                    DateTimeOffset?openedOn1 = null;

                    if (mru1 == 0)
                    {
                        openedOn1 = key.LastWriteTime;
                    }

                    var v1 = new ValuesOut("OpenSaveMRU", keyValue.ValueData, keyValue.ValueName, mru1, openedOn1);
                    v1.BatchKeyPath   = key.KeyPath;
                    v1.BatchValueName = keyValue.ValueName;

                    valuesList.Add(v1);
                }

                foreach (var registryKey in key.SubKeys)
                {
                    currentKey = registryKey.KeyName;

                    //get MRU key and read it in

                    var mruVal = registryKey.Values.SingleOrDefault(t => t.ValueName == "MRUList");

                    var mruListOrder = new ArrayList();

                    if (mruVal != null)
                    {
                        foreach (var c in mruVal.ValueData.ToCharArray())
                        {
                            mruListOrder.Add(c.ToString());
                        }
                    }

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

                        var mru = mruListOrder.IndexOf(keyValue.ValueName);

                        DateTimeOffset?openedOn = null;

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

                        var v = new ValuesOut(registryKey.KeyName, keyValue.ValueData, keyValue.ValueName, mru,
                                              openedOn);
                        v.BatchKeyPath   = registryKey.KeyPath;
                        v.BatchValueName = keyValue.ValueName;

                        valuesList.Add(v);
                    }
                }
            }
            catch (Exception ex)
            {
                Errors.Add($"Error processing OpenSaveMRU subkey {currentKey}: {ex.Message}");
            }

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


            var v2 = valuesList.OrderBy(t => t.MruPosition);

            foreach (var source in v2.ToList())
            {
                _values.Add(source);
            }
        }
예제 #2
0
        public void ProcessValues(RegistryKey key)
        {
            _values.Clear();
            Errors.Clear();

            var valuesList = new List<ValuesOut>();

            var currentKey = string.Empty;

            try
            {
                //this key has folders stored in the root as well

                var mruVal1 = key.Values.SingleOrDefault(t => t.ValueName == "MRUList");

                var mruListOrder1 = new ArrayList();

                if (mruVal1 != null)
                {
                    foreach (var c in mruVal1.ValueData.ToCharArray())
                    {
                        mruListOrder1.Add(c.ToString());
                    }
                }

                foreach (var keyValue in key.Values)
                {
                    if (keyValue.ValueName == "MRUList")
                    {
                        continue;
                    }
                    var mru1 = mruListOrder1.IndexOf(keyValue.ValueName);

                    DateTimeOffset? openedOn1 = null;

                    if (mru1 == 0)
                    {
                        openedOn1 = key.LastWriteTime;
                    }

                    var v1 = new ValuesOut("OpenSaveMRU", keyValue.ValueData, keyValue.ValueName, mru1, openedOn1);

                    valuesList.Add(v1);
                }

                foreach (var registryKey in key.SubKeys)
                {
                    currentKey = registryKey.KeyName;

                    //get MRU key and read it in

                    var mruVal = registryKey.Values.SingleOrDefault(t => t.ValueName == "MRUList");

                    var mruListOrder = new ArrayList();

                    if (mruVal != null)
                    {
                        foreach (var c in mruVal.ValueData.ToCharArray())
                        {
                            mruListOrder.Add(c.ToString());
                        }
                    }

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

                        var mru = mruListOrder.IndexOf(keyValue.ValueName);

                        DateTimeOffset? openedOn = null;

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

                        var v = new ValuesOut(registryKey.KeyName, keyValue.ValueData, keyValue.ValueName, mru, openedOn);

                        valuesList.Add(v);
                    }
                }
            }
            catch (Exception ex)
            {
                Errors.Add($"Error processing OpenSaveMRU subkey {currentKey}: {ex.Message}");
            }

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

            var v2 = valuesList.OrderBy(t => t.MruPosition);

            foreach (var source in v2.ToList())
            {
                _values.Add(source);
            }
        }