Skip to content

Commit

Permalink
add some logic for the loggin
Browse files Browse the repository at this point in the history
  • Loading branch information
Schecher1 committed Mar 17, 2023
1 parent 94cc1e0 commit 908e0f2
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Core/BackUpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ public void CheckBackUpCount()
//if its zero or negativ => no files to delete
int hasToDeleteCounter = files.Length - EnvironmentsVariable.MaxCountBackUp;

LoggerSystem.Log(LogStateEnum.Info, LogPrefixEnum.BackUp_System, "CheckBackUpCount has been found " + hasToDeleteCounter + " files to delete.");

if (hasToDeleteCounter > 0)
//delete the oldest files
for (int i = 0; i < hasToDeleteCounter; i++)
try
{
File.Delete(files[i]);
LoggerSystem.Log(LogStateEnum.Info, LogPrefixEnum.BackUp_System, "CheckBackUpCount has been deleted the file: (autobackup overflow)" + files[i]);
} catch { }
if (!(hasToDeleteCounter > 0))
return;


LoggerSystem.Log(LogStateEnum.Info, LogPrefixEnum.BackUp_System, "CheckBackUpCount has been found " + hasToDeleteCounter + " files to delete.");
//delete the oldest files
for (int i = 0; i < hasToDeleteCounter; i++)
try
{
File.Delete(files[i]);
LoggerSystem.Log(LogStateEnum.Info, LogPrefixEnum.BackUp_System, "CheckBackUpCount has been deleted the file: (autobackup overflow)" + files[i]);
}
catch { }
}
catch (Exception ex)
{
Expand Down

0 comments on commit 908e0f2

Please sign in to comment.