/// <summary> /// PeerCastを初期化します /// </summary> public PeerCast() { logger.Info("Starting PeerCast"); this.AccessController = new AccessController(this); var filever = System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly().Location); this.AgentName = String.Format("{0}/{1}", filever.ProductName, filever.ProductVersion); this.SessionID = Guid.NewGuid(); var bcid = AtomCollectionExtensions.IDToByteArray(Guid.NewGuid()); bcid[0] = 0x00; this.BroadcastID = AtomCollectionExtensions.ByteArrayToID(bcid); logger.Debug("SessionID: {0}", this.SessionID.ToString("N")); logger.Debug("BroadcastID: {0}", this.BroadcastID.ToString("N")); this.YellowPageFactories = new List <IYellowPageClientFactory>(); this.SourceStreamFactories = new List <ISourceStreamFactory>(); this.OutputStreamFactories = new List <IOutputStreamFactory>(); this.ContentReaderFactories = new List <IContentReaderFactory>(); this.ContentFilters = new List <IContentFilter>(); this.monitorTimer = new Timer(OnMonitorTimer, cancelSource.Token, 0, 5000); }
/// <summary> /// PeerCastを初期化します /// </summary> public PeerCast() { logger.Info("Starting PeerCast"); this.AccessController = new AccessController(this); var filever = System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly().Location); this.AgentName = String.Format("{0}/{1}", filever.ProductName, filever.ProductVersion); this.SessionID = Guid.NewGuid(); var bcid = AtomCollectionExtensions.IDToByteArray(Guid.NewGuid()); bcid[0] = 0x00; this.BroadcastID = AtomCollectionExtensions.ByteArrayToID(bcid); logger.Debug("SessionID: {0}", this.SessionID.ToString("N")); logger.Debug("BroadcastID: {0}", this.BroadcastID.ToString("N")); this.GlobalAddress = null; this.GlobalAddress6 = null; this.IsFirewalled = null; this.YellowPageFactories = new List <IYellowPageClientFactory>(); this.SourceStreamFactories = new List <ISourceStreamFactory>(); this.OutputStreamFactories = new List <IOutputStreamFactory>(); this.ContentReaderFactories = new List <IContentReaderFactory>(); foreach (var addr in Dns.GetHostAddresses(Dns.GetHostName())) { switch (addr.AddressFamily) { case AddressFamily.InterNetwork: if (this.LocalAddress == null && !addr.Equals(IPAddress.None) && !addr.Equals(IPAddress.Any) && !addr.Equals(IPAddress.Broadcast) && !IPAddress.IsLoopback(addr)) { this.LocalAddress = addr; logger.Info("IPv4 LocalAddress: {0}", this.LocalAddress); } break; case AddressFamily.InterNetworkV6: if (LocalAddress6 == null && !addr.Equals(IPAddress.IPv6Any) && !addr.Equals(IPAddress.IPv6Loopback) && !addr.Equals(IPAddress.IPv6None)) { this.LocalAddress6 = addr; logger.Info("IPv6 LocalAddress: {0}", this.LocalAddress6); } break; default: break; } } if (this.LocalAddress == null) { this.LocalAddress = IPAddress.Loopback; } if (this.LocalAddress6 == null) { this.LocalAddress6 = IPAddress.IPv6Loopback; } }