Esempio n. 1
0
        public void Start(
			string path,
			ICacheBuilder cache,
			ICrawlResult crawlReader,
			PluginLocator pluginLocator,
			EventEndpoint eventDispatcher)
        {
            _cache = cache;
            _crawlReader = crawlReader;
            _eventDispatcher = eventDispatcher;
            Logger.Write("Setting up file trackers");
            Logger.Write("Setting up token file trackers");
            _tracker = new FileChangeTracker((x) => {
                    _eventDispatcher.Send(
                        "codemodel raw-filesystem-change-" +
                        x.Type.ToString().ToLower() +
                        " \"" + x.Path + "\"");
                });
            Logger.Write("Setting up local file trackers");
            _localTracker = new FileChangeTracker((x) => {
                    _eventDispatcher.Send(
                        "codemodel raw-filesystem-change-" +
                        x.Type.ToString().ToLower() +
                        " \"" + x.Path + "\"");
                });
            Logger.Write("Setting up global file trackers");
            _globalTracker = new FileChangeTracker((x) => {
                    _eventDispatcher.Send(
                        "codemodel raw-filesystem-change-" +
                        x.Type.ToString().ToLower() +
                        " \"" + x.Path + "\"");
                });
            Logger.Write("Adding plugins to cache");
            var plugins = pluginLocator.Locate().ToList();
            foreach (var x in plugins) {
                var plugin = new PluginPattern(x);
                _plugins.Add(plugin);
                _cache.Plugins.Add(
                    new CachedPlugin(x.GetLanguage(), plugin.Patterns));
                Logger.Write("Added plugin " + x.GetLanguage());
            }
            Logger.Write("Starting tracker for {0}", path);
            _tracker.Start(path, getFilter(), handleChanges);
            var locator = new ProfileLocator(path);
            if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) {
                var profilePath = locator.GetLocalProfilePath(locator.GetActiveLocalProfile());
                if (Directory.Exists(profilePath)) {
                    Logger.Write("Starting tracker for {0}", profilePath);
                    _localTracker.Start(profilePath, getFilter(), handleChanges);
                }
            }
            var globalPath = locator.GetGlobalProfilePath(locator.GetActiveGlobalProfile());
            if (Directory.Exists(globalPath)) {
                Logger.Write("Starting tracker for {0}", globalPath);
                _globalTracker.Start(globalPath, getFilter(), handleChanges);
            }
        }
Esempio n. 2
0
 public ReactiveScript(string file, string keyPath, Action<string> dispatch)
 {
     _file = file;
     _keyPath = keyPath;
     _dispatch = dispatch;
     var profiles = new ProfileLocator(_keyPath);
     _globalProfileName = profiles.GetActiveGlobalProfile();
     _localProfileName = profiles.GetActiveLocalProfile();
     getEvents();
 }
Esempio n. 3
0
 public Script(string token, string workingDirectory, string file)
 {
     _file = file;
     _token = token;
     Name = Path.GetFileNameWithoutExtension(file);
     Description = "";
     _workingDirectory = workingDirectory;
     var profiles = new ProfileLocator(_token);
     _globalProfileName = profiles.GetActiveGlobalProfile();
     _localProfileName = profiles.GetActiveLocalProfile();
 }
Esempio n. 4
0
 public ReactiveScriptReader(string path, Func<PluginLocator> locator, Action<string> dispatch)
 {
     _keyPath = path;
     _dispatch = dispatch;
     var profiles = new ProfileLocator(_keyPath);
     _localScriptsPathDefault = getPath(profiles.GetLocalProfilePath("default"));
     _localScriptsPath = getPath(profiles.GetLocalProfilePath(profiles.GetActiveLocalProfile()));
     _globalScriptsPathDefault = getPath(profiles.GetGlobalProfilePath("default"));
     _globalScriptsPath = getPath(profiles.GetGlobalProfilePath(profiles.GetActiveGlobalProfile()));
     _pluginLocator = locator;
 }
Esempio n. 5
0
 public void Remove(string source)
 {
     var package = getPackage(source);
     if (package == null) {
         _dispatch(string.Format("error|there is no package {0} to remove", source));
         return;
     }
     var profiles = new ProfileLocator(_token);
     var isGlobal = profiles.IsGlobal(package.File);
     removePackage(package, Path.GetDirectoryName(Path.GetDirectoryName(package.File)), isGlobal);
     _dispatch(string.Format("Removed package {0}", package.Signature));
 }
