本文整理汇总了C#中Loader.LoadAndExecute方法的典型用法代码示例。如果您正苦于以下问题:C# Loader.LoadAndExecute方法的具体用法?C# Loader.LoadAndExecute怎么用?C# Loader.LoadAndExecute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader.LoadAndExecute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadFileOutToolStripMenuItem_Click
private void loadFileOutToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.openDialog.ShowDialog() != DialogResult.OK)
return;
string filename = this.openDialog.FileName;
Loader loader = new Loader(filename, new VmCompiler());
loader.LoadAndExecute(this.machine);
this.SetMachine(this.machine);
}
示例2: Main
public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Machine machine = new Machine();
if (File.Exists(BootFile))
{
Loader loader = new Loader(BootFile, new VmCompiler());
loader.LoadAndExecute(machine);
}
Application.Run(new Browser(machine));
}
示例3: CreateRemotingAndClientServerAndExportClass
public void CreateRemotingAndClientServerAndExportClass()
{
Loader loader = new Loader(@"DefineRectangleWithNewAndInitialize.st", new SimpleCompiler());
Machine machine = new Machine(true);
RemotingHostServer server = new RemotingHostServer(machine, 10004, "Server4");
Machine machine2 = new Machine(true);
loader.LoadAndExecute(machine2);
BaseClass rect = (BaseClass)machine2.GetGlobalObject("Rectangle");
RemotingHostClient client = new RemotingHostClient("localhost", 10004, "Server4");
client.Execute(rect.ToOutputString());
object result = machine.GetGlobalObject("Rectangle");
Assert.IsNotNull(result);
Assert.IsInstanceOfType(result, typeof(BaseClass));
object newresult = client.Evaluate("Rectangle new");
Assert.IsNotNull(newresult);
Assert.IsInstanceOfType(newresult, typeof(IObject));
IObject newrect = (IObject)newresult;
Assert.AreSame(rect, newrect.Behavior);
Assert.AreEqual(10, newrect[0]);
Assert.AreEqual(20, newrect[1]);
server.Stop();
}
示例4: LoadFile
private void LoadFile(string filename)
{
Loader loader = new Loader(filename, new VmCompiler());
loader.LoadAndExecute(this.machine);
}
示例5: LoadFile
private static void LoadFile(Machine machine, string filename)
{
Loader loader = new Loader(filename, new VmCompiler());
loader.LoadAndExecute(machine);
}
示例6: Execute
public void Execute(string command)
{
Machine current = Machine.Current;
Loader loader = new Loader(new StringReader(command), new SimpleCompiler());
try
{
this.machine.SetCurrent();
loader.LoadAndExecute(this.machine);
}
finally
{
Machine.SetCurrent(current);
}
}
示例7: LoadMachine
private Machine LoadMachine(string filename)
{
Machine machine = new Machine();
Loader loader = new Loader(filename, new SimpleCompiler());
loader.LoadAndExecute(machine);
return machine;
}