Exemplo n.º 1
0
        public ScheduleProperty Clone()
        {
            ScheduleProperty schedule = new ScheduleProperty();

            schedule.Name = this.Name;

            schedule.RepeateTime   = this.RepeateTime;
            schedule.PCTurnOn      = this.PCTurnOn;
            schedule.PCTurnOff     = this.PCTurnOff;
            schedule.PCDateChanges = this.PCDateChanges;

            schedule.RepeatTimeMinute = this.RepeatTimeMinute;
            schedule.DelayTimeMinute  = this.DelayTimeMinute;

            schedule.FromDiskType  = this.FromDiskType;
            schedule.FromFtpUri    = this.FromFtpUri;
            schedule.FromFtpUser   = this.FromFtpUser;
            schedule.FromFtpPw     = this.FromFtpPw;
            schedule.FromDrivePath = this.FromDrivePath;
            schedule.FromSyncType  = this.FromSyncType;

            schedule.ToDiskType  = this.ToDiskType;
            schedule.ToFtpUri    = this.ToFtpUri;
            schedule.ToFtpUser   = this.ToFtpUser;
            schedule.ToFtpPw     = this.ToFtpPw;
            schedule.ToDrivePath = this.ToDrivePath;
            return(schedule);
        }
Exemplo n.º 2
0
        public void ServiceStop()
        {
            SystemLog.Output(SystemLog.MSG_TYPE.Nor, "Schedule Process", "Service Stop");
            EventBroker.AsyncSend(EventBroker.EventID.etFileSync, new EventBroker.EventParam(this, 2, "Stop"));
            EventBroker.RemoveTimeEvent(EventBroker.EventID.etCheckDate, m_checkDateParam);
            foreach (var fte in m_fileTransfer)
            {
                try
                {
                    SystemLog.Output(SystemLog.MSG_TYPE.Nor, "Schedule Process", "Stop : {0}", fte.Key);
                    FileTransfer ft = fte.Value.ParamObj as FileTransfer;
                    FileSchedule.ScheduleProperty sp = ft.Property;

                    if (sp.PCTurnOn == true)
                    {
                        EventBroker.RemoveTimeEvent(EventBroker.EventID.etStartProgram, fte.Value);
                    }
                    if (sp.RepeateTime == true)
                    {
                        EventBroker.RemoveTimeEvent(EventBroker.EventID.etFileTimer, fte.Value);
                    }
                }
                catch (Exception ex)
                {
                    SystemLog.Output(SystemLog.MSG_TYPE.Err, "Schedule Process", "Service Start : " + ex.Message);
                }
            }
            m_fileTransfer.Clear();
            m_isRun = false;
        }
Exemplo n.º 3
0
        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();
                }
            }
        }
Exemplo n.º 4
0
        public void OnSystemShutDown()
        {
            SystemLog.Output(SystemLog.MSG_TYPE.Nor, "Schedule Process", "System ShutDown");
            foreach (var fte in m_fileTransfer)
            {
                FileTransfer ft = fte.Value.ParamObj as FileTransfer;
                FileSchedule.ScheduleProperty sp = ft.Property;

                if (sp.PCTurnOff == true)
                {
                    ft.FileSync();
                }
            }
        }
Exemplo n.º 5
0
        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();
                    }
                }
            }
        }
Exemplo n.º 6
0
        public FileTransfer(FileSchedule.ScheduleProperty property)
        {
            m_property = property;
            try
            {
                if (m_property.FromDiskType == DriveType.Disk)
                {
                    m_fromFileService = new ServiceDisk(m_property.FromDrivePath);
                }
                else
                {
                    m_fromFileService = new ServiceFtp(m_property.FromFtpUser, m_property.FromFtpPw, 5000, m_property.FromFtpUri);
                }

                if (m_property.ToDiskType == DriveType.Disk)
                {
                    m_toFileService = new ServiceDisk(m_property.ToDrivePath);
                }
                else
                {
                    m_toFileService = new ServiceFtp(m_property.ToFtpUser, m_property.ToFtpPw, 5000, m_property.ToFtpUri);
                }
            }
            catch (Exception ex)
            {
                if (m_property.Name != null && m_property.Name != string.Empty)
                {
                    SystemLog.Output(SystemLog.MSG_TYPE.Err, m_property.Name, "Create Object : " + ex.Message);
                }
                else
                {
                    SystemLog.Output(SystemLog.MSG_TYPE.Err, "File Sync", "Create Object : " + ex.Message);
                }
            }
            m_nowWorking = false;
        }