Fixed and closed #542: log appending now correct when flushing old entries.
This commit is contained in:
parent
5f11f2e4ed
commit
4a91270ff1
2 changed files with 8 additions and 6 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
|||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("3.0.2.539")]
|
||||
[assembly: AssemblyFileVersion("3.0.2.539")]
|
||||
[assembly: AssemblyVersion("3.0.2.540")]
|
||||
[assembly: AssemblyFileVersion("3.0.2.540")]
|
||||
|
|
|
@ -489,8 +489,9 @@ namespace ScrewTurn.Wiki {
|
|||
/// <param name="size">The size to shrink the log to (in bytes).</param>
|
||||
private void CutLog(int size) {
|
||||
lock(this) {
|
||||
// Contains the log messages from the newest to the oldest
|
||||
// Contains the log messages from oldest to newest, and reverse the list
|
||||
List<LogEntry> entries = new List<LogEntry>(GetLogEntries());
|
||||
entries.Reverse();
|
||||
|
||||
FileInfo fi = new FileInfo(GetFullPath(LogFile));
|
||||
int difference = (int)(fi.Length - size);
|
||||
|
@ -503,9 +504,7 @@ namespace ScrewTurn.Wiki {
|
|||
toStore.Add(entries[i]);
|
||||
}
|
||||
|
||||
// Reverse the temp list because entries contains the log messages
|
||||
// starting from the newest to the oldest
|
||||
toStore.Reverse();
|
||||
toStore.Sort((a, b) => a.DateTime.CompareTo(b.DateTime));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// Type | DateTime | Message | User
|
||||
|
@ -556,6 +555,9 @@ namespace ScrewTurn.Wiki {
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
result.Sort((a, b) => a.DateTime.CompareTo(b.DateTime));
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue