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 downLoad(out string msg)
        {
            string      deviceId = XmlConfig.readDeviceId();
            XmlNodeList pList    = CXml.ReadList(Application.StartupPath + "\\Update.xml", "/update/fileList/file");

            CSQLite.G_CSQLite.WriteRunLogInfoDB("D03", "开始下载更新文件");
            msg = "开始下载更新文件";
            foreach (XmlNode nl in pList)
            {
                try
                {
                    FtpClient ftp = new FtpClient();
                    ftp.Server     = szAddress;
                    ftp.RemotePath = "update";
                    ftp.Login();
                    ftp.ChangeDir(deviceId);
                    long nSize = 0;
                    if ((nSize = ftp.GetFileSize(nl.Attributes[0].Value)) > 0)
                    {
                        long   nDoneSize = 0;
                        string szFile    = null;
                        do
                        {
                            ftp.Download(nl.Attributes[0].Value, Application.StartupPath + "\\Update\\" + nl.Attributes[0].Value, true);
                            szFile = Application.StartupPath + "\\Update\\" + nl.Attributes[0].Value;
                            if (File.Exists(szFile))
                            {
                                FileInfo fi = new FileInfo(szFile);
                                nDoneSize = fi.Length;
                            }
                        } while (nDoneSize != nSize);
                    }
                    ftp.Close();
                }
                catch (Exception e)
                {
                    CSQLite.G_CSQLite.WriteRunLogInfoDB("D05", "更新文件下载失败");
                    msg = nl.Attributes[0].Value + "更新文件下载失败" + e.Message;
                    return(false);
                }
            }
            CSQLite.G_CSQLite.WriteRunLogInfoDB("D04", "更新文件下载完成");
            msg = "更新文件下载完成";
            return(true);
        }
Ejemplo n.º 4
0
        //----------------------------------------------------------------------------------------------------------------------
        public static int GetPerson(string[] person)
        {
            XmlNodeList pList = CXml.ReadList(Application.StartupPath + "\\person.xml", "/Config/site/person");
            int         i     = 0;

            try
            {
                foreach (XmlNode nl in pList)
                {
                    person[i] = nl.Attributes[0].Value;
                    i++;
                }
            }
            catch
            {
            }
            return(i);
        }
Ejemplo n.º 5
0
 public static void writeTrackOpenButtonStatus(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/button ", "isClick", value);
 }
Ejemplo n.º 6
0
 public static void WriteCCID(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/device", "CCID", value);
 }
Ejemplo n.º 7
0
 public static void writeLimitStartTime(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/auto", "limitStartTime", value);
 }
Ejemplo n.º 8
0
 public static void writeLastUploadTime(string value, string Property)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/upload ", Property, value);
 }
Ejemplo n.º 9
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.º 10
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.º 11
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.º 12
0
 public static void writeDeviceId(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/device", "id", value);
 }
Ejemplo n.º 13
0
 public static void writeComPort(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/com", "port", value);
 }
Ejemplo n.º 14
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.º 15
0
 public static void writeServerIP(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/server", "ip", value);
 }
Ejemplo n.º 16
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.º 17
0
 public static void writeVerson(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/version", "number", value);
 }
Ejemplo n.º 18
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.º 19
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.º 20
0
 public static void writeSoundLevel(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/alarm", "slevel", value);
 }
Ejemplo n.º 21
0
 //-----------------------------------------------------------------------------------------------------------------
 public static void writeConfigNode(string node, string attribute, string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/" + node, attribute, value);
 }
Ejemplo n.º 22
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.º 23
0
 public static void writeOpenPoint(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/click", "openPoint", value);
 }
Ejemplo n.º 24
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.º 25
0
 public static void writeLineName(string value)
 {
     CXml.Update(Application.StartupPath + "\\line.xml", "/Config/site/line", "name", value);
 }
Ejemplo n.º 26
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.º 27
0
 public static void writeAlarmTime(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/alarm", "time", value);
 }
Ejemplo n.º 28
0
 public static void writeDailyStartTime(string value)
 {
     CXml.Update(Application.StartupPath + "\\config.xml", "/Config/site/contAndDailyStartTime", "dailyStartTime", value);
 }
Ejemplo n.º 29
0
        public static string readDailyStartTime()
        {
            string str = CXml.Read(Application.StartupPath + "\\config.xml", "/Config/site/contAndDailyStartTime", "dailyStartTime");

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