本文整理汇总了C#中IRuntime.AddActor方法的典型用法代码示例。如果您正苦于以下问题:C# IRuntime.AddActor方法的具体用法?C# IRuntime.AddActor怎么用?C# IRuntime.AddActor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRuntime
的用法示例。
在下文中一共展示了IRuntime.AddActor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIndexBuilder
private static int CreateIndexBuilder(IRuntime runtime, int manager, HttpListenerResponse response, string path, int reader)
{
// item 883
var builder = new IndexBuilder();
builder.Manager = manager;
builder.FolderReader = reader;
builder.Folder = path;
builder.Response = response;
// item 884
int actorId = runtime.AddActor(builder);
// item 886
runtime.SendMessage(
actorId,
Codes.Start,
null,
0
);
// item 885
return actorId;
}
示例2: CreatePumpFromBytes
private static int CreatePumpFromBytes(IRuntime runtime, int manager, HttpListenerResponse response, byte[] responseData, int responseCode)
{
// item 744
response.StatusCode = responseCode;
response.ContentLength64 = responseData.Length;
// item 740
var pump = new StreamPump();
pump.Manager = manager;
pump.OutStream = response.OutputStream;
pump.OutBuffer.Data = responseData;
pump.OutBuffer.Count = responseData.Length;
// item 745
pump.CurrentState = StreamPump.StateNames.SendRemaining;
// item 741
int id = runtime.AddActor(pump);
// item 746
runtime.StartWrite(
pump.OutStream,
pump.OutBuffer,
id
);
// item 742
return id;
}
示例3: CreateFilePump
private static int CreateFilePump(IRuntime runtime, string path, int manager, HttpListenerResponse response)
{
// item 697
if (File.Exists(path)) {
// item 698
Stream fstream = TryOpenFile(path);
// item 699
if (fstream == null) {
// item 703
runtime.Log.Info(
"Could not open file: "
+ path
);
// item 701
return 0;
} else {
// item 691
FileInfo about = new FileInfo(path);
// item 696
runtime.Log.Info(
String.Format(
"Found file: {0}. Length: {1}",
path,
(int)about.Length
)
);
// item 689
var pump = new StreamPump();
pump.Manager = manager;
pump.TotalLength = (int)about.Length;
pump.InStream = fstream;
pump.OutStream = response.OutputStream;
// item 690
int id = runtime.AddActor(pump);
// item 692
response.StatusCode = 200;
response.ContentLength64 = pump.TotalLength;
// item 694
runtime.StartRead(
pump.InStream,
pump.InBuffer,
id
);
// item 695
return id;
}
} else {
// item 702
runtime.Log.Info(
"File not found: "
+ path
);
// item 701
return 0;
}
}