public void Handle(Guid clientID, CommandMessage message) { if (clientID == Guid.Empty) return; if (message.Arguments.Count != 1) return; var tokenHint = message.Arguments[0]; var locator = new ProfileLocator(fixPath(tokenHint)); var response = "not-running"; var tokenPath = locator.GetLocalProfilesRoot(); if (tokenPath != null) { tokenPath = Path.GetDirectoryName(tokenPath); switch (message.Command) { case "get-token-path": response = tokenPath; break; case "get-token-endpoint": var instance = (new CodeEngineDispatcher(new FS())).GetInstances().FirstOrDefault(x => matchPath(tokenPath, x.Key)); if (instance != null) response = string.Format("127.0.0.1:{0}", instance.Port); break; case "get-token-event-endpoint": var events = (new OpenIDE.Core.EventEndpointIntegrarion.EventClient(tokenPath)).GetInstance(); if (events != null) response = string.Format("127.0.0.1:{0}", events.Port); break; case "get-token-output-endpoint": var output = (new OpenIDE.Core.OutputEndpointIntegration.OutputClient(tokenPath)).GetInstance(); if (output != null) response = string.Format("127.0.0.1:{0}", output.Port); break; case "get-token-editor-endpoint": var editor = (new OpenIDE.Core.EditorEngineIntegration.EngineLocator(new FS())) .GetInstances() .FirstOrDefault(x => x.Key == tokenPath); if (editor != null) response = string.Format("127.0.0.1:{0}", editor.Port); break; } } _endpoint.Send(message.CorrelationID + response, clientID); }
private void listProfilesRaw() { var profileLocator = new ProfileLocator(Environment.CurrentDirectory); Console.WriteLine("active-global|" + profileLocator.GetActiveGlobalProfile()+"|"+profileLocator.GetGlobalProfilePath(profileLocator.GetActiveGlobalProfile())); Console.WriteLine("active-local|" + profileLocator.GetActiveLocalProfile()+"|"+profileLocator.GetLocalProfilePath(profileLocator.GetActiveLocalProfile())); var globalProfiles = profileLocator.GetProfilesForPath( profileLocator.GetGlobalProfilesRoot()); globalProfiles.Insert(0, "default"); globalProfiles.ForEach(x => Console.WriteLine("global|"+x+"|"+profileLocator.GetGlobalProfilePath(x))); if (Directory.Exists(profileLocator.GetLocalProfilesRoot())) { var localProfiles = profileLocator.GetProfilesForPath( profileLocator.GetLocalProfilesRoot()); localProfiles.Insert(0, "default"); localProfiles.ForEach(x => Console.WriteLine("local|"+x+"|"+profileLocator.GetLocalProfilePath(x))); } }
private void listProfiles() { var profileLocator = new ProfileLocator(Environment.CurrentDirectory); Console.WriteLine("Active global profile: " + profileLocator.GetActiveGlobalProfile()); Console.WriteLine("Active local profile: " + profileLocator.GetActiveLocalProfile()); var globalProfiles = profileLocator.GetProfilesForPath( profileLocator.GetGlobalProfilesRoot()); globalProfiles.Insert(0, "default"); Console.WriteLine(); Console.WriteLine("Global profiles:"); globalProfiles.ForEach(x => Console.WriteLine("\t" + x)); if (Directory.Exists(profileLocator.GetLocalProfilesRoot())) { var localProfiles = profileLocator.GetProfilesForPath( profileLocator.GetLocalProfilesRoot()); localProfiles.Insert(0, "default"); Console.WriteLine(); Console.WriteLine("Local profiles:"); localProfiles.ForEach(x => Console.WriteLine("\t" + x)); } Console.WriteLine(); }