├── src ├── 44193.ico ├── FodyWeavers.xml ├── App.config ├── Constants │ ├── RocketDownloadURL.cs │ └── ServerPath.cs ├── packages.config ├── Properties │ └── AssemblyInfo.cs ├── GUI │ ├── FirstStart.cs │ ├── UpdateMenu.cs │ ├── AddServer.cs │ ├── Add Or Clone Server.Designer.cs │ ├── First Start.Designer.cs │ ├── UpdateMenu.Designer.cs │ ├── UpdateMenu.resx │ ├── Server Settings.resx │ ├── Add Or Clone Server.resx │ ├── Workshop Download.resx │ ├── Manager.resx │ ├── Plugin Download.resx │ ├── Plugin.cs │ ├── First Start.resx │ ├── Workshop.cs │ ├── Plugin Download.Designer.cs │ ├── Manager.cs │ ├── ConstConfig.cs │ ├── Workshop Download.Designer.cs │ └── Manager.Designer.cs ├── Configuration │ ├── LocalVersions.cs │ ├── Installation.cs │ └── GameConfiguration.cs ├── Updating │ └── Updater.cs ├── Loading │ ├── Servers.cs │ └── Entry.cs ├── SteamCMD Manager │ └── SteamCMD.cs ├── Server Instance │ └── Server.cs ├── File Control │ └── FileActions.cs ├── FodyWeavers.xsd └── Manager.csproj ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── Unturned Server Manager.sln ├── .gitattributes ├── .gitignore └── README.md /src/44193.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pustalorc/UnturnedServerManager/HEAD/src/44193.ico -------------------------------------------------------------------------------- /src/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Constants/RocketDownloadURL.cs: -------------------------------------------------------------------------------- 1 | namespace Pustalorc.Applications.USM.Constants 2 | { 3 | internal static class RocketDownloadUrl 4 | { 5 | public static string Value => 6 | "https://github.com/RocketMod/Rocket.Unturned/releases/download/4.9.3.0/Rocket.Unturned.zip"; 7 | } 8 | } -------------------------------------------------------------------------------- /src/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Constants/ServerPath.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.InteropServices; 3 | using Pustalorc.Applications.USM.Configuration; 4 | 5 | namespace Pustalorc.Applications.USM.Constants 6 | { 7 | internal static class ServerPath 8 | { 9 | public static string Value => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) 10 | ? Installation.Load().InstallationPath 11 | : Path.Combine(Installation.Load().InstallationPath, "Server"); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("Unturned Server Manager")] 5 | [assembly: AssemblyDescription("")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("Pustalorc")] 8 | [assembly: AssemblyProduct("Unturned Server Manager")] 9 | [assembly: AssemblyCopyright("Copyright © Pustalorc 2016-2019")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | [assembly: ComVisible(false)] 13 | [assembly: Guid("2d1dcd0a-9719-44f5-8f0e-2fd79d918fb5")] 14 | [assembly: AssemblyVersion("4.0.1.2")] 15 | [assembly: AssemblyFileVersion("4.0.1.2")] -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. Windows 10] 25 | - Version [e.g. 4.0.0.0] 26 | 27 | **Additional context** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /src/GUI/FirstStart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Pustalorc.Applications.USM.Configuration; 4 | 5 | namespace Pustalorc.Applications.USM.GUI 6 | { 7 | internal sealed partial class FirstStart : Form 8 | { 9 | public FirstStart() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | private void Browse_Click(object sender, EventArgs e) 15 | { 16 | var result = FolderBrowser.ShowDialog(); 17 | if (result == DialogResult.OK) 18 | SelectedPath.Text = FolderBrowser.SelectedPath; 19 | } 20 | 21 | private void Validate_Click(object sender, EventArgs e) 22 | { 23 | Close(); 24 | } 25 | 26 | private void SelectedPath_KeyPress(object sender, KeyPressEventArgs e) 27 | { 28 | if (e.KeyChar == (char) Keys.Enter) Close(); 29 | } 30 | 31 | private void FirstStart_FormClosing(object sender, FormClosingEventArgs e) 32 | { 33 | var inst = Installation.Load(); 34 | inst.InstallationPath = SelectedPath.Text; 35 | inst.SaveJson(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Unturned Server Manager.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.4 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manager", "src\Manager.csproj", "{2D1DCD0A-9719-44F5-8F0E-2FD79D918FB5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2D1DCD0A-9719-44F5-8F0E-2FD79D918FB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {2D1DCD0A-9719-44F5-8F0E-2FD79D918FB5}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {2D1DCD0A-9719-44F5-8F0E-2FD79D918FB5}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {2D1DCD0A-9719-44F5-8F0E-2FD79D918FB5}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {2BC860B2-5423-4237-ACB6-CFF65941F807} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/GUI/UpdateMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Pustalorc.Applications.USM.Configuration; 4 | using Pustalorc.Applications.USM.Updating; 5 | 6 | namespace Pustalorc.Applications.USM.GUI 7 | { 8 | public sealed partial class UpdateMenu : Form 9 | { 10 | public UpdateMenu() 11 | { 12 | InitializeComponent(); 13 | LoadVersions(); 14 | } 15 | 16 | // Custom Methods 17 | private void LoadVersions() 18 | { 19 | var installedVersions = LocalVersions.Load(); 20 | CUVer.Text = installedVersions.LastUnturnedUpdate.ToString(); 21 | } 22 | 23 | // Form Events 24 | private void UUnturned_Click(object sender, EventArgs e) 25 | { 26 | Hide(); 27 | 28 | Updater.UpdateUnturned(); 29 | LoadVersions(); 30 | 31 | Show(); 32 | } 33 | 34 | private void Validate_Click(object sender, EventArgs e) 35 | { 36 | Hide(); 37 | 38 | Updater.ValidateUnturned(); 39 | LoadVersions(); 40 | 41 | Show(); 42 | } 43 | 44 | private void URocket_Click(object sender, EventArgs e) 45 | { 46 | Hide(); 47 | 48 | Updater.UpdateRocket(); 49 | LoadVersions(); 50 | 51 | Show(); 52 | } 53 | 54 | private void UAll_Click(object sender, EventArgs e) 55 | { 56 | Hide(); 57 | 58 | Updater.UpdateAll(); 59 | LoadVersions(); 60 | 61 | Show(); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /src/Configuration/LocalVersions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | 5 | namespace Pustalorc.Applications.USM.Configuration 6 | { 7 | /// 8 | /// Configuration to save the version or time that the last update was done for either one. 9 | /// 10 | public sealed class LocalVersions 11 | { 12 | [JsonIgnore] private static string FilePath => @"config/Versions.json"; 13 | 14 | public DateTime LastUnturnedUpdate { get; set; } = DateTime.Now; 15 | 16 | public void SaveJson() 17 | { 18 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 19 | File.WriteAllText(file, ToJson()); 20 | } 21 | 22 | private string ToJson() 23 | { 24 | return JsonConvert.SerializeObject(this, Formatting.Indented); 25 | } 26 | 27 | private static void EnsureExists() 28 | { 29 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 30 | if (File.Exists(file)) return; 31 | 32 | var path = Path.GetDirectoryName(file); 33 | if (!Directory.Exists(path)) 34 | if (path != null) 35 | Directory.CreateDirectory(path); 36 | 37 | var config = new LocalVersions(); 38 | config.SaveJson(); 39 | } 40 | 41 | public static LocalVersions Load() 42 | { 43 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 44 | 45 | EnsureExists(); 46 | 47 | return JsonConvert.DeserializeObject(File.ReadAllText(file)); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/GUI/AddServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using System.Windows.Forms; 4 | using Pustalorc.Applications.USM.Loading; 5 | using Pustalorc.Applications.USM.Server_Instance; 6 | 7 | namespace Pustalorc.Applications.USM.GUI 8 | { 9 | internal sealed partial class AddServer : Form 10 | { 11 | private readonly string _clone; 12 | private bool _accepted; 13 | 14 | public AddServer(string cloneServer = null) 15 | { 16 | InitializeComponent(); 17 | 18 | _clone = cloneServer; 19 | } 20 | 21 | private void ServerName_KeyPress(object sender, KeyPressEventArgs e) 22 | { 23 | if (e.KeyChar != (char) Keys.Enter) return; 24 | 25 | _accepted = true; 26 | Close(); 27 | } 28 | 29 | private void OK_Click(object sender, EventArgs e) 30 | { 31 | _accepted = true; 32 | Close(); 33 | } 34 | 35 | private void Cancel_Click(object sender, EventArgs e) 36 | { 37 | Close(); 38 | } 39 | 40 | private void AddServer_FormClosing(object sender, FormClosingEventArgs e) 41 | { 42 | var illegalName = 43 | new Regex( 44 | "(^(PRN|AUX|NUL|CON|COM[1-9]|LPT[1-9]|(\\.+)$)(\\..*)?$)|(([\\x00-\\x1f\\\\?*:\";‌​|/<>])+)|([\\.]+)", 45 | RegexOptions.IgnoreCase); 46 | 47 | if (!_accepted || illegalName.IsMatch(ServerName.Text) || string.IsNullOrEmpty(ServerName.Text)) return; 48 | 49 | if (!Servers.RegisteredServers.Exists(k => k.Name == ServerName.Text)) 50 | Servers.RegisteredServers.Add(Server.Create(ServerName.Text, _clone)); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/Configuration/Installation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | 5 | namespace Pustalorc.Applications.USM.Configuration 6 | { 7 | /// 8 | /// Configuration for where to locate the server installation. 9 | /// 10 | public sealed class Installation 11 | { 12 | [JsonIgnore] private static string FilePath => @"config/Installation.json"; 13 | 14 | public string InstallationPath { get; set; } = AppContext.BaseDirectory; 15 | 16 | public void SaveJson() 17 | { 18 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 19 | File.WriteAllText(file, ToJson()); 20 | 21 | if (!Directory.Exists(InstallationPath)) 22 | Directory.CreateDirectory(InstallationPath); 23 | } 24 | 25 | private string ToJson() 26 | { 27 | return JsonConvert.SerializeObject(this, Formatting.Indented); 28 | } 29 | 30 | private static void EnsureExists() 31 | { 32 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 33 | if (File.Exists(file)) return; 34 | 35 | var path = Path.GetDirectoryName(file); 36 | if (!Directory.Exists(path)) 37 | if (path != null) 38 | Directory.CreateDirectory(path); 39 | 40 | var config = new Installation(); 41 | config.SaveJson(); 42 | } 43 | 44 | public static Installation Load() 45 | { 46 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 47 | 48 | EnsureExists(); 49 | 50 | return JsonConvert.DeserializeObject(File.ReadAllText(file)); 51 | } 52 | 53 | public static bool Exists() 54 | { 55 | var file = Path.Combine(AppContext.BaseDirectory, FilePath); 56 | return File.Exists(file); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/Updating/Updater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Windows.Forms; 4 | using Pustalorc.Applications.USM.Configuration; 5 | using Pustalorc.Applications.USM.Constants; 6 | using Pustalorc.Applications.USM.File_Control; 7 | using Pustalorc.Applications.USM.SteamCMD_Manager; 8 | 9 | namespace Pustalorc.Applications.USM.Updating 10 | { 11 | internal static class Updater 12 | { 13 | /// 14 | /// Installs the latest version of Unturned. 15 | /// 16 | public static void UpdateUnturned() 17 | { 18 | SteamCmd.RunCommand($"+force_install_dir \"{ServerPath.Value}\" +app_update 1110390 +exit"); 19 | 20 | var installedVersions = LocalVersions.Load(); 21 | installedVersions.LastUnturnedUpdate = DateTime.Now; 22 | installedVersions.SaveJson(); 23 | } 24 | 25 | /// 26 | /// Validates and Installs the latest version of Unturned. 27 | /// 28 | public static void ValidateUnturned() 29 | { 30 | SteamCmd.RunCommand( 31 | $"+force_install_dir \"{ServerPath.Value}\" +app_update 1110390 validate +exit"); 32 | 33 | var installedVersions = LocalVersions.Load(); 34 | installedVersions.LastUnturnedUpdate = DateTime.Now; 35 | installedVersions.SaveJson(); 36 | } 37 | 38 | /// 39 | /// Downloads and installs RocketMod. 40 | /// 41 | public static void UpdateRocket() 42 | { 43 | var tempZip = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); 44 | 45 | if (!FileActions.Download(RocketDownloadUrl.Value, tempZip)) 46 | { 47 | MessageBox.Show( 48 | "An error occured during download. Please verify that you can access github.", 49 | "Rocketmod download failed", MessageBoxButtons.OK, MessageBoxIcon.Error); 50 | return; 51 | } 52 | 53 | FileActions.ExtractZip(tempZip, ServerPath.Value); 54 | } 55 | 56 | /// 57 | /// Downloads and installs RocketMod + Unturned. 58 | /// 59 | public static void UpdateAll() 60 | { 61 | UpdateUnturned(); 62 | UpdateRocket(); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/Loading/Servers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Windows.Forms; 7 | using Pustalorc.Applications.USM.Constants; 8 | using Pustalorc.Applications.USM.File_Control; 9 | using Pustalorc.Applications.USM.Server_Instance; 10 | using Pustalorc.Applications.USM.Updating; 11 | 12 | namespace Pustalorc.Applications.USM.Loading 13 | { 14 | internal static class Servers 15 | { 16 | public static List RegisteredServers { get; set; } = new List(); 17 | 18 | public static void Load() 19 | { 20 | if (RegisteredServers.Count > 0) 21 | return; 22 | 23 | var unturnedExec = "Unturned.exe"; 24 | var linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); 25 | if (linux) 26 | Console.WriteLine( 27 | "You are running USM in linux, please verify that you have SteamCMD installed and that it can be executed from bash, otherwise it will not load."); 28 | 29 | for (var i = 0; i <= 10; i++) 30 | { 31 | if (linux) 32 | { 33 | unturnedExec = 34 | new[] {"Unturned_Headless.x86", "Unturned.x86", "Unturned_Headless.x86_64", "Unturned.x86_64"} 35 | .FirstOrDefault(exec => FileActions.VerifyFile(Path.Combine(ServerPath.Value, exec))); 36 | 37 | if (string.IsNullOrEmpty(unturnedExec)) 38 | unturnedExec = "Unturned_Headless.x86_64"; 39 | } 40 | 41 | 42 | if (FileActions.VerifyFile(Path.Combine(ServerPath.Value, unturnedExec))) break; 43 | 44 | if (i == 10) 45 | { 46 | Console.WriteLine( 47 | "Unable to install correctly unturned in your system. Please verify that you have met all pre-install requirements."); 48 | Environment.Exit(0); 49 | return; 50 | } 51 | 52 | Updater.ValidateUnturned(); 53 | } 54 | 55 | var serverDirectory = Path.Combine(ServerPath.Value, "Servers"); 56 | FileActions.VerifyPath(serverDirectory, true); 57 | 58 | var serverDirectoryInfo = new DirectoryInfo(serverDirectory); 59 | foreach (var server in serverDirectoryInfo.GetDirectories()) 60 | RegisteredServers.Add(Server.Create(server.Name)); 61 | } 62 | 63 | private static void Unload() 64 | { 65 | if (RegisteredServers.Count == 0) 66 | return; 67 | 68 | RegisteredServers.Clear(); 69 | } 70 | 71 | public static void Reload() 72 | { 73 | Unload(); 74 | Load(); 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /src/Loading/Entry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | using System.Security.AccessControl; 5 | using System.Security.Principal; 6 | using System.Threading; 7 | using System.Windows.Forms; 8 | using Pustalorc.Applications.USM.Configuration; 9 | using Pustalorc.Applications.USM.GUI; 10 | 11 | // ReSharper disable UnusedParameter.Global 12 | 13 | namespace Pustalorc.Applications.USM.Loading 14 | { 15 | /// 16 | /// Entry point for UnturnedServerManager. 17 | /// 18 | internal static class Entry 19 | { 20 | /// 21 | /// Verifies if another instance of USM is running. Returns false if there isn't, true if there is. 22 | /// 23 | private static bool IsSecondInstance 24 | { 25 | get 26 | { 27 | var appGuid = ((GuidAttribute) Assembly.GetExecutingAssembly() 28 | .GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value; 29 | var mutexId = $"Global\\{{{appGuid}}}"; 30 | var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), 31 | MutexRights.FullControl, AccessControlType.Allow); 32 | var securitySettings = new MutexSecurity(); 33 | securitySettings.AddAccessRule(allowEveryoneRule); 34 | 35 | // ReSharper disable UnusedVariable 36 | using (var mutex = new Mutex(false, mutexId, out var createdNew, securitySettings)) 37 | // ReSharper restore UnusedVariable 38 | { 39 | var hasHandle = false; 40 | try 41 | { 42 | try 43 | { 44 | hasHandle = mutex.WaitOne(0, false); 45 | if (hasHandle == false) 46 | return true; 47 | } 48 | catch (AbandonedMutexException) 49 | { 50 | hasHandle = true; 51 | } 52 | 53 | return false; 54 | } 55 | finally 56 | { 57 | if (hasHandle) 58 | mutex.ReleaseMutex(); 59 | } 60 | } 61 | } 62 | } 63 | 64 | /// 65 | /// Entry point. 66 | /// 67 | /// Arguments supplied by console or startup options. 68 | [STAThread] 69 | public static void Main(string[] args) 70 | { 71 | Application.EnableVisualStyles(); 72 | Application.SetCompatibleTextRenderingDefault(false); 73 | Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); 74 | 75 | if (IsSecondInstance) 76 | return; 77 | 78 | if (!Installation.Exists()) 79 | Application.Run(new FirstStart()); 80 | 81 | Servers.Load(); 82 | 83 | Application.Run(new Manager()); 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /src/SteamCMD Manager/SteamCMD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Runtime.InteropServices; 5 | using Pustalorc.Applications.USM.Configuration; 6 | using Pustalorc.Applications.USM.File_Control; 7 | 8 | namespace Pustalorc.Applications.USM.SteamCMD_Manager 9 | { 10 | internal static class SteamCmd 11 | { 12 | /// 13 | /// Link to official steam download for SteamCMD. 14 | /// 15 | private static string DownloadLink => "https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip"; 16 | 17 | /// 18 | /// Runs a command directly into SteamCMD. 19 | /// 20 | /// 21 | /// The command to be run by SteamCMD. Must be a string such as if you were running SteamCMD.exe from 22 | /// console yourself excluding username + password. 23 | /// 24 | public static void RunCommand(string command) 25 | { 26 | VerifySteam(); 27 | 28 | var inst = Installation.Load(); 29 | var steamCmdExe = Path.Combine(inst.InstallationPath, "steamcmd.exe"); 30 | 31 | var proc = new Process(); 32 | 33 | var startInfo = new ProcessStartInfo {FileName = steamCmdExe, Arguments = $" +login anonymous {command}"}; 34 | 35 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 36 | startInfo = new ProcessStartInfo 37 | {FileName = "/bin/bash", Arguments = $"steamcmd +login anonymous {command}"}; 38 | 39 | proc.StartInfo = startInfo; 40 | proc.Start(); 41 | proc.WaitForExit(); 42 | } 43 | 44 | /// 45 | /// Moves a downloaded workshop folder. 46 | /// 47 | /// The ID of the workshop folder. 48 | /// The destination for the workshop folder. 49 | public static void MoveWorkshopFolder(string id, string directoryDestination) 50 | { 51 | var inst = Installation.Load(); 52 | var workshopDir = Path.Combine(inst.InstallationPath, "steamapps", "workshop", "content", "304930", id); 53 | var mapMeta = Path.Combine(workshopDir, "Map.meta"); 54 | var mapsDir = Path.Combine(directoryDestination, "Maps", id); 55 | var contentDir = Path.Combine(directoryDestination, "Content", id); 56 | 57 | FileActions.CopyDirectory(workshopDir, FileActions.VerifyFile(mapMeta) ? mapsDir : contentDir); 58 | } 59 | 60 | /// 61 | /// Verifies that SteamCMD is present in the installation. Should be called before running SteamCMD.exe or doing 62 | /// anything with SteamCMD. 63 | /// 64 | private static void VerifySteam() 65 | { 66 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return; 67 | 68 | var inst = Installation.Load(); 69 | var steamCmdExe = Path.Combine(inst.InstallationPath, "steamcmd.exe"); 70 | 71 | try 72 | { 73 | if (FileActions.VerifyFile(steamCmdExe)) return; 74 | 75 | var zipTarget = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); 76 | FileActions.Download(DownloadLink, zipTarget); 77 | FileActions.ExtractZip(zipTarget, inst.InstallationPath); 78 | } 79 | catch (Exception ex) 80 | { 81 | Console.WriteLine(ex.Message); 82 | } 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /src/GUI/Add Or Clone Server.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace Pustalorc.Applications.USM.GUI 5 | { 6 | internal sealed partial class AddServer 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | this.Instructions = new System.Windows.Forms.Label(); 35 | this.ServerName = new System.Windows.Forms.TextBox(); 36 | this.OK = new System.Windows.Forms.Button(); 37 | this.Cancel = new System.Windows.Forms.Button(); 38 | this.SuspendLayout(); 39 | // 40 | // Instructions 41 | // 42 | this.Instructions.AutoSize = true; 43 | this.Instructions.Location = new System.Drawing.Point(13, 13); 44 | this.Instructions.Name = "Instructions"; 45 | this.Instructions.Size = new System.Drawing.Size(202, 13); 46 | this.Instructions.TabIndex = 0; 47 | this.Instructions.Text = "Please type the local name for the server:"; 48 | // 49 | // ServerName 50 | // 51 | this.ServerName.Location = new System.Drawing.Point(12, 39); 52 | this.ServerName.Name = "ServerName"; 53 | this.ServerName.Size = new System.Drawing.Size(203, 20); 54 | this.ServerName.TabIndex = 1; 55 | this.ServerName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ServerName_KeyPress); 56 | // 57 | // OK 58 | // 59 | this.OK.Location = new System.Drawing.Point(59, 65); 60 | this.OK.Name = "OK"; 61 | this.OK.Size = new System.Drawing.Size(75, 23); 62 | this.OK.TabIndex = 2; 63 | this.OK.Text = "OK"; 64 | this.OK.UseVisualStyleBackColor = true; 65 | this.OK.Click += new System.EventHandler(this.OK_Click); 66 | // 67 | // Cancel 68 | // 69 | this.Cancel.Location = new System.Drawing.Point(140, 65); 70 | this.Cancel.Name = "Cancel"; 71 | this.Cancel.Size = new System.Drawing.Size(75, 23); 72 | this.Cancel.TabIndex = 3; 73 | this.Cancel.Text = "Cancel"; 74 | this.Cancel.UseVisualStyleBackColor = true; 75 | this.Cancel.Click += new System.EventHandler(this.Cancel_Click); 76 | // 77 | // AddServer 78 | // 79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 81 | this.ClientSize = new System.Drawing.Size(227, 99); 82 | this.Controls.Add(this.Cancel); 83 | this.Controls.Add(this.OK); 84 | this.Controls.Add(this.ServerName); 85 | this.Controls.Add(this.Instructions); 86 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 87 | this.MaximizeBox = false; 88 | this.MinimizeBox = false; 89 | this.Name = "AddServer"; 90 | this.ShowIcon = false; 91 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 92 | this.Text = "Adding a new server..."; 93 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AddServer_FormClosing); 94 | this.ResumeLayout(false); 95 | this.PerformLayout(); 96 | 97 | } 98 | 99 | #endregion 100 | 101 | private Label Instructions; 102 | public TextBox ServerName; 103 | private Button OK; 104 | private Button Cancel; 105 | } 106 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | 244 | # IDEA - Jetbrains rider folder. 245 | .idea/ -------------------------------------------------------------------------------- /src/GUI/First Start.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace Pustalorc.Applications.USM.GUI 5 | { 6 | internal sealed partial class FirstStart 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FirstStart)); 35 | this.Msg = new System.Windows.Forms.Label(); 36 | this.SelectedPath = new System.Windows.Forms.TextBox(); 37 | this.Browse = new System.Windows.Forms.Button(); 38 | this.FolderBrowser = new System.Windows.Forms.FolderBrowserDialog(); 39 | this.ValidatePath = new System.Windows.Forms.Button(); 40 | this.SuspendLayout(); 41 | // 42 | // Msg 43 | // 44 | this.Msg.AutoSize = true; 45 | this.Msg.Location = new System.Drawing.Point(12, 9); 46 | this.Msg.Name = "Msg"; 47 | this.Msg.Size = new System.Drawing.Size(463, 52); 48 | this.Msg.TabIndex = 0; 49 | this.Msg.Text = resources.GetString("Msg.Text"); 50 | // 51 | // SelectedPath 52 | // 53 | this.SelectedPath.Location = new System.Drawing.Point(12, 66); 54 | this.SelectedPath.Name = "SelectedPath"; 55 | this.SelectedPath.Size = new System.Drawing.Size(378, 20); 56 | this.SelectedPath.TabIndex = 1; 57 | this.SelectedPath.Text = "C:\\Servers"; 58 | this.SelectedPath.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.SelectedPath_KeyPress); 59 | // 60 | // Browse 61 | // 62 | this.Browse.Location = new System.Drawing.Point(396, 64); 63 | this.Browse.Name = "Browse"; 64 | this.Browse.Size = new System.Drawing.Size(75, 23); 65 | this.Browse.TabIndex = 2; 66 | this.Browse.Text = "Browse..."; 67 | this.Browse.UseVisualStyleBackColor = true; 68 | this.Browse.Click += new System.EventHandler(this.Browse_Click); 69 | // 70 | // FolderBrowser 71 | // 72 | this.FolderBrowser.RootFolder = System.Environment.SpecialFolder.MyComputer; 73 | // 74 | // ValidatePath 75 | // 76 | this.ValidatePath.Location = new System.Drawing.Point(396, 93); 77 | this.ValidatePath.Name = "ValidatePath"; 78 | this.ValidatePath.Size = new System.Drawing.Size(75, 23); 79 | this.ValidatePath.TabIndex = 3; 80 | this.ValidatePath.Text = "Accept"; 81 | this.ValidatePath.UseVisualStyleBackColor = true; 82 | this.ValidatePath.Click += new System.EventHandler(this.Validate_Click); 83 | // 84 | // FirstStart 85 | // 86 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 87 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 88 | this.ClientSize = new System.Drawing.Size(483, 127); 89 | this.Controls.Add(this.ValidatePath); 90 | this.Controls.Add(this.Browse); 91 | this.Controls.Add(this.SelectedPath); 92 | this.Controls.Add(this.Msg); 93 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 94 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 95 | this.MaximizeBox = false; 96 | this.MinimizeBox = false; 97 | this.Name = "FirstStart"; 98 | this.ShowIcon = false; 99 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 100 | this.Text = "First Startup"; 101 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FirstStart_FormClosing); 102 | this.ResumeLayout(false); 103 | this.PerformLayout(); 104 | 105 | } 106 | 107 | #endregion 108 | 109 | private Label Msg; 110 | private TextBox SelectedPath; 111 | private Button Browse; 112 | private FolderBrowserDialog FolderBrowser; 113 | private Button ValidatePath; 114 | } 115 | } -------------------------------------------------------------------------------- /src/Server Instance/Server.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Runtime.InteropServices; 5 | using Pustalorc.Applications.USM.Configuration; 6 | using Pustalorc.Applications.USM.Constants; 7 | using Pustalorc.Applications.USM.File_Control; 8 | using Pustalorc.Applications.USM.Loading; 9 | 10 | namespace Pustalorc.Applications.USM.Server_Instance 11 | { 12 | public sealed class Server 13 | { 14 | private Process _instance; 15 | private TextReader _consoleReader; 16 | private FileSystemWatcher _fileSystemWatcher; 17 | 18 | internal string Name { get; private set; } 19 | internal bool IsRunning => _instance != null; 20 | 21 | /// 22 | /// The folder in which all the server data is stored. 23 | /// 24 | internal string Folder => Path.Combine(ServerPath.Value, "Servers", Name); 25 | 26 | internal static Server Create(string name, string clone = null) 27 | { 28 | var s = new Server {Name = name}; 29 | 30 | FileActions.VerifyPath(s.Folder, true); 31 | 32 | if (!string.IsNullOrEmpty(clone)) FileActions.CopyDirectory(clone, s.Folder); 33 | 34 | return s; 35 | } 36 | 37 | internal void Start() 38 | { 39 | var commandsDat = Path.Combine(Folder, "Server", "Commands.dat"); 40 | 41 | if (!FileActions.VerifyFile(commandsDat)) 42 | { 43 | FileActions.VerifyFilePath(commandsDat, true); 44 | 45 | var c = GameConfiguration.Load(Name); 46 | File.WriteAllLines(commandsDat, c.ToNelson); 47 | } 48 | 49 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 50 | { 51 | _instance = new Process 52 | { 53 | StartInfo = new ProcessStartInfo 54 | { 55 | FileName = Path.Combine(ServerPath.Value, "ServerHelper.sh"), 56 | Arguments = $" +secureserver/{Name}", 57 | WorkingDirectory = ServerPath.Value, 58 | RedirectStandardOutput = true, 59 | RedirectStandardInput = false, 60 | UseShellExecute = false 61 | } 62 | }; 63 | 64 | _instance.Start(); 65 | 66 | var consoleOutput = $"{Name}.console"; 67 | 68 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 69 | consoleOutput = consoleOutput.Replace(" ", @"\ "); 70 | 71 | _fileSystemWatcher = new FileSystemWatcher(ServerPath.Value, consoleOutput); 72 | _consoleReader = new StreamReader(new FileStream(Path.Combine(ServerPath.Value, consoleOutput), FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)); 73 | 74 | _fileSystemWatcher.Changed += ConsoleNewOutput; 75 | _fileSystemWatcher.EnableRaisingEvents = true; 76 | } 77 | else 78 | { 79 | var serverExec = Path.Combine(ServerPath.Value, "Unturned.exe"); 80 | 81 | if (!FileActions.VerifyFile(serverExec)) 82 | return; 83 | 84 | _instance = new Process 85 | { 86 | StartInfo = new ProcessStartInfo(serverExec, $" -nographics -batchmode +secureserver/{Name}") 87 | {WorkingDirectory = ServerPath.Value} 88 | }; 89 | _instance.Start(); 90 | } 91 | } 92 | 93 | private void ConsoleNewOutput(object sender, FileSystemEventArgs e) 94 | { 95 | if (e.ChangeType != WatcherChangeTypes.Changed) return; 96 | 97 | var newline = _consoleReader.ReadToEnd(); 98 | if (!string.IsNullOrEmpty(newline)) 99 | Console.Write($"[{Name}]: {newline}"); 100 | } 101 | 102 | internal void Restart() 103 | { 104 | Shutdown(); 105 | Start(); 106 | } 107 | 108 | internal void Shutdown() 109 | { 110 | if (_instance == null) return; 111 | 112 | while (!_instance.HasExited) 113 | { 114 | _instance.Kill(); 115 | _instance.WaitForExit(); 116 | } 117 | 118 | _instance = null; 119 | 120 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 121 | { 122 | _fileSystemWatcher.EnableRaisingEvents = false; 123 | _fileSystemWatcher.Changed -= ConsoleNewOutput; 124 | _consoleReader = null; 125 | _fileSystemWatcher = null; 126 | } 127 | 128 | Console.WriteLine($"[{Name}]: Stopped server."); 129 | } 130 | 131 | internal void Delete() 132 | { 133 | Shutdown(); 134 | 135 | while (_instance?.HasExited == false) 136 | { 137 | } 138 | 139 | Servers.RegisteredServers.Remove(this); 140 | GameConfiguration.Delete(Name); 141 | FileActions.DeleteDirectory(Folder); 142 | } 143 | } 144 | } -------------------------------------------------------------------------------- /src/File Control/FileActions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.IO.Compression; 3 | using System.Net; 4 | 5 | namespace Pustalorc.Applications.USM.File_Control 6 | { 7 | internal static class FileActions 8 | { 9 | /// 10 | /// Downloads a file into the destination folder. 11 | /// 12 | /// Uniform Resource Locator for the file. 13 | /// Full path to destination including desired filename. 14 | /// True if no exceptions occur during download, false otherwise. 15 | public static bool Download(string url, string destination) 16 | { 17 | VerifyFilePath(destination, true); 18 | 19 | if (VerifyFile(destination)) 20 | File.Delete(destination); 21 | 22 | try 23 | { 24 | using (var client = new WebClient()) 25 | { 26 | client.DownloadFile(url, destination); 27 | } 28 | } 29 | catch 30 | { 31 | return false; 32 | } 33 | 34 | return true; 35 | } 36 | 37 | /// 38 | /// Verifies that the file exists. 39 | /// 40 | /// Full path, including file name, to the file. 41 | /// True if the file exists, false otherwise. 42 | public static bool VerifyFile(string path) 43 | { 44 | return File.Exists(path); 45 | } 46 | 47 | /// 48 | /// Verifies that the directory in which a file is at exists. 49 | /// 50 | /// The full path, including file name, to the file. 51 | /// If the directory should be created if it doesn't exist. 52 | /// True if directory existed from before, false otherwise. 53 | public static bool VerifyFilePath(string file, bool create) 54 | { 55 | return VerifyPath(Path.GetDirectoryName(file), create); 56 | } 57 | 58 | /// 59 | /// Verifies a path for a valid directory. 60 | /// 61 | /// The full path to a specific folder. 62 | /// If the directory should be created if it doesn't exist. 63 | /// True if directory existed prior to the method calling, false otherwise. 64 | public static bool VerifyPath(string folder, bool create) 65 | { 66 | if (Directory.Exists(folder)) return true; 67 | 68 | if (create) 69 | Directory.CreateDirectory(folder); 70 | 71 | return false; 72 | } 73 | 74 | /// 75 | /// Deletes an entire directory, recursively. 76 | /// 77 | /// The full path to a specific folder. 78 | public static void DeleteDirectory(string folder) 79 | { 80 | if (!VerifyPath(folder, false)) return; 81 | 82 | try 83 | { 84 | Directory.Delete(folder, true); 85 | } 86 | catch 87 | { 88 | // Ignores any errors, including if there is a resource still in use. 89 | } 90 | } 91 | 92 | /// 93 | /// Copies an entire directory recursively, verifying that everything exists. 94 | /// 95 | /// The full path to the target directory to copy. 96 | /// The full path to the destination directory. 97 | public static void CopyDirectory(string folder, string destination) 98 | { 99 | if (!VerifyPath(folder, false)) return; 100 | 101 | VerifyPath(destination, true); 102 | foreach (var dirPath in Directory.GetDirectories(folder, "*", SearchOption.AllDirectories)) 103 | Directory.CreateDirectory(dirPath.Replace(folder, destination)); 104 | 105 | foreach (var newPath in Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories)) 106 | File.Copy(newPath, newPath.Replace(folder, destination), true); 107 | } 108 | 109 | /// 110 | /// Extracts all the contents of a .Zip file into a specific folder. 111 | /// 112 | /// The full path, including file name, to the .Zip file. 113 | /// The full path where the files should be extracted to. 114 | public static void ExtractZip(string zipFile, string destination) 115 | { 116 | if (!VerifyFile(zipFile)) 117 | return; 118 | 119 | VerifyPath(destination, true); 120 | 121 | foreach (var entry in new ZipArchive(File.OpenRead(zipFile)).Entries) 122 | try 123 | { 124 | var dir = Path.GetFullPath(Path.Combine(destination, entry.FullName)); 125 | 126 | VerifyFilePath(dir, true); 127 | 128 | if (entry.Name != "") 129 | entry.ExtractToFile(dir, true); 130 | } 131 | catch 132 | { 133 | // Prevents any exceptions when extracting from halting the extraction process. 134 | } 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /src/GUI/UpdateMenu.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace Pustalorc.Applications.USM.GUI 5 | { 6 | sealed partial class UpdateMenu 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | this.UAll = new System.Windows.Forms.Button(); 35 | this.URocket = new System.Windows.Forms.Button(); 36 | this.CUVer = new System.Windows.Forms.Label(); 37 | this.CUVerDesc = new System.Windows.Forms.Label(); 38 | this.UUnturned = new System.Windows.Forms.Button(); 39 | this.UValidate = new System.Windows.Forms.Button(); 40 | this.SuspendLayout(); 41 | // 42 | // UAll 43 | // 44 | this.UAll.Location = new System.Drawing.Point(179, 41); 45 | this.UAll.Name = "UAll"; 46 | this.UAll.Size = new System.Drawing.Size(130, 23); 47 | this.UAll.TabIndex = 47; 48 | this.UAll.Text = "Update All"; 49 | this.UAll.UseVisualStyleBackColor = true; 50 | this.UAll.Click += new System.EventHandler(this.UAll_Click); 51 | // 52 | // URocket 53 | // 54 | this.URocket.Location = new System.Drawing.Point(12, 40); 55 | this.URocket.Name = "URocket"; 56 | this.URocket.Size = new System.Drawing.Size(130, 23); 57 | this.URocket.TabIndex = 32; 58 | this.URocket.Text = "Install/Update Rocket"; 59 | this.URocket.UseVisualStyleBackColor = true; 60 | this.URocket.Click += new System.EventHandler(this.URocket_Click); 61 | // 62 | // CUVer 63 | // 64 | this.CUVer.AutoSize = true; 65 | this.CUVer.Location = new System.Drawing.Point(332, 16); 66 | this.CUVer.Name = "CUVer"; 67 | this.CUVer.Size = new System.Drawing.Size(27, 13); 68 | this.CUVer.TabIndex = 27; 69 | this.CUVer.Text = "N/A"; 70 | // 71 | // CUVerDesc 72 | // 73 | this.CUVerDesc.AutoSize = true; 74 | this.CUVerDesc.Location = new System.Drawing.Point(148, 16); 75 | this.CUVerDesc.Name = "CUVerDesc"; 76 | this.CUVerDesc.Size = new System.Drawing.Size(178, 13); 77 | this.CUVerDesc.TabIndex = 26; 78 | this.CUVerDesc.Text = "Last Performed Update of Unturned:"; 79 | // 80 | // UUnturned 81 | // 82 | this.UUnturned.Location = new System.Drawing.Point(12, 11); 83 | this.UUnturned.Name = "UUnturned"; 84 | this.UUnturned.Size = new System.Drawing.Size(130, 23); 85 | this.UUnturned.TabIndex = 25; 86 | this.UUnturned.Text = "Update Unturned"; 87 | this.UUnturned.UseVisualStyleBackColor = true; 88 | this.UUnturned.Click += new System.EventHandler(this.UUnturned_Click); 89 | // 90 | // UValidate 91 | // 92 | this.UValidate.Location = new System.Drawing.Point(339, 40); 93 | this.UValidate.Name = "UValidate"; 94 | this.UValidate.Size = new System.Drawing.Size(104, 23); 95 | this.UValidate.TabIndex = 48; 96 | this.UValidate.Text = "Validate Unturned"; 97 | this.UValidate.UseVisualStyleBackColor = true; 98 | this.UValidate.Click += new System.EventHandler(this.Validate_Click); 99 | // 100 | // UpdateMenu 101 | // 102 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 103 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 104 | this.BackColor = System.Drawing.SystemColors.Control; 105 | this.ClientSize = new System.Drawing.Size(455, 76); 106 | this.Controls.Add(this.UValidate); 107 | this.Controls.Add(this.UAll); 108 | this.Controls.Add(this.URocket); 109 | this.Controls.Add(this.CUVer); 110 | this.Controls.Add(this.CUVerDesc); 111 | this.Controls.Add(this.UUnturned); 112 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 113 | this.MaximizeBox = false; 114 | this.MinimizeBox = false; 115 | this.Name = "UpdateMenu"; 116 | this.ShowIcon = false; 117 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 118 | this.Text = "Updater"; 119 | this.ResumeLayout(false); 120 | this.PerformLayout(); 121 | 122 | } 123 | 124 | #endregion 125 | private Button UAll; 126 | private Button URocket; 127 | private Label CUVer; 128 | private Label CUVerDesc; 129 | private Button UUnturned; 130 | private Button UValidate; 131 | } 132 | } -------------------------------------------------------------------------------- /src/Configuration/GameConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using Newtonsoft.Json; 5 | using Pustalorc.Applications.USM.File_Control; 6 | 7 | namespace Pustalorc.Applications.USM.Configuration 8 | { 9 | /// 10 | /// Configuration in json of the server configuration. 11 | /// 12 | public sealed class GameConfiguration 13 | { 14 | [JsonIgnore] private static string _filePath; 15 | 16 | public string Bind { get; set; } = "0.0.0.0"; 17 | public int ChatRate { get; set; } = 0; 18 | public bool Cheats { get; set; } = false; 19 | public int Cycle { get; set; } = 43200; 20 | public string Difficulty { get; set; } = "Normal"; 21 | public bool Filter { get; set; } = false; 22 | public bool GoldMode { get; set; } = false; 23 | public bool HideAdmins { get; set; } = false; 24 | public string Loadout { get; set; } = ""; 25 | public string LoginMessage { get; set; } = ""; 26 | public string Map { get; set; } = "Washington"; 27 | public int MaxPlayers { get; set; } = 24; 28 | public long Owner { get; set; } = 76561197960265728; 29 | public string Password { get; set; } = ""; 30 | public string Perspective { get; set; } = "Both"; 31 | public int Port { get; set; } = 27015; 32 | public string PublicName { get; set; } = "Test Server"; 33 | public bool Pvp { get; set; } = true; 34 | public int QueueSize { get; set; } = 8; 35 | public bool Sync { get; set; } = false; 36 | 37 | public IEnumerable ToNelson => 38 | new List 39 | { 40 | string.IsNullOrEmpty(Map) ? "" : "Map " + Map, 41 | string.IsNullOrEmpty(Bind) ? "" : "Bind " + Bind, 42 | string.IsNullOrEmpty(Password) ? "" : "Password " + Password, 43 | string.IsNullOrEmpty(Difficulty) ? "" : "Mode " + Difficulty, 44 | string.IsNullOrEmpty(PublicName) ? "" : "Name " + PublicName, 45 | string.IsNullOrEmpty(Loadout) ? "" : "Loadout 255/" + Loadout, 46 | string.IsNullOrEmpty(LoginMessage) ? "" : "Welcome " + LoginMessage, 47 | string.IsNullOrEmpty(Perspective) ? "" : "Perspective " + Perspective, 48 | "MaxPlayers " + MaxPlayers, 49 | "Queue_Size " + QueueSize, 50 | "ChatRate " + ChatRate, 51 | "Cycle " + Cycle, 52 | "Owner " + Owner, 53 | "Port " + Port, 54 | Pvp ? "" : "PvE", 55 | Sync ? "Sync" : "", 56 | Cheats ? "Cheats" : "", 57 | Filter ? "Filter" : "", 58 | GoldMode ? "Gold" : "", 59 | HideAdmins ? "hide_admins" : "" 60 | }; 61 | 62 | public void SaveJson() 63 | { 64 | var file = Path.Combine(AppContext.BaseDirectory, _filePath); 65 | File.WriteAllText(file, ToJson()); 66 | } 67 | 68 | private string ToJson() 69 | { 70 | return JsonConvert.SerializeObject(this, Formatting.Indented); 71 | } 72 | 73 | private static void EnsureExists() 74 | { 75 | var file = Path.Combine(AppContext.BaseDirectory, _filePath); 76 | if (File.Exists(file)) return; 77 | 78 | var path = Path.GetDirectoryName(file); 79 | if (!Directory.Exists(path)) 80 | if (path != null) 81 | Directory.CreateDirectory(path); 82 | 83 | var config = new GameConfiguration(); 84 | config.SaveJson(); 85 | } 86 | 87 | public static GameConfiguration Load(string serverName) 88 | { 89 | _filePath = $@"config/Server_{serverName}_commands.json"; 90 | 91 | var file = Path.Combine(AppContext.BaseDirectory, _filePath); 92 | 93 | EnsureExists(); 94 | 95 | return JsonConvert.DeserializeObject(File.ReadAllText(file)); 96 | } 97 | 98 | public static void Delete(string serverName) 99 | { 100 | _filePath = $@"config/Server_{serverName}_commands.json"; 101 | if (FileActions.VerifyFile(_filePath)) 102 | File.Delete(_filePath); 103 | } 104 | 105 | public static void Clone(string server1, string server2) 106 | { 107 | var config1 = $@"config/Server_{server1}_commands.json"; 108 | _filePath = $"config/Server_{server2}_commands.json"; 109 | 110 | if (!FileActions.VerifyFile(config1)) 111 | return; 112 | 113 | if (FileActions.VerifyFile(_filePath)) 114 | File.Delete(_filePath); 115 | 116 | File.Copy(config1, _filePath); 117 | } 118 | 119 | public override string ToString() 120 | { 121 | return $"Public Name: {PublicName}" + 122 | $"\nPort: {Port}" + 123 | $"\nPvP: {Pvp}" + 124 | $"\nPerspective: {Perspective}" + 125 | $"\nMaxPlayers: {MaxPlayers}" + 126 | $"\nMap: {Map}" + 127 | $"\nDifficulty: {Difficulty}" + 128 | $"\nGold Activated: {GoldMode}" + 129 | $"\nCheats Enabled: {Cheats}" + 130 | $"\nServer Password: {Password}" + 131 | $"\nQueue Size: {QueueSize}" + 132 | $"\nOwner Steam64ID: {Owner}" + 133 | $"\nLogin Message: {LoginMessage}" + 134 | $"\nSync Enabled: {Sync}" + 135 | $"\nLoadout: {Loadout}" + 136 | $"\nHide Admins: {HideAdmins}" + 137 | $"\nBind: {Bind}" + 138 | $"\nFilter: {Filter}" + 139 | $"\nCycle: {Cycle}" + 140 | $"\nChat Rate: {ChatRate}"; 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /src/GUI/UpdateMenu.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /src/GUI/Server Settings.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/GUI/Add Or Clone Server.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/GUI/Workshop Download.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/GUI/Manager.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/GUI/Plugin Download.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/GUI/Plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Windows.Forms; 5 | using Pustalorc.Applications.USM.Constants; 6 | using Pustalorc.Applications.USM.File_Control; 7 | 8 | namespace Pustalorc.Applications.USM.GUI 9 | { 10 | internal partial class Plugin : Form 11 | { 12 | private readonly string _server; 13 | private string _itemId = ""; 14 | 15 | public Plugin(string serverPath) 16 | { 17 | InitializeComponent(); 18 | _server = serverPath; 19 | LoadInstalled(); 20 | } 21 | 22 | // Custom Methods 23 | private void LoadInstalled() 24 | { 25 | AlreadyInstalled.Items.Clear(); 26 | var pluginLocation = Path.Combine(_server, "Rocket", "Plugins"); 27 | FileActions.VerifyPath(pluginLocation, true); 28 | 29 | var folder = new DirectoryInfo(pluginLocation); 30 | var content = folder.GetFiles("*.dll", SearchOption.TopDirectoryOnly); 31 | foreach (var file in content) 32 | AlreadyInstalled.Items.Add(file.Name.Substring(0, file.Name.Length - 4)); 33 | 34 | if (AlreadyInstalled.Items.Count == 0) 35 | { 36 | Delete.Enabled = false; 37 | DeleteAll.Enabled = false; 38 | Configuration.Enabled = false; 39 | _itemId = ""; 40 | } 41 | else 42 | { 43 | AlreadyInstalled.SelectedIndex = 0; 44 | Delete.Enabled = true; 45 | DeleteAll.Enabled = true; 46 | Configuration.Enabled = true; 47 | } 48 | } 49 | 50 | // Control Events 51 | private void Exit_Click(object sender, EventArgs e) 52 | { 53 | Close(); 54 | } 55 | 56 | private void AlreadyInstalled_SelectedIndexChanged(object sender, EventArgs e) 57 | { 58 | if (AlreadyInstalled.SelectedItem != null) 59 | { 60 | Delete.Enabled = true; 61 | Configuration.Enabled = true; 62 | _itemId = (string) AlreadyInstalled.SelectedItem; 63 | } 64 | else 65 | { 66 | Delete.Enabled = false; 67 | Configuration.Enabled = true; 68 | _itemId = ""; 69 | } 70 | } 71 | 72 | private void DeleteAll_Click(object sender, EventArgs e) 73 | { 74 | var pluginLocation = Path.Combine(_server, "Rocket", "Plugins"); 75 | var librariesLocation = Path.Combine(_server, "Rocket", "Libraries"); 76 | 77 | FileActions.DeleteDirectory(pluginLocation); 78 | FileActions.DeleteDirectory(librariesLocation); 79 | 80 | LoadInstalled(); 81 | } 82 | 83 | private void Delete_Click(object sender, EventArgs e) 84 | { 85 | var pluginLocation = Path.Combine(_server, "Rocket", "Plugins", _itemId); 86 | 87 | FileActions.DeleteDirectory(pluginLocation); 88 | File.Delete($"{pluginLocation}.dll"); 89 | 90 | LoadInstalled(); 91 | } 92 | 93 | private void Install_Click(object sender, EventArgs e) 94 | { 95 | Hide(); 96 | var pluginLocation = Path.Combine(_server, "Rocket", "Plugins"); 97 | var librariesLocation = Path.Combine(_server, "Rocket", "Libraries"); 98 | var moduleLocation = Path.Combine(ServerPath.Value, "Modules"); 99 | 100 | var tempName = Path.GetTempFileName(); 101 | var tempLocation = Path.Combine(Path.GetTempPath(), tempName.Substring(0, tempName.Length - 4)); 102 | 103 | var result = OpenZip.ShowDialog(); 104 | if (result == DialogResult.OK) 105 | { 106 | var stream = (FileStream) OpenZip.OpenFile(); 107 | FileActions.ExtractZip(stream.Name, tempLocation); 108 | 109 | var tempLibraries = Path.Combine(tempLocation, "Libraries"); 110 | if (FileActions.VerifyPath(tempLibraries, false)) 111 | { 112 | var folder = new DirectoryInfo(tempLibraries); 113 | var content = folder.GetFiles("*.dll", SearchOption.TopDirectoryOnly); 114 | foreach (var file in content) 115 | { 116 | var dest = Path.Combine(librariesLocation, file.Name); 117 | 118 | if (File.Exists(dest)) 119 | File.Delete(dest); 120 | 121 | FileActions.VerifyFilePath(dest, true); 122 | file.MoveTo(dest); 123 | } 124 | } 125 | 126 | var tempPlugins = Path.Combine(tempLocation, "Plugins"); 127 | if (FileActions.VerifyPath(tempPlugins, false)) 128 | { 129 | var folder = new DirectoryInfo(tempPlugins); 130 | var content = folder.GetFiles("*.dll", SearchOption.TopDirectoryOnly); 131 | foreach (var file in content) 132 | { 133 | var dest = Path.Combine(pluginLocation, file.Name); 134 | 135 | if (File.Exists(dest)) 136 | File.Delete(dest); 137 | 138 | FileActions.VerifyFilePath(dest, true); 139 | file.MoveTo(dest); 140 | } 141 | } 142 | 143 | var tempModules = Path.Combine(tempLocation, "Modules"); 144 | if (FileActions.VerifyPath(tempModules, false)) 145 | { 146 | var folder = new DirectoryInfo(tempModules); 147 | var content = folder.GetFiles("*.dll", SearchOption.TopDirectoryOnly); 148 | foreach (var file in content) 149 | { 150 | var dest = Path.Combine(moduleLocation, file.Name); 151 | 152 | if (File.Exists(dest)) 153 | File.Delete(dest); 154 | 155 | FileActions.VerifyFilePath(dest, true); 156 | file.MoveTo(dest); 157 | } 158 | } 159 | } 160 | 161 | LoadInstalled(); 162 | Show(); 163 | } 164 | 165 | private void Configuration_Click(object sender, EventArgs e) 166 | { 167 | var pluginLocation = Path.Combine(_server, "Rocket", "Plugins", _itemId); 168 | 169 | if (FileActions.VerifyPath(pluginLocation, false)) 170 | Process.Start(pluginLocation); 171 | } 172 | } 173 | } -------------------------------------------------------------------------------- /src/GUI/First Start.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Welcome to Unturned Server Manager's first-startup configuration! 122 | Make sure the drive you select here has enough space! (Minimum 3GB) 123 | 124 | Please specify the directory to which Unturned will be installed to and used for hosting the server. 125 | 126 | 127 | 128 | 17, 17 129 | 130 | 131 | -------------------------------------------------------------------------------- /src/FodyWeavers.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks 13 | 14 | 15 | 16 | 17 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. 18 | 19 | 20 | 21 | 22 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks. 23 | 24 | 25 | 26 | 27 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks. 28 | 29 | 30 | 31 | 32 | The order of preloaded assemblies, delimited with line breaks. 33 | 34 | 35 | 36 | 37 | 38 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. 39 | 40 | 41 | 42 | 43 | Controls if .pdbs for reference assemblies are also embedded. 44 | 45 | 46 | 47 | 48 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. 49 | 50 | 51 | 52 | 53 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. 54 | 55 | 56 | 57 | 58 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. 59 | 60 | 61 | 62 | 63 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. 64 | 65 | 66 | 67 | 68 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | 69 | 70 | 71 | 72 | 73 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. 74 | 75 | 76 | 77 | 78 | A list of unmanaged 32 bit assembly names to include, delimited with |. 79 | 80 | 81 | 82 | 83 | A list of unmanaged 64 bit assembly names to include, delimited with |. 84 | 85 | 86 | 87 | 88 | The order of preloaded assemblies, delimited with |. 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. 97 | 98 | 99 | 100 | 101 | A comma-separated list of error codes that can be safely ignored in assembly verification. 102 | 103 | 104 | 105 | 106 | 'false' to turn off automatic generation of the XML Schema file. 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/GUI/Workshop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Runtime.InteropServices; 5 | using System.Windows.Forms; 6 | using Pustalorc.Applications.USM.Constants; 7 | using Pustalorc.Applications.USM.File_Control; 8 | using Pustalorc.Applications.USM.SteamCMD_Manager; 9 | 10 | // ReSharper disable UnusedVariable 11 | 12 | namespace Pustalorc.Applications.USM.GUI 13 | { 14 | internal sealed partial class Workshop : Form 15 | { 16 | private readonly string _server; 17 | private bool _controlChange; 18 | private string _itemId = ""; 19 | 20 | public Workshop(string serverPath) 21 | { 22 | InitializeComponent(); 23 | _server = serverPath; 24 | LoadInstalled(); 25 | } 26 | 27 | // Custom Methods 28 | private void LoadInstalled() 29 | { 30 | AlreadyInstalled.Items.Clear(); 31 | var workshopLocation = Path.Combine(_server, "Workshop", "Content"); 32 | FileActions.VerifyPath(workshopLocation, true); 33 | 34 | var folder = new DirectoryInfo(workshopLocation); 35 | var content = folder.GetDirectories(); 36 | foreach (var item in content) 37 | AlreadyInstalled.Items.Add(item.Name); 38 | 39 | workshopLocation = Path.Combine(_server, "Workshop", "Maps"); 40 | FileActions.VerifyPath(workshopLocation, true); 41 | 42 | folder = new DirectoryInfo(workshopLocation); 43 | content = folder.GetDirectories(); 44 | foreach (var item in content) 45 | AlreadyInstalled.Items.Add(item.Name); 46 | 47 | if (AlreadyInstalled.Items.Count == 0) 48 | { 49 | Delete.Enabled = false; 50 | View.Enabled = false; 51 | UpdateAll.Enabled = false; 52 | DeleteAll.Enabled = false; 53 | _itemId = ""; 54 | } 55 | else 56 | { 57 | AlreadyInstalled.SelectedIndex = 0; 58 | UpdateAll.Enabled = true; 59 | DeleteAll.Enabled = true; 60 | } 61 | } 62 | 63 | // Control Events 64 | private void Exit_Click(object sender, EventArgs e) 65 | { 66 | Close(); 67 | } 68 | 69 | private void DeleteAll_Click(object sender, EventArgs e) 70 | { 71 | FileActions.DeleteDirectory(Path.Combine(_server, "Workshop")); 72 | LoadInstalled(); 73 | } 74 | 75 | private void View_Click(object sender, EventArgs e) 76 | { 77 | if (!string.IsNullOrEmpty(_itemId)) 78 | Process.Start($"https://steamcommunity.com/workshop/filedetails/?id={_itemId}"); 79 | } 80 | 81 | private void UpdateAll_Click(object sender, EventArgs e) 82 | { 83 | Hide(); 84 | if (AlreadyInstalled.Items.Count > 0) 85 | foreach (string s in AlreadyInstalled.Items) 86 | { 87 | SteamCmd.RunCommand( 88 | (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) 89 | ? $"+force_install_dir \"{ServerPath.Value}\" " 90 | : "") + $"+workshop_download_item 304930 {ID.Text} +quit"); 91 | SteamCmd.MoveWorkshopFolder(s, Path.Combine(_server, "Workshop")); 92 | } 93 | 94 | LoadInstalled(); 95 | Show(); 96 | } 97 | 98 | private void Delete_Click(object sender, EventArgs e) 99 | { 100 | if (!string.IsNullOrEmpty(_itemId)) 101 | { 102 | FileActions.DeleteDirectory(Path.Combine(_server, "Workshop", "Content", _itemId)); 103 | FileActions.DeleteDirectory(Path.Combine(_server, "Workshop", "Maps", _itemId)); 104 | } 105 | 106 | LoadInstalled(); 107 | } 108 | 109 | private void InstallID_Click(object sender, EventArgs e) 110 | { 111 | Hide(); 112 | if (!string.IsNullOrEmpty(ID.Text)) 113 | { 114 | SteamCmd.RunCommand( 115 | (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) 116 | ? $"+force_install_dir \"{ServerPath.Value}\" " 117 | : "") + $"+workshop_download_item 304930 {ID.Text} +quit"); 118 | SteamCmd.MoveWorkshopFolder(ID.Text, Path.Combine(_server, "Workshop")); 119 | } 120 | 121 | LoadInstalled(); 122 | Show(); 123 | } 124 | 125 | private void AlreadyInstalled_SelectedIndexChanged(object sender, EventArgs e) 126 | { 127 | if (AlreadyInstalled.SelectedItem != null) 128 | { 129 | Delete.Enabled = true; 130 | View.Enabled = true; 131 | _itemId = (string) AlreadyInstalled.SelectedItem; 132 | } 133 | else 134 | { 135 | Delete.Enabled = false; 136 | View.Enabled = false; 137 | _itemId = ""; 138 | } 139 | } 140 | 141 | private void ID_TextChanged(object sender, EventArgs e) 142 | { 143 | if (!_controlChange) 144 | Link.Text = $@"https://steamcommunity.com/sharedfiles/filedetails/?id={ID.Text}"; 145 | } 146 | 147 | private void Link_TextChanged(object sender, EventArgs e) 148 | { 149 | _controlChange = true; 150 | ID.Text = ""; 151 | 152 | if (Link.Text.StartsWith("https://steamcommunity.com/sharedfiles/filedetails/?id=", 153 | StringComparison.Ordinal)) 154 | { 155 | var id = Link.Text.Substring("https://steamcommunity.com/sharedfiles/filedetails/?id=".Length); 156 | 157 | var iid = ""; 158 | foreach (var c in id) 159 | if (ulong.TryParse("" + c, out var n)) 160 | iid += c; 161 | else 162 | break; 163 | 164 | if (ulong.TryParse(iid, out var uid)) 165 | ID.Text = iid; 166 | } 167 | else if (Link.Text.StartsWith("https://steamcommunity.com/workshop/filedetails/?id=", 168 | StringComparison.Ordinal)) 169 | { 170 | var id = Link.Text.Substring("https://steamcommunity.com/workshop/filedetails/?id=".Length); 171 | 172 | var iid = ""; 173 | foreach (var c in id) 174 | if (ulong.TryParse("" + c, out var n)) 175 | iid += c; 176 | else 177 | break; 178 | 179 | if (ulong.TryParse(iid, out var uid)) 180 | ID.Text = iid; 181 | } 182 | 183 | _controlChange = false; 184 | } 185 | } 186 | } -------------------------------------------------------------------------------- /src/GUI/Plugin Download.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace Pustalorc.Applications.USM.GUI 5 | { 6 | internal sealed partial class Plugin 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Plugin)); 35 | this.DeleteAll = new System.Windows.Forms.Button(); 36 | this.AlreadyInstalledDesc = new System.Windows.Forms.Label(); 37 | this.Exit = new System.Windows.Forms.Button(); 38 | this.Configuration = new System.Windows.Forms.Button(); 39 | this.AlreadyInstalled = new System.Windows.Forms.ListBox(); 40 | this.Delete = new System.Windows.Forms.Button(); 41 | this.Install = new System.Windows.Forms.Button(); 42 | this.OpenZip = new System.Windows.Forms.OpenFileDialog(); 43 | this.SuspendLayout(); 44 | // 45 | // DeleteAll 46 | // 47 | this.DeleteAll.Location = new System.Drawing.Point(15, 334); 48 | this.DeleteAll.Name = "DeleteAll"; 49 | this.DeleteAll.Size = new System.Drawing.Size(61, 23); 50 | this.DeleteAll.TabIndex = 37; 51 | this.DeleteAll.Text = "Delete All"; 52 | this.DeleteAll.UseVisualStyleBackColor = true; 53 | this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click); 54 | // 55 | // AlreadyInstalledDesc 56 | // 57 | this.AlreadyInstalledDesc.AutoSize = true; 58 | this.AlreadyInstalledDesc.Location = new System.Drawing.Point(12, 9); 59 | this.AlreadyInstalledDesc.Name = "AlreadyInstalledDesc"; 60 | this.AlreadyInstalledDesc.Size = new System.Drawing.Size(124, 13); 61 | this.AlreadyInstalledDesc.TabIndex = 35; 62 | this.AlreadyInstalledDesc.Text = "Plugins Already Installed:"; 63 | // 64 | // Exit 65 | // 66 | this.Exit.Location = new System.Drawing.Point(386, 334); 67 | this.Exit.Name = "Exit"; 68 | this.Exit.Size = new System.Drawing.Size(37, 23); 69 | this.Exit.TabIndex = 30; 70 | this.Exit.Text = "Exit"; 71 | this.Exit.UseVisualStyleBackColor = true; 72 | this.Exit.Click += new System.EventHandler(this.Exit_Click); 73 | // 74 | // Configuration 75 | // 76 | this.Configuration.Location = new System.Drawing.Point(272, 334); 77 | this.Configuration.Name = "Configuration"; 78 | this.Configuration.Size = new System.Drawing.Size(108, 23); 79 | this.Configuration.TabIndex = 39; 80 | this.Configuration.Text = "Open Configuration"; 81 | this.Configuration.UseVisualStyleBackColor = true; 82 | this.Configuration.Click += new System.EventHandler(this.Configuration_Click); 83 | // 84 | // AlreadyInstalled 85 | // 86 | this.AlreadyInstalled.FormattingEnabled = true; 87 | this.AlreadyInstalled.Location = new System.Drawing.Point(15, 25); 88 | this.AlreadyInstalled.Name = "AlreadyInstalled"; 89 | this.AlreadyInstalled.Size = new System.Drawing.Size(408, 303); 90 | this.AlreadyInstalled.TabIndex = 40; 91 | this.AlreadyInstalled.SelectedIndexChanged += new System.EventHandler(this.AlreadyInstalled_SelectedIndexChanged); 92 | // 93 | // Delete 94 | // 95 | this.Delete.Location = new System.Drawing.Point(82, 334); 96 | this.Delete.Name = "Delete"; 97 | this.Delete.Size = new System.Drawing.Size(92, 23); 98 | this.Delete.TabIndex = 41; 99 | this.Delete.Text = "Delete Selected"; 100 | this.Delete.UseVisualStyleBackColor = true; 101 | this.Delete.Click += new System.EventHandler(this.Delete_Click); 102 | // 103 | // Install 104 | // 105 | this.Install.Location = new System.Drawing.Point(180, 334); 106 | this.Install.Name = "Install"; 107 | this.Install.Size = new System.Drawing.Size(86, 23); 108 | this.Install.TabIndex = 42; 109 | this.Install.Text = "Install From Zip"; 110 | this.Install.UseVisualStyleBackColor = true; 111 | this.Install.Click += new System.EventHandler(this.Install_Click); 112 | // 113 | // OpenZip 114 | // 115 | this.OpenZip.DefaultExt = "dll"; 116 | this.OpenZip.Filter = "\"Compressed (zipped) Folder\" (*.zip)|*.zip"; 117 | this.OpenZip.RestoreDirectory = true; 118 | // 119 | // Plugin 120 | // 121 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 122 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 123 | this.BackColor = System.Drawing.SystemColors.Control; 124 | this.ClientSize = new System.Drawing.Size(441, 374); 125 | this.Controls.Add(this.Install); 126 | this.Controls.Add(this.Delete); 127 | this.Controls.Add(this.AlreadyInstalled); 128 | this.Controls.Add(this.Configuration); 129 | this.Controls.Add(this.DeleteAll); 130 | this.Controls.Add(this.AlreadyInstalledDesc); 131 | this.Controls.Add(this.Exit); 132 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 133 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 134 | this.MaximizeBox = false; 135 | this.MinimizeBox = false; 136 | this.Name = "Plugin"; 137 | this.ShowIcon = false; 138 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 139 | this.Text = "Plugin Installer"; 140 | this.ResumeLayout(false); 141 | this.PerformLayout(); 142 | 143 | } 144 | 145 | #endregion 146 | private Button DeleteAll; 147 | private Label AlreadyInstalledDesc; 148 | private Button Exit; 149 | private Button Configuration; 150 | private ListBox AlreadyInstalled; 151 | private Button Delete; 152 | private Button Install; 153 | private OpenFileDialog OpenZip; 154 | } 155 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ----------- Unturned Server Manager ----------- 2 | 3 | Version: Public 4.0.1.2 4 | 5 | [![Github Releases](https://img.shields.io/github/downloads/Pustalorc/UnturnedServerManager/latest/total.svg?style=plastic)](https://github.com/Pustalorc/UnturnedServerManager/releases/latest) 6 | 7 | # Requirements: 8 | 9 | [.Net Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) or later versions 10 | 11 | Windows or Linux 12 | 13 | # Download: 14 | 15 | [Releases](https://github.com/Pustalorc/UnturnedServerManager/releases/latest) 16 | 17 | # Changelog: 18 | 19 | **V4.0.1.2** - 20 | * Rocketmod shut their dedicated machines down. "Latest" rocketmod version is now permanently [#1363](https://github.com/RocketMod/Rocket.Unturned/releases/tag/4.9.3.0) 21 | * Modified update menu to work correctly without rocketmod versions. 22 | 23 | **V4.0.1.1** - 24 | * Updated .NET Framework to 4.8 25 | * Updated packages to latest versions 26 | 27 | **V4.0.1.0** - 28 | * Added Try Catch to prevent crashing when retrieving RocketMod's latest build if it isn't available. 29 | * Added a message when downloading rocketmod fails. 30 | * Added support to run SteamCMD on Linux without checking if it exists (See Linux install wiki) 31 | * Added support to startup a server on Linux by using ServerHelper.sh that comes with 1110390. 32 | * Added minor console logging for startup/shutdown of a server since 1110390 doesn't have fully functional console output in Linux. 33 | * Added install check support for Linux (verifying that Unturned_Headless.x86_64 exists). 34 | * Added a limit to how many times verification of the installation happens (Previously unlimited, now only 10 tries). 35 | * Updated packages to latest versions. 36 | * Changed APPID download from 304930 (Unturned) to 1110390 (Unturned Dedicated Server Tool) 37 | * Changed initial message to not mention 10GB required, and instead mention 3GB minimum. (U3DS is small in comparison to the base game) 38 | * Changed all links from my previous username to my current username. 39 | * Removed Steam Login (1110390 can be downloaded with Anonymous steam login) 40 | * Removed tracking of unturned version, instead using DateTime to figure out when was the last update done at. 41 | * Removed unneeded Memory.Servers and moved its use to Loading.Servers. 42 | * Removed all in-software icons (current incompatibility with Linux) 43 | * Fixed server cloning not copying over the settings. 44 | * Fixed changing settings not applying to the server. 45 | * Fixed unable to create servers with a space in their name. 46 | * Fixed any possible errors during download from crashing the program. 47 | * Fixed all paths to use a normal slash instead of a backwards slash (Compatibility with Linux) 48 | * Fixed GameConfiguration.cs for JSON (Was using fields, now uses properties) 49 | 50 | **V4.0.0.2** - 51 | * Removed vanilla server option due to high disk usage. 52 | * Fixed updating menu crashing the application. 53 | * Code Cleanup (Jetbrains Rider) 54 | 55 | **V4.0.0.1** - 56 | * Fixed raised exception when leaving the map field empty in the server configuration, saving and loading it again. (Credit to Luke_ArOres#0769 for finding it) 57 | * Fixed forgotten addition of auto-detection of workshop maps. (Credit to Luke_ArOres#0769 for reminding of this issue) 58 | * Fixed minor issue when loading maps for a vanilla server. 59 | * Updated Fody and Costura.Fody to latest versions. 60 | 61 | **V4.0.0.0** - 62 | 63 | * Added more local control over server instances. 64 | * Added filesystem control. 65 | * Added constants file. 66 | * Added steam login. 67 | * Added Costura.Fody so that no referenced libraries are required next to the executable 68 | * Improved plugin installer. 69 | * Improved workshop installer. 70 | * Improved design for the manager. 71 | * Improved installation checking. 72 | * Improved the entry for clean loading. 73 | * Improved back-end downloading + Updating. 74 | * Improved form controls for the server settings. 75 | * Improved saved configuration files to json formatted files. 76 | * Changed version retreival from github file to custom build numbers. 77 | * Changed background colour to "Control" from FF0000. 78 | * Removed project signing (due to Costura.Fody issues). 79 | * Removed self-version checking. 80 | * Removed logging. 81 | * Fixed updating issues. 82 | * Cleaned up & organised code. 83 | 84 | **V3.0.1.4** - 85 | 86 | * Fixed A Problem With The Updater Tool GUI Displaying + Storing The Wrong Version Values. 87 | 88 | **V3.0.1.3** - 89 | 90 | * Fixed The Ability To Launch More Than 1 Instance Of USM. 91 | * Fixed TickTimer Form Showing When Doing Alt+Tab. 92 | 93 | **V3.0.1.2** - 94 | 95 | * Fixed A Problem With Plugin Integrity Update. 96 | 97 | **V3.0.1.1** - 98 | 99 | * Fixed The Ability To Resize The Updater Tool. 100 | * Fixed The Startup Position Of The Server Settings Tool And Updater Tool. 101 | * Re-Added USMVer.dat File To Notify Old Versions Of New Update. 102 | 103 | **V3.0.1.0** - 104 | 105 | * Fixed The Inability To Change The Server Path From GUI. 106 | * Fixed Inability To Start Program Again After Force Shutdown/Crash. 107 | * Fixed Plugin Lists And Download. 108 | * Fixed Unturned Version Not Updating On GUI With "Update All". 109 | * Fixed Unknown DLL Files When Installing Some Plugins. 110 | * Fixed Way To Download Data Files. 111 | * Fixed The Bug With Using A Link In The Install By ID. 112 | * Changed Unturned Updater Redirector. 113 | * Added Versions.zip And Plugins.zip To Data Folder. 114 | * Added .GitIgnore To Upload The Code Easier Without The Loss Of Local Data. 115 | * Removed USM.exe, PIVer.dat, Plugins.dat, PluginsDl.dat, PluginsPage.dat, RocVer.dat, UntVer.dat And USMVer.dat From Data Folder. 116 | 117 | **V3.0.0.5** - 118 | 119 | * Fixed Multiple Bugs With The Workshop Install Tool. 120 | * Fixed Logger. 121 | * Fixed Unturned Install. 122 | * Fixed "Update All" Workshop Items Bug. 123 | * Fixed Install By Id Workshop Items Bug. 124 | * Changed Unturned Install Method. 125 | 126 | **V3.0.0.4** - 127 | 128 | * Fixed Unable To Start Program In Offline Mode 129 | * Fixed Bug When Puting A Non-Directory Link In Workshop Installer. 130 | * Fixed Multiple Bugs With The Unturned Updater. 131 | * Removed Comment About Unturned Updating Being Disabled. 132 | * Enabled/Added Unturned Update Option. 133 | * Added Option To Install Workshop Items By Item ID. 134 | * Added "Update All" Button To Workshop Installer. 135 | * Added Logger & System Logging To Log.txt. 136 | * Changed Background Color To All Forms. 137 | 138 | **V3.0.0.3** - 139 | 140 | * Fixed Updater. 141 | * Fixed Few Errors With Plugin Installer. 142 | * Fixed Few Errors With Downloader.cs. 143 | * Fixed Per-Server Saving Issue. 144 | * Fixed Issue With Plugin Management Button Being Active After Server Launch. 145 | * Fixed Issue With Not Setting Difficulty. 146 | * Changed Server ID Managing. 147 | * Removed Github File Rocket_Latest.zip - Changed To Rocket Direct Download Link. 148 | 149 | **V3.0.0.2** - 150 | 151 | * Fixed An Error With The Versions.dat File. 152 | 153 | **V3.0.0.1** - 154 | 155 | * Fixed An Error When Launching The Updater Tool. 156 | * Fixed A Bug Returning An Exception When Loading The Plugin Installer Without The PI Files. 157 | * Added A Loop To Check If Rocket Is Installed, If It Isn't Plugin Install Is Disabled. 158 | 159 | **V3.0.0.0** - 160 | 161 | * Fixed Issue With Gold Mode. 162 | * Fixed Rocket Installation Freezing. 163 | * Fixed Rocket Updating. 164 | * Fixed/Added Ease of install for plugins. 165 | * Fixed Bug With Workshop Item IDs Not Displaying. 166 | * Fixed Per-Server SRS. 167 | * Added Full Updater. 168 | * Added Plugin Integrity files to include downloads and web pages to working plugins and their names. 169 | * Added System Tray Icon. 170 | * Added Local Server Configuration Files. 171 | * Added Button To Open Selected Workshop Items In Browser. 172 | * Disabled Unturned Updating For A Future, Much Better Update. 173 | * Removed Rocket Updating Animation. 174 | * Removed Global SRS. 175 | * Removed Rocket Libraries. 176 | * Changed User Interface. 177 | * Changed Max servers from 4 to 100. 178 | * Changed USM.lock file position. 179 | * Changed Per-Server SRS Limiters. 180 | * Changed Self-Version Checking Feature To The Full Updater + Notification. 181 | * Changed USM Configuration File. 182 | 183 | **V2.0.1.0** - 184 | 185 | * Changed How Rocket Install Works Due To Rocket Changing Their Builds And How They Function (Fully explained here: https://rocketmod.net/viewtopic.php?f=44&t=2961). 186 | * Added Small Self-Version Checking Feature. Will Be Improved In Expected 3.0.0.0 Release. 187 | 188 | **V2.0.0.0** - 189 | 190 | * Added Link To Reddit Post. 191 | * Fixed SRS (Shutdown, Restart and Start) Buttons To Apply To The Servers That The Program Started Only. 192 | * Added Rocket Install, Workshop Install And Plugin Install (Plugin install is buggy!). 193 | * Added Per-Server SRS Features. 194 | 195 | **V1.0.0.1** - Added link to github page. 196 | 197 | ----------- Unturned Server Manager ----------- 198 | -------------------------------------------------------------------------------- /src/GUI/Manager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Windows.Forms; 5 | using Pustalorc.Applications.USM.Configuration; 6 | using Pustalorc.Applications.USM.File_Control; 7 | 8 | namespace Pustalorc.Applications.USM.GUI 9 | { 10 | internal sealed partial class Manager : Form 11 | { 12 | private bool _otherGuiOpen; 13 | private bool _reloaded; 14 | private string _selectedServer = ""; 15 | 16 | public Manager() 17 | { 18 | InitializeComponent(); 19 | 20 | BuildNotifyMenu(); 21 | Notifier.Visible = true; 22 | 23 | LoadServers(); 24 | } 25 | 26 | // Custom methods. 27 | private void BuildNotifyMenu() 28 | { 29 | var menu = new ContextMenu(); 30 | var exit = new MenuItem(); 31 | var wiki = new MenuItem(); 32 | var issues = new MenuItem(); 33 | menu.MenuItems.AddRange(new[] {exit, wiki, issues}); 34 | exit.Index = 0; 35 | exit.Text = @"Exit"; 36 | exit.Click += Exit_Click; 37 | wiki.Index = 0; 38 | wiki.Text = @"Wiki"; 39 | wiki.Click += Github_Click; 40 | issues.Index = 0; 41 | issues.Text = @"Issues And Suggestions"; 42 | issues.Click += Issues_Click; 43 | Notifier.ContextMenu = menu; 44 | } 45 | 46 | private void LoadServers() 47 | { 48 | _reloaded = true; 49 | 50 | Servers.Items.Clear(); 51 | 52 | foreach (var s in Loading.Servers.RegisteredServers) 53 | Servers.Items.Add(s.Name); 54 | 55 | if (Servers.Items.Count == 0) 56 | { 57 | ToggleServerElements(false); 58 | ServerSettings.Text = ""; 59 | } 60 | else 61 | { 62 | ToggleServerElements(true); 63 | Servers.SelectedIndex = 0; 64 | 65 | _selectedServer = (string) Servers.SelectedItem; 66 | 67 | LoadServerDetails(); 68 | } 69 | 70 | _reloaded = false; 71 | } 72 | 73 | private void ToggleServerElements(bool status) 74 | { 75 | Settings.Enabled = status; 76 | ServerSettings.Enabled = status; 77 | Toggle.Enabled = status; 78 | OpenLocal.Enabled = status; 79 | Restart.Enabled = false; 80 | Reset.Enabled = status; 81 | Workshop.Enabled = status; 82 | Plugin.Enabled = status; 83 | DeleteServer.Enabled = status; 84 | CloneServer.Enabled = status; 85 | } 86 | 87 | private void LoadServerDetails() 88 | { 89 | ServerSettings.Text = GameConfiguration.Load(_selectedServer).ToString(); 90 | 91 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 92 | if (server == null) return; 93 | 94 | Restart.Enabled = server.IsRunning; 95 | } 96 | 97 | // Notification tray actions. 98 | private void Notifier_MouseDoubleClick(object sender, MouseEventArgs e) 99 | { 100 | if (_otherGuiOpen) return; 101 | 102 | if (Visible) 103 | Hide(); 104 | else 105 | Show(); 106 | } 107 | 108 | private static void Exit_Click(object sender, EventArgs e) 109 | { 110 | Application.Exit(); 111 | } 112 | 113 | private static void Github_Click(object sender, EventArgs e) 114 | { 115 | Process.Start("https://github.com/pustalorc/UnturnedServerManager/wiki"); 116 | } 117 | 118 | private static void Issues_Click(object sender, EventArgs e) 119 | { 120 | Process.Start("https://github.com/pustalorc/UnturnedServerManager/issues"); 121 | } 122 | 123 | // Form events. 124 | private void GithubLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 125 | { 126 | Process.Start("https://github.com/pustalorc/UnturnedServerManager/"); 127 | } 128 | 129 | private void LinkMe_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 130 | { 131 | Process.Start("https://pustalorc.github.io/"); 132 | } 133 | 134 | private void Settings_Click(object sender, EventArgs e) 135 | { 136 | _otherGuiOpen = true; 137 | Hide(); 138 | 139 | var f = new ConstConfig(_selectedServer); 140 | f.ShowDialog(); 141 | 142 | Show(); 143 | _otherGuiOpen = false; 144 | LoadServerDetails(); 145 | } 146 | 147 | private void Updater_Click(object sender, EventArgs e) 148 | { 149 | _otherGuiOpen = true; 150 | Hide(); 151 | 152 | var f = new UpdateMenu(); 153 | f.ShowDialog(); 154 | 155 | Show(); 156 | _otherGuiOpen = false; 157 | } 158 | 159 | private void Workshop_Click(object sender, EventArgs e) 160 | { 161 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 162 | if (server == null) return; 163 | 164 | _otherGuiOpen = true; 165 | Hide(); 166 | 167 | var f = new Workshop(server.Folder); 168 | f.ShowDialog(); 169 | 170 | Show(); 171 | _otherGuiOpen = false; 172 | } 173 | 174 | private void Plugin_Click(object sender, EventArgs e) 175 | { 176 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 177 | if (server == null) return; 178 | 179 | _otherGuiOpen = true; 180 | Hide(); 181 | 182 | var f = new Plugin(server.Folder); 183 | f.ShowDialog(); 184 | 185 | Show(); 186 | _otherGuiOpen = false; 187 | } 188 | 189 | private void Restart_Click(object sender, EventArgs e) 190 | { 191 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 192 | server?.Restart(); 193 | } 194 | 195 | private void Toggle_Click(object sender, EventArgs e) 196 | { 197 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 198 | if (server == null) return; 199 | 200 | if (server.IsRunning) 201 | { 202 | Restart.Enabled = false; 203 | server.Shutdown(); 204 | } 205 | else 206 | { 207 | Restart.Enabled = true; 208 | server.Start(); 209 | } 210 | } 211 | 212 | private void Reset_Click(object sender, EventArgs e) 213 | { 214 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 215 | if (server == null) return; 216 | 217 | FileActions.DeleteDirectory(Path.Combine(server.Folder, "Players")); 218 | FileActions.DeleteDirectory(Path.Combine(server.Folder, "Level")); 219 | } 220 | 221 | private void NewServer_Click(object sender, EventArgs e) 222 | { 223 | _otherGuiOpen = true; 224 | Hide(); 225 | 226 | var f = new AddServer(); 227 | f.ShowDialog(); 228 | 229 | Show(); 230 | _otherGuiOpen = false; 231 | LoadServers(); 232 | } 233 | 234 | private void OpenLocal_Click(object sender, EventArgs e) 235 | { 236 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 237 | if (server != null) 238 | Process.Start(server.Folder); 239 | } 240 | 241 | private void CloneServer_Click(object sender, EventArgs e) 242 | { 243 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 244 | if (server == null) return; 245 | 246 | _otherGuiOpen = true; 247 | Hide(); 248 | 249 | var f = new AddServer(server.Folder); 250 | f.ShowDialog(); 251 | 252 | GameConfiguration.Clone(server.Name, f.ServerName.Text); 253 | 254 | Show(); 255 | _otherGuiOpen = false; 256 | LoadServers(); 257 | } 258 | 259 | private void DeleteServer_Click(object sender, EventArgs e) 260 | { 261 | var server = Loading.Servers.RegisteredServers.Find(k => k.Name == _selectedServer); 262 | if (server?.IsRunning == true) 263 | server.Shutdown(); 264 | 265 | server?.Delete(); 266 | 267 | LoadServers(); 268 | } 269 | 270 | private void Servers_SelectedIndexChanged(object sender, EventArgs e) 271 | { 272 | if (_reloaded) return; 273 | 274 | _selectedServer = (string) Servers.SelectedItem; 275 | 276 | LoadServerDetails(); 277 | } 278 | } 279 | } -------------------------------------------------------------------------------- /src/Manager.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {2D1DCD0A-9719-44F5-8F0E-2FD79D918FB5} 9 | WinExe 10 | Properties 11 | Pustalorc.Applications.USM 12 | UnturnedServerManager 13 | v4.8 14 | 512 15 | true 16 | false 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | true 31 | 32 | 33 | 34 | latest 35 | 36 | 37 | AnyCPU 38 | true 39 | full 40 | false 41 | bin\Debug\ 42 | DEBUG;TRACE 43 | prompt 44 | 4 45 | 46 | 47 | AnyCPU 48 | pdbonly 49 | true 50 | bin\Release\ 51 | TRACE 52 | prompt 53 | 4 54 | 55 | 56 | 44193.ico 57 | 58 | 59 | false 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Form 74 | 75 | 76 | AddServer.cs 77 | 78 | 79 | Form 80 | 81 | 82 | FirstStart.cs 83 | 84 | 85 | 86 | Form 87 | 88 | 89 | ConstConfig.cs 90 | 91 | 92 | Form 93 | 94 | 95 | Manager.cs 96 | 97 | 98 | Form 99 | 100 | 101 | Plugin.cs 102 | 103 | 104 | 105 | 106 | 107 | Form 108 | 109 | 110 | UpdateMenu.cs 111 | 112 | 113 | 114 | 115 | Form 116 | 117 | 118 | Workshop.cs 119 | 120 | 121 | AddServer.cs 122 | 123 | 124 | FirstStart.cs 125 | 126 | 127 | ConstConfig.cs 128 | 129 | 130 | Manager.cs 131 | 132 | 133 | Plugin.cs 134 | 135 | 136 | UpdateMenu.cs 137 | 138 | 139 | Workshop.cs 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | False 155 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29 156 | true 157 | 158 | 159 | False 160 | .NET Framework 3.5 SP1 161 | false 162 | 163 | 164 | 165 | 166 | ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll 167 | 168 | 169 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 185 | 186 | 187 | 188 | 189 | 190 | 197 | -------------------------------------------------------------------------------- /src/GUI/ConstConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using Pustalorc.Applications.USM.Configuration; 6 | using Pustalorc.Applications.USM.Constants; 7 | using Pustalorc.Applications.USM.File_Control; 8 | using Pustalorc.Applications.USM.Loading; 9 | 10 | namespace Pustalorc.Applications.USM.GUI 11 | { 12 | internal sealed partial class ConstConfig : Form 13 | { 14 | private readonly string _targetServer; 15 | 16 | public ConstConfig(string serverName) 17 | { 18 | InitializeComponent(); 19 | 20 | _targetServer = serverName; 21 | 22 | LoadMaps(); 23 | LoadSaved(); 24 | } 25 | 26 | // Custom Methods 27 | private void LoadMaps() 28 | { 29 | var server = Servers.RegisteredServers.Find(k => k.Name == _targetServer); 30 | var dir = Path.Combine(ServerPath.Value, "Maps"); 31 | FileActions.VerifyPath(dir, true); 32 | 33 | var rocketModDirectoryInfo = new DirectoryInfo(dir); 34 | foreach (var rocketServer in rocketModDirectoryInfo.GetDirectories()) 35 | Maps.Items.Add(rocketServer.Name); 36 | 37 | var workshopMaps = Path.Combine(server.Folder, "Workshop", "Maps"); 38 | FileActions.VerifyPath(workshopMaps, true); 39 | 40 | var folder = new DirectoryInfo(workshopMaps); 41 | var content = folder.GetDirectories(); 42 | foreach (var mapName in content.SelectMany(item => item.GetDirectories())) 43 | Maps.Items.Add(mapName.Name); 44 | } 45 | 46 | private void Save() 47 | { 48 | var conf = GameConfiguration.Load(_targetServer); 49 | conf.PublicName = NameSel.Text.Length < 5 ? "Unturned" : NameSel.Text; 50 | conf.Port = (int) Port.Value; 51 | conf.Pvp = PvPOn.Checked; 52 | conf.Perspective = PerspFirstPer.Checked ? "First" : "Both"; 53 | conf.MaxPlayers = MaxPlayersVal1.Checked ? 8 : 54 | MaxPlayersVal2.Checked ? 16 : 55 | MaxPlayersVal3.Checked ? 24 : (int) MaxPlayers.Value; 56 | conf.Map = (string) Maps.SelectedItem; 57 | conf.Difficulty = DiffEasy.Checked ? "Easy" : DiffNormal.Checked ? "Normal" : "Hard"; 58 | conf.GoldMode = GoldTrue.Checked; 59 | conf.Cheats = CheatsOn.Checked; 60 | conf.Password = PasswordSel.Text; 61 | conf.QueueSize = QueueSize1.Checked ? 8 : 62 | QueueSize2.Checked ? 16 : 63 | QueueSize3.Checked ? 24 : (int) Queue.Value; 64 | conf.Owner = (long) OwnerID.Value; 65 | conf.LoginMessage = MessageSel.Text; 66 | conf.Sync = SyncOn.Checked; 67 | conf.Loadout = LoadoutSel.Text; 68 | conf.HideAdmins = HideAdTrue.Checked; 69 | conf.Bind = string.Join(".", 70 | new[] {(byte) IPField1.Value, (byte) IPField2.Value, (byte) IPField3.Value, (byte) IPField4.Value}); 71 | conf.Filter = FilterOn.Checked; 72 | conf.Cycle = Cycle1.Checked ? 43200 : (int) Cycle.Value; 73 | conf.ChatRate = Rate1.Checked ? 0 : (int) ChatRate.Value; 74 | conf.SaveJson(); 75 | 76 | var commandsDat = Path.Combine(ServerPath.Value, "Servers", _targetServer, "Server", "Commands.dat"); 77 | FileActions.VerifyFilePath(commandsDat, true); 78 | File.WriteAllLines(commandsDat, conf.ToNelson); 79 | 80 | Close(); 81 | } 82 | 83 | private void LoadSaved() 84 | { 85 | var conf = GameConfiguration.Load(_targetServer); 86 | 87 | var bindBytes = conf.Bind.Split('.').ToList().ConvertAll(k => 88 | { 89 | if (byte.TryParse(k, out var r)) 90 | return r; 91 | 92 | return (byte) 0; 93 | }); 94 | IPField1.Value = bindBytes[0]; 95 | IPField2.Value = bindBytes[1]; 96 | IPField3.Value = bindBytes[2]; 97 | IPField4.Value = bindBytes[3]; 98 | 99 | NameSel.Text = conf.PublicName; 100 | Port.Value = conf.Port; 101 | 102 | Maps.SelectedIndex = string.IsNullOrEmpty(conf.Map) ? 0 : Maps.Items.IndexOf(conf.Map); 103 | 104 | PasswordSel.Text = conf.Password; 105 | OwnerID.Value = conf.Owner; 106 | MessageSel.Text = conf.LoginMessage; 107 | LoadoutSel.Text = conf.Loadout; 108 | 109 | if (conf.Pvp) 110 | PvPOn.Checked = true; 111 | else 112 | PvPOff.Checked = true; 113 | 114 | if (conf.GoldMode) 115 | GoldTrue.Checked = true; 116 | else 117 | GoldFalse.Checked = true; 118 | 119 | if (conf.Cheats) 120 | CheatsOn.Checked = true; 121 | else 122 | CheatsOff.Checked = true; 123 | 124 | if (conf.Sync) 125 | SyncOn.Checked = true; 126 | else 127 | SyncOff.Checked = true; 128 | 129 | if (conf.HideAdmins) 130 | HideAdTrue.Checked = true; 131 | else 132 | HideAdFalse.Checked = true; 133 | 134 | if (conf.Filter) 135 | FilterOn.Checked = true; 136 | else 137 | FilterOff.Checked = true; 138 | 139 | switch (conf.Perspective) 140 | { 141 | case "First": 142 | PerspFirstPer.Checked = true; 143 | break; 144 | case "Both": 145 | PerspBoth.Checked = true; 146 | break; 147 | default: 148 | PerspBoth.Checked = true; 149 | break; 150 | } 151 | 152 | switch (conf.Difficulty) 153 | { 154 | case "Easy": 155 | DiffEasy.Checked = true; 156 | break; 157 | case "Normal": 158 | DiffNormal.Checked = true; 159 | break; 160 | case "Hard": 161 | DiffHard.Checked = true; 162 | break; 163 | default: 164 | DiffNormal.Checked = true; 165 | break; 166 | } 167 | 168 | if (conf.Cycle == 43200) 169 | { 170 | Cycle1.Checked = true; 171 | } 172 | else 173 | { 174 | Cycle2.Checked = true; 175 | Cycle.Enabled = true; 176 | Cycle.Value = conf.Cycle; 177 | } 178 | 179 | if (conf.ChatRate == 0) 180 | { 181 | Rate1.Checked = true; 182 | } 183 | else 184 | { 185 | Rate2.Checked = true; 186 | ChatRate.Enabled = true; 187 | ChatRate.Value = conf.ChatRate; 188 | } 189 | 190 | switch (conf.QueueSize) 191 | { 192 | case 8: 193 | QueueSize1.Checked = true; 194 | break; 195 | case 16: 196 | QueueSize2.Checked = true; 197 | break; 198 | case 24: 199 | QueueSize3.Checked = true; 200 | break; 201 | default: 202 | QueueSize4.Checked = true; 203 | Queue.Enabled = true; 204 | Queue.Value = conf.QueueSize; 205 | break; 206 | } 207 | 208 | switch (conf.MaxPlayers) 209 | { 210 | case 8: 211 | MaxPlayersVal1.Checked = true; 212 | break; 213 | case 16: 214 | MaxPlayersVal2.Checked = true; 215 | break; 216 | case 24: 217 | MaxPlayersVal3.Checked = true; 218 | break; 219 | default: 220 | MaxPlayersVal4.Checked = true; 221 | MaxPlayers.Enabled = true; 222 | MaxPlayers.Value = conf.MaxPlayers; 223 | break; 224 | } 225 | } 226 | 227 | // Control Update Methods 228 | private void QueueChange() 229 | { 230 | if (QueueSize1.Checked || QueueSize2.Checked || QueueSize3.Checked) 231 | Queue.Enabled = false; 232 | else if (QueueSize4.Checked) 233 | Queue.Enabled = true; 234 | } 235 | 236 | private void CycleChange() 237 | { 238 | if (Cycle1.Checked) 239 | Cycle.Enabled = false; 240 | else if (Cycle2.Checked) 241 | Cycle.Enabled = true; 242 | } 243 | 244 | private void MaxPlayersChange() 245 | { 246 | if (MaxPlayersVal1.Checked || MaxPlayersVal2.Checked || MaxPlayersVal3.Checked) 247 | MaxPlayers.Enabled = false; 248 | else if (MaxPlayersVal4.Checked) 249 | MaxPlayers.Enabled = true; 250 | } 251 | 252 | private void ChatChange() 253 | { 254 | if (Rate1.Checked) 255 | ChatRate.Enabled = false; 256 | else if (Rate2.Checked) 257 | ChatRate.Enabled = true; 258 | } 259 | 260 | // Control Events 261 | private void Exit_Click(object sender, EventArgs e) 262 | { 263 | Save(); 264 | } 265 | 266 | private void MaxPlayers_CheckedChanged(object sender, EventArgs e) 267 | { 268 | MaxPlayersChange(); 269 | } 270 | 271 | private void QueueSize_CheckedChanged(object sender, EventArgs e) 272 | { 273 | QueueChange(); 274 | } 275 | 276 | private void Rate_CheckedChanged(object sender, EventArgs e) 277 | { 278 | ChatChange(); 279 | } 280 | 281 | private void Cycle_CheckedChanged(object sender, EventArgs e) 282 | { 283 | CycleChange(); 284 | } 285 | } 286 | } -------------------------------------------------------------------------------- /src/GUI/Workshop Download.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace Pustalorc.Applications.USM.GUI 5 | { 6 | internal sealed partial class Workshop 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Workshop)); 35 | this.DeleteAll = new System.Windows.Forms.Button(); 36 | this.AlreadyInstalledDesc = new System.Windows.Forms.Label(); 37 | this.Exit = new System.Windows.Forms.Button(); 38 | this.Desc1 = new System.Windows.Forms.Label(); 39 | this.ID = new System.Windows.Forms.TextBox(); 40 | this.Desc2 = new System.Windows.Forms.Label(); 41 | this.Desc3 = new System.Windows.Forms.Label(); 42 | this.Desc4 = new System.Windows.Forms.Label(); 43 | this.Link = new System.Windows.Forms.TextBox(); 44 | this.InstallID = new System.Windows.Forms.Button(); 45 | this.UpdateAll = new System.Windows.Forms.Button(); 46 | this.Delete = new System.Windows.Forms.Button(); 47 | this.View = new System.Windows.Forms.Button(); 48 | this.AlreadyInstalled = new System.Windows.Forms.ListBox(); 49 | this.SuspendLayout(); 50 | // 51 | // DeleteAll 52 | // 53 | this.DeleteAll.Enabled = false; 54 | this.DeleteAll.Location = new System.Drawing.Point(12, 306); 55 | this.DeleteAll.Name = "DeleteAll"; 56 | this.DeleteAll.Size = new System.Drawing.Size(62, 23); 57 | this.DeleteAll.TabIndex = 24; 58 | this.DeleteAll.Text = "Delete All"; 59 | this.DeleteAll.UseVisualStyleBackColor = true; 60 | this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click); 61 | // 62 | // AlreadyInstalledDesc 63 | // 64 | this.AlreadyInstalledDesc.AutoSize = true; 65 | this.AlreadyInstalledDesc.Location = new System.Drawing.Point(12, 9); 66 | this.AlreadyInstalledDesc.Name = "AlreadyInstalledDesc"; 67 | this.AlreadyInstalledDesc.Size = new System.Drawing.Size(129, 13); 68 | this.AlreadyInstalledDesc.TabIndex = 22; 69 | this.AlreadyInstalledDesc.Text = "Installed Workshop Items:"; 70 | // 71 | // Exit 72 | // 73 | this.Exit.Location = new System.Drawing.Point(493, 306); 74 | this.Exit.Name = "Exit"; 75 | this.Exit.Size = new System.Drawing.Size(38, 23); 76 | this.Exit.TabIndex = 17; 77 | this.Exit.Text = "Exit"; 78 | this.Exit.UseVisualStyleBackColor = true; 79 | this.Exit.Click += new System.EventHandler(this.Exit_Click); 80 | // 81 | // Desc1 82 | // 83 | this.Desc1.AutoSize = true; 84 | this.Desc1.Location = new System.Drawing.Point(342, 9); 85 | this.Desc1.Name = "Desc1"; 86 | this.Desc1.Size = new System.Drawing.Size(189, 13); 87 | this.Desc1.TabIndex = 27; 88 | this.Desc1.Text = "Install By ID or link to steam workshop:"; 89 | // 90 | // ID 91 | // 92 | this.ID.Location = new System.Drawing.Point(378, 37); 93 | this.ID.Name = "ID"; 94 | this.ID.Size = new System.Drawing.Size(153, 20); 95 | this.ID.TabIndex = 28; 96 | this.ID.TextChanged += new System.EventHandler(this.ID_TextChanged); 97 | // 98 | // Desc2 99 | // 100 | this.Desc2.AutoSize = true; 101 | this.Desc2.Location = new System.Drawing.Point(342, 40); 102 | this.Desc2.Name = "Desc2"; 103 | this.Desc2.Size = new System.Drawing.Size(21, 13); 104 | this.Desc2.TabIndex = 29; 105 | this.Desc2.Text = "ID:"; 106 | // 107 | // Desc3 108 | // 109 | this.Desc3.AutoSize = true; 110 | this.Desc3.Location = new System.Drawing.Point(342, 72); 111 | this.Desc3.Name = "Desc3"; 112 | this.Desc3.Size = new System.Drawing.Size(23, 13); 113 | this.Desc3.TabIndex = 30; 114 | this.Desc3.Text = "OR"; 115 | // 116 | // Desc4 117 | // 118 | this.Desc4.AutoSize = true; 119 | this.Desc4.Location = new System.Drawing.Point(342, 103); 120 | this.Desc4.Name = "Desc4"; 121 | this.Desc4.Size = new System.Drawing.Size(30, 13); 122 | this.Desc4.TabIndex = 31; 123 | this.Desc4.Text = "Link:"; 124 | // 125 | // Link 126 | // 127 | this.Link.Location = new System.Drawing.Point(378, 100); 128 | this.Link.Name = "Link"; 129 | this.Link.Size = new System.Drawing.Size(153, 20); 130 | this.Link.TabIndex = 32; 131 | this.Link.TextChanged += new System.EventHandler(this.Link_TextChanged); 132 | // 133 | // InstallID 134 | // 135 | this.InstallID.Location = new System.Drawing.Point(432, 126); 136 | this.InstallID.Name = "InstallID"; 137 | this.InstallID.Size = new System.Drawing.Size(99, 23); 138 | this.InstallID.TabIndex = 33; 139 | this.InstallID.Text = "Install by id or link"; 140 | this.InstallID.UseVisualStyleBackColor = true; 141 | this.InstallID.Click += new System.EventHandler(this.InstallID_Click); 142 | // 143 | // UpdateAll 144 | // 145 | this.UpdateAll.Enabled = false; 146 | this.UpdateAll.Location = new System.Drawing.Point(80, 306); 147 | this.UpdateAll.Name = "UpdateAll"; 148 | this.UpdateAll.Size = new System.Drawing.Size(65, 23); 149 | this.UpdateAll.TabIndex = 34; 150 | this.UpdateAll.Text = "Update All"; 151 | this.UpdateAll.UseVisualStyleBackColor = true; 152 | this.UpdateAll.Click += new System.EventHandler(this.UpdateAll_Click); 153 | // 154 | // Delete 155 | // 156 | this.Delete.Enabled = false; 157 | this.Delete.Location = new System.Drawing.Point(151, 306); 158 | this.Delete.Name = "Delete"; 159 | this.Delete.Size = new System.Drawing.Size(92, 23); 160 | this.Delete.TabIndex = 35; 161 | this.Delete.Text = "Delete Selected"; 162 | this.Delete.UseVisualStyleBackColor = true; 163 | this.Delete.Click += new System.EventHandler(this.Delete_Click); 164 | // 165 | // View 166 | // 167 | this.View.Enabled = false; 168 | this.View.Location = new System.Drawing.Point(249, 306); 169 | this.View.Name = "View"; 170 | this.View.Size = new System.Drawing.Size(87, 23); 171 | this.View.TabIndex = 36; 172 | this.View.Text = "View on Steam"; 173 | this.View.UseVisualStyleBackColor = true; 174 | this.View.Click += new System.EventHandler(this.View_Click); 175 | // 176 | // AlreadyInstalled 177 | // 178 | this.AlreadyInstalled.FormattingEnabled = true; 179 | this.AlreadyInstalled.Location = new System.Drawing.Point(12, 25); 180 | this.AlreadyInstalled.Name = "AlreadyInstalled"; 181 | this.AlreadyInstalled.Size = new System.Drawing.Size(324, 277); 182 | this.AlreadyInstalled.TabIndex = 37; 183 | this.AlreadyInstalled.SelectedIndexChanged += new System.EventHandler(this.AlreadyInstalled_SelectedIndexChanged); 184 | // 185 | // Workshop 186 | // 187 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 188 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 189 | this.BackColor = System.Drawing.SystemColors.Control; 190 | this.ClientSize = new System.Drawing.Size(543, 341); 191 | this.Controls.Add(this.AlreadyInstalled); 192 | this.Controls.Add(this.View); 193 | this.Controls.Add(this.Delete); 194 | this.Controls.Add(this.UpdateAll); 195 | this.Controls.Add(this.InstallID); 196 | this.Controls.Add(this.Link); 197 | this.Controls.Add(this.Desc4); 198 | this.Controls.Add(this.Desc3); 199 | this.Controls.Add(this.Desc2); 200 | this.Controls.Add(this.ID); 201 | this.Controls.Add(this.Desc1); 202 | this.Controls.Add(this.DeleteAll); 203 | this.Controls.Add(this.AlreadyInstalledDesc); 204 | this.Controls.Add(this.Exit); 205 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 206 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 207 | this.MaximizeBox = false; 208 | this.MinimizeBox = false; 209 | this.Name = "Workshop"; 210 | this.ShowIcon = false; 211 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 212 | this.Text = "Managing Workshop Items"; 213 | this.ResumeLayout(false); 214 | this.PerformLayout(); 215 | 216 | } 217 | 218 | #endregion 219 | private Button DeleteAll; 220 | private Label AlreadyInstalledDesc; 221 | private Button Exit; 222 | private Label Desc1; 223 | private TextBox ID; 224 | private Label Desc2; 225 | private Label Desc3; 226 | private Label Desc4; 227 | private TextBox Link; 228 | private Button InstallID; 229 | private Button UpdateAll; 230 | private Button Delete; 231 | private Button View; 232 | private ListBox AlreadyInstalled; 233 | } 234 | } -------------------------------------------------------------------------------- /src/GUI/Manager.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace Pustalorc.Applications.USM.GUI 5 | { 6 | internal sealed partial class Manager 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | this.components = new System.ComponentModel.Container(); 35 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Manager)); 36 | this.Settings = new System.Windows.Forms.Button(); 37 | this.Workshop = new System.Windows.Forms.Button(); 38 | this.Plugin = new System.Windows.Forms.Button(); 39 | this.Toggle = new System.Windows.Forms.Button(); 40 | this.Updater = new System.Windows.Forms.Button(); 41 | this.GithubLink = new System.Windows.Forms.LinkLabel(); 42 | this.Desc9 = new System.Windows.Forms.Label(); 43 | this.LinkMe = new System.Windows.Forms.LinkLabel(); 44 | this.Notifier = new System.Windows.Forms.NotifyIcon(this.components); 45 | this.Servers = new System.Windows.Forms.ListBox(); 46 | this.NewServer = new System.Windows.Forms.Button(); 47 | this.DeleteServer = new System.Windows.Forms.Button(); 48 | this.CloneServer = new System.Windows.Forms.Button(); 49 | this.List_TXT = new System.Windows.Forms.Label(); 50 | this.ServerSettings = new System.Windows.Forms.RichTextBox(); 51 | this.Settings_TXT = new System.Windows.Forms.Label(); 52 | this.Restart = new System.Windows.Forms.Button(); 53 | this.Mngmnt_TXT = new System.Windows.Forms.Label(); 54 | this.ctrl_TXT = new System.Windows.Forms.Label(); 55 | this.Reset = new System.Windows.Forms.Button(); 56 | this.OpenLocal = new System.Windows.Forms.Button(); 57 | this.SuspendLayout(); 58 | // 59 | // Settings 60 | // 61 | this.Settings.Location = new System.Drawing.Point(255, 12); 62 | this.Settings.Name = "Settings"; 63 | this.Settings.Size = new System.Drawing.Size(130, 23); 64 | this.Settings.TabIndex = 7; 65 | this.Settings.Text = "Change Server Settings"; 66 | this.Settings.UseVisualStyleBackColor = true; 67 | this.Settings.Click += new System.EventHandler(this.Settings_Click); 68 | // 69 | // Workshop 70 | // 71 | this.Workshop.Location = new System.Drawing.Point(391, 57); 72 | this.Workshop.Name = "Workshop"; 73 | this.Workshop.Size = new System.Drawing.Size(139, 23); 74 | this.Workshop.TabIndex = 16; 75 | this.Workshop.Text = "Workshop Content"; 76 | this.Workshop.UseVisualStyleBackColor = true; 77 | this.Workshop.Click += new System.EventHandler(this.Workshop_Click); 78 | // 79 | // Plugin 80 | // 81 | this.Plugin.Location = new System.Drawing.Point(391, 86); 82 | this.Plugin.Name = "Plugin"; 83 | this.Plugin.Size = new System.Drawing.Size(139, 23); 84 | this.Plugin.TabIndex = 17; 85 | this.Plugin.Text = "Rocket Plugins"; 86 | this.Plugin.UseVisualStyleBackColor = true; 87 | this.Plugin.Click += new System.EventHandler(this.Plugin_Click); 88 | // 89 | // Toggle 90 | // 91 | this.Toggle.Location = new System.Drawing.Point(391, 168); 92 | this.Toggle.Name = "Toggle"; 93 | this.Toggle.Size = new System.Drawing.Size(139, 23); 94 | this.Toggle.TabIndex = 18; 95 | this.Toggle.Text = "Start/Stop Server"; 96 | this.Toggle.UseVisualStyleBackColor = true; 97 | this.Toggle.Click += new System.EventHandler(this.Toggle_Click); 98 | // 99 | // Updater 100 | // 101 | this.Updater.Location = new System.Drawing.Point(12, 402); 102 | this.Updater.Name = "Updater"; 103 | this.Updater.Size = new System.Drawing.Size(75, 23); 104 | this.Updater.TabIndex = 22; 105 | this.Updater.Text = "Update Tool"; 106 | this.Updater.UseVisualStyleBackColor = true; 107 | this.Updater.Click += new System.EventHandler(this.Updater_Click); 108 | // 109 | // GithubLink 110 | // 111 | this.GithubLink.AutoSize = true; 112 | this.GithubLink.Location = new System.Drawing.Point(107, 407); 113 | this.GithubLink.Name = "GithubLink"; 114 | this.GithubLink.Size = new System.Drawing.Size(222, 13); 115 | this.GithubLink.TabIndex = 23; 116 | this.GithubLink.TabStop = true; 117 | this.GithubLink.Text = "Github (Source Code, Issues, Wiki and more!)"; 118 | this.GithubLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.GithubLink_LinkClicked); 119 | // 120 | // Desc9 121 | // 122 | this.Desc9.AutoSize = true; 123 | this.Desc9.Location = new System.Drawing.Point(335, 407); 124 | this.Desc9.Name = "Desc9"; 125 | this.Desc9.Size = new System.Drawing.Size(152, 13); 126 | this.Desc9.TabIndex = 25; 127 | this.Desc9.Text = "Programmed and Designed by:"; 128 | // 129 | // LinkMe 130 | // 131 | this.LinkMe.AutoSize = true; 132 | this.LinkMe.Location = new System.Drawing.Point(483, 407); 133 | this.LinkMe.Name = "LinkMe"; 134 | this.LinkMe.Size = new System.Drawing.Size(64, 13); 135 | this.LinkMe.TabIndex = 26; 136 | this.LinkMe.TabStop = true; 137 | this.LinkMe.Text = "Pustalorc"; 138 | this.LinkMe.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkMe_LinkClicked); 139 | // 140 | // Notifier 141 | // 142 | this.Notifier.BalloonTipText = "Unturned Server Manager"; 143 | this.Notifier.BalloonTipTitle = "Unturned Server Manager"; 144 | this.Notifier.Icon = ((System.Drawing.Icon)(resources.GetObject("Notifier.Icon"))); 145 | this.Notifier.Text = "Unturned Server Manager"; 146 | this.Notifier.Visible = true; 147 | this.Notifier.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Notifier_MouseDoubleClick); 148 | // 149 | // Servers 150 | // 151 | this.Servers.FormattingEnabled = true; 152 | this.Servers.Location = new System.Drawing.Point(11, 36); 153 | this.Servers.Name = "Servers"; 154 | this.Servers.Size = new System.Drawing.Size(153, 290); 155 | this.Servers.TabIndex = 27; 156 | this.Servers.SelectedIndexChanged += new System.EventHandler(this.Servers_SelectedIndexChanged); 157 | // 158 | // NewServer 159 | // 160 | this.NewServer.Location = new System.Drawing.Point(11, 332); 161 | this.NewServer.Name = "NewServer"; 162 | this.NewServer.Size = new System.Drawing.Size(49, 23); 163 | this.NewServer.TabIndex = 28; 164 | this.NewServer.Text = "New"; 165 | this.NewServer.UseVisualStyleBackColor = true; 166 | this.NewServer.Click += new System.EventHandler(this.NewServer_Click); 167 | // 168 | // DeleteServer 169 | // 170 | this.DeleteServer.Location = new System.Drawing.Point(117, 332); 171 | this.DeleteServer.Name = "DeleteServer"; 172 | this.DeleteServer.Size = new System.Drawing.Size(47, 23); 173 | this.DeleteServer.TabIndex = 29; 174 | this.DeleteServer.Text = "Delete"; 175 | this.DeleteServer.UseVisualStyleBackColor = true; 176 | this.DeleteServer.Click += new System.EventHandler(this.DeleteServer_Click); 177 | // 178 | // CloneServer 179 | // 180 | this.CloneServer.Location = new System.Drawing.Point(66, 332); 181 | this.CloneServer.Name = "CloneServer"; 182 | this.CloneServer.Size = new System.Drawing.Size(45, 23); 183 | this.CloneServer.TabIndex = 30; 184 | this.CloneServer.Text = "Clone"; 185 | this.CloneServer.UseVisualStyleBackColor = true; 186 | this.CloneServer.Click += new System.EventHandler(this.CloneServer_Click); 187 | // 188 | // List_TXT 189 | // 190 | this.List_TXT.AutoSize = true; 191 | this.List_TXT.Location = new System.Drawing.Point(12, 17); 192 | this.List_TXT.Name = "List_TXT"; 193 | this.List_TXT.Size = new System.Drawing.Size(75, 13); 194 | this.List_TXT.TabIndex = 31; 195 | this.List_TXT.Text = "Local Servers:"; 196 | // 197 | // ServerSettings 198 | // 199 | this.ServerSettings.Location = new System.Drawing.Point(170, 41); 200 | this.ServerSettings.Name = "ServerSettings"; 201 | this.ServerSettings.ReadOnly = true; 202 | this.ServerSettings.Size = new System.Drawing.Size(215, 285); 203 | this.ServerSettings.TabIndex = 32; 204 | this.ServerSettings.Text = ""; 205 | // 206 | // Settings_TXT 207 | // 208 | this.Settings_TXT.AutoSize = true; 209 | this.Settings_TXT.Location = new System.Drawing.Point(167, 17); 210 | this.Settings_TXT.Name = "Settings_TXT"; 211 | this.Settings_TXT.Size = new System.Drawing.Size(82, 13); 212 | this.Settings_TXT.TabIndex = 33; 213 | this.Settings_TXT.Text = "Server Settings:"; 214 | // 215 | // Restart 216 | // 217 | this.Restart.Enabled = false; 218 | this.Restart.Location = new System.Drawing.Point(391, 197); 219 | this.Restart.Name = "Restart"; 220 | this.Restart.Size = new System.Drawing.Size(139, 23); 221 | this.Restart.TabIndex = 20; 222 | this.Restart.Text = "Restart Server"; 223 | this.Restart.UseVisualStyleBackColor = true; 224 | this.Restart.Click += new System.EventHandler(this.Restart_Click); 225 | // 226 | // Mngmnt_TXT 227 | // 228 | this.Mngmnt_TXT.AutoSize = true; 229 | this.Mngmnt_TXT.Location = new System.Drawing.Point(391, 41); 230 | this.Mngmnt_TXT.Name = "Mngmnt_TXT"; 231 | this.Mngmnt_TXT.Size = new System.Drawing.Size(72, 13); 232 | this.Mngmnt_TXT.TabIndex = 35; 233 | this.Mngmnt_TXT.Text = "Management:"; 234 | // 235 | // ctrl_TXT 236 | // 237 | this.ctrl_TXT.AutoSize = true; 238 | this.ctrl_TXT.Location = new System.Drawing.Point(391, 152); 239 | this.ctrl_TXT.Name = "ctrl_TXT"; 240 | this.ctrl_TXT.Size = new System.Drawing.Size(43, 13); 241 | this.ctrl_TXT.TabIndex = 37; 242 | this.ctrl_TXT.Text = "Control:"; 243 | // 244 | // Reset 245 | // 246 | this.Reset.Location = new System.Drawing.Point(391, 115); 247 | this.Reset.Name = "Reset"; 248 | this.Reset.Size = new System.Drawing.Size(139, 23); 249 | this.Reset.TabIndex = 39; 250 | this.Reset.Text = "Clear Map and User Data"; 251 | this.Reset.UseVisualStyleBackColor = true; 252 | this.Reset.Click += new System.EventHandler(this.Reset_Click); 253 | // 254 | // OpenLocal 255 | // 256 | this.OpenLocal.Location = new System.Drawing.Point(391, 226); 257 | this.OpenLocal.Name = "OpenLocal"; 258 | this.OpenLocal.Size = new System.Drawing.Size(139, 23); 259 | this.OpenLocal.TabIndex = 40; 260 | this.OpenLocal.Text = "Open Local Folder"; 261 | this.OpenLocal.UseVisualStyleBackColor = true; 262 | this.OpenLocal.Click += new System.EventHandler(this.OpenLocal_Click); 263 | // 264 | // Manager 265 | // 266 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 267 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 268 | this.BackColor = System.Drawing.SystemColors.Control; 269 | this.ClientSize = new System.Drawing.Size(559, 437); 270 | this.Controls.Add(this.OpenLocal); 271 | this.Controls.Add(this.Reset); 272 | this.Controls.Add(this.ctrl_TXT); 273 | this.Controls.Add(this.Mngmnt_TXT); 274 | this.Controls.Add(this.Settings_TXT); 275 | this.Controls.Add(this.ServerSettings); 276 | this.Controls.Add(this.List_TXT); 277 | this.Controls.Add(this.CloneServer); 278 | this.Controls.Add(this.DeleteServer); 279 | this.Controls.Add(this.NewServer); 280 | this.Controls.Add(this.Servers); 281 | this.Controls.Add(this.LinkMe); 282 | this.Controls.Add(this.Desc9); 283 | this.Controls.Add(this.GithubLink); 284 | this.Controls.Add(this.Updater); 285 | this.Controls.Add(this.Restart); 286 | this.Controls.Add(this.Toggle); 287 | this.Controls.Add(this.Plugin); 288 | this.Controls.Add(this.Workshop); 289 | this.Controls.Add(this.Settings); 290 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 291 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 292 | this.MaximizeBox = false; 293 | this.Name = "Manager"; 294 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 295 | this.Text = "Unturned Server Manager"; 296 | this.ResumeLayout(false); 297 | this.PerformLayout(); 298 | 299 | } 300 | 301 | #endregion 302 | private Button Settings; 303 | private Button Workshop; 304 | private Button Plugin; 305 | private Button Toggle; 306 | private Button Updater; 307 | private LinkLabel GithubLink; 308 | private Label Desc9; 309 | private LinkLabel LinkMe; 310 | public NotifyIcon Notifier; 311 | private ListBox Servers; 312 | private Button NewServer; 313 | private Button DeleteServer; 314 | private Button CloneServer; 315 | private Label List_TXT; 316 | private RichTextBox ServerSettings; 317 | private Label Settings_TXT; 318 | private Button Restart; 319 | private Label Mngmnt_TXT; 320 | private Label ctrl_TXT; 321 | private Button Reset; 322 | private Button OpenLocal; 323 | } 324 | } --------------------------------------------------------------------------------