// Token: 0x060005AB RID: 1451 RVA: 0x000154BC File Offset: 0x000136BC
 private bool DeleteValueInternal(string propertyName, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
 {
     return(DistributedStore.Instance.ExecuteRequest <bool>(this, OperationCategory.DeleteValue, OperationType.Write, string.Format("Property: [{0}] IsBestEffort: [{1}] IsConstrained: [{2}]", propertyName, isIgnoreIfNotExist, constraints != null), delegate(IDistributedStoreKey key)
     {
         this.ThrowIfKeyIsInvalid(key);
         return key.DeleteValue(propertyName, isIgnoreIfNotExist, ReadWriteConstraints.Copy(constraints));
     }));
 }
 // Token: 0x060005AA RID: 1450 RVA: 0x00015444 File Offset: 0x00013644
 public IEnumerable <Tuple <string, object> > GetAllValuesInternal(ReadWriteConstraints constraints)
 {
     return(DistributedStore.Instance.ExecuteRequest <IEnumerable <Tuple <string, object> > >(this, OperationCategory.GetAllValues, OperationType.Read, string.Empty, delegate(IDistributedStoreKey key)
     {
         this.ThrowIfKeyIsInvalid(key);
         return key.GetAllValues(ReadWriteConstraints.Copy(constraints));
     }));
 }
Exemplo n.º 3
0
        private bool IsPropertyExists(string propertyName, ReadWriteConstraints constraints)
        {
            bool result = false;
            RegistryValueKind registryValueKind;

            this.GetValue(propertyName, out result, out registryValueKind, constraints);
            return(result);
        }
Exemplo n.º 4
0
 private WriteOptions GetWriteOptions(ReadWriteConstraints rwc)
 {
     if (rwc == null || rwc.WriteOptions == null)
     {
         return(this.BaseParameters.DefaultWriteOptions);
     }
     return(rwc.WriteOptions);
 }
Exemplo n.º 5
0
 private IEnumerable <string> GetValueNamesInternal(ReadWriteConstraints constraints)
 {
     return(DistributedStore.Instance.ExecuteRequest <IEnumerable <string> >(this, OperationCategory.GetValueNames, OperationType.Read, string.Empty, delegate(IDistributedStoreKey key)
     {
         this.ThrowIfKeyIsInvalid(key);
         return key.GetValueNames(constraints);
     }));
 }
Exemplo n.º 6
0
 // Token: 0x060005C4 RID: 1476 RVA: 0x00015F74 File Offset: 0x00014174
 public IEnumerable <Tuple <string, RegistryValueKind> > GetValueInfos(ReadWriteConstraints constraints)
 {
     PropertyNameInfo[] propertyNameInfos = this.GetPropertyNameInfos(constraints);
     if (propertyNameInfos != null)
     {
         return((from pni in propertyNameInfos
                 select new Tuple <string, RegistryValueKind>(pni.Name, (RegistryValueKind)pni.Kind)).ToArray <Tuple <string, RegistryValueKind> >());
     }
     return(Utils.EmptyArray <Tuple <string, RegistryValueKind> >());
 }
Exemplo n.º 7
0
 // Token: 0x060005C3 RID: 1475 RVA: 0x00015F18 File Offset: 0x00014118
 public IEnumerable <string> GetValueNames(ReadWriteConstraints constraints)
 {
     PropertyNameInfo[] propertyNameInfos = this.GetPropertyNameInfos(constraints);
     if (propertyNameInfos != null)
     {
         return((from pni in propertyNameInfos
                 select pni.Name).ToArray <string>());
     }
     return(Utils.EmptyArray <string>());
 }
Exemplo n.º 8
0
 // Token: 0x0600053A RID: 1338 RVA: 0x00013B98 File Offset: 0x00011D98
 private bool IsKeyExists(string subKeyName, ReadWriteConstraints constraints)
 {
     using (IDistributedStoreKey distributedStoreKey = this.OpenKey(subKeyName, DxStoreKeyAccessMode.Read, true, constraints))
     {
         if (distributedStoreKey != null)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 9
0
        // Token: 0x060005C2 RID: 1474 RVA: 0x00015EB8 File Offset: 0x000140B8
        public PropertyNameInfo[] GetPropertyNameInfos(ReadWriteConstraints constraints)
        {
            ReadOptions readOptions = this.GetReadOptions(constraints);

            return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <PropertyNameInfo[]>(OperationCategory.GetSubKeyNames, this.FullKeyName, delegate()
            {
                DxStoreAccessRequest.GetPropertyNames getPropertyNames = this.CreateRequest <DxStoreAccessRequest.GetPropertyNames>();
                getPropertyNames.ReadOptions = readOptions;
                DxStoreAccessReply.GetPropertyNames propertyNames = this.BaseParameters.Client.GetPropertyNames(getPropertyNames, null);
                this.SetReadResult(constraints, propertyNames.ReadResult);
                return propertyNames.Infos;
            }, false));
        }
Exemplo n.º 10
0
        // Token: 0x060005C1 RID: 1473 RVA: 0x00015DF4 File Offset: 0x00013FF4
        public IEnumerable <string> GetSubkeyNames(ReadWriteConstraints constraints)
        {
            ReadOptions readOptions = this.GetReadOptions(constraints);

            return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <string[]>(OperationCategory.GetSubKeyNames, this.FullKeyName, delegate()
            {
                DxStoreAccessRequest.GetSubkeyNames getSubkeyNames = this.CreateRequest <DxStoreAccessRequest.GetSubkeyNames>();
                getSubkeyNames.ReadOptions = readOptions;
                DxStoreAccessReply.GetSubkeyNames subkeyNames = this.BaseParameters.Client.GetSubkeyNames(getSubkeyNames, null);
                this.SetReadResult(constraints, subkeyNames.ReadResult);
                return subkeyNames.Keys;
            }, false));
        }
Exemplo n.º 11
0
        // Token: 0x0600052B RID: 1323 RVA: 0x000135B4 File Offset: 0x000117B4
        public bool DeleteValue(string propertyName, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
        {
            if (isIgnoreIfNotExist && !this.IsPropertyExists(propertyName, constraints))
            {
                return(false);
            }
            int num = ClusapiMethods.ClusterRegDeleteValue(this.KeyHandle, propertyName);

            if (num != 0)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegDeleteValue()", new object[0]);
            }
            return(true);
        }
Exemplo n.º 12
0
        // Token: 0x06000537 RID: 1335 RVA: 0x000139C4 File Offset: 0x00011BC4
        private bool DeleteKeyInternal(string keyName, ReadWriteConstraints constraints)
        {
            IEnumerable <string> subkeyNames = this.GetSubkeyNames(keyName, constraints);

            foreach (string path in subkeyNames)
            {
                this.DeleteKeyInternal(Path.Combine(keyName, path), constraints);
            }
            int num = ClusapiMethods.ClusterRegDeleteKey(this.KeyHandle, keyName);

            if (num != 2 && num != 0)
            {
                throw new ClusterApiException("ClusterRegDeleteKey", new Win32Exception(num));
            }
            return(true);
        }
Exemplo n.º 13
0
        // Token: 0x060005C7 RID: 1479 RVA: 0x0001618C File Offset: 0x0001438C
        public void ExecuteBatchRequest(List <DxStoreBatchCommand> commands, ReadWriteConstraints constraints)
        {
            WriteOptions writeOptions = this.GetWriteOptions(constraints);

            this.BaseParameters.KeyFactory.RunOperationAndTranslateException(OperationCategory.ExecuteBatch, this.FullKeyName, delegate()
            {
                DxStoreAccessRequest.ExecuteBatch executeBatch = new DxStoreAccessRequest.ExecuteBatch
                {
                    Commands     = commands.ToArray(),
                    WriteOptions = writeOptions
                };
                executeBatch.Initialize(this.FullKeyName, this.BaseParameters.IsPrivate, this.BaseParameters.Self);
                DxStoreAccessReply.ExecuteBatch executeBatch2 = this.BaseParameters.Client.ExecuteBatch(executeBatch, null);
                this.SetWriteResult(constraints, executeBatch2.WriteResult);
            });
        }
Exemplo n.º 14
0
        // Token: 0x060005C5 RID: 1477 RVA: 0x0001607C File Offset: 0x0001427C
        public IEnumerable <Tuple <string, object> > GetAllValues(ReadWriteConstraints constraints)
        {
            List <Tuple <string, object> > list = new List <Tuple <string, object> >();
            ReadOptions readOptions             = this.GetReadOptions(constraints);

            return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <List <Tuple <string, object> > >(OperationCategory.GetAllValues, this.FullKeyName, delegate()
            {
                DxStoreAccessRequest.GetAllProperties getAllProperties = this.CreateRequest <DxStoreAccessRequest.GetAllProperties>();
                getAllProperties.ReadOptions = readOptions;
                DxStoreAccessReply.GetAllProperties allProperties = this.BaseParameters.Client.GetAllProperties(getAllProperties, null);
                this.SetReadResult(constraints, allProperties.ReadResult);
                foreach (Tuple <string, PropertyValue> tuple in allProperties.Values)
                {
                    string item = tuple.Item1;
                    object item2 = (tuple.Item2 != null) ? tuple.Item2.Value : null;
                    list.Add(new Tuple <string, object>(item, item2));
                }
                return list;
            }, false));
        }
