Ejemplo n.º 1
0
        void FileSystemMonitor_Renamed(object sender, RenamedEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("-=== CORE ===-\r\n" + e.FullPath + " renamed from " + e.OldFullPath);
            CustomRenamedEventArgs mye = new CustomRenamedEventArgs(e.ChangeType, e.OldFullPath.Substring(0, e.OldFullPath.IndexOf("\\")),
                                                                    e.Name, e.OldName);

            if (FSMRenamed != null && mye.PassExtensionFilter() && !mye.IsFileSystem())
            {
                FSMRenamed(this, mye);
                return;
            }
            FileInfo oldfi = new FileInfo(e.OldFullPath);
            FileInfo newfi = new FileInfo(e.FullPath);
            //if ((oldfi.Extension == ".tmp" || oldfi.Name.Contains("__rar_"))&& FSMModified != null)
            //{
            CreatedDeletedModifiedEventArgs mye2 = new CreatedDeletedModifiedEventArgs(WatcherChangeTypes.Changed,
                                                                                       newfi.Directory.FullName,
                                                                                       e.Name.Substring(e.Name.LastIndexOf("\\")));

            if (mye2.PassExtensionFilter())
            {
                FSMModified(sender, mye2);
                return;
            }
            //}
        }
Ejemplo n.º 2
0
        void FileSystemMonitor_Created(object sender, FileSystemEventArgs e)
        {
            CreatedDeletedModifiedEventArgs mye = new CreatedDeletedModifiedEventArgs(e.ChangeType, e.FullPath.Substring(0,
                                                                                                                         e.FullPath.IndexOf("\\")), e.Name);

            if (FSMCreated != null && mye.PassExtensionFilter() && !mye.IsFileSystem())
            {
                FSMCreated(this, mye);
            }
        }
Ejemplo n.º 3
0
        void Monitor_CreatedDeletedModified(object sender, CreatedDeletedModifiedEventArgs e)
        {
            switch (e.ChangeType)
            {
            case WatcherChangeTypes.Created:
                le = new LogEntry(Logfile.FullName, (uint)LogEntryIDs.FileCreate, e.FullPath, machine, user);
                System.Diagnostics.Debug.WriteLine(e.FullPath + " created");
                break;

            case WatcherChangeTypes.Deleted:
                le = new LogEntry(Logfile.FullName, (uint)LogEntryIDs.FileDelete, e.FullPath, machine, user);
                System.Diagnostics.Debug.WriteLine(e.FullPath + " deleted");
                break;

            case WatcherChangeTypes.Changed:
                System.Diagnostics.Debug.WriteLine(e.FullPath + " modified");
                le = new LogEntry(Logfile.FullName, (uint)LogEntryIDs.FileModified, e.FullPath, machine, user);
                break;
            }
        }