Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new item
        /// </summary>
        /// <param name="info">Info.</param>
        void NewItem(FileSystemInfo info)
        {
            try {
                string[]     keywords       = Splitter.Split(info.Name.ToLower());
                IInteraction newInteraction = new LightFilesystemInteraction(info, keywords, RootPath);

                if (info is FileInfo)
                {
                    newFile.TryProcess(newInteraction);
                }
                if (info is DirectoryInfo)
                {
                    newDirectory.TryProcess(newInteraction);
                }

                infoCache [info.FullName] = info;
            } catch (Exception exception) {
                Secretary.Report(5, "Inclusion of new file failed; ", exception.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes an item.
        /// </summary>
        /// <param name="info">Info.</param>
        void RemoveItem(FileSystemInfo info)
        {
            try {
                infoCache.Dictionary.Remove(info.FullName);

                string[]     keywords           = Splitter.Split(info.Name.ToLower());
                IInteraction removalInteraction = new LightFilesystemInteraction(info, keywords, RootPath);

                if (info is FileInfo)
                {
                    deletedFile.TryProcess(removalInteraction);
                }
                if (info is DirectoryInfo)
                {
                    deletedDirectory.TryProcess(removalInteraction);
                }
            } catch (Exception exception) {
                Secretary.Report(5, "Removal of missing file failed; ", exception.Message);
            }
        }