protected override void InitializeUserScriptOptions(UserScriptOptions options) { var rspFile = GetResponseFile("CSharpInteractive.rsp"); if (rspFile == null) { return; } ReplEditor.OutputPrintLine(string.Format(dnSpy_Scripting_Roslyn_Resources.LoadingContextFromFile, Path.GetFileName(rspFile)), BoxedTextColor.ReplOutputText); foreach (var t in ResponseFileReader.Read(rspFile)) { switch (t.Item1.ToLowerInvariant()) { case "r": case "reference": options.References.AddRange(RespFileUtils.GetReferences(t.Item2)); break; case "u": case "using": case "usings": case "import": case "imports": options.Imports.AddRange(t.Item2.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); break; case "lib": case "libpath": case "libpaths": options.LibPaths.AddRange(RespFileUtils.GetReferencePaths(t.Item2)); break; case "loadpath": case "loadpaths": options.LoadPaths.AddRange(RespFileUtils.GetReferencePaths(t.Item2)); break; default: Debug.Fail($"Unknown option: '{t.Item1}'"); break; } } }
protected override ScriptOptions CreateScriptOptions(ScriptOptions options) { var rspFile = GetResponseFile("CSharpInteractive.rsp"); if (rspFile == null) { return(options); } this.replEditor.OutputPrintLine(string.Format(dnSpy_Scripting_Roslyn_Resources.LoadingContextFromFile, Path.GetFileName(rspFile))); foreach (var t in ResponseFileReader.Read(rspFile)) { if (t.Item1 == "/r") { Debug.Assert(t.Item3.Length == 0); if (t.Item3.Length != 0) { continue; } options = options.AddReferences(t.Item2); } else if (t.Item1 == "/u") { Debug.Assert(t.Item3.Length == 0); if (t.Item3.Length != 0) { continue; } options = options.AddImports(t.Item2); } else { Debug.Fail(string.Format("Unknown option: '{0}'", t.Item1)); } } return(options); }