本文整理汇总了C#中Pipe.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Pipe.Initialize方法的具体用法?C# Pipe.Initialize怎么用?C# Pipe.Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipe
的用法示例。
在下文中一共展示了Pipe.Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PumpingRound
public static void PumpingRound()
{
Pump<TextMessage> pump = new Pump<TextMessage>();
pump.Initialize();
pump.Interval = 1;
Pipe<TextMessage> p1 = new Pipe<TextMessage>();
Pipe<TextMessage> p2 = new Pipe<TextMessage>();
Pipe<TextMessage> p3 = new Pipe<TextMessage>();
Pipe<TextMessage> p4 = new Pipe<TextMessage>();
p1.Initialize();
p2.Initialize();
p3.Initialize();
p4.Initialize();
pump.AddFlow(p1, p2);
pump.AddFlow(p2, p3);
pump.AddFlow(p3, p4);
pump.AddFlow(p4, p1);
p1.AddInputNotify(new Notify(NotifyOutput));
p2.AddInputNotify(new Notify(NotifyOutput2));
p3.AddInputNotify(new Notify(NotifyOutput));
p4.AddInputNotify(new Notify(NotifyOutput2));
p1.Push(new TextMessage("bla bla"));
pump.Start();
Console.ReadLine();
}
示例2: Main
static void Main(string[] args)
{
TcpClient client = new TcpClient();
client.Connect("192.168.178.54", 54000);
Pipe<String> pis = new Pipe<String>();
Pipe<String> pis2 = new Pipe<String>();
SerialPort sp2 = new SerialPort("COM12");
PipeStream ps = new PipeStream();
PipeStream ps2 = new PipeStream();
sp2.Open();
ps.AutoOpen = true;
ps2.AutoOpen = true;
ps2.Stream = sp2.BaseStream;
ps.Stream = client.GetStream();
pis.BasePipe = ps;
pis2.BasePipe = ps2;
pis.Initialize();
pis2.Initialize();
ps2.Initialize();
ps.Initialize();
int i = 0;
while (true)
{
ps2.PushObject(ps.PopObject());
ps.PushObject(ps2.PopObject());
Thread.Sleep(100);
}
//ModConfigSectionReader loader = new ModConfigSectionReader();
//loader.LoadAndRun();
Console.ReadLine();
}