コード例 #1
0
        public void HamKiemtraphienban(string tenungdung, string tentrenSERVER)
        {
            lbtenungdung.Text = tenungdung;
            lbnoidung.Text    = "Có phiên bản mới !. Đang cập nhật ...";
            ftp ftpH = new ftp(serverFtp, "hts", "hoanglaota");

            string[] danhsachFILEDOWN = ftpH.directoryListSimple("app/luutru/" + tentrenSERVER + "/");
            if (danhsachFILEDOWN != null)
            {
                if (!Directory.Exists(Application.StartupPath + @"\backup\"))
                {
                    Directory.CreateDirectory(Application.StartupPath + @"\backup\");
                }
                for (int i = 0; i < danhsachFILEDOWN.Length; i++)
                {
                    if (File.Exists(Application.StartupPath + @"\" + danhsachFILEDOWN[i]))
                    {
                        File.Copy(Application.StartupPath + @"\" + danhsachFILEDOWN[i], Application.StartupPath + @"\backup\" + danhsachFILEDOWN[i], true);
                    }
                    ftpH.download("app/luutru/" + tentrenSERVER + "/" + danhsachFILEDOWN[i], Application.StartupPath + @"\" + danhsachFILEDOWN[i]);
                }
                string[,] giatriupdate = new string[, ]
                {
                    { "phienban", sophienbanSV },
                    { "ngaycapnhat", DateTime.Now.ToString("dd-MM-yyyy") }
                };
                xlJson.UpdatevalueJSON(giatriupdate);
            }


            Khoichay(tenungdung);
        }
コード例 #2
0
        public void HamKiemtraphienban(string tenungdung, string tentrenSERVER)
        {
            lbtenungdung.Invoke(new MethodInvoker(delegate()
            {
                lbtenungdung.Text = tenungdung;
            }));
            var    con        = ketnoi.Khoitao(serverMysql);
            string phienbanSV = con.GetPhienban(tentrenSERVER);

            if (phienbanSV != sophienban)
            {
                lbnoidung.Invoke(new MethodInvoker(delegate()
                {
                    lbnoidung.Text = "Có phiên bản mới !. Đang cập nhật ...";
                }));


                ftp      ftpH             = new ftp(serverFtp, "hts", "hoanglaota");
                string[] danhsachFILEDOWN = ftpH.directoryListSimple("app/luutru/" + tentrenSERVER + "/");
                if (danhsachFILEDOWN != null)
                {
                    for (int i = 0; i < danhsachFILEDOWN.Length; i++)
                    {
                        ftpH.download("app/luutru/" + tentrenSERVER + "/" + danhsachFILEDOWN[i], Application.StartupPath + "/" + danhsachFILEDOWN[i]);
                    }
                    string[,] giatriupdate = new string[, ]
                    {
                        { "phienban", phienbanSV },
                        { "ngaycapnhat", DateTime.Now.ToString("dd-MM-yyyy") }
                    };
                    xlJson.UpdatevalueJSON(giatriupdate);
                }
            }
            Khoichay(tenungdung);
        }