Exemplo n.º 15
0
 // Token: 0x060005C0 RID: 1472 RVA: 0x00015D34 File Offset: 0x00013F34
 public bool DeleteValue(string propertyName, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
 {
     return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <bool>(OperationCategory.DeleteValue, this.FullKeyName, delegate()
     {
         ReadOptions readOptions = this.GetReadOptions(constraints);
         WriteOptions writeOptions = this.GetWriteOptions(constraints);
         DxStoreAccessRequest.DeleteProperty deleteProperty = this.CreateRequest <DxStoreAccessRequest.DeleteProperty>();
         deleteProperty.Name = propertyName;
         deleteProperty.ReadOptions = readOptions;
         deleteProperty.WriteOptions = writeOptions;
         DxStoreAccessReply.DeleteProperty deleteProperty2 = this.BaseParameters.Client.DeleteProperty(deleteProperty, null);
         this.SetReadResult(constraints, deleteProperty2.ReadResult);
         this.SetWriteResult(constraints, deleteProperty2.WriteResult);
         if (!deleteProperty2.IsExist && !isIgnoreIfNotExist)
         {
             throw new DxStorePropertyNotFoundException(propertyName);
         }
         return deleteProperty2.IsExist;
     }, false));
 }
Exemplo n.º 16
0
        // Token: 0x0600052A RID: 1322 RVA: 0x00013538 File Offset: 0x00011738
        public IEnumerable <Tuple <string, object> > GetAllValues(ReadWriteConstraints constraints)
        {
            List <Tuple <string, object> > list       = new List <Tuple <string, object> >();
            IEnumerable <string>           valueNames = this.GetValueNames(constraints);

            if (valueNames != null)
            {
                foreach (string text in valueNames)
                {
                    bool flag = false;
                    RegistryValueKind registryValueKind = RegistryValueKind.Unknown;
                    object            value             = this.GetValue(text, out flag, out registryValueKind, constraints);
                    if (flag)
                    {
                        list.Add(new Tuple <string, object>(text, value));
                    }
                }
            }
            return(list);
        }
