Exemple #1
0
 // Token: 0x06000603 RID: 1539 RVA: 0x000168C4 File Offset: 0x00014AC4
 public void CreateKey(string keyName)
 {
     DxStoreBatchCommand.CreateKey item = new DxStoreBatchCommand.CreateKey
     {
         Name = keyName
     };
     this.Commands.Add(item);
 }
 // 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);
     }
 }
Exemple #3
0
        private void ExecuteBatchInternal(int?instanceNumber, KeyContainer container, DxStoreBatchCommand[] commands)
        {
            int  num  = -1;
            bool flag = ExTraceGlobals.StoreWriteTracer.IsTraceEnabled(TraceType.DebugTrace);

            foreach (DxStoreBatchCommand dxStoreBatchCommand in commands)
            {
                num++;
                bool flag2 = false;
                WellKnownBatchCommandName typeId = dxStoreBatchCommand.GetTypeId();
                if (flag)
                {
                    ExTraceGlobals.StoreWriteTracer.TraceDebug <int, WellKnownBatchCommandName, string>((long)this.identityHash, "Executing batch operation# {0} - {1}: {2}", num, typeId, dxStoreBatchCommand.GetDebugString());
                }
                switch (typeId)
                {
                case WellKnownBatchCommandName.CreateKey:
                {
                    DxStoreBatchCommand.CreateKey createKey = dxStoreBatchCommand as DxStoreBatchCommand.CreateKey;
                    if (createKey != null)
                    {
                        flag2     = true;
                        container = this.FindContainer(this.JoinKeys(container.FullName, createKey.Name), true);
                    }
                    break;
                }

                case WellKnownBatchCommandName.DeleteKey:
                {
                    DxStoreBatchCommand.DeleteKey deleteKey = dxStoreBatchCommand as DxStoreBatchCommand.DeleteKey;
                    if (deleteKey != null)
                    {
                        flag2 = true;
                        KeyContainer keyContainer = this.FindContainer(this.JoinKeys(container.FullName, deleteKey.Name), false);
                        if (instanceNumber != null && keyContainer != null && keyContainer.Parent != null)
                        {
                            keyContainer.Parent.SubKeys.Remove(keyContainer.Name);
                        }
                    }
                    break;
                }

                case WellKnownBatchCommandName.SetProperty:
                {
                    DxStoreBatchCommand.SetProperty setProperty = dxStoreBatchCommand as DxStoreBatchCommand.SetProperty;
                    if (setProperty != null)
                    {
                        flag2 = true;
                        this.SetPropertyInternal(container, setProperty.Name, setProperty.Value.Clone());
                    }
                    break;
                }

                case WellKnownBatchCommandName.DeleteProperty:
                {
                    DxStoreBatchCommand.DeleteProperty deleteProperty = dxStoreBatchCommand as DxStoreBatchCommand.DeleteProperty;
                    if (deleteProperty != null)
                    {
                        flag2 = true;
                        this.DeletePropertyInternal(container, deleteProperty.Name);
                    }
                    break;
                }
                }
                if (!flag2 && ExTraceGlobals.StoreWriteTracer.IsTraceEnabled(TraceType.ErrorTrace))
                {
                    ExTraceGlobals.StoreWriteTracer.TraceError <int, WellKnownBatchCommandName, string>((long)this.identityHash, "Unknown batch command# {0} - {1}: {2}", num, typeId, dxStoreBatchCommand.GetType().Name);
                }
            }
        }