當前位置: 首頁>>代碼示例>>C#>>正文


C# AtomCollection.SetHostOldPos方法代碼示例

本文整理匯總了C#中AtomCollection.SetHostOldPos方法的典型用法代碼示例。如果您正苦於以下問題:C# AtomCollection.SetHostOldPos方法的具體用法?C# AtomCollection.SetHostOldPos怎麽用?C# AtomCollection.SetHostOldPos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AtomCollection的用法示例。


在下文中一共展示了AtomCollection.SetHostOldPos方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PostHostInfo

 private void PostHostInfo(AtomCollection parent, Channel channel, bool playing)
 {
     var host = channel.SelfNode;
       var hostinfo = new AtomCollection();
       hostinfo.SetHostChannelID(channel.ChannelID);
       hostinfo.SetHostSessionID(PeerCast.SessionID);
       var globalendpoint = host.GlobalEndPoint;
       if (globalendpoint!=null) {
     hostinfo.AddHostIP(globalendpoint.Address);
     hostinfo.AddHostPort(globalendpoint.Port);
       }
       var localendpoint = host.LocalEndPoint;
       if (localendpoint!=null) {
     hostinfo.AddHostIP(localendpoint.Address);
     hostinfo.AddHostPort(localendpoint.Port);
       }
       hostinfo.SetHostNumListeners(channel.TotalDirects);
       hostinfo.SetHostNumRelays(channel.TotalRelays);
       hostinfo.SetHostUptime(channel.Uptime);
       if (channel.Contents.Count > 0) {
     hostinfo.SetHostOldPos((uint)(channel.Contents.Oldest.Position & 0xFFFFFFFFU));
     hostinfo.SetHostNewPos((uint)(channel.Contents.Newest.Position & 0xFFFFFFFFU));
       }
       PCPVersion.SetHostVersion(hostinfo);
       hostinfo.SetHostFlags1(
     (PeerCast.AccessController.IsChannelRelayable(channel) ? PCPHostFlags1.Relay : 0) |
     (PeerCast.AccessController.IsChannelPlayable(channel) ? PCPHostFlags1.Direct : 0) |
     ((!PeerCast.IsFirewalled.HasValue || PeerCast.IsFirewalled.Value) ? PCPHostFlags1.Firewalled : 0) |
     PCPHostFlags1.Tracker |
     (playing ? PCPHostFlags1.Receiving : PCPHostFlags1.None));
       parent.SetHost(hostinfo);
 }
開發者ID:psjp,項目名稱:peercaststation,代碼行數:32,代碼來源:PCPYellowPageClient.cs

示例2: CreateHostPacket

 /// <summary>
 /// 現在のチャンネルとPeerCastの狀態からHostパケットを作ります
 /// </summary>
 /// <returns>作ったPCP_HOSTパケット</returns>
 private Atom CreateHostPacket()
 {
     var host = new AtomCollection();
       host.SetHostChannelID(Channel.ChannelID);
       host.SetHostSessionID(PeerCast.SessionID);
       var globalendpoint =
     PeerCast.GetGlobalEndPoint(
       RemoteEndPoint.AddressFamily,
       OutputStreamType.Relay);
       if (globalendpoint!=null) {
     host.AddHostIP(globalendpoint.Address);
     host.AddHostPort(globalendpoint.Port);
       }
       var localendpoint =
     PeerCast.GetLocalEndPoint(
       RemoteEndPoint.AddressFamily,
       OutputStreamType.Relay);
       if (localendpoint!=null) {
     host.AddHostIP(localendpoint.Address);
     host.AddHostPort(localendpoint.Port);
       }
       host.SetHostNumListeners(Channel.LocalDirects);
       host.SetHostNumRelays(Channel.LocalRelays);
       host.SetHostUptime(Channel.Uptime);
       if (Channel.Contents.Count > 0) {
     host.SetHostOldPos((uint)(Channel.Contents.Oldest.Position & 0xFFFFFFFFU));
     host.SetHostNewPos((uint)(Channel.Contents.Newest.Position & 0xFFFFFFFFU));
       }
       PCPVersion.SetHostVersion(host);
       host.SetHostFlags1(
     (PeerCast.AccessController.IsChannelRelayable(Channel) ? PCPHostFlags1.Relay : 0) |
     (PeerCast.AccessController.IsChannelPlayable(Channel) ? PCPHostFlags1.Direct : 0) |
     ((!PeerCast.IsFirewalled.HasValue || PeerCast.IsFirewalled.Value) ? PCPHostFlags1.Firewalled : 0) |
     (RecvRate>0 ? PCPHostFlags1.Receiving : 0));
       host.SetHostUphostIP(RemoteEndPoint.Address);
       host.SetHostUphostPort(RemoteEndPoint.Port);
       return new Atom(Atom.PCP_HOST, host);
 }
開發者ID:peca-dev,項目名稱:peercaststation,代碼行數:42,代碼來源:PCPSourceStream.cs

示例3: PostHostInfo

 private void PostHostInfo(AtomCollection parent, Channel channel, bool playing)
 {
     var hostinfo = new AtomCollection();
       hostinfo.SetHostChannelID(channel.ChannelID);
       hostinfo.SetHostSessionID(PeerCast.SessionID);
       var globalendpoint = PeerCast.GetGlobalEndPoint(AddressFamily.InterNetwork, OutputStreamType.Relay);
       if (globalendpoint!=null) {
     hostinfo.AddHostIP(globalendpoint.Address);
     hostinfo.AddHostPort(globalendpoint.Port);
       }
       var localendpoint = PeerCast.GetLocalEndPoint(AddressFamily.InterNetwork, OutputStreamType.Relay);
       if (localendpoint!=null) {
     hostinfo.AddHostIP(localendpoint.Address);
     hostinfo.AddHostPort(localendpoint.Port);
       }
       hostinfo.SetHostNumListeners(channel.TotalDirects);
       hostinfo.SetHostNumRelays(channel.TotalRelays);
       hostinfo.SetHostUptime(channel.Uptime);
       if (channel.Contents.Count > 0) {
     hostinfo.SetHostOldPos((uint)(channel.Contents.Oldest.Position & 0xFFFFFFFFU));
     hostinfo.SetHostNewPos((uint)(channel.Contents.Newest.Position & 0xFFFFFFFFU));
       }
       PCPVersion.SetHostVersion(hostinfo);
       var relayable = PeerCast.AccessController.IsChannelRelayable(channel);
       var playable  = PeerCast.AccessController.IsChannelPlayable(channel) && PeerCast.FindListener(remoteEndPoint.Address, OutputStreamType.Play)!=null;
       var firewalled = !PeerCast.IsFirewalled.HasValue || PeerCast.IsFirewalled.Value || PeerCast.FindListener(remoteEndPoint.Address, OutputStreamType.Relay)==null;
       hostinfo.SetHostFlags1(
     (relayable ? PCPHostFlags1.Relay : 0) |
     (playable ? PCPHostFlags1.Direct : 0) |
     (firewalled ? PCPHostFlags1.Firewalled : 0) |
     PCPHostFlags1.Tracker |
     (playing ? PCPHostFlags1.Receiving : PCPHostFlags1.None));
       parent.SetHost(hostinfo);
 }
開發者ID:peca-dev,項目名稱:peercaststation,代碼行數:34,代碼來源:PCPYellowPageClient.cs


注:本文中的AtomCollection.SetHostOldPos方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。