Exemplo n.º 1
0
        internal static ObjectFullSyncPageToken Parse(byte[] tokenBytes)
        {
            if (tokenBytes == null)
            {
                throw new ArgumentNullException("tokenBytes");
            }
            Exception innerException;

            try
            {
                using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(tokenBytes, typeof(ObjectFullSyncPageToken)))
                {
                    int num = (int)backSyncCookieReader.GetNextAttributeValue();
                    ServiceInstanceId serviceInstanceId             = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue());
                    long                     dateData               = (long)backSyncCookieReader.GetNextAttributeValue();
                    long                     dateData2              = (long)backSyncCookieReader.GetNextAttributeValue();
                    Guid                     invocationId           = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    BackSyncOptions          syncOptions            = (BackSyncOptions)((int)backSyncCookieReader.GetNextAttributeValue());
                    string[]                 array                  = (string[])backSyncCookieReader.GetNextAttributeValue();
                    byte[]                   array2                 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    string[]                 errorObjects           = (string[])backSyncCookieReader.GetNextAttributeValue();
                    Dictionary <string, int> errorObjectsAndCount   = BackSyncCookie.ParseErrorObjectsAndFailureCounts(errorObjects);
                    DateTime                 sequenceStartTimestamp = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue());
                    Guid                     sequenceId             = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    HashSet <SyncObjectId>   hashSet                = new HashSet <SyncObjectId>();
                    if (array != null)
                    {
                        foreach (string identity in array)
                        {
                            hashSet.Add(SyncObjectId.Parse(identity));
                        }
                    }
                    FullSyncObjectCookie objectCookie = (array2 == null) ? null : FullSyncObjectCookie.Parse(array2);
                    return(new ObjectFullSyncPageToken(invocationId, hashSet, syncOptions, DateTime.FromBinary(dateData), DateTime.FromBinary(dateData2), objectCookie, errorObjectsAndCount, serviceInstanceId, sequenceId, sequenceStartTimestamp));
                }
            }
            catch (ArgumentException ex)
            {
                innerException = ex;
            }
            catch (IOException ex2)
            {
                innerException = ex2;
            }
            catch (FormatException ex3)
            {
                innerException = ex3;
            }
            catch (InvalidCookieException ex4)
            {
                innerException = ex4;
            }
            throw new InvalidCookieException(innerException);
        }
        // Token: 0x060061E2 RID: 25058 RVA: 0x0014E6C0 File Offset: 0x0014C8C0
        public static BackSyncCookie Parse(byte[] binaryCookie)
        {
            if (binaryCookie == null)
            {
                ExTraceGlobals.BackSyncTracer.TraceError((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse input binaryCookie is NULL");
                throw new ArgumentNullException("binaryCookie");
            }
            ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse Read BackSync binary cookie \"{0}\"", Convert.ToBase64String(binaryCookie));
            Exception ex2;

            try
            {
                using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(binaryCookie, typeof(BackSyncCookie)))
                {
                    int num = (int)backSyncCookieReader.GetNextAttributeValue();
                    ServiceInstanceId serviceInstanceId = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue());
                    long   dateData     = (long)backSyncCookieReader.GetNextAttributeValue();
                    long   dateData2    = (long)backSyncCookieReader.GetNextAttributeValue();
                    Guid   invocationId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    bool   moreData     = (bool)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array        = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array != null)
                    {
                        ADDirSyncCookie.Parse(array);
                    }
                    string[] errorObjects = (string[])backSyncCookieReader.GetNextAttributeValue();
                    Dictionary <string, int> errorObjects2 = BackSyncCookie.ParseErrorObjectsAndFailureCounts(errorObjects);
                    long   dateData3 = (long)backSyncCookieReader.GetNextAttributeValue();
                    byte[] lastDirSyncCookieWithReplicationVectors = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    long   dateData4  = (long)backSyncCookieReader.GetNextAttributeValue();
                    Guid   sequenceId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    return(new BackSyncCookie(DateTime.FromBinary(dateData), DateTime.FromBinary(dateData2), DateTime.FromBinary(dateData3), invocationId, moreData, array, errorObjects2, lastDirSyncCookieWithReplicationVectors, serviceInstanceId, sequenceId, DateTime.FromBinary(dateData4)));
                }
            }
            catch (ArgumentException ex)
            {
                ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse ArgumentException {0}", ex.ToString());
                ex2 = ex;
            }
            catch (IOException ex3)
            {
                ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse IOException {0}", ex3.ToString());
                ex2 = ex3;
            }
            catch (FormatException ex4)
            {
                ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse FormatException {0}", ex4.ToString());
                ex2 = ex4;
            }
            ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse throw InvalidCookieException {0}", ex2.ToString());
            throw new InvalidCookieException(ex2);
        }
