private void OnReceiveFileSync(EventBroker.EventID id, EventBroker.EventParam param) { if (param == null) { return; } if (param.ParamString != null) { if (param.ParamInt == 0) { notiftyBalloonTip(param.ParamString + " Error", 1000, "File Sync"); } else if (param.ParamInt == 1) { notiftyBalloonTip(param.ParamString + " OK", 2000, "File Sync"); } else if (param.ParamInt == 2) { notiftyBalloonTip(param.ParamString, 1000, "Service"); } else { notiftyBalloonTip(param.ParamString, 1000, "Renaissance Cloud"); } } }
private void OnTimer(EventBroker.EventID id, EventBroker.EventParam param) { if (param == null) { return; } FileTransfer ft = param.ParamObj as FileTransfer; ft.FileSync(); }
private void OnStartProgram(EventBroker.EventID id, EventBroker.EventParam param) { SystemLog.Output(SystemLog.MSG_TYPE.Nor, "Schedule Process", "System Start"); foreach (var fte in m_fileTransfer) { FileTransfer ft = fte.Value.ParamObj as FileTransfer; FileSchedule.ScheduleProperty sp = ft.Property; if (sp.PCTurnOn == true) { ft.FileSync(); } } }
private void OnCheckDate(EventBroker.EventID id, EventBroker.EventParam param) { if (m_currentDate.Day != DateTime.Now.Day) { m_currentDate = DateTime.Now; SystemLog.Output(SystemLog.MSG_TYPE.Nor, "Schedule Process", "System Date Change"); foreach (var fte in m_fileTransfer) { FileTransfer ft = fte.Value.ParamObj as FileTransfer; FileSchedule.ScheduleProperty sp = ft.Property; if (sp.PCDateChanges == true) { ft.FileSync(); } } } }
private void OnReceiveLog(EventBroker.EventID id, EventBroker.EventParam param) { if (param == null) { return; } SystemLog.MSG_TYPE type = (SystemLog.MSG_TYPE)param.ParamInt; if (type == SystemLog.MSG_TYPE.Err) { Output(param.ParamString, Brushes.Yellow); } else if (type == SystemLog.MSG_TYPE.War) { Output(param.ParamString, Brushes.YellowGreen); } else { Output(param.ParamString, Brushes.LightGray); } }
private void OnReceiveUpdateMe(EventBroker.EventID id, EventBroker.EventParam param) { if (param == null || m_disableProgramUpdate) { return; } try { PropertiesSystem prop = PropertiesSetting.DefaultSetting.Property; if (prop == null) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "RCloud Auto update", "ProperiesSystem null"); return; } if (prop.UpdateEnable) { IFileService server = null; try { if (prop.UpdateDrvieType == DriveType.FTP) { server = new ServiceFtp(prop.UpdateFtpUser, prop.UpdateFtpPw, 5000, prop.UpdateFtpUri); } else { server = new ServiceDisk(prop.UpdateDiskUri); } } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "RCloud Auto update", "Connection Server fail, " + ex.Message); return; } List <FileInfo> info = null; try { info = server.GetFileList(null, "zip"); if (info == null) { return; } } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "RCloud Auto update", "Get File List fail, " + ex.Message); return; } try { foreach (FileInfo fo in info) { string str = fo.Name.ToUpper(); if (fo.Name == null) { continue; } if (str.IndexOf("RCLOUD ") == 0) { string[] strArray = str.Split(' '); if (strArray.Length == 2) { string[] verArray = strArray[1].Split('.'); if (verArray.Length == 3) { try { int major = Convert.ToInt32(verArray[0]); int minor = Convert.ToInt32(verArray[1]); int build = Convert.ToInt32(verArray[2]); Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (major != ver.Major || minor != ver.Minor || build != ver.Build) { string currentPath = AppDomain.CurrentDomain.BaseDirectory; SystemLog.Output(SystemLog.MSG_TYPE.Nor, "RCloud Auto update", "Update Start"); int indexRemove = currentPath.LastIndexOf(@"\"); if (indexRemove > 1 && (indexRemove + 1) >= currentPath.Length) { currentPath = currentPath.Substring(0, indexRemove); } string tempPath = currentPath + "\\UpdateTemp"; if (UpdateMeDownload(server, fo, tempPath) == true) { UpdateMeFileChange(currentPath, tempPath); } } } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "RCloud Auto update", "file update check fail, " + ex.Message); } } break; } } } }catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "RCloud Auto update", "iterator, " + ex.Message); } } }catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "RCloud Auto update", "Error, " + ex.Message); } }