diff --git a/Observatory/JournalPoker.cs b/Observatory/JournalPoker.cs index 4b97c30..0928417 100644 --- a/Observatory/JournalPoker.cs +++ b/Observatory/JournalPoker.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using System.Linq; using System.IO; namespace Observatory @@ -29,13 +30,7 @@ await Task.Run(() => FileStream stream; FileInfo fileToPoke = null; - foreach (var file in directoryInfo.GetFiles("Journal.????????????.??.log")) - { - if (fileToPoke == null || string.Compare(file.Name, fileToPoke.Name) > 0) - { - fileToPoke = file; - } - } + fileToPoke = directoryInfo.GetFiles("Journal.*.??.log").OrderBy(f => f.LastWriteTime).Last(); stream = fileToPoke.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); stream.Close(); diff --git a/Observatory/LogMonitor.cs b/Observatory/LogMonitor.cs index c7dedf9..9b82b7c 100644 --- a/Observatory/LogMonitor.cs +++ b/Observatory/LogMonitor.cs @@ -57,7 +57,7 @@ public LogMonitor() Properties.Observatory.Default.JournalPath = LogDirectory; Properties.Observatory.Default.Save(); - logWatcher = new FileSystemWatcher(LogDirectory, "Journal.????????????.??.log") + logWatcher = new FileSystemWatcher(LogDirectory, "Journal.*.??.log") { NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.FileName }; @@ -101,7 +101,7 @@ public void ReadAll(ProgressBar progressBar) progressBar.Visible = true; SystemBody.Clear(); DirectoryInfo logDir = new DirectoryInfo(CheckLogPath()); - FileInfo[] allJournals = logDir.GetFiles("Journal.????????????.??.log"); + var allJournals = logDir.GetFiles("Journal.*.??.log").OrderBy(f => f.LastWriteTime); int progress = 0; try { @@ -151,7 +151,7 @@ public bool IsMonitoring() private string CheckLogPath() { LogDirectory = string.IsNullOrEmpty(LogDirectory) ? GetSavedGamesPath() + "\\Frontier Developments\\Elite Dangerous" : LogDirectory; - if (!Directory.Exists(LogDirectory) || new DirectoryInfo(LogDirectory).GetFiles("Journal.????????????.??.log").Count() == 0) + if (!Directory.Exists(LogDirectory) || new DirectoryInfo(LogDirectory).GetFiles("Journal.*.??.log").Count() == 0) { //var useCapi = MessageBox.Show("Journal Folder not found or empty, use Frontier Companion API?\r\n\r\nConsole players should choose 'Yes', PC users should choose 'No' unless you're very sure you need to pull of copy of your recent journals from Frontier's servers.", "Journal Files Not Found", MessageBoxButtons.YesNo); @@ -352,7 +352,7 @@ private void PopulatePastScans() { FileInfo fileToRead = null; - foreach (var file in new DirectoryInfo(LogDirectory).GetFiles("Journal.????????????.??.log")) + foreach (var file in new DirectoryInfo(LogDirectory).GetFiles("Journal.*.??.log").OrderBy(f => f.LastWriteTime)) { if (fileToRead == null || string.Compare(file.Name, fileToRead.Name) > 0) { diff --git a/Observatory/Properties/AssemblyInfo.cs b/Observatory/Properties/AssemblyInfo.cs index 1924e27..58f532e 100644 --- a/Observatory/Properties/AssemblyInfo.cs +++ b/Observatory/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.5.21.297")] -[assembly: AssemblyFileVersion("0.5.21.297")] +[assembly: AssemblyVersion("0.5.22.076")] +[assembly: AssemblyFileVersion("0.5.22.076")]