in src/dotnet/RiderPlugin.UnrealLink/RiderBackendToUnrealEditor.cs [55:122]
public RiderBackendToUnrealEditor(Lifetime lifetime, IShellLocks locks, RdDispatcher dispatcher, ILogger logger,
UnrealHost unrealHost, UnrealLinkResolver linkResolver, EditorNavigator editorNavigator,
UnrealPluginDetector pluginDetector, ISolution solution)
{
myComponentLifetime = lifetime;
myLocks = locks;
myConnectionLifetimeProducer = new SequentialLifetimes(lifetime);
myDispatcher = dispatcher;
myLogger = logger;
myUnrealHost = unrealHost;
myLinkResolver = linkResolver;
myEditorNavigator = editorNavigator;
myLogger.Info("RiderBackendToUnrealEditor building started");
pluginDetector.InstallInfoProperty.ForEachValue_NotNull(myComponentLifetime, (lt, pluginInfo) =>
{
var portDirectoryFullPath = GetPathToPortsFolder();
Directory.CreateDirectory(portDirectoryFullPath);
var projects = pluginInfo.ProjectPlugins.Select(it => it.ProjectName)
.ToList();
solution.Locks.Tasks.Queue(myComponentLifetime, () =>
{
var watcher = new FileSystemWatcher(portDirectoryFullPath)
{
NotifyFilter = NotifyFilters.FileName,
Filter = "*.uproject",
IncludeSubdirectories = false
};
RenamedEventHandler handler = (obj, fileSystemEvent) =>
{
var path = VirtualFileSystemPath.Parse(fileSystemEvent.FullPath,
solution.GetInteractionContext());
// Skip changes to temp files
if (path.Name.StartsWith("~")) return;
if (projects.Contains(path.Name) && myComponentLifetime.IsAlive)
{
myLogger.Info(
$"FileSystemWatcher event {fileSystemEvent.ChangeType} found \"{path.Name}\"");
myLocks.ExecuteOrQueue(myComponentLifetime, "UnrealLink.CreateProtocol",
() => CreateProtocols(path));
}
};
watcher.Renamed += handler;
lt.Bracket(() => { }, () => { watcher.Dispose(); });
StartWatcher(watcher);
}, callerInfo: CallerInfo.CreateByCurrentContext());
foreach (var projectName in projects)
{
var portFileFullPath =
VirtualFileSystemPath.Parse(portDirectoryFullPath, InteractionContext.SolutionContext) /
projectName;
myLocks.ExecuteOrQueue(myComponentLifetime, "UnrealLink.CreateProtocol",
() => CreateProtocols(portFileFullPath));
}
});
myLogger.Info("RiderBackendToUnrealEditor building finished");
}