Ejemplo n.º 1
0
        public static string readDeviceId()
        {
            string str;

            str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/device", "id");
            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 2
0
        public static string readServerIP()
        {
            string      str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/server", "ip");
            XmlDocument doc = new XmlDocument();

            doc.Load(Application.StartupPath + "\\config.xml");
            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 3
0
        public bool CheckUpdates(out string msg)
        {
            string     deviceId = XmlConfig.readDeviceId();
            CFTPClient ftp      = null;

            try
            {
                msg            = "开始更新进程";
                ftp            = new CFTPClient();
                ftp.RemoteHost = szAddress;
                ftp.RemotePath = "update";
                ftp.RemoteUser = "******";
                ftp.RemotePass = "******";
                ftp.Connect();
                ftp.ChDir(deviceId);
                try
                {
                    ftp.GetFile("Update.xml", Application.StartupPath + "\\", "Update.xml");
                }
                catch
                {
                }

                long NewBuildTime, CurlBuildTime;
                NewBuildTime = CurlBuildTime = 0;

                string strNewBuildTime  = CXml.Read(Application.StartupPath + "\\Update.xml", "/update/build ", "time");
                string strCurlBuildTime = XmlConfig.readBuildTime();
                if (string.IsNullOrEmpty(strNewBuildTime))
                {
                    ftp.DisConnect();
                    msg = "远程目录没有设置更新时间";
                    return(false);
                }
                else
                {
                    NewBuildTime = long.Parse(strNewBuildTime);
                }
                if (string.IsNullOrEmpty(strCurlBuildTime))
                {
                    strCurlBuildTime = "0";
                }
                CurlBuildTime = long.Parse(strCurlBuildTime);
                if (NewBuildTime > CurlBuildTime)
                {
                    CSQLite.G_CSQLite.WriteRunLogInfoDB("0xDA", "检测到新版本");
                    ftp.DisConnect();
                    msg = "检测到新版本";
                    return(true);
                }
                else
                {
                    msg = "当前已是最新版本";
                    CSQLite.G_CSQLite.WriteRunLogInfoDB("0xD9", "当前已是最新版本");
                    return(false);
                }
            }
            catch
            {
                try
                {
                    ftp.DisConnect();
                }
                catch
                {
                }
                msg = "检测更新失败";
                CSQLite.G_CSQLite.WriteRunLogInfoDB("E02", "检测更新函数失败");
                return(false);
            }
        }
Ejemplo n.º 4
0
        public static string readAlarmTime()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/alarm", "time");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 5
0
        public static string readLineName()
        {
            string str = CXml.Read(Application.StartupPath + "\\line.xml", "/Config/site/line", "name");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 6
0
        public static string readOpenPoint()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/click", "openPoint");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 7
0
        public static string readSoundLevel()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/alarm", "slevel");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 8
0
        public static string readComPort()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/com", "port");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 9
0
        public static string readVerson()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/version", "number");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 10
0
        public static string readTrackOpenButtonStatus()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/button", "isClick");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 11
0
        public static string readLastUploadTime(string Property)
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/upload", Property);

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 12
0
        public static string readLimitStartTime()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/auto", "limitStartTime");

            return((str != null && str != "") ? str : "0");
        }
Ejemplo n.º 13
0
        public static string readDailyStartTime()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/contAndDailyStartTime", "dailyStartTime");

            return((str != null && str != "") ? str : "0");
        }