Esempio n. 6
0
 public List<Snippet> GetSnippets()
 {
     var list = new List<Snippet>();
     var locator = new ProfileLocator(_token);
     var paths = locator.GetPathsCurrentProfiles();
     foreach (var path in paths) {
         var dir = System.IO.Path.Combine(path, "snippets");
         if (Directory.Exists(dir))
             addFiles(list, dir);
         scanLanguages(list, path);
     }
     return list;
 }
Esempio n. 7
0
 public void Start(string token)
 {
     var appdir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     Logger.Write("Initializing code engine");
     initCodeEngine(token, appdir);
     Logger.Write("Running init script for " + appdir);
     runInitScript(token, appdir);
     Logger.Write("Initalizing language plugins");
     _pluginLocator().Locate().ToList()
         .ForEach(plugin => {
             var language = plugin.GetLanguage();
             Logger.Write("Initializing " + language);
             runInitScript(token, Path.Combine(Path.GetDirectoryName(plugin.FullPath), language + "-files"));
         });
     var locator = new ProfileLocator(token);
     var profilePath = locator.GetLocalProfilePath(locator.GetActiveLocalProfile());
     Logger.Write("Running init script for " + profilePath);
     runInitScript(token, profilePath);
 }
 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);
 }
Esempio n. 9
0
        public AppSettings(string path, Func<IEnumerable<ICommandHandler>> handlers, Func<IEnumerable<ICommandHandler>> pluginHandlers)
        {
            _path = path;
            var locator = new ProfileLocator(Environment.CurrentDirectory);
            RootPath = locator.GetLocalProfilePath("default");
            if (RootPath == null)
                RootPath = Directory.GetCurrentDirectory();
            else
                RootPath = System.IO.Path.GetDirectoryName(RootPath);

            var local = new Configuration(Directory.GetCurrentDirectory(), false);
            var global = new Configuration(_path, false);

            if (local.DefaultLanguage != null)
                DefaultLanguage = local.DefaultLanguage;
            else if (global.DefaultLanguage != null)
                DefaultLanguage = global.DefaultLanguage;

            if (local.EnabledLanguages != null)
                EnabledLanguages = local.EnabledLanguages;
            else if (global.EnabledLanguages != null)
                EnabledLanguages = global.EnabledLanguages;
        }
Esempio n. 10
0
        public AppSettings(string path, Func<IEnumerable<ICommandHandler>> handlers, Func<IEnumerable<ICommandHandler>> pluginHandlers)
        {
            _path = path;
            SourcePrioritization = new string[] {};
            var locator = new ProfileLocator(fixPath(Environment.CurrentDirectory));
            RootPath = locator.GetLocalProfilePath("default");
            if (RootPath == null)
                RootPath = fixPath(Directory.GetCurrentDirectory());
            else
                RootPath = System.IO.Path.GetDirectoryName(RootPath);
            var reader = new ConfigReader(RootPath);

            var defaultLanguage = reader.Get("default.language");
            if (defaultLanguage != null)
                DefaultLanguage = defaultLanguage;

            var enabledLanguages = reader.Get("enabled.languages");
            if (enabledLanguages != null)
                EnabledLanguages = splitValue(enabledLanguages);

            var prioritizedSources = reader.Get("oi.source.prioritization");
            if (prioritizedSources != null)
                SourcePrioritization = splitValue(prioritizedSources);
        }
