Esempio n. 1
0
        // Token: 0x06006141 RID: 24897 RVA: 0x0014B0E0 File Offset: 0x001492E0
        public byte[] ToSendMessage()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("v:").Append(DiagnosticCommand.Version).Append(';');
            stringBuilder.Append("c:").Append(this.Command.ToString()).Append(';');
            if (this.Organizations == null)
            {
                stringBuilder.Append("o:global").Append(';');
            }
            else if (this.Organizations.Count > 0)
            {
                DiagnosticCommand.AppendGuidList(stringBuilder, "o:", this.Organizations);
            }
            else
            {
                stringBuilder.Append("o:").Append(';');
            }
            if (this.CacheEntries.Count > 0)
            {
                DiagnosticCommand.AppendGuidList(stringBuilder, "e:", this.CacheEntries);
            }
            string s = stringBuilder.ToString().TrimEnd(new char[]
            {
                ';'
            });

            return(Encoding.UTF8.GetBytes(s));
        }
Esempio n. 2
0
 // Token: 0x06006130 RID: 24880 RVA: 0x0014A9B0 File Offset: 0x00148BB0
 private void ProcessDiagnosticCommand(DiagnosticCommand command, PipeStream stream)
 {
     if (command.Command == DiagnosticType.Reset)
     {
         if (command.IsGlobalCacheEntryCommand)
         {
             base.ProvisioningCache.RemoveGlobalDatas(command.CacheEntries);
         }
         else if (command.Organizations == null)
         {
             base.ProvisioningCache.ResetOrganizationData();
         }
         else
         {
             foreach (Guid orgId in command.Organizations)
             {
                 base.ProvisioningCache.RemoveOrganizationDatas(orgId, command.CacheEntries);
             }
         }
         byte[] bytes = Encoding.UTF8.GetBytes("Successfully reset the provisioning cache data");
         stream.Write(bytes, 0, bytes.Length);
         return;
     }
     if (command.Command == DiagnosticType.Dump)
     {
         foreach (CachedEntryObject cachedEntryObject in base.ProvisioningCache.DumpCachedEntries(command.Organizations, command.CacheEntries))
         {
             byte[] array = cachedEntryObject.ToSendMessage();
             stream.Write(array, 0, array.Length);
         }
     }
 }
Esempio n. 3
0
 // Token: 0x06006132 RID: 24882 RVA: 0x0014AD28 File Offset: 0x00148F28
 internal override void StopExecute()
 {
     base.StopExecute();
     if (base.GotStopSignalFromTestCode && this.isWaitForConnection)
     {
         while (this.isWaitForConnection)
         {
             using (NamedPipeClientStream namedPipeClientStream = new NamedPipeClientStream(".", this.pipeName, PipeDirection.InOut))
             {
                 try
                 {
                     byte[] array = new DiagnosticCommand(DiagnosticType.Dump, Guid.NewGuid()).ToSendMessage();
                     namedPipeClientStream.Connect();
                     namedPipeClientStream.Write(array, 0, array.Length);
                     namedPipeClientStream.Flush();
                 }
                 catch
                 {
                 }
                 Thread.Sleep(10000);
             }
         }
         base.AsyncThread.Join();
     }
 }
