Skip to content

Commit fd14bf9

Browse files
committed
Automatic merge of T1.5.1-1190-g4100903d79 and 16 pull requests
- Pull request #959 at 2452cb0: Fix TrackViewer crash on big zoom value - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #799 at dfc715e: Consolidated wind simulation - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #885 at 8f473ce: feat: Add notifications to Menu - Pull request #891 at 9a1d6b2: Auto save - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #952 at 8347095: Investigation - Pulsing graphics - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #954 at 53e9cc6: Multiple Track Profiles & Superelevation Improvements - Pull request #962 at 46d0472: Fix pantographs on unpowered cars - Pull request #973 at c35be87: fix: Using singular target framework to allow for different platforms across different projects - Pull request #974 at 5faea6f: Bug fix for https://bugs.launchpad.net/or/+bug/2076034 Doors remain open in AI trains - Pull request #978 at 91f3ee8: fix: adds MilepostUnitsMiles to Manual - Pull request #900 at c27f32d: DMI updates - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder
18 parents 755ff2b + 4100903 + 2452cb0 + e90a2aa + dfc715e + d00beb9 + 8f473ce + 9a1d6b2 + 1f5ba4c + 8347095 + a519452 + 53e9cc6 + 46d0472 + c35be87 + 5faea6f + 91f3ee8 + c27f32d + f92de76 commit fd14bf9

File tree

28 files changed

+80
-100
lines changed

28 files changed

+80
-100
lines changed

Source/ContentChecker/ContentChecker.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<TargetFramework Condition="'$(BuildDotNet)' == 'true'">net6-windows</TargetFramework>
44
<TargetFramework Condition="'$(TargetFramework)' == ''">net472</TargetFramework>
55
<OutputType>Exe</OutputType>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
68
<IsPublishable>False</IsPublishable>
79
<AssemblyTitle>Open Rails Content Checker</AssemblyTitle>
810
<Description>Open Rails Transport Simulator</Description>

Source/ContentChecker/Loader.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
using System.Linq;
4444
using System.Text;
4545
using Microsoft.Xna.Framework.Graphics;
46+
using System.Windows.Forms;
4647