Esempio n. 11
0
        private bool install(string packageToken, string[] acceptedVersions)
        {
            var source = _packageFetcher.Fetch(packageToken);
            if (source == null || !File.Exists(source.Package)) {
                _dispatch("error|could not find package " + packageToken);
                return false;
            }

            if (isMetaPackage(source.Package)) {
                installMetaPackage(source);
                return true;
            }

            string activeProfile = null;
            var actionSucceeded = prepareForAction(
                source.Package,
                (package) => {
                    var profiles = new ProfileLocator(_token);
                    if (_useGlobal)
                        activeProfile = profiles.GetActiveGlobalProfile();
                    else
                        activeProfile = profiles.GetActiveLocalProfile();
                    var installPath = getInstallPath(package, profiles, activeProfile);
                    if (installPath == null)
                        return null;
                    Logger.Write("Installing the package in " + installPath);
                    return installPath;
                },
                (args) => {
                        if (args.Match != null) {
                            Logger.Write("found matching package " + args.Match);
                            var command = Path.GetFileNameWithoutExtension(args.Match);
                            var package = getPackage(command);
                            if (package != null) {
                                Logger.Write("loaded package " + package.ID);
                                if (acceptedVersions != null) {
                                    if (acceptedVersions.Length > 0 && !acceptedVersions.Any(x => x == package.Version)) {
                                        var versions = "";
                                        foreach (var version in acceptedVersions) {
                                            versions += version + ",";
                                        }
                                        versions = versions.Trim(new[] {','});
                                        _dispatch(string.Format("error|dependency {0} ({1}) is installed. Accepted versions are {2}", args.Package.ID, package.Version, versions));
                                        return false;
                                    }
                                }
                                Logger.Write(string.Format("skipping {0} ({1}) already installed", package.ID, package.Version));
                            } else {
                                _dispatch(string.Format("error|the package with the command {0} conflicts with the package you are trying to install", command));
                            }
                        } else if (acceptedVersions != null && !acceptedVersions.Any(x => x == args.Package.Version)) {
                            var versions = "";
                            foreach (var version in acceptedVersions) {
                                versions += version + ",";
                            }
                            versions = versions.Trim(new[] {','});
                            _dispatch(string.Format("error|dependency {0} of version {1} is not a valid. Accepted versions are {2}", args.Package.ID, args.Package.Version, versions));
                            return false;
                        } else
                            installPackage(source.Package, args.Package, args.TempPath, args.InstallPath, activeProfile);
                        return true;
                    });
            if (source.IsTemporaryPackage)
                File.Delete(source.Package);
            return actionSucceeded;
        }
Esempio n. 12
0
 private string getLanguageInstallPath(Package package, bool forcelocal)
 {
     var language = _locator
         .Locate()
         .FirstOrDefault(x => x.GetLanguage() == package.Language);
     if (language == null) {
         Logger.Write("Failed to locate language " + package.Language);
         return null;
     }
     var basepath = Path.GetDirectoryName(language.FullPath);
     if (forcelocal) {
         var profiles = new ProfileLocator(_token);
         basepath = Path.Combine(profiles.GetLocalProfilePath(profiles.GetActiveLocalProfile()), "languages");
     }
     return
         Path.Combine(
             Path.Combine(
                 basepath,
                 language.GetLanguage() + "-files"),
             package.Target.Replace("language-", "") + "s");
 }
Esempio n. 13
0
 private Package getPackage(string name)
 {
     Logger.Write("Looking for package " + name);
     var profiles = new ProfileLocator(_token);
     var packages = new List<Package>();
     profiles.GetFilesCurrentProfiles("package.json").ToList()
         .ForEach(x => {
                 try {
                     Logger.Write("Reading package " + x);
                     var package = Package.Read(x);
                     if (package != null) {
                         Logger.Write("adding package {0} ({1})", package.ID, package.Version);
                         packages.Add(package);
                     }
                 } catch (Exception ex) {
                     Logger.Write(ex);
                 }
             });
     return packages.FirstOrDefault(x => x.ID == name);
 }
Esempio n. 14
0
 private DefinitionCache writeBuiltInCommands(string file, ProfileLocator profiles)
 {
     var builtInCache = new DefinitionCache();
     foreach (var cmd in _builtIn()) {
         var item = builtInCache
             .Add(
                 DefinitionCacheItemType.BuiltIn,
                 null,
                 DateTime.Now,
                 false,
                 true,
                 cmd.Name,
                 cmd.Usage.Description);
         add(builtInCache, item, cmd.Usage.Parameters);
     }
     writeCache(profiles.AppRootPath, builtInCache);
     return builtInCache;
 }
