Exemplo n.º 1
0
 private static void CheckAndUpdateSegment()
 {
     Canary15DataSegment.SampleUtcNow();
     if (Canary15DataSegment.UtcNow >= Canary15DataManager.NextRefreshTime)
     {
         Canary15DataManager.ResetNextRefreshTime();
         Canary15DataManager.RecalculateState();
         if (Canary15DataManager.pendingSegment != null)
         {
             Canary15DataManager.pendingSegment.Trace(8, "CheckAndUpdateSegment()");
             if (Canary15DataManager.pendingSegment.State == Canary15DataSegment.SegmentState.Pending && Canary15DataManager.pendingSegment.NextRefreshTime < Canary15DataSegment.UtcNow)
             {
                 Canary15DataSegment.LoadClientAccessADObject();
                 Canary15DataManager.pendingSegment.ReadSegmentFromAD();
                 Canary15DataManager.NextRefreshTime = Canary15DataManager.pendingSegment.NextRefreshTime;
                 Canary15DataManager.pendingSegment.Trace(8, "CheckAndUpdateSegment()");
                 Canary15DataManager.pendingSegment.LogToIIS(8);
                 return;
             }
         }
         else if (Canary15DataManager.oldSegment != null)
         {
             Canary15DataManager.oldSegment.Trace(8, "CheckAndUpdateSegment()");
             Canary15DataManager.oldSegment.LogToIIS(8);
             Canary15DataManager.activeSegment.Trace(8, "CheckAndUpdateSegment()");
             Canary15DataManager.activeSegment.LogToIIS(8);
             Canary15DataManager.oldSegment.CloneFromSegment(Canary15DataManager.activeSegment);
             Canary15DataManager.oldSegment.Trace(8, "CheckAndUpdateSegment()");
             Canary15DataManager.oldSegment.LogToIIS(8);
             Canary15DataManager.oldSegment.SaveSegmentToAD();
             Canary15DataManager.NextRefreshTime = Canary15DataManager.oldSegment.NextRefreshTime;
         }
     }
 }
Exemplo n.º 2
0
        static Canary15DataManager()
        {
            Canary15Trace.TraceVersion();
            Canary15Trace.TraceTimeSpan(Canary15DataManager.defaultPeriod, 0, "Canary15DataManager().DefaultPeriod.");
            Canary15DataSegment.SampleUtcNow();
            Canary15DataManager.NextRefreshTime = Canary15DataSegment.UtcNow;
            Canary15DataManager.segments        = new Canary15DataSegment[3];
            for (int i = 0; i < 3; i++)
            {
                Canary15DataManager.segments[i] = Canary15DataSegment.CreateFromADData(i);
            }
            bool flag = Canary15DataManager.segments[0].IsNull || Canary15DataManager.segments[1].IsNull || Canary15DataManager.segments[2].IsNull;

            if (Canary15DataManager.segments[0].IsNull || (Canary15DataManager.segments[1].IsNull && !Canary15DataManager.segments[2].IsNull))
            {
                Canary15DataManager.segments[1].MarkADSegmentForDeletion();
                Canary15DataManager.segments[2].MarkADSegmentForDeletion();
                Canary15DataManager.Create(0);
            }
            if (flag)
            {
                long num   = 36000000000L;
                long ticks = Canary15DataManager.segments[0].Header.ReplicationDuration.Ticks;
                if (ticks == 0L)
                {
                    ticks = Canary15DataSegment.ReplicationDuration.Ticks;
                }
                long num2 = Canary15DataManager.segments[0].Header.StartTime.Ticks - ticks;
                if (num2 > Canary15DataSegment.UtcNow.Ticks)
                {
                    num2 = Canary15DataSegment.UtcNow.Ticks;
                }
                Canary15DataManager.CreateFromLegacyData(2, num2 - num, ticks + num, ticks);
                Canary15DataManager.segments[2].LogToIIS(0);
            }
        }