Пример #1
0
        private void HandleFileChange(FileSystemEventArgs e)
        {
            if (IsRepositoryFile(e.FullPath))
            {
                RepositoryItemBase item = null;
                switch (e.ChangeType)
                {
                case WatcherChangeTypes.Changed:
                    WaitforFileIsReadable(e.FullPath);
                    // reLoad the object to mem updating fields
                    item = GetItemFromCacheByFileName(e.FullPath);
                    if (item != null)
                    {
                        NewRepositorySerializer.ReloadObjectFromFile(item);
                        item.RefreshSourceControlStatus();
                    }
                    break;

                case WatcherChangeTypes.Deleted:
                    //remove from cache and list
                    item = GetItemFromCacheByFileName(e.FullPath);
                    RemoveItemFromLists(item);
                    break;

                case WatcherChangeTypes.Created:
                    WaitforFileIsReadable(e.FullPath);
                    // add item to cache and list
                    T newItem = LoadItemfromFile <T>(e.FullPath, Path.GetDirectoryName(e.FullPath));
                    AddItemtoCache(e.FullPath, newItem);
                    mSolutionRepositoryItemInfo.AddItemToCache((T)(object)newItem);
                    mFolderItemsList.Add(newItem);
                    break;
                }
            }
            SolutionRepository.RefreshParentFoldersSoucerControlStatus(Path.GetDirectoryName(e.FullPath));
        }
Пример #2
0
 // TODO: temp until we move all items to new RS
 public static void InitSerializers(IRepositorySerializer oldRepositorySerializer)
 {
     OldRepositorySerializer  = oldRepositorySerializer;
     NewRepositorySerializer2 = new NewRepositorySerializer();
 }