Exemplo n.º 3
0
        internal new static MergePageToken Parse(byte[] tokenBytes)
        {
            if (tokenBytes == null)
            {
                ExTraceGlobals.MergeTracer.TraceError((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse tokenBytes is NULL");
                throw new ArgumentNullException("tokenBytes");
            }
            ExTraceGlobals.MergeTracer.TraceDebug((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse entering");
            Exception ex2;

            try
            {
                using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(tokenBytes, typeof(MergePageToken)))
                {
                    int num = (int)backSyncCookieReader.GetNextAttributeValue();
                    backSyncCookieReader.GetNextAttributeValue();
                    MergeState mergeState = (MergeState)backSyncCookieReader.GetNextAttributeValue();
                    if (mergeState == MergeState.Complete)
                    {
                        throw new InvalidCookieException();
                    }
                    byte[]   tenantFullSyncPageTokenBytes = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    byte[]   incrementalSyncCookieBytes   = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    string[] errorObjects = (string[])backSyncCookieReader.GetNextAttributeValue();
                    Dictionary <string, int> errorObjectsAndFailureCounts = BackSyncCookie.ParseErrorObjectsAndFailureCounts(errorObjects);
                    return(new MergePageToken(mergeState, tenantFullSyncPageTokenBytes, incrementalSyncCookieBytes, errorObjectsAndFailureCounts));
                }
            }
            catch (ArgumentException ex)
            {
                ExTraceGlobals.MergeTracer.TraceError <string>((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse ArgumentException {0}", ex.ToString());
                ex2 = ex;
            }
            catch (IOException ex3)
            {
                ExTraceGlobals.MergeTracer.TraceError <string>((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse IOException {0}", ex3.ToString());
                ex2 = ex3;
            }
            catch (FormatException ex4)
            {
                ExTraceGlobals.MergeTracer.TraceError <string>((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse FormatException {0}", ex4.ToString());
                ex2 = ex4;
            }
            catch (InvalidCookieException ex5)
            {
                ExTraceGlobals.MergeTracer.TraceError <string>((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse InvalidCookieException {0}", ex5.ToString());
                ex2 = ex5;
            }
            ExTraceGlobals.MergeTracer.TraceError <string>((long)typeof(MergePageToken).GetHashCode(), "MergePageToken.Parse throw InvalidCookieException {0}", ex2.ToString());
            throw new InvalidCookieException(ex2);
        }
Exemplo n.º 4
0
        public static FullSyncObjectCookie Parse(byte[] bytes)
        {
            ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "FullSyncObjectCookie.Parse entering");
            if (bytes == null)
            {
                ExTraceGlobals.BackSyncTracer.TraceError((long)SyncConfiguration.TraceId, "FullSyncObjectCookie.Parse bytes is NULL");
                throw new ArgumentNullException("bytes");
            }
            Exception ex2;

            try
            {
                using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(bytes, typeof(FullSyncObjectCookie)))
                {
                    return(new FullSyncObjectCookie
                    {
                        Version = (int)backSyncCookieReader.GetNextAttributeValue(),
                        ServiceInstanceId = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue()),
                        ObjectId = SyncObjectId.Parse((string)backSyncCookieReader.GetNextAttributeValue()),
                        ReadRestartsCount = (int)backSyncCookieReader.GetNextAttributeValue(),
                        UsnChanged = (long)backSyncCookieReader.GetNextAttributeValue(),
                        EnumerateLinks = (bool)backSyncCookieReader.GetNextAttributeValue(),
                        LinkRangeStart = (int)backSyncCookieReader.GetNextAttributeValue(),
                        LinkVersion = (int)backSyncCookieReader.GetNextAttributeValue(),
                        LinkTarget = (string)backSyncCookieReader.GetNextAttributeValue(),
                        LinkName = (string)backSyncCookieReader.GetNextAttributeValue()
                    });
                }
            }
            catch (ArgumentException ex)
            {
                ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "FullSyncObjectCookie.Parse ArgumentException {0}", ex.ToString());
                ex2 = ex;
            }
            catch (IOException ex3)
            {
                ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "FullSyncObjectCookie.Parse IOException {0}", ex3.ToString());
                ex2 = ex3;
            }
            catch (FormatException ex4)
            {
                ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "FullSyncObjectCookie.Parse FormatException {0}", ex4.ToString());
                ex2 = ex4;
            }
            ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "FullSyncObjectCookie.Parse throw InvalidCookieException {0}", ex2.ToString());
            throw new InvalidCookieException(ex2);
        }
        public TenantRelocationSyncPageToken(byte[] tokenBytes)
        {
            Exception ex = null;

            try
            {
                using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(tokenBytes, typeof(TenantRelocationSyncPageToken)))
                {
                    this.Version = (int)backSyncCookieReader.GetNextAttributeValue();
                    backSyncCookieReader.GetNextAttributeValue();
                    this.Timestamp = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue());
                    this.LastReadFailureStartTime           = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue());
                    this.InvocationId                       = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.TenantConfigUnitObjectGuid         = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.TenantOrganizationalUnitObjectGuid = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.IsTenantConfigUnitInConfigNc       = (bool)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array != null)
                    {
                        this.PartitionHint = TenantPartitionHint.Deserialize(array);
                    }
                    this.State = (TenantRelocationSyncState)backSyncCookieReader.GetNextAttributeValue();
                    this.ConfigUnitObjectUSN            = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.ConfigUnitTombstoneUSN         = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.OrganizationalUnitObjectUSN    = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.OrganizationalUnitTombstoneUSN = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.SpecialObjectsUSN = (long)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array2 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array2 != null)
                    {
                        this.ConfigNcWatermarks = WatermarkMap.Parse(array2);
                    }
                    byte[] array3 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array3 != null)
                    {
                        this.PendingConfigNcWatermarks = WatermarkMap.Parse(array3);
                    }
                    byte[] array4 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array4 != null)
                    {
                        this.Watermarks = WatermarkMap.Parse(array4);
                    }
                    this.WatermarksInvocationId        = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.PendingWatermarksInvocationId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array5 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array5 != null)
                    {
                        this.PendingWatermarks = WatermarkMap.Parse(array5);
                    }
                    this.LinkPageStart           = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.LinkPageEnd             = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.LinkRangeStart          = (int)backSyncCookieReader.GetNextAttributeValue();
                    this.ObjectsInLinkPage       = (int)backSyncCookieReader.GetNextAttributeValue();
                    this.AffinityDcFqdn          = (string)backSyncCookieReader.GetNextAttributeValue();
                    this.AffinityTargetDcFqdn    = (string)backSyncCookieReader.GetNextAttributeValue();
                    this.PreSyncLdapPagingCookie = (byte[])backSyncCookieReader.GetNextAttributeValue();
                }
            }
            catch (ArgumentException ex2)
            {
                ExTraceGlobals.TenantRelocationTracer.TraceError <string>((long)this.TenantConfigUnitObjectGuid.GetHashCode(), "TenantRelocationSyncPageToken ArgumentException {0}", ex2.ToString());
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ExTraceGlobals.TenantRelocationTracer.TraceError <string>((long)this.TenantConfigUnitObjectGuid.GetHashCode(), "TenantRelocationSyncPageToken IOException {0}", ex3.ToString());
                ex = ex3;
            }
            catch (FormatException ex4)
            {
                ExTraceGlobals.TenantRelocationTracer.TraceError <string>((long)this.TenantConfigUnitObjectGuid.GetHashCode(), "TenantRelocationSyncPageToken FormatException {0}", ex4.ToString());
                ex = ex4;
            }
            catch (InvalidCookieException ex5)
            {
                ExTraceGlobals.TenantRelocationTracer.TraceError <string>((long)this.TenantConfigUnitObjectGuid.GetHashCode(), "TenantRelocationSyncPageToken InvalidCookieException {0}", ex5.ToString());
                ex = ex5;
            }
            if (ex != null)
            {
                ExTraceGlobals.TenantRelocationTracer.TraceError <string>((long)this.TenantConfigUnitObjectGuid.GetHashCode(), "TenantRelocationSyncPageToken throw InvalidCookieException {0}", ex.ToString());
                throw new InvalidCookieException(ex);
            }
        }
        protected TenantFullSyncPageToken(byte[] tokenBytes)
        {
            Exception ex = null;

            try
            {
                using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(tokenBytes, typeof(TenantFullSyncPageToken)))
                {
                    this.Version                   = (int)backSyncCookieReader.GetNextAttributeValue();
                    this.ServiceInstanceId         = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue());
                    this.Timestamp                 = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue());
                    this.LastReadFailureStartTime  = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue());
                    this.InvocationId              = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.TenantExternalDirectoryId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.TenantObjectGuid          = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.State = (TenantFullSyncState)backSyncCookieReader.GetNextAttributeValue();
                    this.ObjectUpdateSequenceNumber    = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.TombstoneUpdateSequenceNumber = (long)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array != null)
                    {
                        this.PendingWatermarks = WatermarkMap.Parse(array);
                    }
                    this.PendingWatermarksInvocationId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array2 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array2 != null)
                    {
                        this.Watermarks = WatermarkMap.Parse(array2);
                    }
                    this.WatermarksInvocationId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    this.LinkPageStart          = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.LinkPageEnd            = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.LinkRangeStart         = (int)backSyncCookieReader.GetNextAttributeValue();
                    this.ObjectsInLinkPage      = (int)backSyncCookieReader.GetNextAttributeValue();
                    string[] array3 = (string[])backSyncCookieReader.GetNextAttributeValue();
                    this.ErrorObjectsAndFailureCounts = ((array3 != null) ? BackSyncCookie.ParseErrorObjectsAndFailureCounts(array3) : new Dictionary <string, int>());
                    this.SequenceStartTimestamp       = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue());
                    this.SequenceId = (Guid)backSyncCookieReader.GetNextAttributeValue();
                    byte[] array4 = (byte[])backSyncCookieReader.GetNextAttributeValue();
                    if (array4 != null)
                    {
                        this.TenantScopedBackSyncCookie = BackSyncCookie.Parse(array4);
                        this.InvocationId = this.TenantScopedBackSyncCookie.InvocationId;
                    }
                    this.UseContainerizedUsnChangedIndex       = (bool)backSyncCookieReader.GetNextAttributeValue();
                    this.SoftDeletedObjectUpdateSequenceNumber = (long)backSyncCookieReader.GetNextAttributeValue();
                    this.PreviousState = (TenantFullSyncState)backSyncCookieReader.GetNextAttributeValue();
                }
            }
            catch (ArgumentException ex2)
            {
                ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken ArgumentException {0}", ex2.ToString());
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken IOException {0}", ex3.ToString());
                ex = ex3;
            }
            catch (FormatException ex4)
            {
                ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken FormatException {0}", ex4.ToString());
                ex = ex4;
            }
            catch (InvalidCookieException ex5)
            {
                ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken InvalidCookieException {0}", ex5.ToString());
                ex = ex5;
            }
            if (ex != null)
            {
                ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken throw InvalidCookieException {0}", ex.ToString());
                throw new InvalidCookieException(ex);
            }
        }