コード例 #1
0
        private static void ProcessSourceDirEvents()
        {
            // Process events
            while (sourceDirEventBuffer.Count > 0)
            {
                FileSystemEventArgs e = FetchFileSystemEvent(sourceDirEventBuffer, sourceDirWatcher.Path);
                if (e == null)
                {
                    continue;
                }

                if (e.ChangeType == WatcherChangeTypes.Changed)
                {
                    if (File.Exists(e.FullPath) && PathHelper.IsPathLocatedIn(e.FullPath, EditorHelper.SourceMediaDirectory))
                    {
                        reimportSchedule.Add(e.FullPath);
                    }
                    if (SrcFileModified != null)
                    {
                        SrcFileModified(null, e);
                    }
                }
                else if (e.ChangeType == WatcherChangeTypes.Created)
                {
                }
                else if (e.ChangeType == WatcherChangeTypes.Deleted)
                {
                    if (SrcFileDeleted != null)
                    {
                        SrcFileDeleted(null, e);
                    }
                }
                else if (e.ChangeType == WatcherChangeTypes.Renamed)
                {
                    RenamedEventArgs rename = e as RenamedEventArgs;
                    FileImportProvider.NotifyFileRenamed(rename.OldFullPath, rename.FullPath);
                    if (SrcFileRenamed != null)
                    {
                        SrcFileRenamed(null, e);
                    }
                }
            }
        }
コード例 #2
0
        private static void ProcessSourceDirEvents()
        {
            // Process events
            while (sourceDirEventBuffer.Count > 0)
            {
                FileSystemEventArgs e = FetchFileSystemEvent(sourceDirEventBuffer, sourceDirWatcher.Path);
                if (e == null)
                {
                    continue;
                }

                // Mind modified source files for re-import
                if (e.ChangeType == WatcherChangeTypes.Changed)
                {
                    if (File.Exists(e.FullPath) && PathHelper.IsPathLocatedIn(e.FullPath, EditorHelper.SourceMediaDirectory))
                    {
                        reimportSchedule.Add(e.FullPath);
                    }
                }
            }
        }
コード例 #3
0
        private static int async_RenameContentRefs_Perform(object obj, List <ResourceRenamedEventArgs> args)
        {
            int counter = 0;

            ReflectionHelper.VisitObjectsDeep <IContentRef>(obj, r =>
            {
                if (r.IsDefaultContent)
                {
                    return(r);
                }
                if (r.IsExplicitNull)
                {
                    return(r);
                }
                if (string.IsNullOrEmpty(r.Path))
                {
                    return(r);
                }

                foreach (ResourceRenamedEventArgs e in args)
                {
                    if (e.IsResource && r.Path == e.OldPath)
                    {
                        r.Path = e.Path;
                        counter++;
                        break;
                    }
                    else if (e.IsDirectory && PathHelper.IsPathLocatedIn(r.Path, e.OldPath))
                    {
                        r.Path = r.Path.Replace(e.OldPath, e.Path);
                        counter++;
                        break;
                    }
                }
                return(r);
            });
            return(counter);
        }