// Token: 0x06000938 RID: 2360 RVA: 0x00024D44 File Offset: 0x00022F44
        private static void FillHitData(ConditionalMetadataResult result, ConditionalRegistrationLog.ConditionalRegistrationHitMetadata hit)
        {
            result.Cookie = hit.Cookie;
            if (hit == null || hit.HitFiles.Length <= 0)
            {
                result.Files       = null;
                result.CurrentHits = 0;
                return;
            }
            FileInfo    fileInfo    = hit.HitFiles[0];
            XmlDocument xmlDocument = new XmlDocument();

            using (StreamReader streamReader = fileInfo.OpenText())
            {
                xmlDocument.LoadXml(streamReader.ReadToEnd());
            }
            result.Created      = ((xmlDocument.SelectSingleNode("Registration/CreationDate") != null) ? DateTime.Parse(xmlDocument.SelectSingleNode("Registration/CreationDate").InnerText) : DateTime.MinValue);
            result.Description  = ((xmlDocument.SelectSingleNode("Registration/Description") != null) ? xmlDocument.SelectSingleNode("Registration/Description").InnerText : string.Empty);
            result.WhereClause  = ((xmlDocument.SelectSingleNode("Registration/OriginalFilter") != null) ? xmlDocument.SelectSingleNode("Registration/OriginalFilter").InnerText : string.Empty);
            result.SelectClause = ((xmlDocument.SelectSingleNode("Registration/Fetch") != null) ? xmlDocument.SelectSingleNode("Registration/Fetch").InnerText : string.Empty);
            result.CurrentHits  = hit.HitFiles.Length;
            result.MaxHits      = ((xmlDocument.SelectSingleNode("Registration/MaxHits") != null) ? int.Parse(xmlDocument.SelectSingleNode("Registration/MaxHits").InnerText) : 10);
            result.Files        = new string[hit.HitFiles.Length];
            for (int i = 0; i < result.Files.Length; i++)
            {
                result.Files[i] = hit.HitFiles[i].Name;
            }
            result.CurrentHits = hit.HitFiles.Length;
        }
 // Token: 0x06000937 RID: 2359 RVA: 0x00024C4C File Offset: 0x00022E4C
 private void FillCorrectResultType(BaseConditionalRegistration reg, ConditionalRegistrationLog.ConditionalRegistrationHitMetadata hit, out ActiveConditionalMetadataResult active, out ConditionalMetadataResult expired)
 {
     if (reg != null)
     {
         expired = null;
         active  = new ActiveConditionalMetadataResult();
         if (hit != null)
         {
             GetConditionMetadataHandler.FillHitData(active, hit);
         }
         active.Created      = (DateTime)reg.Created;
         active.Cookie       = reg.Cookie;
         active.Description  = reg.Description;
         active.SelectClause = reg.OriginalPropertiesToFetch;
         active.WhereClause  = reg.OriginalFilter;
         ConditionalRegistration conditionalRegistration = reg as ConditionalRegistration;
         if (conditionalRegistration != null)
         {
             active.MaxHits       = conditionalRegistration.MaxHits;
             active.TimeRemaining = ((DateTime)reg.Created.Add(conditionalRegistration.TimeToLive) - DateTime.UtcNow).ToString();
             return;
         }
         active.MaxHits       = int.MaxValue;
         active.TimeRemaining = "Persistent";
         return;
     }
     else
     {
         if (hit != null)
         {
             active  = null;
             expired = new ConditionalMetadataResult();
             GetConditionMetadataHandler.FillHitData(expired, hit);
             return;
         }
         active  = null;
         expired = null;
         return;
     }
 }
Beispiel #3
0
 // Token: 0x060008C2 RID: 2242 RVA: 0x00022E68 File Offset: 0x00021068
 protected BaseConditionalRegistration(string cookie, string user, string propertiesToFetch, string whereClause)
 {
     this.User                      = user;
     this.OriginalFilter            = whereClause;
     this.OriginalPropertiesToFetch = propertiesToFetch;
     this.PropertiesToFetch         = BaseConditionalRegistration.ParsePropertiesToFetch(propertiesToFetch);
     this.QueryFilter               = BaseConditionalRegistration.ParseWhereClause(whereClause);
     this.Created                   = (ExDateTime)TimeProvider.UtcNow;
     this.Cookie                    = cookie;
     if (BaseConditionalRegistration.GetHitCountForCookie == null)
     {
         ConditionalRegistrationLog.ConditionalRegistrationHitMetadata hitsForCookie = ConditionalRegistrationLog.GetHitsForCookie(user, cookie);
         if (hitsForCookie != null)
         {
             this.hits = hitsForCookie.HitFiles.Length;
             return;
         }
     }
     else
     {
         this.hits = BaseConditionalRegistration.GetHitCountForCookie();
     }
 }
Beispiel #4
0
 // Token: 0x06000905 RID: 2309 RVA: 0x00023BE0 File Offset: 0x00021DE0
 internal void GetRegistrationMetadata(string userIdentity, string cookie, out BaseConditionalRegistration reg, out ConditionalRegistrationLog.ConditionalRegistrationHitMetadata hit)
 {
     reg = this.GetRegistration(cookie);
     hit = ConditionalRegistrationLog.GetHitsForCookie(userIdentity, cookie);
 }