Ejemplo n.º 1
0
 static Canary15DataSegment()
 {
     Canary15Trace.TraceDateTime(Canary15DataSegment.UtcNow, 0, "Canary15DataSegment().UtcNow.");
     Canary15Trace.TraceTimeSpan(Canary15DataSegment.defaultRefreshPeriod, 1, "Canary15DataSegment().defaultRefreshPeriod.");
     Canary15Trace.TraceTimeSpan(Canary15DataSegment.ReplicationDuration, 2, "Canary15DataSegment().ReplicationDuration.");
     Canary15DataSegment.topoConfigSession      = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 119, ".cctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\common\\Canary15DataSegment.cs");
     Canary15DataSegment.adClientAccessObjectId = Canary15DataSegment.topoConfigSession.GetClientAccessContainerId();
     Canary15DataSegment.LoadClientAccessADObject();
     byte[] array  = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().ObjectGuid.ToByteArray();
     byte[] array2 = Canary15DataSegment.topoConfigSession.GetDatabasesContainerId().ObjectGuid.ToByteArray();
     Canary15DataSegment.adObjectIdsBinary = new byte[array.Length + array2.Length];
     array.CopyTo(Canary15DataSegment.adObjectIdsBinary, 0);
     array2.CopyTo(Canary15DataSegment.adObjectIdsBinary, array.Length);
     if (Canary15Trace.IsTraceEnabled(TraceType.DebugTrace))
     {
         using (SHA256Cng sha256Cng = new SHA256Cng())
         {
             byte[] bytes = sha256Cng.ComputeHash(Canary15DataSegment.adObjectIdsBinary);
             Canary15Trace.TraceDebug(2L, "adObjectIdsBinaryHash:{0}", new object[]
             {
                 Canary15DataSegment.GetHexString(bytes)
             });
             sha256Cng.Clear();
         }
     }
 }
Ejemplo n.º 2
0
        private static string GetHexString(byte[] bytes)
        {
            if (!Canary15Trace.IsTraceEnabled(TraceType.DebugTrace))
            {
                return(null);
            }
            if (bytes == null)
            {
                return("NULL_BYTE_ARRAY");
            }
            StringBuilder stringBuilder = new StringBuilder();

            foreach (byte b in bytes)
            {
                stringBuilder.AppendFormat("{0:x2}", b);
            }
            return(stringBuilder.ToString());
        }