Exemplo n.º 1
0
        public void SaveSettings(System.Collections.Specialized.StringDictionary settings)
        {
            settings[Constants.ReportingServer]             = txtReportingService.Text;
            settings[Constants.SqlServer]                   = txtSqlServer.Text;
            settings[Constants.IFDWebApplicationRootDomain] = txtDomainName.Text;
            settings[Constants.Port]          = txtPort.Text;
            settings[Constants.AppRootDomain] = txtAppRootDomain.Text;
            if (ddlCrmIpAddress.AddressId > 0)
            {
                IPAddressInfo address = ES.Services.Servers.GetIPAddress(ddlCrmIpAddress.AddressId);
                if (String.IsNullOrEmpty(address.ExternalIP))
                {
                    settings[Constants.CRMWebsiteIP] = address.InternalIP;
                }
                else
                {
                    settings[Constants.CRMWebsiteIP] = address.ExternalIP;
                }
            }
            else
            {
                settings[Constants.CRMWebsiteIP] = String.Empty;
            }

            settings[Constants.UrlSchema] = ddlSchema.SelectedValue;
        }
        public void SaveSettings(StringDictionary settings)
        {
            settings["RootWebApplicationUri"] = this.txtRootWebApplication.Text;
            settings["LocalHostFile"]         = chkLocalHostFile.Checked.ToString();
            settings["RootWebApplicationInteralIpAddress"] = String.Empty;
            settings["SharedSSLRoot"] = this.txtSharedSSLRoot.Text;

            if (ddlRootWebApplicationIpAddress.AddressId > 0)
            {
                IPAddressInfo address = ES.Services.Servers.GetIPAddress(ddlRootWebApplicationIpAddress.AddressId);
                if (String.IsNullOrEmpty(address.ExternalIP))
                {
                    settings["RootWebApplicationIpAddress"] = address.InternalIP;
                }
                else
                {
                    settings["RootWebApplicationIpAddress"] = address.ExternalIP;
                }

                if (!String.IsNullOrEmpty(address.InternalIP))
                {
                    settings["RootWebApplicationInteralIpAddress"] = address.InternalIP;
                }
            }
            else
            {
                settings["RootWebApplicationIpAddress"] = String.Empty;
            }
        }