Exemplo n.º 17
0
        // Token: 0x0600052D RID: 1325 RVA: 0x00013694 File Offset: 0x00011894
        public IEnumerable <Tuple <string, RegistryValueKind> > GetValueInfos(ReadWriteConstraints constraints)
        {
            List <Tuple <string, RegistryValueKind> > list = new List <Tuple <string, RegistryValueKind> >();
            int num  = 128;
            int num2 = 0;
            int item = 0;
            int num5;

            for (;;)
            {
                StringBuilder stringBuilder = new StringBuilder(num);
                int           num3          = num;
                int           num4          = 0;
                num5 = ClusapiMethods.ClusterRegEnumValue(this.KeyHandle, num2, stringBuilder, ref num3, ref item, IntPtr.Zero, ref num4);
                if (259 == num5)
                {
                    return(list);
                }
                if (234 != num5 && num5 != 0)
                {
                    break;
                }
                if (num3 > num)
                {
                    num           = num3 + 1;
                    num4          = 0;
                    stringBuilder = new StringBuilder(num);
                    num5          = ClusapiMethods.ClusterRegEnumValue(this.KeyHandle, num2, stringBuilder, ref num3, ref item, IntPtr.Zero, ref num4);
                }
                if (234 != num5 && num5 != 0)
                {
                    goto Block_6;
                }
                list.Add(new Tuple <string, RegistryValueKind>(stringBuilder.ToString(), (RegistryValueKind)item));
                num2++;
            }
            throw AmExceptionHelper.ConstructClusterApiException(num5, "ClusterRegEnumValue(first)", new object[0]);
Block_6:
            throw AmExceptionHelper.ConstructClusterApiException(num5, "ClusterRegEnumValue(second)", new object[0]);
        }
