Пример #1
0
 // Token: 0x060007D8 RID: 2008
 public abstract void SetValue(string keyName, RegistryValue value);
Пример #2
0
        private void CopyWorker(RegistryManipulator source, RegistryManipulator destination)
        {
            string text  = null;
            string text2 = null;
            bool   flag  = true;
            bool   flag2 = true;

            this.m_isCopying = true;
            try
            {
                Queue <string> queue  = new Queue <string>();
                Queue <string> queue2 = new Queue <string>();
                List <string>  list   = new List <string>();
                List <string>  list2  = new List <string>();
                queue.Enqueue(string.Empty);
                queue2.Enqueue(string.Empty);
                while (this.m_isValid)
                {
                    if (flag)
                    {
                        list.Clear();
                        if (queue.Count > 0)
                        {
                            text = queue.Dequeue();
                            flag = false;
                            foreach (string text3 in source.GetSubKeyNames(text))
                            {
                                string item = text3;
                                if (text.CompareTo(string.Empty) != 0)
                                {
                                    item = text + "\\" + text3;
                                }
                                queue.Enqueue(item);
                            }
                        }
                        else
                        {
                            text = null;
                        }
                    }
                    if (flag2)
                    {
                        list2.Clear();
                        if (queue2.Count > 0)
                        {
                            text2 = queue2.Dequeue();
                            foreach (string text4 in destination.GetSubKeyNames(text2))
                            {
                                string item2 = text4;
                                if (text2.CompareTo(string.Empty) != 0)
                                {
                                    item2 = text2 + "\\" + text4;
                                }
                                queue2.Enqueue(item2);
                            }
                        }
                        else
                        {
                            text2 = null;
                        }
                    }
                    int num;
                    if (text == null)
                    {
                        num = 1;
                    }
                    else if (text2 == null)
                    {
                        num = -1;
                    }
                    else
                    {
                        num = string.Compare(text, text2, StringComparison.OrdinalIgnoreCase);
                    }
                    if (num == 0)
                    {
                        foreach (string item3 in source.GetValueNames(text))
                        {
                            list.Add(item3);
                        }
                        list.Sort();
                        foreach (string item4 in destination.GetValueNames(text2))
                        {
                            list2.Add(item4);
                        }
                        list2.Sort();
                        int num2 = 0;
                        int num3 = 0;
                        while (num3 < list.Count || num2 < list2.Count)
                        {
                            int num4;
                            if (num3 >= list.Count)
                            {
                                num4 = 1;
                            }
                            else if (num2 >= list2.Count)
                            {
                                num4 = -1;
                            }
                            else
                            {
                                num4 = string.Compare(list[num3], list2[num2]);
                            }
                            if (num4 == 0)
                            {
                                RegistryValue value  = source.GetValue(text, list[num3]);
                                RegistryValue value2 = destination.GetValue(text2, list2[num2]);
                                if (value != null && !value.Equals(value2))
                                {
                                    destination.SetValue(text, value);
                                }
                                else if (value == null)
                                {
                                    destination.DeleteValue(text2, list2[num2]);
                                }
                                num3++;
                                num2++;
                            }
                            else if (num4 < 0)
                            {
                                RegistryValue value3 = source.GetValue(text, list[num3]);
                                if (value3 != null)
                                {
                                    destination.SetValue(text, value3);
                                }
                                num3++;
                            }
                            else
                            {
                                destination.DeleteValue(text2, list2[num2]);
                                num2++;
                            }
                        }
                        flag  = true;
                        flag2 = true;
                    }
                    else if (num < 0 && text != null)
                    {
                        destination.CreateKey(text);
                        flag2 = false;
                        text2 = text;
                    }
                    else
                    {
                        if (text2 == null)
                        {
                            return;
                        }
                        destination.DeleteKey(text2);
                        flag2 = true;
                    }
                }
                AmTrace.Warning("Skipping a copy notification since the database has changed master. Source root: {0}", new object[]
                {
                    source.Root
                });
            }
            finally
            {
                this.m_isCopying = false;
            }
        }
Пример #3
0
 public override void SetValue(string keyName, RegistryValue value)
 {
     this.RunActionWithKey <bool>(keyName, (IDistributedStoreKey regKey) => regKey.SetValue(value.Name, value.Value, value.Kind, false, null), DxStoreKeyAccessMode.Write);
 }
Пример #4
0
        public bool Equals(RegistryValue other)
        {
            int  num    = 0;
            bool result = true;

            if (other == null || other.Value == null)
            {
                result = false;
            }
            else
            {
                if (this.Kind == other.Kind && string.Compare(this.Name, other.Name, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    switch (this.Kind)
                    {
                    case RegistryValueKind.String:
                    case RegistryValueKind.ExpandString:
                        return(SharedHelper.StringIEquals((string)this.Value, (string)other.Value));

                    case RegistryValueKind.Binary:
                    {
                        byte[] array  = (byte[])other.Value;
                        byte[] array2 = (byte[])this.Value;
                        if (array.Length == array2.Length)
                        {
                            foreach (byte b in array2)
                            {
                                if (b != array[num])
                                {
                                    result = false;
                                    break;
                                }
                                num++;
                            }
                            return(result);
                        }
                        return(false);
                    }

                    case RegistryValueKind.DWord:
                        return((int)this.Value == (int)other.Value);

                    case RegistryValueKind.MultiString:
                    {
                        string[] array4 = (string[])other.Value;
                        string[] array5 = (string[])this.Value;
                        if (array4.Length == array5.Length)
                        {
                            foreach (string str in array5)
                            {
                                if (!SharedHelper.StringIEquals(str, array4[num]))
                                {
                                    result = false;
                                    break;
                                }
                                num++;
                            }
                            return(result);
                        }
                        return(false);
                    }

                    case RegistryValueKind.QWord:
                        return((long)this.Value == (long)other.Value);
                    }
                    throw new NotImplementedException();
                }
                result = false;
            }
            return(result);
        }