commit
dc5a61c4bc
|
@ -0,0 +1,2 @@
|
|||
language: csharp
|
||||
solution: UnturnedSL.sln
|
|
@ -1,10 +1,10 @@
|
|||
# USL
|
||||
[![banner.png](https://s14.postimg.org/x2qqyft69/banner.png)](https://postimg.org/image/3nl2pfoml/)
|
||||
![Main Banner](https://s14.postimg.org/x2qqyft69/banner.png)
|
||||
|
||||
[![GitHub issues](https://img.shields.io/github/issues/casKd-dev/USL.svg?style=for-the-badge)](https://github.com/casKd-dev/USL/issues)
|
||||
[![TravisCI build](https://travis-ci.org/casKd-dev/USL.svg?branch=dev)](https://travis-ci.org/casKd-dev/USL/builds/)
|
||||
|
||||
A Gameserver launcher written in C# .
|
||||
This project aims to help people not as experienced with Unturned or computers in general.
|
||||
It is so easy to use in fact, that just pressing enter while having steam installed in the default directory will launch a server without you knowing anything you did.
|
||||
It is so easy to use in fact, that just leaving the default options while having the Unturned installed in the default directory will launch it!
|
||||
|
||||
I mainly work on it in my free time, if you want to push or contribute feel free to contact me!
|
||||
I mainly work on it in my free time, if you want to push or contribute, feel free to contact me!
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
@ -16,39 +12,25 @@ namespace UnturnedSL
|
|||
string title = "USL by casKd running on version " + lauversion;
|
||||
Console.Title = title;
|
||||
Console.SetWindowSize(100,20);
|
||||
if (!File.Exists("settings.cfg")) { /*Checks for new users*/
|
||||
FirstSetup();
|
||||
TextReader settings = new StreamReader("settings.cfg", true);
|
||||
string name = settings.ReadLine();
|
||||
string map = settings.ReadLine();
|
||||
string welcome = settings.ReadLine();
|
||||
string port = settings.ReadLine();
|
||||
string data = settings.ReadLine();
|
||||
string extralo = settings.ReadLine();
|
||||
string path = settings.ReadLine();
|
||||
settings.Close(); /*Loads settings from file and checks if all lines are present and valid*/
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
string launchop = "-nographics -batchmode -name " + "\"" + name + "\"" + " -map " + map + " -welcome " + "\"" + welcome + "\"" + " -port:" + port + " " + extralo + " +secureserver/" + data;
|
||||
Validation(name, map, welcome, port, data, extralo, path, out bool valid);
|
||||
Run(valid, name, map, welcome, data, port, extralo, path);
|
||||
|
||||
|
||||
} else {
|
||||
TextReader settings = new StreamReader("settings.cfg", true);
|
||||
string name = settings.ReadLine();
|
||||
string map = settings.ReadLine();
|
||||
string welcome = settings.ReadLine();
|
||||
string port = settings.ReadLine();
|
||||
string data = settings.ReadLine();
|
||||
string extralo = settings.ReadLine();
|
||||
string path = settings.ReadLine();
|
||||
settings.Close(); /*Loads settings from file and checks if all lines are present and valid*/
|
||||
Validation(name, map, welcome, port, data, extralo, path, out bool valid);
|
||||
Run(valid, name, map, welcome, port, data, extralo, path);
|
||||
}
|
||||
MkDirIfNotExist("config");
|
||||
if (Directory.GetFiles("config", "*.cfg").Length == 0) {FirstSetup(); } /*Checks for new users*/
|
||||
string[] oFiles = Directory.GetFiles("config", "*.cfg");
|
||||
/*Loads settings from file and checks if all lines are present and valid*/
|
||||
TextReader settings = new StreamReader(oFiles[0], true);
|
||||
string name = settings.ReadLine();
|
||||
string map = settings.ReadLine();
|
||||
string welcome = settings.ReadLine();
|
||||
string port = settings.ReadLine();
|
||||
string data = settings.ReadLine();
|
||||
string extralo = settings.ReadLine();
|
||||
string path = settings.ReadLine();
|
||||
settings.Close();
|
||||
Validation(name, map, welcome, port, data, extralo, path, out bool valid);
|
||||
Run(valid, name, map, welcome, port, data, extralo, path);
|
||||
}
|
||||
/*Validate if all input is correct*/
|
||||
|
||||
static void Validation(string name, string map, string welcome, string port, string data, string extralo, string path,out bool valid)
|
||||
/*Validate if all input is correct*/
|
||||
{
|
||||
/*Checks if every condition is true*/
|
||||
bool bNum = int.TryParse(port, out int i);
|
||||
|
@ -65,11 +47,12 @@ namespace UnturnedSL
|
|||
)
|
||||
{ valid = true;} else { valid = false;}
|
||||
}
|
||||
/*First setup*/
|
||||
|
||||
static void FirstSetup()
|
||||
/*First setup*/
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("Welcome!" + Environment.NewLine);
|
||||
Console.WriteLine("Welcome!" + Environment.NewLine + "Do you want to go through the setup? [N/y]" + Environment.NewLine);
|
||||
string[] defvalue = {
|
||||
"PEI",
|
||||
"USL-My server",
|
||||
|
@ -87,30 +70,43 @@ namespace UnturnedSL
|
|||
"Do you want any other parameters for your server?",
|
||||
"Where is your Unturned installation located?"
|
||||
};
|
||||
/*Asks user to setup their own server, which later saves in a config file*/
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
string[] setvals = { "map", "name", "welcome", "port", "data", "extralo", "path" };
|
||||
var loopval = 0;
|
||||
string[] answ = new string[7];
|
||||
foreach (string val in setvals)
|
||||
/*Asks user to setup their own server, which later saves in a config file*/
|
||||
if (String.Equals(Console.ReadLine(), "y", StringComparison.CurrentCultureIgnoreCase) == true)
|
||||
{
|
||||
while (loopval <= 6)
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.Clear();
|
||||
foreach (string val in setvals)
|
||||
{
|
||||
Console.WriteLine(question[loopval] + Environment.NewLine + "Default value: " + defvalue[loopval]);
|
||||
answ[loopval] = Console.ReadLine();
|
||||
if (String.IsNullOrWhiteSpace(answ[loopval]))
|
||||
while (loopval <= 6)
|
||||
{
|
||||
Console.WriteLine(question[loopval] + Environment.NewLine + "Default value: " + defvalue[loopval]);
|
||||
answ[loopval] = Console.ReadLine();
|
||||
if (String.IsNullOrWhiteSpace(answ[loopval]))
|
||||
{
|
||||
answ[loopval] = defvalue[loopval];
|
||||
loopval++;
|
||||
}
|
||||
else
|
||||
{
|
||||
loopval++;
|
||||
}
|
||||
Console.Clear();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (string val in setvals)
|
||||
{
|
||||
while (loopval <= 6)
|
||||
{
|
||||
answ[loopval] = defvalue[loopval];
|
||||
loopval++;
|
||||
}
|
||||
else
|
||||
{
|
||||
loopval++;
|
||||
}
|
||||
Console.Clear();
|
||||
}
|
||||
}
|
||||
/*Saves data*/
|
||||
/*Transfers data from array to variables*/
|
||||
string map = answ[0];
|
||||
string name = answ[1];
|
||||
string welcome = answ[2];
|
||||
|
@ -120,7 +116,7 @@ namespace UnturnedSL
|
|||
string path = answ[6];
|
||||
Console.Clear();
|
||||
/*Stores data into a file*/
|
||||
TextWriter settings = new StreamWriter("settings.cfg", true);
|
||||
TextWriter settings = new StreamWriter("config/settings.cfg", true);
|
||||
settings.WriteLine(name);
|
||||
settings.WriteLine(map);
|
||||
settings.WriteLine(welcome);
|
||||
|
@ -130,8 +126,9 @@ namespace UnturnedSL
|
|||
settings.WriteLine(path);
|
||||
settings.Close();
|
||||
}
|
||||
|
||||
static void DisplayText(string name, string map, string welcome, string port, string data, string extralo, string path)
|
||||
/*Outputs info of the current configuration*/
|
||||
/*Outputs info of the current configuration*/
|
||||
{
|
||||
string displaytext =
|
||||
"Server info:" + Environment.NewLine + Environment.NewLine +
|
||||
|
@ -144,15 +141,17 @@ namespace UnturnedSL
|
|||
"Path to Game:" + "\t" + "\t" + path + Environment.NewLine;
|
||||
Console.WriteLine(displaytext);
|
||||
}
|
||||
|
||||
static void DebugInfo()
|
||||
/*Helps at debugging, mostly needed when having problems*/
|
||||
/*Helps at debugging, mostly needed when having problems*/
|
||||
{
|
||||
string debugtext =
|
||||
"Currently running from:" + Environment.NewLine +
|
||||
Directory.GetCurrentDirectory() + Environment.NewLine +
|
||||
"Config exists: " + File.Exists("settings.cfg") + Environment.NewLine;
|
||||
"Config exists: " + File.Exists("config/settings.cfg") + Environment.NewLine;
|
||||
Console.WriteLine(debugtext);
|
||||
}
|
||||
|
||||
static void Run(bool valid, string name, string map, string welcome, string port, string data, string extralo, string path)
|
||||
{
|
||||
if (valid == true)
|
||||
|
@ -178,5 +177,12 @@ namespace UnturnedSL
|
|||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void MkDirIfNotExist(string name)
|
||||
/*This method name explains itself*/
|
||||
{
|
||||
if (Directory.Exists(name)) { }
|
||||
else { Directory.CreateDirectory(name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ using System.Runtime.InteropServices;
|
|||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("UnturnedSL")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyDescription("An Unturned server Launcher")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnturnedSL")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.13")]
|
||||
[assembly: AssemblyFileVersion("1.13")]
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
|
@ -12,18 +12,18 @@
|
|||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>D:\Projects\Unturned SL\</PublishUrl>
|
||||
<PublishUrl>D:\Projects\ServerLauncher\Pubish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateMode>Background</UpdateMode>
|
||||
<UpdateInterval>1</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>5</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>1.3.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
@ -51,17 +51,25 @@
|
|||
<ManifestCertificateThumbprint>38F8CCBCA52BFC6A38DA55C985EAB30042818FD1</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>UnturnedSL_TemporaryKey.pfx</ManifestKeyFile>
|
||||
<ManifestKeyFile>
|
||||
</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -76,6 +84,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||
|
@ -92,6 +101,5 @@
|
|||
<ItemGroup>
|
||||
<Content Include="logo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Reference in New Issue