init
This commit is contained in:
BIN
Capture.PNG
Normal file
BIN
Capture.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
3
Readme.md
Normal file
3
Readme.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
This is a simple c# repl powered by roslyn
|
||||||
|
|
||||||
|

|
||||||
@@ -5,6 +5,11 @@ VisualStudioVersion = 15.0.27130.2010
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRepl", "SharpRepl\SharpRepl.csproj", "{F240A133-A353-4FF2-9E5F-18CDC650085A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRepl", "SharpRepl\SharpRepl.csproj", "{F240A133-A353-4FF2-9E5F-18CDC650085A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4DF85585-54FB-48A9-BE73-FF42D0F42783}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
Readme.md = Readme.md
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|||||||
11
SharpRepl/Banner.txt
Normal file
11
SharpRepl/Banner.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
$$$$$$\ $$\ $$$$$$$\ $$\
|
||||||
|
$$ __$$\ $$ | $$ __$$\ $$ |
|
||||||
|
$$ / \__|$$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$ | $$ | $$$$$$\ $$$$$$\ $$ |
|
||||||
|
\$$$$$$\ $$ __$$\ \____$$\ $$ __$$\ $$ __$$\ $$$$$$$ |$$ __$$\ $$ __$$\ $$ |
|
||||||
|
\____$$\ $$ | $$ | $$$$$$$ |$$ | \__|$$ / $$ |$$ __$$< $$$$$$$$ |$$ / $$ |$$ |
|
||||||
|
$$\ $$ |$$ | $$ |$$ __$$ |$$ | $$ | $$ |$$ | $$ |$$ ____|$$ | $$ |$$ |
|
||||||
|
\$$$$$$ |$$ | $$ |\$$$$$$$ |$$ | $$$$$$$ |$$ | $$ |\$$$$$$$\ $$$$$$$ |$$ |
|
||||||
|
\______/ \__| \__| \_______|\__| $$ ____/ \__| \__| \_______|$$ ____/ \__|
|
||||||
|
$$ | $$ |
|
||||||
|
$$ | $$ |
|
||||||
|
\__| \__|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
using System;
|
using Microsoft.CodeAnalysis.CSharp.Scripting;
|
||||||
|
using Microsoft.CodeAnalysis.Scripting;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace SharpRepl
|
namespace SharpRepl
|
||||||
{
|
{
|
||||||
@@ -6,7 +10,31 @@ namespace SharpRepl
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Hello World!");
|
foreach(var line in banner)
|
||||||
|
{
|
||||||
|
Console.WriteLine(line);
|
||||||
}
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
var state = CSharpScript.RunAsync("2+2").Result; //prime the engine
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Console.Write('>');
|
||||||
|
var input = Console.ReadLine();
|
||||||
|
state = state.ContinueWithAsync(input).Result;
|
||||||
|
if (state.ReturnValue != null && !string.IsNullOrWhiteSpace(state.ReturnValue.ToString()))
|
||||||
|
{
|
||||||
|
Console.WriteLine(state.ReturnValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string[] banner = File.ReadAllLines(Path.Combine(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName, "Banner.txt"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,18 @@
|
|||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Banner.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Banner.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.6.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user