UweKeim / ZetaLongPaths

A .NET library to access files and directories with more than 260 characters length.
https://nuget.org/packages/ZetaLongPaths
MIT License
141 stars 28 forks source link

Question about watcher when use Zeta #40

Open MustafaDaoud90 opened 2 years ago

MustafaDaoud90 commented 2 years ago

any idea to work on watcher events when using zeta such as:

watcher.Deleted += new System.IO.FileSystemEventHandler(OnDeleted); watcher.Renamed += new System.IO.RenamedEventHandler(OnRenamed);

private void OnRenamed(object source, System.IO.RenamedEventArgs e)
    {
        try
        {

            FileSystemEvent fse;
            if (ZlpIOHelper.FileExists(e.FullPath))
            {
                fse = new FileSystemEvent(e.OldFullPath, e.FullPath, FileSystemType.FILE);
            }
            else if (ZlpIOHelper.DirectoryExists(e.FullPath))
            {
                fse = new FileSystemEvent(e.OldFullPath, e.FullPath, FileSystemType.FOLDER);
            }
            else
            {
                fse = new FileSystemEvent(e.OldFullPath, e.FullPath, FileSystemType.UNKNOWN);
            }
            FileSystemEventDispatcher.Instance.Enqueue(fse);
        }
        catch (Exception ex)
        {

        }

    }

e.OldFullPath when using a long path returns too long an exception.