Exemplo n.º 1
0
        // Token: 0x060005BD RID: 1469 RVA: 0x000159CC File Offset: 0x00013BCC
        public bool DeleteKey(string keyName, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
        {
            ReadOptions  readOptions  = this.GetReadOptions(constraints);
            WriteOptions writeOptions = this.GetWriteOptions(constraints);

            return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <bool>(OperationCategory.DeleteKey, this.FullKeyName, delegate()
            {
                DxStoreAccessRequest.DeleteKey deleteKey = this.CreateRequest <DxStoreAccessRequest.DeleteKey>();
                deleteKey.SubkeyName = keyName;
                deleteKey.ReadOptions = readOptions;
                deleteKey.WriteOptions = writeOptions;
                DxStoreAccessReply.DeleteKey deleteKey2 = this.BaseParameters.Client.DeleteKey(deleteKey, null);
                if (!deleteKey2.IsExist && !isIgnoreIfNotExist)
                {
                    throw new DxStoreKeyNotFoundException(keyName);
                }
                this.SetReadResult(constraints, deleteKey2.ReadResult);
                this.SetWriteResult(constraints, deleteKey2.WriteResult);
                return deleteKey2.IsExist;
            }, false));
        }
Exemplo n.º 2
0
        private DxStoreAccessReply.DeleteKey DeleteKeyInternal(DxStoreAccessRequest.DeleteKey request)
        {
            bool isStale = !this.EnsureInstanceReadyAndNotStale(request.ReadOptions);

            DxStoreAccessReply.DeleteKey deleteKey = this.CreateReply <DxStoreAccessReply.DeleteKey>();
            string keyName = Utils.CombinePathNullSafe(request.FullKeyName, request.SubkeyName);

            deleteKey.ReadResult = new ReadResult
            {
                IsStale = isStale
            };
            deleteKey.IsExist = this.instance.LocalDataStore.IsKeyExist(keyName);
            if (deleteKey.IsExist)
            {
                DxStoreCommand.DeleteKey command = new DxStoreCommand.DeleteKey
                {
                    KeyName    = request.FullKeyName,
                    SubkeyName = request.SubkeyName
                };
                deleteKey.WriteResult = this.ExecuteCommand(command, request.WriteOptions, this.UpdateTimeout);
            }
            return(this.FinishRequest <DxStoreAccessReply.DeleteKey>(deleteKey));
        }