-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge branch 'develop' into release/6.6"
- Loading branch information
1 parent
1b23439
commit 68339b5
Showing
90 changed files
with
1,186 additions
and
596 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AgIO | ||
{ | ||
public static class Log | ||
{ | ||
public static StringBuilder sbEvent = new StringBuilder(); | ||
|
||
public static void EventWriter(string message) | ||
{ | ||
sbEvent.Append(DateTime.Now.ToString("T")); | ||
sbEvent.Append("-> "); | ||
sbEvent.Append(message); | ||
sbEvent.Append("\r"); | ||
} | ||
|
||
public static void CheckLogSize(string logFile, int sizeLimit) | ||
{ | ||
//system event log file | ||
FileInfo txtfile = new FileInfo(logFile); | ||
if (txtfile.Exists) | ||
{ | ||
if (txtfile.Length > (sizeLimit)) // ## NOTE: 0.5MB max file size | ||
{ | ||
StringBuilder sbF = new StringBuilder(); | ||
long bytes = txtfile.Length - sizeLimit; | ||
bytes = (sizeLimit * 2) / 10 + bytes; | ||
Log.EventWriter("Log File Reduced by: " + bytes.ToString()); | ||
|
||
//create some extra space | ||
int bytesSoFar = 0; | ||
|
||
using (StreamReader reader = new StreamReader(logFile)) | ||
{ | ||
try | ||
{ | ||
//Date time line | ||
while (!reader.EndOfStream) | ||
{ | ||
bytesSoFar += reader.ReadLine().Length; | ||
if (bytesSoFar > bytes) | ||
break; | ||
} | ||
|
||
while (!reader.EndOfStream) | ||
{ | ||
sbF.AppendLine(reader.ReadLine()); | ||
} | ||
} | ||
catch { } | ||
} | ||
|
||
using (StreamWriter writer = new StreamWriter(logFile)) | ||
{ | ||
writer.WriteLine(sbF); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
using System; | ||
using System.IO; | ||
using System.Windows.Forms; | ||
using AgLibrary.Logging; | ||
|
||
namespace AgIO | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
using System; | ||
using System.IO.Ports; | ||
using System.Windows.Forms; | ||
using AgLibrary.Logging; | ||
|
||
namespace AgIO | ||
{ | ||
|
Oops, something went wrong.