This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task ExecuteSignUpUserCommand () | |
{ | |
if (IsBusy) { | |
return; | |
} | |
IsBusy = true; | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Keys.cs | |
public class Keys | |
{ | |
public static readonly string XamarinInsightsKey = "0000"; | |
public static readonly string ParseAppKey = "0000"; | |
public static readonly string ParseDotNetKey = "0000"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task Main(string[] args) | |
{ | |
Console.WriteLine("Write some C#"); | |
var evaluate = true; | |
while(evaluate) | |
{ | |
var input = Console.ReadLine(); | |
if(input == "exit") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Allows for analysing source code | |
using Microsoft.CodeAnalysis; | |
//Provides the CSharpScript factory class | |
using Microsoft.CodeAnalysis.CSharp.Scripting; | |
//This is where most of the magic happens | |
using Microsoft.CodeAnalysis.Scripting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.CodeAnalysis.CSharp.Scripting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task Main(string[] args) | |
{ | |
var userScriptPath = Path.Combine(Environment.CurrentDirectory, "scriptInput.txt"); | |
var fileContents = File.ReadAllText(userScriptPath); | |
Script script = CSharpScript.Create(fileContents, ScriptOptions.Default); | |
var result = await script.RunAsync(); | |
Console.WriteLine($"Seconds in a week: {result.GetVariable("seconds").Value}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.TimeSpan sinceMidnight = System.DateTime.Now - System.DateTime.Today; | |
var seconds = sinceMidnight.TotalSeconds; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Script script; | |
public static async Task Main(string[] args) | |
{ | |
var userScriptPath = Path.Combine(Environment.CurrentDirectory, "scriptInput.txt"); | |
var fileContents = File.ReadAllText(userScriptPath); | |
script = CSharpScript.Create(fileContents, ScriptOptions.Default); | |
for (int i = 0; i < 15; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Script userScript; | |
private void CompileScript() | |
{ | |
UpdateSource(); //Handles creating a copy of the script which includes variables the user never sees. | |
string text = csSource.Text; //csSource is an object from the UI provider | |
userScript = CSharpScript.Create(text, options: userScriptOptions); | |
userScript.Compile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Compilation compilation; | |
private SemanticModel semanticModel; | |
private CompilationUnitSyntax syntaxRootNode; | |
// Validation Class Constructor | |
public ScriptValidator(Script script) | |
{ | |
compilation = script.GetCompilation(); | |
SyntaxTree syntaxTree = compilation.SyntaxTrees.First(); |
OlderNewer