Example #1
0
 internal void UpdateFileTime(string canonicalName, LocalState.FileTimestamp ft, bool?present)
 {
     lock (this)
     {
         LocalState.FileTimestamp prior = null;
         if (!present.HasValue || present.Value == true)
         {
             prior = Find <LocalState.FileTimestamp>(x => x.CanonicalName == canonicalName);
         }
         if (prior == null)
         {
             prior = new FileTimestamp()
             {
                 CanonicalName = canonicalName, LastSeenTime = ft.LastSeenTime, DataIdentifier = ft.DataIdentifier
             };
             Insert(prior);
         }
         else
         {
             prior.LastSeenTime   = ft.LastSeenTime;
             prior.DataIdentifier = ft.DataIdentifier;
             Update(prior);
         }
     }
 }
Example #2
0
 internal void UpdateFileTime(string canonicalName, LocalState.FileTimestamp ft, bool? present)
 {
     lock (this)
     {
         LocalState.FileTimestamp prior = null;
         if (!present.HasValue || present.Value == true)
             prior = Find<LocalState.FileTimestamp>(x => x.CanonicalName == canonicalName);
         if (prior == null)
         {
             prior = new FileTimestamp() { CanonicalName = canonicalName, LastSeenTime = ft.LastSeenTime, DataIdentifier = ft.DataIdentifier };
             Insert(prior);
         }
         else
         {
             prior.LastSeenTime = ft.LastSeenTime;
             prior.DataIdentifier = ft.DataIdentifier;
             Update(prior);
         }
     }
 }
Example #3
0
        internal void ReplaceFileTimes(Dictionary<string, LocalState.FileTimestamp> filetimes)
        {
            lock (this)
            {
                try
                {
                    BeginTransaction();

                    DeleteAll<LocalState.FileTimestamp>();
                    foreach (var x in filetimes)
                    {
                        LocalState.FileTimestamp fst = new FileTimestamp() { DataIdentifier = x.Value.DataIdentifier, CanonicalName = x.Key, LastSeenTime = x.Value.LastSeenTime };
                        Insert(fst);
                    }

                    Commit();
                    var oldList = LoadFileTimes();
                }
                catch
                {
                    Rollback();
                    throw;
                }
            }
        }