Exemplo n.º 3
0
        public static IPAddressInfo GetIPAddressInfo(PcapDevice device)
        {
            PcapAddress pcap_address = null;

            pcap_address = device.Interface.Addresses
                           .Where(a => a.Addr.type == Sockaddr.AddressTypes.AF_INET_AF_INET6 &&
                                  a.Addr.ipAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                           .FirstOrDefault();

            if (pcap_address == null)
            {
                throw new InvalidOperationException("IP address not found");
            }

            IPAddressInfo ipaddressinfo = new IPAddressInfo
            {
                IPAddress = pcap_address.Addr.ipAddress,
                Mask      = pcap_address.Netmask.ipAddress,
                Gateway   = device.Interface.GatewayAddresses?.FirstOrDefault()
            };

            ipaddressinfo.IPNetwork   = GetNetworkAddress(ipaddressinfo.Mask, ipaddressinfo.IPAddress);
            ipaddressinfo.IPBroadcast = GetBroadcastAddress(ipaddressinfo.Mask, ipaddressinfo.IPAddress);

            return(ipaddressinfo);
        }
Exemplo n.º 4
0
 public void SaveSettings(StringDictionary settings)
 {
     if (ipAddress.AddressId > 0)
     {
         IPAddressInfo address = ES.Services.Servers.GetIPAddress(ipAddress.AddressId);
         if (String.IsNullOrEmpty(address.InternalIP))
         {
             settings["SharedIP"] = address.ExternalIP;
         }
         else
         {
             settings["SharedIP"] = address.InternalIP;
         }
     }
     else
     {
         settings["SharedIP"] = String.Empty;
     }
     settings["SiteId"] = ddlSite.SelectedValue;
     if (!string.IsNullOrWhiteSpace(txtAdFtpRoot.Text))
     {
         settings["AdFtpRoot"] = txtAdFtpRoot.Text.Trim();
     }
     settings["FtpGroupName"]      = txtFtpGroupName.Text.Trim();
     settings["BuildUncFilesPath"] = chkBuildUncFilesPath.Checked.ToString();
     ActiveDirectoryIntegration.SaveSettings(settings);
 }
Exemplo n.º 5
0
        private void BindPhone()
        {
            int addressId = PanelRequest.AddressID;

            // check if multiple editing
            if (!String.IsNullOrEmpty(PanelRequest.Addresses))
            {
                string[] ids = PanelRequest.Addresses.Split(',');
                addressId = Utils.ParseInt(ids[0], 0);
            }

            // bind first address
            IPAddressInfo addr = ES.Services.Servers.GetIPAddress(addressId);

            if (addr != null)
            {
                Utils.SelectListItem(ddlServer, addr.ServerId);

                Phone.Text       = addr.ExternalIP;
                txtComments.Text = addr.Comments;

                ToggleControls();
            }
            else
            {
                // exit
                RedirectBack();
            }
        }
        private void BindIPAddress()
        {
            int addressId = PanelRequest.AddressID;

            // check if multiple editing
            if (!String.IsNullOrEmpty(PanelRequest.Addresses))
            {
                string[] ids = PanelRequest.Addresses.Split(',');
                addressId = Utils.ParseInt(ids[0], 0);
            }

            // bind first address
            IPAddressInfo addr = ES.Services.Servers.GetIPAddress(addressId);

            if (addr != null)
            {
                Utils.SelectListItem(ddlServer, addr.ServerId);
                Utils.SelectListItem(ddlPools, addr.Pool.ToString());

                externalIP.Text     = addr.ExternalIP;
                internalIP.Text     = addr.InternalIP;
                subnetMask.Text     = addr.SubnetMask;
                defaultGateway.Text = addr.DefaultGateway;
                VLAN.Text           = addr.VLAN.ToString();
                txtComments.Text    = addr.Comments;

                ToggleControls();
            }
            else
            {
                // exit
                RedirectBack();
            }
        }
Exemplo n.º 7
0
        private IPAddressInfo registIPInfo(string host, IPAddress[] addresses)
        {
            IPAddressInfo info = new IPAddressInfo();

            info.host = host;
            info.parse(addresses);
            _ipInfoDic.put(host, info);

            return(info);
        }
Exemplo n.º 8
0
        private ListItem CreateIPListItem(int addressId)
        {
            IPAddressInfo addr = ES.Services.Servers.GetIPAddress(addressId);

            if (addr != null)
            {
                string fullIP = addr.ExternalIP;
                if (addr.InternalIP != null &&
                    addr.InternalIP != "" &&
                    addr.InternalIP != addr.ExternalIP)
                {
                    fullIP += " (" + addr.InternalIP + ")";
                }

                return(new ListItem(fullIP, addr.AddressId.ToString()));
            }
            return(null);
        }
Exemplo n.º 9
0
        public static bool IsIpAddressOfNetwork(PcapDevice device, IPAddress ipAdress)
        {
            IPAddressInfo ip_info = GetIPAddressInfo(device);

            byte[] bytes_ip_device = ip_info.IPAddress.GetAddressBytes(); // IPv4
            byte[] bytes_ip_start  = ip_info.IPNetwork.GetAddressBytes();
            byte[] bytes_ip_end    = ip_info.IPBroadcast.GetAddressBytes();

            byte[] byte_ipAddress = ipAdress.GetAddressBytes();

            for (int i = 0; i < 4; i++)
            {
                if (byte_ipAddress[i] < bytes_ip_start[i] ||
                    byte_ipAddress[i] > bytes_ip_end[i])
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 10
0
        public void SaveSettings(StringDictionary settings)
        {
            settings["RootWebApplicationUri"] = this.txtRootWebApplication.Text;

            if (ddlRootWebApplicationIpAddress.AddressId > 0)
            {
                IPAddressInfo address = ES.Services.Servers.GetIPAddress(ddlRootWebApplicationIpAddress.AddressId);
                if (String.IsNullOrEmpty(address.ExternalIP))
                {
                    settings["RootWebApplicationIpAddress"] = address.InternalIP;
                }
                else
                {
                    settings["RootWebApplicationIpAddress"] = address.ExternalIP;
                }
            }
            else
            {
                settings["RootWebApplicationIpAddress"] = String.Empty;
            }
            settings["BackupTemporaryFolder"] = txtBackupTempFolder.Text;
        }
Exemplo n.º 11
0
        public void SaveSettings(System.Collections.Specialized.StringDictionary settings)
        {
            settings[Constants.ReportingServer]             = txtReportingService.Text;
            settings[Constants.SqlServer]                   = txtSqlServer.Text;
            settings[Constants.IFDWebApplicationRootDomain] = txtDomainName.Text;
            settings[Constants.Port] = txtPort.Text;

            settings[Constants.AppRootDomain]          = txtAppRootDomain.Text;
            settings[Constants.OrganizationWebService] = txtOrganizationWebService.Text;
            settings[Constants.DiscoveryWebService]    = txtDiscoveryWebService.Text;
            settings[Constants.DeploymentWebService]   = txtDeploymentWebService.Text;

            settings[Constants.Password] = (txtPassword.Text.Length > 0) ? txtPassword.Text : (string)ViewState["PWD"];
            settings[Constants.UserName] = txtUserName.Text;

            if (ddlCrmIpAddress.AddressId > 0)
            {
                IPAddressInfo address = ES.Services.Servers.GetIPAddress(ddlCrmIpAddress.AddressId);
                if (String.IsNullOrEmpty(address.ExternalIP))
                {
                    settings[Constants.CRMWebsiteIP] = address.InternalIP;
                }
                else
                {
                    settings[Constants.CRMWebsiteIP] = address.ExternalIP;
                }
            }
            else
            {
                settings[Constants.CRMWebsiteIP] = String.Empty;
            }

            settings[Constants.UrlSchema] = ddlSchema.SelectedValue;

            settings[Constants.Collation]    = ddlCollation.SelectedValue;
            settings[Constants.Currency]     = ddlCurrency.SelectedValue;
            settings[Constants.BaseLanguage] = ddlBaseLanguage.SelectedValue;
        }
Exemplo n.º 12
0
        private void toGetDNS()
        {
            _state       = Connecting;
            _connectTime = 0;

            int index = ++_doIndex;

            _currentInfo = _ipInfoDic.get(_host);

            if (_currentInfo != null)
            {
                preConnectAfterAddress();
            }
            else
            {
                IPAddress address;

                if (!IPAddress.TryParse(_host, out address))
                {
                    Ctrl.debugLog("dns上");

                    Dns.BeginGetHostAddresses(_host, v =>
                    {
                        IPAddress[] addresses = null;

                        try
                        {
                            addresses = Dns.EndGetHostAddresses(v);
                        }
                        catch (Exception e)
                        {
                            Ctrl.printExceptionForIO(e);
                        }

                        ThreadControl.addMainFunc(() =>
                        {
                            if (index == _doIndex)
                            {
                                if (addresses != null)
                                {
                                    foreach (IPAddress ipAddress in addresses)
                                    {
                                        Ctrl.print("dns看收到的上地址", ipAddress);
                                    }

                                    _currentInfo = registIPInfo(_host, addresses);
                                    preConnectAfterAddress();
                                }
                                else
                                {
                                    Ctrl.printForIO("解析dns失败");
                                }
                            }
                            else
                            {
                                Ctrl.print("dns获取完,已经到下个index");
                            }
                        });
                    }, null);
                }
                else
                {
                    Ctrl.debugLog("dns下");
                    _currentInfo = registIPInfo(_host, new[] { address });
                    preConnectAfterAddress();
                }
            }
        }
Exemplo n.º 13
0
 private void clearAddress()
 {
     _currentInfo = null;
     _hostAddress = null;
 }