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)); }
private void SetItem(string path, FileStateInfo fileStateInfo) { if (!InnerState.ContainsKey(path)) { InnerState.Add(path, fileStateInfo); } else { InnerState[path] = fileStateInfo; } }
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)); }