Exemplo n.º 18
0
 // Token: 0x06000530 RID: 1328 RVA: 0x000137B0 File Offset: 0x000119B0
 public void ExecuteBatchRequest(List <DxStoreBatchCommand> commands, ReadWriteConstraints constraints)
 {
     using (ClusdbBatchRequest clusdbBatchRequest = new ClusdbBatchRequest(this))
     {
         foreach (DxStoreBatchCommand dxStoreBatchCommand in commands)
         {
             DxStoreBatchCommand.CreateKey createKey = dxStoreBatchCommand as DxStoreBatchCommand.CreateKey;
             if (createKey != null)
             {
                 clusdbBatchRequest.CreateKey(createKey.Name);
             }
             else
             {
                 DxStoreBatchCommand.DeleteKey deleteKey = dxStoreBatchCommand as DxStoreBatchCommand.DeleteKey;
                 if (deleteKey != null)
                 {
                     clusdbBatchRequest.DeleteKey(deleteKey.Name);
                 }
                 else
                 {
                     DxStoreBatchCommand.SetProperty setProperty = dxStoreBatchCommand as DxStoreBatchCommand.SetProperty;
                     if (setProperty != null)
                     {
                         clusdbBatchRequest.SetValue(setProperty.Name, setProperty.Value.Value, (RegistryValueKind)setProperty.Value.Kind);
                     }
                     else
                     {
                         DxStoreBatchCommand.DeleteProperty deleteProperty = dxStoreBatchCommand as DxStoreBatchCommand.DeleteProperty;
                         if (deleteProperty != null)
                         {
                             clusdbBatchRequest.DeleteValue(deleteProperty.Name);
                         }
                     }
                 }
             }
         }
         clusdbBatchRequest.Execute(constraints);
     }
 }
Exemplo n.º 19
0
        public static T GetValue <T>(this IDistributedStoreKey key, string propertyName, T defaultValue = default(T), ReadWriteConstraints constraints = null)
        {
            bool flag;

            return(key.GetValue(propertyName, defaultValue, out flag, constraints));
        }
Exemplo n.º 20
0
 // Token: 0x06000529 RID: 1321 RVA: 0x00013524 File Offset: 0x00011724
 public object GetValue(string propertyName, out bool isValueExist, out RegistryValueKind valueKind, ReadWriteConstraints constraints)
 {
     return(this.GetRaw(this.KeyHandle, propertyName, out isValueExist, out valueKind));
 }
Exemplo n.º 21
0
        // Token: 0x06000528 RID: 1320 RVA: 0x00013480 File Offset: 0x00011680
        public bool SetValue(string propertyName, object propertyValue, RegistryValueKind valueKind, bool isBestEffort, ReadWriteConstraints constraints)
        {
            bool result = false;

            using (ClusdbMarshalledProperty clusdbMarshalledProperty = ClusdbMarshalledProperty.Create(propertyName, propertyValue, valueKind))
            {
                if (clusdbMarshalledProperty != null)
                {
                    int num = ClusapiMethods.ClusterRegSetValue(this.KeyHandle, clusdbMarshalledProperty.PropertyName, clusdbMarshalledProperty.ValueKind, clusdbMarshalledProperty.PropertyValueIntPtr, clusdbMarshalledProperty.PropertyValueSize);
                    if (num != 0)
                    {
                        if (!isBestEffort)
                        {
                            throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegSetValue()", new object[0]);
                        }
                    }
                    else
                    {
                        result = true;
                    }
                }
                else if (!isBestEffort)
                {
                    string typeName = (propertyValue != null) ? propertyValue.GetType().Name : "<null>";
                    throw new ClusterApiException("ClusterRegSetValue(unsupported registry type)", new ClusterUnsupportedRegistryTypeException(typeName));
                }
            }
            return(result);
        }