Esempio n. 15
0
 private string getInstallPath(Package package, ProfileLocator profiles, string activeProfile)
 {
     string installPath;
     if (package.Target.StartsWith("language-")) {
         var path = getLanguageInstallPath(package, !_useGlobal);
         if (path == null) {
             _dispatch("error|could not find language to install language dependent package in");
             return null;
         }
         if (_useGlobal && !profiles.IsGlobal(path)) {
             _dispatch("error|cannot install language dependent package globally as language is installed locally.");
             return null;
         }
         return path;
     }
     if (_useGlobal)
         installPath = profiles.GetGlobalProfilePath(activeProfile);
     else
         installPath = profiles.GetLocalProfilePath(activeProfile);
     if (installPath == null) {
         _dispatch("error|the current location does not have an initialized config point");
         return null;
     }
     return Path.Combine(installPath, package.Target + "s");
 }
Esempio n. 16
0
 public string GetLocalPath()
 {
     var locator = new ProfileLocator(_keyPath);
     return GetLocalPath(locator.GetActiveLocalProfile());
 }
Esempio n. 17
0
        public void Execute(string[] arguments)
        {
            _verbose = arguments.Contains("-v");
            _showoutputs = arguments.Contains("-o");
            _showevents = arguments.Contains("-e");
            _printOnlyErrorsAndInconclusives = arguments.Contains("--only-errors");
            _logging = arguments.Contains("-l");
            var profiles = new ProfileLocator(_token);

            var testFiles = new List<string>();
            if (arguments.Length > 0 && File.Exists(arguments[0])) {
                testFiles.Add(arguments[0]);
            } else {
                testFiles
                    .AddRange(
                        getTests(profiles.GetLocalProfilePath("default")));
                testFiles
                    .AddRange(
                        getTests(profiles.GetGlobalProfilePath("default")));
                testFiles
                    .AddRange(
                        getTests(
                            Path.GetDirectoryName(
                                Assembly.GetExecutingAssembly().Location)));
            }

            foreach (var testFile in testFiles) {

                _testRunLocation = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString());
                Console.WriteLine("Testing: {0}", testFile);
                var eventListenerStarted = false;
                var systemStarted = false;
                var runCompleted = false;
                var eventListener = new Thread(() => {
                            var eventSocketClient = new EventStuff.EventClient(
                                (line) => {
                                            if (line == "codeengine started") {
                                                log("Code engine started");
                                                systemStarted = true;
                                            } if (line == "codeengine stopped") {
                                                log("Code engine stopped");
                                                runCompleted = true;
                                            }
                                            _events.Add(line);
                                        });
                            while (true) {
                                eventSocketClient.Connect(_testRunLocation);
                                eventListenerStarted = true;
                                if (!eventSocketClient.IsConnected) {
                                    Thread.Sleep(10);
                                    if (runCompleted || systemStarted)
                                        break;
                                    continue;
                                }
                                log("Event listener connected");
                                while (eventSocketClient.IsConnected)
                                    Thread.Sleep(10);
                                break;
                            }
                            eventListenerStarted = false;
                        });
                var isQuerying = false;
                var useEditor = false;
                var tests = new List<string>();
                Process proc = null;
                try {
                    Directory.CreateDirectory(_testRunLocation);
                    _events = new List<string>();
                    _outputs = new List<string>();
                    _asserts = new List<string>();

                    log("Initializing test location");
                    runCommand("init");
                    // Make sure we run tests in default profile is
                    // this by any chance overloaded in init command
                    runCommand("profile load default");
                    eventListener.Start();

                    new Thread(() => {
                            log("Starting test process");
                            var testProc = new Process();
                            try {
                                testProc
                                    .Query(
                                        testFile,
                                        _testRunLocation,
                                        false,
                                        Environment.CurrentDirectory,
                                        (error, line) => {
                                                if (line == "initialized" || line.StartsWith("initialized|")) {
                                                    log("Test file initialized");
                                                    proc = testProc;
                                                    var chunks = line.Split(new[] {'|'});
                                                    if (chunks.Length > 1 && chunks[1] == "editor") {
                                                        while (!eventListenerStarted)
                                                            Thread.Sleep(10);
                                                        log("Starting editor");
                                                        new Process().Run("oi", "editor test", false, _testRunLocation);
                                                        log("Editor launched");
                                                        useEditor = true;
                                                    } else {
                                                        log("System started");
                                                        systemStarted = true;
                                                    }
                                                    return;
                                                }
                                                if (line == "end-of-conversation") {
                                                    isQuerying = false;
                                                    return;
                                                }
                                                handleFeedback(proc, error, line);
                                            });
                            } catch (Exception ex) {
                                handleFeedback(testProc, true, "A fatal error occured while running " + testFile + Environment.NewLine + ex.Message);
                            }
                            isQuerying = false;
                            runCompleted = true;
                        }).Start();
                } catch (Exception ex) {
                    Console.WriteLine(ex.ToString());
                }

                log("Waiting for system to complete loading");
                while (!systemStarted)
                    Thread.Sleep(10);

                log("Getting tests");
                isQuerying = ask(proc, "get-tests");
                while (isQuerying)
                    Thread.Sleep(10);
                tests.AddRange(
                    _summary.ToString()
                    .Replace("\t", "")
                    .Split(
                        new[] { Environment.NewLine },
                        StringSplitOptions.RemoveEmptyEntries));

                foreach (var test in tests) {
                    if (_currentTest != null)
                        writeInconclusive();
                    log("Running test: " + test);
                    _outputs.Clear();
                    _events.Clear();
                    _asserts.Clear();
                    _currentTest = test;
                    _summary = new StringBuilder();
                    if (_verbose)
                        Console.Write(_currentTest + "...");
                    isQuerying = ask(proc, "test|" + _currentTest);
                    while (isQuerying)
                        Thread.Sleep(10);
                }

                if (useEditor) {
                    log("Shuting down editor");
                    new Process().Run("oi", "editor command kill", false, _testRunLocation);
                }

                log("Shuting down system");
                ask(proc, "shutdown");
                while (!runCompleted)
                    Thread.Sleep(10);

                log("Waiting for event listener to stop");
                while (eventListenerStarted)
                    Thread.Sleep(10);

                if (Directory.Exists(_testRunLocation))
                    Directory.Delete(_testRunLocation, true);

                if (_currentTest != null)
                    writeInconclusive();
                _currentTest = null;
                log("Test run finished");
                Console.WriteLine();
            }
        }
