Skip to content

Commit d5101a7

Browse files
committed
Automatic merge of T1.5.1-797-gabb8eb9a4 and 14 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at a055bca: Blueprint/train car operations UI window - Pull request #885 at 8f94333: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 0a9d939: feat: Improved system information collection - Pull request #899 at 5e6f22a: Duplex steam engines - Booster Engine addition - Pull request #903 at f1c7eb8: Downloading route content (Github, zip) - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #908 at 4b4afe3: feat: supports switching adhesion precisions - Pull request #909 at c3a572a: Correct Control Car crash bug
16 parents 753acc7 + abb8eb9 + 3539862 + d00beb9 + f92de76 + a055bca + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 0a9d939 + 5e6f22a + f1c7eb8 + 9b0b04f + 4b4afe3 + c3a572a commit d5101a7

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

Source/Menu/DownloadContentForm.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,6 @@ private void DownloadContentButton_Click(object sender, EventArgs e)
250250

251251
Settings.Content.InstallPath = installPath;
252252

253-
// set json route filename
254-
255-
Settings.Content.RouteJsonName = Path.Combine(installPath, "ORRoute.json");
256-
257253
// the download
258254

259255
Cursor.Current = Cursors.WaitCursor;

Source/ORTS.Settings/ContentSettings.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ public class ContentSettings : SettingsBase
3030
[Default("C:\\OpenRails")]
3131
public string InstallPath { get; set; }
3232

33-
[Default("")]
34-
public string RouteJsonName { get; set; }
35-
3633
#endregion
3734

3835
public ContentSettings(IEnumerable<string> options)

Source/ORTS.Settings/RouteSettings.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
using Newtonsoft.Json.Linq;
2525
using LibGit2Sharp;
2626
using ORTS.Common;
27+
using System.Windows.Forms;
2728

2829
namespace ORTS.Settings
2930
{
3031
public class RouteSettings
3132
{
33+
34+
3235
public enum DownloadType
3336
{
3437
github,
@@ -123,20 +126,32 @@ public void Load()
123126
// left empty
124127
}
125128

129+
private string RouteJsonName;
130+
126131
public void LoadContentAndInstalled()
127132
{
128-
if (!string.IsNullOrWhiteSpace(Content.RouteJsonName))
133+
// set json route filename
134+
135+
string userDataSettingsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName, "Settings");
136+
if (!Directory.Exists(userDataSettingsFolder))
137+
{
138+
Directory.CreateDirectory(userDataSettingsFolder);
139+
}
140+
141+
RouteJsonName = Path.Combine(userDataSettingsFolder, "ORRoute.json");
142+
143+
if (!string.IsNullOrWhiteSpace(RouteJsonName))
129144
{
130-
if (File.Exists(Content.RouteJsonName))
145+
if (File.Exists(RouteJsonName))
131146
{
132147
try
133148
{
134-
string json = File.ReadAllText(Content.RouteJsonName);
149+
string json = File.ReadAllText(RouteJsonName);
135150
Routes = JsonConvert.DeserializeObject<IDictionary<string, Route>>(json);
136151
}
137152
catch (Exception error)
138153
{
139-
throw new Exception("Error during reading " + Content.RouteJsonName + ": " + error.Message, error);
154+
throw new Exception("Error during reading " + RouteJsonName + ": " + error.Message, error);
140155
}
141156
}
142157
}
@@ -162,7 +177,7 @@ public void LoadContentAndInstalled()
162177
}
163178
catch (Exception error)
164179
{
165-
throw new Exception("Error during retrieving routes.json from \"" + githubUrl + "\":" + error.Message, error);
180+
throw new Exception("Error during retrieving routes.json from \"" + githubUrl + "\": " + error.Message, error);
166181
}
167182
}
168183

@@ -281,7 +296,7 @@ public void Save()
281296
}
282297
}
283298
string json = JsonConvert.SerializeObject(routes, Formatting.Indented);
284-
File.WriteAllText(Content.RouteJsonName, json);
299+
File.WriteAllText(RouteJsonName, json);
285300
}
286301
}
287302
}

0 commit comments

Comments
 (0)