Ejemplo n.º 1
0
        private void Renamed(string path, string oldPath)
        {
            if (ShallPathBeIgnored(path))
            {
                return;
            }

            FileStateInfo renamedItemInfo = new FileStateInfo
                {
                    FileName = path, IsDirectory = FSHelper.IsDirectory(path), StateInfo = FileState.Renamed(oldPath)
                };
            FileStateInfo oldRenamedItemInfo = new FileStateInfo
            {
                FileName = oldPath,
                StateInfo = FileState.Removed
            };

            SetItem(path, renamedItemInfo);
            SetItem(oldPath, oldRenamedItemInfo);
            OnStateChanged(string.Format("{0} >> {1}", FormatFSChangeNotificationText("Перайменавана", oldPath), path));
        }
Ejemplo n.º 2
0
 private void SetItem(string path, FileStateInfo fileStateInfo)
 {
     if (!InnerState.ContainsKey(path))
     {
         InnerState.Add(path, fileStateInfo);
     }
     else
     {
         InnerState[path] = fileStateInfo;
     }
 }
Ejemplo n.º 3
0
        private void Deleted(string path)
        {
            if (ShallPathBeIgnored(path))
            {
                return;
            }

            FileStateInfo deletedItemInfo = new FileStateInfo
                {
                    FileName = path,
                    StateInfo = FileState.Removed
                };

            SetItem(path, deletedItemInfo);

            if (deletedItemInfo.IsDirectory)
            {
                foreach (var fileStateInfo in InnerState.Where(
                    fileStateInfo => fileStateInfo.Value.FileName.StartsWith(deletedItemInfo.FileName)))
                {
                    InnerState.Remove(fileStateInfo.Key);
                }
            }
            OnStateChanged(string.Format("Удалено: {0}", path));
        }