本文整理汇总了C#中IStream.GetProtocol方法的典型用法代码示例。如果您正苦于以下问题:C# IStream.GetProtocol方法的具体用法?C# IStream.GetProtocol怎么用?C# IStream.GetProtocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStream
的用法示例。
在下文中一共展示了IStream.GetProtocol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterStream
public bool RegisterStream(IStream stream)
{
if (StreamsByUniqueId.ContainsKey(stream.UniqueId))
{
Logger.FATAL("Stream with unique ID {0} already registered",stream.UniqueId);
return false;
}
StreamsByUniqueId[stream.UniqueId] = stream;
var protocol = stream.GetProtocol();
if (protocol != null)
{
if (!StreamsByProtocolId.ContainsKey(protocol.Id))
StreamsByProtocolId[protocol.Id] = new Dictionary<uint, IStream>();
StreamsByProtocolId[protocol.Id][stream.UniqueId] = stream;
}
if (!StreamsByType.ContainsKey(stream.Type))
{
StreamsByType[stream.Type] = new Dictionary<uint, IStream>();
}
StreamsByType[stream.Type][stream.UniqueId] = stream;
if (!StreamsByName.ContainsKey(stream.Name))
{
StreamsByName[stream.Name] = new Dictionary<uint, IStream>();
}
StreamsByName[stream.Name][stream.UniqueId] = stream;
Application.SignalStreamRegistered(stream);
return true;
}
示例2: UnRegisterStream
public void UnRegisterStream(IStream stream)
{
bool signalStreamUnregistered = StreamsByUniqueId.ContainsKey(stream.UniqueId);
StreamsByUniqueId.Map_Erase(stream.UniqueId);
var protocol = stream.GetProtocol();
if (protocol != null)
{
StreamsByProtocolId.Map_Erase2(protocol.Id, stream.UniqueId);
}
StreamsByType.Map_Erase2(stream.Type,stream.UniqueId);
StreamsByName.Map_Erase2(stream.Name,stream.UniqueId);
if(signalStreamUnregistered)
Application.SignalStreamUnRegistered(stream);
}