本文整理汇总了C#中IChannel类的典型用法代码示例。如果您正苦于以下问题:C# IChannel类的具体用法?C# IChannel怎么用?C# IChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IChannel类属于命名空间,在下文中一共展示了IChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
/// <summary>
/// BSON 패킷 구조를 따르는 PacketBuffer을 BSON Data로 변환 시키는 메서드
/// </summary>
/// <param name="buffer">BSON 패킷 구조를 따르는 Packet Buffer</param>
/// <returns>BSON Data</returns>
public dynamic Decode(IChannel channel, PacketBuffer buffer)
{
//버퍼 읽기 시작을 알림
buffer.BeginBufferIndex();
if (buffer.AvailableBytes() < 5) //버퍼길이가 5미만이면 리턴
return null;
uint len = buffer.ReadUInt32();
if (len > buffer.AvailableBytes())
{
//버퍼의 길이가 실제 패킷 길이보다 모자름으로, 리셋후 리턴
buffer.ResetBufferIndex();
return null;
}
var data = new byte[len];
buffer.ReadBytes(data);
buffer.EndBufferIndex();
var stream = new MemoryStream(data);
dynamic res = Serializer.Deserialize(new BsonReader(stream));
stream.Dispose();
return res;
}
示例2: AbstractSocketChannel
protected AbstractSocketChannel(IChannel parent, Socket socket)
: base(parent)
{
Socket = socket;
_state = StateFlags.Open;
try
{
Socket.Blocking = false;
}
catch (SocketException ex)
{
try
{
socket.Close();
}
catch (SocketException ex2)
{
if (Logger.IsWarningEnabled)
{
Logger.Warning("Failed to close a partially initialized socket.", ex2);
}
}
throw new ChannelException("Failed to enter non-blocking mode.", ex);
}
}
示例3: MessageConsumerBuilder
public MessageConsumerBuilder(IChannel channel, string queueName)
{
_channel = channel;
_queueName = queueName;
_prefetchHigh = _channel.DefaultPrefetchHigh;
_prefetchLow = _channel.DefaultPrefetchLow;
}
示例4: Disconnected
public void Disconnected(IChannel channel)
{
channelLock.EnterWriteLock();
_channels.Remove(channel);
channelLock.ExitWriteLock();
SendMessage(channel + " 88" + "\r\n> ");
}
示例5: Decode
public object Decode(IChannel channel, PacketBuffer buffer)
{
//버퍼 읽기 시작을 알림
buffer.BeginBufferIndex();
if (buffer.AvailableBytes() < 6) //버퍼길이가 5미만이면 리턴
return null;
buffer.ReadByte();
uint len = buffer.ReadUInt32();
if (len > buffer.AvailableBytes())
{
//버퍼의 길이가 실제 패킷 길이보다 모자름으로, 리셋후 리턴
buffer.ResetBufferIndex();
return null;
}
var data = new byte[len];
buffer.ReadBytes(data);
buffer.EndBufferIndex();
var stream = new MemoryStream(data);
var res = Unpacker.Create(stream).Unpack<MessagePackObject>();
stream.Dispose();
return res;
}
示例6: GetReport
public IMessage GetReport(IChannel channel)
{
log.Debug("public Message getReport(Session session): called");
// Generate a dummy report, the coordinator expects a report but doesn't care what it is.
return channel.CreateTextMessage("Dummy Run, Ok.");
}
示例7: abort
/// <summary>Method abort</summary>
/// <param name="error"></param>
/// <param name="channel"></param>
/// <exception cref="BEEPException" />
public virtual void abort(BEEPError error, IChannel channel)
{
tuningChannels.Remove(channel);
log.debug("TuningProfile.abort");
// Log entry or something - throw an exception???
}
示例8: IsCamAbleToDecryptChannel
private bool IsCamAbleToDecryptChannel(IUser user, ITvCardHandler tvcard, IChannel tuningDetail, int decryptLimit)
{
if (!tuningDetail.FreeToAir)
{
bool isCamAbleToDecryptChannel = true;
if (decryptLimit > 0)
{
int camDecrypting = NumberOfChannelsDecrypting(tvcard);
//Check if the user is currently occupying a decoding slot and subtract that from the number of channels it is decoding.
if (user.CardId == tvcard.DataBaseCard.IdCard)
{
bool isFreeToAir = IsFreeToAir(tvcard, ref user);
if (!isFreeToAir)
{
int numberOfUsersOnCurrentChannel = GetNumberOfUsersOnCurrentChannel(tvcard, user);
//Only subtract the slot the user is currently occupying if he is the only user occupying the slot.
if (numberOfUsersOnCurrentChannel == 1)
{
--camDecrypting;
}
}
}
//check if cam is capable of descrambling an extra channel
isCamAbleToDecryptChannel = (camDecrypting < decryptLimit);
}
return isCamAbleToDecryptChannel;
}
return true;
}
示例9: SecurityDuplexSessionChannel
public SecurityDuplexSessionChannel (ChannelFactoryBase factory, IChannel innerChannel, EndpointAddress remoteAddress, Uri via, InitiatorMessageSecurityBindingSupport security)
: base (factory, remoteAddress, via)
{
this.channel = innerChannel;
session = new SecurityDuplexSession (this);
InitializeSecurityFunctionality (security);
}
示例10: Run
public void Run(ModuleInfo info, CancellationToken token = default(CancellationToken))
{
double a = 0;
double b = Math.PI/2;
double h = 0.00000001;
const int pointsNum = 2;
var points = new IPoint[pointsNum];
var channels = new IChannel[pointsNum];
for (int i = 0; i < pointsNum; ++i)
{
points[i] = info.CreatePoint();
channels[i] = points[i].CreateChannel();
points[i].ExecuteClass("FirstModule.IntegralModule");
}
double y = a;
for (int i = 0; i < pointsNum; ++i)
{
channels[i].WriteData(y);
channels[i].WriteData(y + (b - a) / pointsNum);
channels[i].WriteData(h);
y += (b - a) / pointsNum;
}
DateTime time = DateTime.Now;
Console.WriteLine("Waiting for result...");
double res = 0;
for (int i = pointsNum - 1; i >= 0; --i)
{
res += channels[i].ReadData(typeof(double));
}
Console.WriteLine("Result found: res = {0}, time = {1}", res, Math.Round((DateTime.Now - time).TotalSeconds,3));
}
示例11: _connection_OnReceived
private static void _connection_OnReceived(object Data, System.IO.Ports.SerialPort port, IChannel channel, DateTime Timestamp)
{
//receive the data
_display.Clear();
Font fontNinaB = Resources.GetFont(Resources.FontResources.NinaB);
var display = (string)Data;
try
{
var ary = (string[]) Data;
if (ary != null)
{
display = "";
for (int i = 0; i < ary.Length; i++)
{
display += ary[i] + ",";
}
}
}
catch (Exception)
{
}
_display.DrawText(display, fontNinaB, Color.White, 10, 64);
_display.Flush();
//echo it back
_connection.Write(Data);
}
示例12: SetInstanceIdChannel
internal void SetInstanceIdChannel(string instanceId, IChannel channel)
{
lock (this)
{
this.channels[instanceId] = channel;
}
}
示例13: Decode
public dynamic Decode(IChannel channel, PacketBuffer buffer)
{
buffer.BeginBufferIndex();
if (buffer.AvailableBytes() < 1)
{
buffer.ResetBufferIndex();
return null;
}
var data = new byte[buffer.AvailableBytes()];
buffer.ReadBytes(data);
string s = System.Text.Encoding.UTF8.GetString(data);
int len = s.IndexOf('\n');
if (len == -1)
{
buffer.ResetBufferIndex();
return null;
}
s = s.Substring(0, len + 1);
buffer.SetPosition(System.Text.Encoding.UTF8.GetByteCount(s));
buffer.EndBufferIndex();
return s;
}
示例14: Form1
public Form1()
{
InitializeComponent();
log4net.Config.XmlConfigurator.Configure();
textBox1.Text = ConfigurationManager.AppSettings["Path"];
_application = new Application(ApplicationName);
_workerFiber = new PoolFiber();
_workerFiber.Start();
_importar = new Channel<string>();
_importar.Subscribe(_workerFiber, Work);
_notificationType = new NotificationType(SampleNotificationType, "Sample Notification");
_growl = new GrowlConnector { EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES };
_growl.NotificationCallback += GrowlNotificationCallback;
_growl.Register(_application, new[] { _notificationType });
folderWatch.Created += FolderWatchCreated;
folderWatch.Renamed += FolderWatchRenamed;
folderWatch.Deleted += FolderWatchDeleted;
InitDatabase();
if (!_autostart) return;
Operar(true,true);
}
示例15: SetUp
public void SetUp()
{
testSender = MockRepository.GenerateStub<ISendMessages>();
messagePersister = new InMemoryPersistence();
httpChannel = new HttpChannel(messagePersister)
{
ListenUrl = "http://localhost:8092/Gateway/",
ReturnAddress = "Gateway.Tests.Input"
};
httpChannel.MessageReceived += httpChannel_MessageReceived;
httpChannel.Start();
bus = Configure.With()
.DefaultBuilder()
.XmlSerializer()
.FileShareDataBus("./databus")
.InMemoryFaultManagement()
.UnicastBus()
.MsmqTransport()
.CreateBus()
.Start();
}