예제 #1
0
        internal static WatermarkMap Parse(byte[] rawBytes)
        {
            string @string = Encoding.UTF8.GetString(rawBytes);

            return(WatermarkMap.Parse(@string));
        }
        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);
            }
        }