Esempio n. 18
0
 private void mergeBuiltInCommands(ProfileLocator profiles)
 {
     var builtInFile = Path.Combine(profiles.AppRootPath, "oi-definitions.json");
     var builtInCache = new DefinitionCache();
     if (File.Exists(builtInFile)) {
         builtInCache = appendDefinitions(builtInFile);
         var updated = builtInCache.GetOldestItem();
         if (updated != null && fileTime(System.Reflection.Assembly.GetExecutingAssembly().Location) > updated.Updated)
             builtInCache = writeBuiltInCommands(builtInFile, profiles);
     } else {
         Logger.Write("Could not find definition file: " + builtInFile);
         builtInCache = writeBuiltInCommands(builtInFile, profiles);
     }
     _cache.Merge(builtInCache);
 }
Esempio n. 19
0
 public SourceLocator(string token, string[] sourcePrioritization)
 {
     _token = token;
     _sourcePrioritization = sourcePrioritization;
     _locator = new ProfileLocator(_token);
 }
Esempio n. 20
0
        public void Build()
        {
            _cache = new DefinitionCache();
            var profiles = new ProfileLocator(_token);

            mergeBuiltInCommands(profiles);
            // Reverse paths to handle global first then local
            var paths = profiles.GetPathsCurrentProfiles().Reverse().ToArray();
            //for (int i = paths.Length - 1; i >= 0; i--)
            //	mergeExternalCommands(paths[i]);
            foreach (var path in paths)
                mergeExternalCommands(path);
        }
Esempio n. 21
0
 private void construct(string file, string keyPath, Action<string,string> outputDispatcher, Action<string> dispatch, bool dispatchErrors)
 {
     _file = file;
     _keyPath = keyPath;
     _outputDispatcher = outputDispatcher;
     _dispatch = dispatch;
     _dispatchErrors = dispatchErrors;
     var profiles = new ProfileLocator(_keyPath);
     _globalProfileName = profiles.GetActiveGlobalProfile();
     _localProfileName = profiles.GetActiveLocalProfile();
     getEvents();
 }
