示例#1
0
        public static IPEntity getIPConfig()
        {
            try
            {
                string data = FileManage.ReadFile(path);
                if (data == "")
                {
                    return(null);
                }

                string[] ip = data.Split('\n')[0].Replace("ip=", "").Replace(" ", "").Replace("\r", "").Split('.');
                if (ip.Length != 4)
                {
                    return(null);
                }

                int      port     = int.Parse(data.Split('\n')[1].Replace("port=", "").Replace("\r", "").Replace(" ", ""));
                IPEntity ipEntity = new IPEntity();
                ipEntity.Ip   = ip;
                ipEntity.Port = port;
                return(ipEntity);
            }
            catch (Exception ex)
            {
            }

            return(null);
        }
示例#2
0
        public void getData()
        {
            try
            {
                string data = FileManage.ReadFile(path);
                if (data == "")
                {
                    return;
                }

                string[] arrData = data.Split('\n');
                int      len     = arrData.Length;
                arrayEPC  = new string[len]; //epc
                arrayName = new string[len]; //
                arrayType = new string[len]; //
                arrayTime = new long[len];   //

                for (int k = 0; k < len; k++)
                {
                    string[] temp = arrData[k].ToString().Replace("\r", "").Replace(" ", "").Split('=');
                    if (temp[0] != "")
                    {
                        arrayEPC[k]  = temp[0];
                        arrayName[k] = temp[1];
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }