Beispiel #1
0
        private void SectionHandler_OnConfigurationChanged(object sender, EventArgs e)
        {
            CategoryPropertyItem   piRoot = ConfigurationAccessHelper.GetCategoryPropertyByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, "NetworkPeering/NAT_Gateways");
            List <AddressEndPoint> list   = new List <AddressEndPoint>();

            if (piRoot != null)
            {
                foreach (CategoryPropertyItem pi in piRoot)
                {
                    list.Add(AddressEndPoint.Parse(pi.EntryValue));
                }
            }
            EndPoints = list;
        }
Beispiel #2
0
        private void SectionHandler_OnConfigurationChanged(object sender, EventArgs e)
        {
            CategoryPropertyItem   piRoot = ConfigurationAccessHelper.GetCategoryPropertyByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, "NetworkPeering/TCP_Connections");
            List <ConnectionEntry> list   = new List <ConnectionEntry>();

            if (piRoot != null)
            {
                foreach (CategoryPropertyItem pi in piRoot)
                {
                    AddressEndPoint address    = AddressEndPoint.Parse(pi.EntryValue);
                    bool            reConnect  = true;
                    int             delayValue = 1000;
                    int             conTimeout = Timeout.Infinite;
                    string          item       = ConfigurationAccessHelper.GetValueByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, string.Format("NetworkPeering/TCP_Connections/{0}/ReconnectOnFailure", pi.Id));
                    if (!string.IsNullOrEmpty(item))
                    {
                        bool.TryParse(item, out reConnect);
                    }
                    item = ConfigurationAccessHelper.GetValueByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, string.Format("NetworkPeering/TCP_Connections/{0}/DelayBetweenAttempsInMS", pi.Id));
                    if (!string.IsNullOrEmpty(item))
                    {
                        int.TryParse(item, out delayValue);
                        if (delayValue < 0)
                        {
                            delayValue = 1000;
                        }
                    }
                    item = ConfigurationAccessHelper.GetValueByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, string.Format("NetworkPeering/TCP_Connections/{0}/ConnectionTimeout", pi.Id));
                    if (!string.IsNullOrEmpty(item))
                    {
                        int.TryParse(item, out conTimeout);
                        if (conTimeout < Timeout.Infinite)
                        {
                            conTimeout = Timeout.Infinite;
                        }
                    }
                    list.Add(new ConnectionEntry(address, reConnect, delayValue, conTimeout));
                }
            }
            EndPoints = list;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes the channel.
        /// </summary>
        /// <param name="pi">The pi.</param>
        public virtual void Initialize(CategoryPropertyItem pi)
        {
            DoDisposeCheck();
            if (pi == null)
            {
                ThrowHelper.ThrowArgumentNullException("pi");
            }

            if (!mInitialized)
            {
                {
                    this.mConnectionData = null;
                    CategoryPropertyItem item = ConfigurationAccessHelper.GetCategoryPropertyByPath(pi.PropertyItems, "RemoteAddress");
                    if (item != null)
                    {
                        this.mConnectionData = AddressEndPoint.Parse(item.EntryValue);
                    }
                    if (item != null)
                    {
                        ConfigurationAccessHelper.ParseLongValue(pi.PropertyItems, "DefaultErrorResponseTimeout", Timeout.Infinite, long.MaxValue, ref mDefaultErrorResponseTimeout);
                    }
                }
                {
                    mServerEndpoints.Clear();
                    CategoryPropertyItem baseAddressesItems = ConfigurationAccessHelper.GetCategoryPropertyByPath(pi.PropertyItems, "BaseAddresses");
                    if (baseAddressesItems != null)
                    {
                        IEnumerator <CategoryPropertyItem> iterator = baseAddressesItems.GetEnumerator();
                        while (iterator.MoveNext())
                        {
                            mServerEndpoints.Add(AddressEndPoint.Parse(iterator.Current.EntryValue));
                        }
                    }
                }
                {
                    mSessionReusable = true;
                    ConfigurationAccessHelper.ParseBooleanValue(pi.PropertyItems, "SessionReusable", ref mSessionReusable);
                }
            }
        }
Beispiel #4
0
        private void SectionHandler_OnConfigurationChanged(object sender, EventArgs e)
        {
            CategoryPropertyItem   piRoot = ConfigurationAccessHelper.GetCategoryPropertyByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, "NetworkPeering/TCPServers/Auto");
            List <AddressEndPoint> list   = new List <AddressEndPoint>();

            if (piRoot != null)
            {
                foreach (CategoryPropertyItem pi in piRoot)
                {
                    list.Add(AddressEndPoint.Parse(pi.EntryValue));
                }
            }
            EndPoints = list;

            string value     = ConfigurationAccessHelper.GetValueByPath(TerraGrafConfiguration.Settings.CategoryPropertyItems, "NetworkPeering/TCPServers/Auto");
            bool   boolValue = false;

            if (!string.IsNullOrEmpty(value))
            {
                bool.TryParse(value, out boolValue);
            }
            mAuto = boolValue;
        }