diff --git a/App.config b/App.config index 47481be..381b7f9 100644 --- a/App.config +++ b/App.config @@ -26,7 +26,7 @@ - + @@ -41,6 +41,9 @@ + + + \ No newline at end of file diff --git a/MainForm.cs b/MainForm.cs index 8b9c54b..dabcd83 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -40,7 +40,7 @@ public MainForm() CollectionIDBox.Enabled = consolecheck.Checked; StringBuilder path = new StringBuilder( label4.Text ); - path.Append( Properties.Settings.Default.FilePath ); + path.Append( Properties.Settings.Default.FileName ); label4.Text = path.ToString(); string[] listgamemodes = Directory.GetDirectories( Settings.FilePath + @"\garrysmod\gamemodes" ); @@ -115,12 +115,14 @@ private void GamemodeChanged( object sender, EventArgs e ) private void ChangePathClick( object sender, EventArgs e ) { - FolderBrowserDialog browse = new FolderBrowserDialog(); - browse.Description = "Select server file path. (The folder containing the srcds.exe file.)"; + OpenFileDialog browse = new OpenFileDialog(); + browse.Filter = "Server Executable (*.exe)|*.exe"; + browse.RestoreDirectory = true; if ( browse.ShowDialog() == DialogResult.OK ) { - Properties.Settings.Default.FilePath = browse.SelectedPath; - label4.Text = "Current server file path: " + Properties.Settings.Default.FilePath; + Properties.Settings.Default.FileName = browse.FileName; + Properties.Settings.Default.FilePath = Path.GetDirectoryName( browse.FileName ); + label4.Text = "Current server file path: " + Properties.Settings.Default.FileName; } } @@ -178,7 +180,7 @@ private void StartButtonClick( object sender, EventArgs e ) { UseShellExecute = true, WorkingDirectory = Properties.Settings.Default.FilePath, - FileName = Properties.Settings.Default.FilePath + @"\srcds.exe", + FileName = Properties.Settings.Default.FileName, Arguments = "+gamemode " + gameselect.Text.ToString() + ConsoleEnabled + LANEnabled + "+map " + mapselect.Text.ToString() + " +maxplayers " + maxplayers.Value + " +r_hunkalloclightmaps 0" + Password + SteamToken + CollectionID, }; diff --git a/Program.cs b/Program.cs index 9eafa36..bf4469a 100644 --- a/Program.cs +++ b/Program.cs @@ -11,18 +11,18 @@ static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - if ( string.IsNullOrWhiteSpace( Properties.Settings.Default.FilePath ) || !Directory.Exists( Properties.Settings.Default.FilePath ) ) + if ( string.IsNullOrWhiteSpace( Properties.Settings.Default.FileName ) || !Directory.Exists( Properties.Settings.Default.FileName ) ) { - DialogResult BrowseCheck = MessageBox.Show( "Please select the server directory.", "Server file path not found.", MessageBoxButtons.OK, MessageBoxIcon.Warning ); + DialogResult BrowseCheck = MessageBox.Show( "Please select the server file.", "Server file path not found.", MessageBoxButtons.OK, MessageBoxIcon.Warning ); if ( BrowseCheck == DialogResult.OK ) { - FolderBrowserDialog browse = new FolderBrowserDialog - { - Description = "Select server file path. (The folder containing the srcds.exe file.)" - }; + OpenFileDialog browse = new OpenFileDialog(); + browse.Filter = "Server Executable (*.exe)|*.exe"; + browse.RestoreDirectory = true; if ( browse.ShowDialog() == DialogResult.OK ) { - Properties.Settings.Default.FilePath = browse.SelectedPath; + Properties.Settings.Default.FileName = browse.FileName; + Properties.Settings.Default.FilePath = Path.GetDirectoryName( browse.FileName ); } } else return; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index c949cda..ad7bf69 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -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( "1.3.1" )] -[assembly: AssemblyFileVersion( "1.3.1" )] +[assembly: AssemblyVersion( "1.3.2" )] +[assembly: AssemblyFileVersion( "1.3.2" )] diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index b6da761..fb26b89 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace GMod_Server_Launcher_Console.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.1.0")] public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -86,12 +86,12 @@ public string Gamemode { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] - public string FilePath { + public string FileName { get { - return ((string)(this["FilePath"])); + return ((string)(this["FileName"])); } set { - this["FilePath"] = value; + this["FileName"] = value; } } @@ -142,5 +142,17 @@ public string CollectionID { this["CollectionID"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string FilePath { + get { + return ((string)(this["FilePath"])); + } + set { + this["FilePath"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index e3581c1..a4d24e1 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -17,7 +17,7 @@ - + @@ -32,5 +32,8 @@ + + + \ No newline at end of file