Пример #1
0
 void Init(HOST host)
 {
     ID      = host.id;
     NAME    = host.name;
     STARTED = IdBasedObject.DateTimeToString(host.STARTED);
     PCPING  = IdBasedObject.DateTimeToString(host.pcping);
     INFO    = host.systeminfo;
     IP      = host.ip;
     MAC     = host.mac;
 }
Пример #2
0
            public bool Equals(HOST p)
            {
                // If parameter is null return false:
                if ((object)p == null)
                {
                    return(false);
                }

                // Return true if the fields match:
                return((this.name == p.name) && (this.ip.Equals(p.ip)));
            }
Пример #3
0
            public bool Equals(HOST p)
            {
                // If parameter is null return false:
                if ((object)p == null)
                {
                    return false;
                }

                // Return true if the fields match:
                return (this.name == p.name) && (this.ip.Equals(p.ip));
            }
Пример #4
0
        public static string GetConnectString(HOST hostinfo)
        {
            string sqlConnectionStr = "";

            if (hostinfo.DBTYPE == DBType.sqlserver)
            {
                sqlConnectionStr = string.Format("server={0};database={1};uid={2};pwd={3}", hostinfo.master_HOST, hostinfo.master_DBNAME, hostinfo.USERID, hostinfo.PWD);
            }
            else if (hostinfo.DBTYPE == DBType.oracle)
            {
                sqlConnectionStr = string.Format("Driver={0};dbq = {1}; UID = {2}; PWD = {3};", hostinfo.master_HOST, hostinfo.master_DBNAME, hostinfo.USERID, hostinfo.PWD);
            }


            return(sqlConnectionStr);
        }
Пример #5
0
            public static List <HOST> getLanHosts()
            {
                var l_hosts   = new List <HOST>();
                var hostnames = getLanHostnames2();  // <------------ temp

                foreach (var host in hostnames)
                {
                    HOST h = new HOST();
                    h.name = host;
                    var t_ip = getLanHostAddresses(host);
                    if (t_ip.Count > 0)
                    {
                        h.ip = t_ip[0];
                        l_hosts.Add(h);
                    }
                }

                return(l_hosts);
            }
Пример #6
0
            public override bool Equals(System.Object obj)
            {
                // If parameter is null return false.
                if (obj == null)
                {
                    return(false);
                }

                // If parameter cannot be cast to Point return false.
                HOST p = obj as HOST;

                if ((System.Object)p == null)
                {
                    return(false);
                }

                // Return true if the fields match:
                return((this.name == p.name) && (this.ip.Equals(p.ip)));
            }
Пример #7
0
 public static IPersistBroker PersistBroker(HOST hostInfo, System.Globalization.CultureInfo cultureInfo)
 {
     if (hostInfo == null)
     {
         Log.Info("$Need_dbinfo");
         return(null);
     }
     if (cultureInfo == null)
     {
         cultureInfo = new System.Globalization.CultureInfo("en-US", false);
     }
     if (hostInfo.DBTYPE == DBType.sqlserver)
     {
         return(new Service.Common.PersistBroker.SqlPersistBroker(GetConnectString(hostInfo), cultureInfo));
     }
     else
     {
         //当前只支持sqlserver
         Log.Info("$dbtype_erro");
         return(null);
         //return new Service.Common.PersistBroker.SqlPersistBroker(connectString, cultureInfo);
     }
 }
Пример #8
0
 public HostState(HOST host)
 {
     Init(host);
 }
Пример #9
0
            public static List<HOST> getLanHosts()
            {
                var l_hosts = new List<HOST>();
                var hostnames = getLanHostnames2();  // <------------ temp
                foreach (var host in hostnames)
                {
                    HOST h = new HOST();
                    h.name = host;
                    var t_ip = getLanHostAddresses(host);
                    if (t_ip.Count > 0)
                    {
                        h.ip = t_ip[0];
                        l_hosts.Add(h);
                    }

                }

                return l_hosts;
            }
Пример #10
0
 public override string ToString()
 {
     return(HOST.ToString() + ":" + PORT.ToString());
 }