|
|
@@ -31,6 +31,7 @@ namespace OHVDriveLogger
|
|
|
string UploadIP = string.Empty;
|
|
|
string PLCAddress = string.Empty;
|
|
|
int PLCPort = 0;
|
|
|
+ string LOG_DIR = string.Empty;
|
|
|
|
|
|
public FormMain()
|
|
|
{
|
|
|
@@ -39,22 +40,27 @@ namespace OHVDriveLogger
|
|
|
this.Load += FormMain_Load;
|
|
|
this.FormClosing += FormMain_FormClosing;
|
|
|
|
|
|
- MidnightNotifier.DayChanged += MidnightNotifier_DayChanged;
|
|
|
+ //MidnightNotifier.DayChanged += MidnightNotifier_DayChanged;
|
|
|
+ //FixTimeNotifier.HourChanged += FixTimeNotifier_HourChanged;
|
|
|
|
|
|
this.vehicleID = ConfigurationManager.AppSettings["VehicleID"];
|
|
|
this.UploadIP = ConfigurationManager.AppSettings["FTPUploadIP"];
|
|
|
this.PLCAddress = ConfigurationManager.AppSettings["PLC_IP"];
|
|
|
this.PLCPort = Convert.ToInt16( ConfigurationManager.AppSettings["PLC_PORT"] );
|
|
|
+ this.LOG_DIR = ConfigurationManager.AppSettings["LOG_DIR"];
|
|
|
|
|
|
FTPLogger.Instance.UploadIP = this.UploadIP;
|
|
|
FTPLogger.Instance.PLCAddress = this.PLCAddress;
|
|
|
}
|
|
|
|
|
|
+ private void FixTimeNotifier_HourChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ logger.I("FixTime Notifier");
|
|
|
+ Task.Run(() => { DeleteNoBackupFiles(this.LOG_DIR, 2); });
|
|
|
+ }
|
|
|
+
|
|
|
private void MidnightNotifier_DayChanged( object sender, EventArgs e )
|
|
|
{
|
|
|
- logger.I( "자정 Event Occur" );
|
|
|
- Task.Run( () => { DeleteNoBackupFiles( @"c:\LOG\OHV\DriveLogger\", 2 ); } );
|
|
|
- Task.Run( () => { DeleteNoBackupFiles( @"c:\LOG\OHV\Vehicle\", 2 ); } );
|
|
|
}
|
|
|
|
|
|
private void FormMain_FormClosing( object sender, FormClosingEventArgs e )
|
|
|
@@ -194,16 +200,12 @@ namespace OHVDriveLogger
|
|
|
buffered.Flush();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
this.plc.WriteBit( "DRIVE_LOGGING_ONOFF", false );
|
|
|
|
|
|
- //LockUtils.Wait( 200 );
|
|
|
- //FTPLogger.Instance.FTPDownload();
|
|
|
- LockUtils.Wait( 500 );
|
|
|
- FTPLogger.Instance.FTPUpload();
|
|
|
+ LockUtils.Wait(200);
|
|
|
+ FTPLogger.Instance.FTPDownload();
|
|
|
+ LockUtils.Wait( 100 );
|
|
|
+ FTPLogger.Instance.FTPUpload($"\\LOG\\{this.vehicleID}");
|
|
|
LockUtils.Wait( 100 );
|
|
|
}
|
|
|
|
|
|
@@ -240,11 +242,11 @@ namespace OHVDriveLogger
|
|
|
if ( fi.LastWriteTime > dt )
|
|
|
continue;
|
|
|
|
|
|
- FileUtils.DeleteFileIfExist( path );
|
|
|
+ FileUtils.DeleteFileIfExist( path );
|
|
|
delCount++;
|
|
|
logger.D( $"Deleted File - Name : [ {fi.Name} ]" );
|
|
|
|
|
|
- if ( delCount > 2 )
|
|
|
+ if ( delCount > 100 ) //한번에 지우는 파일 갯수.
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -265,10 +267,17 @@ namespace OHVDriveLogger
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
- catch
|
|
|
+ catch(Exception ex)
|
|
|
{
|
|
|
-
|
|
|
+ logger.E(ex);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void label55_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ //FTPLogger.Instance.FTPDownload();
|
|
|
+ //LockUtils.Wait(100);
|
|
|
+ //FTPLogger.Instance.FTPUpload($"\\LOG\\{this.vehicleID}");
|
|
|
+ }
|
|
|
}
|
|
|
}
|