Inheritance: RepositoryIgnoreDAO
Exemplo n.º 1
0
 public override void IgnoreFromIgnordList(Event e)
 {
     RepositoryIgnoreDAO ignoreDato = new SQLiteRepositoryIgnoreDAO();
     List<RepositoryIgnore> ignores = ignoreDato.All(this.repo);
     bool ignore = false;
     foreach (RepositoryIgnore ignoreItem in ignores)
     {
         if (e.Item.Key.StartsWith(ignoreItem.Path) || (e.EventType == EventType.MOVE && e.Item.ResultItem.Key.StartsWith(ignoreItem.Path)))
         {
             ignore = true;
         }
     }
     if(ignore)
         database.ExecuteNonQuery(string.Format("UPDATE EVENT SET  SYNCHRONIZED = '{0}', RESPONSE = '{1}' WHERE EventID = '{2}'", bool.TrueString, RESPONSE.IGNORED.ToString(), e.Id));
 }
 // Shared initialization code
 void Initialize()
 {
     count = 0;
     repoDao = new SQLiteRepositoryDAO();
     repoIgnore = new SQLiteRepositoryIgnoreDAO();
     //netTraffic = new NetworkTraffic (Process.GetCurrentProcess().Id);
 }
Exemplo n.º 3
0
        public override void Create(Event e)
        {
            if (e == null)
                return;
                repositoryItemDAO.Create (e);
                if (e.EventType == EventType.DELETE || e.EventType == EventType.MOVE)
                {
                    repositoryItemDAO.MarkAsMoved(e.Item);
                }

                DateTime dateOfEvent =  e.InsertTime;
                if(dateOfEvent==DateTime.MinValue){
                    dateOfEvent = GlobalDateTime.Now;
                }

                //Verify ignore
                RepositoryIgnoreDAO ignoreDato = new SQLiteRepositoryIgnoreDAO();
                List<RepositoryIgnore> ignores = ignoreDato.All(this.repo);
                foreach (RepositoryIgnore ignoreItem in ignores)
                {
                    if (e.Item.Key.StartsWith(ignoreItem.Path))
                    {
                        e.Synchronized = true;
                        e.Response = RESPONSE.IGNORED;
                    }
                }

                string sql =string.Format("INSERT INTO EVENT (ITEMID, TYPE, REPOSITORY, SYNCHRONIZED, INSERTTIME, USER, APPLICATION, APPLICATION_VERSION, DEVICE_ID, OS, BUCKET, TRY_QNT, RESPONSE, RepositoryId) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}')",
                                            e.Item.Id, e.EventType.ToString(), e.RepositoryType.ToString(), e.Synchronized.ToString(), dateOfEvent.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"), e.User, e.Application, e.ApplicationVersion, e.DeviceId, e.OS, e.Bucket, e.TryQnt, e.Response.ToString(), e.Repository.Id);

                if (e.Response != RESPONSE.IGNORED)
                {
                    e.Id = (int)database.ExecuteNonQuery(sql, true);
                    Logger.LogEvent("EVENT CREATED", e);
                }
        }
 private void CreateIgnoredList(List<string> ignoreKeys, LocalRepository repo)
 {
     SQLiteRepositoryIgnoreDAO repoIgnoreDao = new SQLiteRepositoryIgnoreDAO();
     foreach (string ignore in ignoreKeys)
     {
         repoIgnoreDao.Create(repo, ignore);
     }
 }