Esempio n. 22
0
 private static string getConfigPoint(string path)
 {
     var locator = new ProfileLocator(path);
     return locator.GetLocalProfilePath(locator.GetActiveLocalProfile());
 }
Esempio n. 23
0
 public string GetGlobalPath(string profile)
 {
     var locator = new ProfileLocator(_keyPath);
     return getPath(locator.GetGlobalProfilePath(profile));
 }
Esempio n. 24
0
 public SourceLocator(string token)
 {
     _token = token;
     _locator = new ProfileLocator(_token);
 }
Esempio n. 25
0
 private string getInstallPath(Package package, ProfileLocator profiles, string activeProfile)
 {
     string installPath;
     if (package.Target.StartsWith("language-"))
         return getLanguageInstallPath(package);
     if (_useGlobal)
         installPath = profiles.GetGlobalProfilePath(activeProfile);
     else
         installPath = profiles.GetLocalProfilePath(activeProfile);
     if (installPath == null)
         return null;
     return Path.Combine(installPath, package.Target + "s");
 }
Esempio n. 26
0
 public ConfigReader(string token)
 {
     _token = token;
     _locator = new ProfileLocator(_token);
 }
Esempio n. 27
0
 public void Update(string packageToken)
 {
     var source = _packageFetcher.Fetch(packageToken);
     if (source == null) {
         _dispatch("error|cannot find the package you are trying to update to");
         return;
     }
     if (!File.Exists(source.Package)) {
         _dispatch("error|cannot find the package you are trying to update to");
         return;
     }
     Package packageToUpdate = null;
     prepareForAction(
         source.Package,
         (package) => {
             packageToUpdate = getPackages(true)
                 .FirstOrDefault(x => x.ID == package.ID);
             if (packageToUpdate == null) {
                 _dispatch("error|the package you are trying to update is not installed");
                 return null;
             }
             var profiles = new ProfileLocator(_token);
             _useGlobal = profiles.IsGlobal(packageToUpdate.File);
             return Path.GetDirectoryName(Path.GetDirectoryName(packageToUpdate.File));
         },
         (args) => {
                 if (args.Match == null)
                     printUnexistingUpdate(args.Package.ID, args.Package);
                 else
                     update(source.Package, packageToUpdate, args);
                 return true;
             });
     if (source.IsTemporaryPackage)
         File.Delete(source.Package);
 }
        private List<string> getLanguagePaths()
        {
            var orderedProfilePaths = new List<string>();
            var profiles = new ProfileLocator(_keyPath);
            var profilePath = profiles.GetGlobalProfilePath("default");
            if (profilePath != null)
                orderedProfilePaths.Add(Path.Combine(profilePath, "languages"));
            profilePath = profiles.GetGlobalProfilePath(profiles.GetActiveGlobalProfile());
            if (profilePath != null)
                orderedProfilePaths.Add(Path.Combine(profilePath, "languages"));
            profilePath = profiles.GetLocalProfilePath("default");
            if (profilePath != null)
                orderedProfilePaths.Add(Path.Combine(profilePath, "languages"));
            profilePath = profiles.GetLocalProfilePath(profiles.GetActiveLocalProfile());
            if (profilePath != null)
                orderedProfilePaths.Add(Path.Combine(profilePath, "languages"));

            var paths = new List<string>();
            foreach (var plugin in _pluginLocator().Locate())
                addLanguagePath(plugin, orderedProfilePaths, ref paths);
            paths.Reverse();
            return paths;
        }
Esempio n. 29
0
 private IEnumerable<Package> getPackages(bool all)
 {
     var profiles = new ProfileLocator(_token);
     var packages = new List<Package>();
     profiles.GetFilesCurrentProfiles("package.json").ToList()
         .ForEach(x => {
                 try {
                     Logger.Write("Reading package " + x);
                     var package = Package.Read(x);
                     if (package != null)
                         packages.Add(package);
                 } catch {
                 }
             });
     return packages;
 }
Esempio n. 30
0
 public string GetLocalPath(string profile)
 {
     var locator = new ProfileLocator(_keyPath);
     var profilePath = locator.GetLocalProfilePath(profile);
     if (profilePath == null)
         return profilePath;
     return getPath(profilePath);
 }