コード例 #1
0
 public void RemoveObjectFromList(SyncObjectId objectId, bool clearObjectCookie)
 {
     ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "ObjectFullSyncPageToken RemoveObjectFromList objectId {0}", (objectId != null) ? objectId.ObjectId : "NULL");
     this.ObjectIds.Remove(objectId);
     if (clearObjectCookie)
     {
         ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "ObjectFullSyncPageToken clear object cookie");
         this.ObjectCookie = null;
     }
 }
コード例 #2
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);
        }
コード例 #3
0
 public ObjectFullSyncPageToken(Guid invocationId, ICollection <SyncObjectId> objectIds, BackSyncOptions syncOptions, DateTime timestamp, DateTime lastReadFailureStartTime, FullSyncObjectCookie objectCookie, Dictionary <string, int> errorObjectsAndCount, ServiceInstanceId serviceInstanceId, Guid sequenceId, DateTime sequenceStartTimestamp)
 {
     this.Version = 2;
     ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "Version {0}", this.Version);
     this.Timestamp = timestamp;
     ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "Timestamp {0}", this.Timestamp);
     this.LastReadFailureStartTime = lastReadFailureStartTime;
     ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "LastReadFailureStartTime {0}", this.LastReadFailureStartTime);
     this.InvocationId = invocationId;
     ExTraceGlobals.BackSyncTracer.TraceDebug <Guid>((long)SyncConfiguration.TraceId, "InvocationId {0}", this.InvocationId);
     this.ObjectIds = new HashSet <SyncObjectId>(objectIds);
     ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "ObjectIds count = {0}", this.ObjectIds.Count);
     this.SyncOptions = syncOptions;
     ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "SyncOptions {0}", this.SyncOptions.ToString());
     this.ServiceInstanceId = serviceInstanceId;
     ExTraceGlobals.BackSyncTracer.TraceDebug <ServiceInstanceId>((long)SyncConfiguration.TraceId, "SyncServiceInstanceId {0}", this.ServiceInstanceId);
     this.ObjectCookie = objectCookie;
     this.ErrorObjectsAndFailureCounts = (errorObjectsAndCount ?? new Dictionary <string, int>());
     this.SequenceId             = sequenceId;
     this.SequenceStartTimestamp = sequenceStartTimestamp;
     ExTraceGlobals.BackSyncTracer.TraceDebug <Guid, DateTime>((long)SyncConfiguration.TraceId, "BackSyncCookie this.SequenceId = {0} this.SequenceStartTimestamp = {1} ", this.SequenceId, this.SequenceStartTimestamp);
 }