Skip to content

Commit

Permalink
add JournalPath to appsettings.config
Browse files Browse the repository at this point in the history
  • Loading branch information
mhwlng committed Mar 19, 2022
1 parent 3b4cb25 commit 463a543
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Elite/History.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Drawing;
using System.Globalization;
using System.IO;
Expand Down Expand Up @@ -84,6 +86,11 @@ public static extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)
IntPtr hToken, out IntPtr ppszPath);
}

private static string GetExePath()
{
var strExeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
return Path.GetDirectoryName(strExeFilePath);
}

/// <summary>
/// The standard Directory of the Player Journal files (C:\Users\%username%\Saved Games\Frontier Developments\Elite Dangerous).
Expand All @@ -92,6 +99,18 @@ private static DirectoryInfo StandardDirectory
{
get
{
var exePath = GetExePath();

if (File.Exists(Path.Combine(exePath, "appSettings.config")) &&
ConfigurationManager.GetSection("appSettings") is NameValueCollection appSection)
{
var journalPath = appSection["JournalPath"];
if (!string.IsNullOrEmpty(journalPath))
{
return new DirectoryInfo(journalPath);
}
}

//#if DEBUG
//return new DirectoryInfo(@"C:\Users\Marcel\Desktop\Elite Dangerous");
//#endif
Expand Down
3 changes: 2 additions & 1 deletion Elite/appsettings.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />
<add key="clickSound" value ="beep-3.wav" />
<add key="clickSound" value="beep-3.wav" />
<add key="JournalPath" value="" />
</appSettings>

0 comments on commit 463a543

Please sign in to comment.