本文整理汇总了C#中Program.CreateNewRelayEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Program.CreateNewRelayEntry方法的具体用法?C# Program.CreateNewRelayEntry怎么用?C# Program.CreateNewRelayEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program.CreateNewRelayEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileAndRun
public void CompileAndRun()
{
GameTypes.D.onDLog += Console.WriteLine;
output = new List<string>();
RelayTwo relay = new RelayTwo();
TableTwo programsTable = relay.CreateTable(Program.TABLE_NAME);
FunctionDefinition print = new FunctionDefinition("void", "print", new string[] { "string" }, new string[] { "s" }, API_print, FunctionDocumentation.Default());
Program p1 = new Program();
p1.CreateNewRelayEntry(programsTable, "Program");
p1.Init(new ProgramRunner(relay));
p1.sourceCodeContent = "print(42)";
p1.FunctionDefinitions.Add(print);
p1.Compile();
Assert.AreEqual(0, p1.GetErrors().Length);
for(int i = 0; i < 100; i++) {
if(p1.sprakRunner.interpreter != null) {
p1.Update(0.1f);
}
}
Assert.AreEqual(1, output.Count);
Assert.AreEqual("42", output[0]);
}
示例2: CompileWithError
public void CompileWithError()
{
RelayTwo relay = new RelayTwo();
TableTwo programsTable = relay.CreateTable(Program.TABLE_NAME);
Program p1 = new Program();
p1.CreateNewRelayEntry(programsTable, "Program");
p1.sourceCodeContent = "var x = ";
p1.Compile();
Assert.AreEqual(1, p1.GetErrors().Length);
}
示例3: CreateProgram
public Program CreateProgram(string pName, string pSourceCodeContent, string pNameOfSourceCode)
{
Program newProgram = new Program();
newProgram.CreateNewRelayEntry(_programTable, typeof(Program).Name);
newProgram.name = pName;
newProgram.sourceCodeContent = pSourceCodeContent;
newProgram.sourceCodeName = pNameOfSourceCode;
newProgram.Init(this);
_newPrograms.Add(newProgram);
return newProgram;
}