Ejemplo n.º 1
0
        public void ReadFrom(Properties.Settings settings, ConfigReader reader)
        {
            PresenceAddress = reader.GetSetting(SettingKey.PresenceAddress, DefaultValues.PresenceAddress);
            BindToIP        = settings.BindToIP;

            bool requiresNewBindToIP = !NetworkUtility.IsValidLocalIP(BindToIP);

            if (requiresNewBindToIP)
            {
                var ip = NetworkUtility.GetLocalIPAddress();
                BindToIP = ip == null ? String.Empty : ip.ToString();
            }

            ClientID = settings.ClientID;

            if (String.IsNullOrEmpty(ClientID))
            {
                ClientID = Guid.NewGuid().ToString();
            }

            ChatPort             = reader.GetSetting(SettingKey.ChatPort, DefaultValues.ChatPort);
            KeepAliveTime        = reader.GetSetting(SettingKey.KeepAliveTime, DefaultValues.KeepAliveTime);
            PresencePort         = reader.GetSetting(SettingKey.PresencePort, DefaultValues.PresencePort);
            PresenceCallbackPort = reader.GetSetting(SettingKey.PresenceCallbackPort, DefaultValues.PresenceCallbackPort);
        }
Ejemplo n.º 2
0
        public bool Filter(StringBuilder message, IChatWindow window)
        {
            message.Replace("(you)", window.PrimaryBuddy.DisplayName)
            .Replace("(me)", SquiggleContext.Current.ChatClient.CurrentUser.DisplayName)
            .Replace("(now)", DateTime.Now.ToString())
            .Replace("(time)", DateTime.Now.ToLongTimeString())
            .Replace("(stime)", DateTime.Now.ToShortTimeString())
            .Replace("(date)", DateTime.Now.ToShortDateString())
            .Replace("(day)", DateTime.Now.DayOfWeek.ToString())
            .Replace("(myip)", (NetworkUtility.GetLocalIPAddress() ?? IPAddress.Loopback).ToString())
            .Replace("(ver)", AppInfo.Version.ToString());

            return(true);
        }
Ejemplo n.º 3
0
        static IPEndPoint GetConfig()
        {
            string    temp = ConfigurationManager.AppSettings["ip"];
            IPAddress ip;

            if (String.IsNullOrEmpty(temp) ||
                !IPAddress.TryParse(temp, out ip) ||
                !NetworkUtility.IsValidLocalIP(ip))
            {
                ip = NetworkUtility.GetLocalIPAddress();
            }

            var reader = new ConfigReader();
            int port   = reader.GetSetting <int>("port", DefaultValues.PresencePort);

            var endPoint = new IPEndPoint(ip, port);

            return(endPoint);
        }
Ejemplo n.º 4
0
 void Start()
 {
     IP.text = NetworkUtility.GetLocalIPAddress().ToString();
 }