Skip to content

Commit

Permalink
Handle Odyssey Update 11 journal files
Browse files Browse the repository at this point in the history
  • Loading branch information
Xjph committed Mar 17, 2022
1 parent 2b29f9d commit cdfdc3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
9 changes: 2 additions & 7 deletions Observatory/JournalPoker.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Linq;
using System.IO;

namespace Observatory
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions Observatory/LogMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions Observatory/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit cdfdc3d

Please sign in to comment.