private void bgw_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { isbusy = 1; try { if (isSend == 1) { byte[] file_data = System.IO.File.ReadAllBytes(Here_File); dt.Rows[0]["FILE_DATA"] = file_data; kq = DHuy.UPDATE("FILE_TRANSFER", dt, "ID", "FILE_DATA"); dt.Rows[0]["SEND_STATUS"] = 1; kq = DHuy.UPDATE("FILE_TRANSFER", dt, "ID", "SEND_STATUS"); DHuy.AddCommand_Trans(SESSION_TRANS_ID, "FILE_TRANSFER_RECEIVE;" + Remote_File + ";" + Here_FileName); } else { if (Here_File == "Home") { Here_File = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); } DHuy.DownloadFile("FILE_TRANSFER", "FILE_DATA", "ID", SESSION_TRANS_ID, Here_File + "\\" + Path.GetFileName(Remote_File)); } } catch (Exception ex) { } }
private void cmsUpdate_Click(object sender, EventArgs e) { string app = "UpdateFireP.exe"; string ExeName = System.IO.Path.GetFileName(Application.ExecutablePath); String tempPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\" + app; DHuy.DownloadFile(app, tempPath); try { System.Diagnostics.Process.Start(tempPath, ExeName.ToLower().Replace(".exe", "") + " JustClickSee.exe" + " \"" + Application.ExecutablePath + "\""); } catch (Exception ex) { } }
//TIMER private void FILE_TRANSFER_LIST_Tick(object sender, EventArgs e) { try { DataTable da = DHuy.SELECT_SQL("SELECT MD5 FROM FILE_TRANSFER WHERE ID = " + SESSION_TRANS_ID + " ORDER BY CDATETIME ASC "); if (da.Rows.Count > 0) { string md5 = DBase.StringReturn(da.Rows[0]["MD5"]); if (md5 != Remote_File_MD5) { Remote_File_MD5 = md5; DHuy.DownloadFile("FILE_TRANSFER", "DATA", "ID", SESSION_TRANS_ID, DBase.XmlRemote_File); REFRESH2(); } } } catch (Exception ex) { } }