4748
namespace ContentChecker
4849
{
@@ -69,7 +70,7 @@ abstract class Loader
6970
/// <summary> The number of files that were actually loaded </summary>
7071
public int FilesLoaded { get; protected set; }
7172
/// <summary> The number of files that were not loaded but skipped </summary>
72-
public int FilesSkipped { get; protected set; }
73+
public int FilesSkipped {get; protected set;}
7374

7475
/// <summary> The action to take when an additonal file has been identified. This is intended to be set externally </summary>
7576
protected Action<string, Loader> AddAdditionalFileAction { get; set; }
@@ -157,13 +158,17 @@ protected static GraphicsDevice GetGraphicsDevice()
157158
{
158159
if (_graphicsDevice == null)
159160
{
161+
// We use a Windows.Forms Control instead of an xna GAME because it is much easier to use.
162+
var _c = new Control();
163+
160164
// Details probably do not matter too much
161165
PresentationParameters parameters = new PresentationParameters()
162166
{
163167
BackBufferWidth = 100,
164168
BackBufferHeight = 100,
165169
BackBufferFormat = SurfaceFormat.Color,
166170
//DepthStencilFormat = DepthFormat.Depth24,
171+
DeviceWindowHandle = _c.Handle,
167172
PresentationInterval = PresentInterval.Immediate,
168173
IsFullScreen = false,
169174
};

Source/ContentChecker/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ static bool OptionsContain(string[] args, IEnumerable<string> optionNames) {
7777
/// </summary>
7878
static void ShowHelp()
7979
{
80-
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
80+
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
81+
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
8182
Console.WriteLine();
8283
Console.WriteLine("Usage:");
83-
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
84+
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(version.FileName));
8485
Console.WriteLine();
8586
Console.WriteLine("Arguments:");
8687
Console.WriteLine(" <FILE> Data files to check; may contain wildcards");

Source/Contrib/DataCollector/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using ORTS.Common;
2020
using System;
2121
using System.Collections.Generic;
22+
using System.Diagnostics;
2223
using System.IO;
2324
using System.Linq;
2425

@@ -38,10 +39,11 @@ static void Main(string[] args)
3839

3940
static void ShowHelp()
4041
{
41-
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
42+
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
43+
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
4244
Console.WriteLine();
4345
Console.WriteLine("Usage:");
44-
Console.WriteLine(" {0} [options] [<PATH> [...]]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
46+
Console.WriteLine(" {0} [options] [<PATH> [...]]", Path.GetFileNameWithoutExtension(version.FileName));
4547
Console.WriteLine();
4648
Console.WriteLine("Arguments:");
4749
Console.WriteLine(" <PATH> Directories to scan for specific options");

Source/Contrib/DataConverter/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
using System;
1919
using System.Collections.Generic;
20+
using System.Diagnostics;
2021
using System.IO;
2122
using System.Linq;
2223
using System.Runtime.Serialization;
@@ -86,10 +87,11 @@ static void Main(string[] args)
8687

8788
static void ShowHelp(List<IDataConverter> converters)
8889
{
89-
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
90+
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
91+
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
9092
Console.WriteLine();
9193
Console.WriteLine("Usage:");
92-
Console.WriteLine(" {0} /input <INPUT> [/output] [<OUTPUT> [...]]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
94+
Console.WriteLine(" {0} /input <INPUT> [/output] [<OUTPUT> [...]]", Path.GetFileNameWithoutExtension(version.FileName));
9395
Console.WriteLine();
9496
Console.WriteLine("Arguments:");
9597
Console.WriteLine(" <INPUT> Specifies the file to read");

Source/Contrib/DataValidator/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ static void Main(string[] args)
3939

4040
static void ShowHelp()
4141
{
42-
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
42+
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
43+
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
4344
Console.WriteLine();
4445
Console.WriteLine("Usage:");
45-
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
46+
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(version.FileName));
4647
Console.WriteLine();
4748
Console.WriteLine("Arguments:");
4849
Console.WriteLine(" <FILE> Data files to validate; may contain wildcards");

Source/Contrib/SimulatorTester/Program.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
using Orts.Simulation;
2222
using ORTS.Common;
2323
using System.IO;
24+
using System.Windows.Forms;
2425
using Orts.Common;
26+
using System.Diagnostics;
2527

2628
namespace SimulatorTester
2729
{
@@ -35,22 +37,23 @@ static void Main(string[] args)
3537

3638
if (files.Count != 1 || options.Contains("help", StringComparer.InvariantCultureIgnoreCase))
3739
{
38-
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
40+
var version = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);
41+
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
3942
Console.WriteLine();
4043
Console.WriteLine("Usage:");
41-
Console.WriteLine(" {0} [options] <SAVE_FILE>", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
44+
Console.WriteLine(" {0} [options] <SAVE_FILE>", Path.GetFileNameWithoutExtension(Application.ExecutablePath));
4245
Console.WriteLine();
4346
Console.WriteLine("Arguments:");
44-
Console.WriteLine(" <SAVE_FILE> {0} save file to use", ApplicationInfo.ProductName);
47+
Console.WriteLine(" <SAVE_FILE> {0} save file to use", Application.ProductName);
4548
Console.WriteLine();
4649
Console.WriteLine("Options:");
4750
Console.WriteLine(" /quiet Do not show summary of simulation (only exit code is set)");
48-
Console.WriteLine(" /verbose Show version and settings (similar to a {0} log)", ApplicationInfo.ProductName);
51+
Console.WriteLine(" /verbose Show version and settings (similar to a {0} log)", Application.ProductName);
4952
Console.WriteLine(" /fps <FPS> Set the simulation frame-rate [default: 10]");
5053
Console.WriteLine(" /help Show help and usage information");
51-
Console.WriteLine(" ...and any standard {0} option", ApplicationInfo.ProductName);
54+
Console.WriteLine(" ...and any standard {0} option", Application.ProductName);
5255
Console.WriteLine();
53-
Console.WriteLine("The {0} takes a save file and:", ApplicationInfo.ApplicationName);
56+
Console.WriteLine("The {0} takes a save file and:", version.FileDescription);
5457
Console.WriteLine(" - Loads the same activity as contained in the save file");
5558
Console.WriteLine(" - Runs the simulation at the specified FPS for the same duration as the save file");
5659
Console.WriteLine(" - Compares the final position with that contained in the save file");
@@ -62,15 +65,15 @@ static void Main(string[] args)
6265

6366
if (settings.Verbose)
6467
{
65-
Console.WriteLine("This is a log file for {0}. Please include this file in bug reports.", ApplicationInfo.ProductName);
68+
Console.WriteLine("This is a log file for {0}. Please include this file in bug reports.", Application.ProductName);
6669
LogSeparator();
6770

6871
SystemInfo.WriteSystemDetails(Console.Out);
6972
LogSeparator();
7073

7174
Console.WriteLine("Version = {0}", VersionInfo.Version.Length > 0 ? VersionInfo.Version : "<none>");
7275
Console.WriteLine("Build = {0}", VersionInfo.Build);
73-
Console.WriteLine("Executable = {0}", Path.GetFileName(ApplicationInfo.ProcessFile));
76+
Console.WriteLine("Executable = {0}", Path.GetFileName(Application.ExecutablePath));
7477
foreach (var arg in args)
7578
Console.WriteLine("Argument = {0}", arg);
7679
LogSeparator();

Source/Contrib/SimulatorTester/SimulatorTester.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<RootNamespace>Orts.SimulatorTester</RootNamespace>
77
<AssemblyName>Contrib.SimulatorTester</AssemblyName>
88
<ApplicationIcon>..\..\ORTS.ico</ApplicationIcon>
9+
<UseWindowsForms>true</UseWindowsForms>
10+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
11+
<OutputPath>..\..\..\Program\</OutputPath>
912
<IsPublishable>False</IsPublishable>
1013
<AssemblyTitle>Open Rails Simulator Tester (Contributed)</AssemblyTitle>
1114
<Description>Open Rails Transport Simulator</Description>

Source/Menu/MainForm.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal string RunActivityProgram
7878
{
7979
get
8080
{
81-
return System.IO.Path.Combine(ApplicationInfo.ProcessDirectory, "RunActivity.exe");
81+
return System.IO.Path.Combine(Application.StartupPath, "RunActivity.exe");
8282
}
8383
}
8484

@@ -128,7 +128,7 @@ public MainForm()
128128
panelModeTimetable.Location = panelModeActivity.Location;
129129
ShowDetails();
130130
UpdateEnabled();
131-
UpdateManager = new UpdateManager(ApplicationInfo.ProcessDirectory, Application.ProductName, VersionInfo.VersionOrBuild);
131+
UpdateManager = new UpdateManager(System.IO.Path.GetDirectoryName(Application.ExecutablePath), Application.ProductName, VersionInfo.VersionOrBuild);
132132
ElevationIcon = new Icon(SystemIcons.Shield, SystemInformation.SmallIconSize).ToBitmap();
133133
}
134134

@@ -186,7 +186,7 @@ void MainForm_Shown(object sender, EventArgs e)
186186
"Updater.exe",
187187
};
188188
var tools = new List<ToolStripItem>();
189-
foreach (var executable in Directory.GetFiles(ApplicationInfo.ProcessDirectory, "*.exe"))
189+
foreach (var executable in Directory.GetFiles(System.IO.Path.GetDirectoryName(Application.ExecutablePath), "*.exe"))
190190
{
191191
// Don't show any of the core parts of the application.
192192
if (coreExecutables.Contains(System.IO.Path.GetFileName(executable)))
@@ -348,7 +348,7 @@ void LoadLanguage()
348348

349349
void RestartMenu()
350350
{
351-
Process.Start(ApplicationInfo.ProcessFile);
351+
Process.Start(Application.ExecutablePath);
352352
Close();
353353
}
354354
#endregion

Source/Menu/Options.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
using GNU.Gettext;
2828
using GNU.Gettext.WinForms;
2929
using MSTS;
30-
using ORTS.Common;
3130
using ORTS.Common.Input;
3231
using ORTS.Settings;
3332
using ORTS.Updater;
@@ -89,7 +88,7 @@ public OptionsForm(UserSettings settings, UpdateManager updateManager, bool init
8988
// Collect all the available language codes by searching for
9089
// localisation files, but always include English (base language).
9190
var languageCodes = new List<string> { "en" };
92-
foreach (var path in Directory.GetDirectories(ApplicationInfo.ProcessDirectory))
91+
foreach (var path in Directory.GetDirectories(Path.GetDirectoryName(Application.ExecutablePath)))
9392
if (Directory.GetFiles(path, "*.Messages.resources.dll").Length > 0)
9493
languageCodes.Add(Path.GetFileName(path));
9594

@@ -749,11 +748,11 @@ private void textBoxContentName_TextChanged(object sender, EventArgs e)
749748
var current = bindingSourceContent.Current as ContentFolder;
750749
if (current != null && current.Name != textBoxContentName.Text)
751750
{
752-
if (current.Path.ToLower().Contains(ApplicationInfo.ProcessDirectory.ToLower()))
751+
if (current.Path.ToLower().Contains(Application.StartupPath.ToLower()))
753752
{
754753
// Block added because a succesful Update operation will empty the Open Rails folder and lose any content stored within it.
755754
MessageBox.Show(catalog.GetString
756-
($"Cannot use content from any folder which lies inside the Open Rails folder {ApplicationInfo.ProcessDirectory}\n\n")
755+
($"Cannot use content from any folder which lies inside the Open Rails folder {Application.StartupPath}\n\n")
757756
, "Invalid content location"
758757
, MessageBoxButtons.OK
759758
, MessageBoxIcon.Error);

0 commit comments

Comments
 (0)