Skip to content

Commit 0e5b0ec

Browse files
committed
Automatic merge of T1.5.1-925-g1c557094e and 16 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 3ca0eb1: Blueprint/train car operations UI window - Pull request #885 at fb6b812: 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 #903 at 7af1f91: Downloading route content (Github, zip) - Pull request #912 at f7b85e4: New Triple Valve Features Vol. 2 - Pull request #919 at 26cc6a8: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #923 at cc1b5b6: Add curve squeal to route - Pull request #924 at 6c2c3cd: Default Asset Improvements - Pull request #925 at e3b1688: Fix brakeshoe force bug - Pull request #927 at 7bce293: AI Train Power Supply/Lights Fix - Pull request #929 at a406a69: Add support for common circuit breaker variants
18 parents 8943de8 + 1c55709 + 3539862 + d00beb9 + f92de76 + 3ca0eb1 + fb6b812 + 6c0785b + 1f5ba4c + 5866028 + 7af1f91 + f7b85e4 + 26cc6a8 + cc1b5b6 + 6c2c3cd + e3b1688 + 7bce293 + a406a69 commit 0e5b0ec

File tree

3 files changed

+45
-33
lines changed

3 files changed

+45
-33
lines changed

Source/Menu/DownloadContentForm.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Menu/DownloadContentForm.cs

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ private void dataGridViewDownloadContent_SelectionChanged(object sender, EventAr
142142
}
143143
#endregion
144144

145+
#region InstallPathTextBox
146+
private void InstallPathTextBox_TextChanged(object sender, EventArgs e)
147+
{
148+
Settings.Content.InstallPath = InstallPathTextBox.Text;
149+
}
150+
#endregion
151+
145152
#region InstallPathBrowseButton
146153
private void InstallPathBrowseButton_Click(object sender, EventArgs e)
147154
{
@@ -175,6 +182,14 @@ private async void DownloadContentButton_Click(object sender, EventArgs e)
175182

176183
DisableButtons();
177184

185+
message = Catalog.GetStringFmt("Route to be installed in \"{0}\", are you sure?", installPathRoute);
186+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
187+
{
188+
// cancelled
189+
EnableButtons();
190+
return;
191+
}
192+
178193
// various checks for the directory where the route is installed
179194

180195
string pathDirectoryExe = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
@@ -191,39 +206,33 @@ private async void DownloadContentButton_Click(object sender, EventArgs e)
191206
return;
192207
}
193208

194-
DriveInfo dInfo = new DriveInfo(installPathRoute);
195-
196-
long size = route.InstallSize + route.DownloadSize;
197-
198-
if (size > (dInfo.AvailableFreeSpace * 1.1))
209+
try
199210
{
200-
message = Catalog.GetStringFmt("Not enough diskspace on drive {0} ({1}), available {2} kB, needed {3} kB, still continue?",
201-
dInfo.Name,
202-
dInfo.VolumeLabel,
203-
(dInfo.AvailableFreeSpace / 1024).ToString("N0"),
204-
(size / 1024).ToString("N0"));
211+
DriveInfo dInfo = new DriveInfo(installPathRoute);
205212

206-
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
207-
{
208-
// cancelled
209-
EnableButtons();
210-
return;
211-
}
212-
}
213+
long size = route.InstallSize + route.DownloadSize;
213214

214-
message = Catalog.GetStringFmt("Route to be installed in \"{0}\", are you sure?", installPathRoute);
215+
if (size > (dInfo.AvailableFreeSpace * 1.1))
216+
{
217+
message = Catalog.GetStringFmt("Not enough diskspace on drive {0} ({1}), available {2} kB, needed {3} kB, still continue?",
218+
dInfo.Name,
219+
dInfo.VolumeLabel,
220+
(dInfo.AvailableFreeSpace / 1024).ToString("N0"),
221+
(size / 1024).ToString("N0"));
215222

216-
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
217-
{
218-
// cancelled
219-
EnableButtons();
220-
return;
223+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
224+
{
225+
// cancelled
226+
EnableButtons();
227+
return;
228+
}
229+
}
221230
}
222-
223-
if (!Directory.Exists(installPath))
231+
catch (System.IO.DriveNotFoundException)
224232
{
225-
message = Catalog.GetStringFmt("Directory \"{0}\" does not exist", installPath);
233+
message = Catalog.GetStringFmt("Drive not available");
226234
MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Error);
235+
// cancelled
227236
EnableButtons();
228237
return;
229238
}
@@ -255,8 +264,6 @@ private async void DownloadContentButton_Click(object sender, EventArgs e)
255264
}
256265
}
257266

258-
Settings.Content.InstallPath = installPath;
259-
260267
// the download
261268

262269
dataGridViewDownloadContent.CurrentRow.Cells[1].Value = Catalog.GetString("Installing...");
@@ -922,7 +929,7 @@ private async void DeleteButton_Click(object sender, EventArgs e)
922929
DisableButtons();
923930

924931
message = Catalog.GetStringFmt("Directory \"{0}\" is to be deleted, are you really sure?", route.DirectoryInstalledIn);
925-
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
932+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
926933
{
927934
// cancelled
928935
EnableButtons();
@@ -935,7 +942,7 @@ private async void DeleteButton_Click(object sender, EventArgs e)
935942
{
936943
writeAndStartInfoFile();
937944
message = Catalog.GetStringFmt("Changed or added local files found in Directory \"{0}\", see Info at the bottom for more information. Do you want to continue?", route.DirectoryInstalledIn);
938-
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
945+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
939946
{
940947
// cancelled
941948
EnableButtons();
@@ -1006,7 +1013,7 @@ private void updateButton_Click(object sender, EventArgs e)
10061013
{
10071014
writeAndStartInfoFile();
10081015
message = Catalog.GetString("Remote updates found, see Info at the bottom for more information. Do you want to continue?");
1009-
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
1016+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
10101017
{
10111018
// cancelled
10121019
EnableButtons();
@@ -1015,7 +1022,7 @@ private void updateButton_Click(object sender, EventArgs e)
10151022
if (areThereChangedAddedFiles(route))
10161023
{
10171024
message = Catalog.GetString("Changed or added local files found, Update might fail, see Info at the bottom for more information. Do you want to continue?");
1018-
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
1025+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
10191026
{
10201027
// cancelled
10211028
EnableButtons();

Source/ORTS.Settings/ContentSettings.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ContentSettings : SettingsBase
2727
{
2828
#region User Settings
2929

30-
[Default("C:\\OpenRailsRoutes")]
30+
[Default("")]
3131
public string InstallPath { get; set; }
3232

3333
#endregion
@@ -36,6 +36,10 @@ public ContentSettings(IEnumerable<string> options)
3636
: base(SettingsStore.GetSettingStore(UserSettings.SettingsFilePath, UserSettings.RegistryKey, "Content"))
3737
{
3838
Load(options);
39+
if (string.IsNullOrEmpty(InstallPath))
40+
{
41+
InstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) , "Open Rails", "Content");
42+
}
3943
}
4044

4145
public override object GetDefaultValue(string name)

0 commit comments

Comments
 (0)