Exemplo n.º 22
0
 // Token: 0x06000527 RID: 1319 RVA: 0x00013468 File Offset: 0x00011668
 public bool DeleteKey(string subKeyName, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
 {
     return(this.IsKeyExists(subKeyName, constraints) && this.DeleteKeyInternal(subKeyName, constraints));
 }
Exemplo n.º 23
0
        // Token: 0x060005BF RID: 1471 RVA: 0x00015BE4 File Offset: 0x00013DE4
        public object GetValue(string propertyName, out bool isValueExist, out RegistryValueKind valueKind, ReadWriteConstraints constraints)
        {
            ReadOptions readOptions = this.GetReadOptions(constraints);

            isValueExist = false;
            valueKind    = RegistryValueKind.Unknown;
            PropertyValue propertyValue = this.BaseParameters.KeyFactory.RunOperationAndTranslateException <PropertyValue>(OperationCategory.GetValue, this.FullKeyName, delegate()
            {
                DxStoreAccessRequest.GetProperty getProperty = this.CreateRequest <DxStoreAccessRequest.GetProperty>();
                getProperty.Name        = propertyName;
                getProperty.ReadOptions = readOptions;
                DxStoreAccessReply.GetProperty property = this.BaseParameters.Client.GetProperty(getProperty, null);
                this.SetReadResult(constraints, property.ReadResult);
                return(property.Value);
            }, false);
            object result = null;

            if (propertyValue != null)
            {
                isValueExist = true;
                result       = propertyValue.Value;
                valueKind    = (RegistryValueKind)propertyValue.Kind;
            }
            return(result);
        }
Exemplo n.º 24
0
 // Token: 0x06000525 RID: 1317 RVA: 0x00013455 File Offset: 0x00011655
 public IDistributedStoreKey OpenKey(string subKeyName, DxStoreKeyAccessMode mode, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
 {
     return(this.OpenKeyInternal(subKeyName, mode, isIgnoreIfNotExist));
 }
Exemplo n.º 25
0
 // Token: 0x060005BB RID: 1467 RVA: 0x000158A4 File Offset: 0x00013AA4
 public IDistributedStoreKey OpenKey(string subkeyName, DxStoreKeyAccessMode mode, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
 {
     return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <IDistributedStoreKey>(OperationCategory.OpenKey, Path.Combine(this.FullKeyName, subkeyName), delegate()
     {
         ReadOptions readOptions = this.GetReadOptions(constraints);
         WriteOptions writeOptions = this.GetWriteOptions(constraints);
         DxStoreAccessRequest.CheckKey checkKey = this.CreateRequest <DxStoreAccessRequest.CheckKey>();
         checkKey.IsCreateIfNotExist = (mode == DxStoreKeyAccessMode.CreateIfNotExist);
         checkKey.SubkeyName = subkeyName;
         checkKey.ReadOptions = readOptions;
         checkKey.WriteOptions = writeOptions;
         DxStoreAccessReply.CheckKey checkKey2 = this.BaseParameters.Client.CheckKey(checkKey, null);
         this.SetReadResult(constraints, checkKey2.ReadResult);
         this.SetWriteResult(constraints, checkKey2.WriteResult);
         IDistributedStoreKey result = null;
         if (!checkKey2.IsExist)
         {
             if (!isIgnoreIfNotExist)
             {
                 throw new DxStoreKeyNotFoundException(subkeyName);
             }
         }
         else
         {
             result = new DxStoreKey(Path.Combine(this.FullKeyName, subkeyName), mode, this.BaseParameters);
         }
         return result;
     }, false));
 }
Exemplo n.º 26
0
 // Token: 0x0600052E RID: 1326 RVA: 0x0001377B File Offset: 0x0001197B
 public IEnumerable <string> GetValueNames(ReadWriteConstraints constraints)
 {
     return(from vi in this.GetValueInfos(constraints)
            select vi.Item1);
 }
Exemplo n.º 27
0
        public static bool SetValue <T>(this IDistributedStoreKey key, string propertyName, T propertyValue, bool isBestEffort = false, ReadWriteConstraints constraints = null)
        {
            RegistryValueKind valueKind = Utils.GetValueKind(propertyValue);

            return(key.SetValue(propertyName, propertyValue, valueKind, isBestEffort, constraints));
        }
Exemplo n.º 28
0
 public static IDistributedStoreKey OpenOrCreateKey(this IDistributedStoreKey key, string keyName, bool isIgnoreIfNotExist = false, ReadWriteConstraints constraints = null)
 {
     return(key.OpenKey(keyName, DxStoreKeyAccessMode.CreateIfNotExist, isIgnoreIfNotExist, constraints));
 }
Exemplo n.º 29
0
 public static IEnumerable <string> GetSubkeyNames(this IDistributedStoreKey parentKey, string subkeyName, ReadWriteConstraints constraints)
 {
     using (IDistributedStoreKey distributedStoreKey = parentKey.OpenKey(subkeyName, DxStoreKeyAccessMode.Read, true, constraints))
     {
         if (distributedStoreKey != null)
         {
             return(distributedStoreKey.GetSubkeyNames(constraints));
         }
     }
     return(null);
 }
Exemplo n.º 30
0
        public static T GetValue <T>(this IDistributedStoreKey key, string propertyName, T defaultValue, out bool isValueExist, ReadWriteConstraints constriants = null)
        {
            RegistryValueKind registryValueKind;
            object            value = key.GetValue(propertyName, out isValueExist, out registryValueKind, constriants);

            if (isValueExist)
            {
                return((T)((object)value));
            }
            return(defaultValue);
        }