Esempio n. 4
0
        // Token: 0x0600613F RID: 24895 RVA: 0x0014AEE8 File Offset: 0x001490E8
        public static DiagnosticCommand FromReceivedData(byte[] buffer, int bufLen)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if (bufLen <= 0)
            {
                throw new ArgumentException("bufLen is less than zero.");
            }
            if (buffer.Length < bufLen)
            {
                throw new ArgumentException("The buffer is too small.");
            }
            string @string = Encoding.UTF8.GetString(buffer, 0, bufLen);

            string[] array = @string.Split(new char[]
            {
                ';'
            });
            if (array == null || array.Length < 3)
            {
                throw new ArgumentException("Received diagnostic command is invalid.");
            }
            if (!array[1].StartsWith("c:", StringComparison.OrdinalIgnoreCase))
            {
                throw new ArgumentException(string.Format("Invalid ProvisioningCache diagnostic command received, failed to parse the command {0}", array[1]));
            }
            DiagnosticType command;

            if (!Enum.TryParse <DiagnosticType>(array[1].Substring(array[1].IndexOf(':') + 1), true, out command))
            {
                throw new ArgumentException(string.Format("Invalid diagnostic command type received: {0}", array[1]));
            }
            List <Guid> orgIds = null;

            if (!array[2].StartsWith("o:global", StringComparison.OrdinalIgnoreCase))
            {
                if (string.IsNullOrWhiteSpace(array[2].Substring("o:".Length)))
                {
                    orgIds = new List <Guid>();
                }
                else
                {
                    orgIds = DiagnosticCommand.ParseGuidLists(array[2], "o:", "Org Ids");
                }
            }
            List <Guid> entries;

            if (array.Length > 3 && !string.IsNullOrWhiteSpace(array[3]))
            {
                entries = DiagnosticCommand.ParseGuidLists(array[3], "e:", "Cache Entries");
            }
            else
            {
                entries = new List <Guid>();
            }
            return(new DiagnosticCommand(command, orgIds, entries));
        }
Esempio n. 5
0
        // Token: 0x0600613E RID: 24894 RVA: 0x0014AEB4 File Offset: 0x001490B4
        public static DiagnosticCommand TryFromReceivedData(byte[] buffer, int bufLen, out Exception ex)
        {
            ex = null;
            DiagnosticCommand result = null;

            try
            {
                result = DiagnosticCommand.FromReceivedData(buffer, bufLen);
            }
            catch (Exception ex2)
            {
                ex = ex2;
            }
            return(result);
        }
Esempio n. 6
0
 // Token: 0x06006131 RID: 24881 RVA: 0x0014AACC File Offset: 0x00148CCC
 private void ProcessClientAccept()
 {
     byte[] array = new byte[1000];
     Array.Clear(array, 0, array.Length);
     try
     {
         if (!base.GotStopSignalFromTestCode)
         {
             int               bufLen = this.serverStream.Read(array, 0, array.Length);
             Exception         ex;
             DiagnosticCommand command = DiagnosticCommand.TryFromReceivedData(array, bufLen, out ex);
             if (ex != null)
             {
                 Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCInvalidDiagnosticCommandReceived, this.pipeName, new object[]
                 {
                     this.pipeName,
                     Encoding.UTF8.GetString(array, 0, array.Length),
                     ex.ToString()
                 });
             }
             else
             {
                 this.ProcessDiagnosticCommand(command, this.serverStream);
                 this.serverStream.Flush();
             }
         }
     }
     catch (ArgumentOutOfRangeException ex2)
     {
         Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveClientDiagnosticDommand, this.pipeName, new object[]
         {
             this.pipeName,
             ex2.ToString()
         });
         throw ex2;
     }
     catch (IOException ex3)
     {
         Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveClientDiagnosticDommand, this.pipeName, new object[]
         {
             this.pipeName,
             ex3.ToString()
         });
         throw ex3;
     }
     catch (ObjectDisposedException ex4)
     {
         Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveClientDiagnosticDommand, this.pipeName, new object[]
         {
             this.pipeName,
             ex4.ToString()
         });
         throw ex4;
     }
     catch (InvalidOperationException ex5)
     {
         Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveClientDiagnosticDommand, this.pipeName, new object[]
         {
             this.pipeName,
             ex5.ToString()
         });
         throw ex5;
     }
     catch (NotSupportedException ex6)
     {
         Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveClientDiagnosticDommand, this.pipeName, new object[]
         {
             this.pipeName,
             ex6.ToString()
         });
         throw ex6;
     }
     finally
     {
         this.serverStream.Disconnect();
     }
 }