Пример #1
0
        private static async Task LoadRtvsPackage(IRSessionEvaluation eval, string libPath)
        {
            await eval.ExecuteAsync(Invariant($@"
if (!base::isNamespaceLoaded('rtvs')) {{
    base::loadNamespace('rtvs', lib.loc = {libPath.ToRStringLiteral()})
}}
if (rtvs:::version != {rtvsPackageVersion}) {{
    warning('This R session was created using an incompatible version of RTVS, and may misbehave or crash when used with this version. Click ""Reset"" to replace it with a new clean session.');
}}
"));
        }
Пример #2
0
        public static Task SetLocalLibsAsync(IRSessionEvaluation eval, params string[] libPaths)
        {
            foreach (var libPath in libPaths.Where(libPath => !Directory.Exists(libPath)))
            {
                Directory.CreateDirectory(libPath);
            }

            var paths = string.Join(",", libPaths.Select(p => p.ToRPath().ToRStringLiteral()));
            var code  = $".libPaths(c({paths}))";

            return(eval.ExecuteAsync(code));
        }
Пример #3
0
 private static async Task LoadRtvsPackage(IRSessionEvaluation eval, string libPath)
 {
     await eval.ExecuteAsync(Invariant($"base::loadNamespace('rtvs', lib.loc = {libPath.ToRStringLiteral()})"));
 }
Пример #4
0
 private static async Task LoadRtvsPackage(IRSessionEvaluation eval)
 {
     var libPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetAssemblyPath());
     await eval.ExecuteAsync(Invariant($"base::loadNamespace('rtvs', lib.loc = {libPath.ToRStringLiteral()})"));
 }
Пример #5
0
        public static Task SetLocalRepoAsync(IRSessionEvaluation eval, string localRepoPath)
        {
            var code = $"options(repos=list(LOCAL=\"file:///{localRepoPath.ToRPath()}\"))";

            return(eval.ExecuteAsync(code));
        }