2.5
This commit is contained in:
parent
9fa7ece6fd
commit
124401f748
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>C:\Users\Thomas\source\repos\ARCHBLOXLauncher1\Properties\PublishProfiles\x64.pubxml</_LastSelectedProfileId>
|
||||
<_LastSelectedProfileId>C:\Users\Thomas\source\repos\ARCHBLOXLauncher1\Properties\PublishProfiles\x86.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Form1.cs">
|
||||
|
|
|
|||
82
Form1.cs
82
Form1.cs
|
|
@ -16,6 +16,7 @@ namespace ARCHBLOXLauncher1
|
|||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
bool exitafterarg = false;
|
||||
bool lockanims = true;
|
||||
bool rbxl = false;
|
||||
private DiscordRpcClient client;
|
||||
|
|
@ -149,6 +150,87 @@ namespace ARCHBLOXLauncher1
|
|||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
var lastword = "";
|
||||
var info1 = "";
|
||||
var info2 = "";
|
||||
string[] args = ARCHBLOXProtocol.SharedVariables.Arguments.Split('/');
|
||||
foreach (var word in args)
|
||||
{
|
||||
if (lastword == "host") {
|
||||
exitafterarg = true;
|
||||
lastword = "stop";
|
||||
string[] info = word.Split('|');
|
||||
foreach (var word2 in info)
|
||||
{
|
||||
if (info1 == "") {
|
||||
info1 = word2;
|
||||
} else {
|
||||
info2 = word2;
|
||||
}
|
||||
}
|
||||
if (info1 == "" || info2 == "")
|
||||
{
|
||||
MessageBox.Show("Paramaters are invalid. Please try again. (ID: 500)", "ARCHBLOX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
var pProcess = new Process();
|
||||
hosting = true;
|
||||
pProcess.StartInfo.FileName = filePath;
|
||||
pProcess.StartInfo.Arguments = "-a \"http://www.morblox.us/\" -j \"http://www.morblox.us/game/gameserver.php?port=" + info1 + "&rbxl=" + info2 + "\" -t \"1\"";
|
||||
pProcess.StartInfo.UseShellExecute = false;
|
||||
pProcess.StartInfo.RedirectStandardOutput = true;
|
||||
pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||
pProcess.StartInfo.CreateNoWindow = false;
|
||||
pProcess.Start();
|
||||
MessageBox.Show("Starting game server on port " + info1 + " using " + info2, "ARCHBLOX", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
if (lastword == "join")
|
||||
{
|
||||
exitafterarg = true;
|
||||
lastword = "stop";
|
||||
string[] info = word.Split('|');
|
||||
foreach (var word2 in info)
|
||||
{
|
||||
if (info1 == "")
|
||||
{
|
||||
info1 = word2;
|
||||
}
|
||||
else
|
||||
{
|
||||
info2 = word2;
|
||||
}
|
||||
}
|
||||
if (info1 == "" || info2 == "") {
|
||||
MessageBox.Show("Paramaters are invalid. Please try again. (ID: 500)", "ARCHBLOX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
var pProcess = new Process();
|
||||
hosting = true;
|
||||
pProcess.StartInfo.FileName = filePath;
|
||||
pProcess.StartInfo.Arguments = "-a \"http://www.morblox.us/\" -j \"http://www.morblox.us/game/join.ashx?port=" + info1 + "&ip=" + info2 + "\" -t \"1\"";
|
||||
pProcess.StartInfo.UseShellExecute = false;
|
||||
pProcess.StartInfo.RedirectStandardOutput = true;
|
||||
pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||
pProcess.StartInfo.CreateNoWindow = false;
|
||||
pProcess.Start();
|
||||
MessageBox.Show("Joining " + info2 + ":" + info1, "ARCHBLOX", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
if (word == "install")
|
||||
{
|
||||
ARCHBLOXLauncher1.Form2 form2 = new ARCHBLOXLauncher1.Form2();
|
||||
form2.Show();
|
||||
}
|
||||
if (word == "") { } else
|
||||
{
|
||||
lastword = word;
|
||||
}
|
||||
}
|
||||
|
||||
if (exitafterarg == true)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
|
||||
AnimationHandler_SlideOutHostBox.Tick += new EventHandler(slideOutHostBox);
|
||||
AnimationHandler_SlideInHostBox.Tick += new EventHandler(slideInHostBox);
|
||||
|
|
|
|||
4
Form2.cs
4
Form2.cs
|
|
@ -15,7 +15,6 @@ using System.Threading.Tasks;
|
|||
using System.IO;
|
||||
using System.DirectoryServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ARCHBLOXLauncher1
|
||||
{
|
||||
public partial class Form2 : Form
|
||||
|
|
@ -25,7 +24,6 @@ namespace ARCHBLOXLauncher1
|
|||
private static WebClient wc = new WebClient();
|
||||
private static ManualResetEvent handle = new ManualResetEvent(true);
|
||||
|
||||
|
||||
private static long GetDirectorySize(string folderPath)
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(folderPath);
|
||||
|
|
@ -47,6 +45,7 @@ namespace ARCHBLOXLauncher1
|
|||
DialogResult res = MessageBox.Show("Do you want to delete previous installs of ARCHBLOX? Current size of ARCHBLOX folder: " + GetDirectorySize(folderPath) + "MB.", "ARCHBLOX", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
ARCHBLOXProtocol.ARCHBLOXURIProtocol.Unregister();
|
||||
label1.Text = "Removing previous installs...";
|
||||
Directory.Delete(folderPath, true);
|
||||
|
||||
|
|
@ -101,6 +100,7 @@ namespace ARCHBLOXLauncher1
|
|||
ZipFile.ExtractToDirectory(filePath, clientPath);
|
||||
File.Delete(filePath);
|
||||
label1.Text = "Install completed!";
|
||||
ARCHBLOXProtocol.ARCHBLOXURIProtocol.Register();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,18 @@ namespace ARCHBLOXLauncher1
|
|||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
if (args.Length > 0)
|
||||
{
|
||||
foreach (string s in args)
|
||||
{
|
||||
ARCHBLOXProtocol.SharedVariables.Arguments = s;
|
||||
}
|
||||
}
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2022-07-12T14:37:23.7218937Z;True|2022-07-13T00:35:56.1276705+10:00;True|2022-07-12T20:31:31.4891674+10:00;True|2022-07-12T07:42:57.8030421+10:00;True|2022-07-12T07:24:22.2110673+10:00;True|2022-07-12T07:12:22.1327523+10:00;True|2022-07-12T01:02:07.4142780+10:00;True|2022-07-12T01:01:55.1054218+10:00;True|2022-07-12T00:57:05.7704097+10:00;True|2022-07-11T19:45:06.3965836+10:00;True|2022-07-11T03:03:05.5235378+10:00;True|2022-07-11T01:29:52.2575986+10:00;True|2022-07-11T01:29:03.7081553+10:00;True|2022-07-11T01:07:30.8355486+10:00;True|2022-07-11T00:18:27.1107980+10:00;True|2022-07-10T21:59:11.0753271+10:00;True|2022-07-10T19:15:49.4105023+10:00;True|2022-07-10T19:13:41.3098116+10:00;True|2022-07-10T19:12:41.5715908+10:00;</History>
|
||||
<History>True|2022-07-13T06:20:04.4747082Z;True|2022-07-13T00:37:48.5001758+10:00;True|2022-07-13T00:37:23.7218937+10:00;True|2022-07-13T00:35:56.1276705+10:00;True|2022-07-12T20:31:31.4891674+10:00;True|2022-07-12T07:42:57.8030421+10:00;True|2022-07-12T07:24:22.2110673+10:00;True|2022-07-12T07:12:22.1327523+10:00;True|2022-07-12T01:02:07.4142780+10:00;True|2022-07-12T01:01:55.1054218+10:00;True|2022-07-12T00:57:05.7704097+10:00;True|2022-07-11T19:45:06.3965836+10:00;True|2022-07-11T03:03:05.5235378+10:00;True|2022-07-11T01:29:52.2575986+10:00;True|2022-07-11T01:29:03.7081553+10:00;True|2022-07-11T01:07:30.8355486+10:00;True|2022-07-11T00:18:27.1107980+10:00;True|2022-07-10T21:59:11.0753271+10:00;True|2022-07-10T19:15:49.4105023+10:00;True|2022-07-10T19:13:41.3098116+10:00;True|2022-07-10T19:12:41.5715908+10:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2022-07-12T14:37:19.8958675Z;True|2022-07-13T00:36:07.1078472+10:00;True|2022-07-12T20:31:25.7325840+10:00;True|2022-07-12T07:43:08.7666080+10:00;True|2022-07-12T07:24:17.3722228+10:00;True|2022-07-12T07:12:29.3685122+10:00;True|2022-07-12T01:01:59.7182995+10:00;True|2022-07-12T00:56:51.3800489+10:00;True|2022-07-11T19:45:17.8917634+10:00;True|2022-07-11T03:02:35.7176035+10:00;True|2022-07-11T01:29:59.8179775+10:00;True|2022-07-11T01:28:57.8645143+10:00;True|2022-07-11T01:07:39.1190996+10:00;True|2022-07-11T00:18:18.9541704+10:00;True|2022-07-10T21:59:16.0892178+10:00;True|2022-07-10T19:13:19.3369745+10:00;True|2022-07-10T19:13:01.5256770+10:00;</History>
|
||||
<History>True|2022-07-13T06:19:59.8973544Z;True|2022-07-13T00:38:04.2388491+10:00;True|2022-07-13T00:37:19.8958675+10:00;True|2022-07-13T00:36:07.1078472+10:00;True|2022-07-12T20:31:25.7325840+10:00;True|2022-07-12T07:43:08.7666080+10:00;True|2022-07-12T07:24:17.3722228+10:00;True|2022-07-12T07:12:29.3685122+10:00;True|2022-07-12T01:01:59.7182995+10:00;True|2022-07-12T00:56:51.3800489+10:00;True|2022-07-11T19:45:17.8917634+10:00;True|2022-07-11T03:02:35.7176035+10:00;True|2022-07-11T01:29:59.8179775+10:00;True|2022-07-11T01:28:57.8645143+10:00;True|2022-07-11T01:07:39.1190996+10:00;True|2022-07-11T00:18:18.9541704+10:00;True|2022-07-10T21:59:16.0892178+10:00;True|2022-07-10T19:13:19.3369745+10:00;True|2022-07-10T19:13:01.5256770+10:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Security.Permissions;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ARCHBLOXProtocol
|
||||
{
|
||||
class SharedVariables
|
||||
{
|
||||
public static string Arguments = "";
|
||||
};
|
||||
[PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")]
|
||||
internal static class ARCHBLOXURIProtocol
|
||||
{
|
||||
private const string _Protocol = "archblox";
|
||||
private const string _ProtocolHandler = "url.archblox";
|
||||
|
||||
private static readonly string _launch = string.Format(
|
||||
"{0}{1}{0} {0}%1{0}", (char)34, Application.ExecutablePath);
|
||||
|
||||
private static readonly Version _win8Version = new Version(6, 2, 9200, 0);
|
||||
private static readonly bool _isWin8 =
|
||||
Environment.OSVersion.Platform == PlatformID.Win32NT &&
|
||||
Environment.OSVersion.Version >= _win8Version;
|
||||
|
||||
internal static void Register()
|
||||
{
|
||||
if (_isWin8) RegisterWin8();
|
||||
else RegisterWin7();
|
||||
}
|
||||
|
||||
private static void RegisterWin7()
|
||||
{
|
||||
var regKey = Registry.ClassesRoot.CreateSubKey(_Protocol);
|
||||
|
||||
regKey.CreateSubKey("DefaultIcon")
|
||||
.SetValue(null, string.Format("{0}{1},1{0}", (char)34,
|
||||
Application.ExecutablePath));
|
||||
|
||||
regKey.SetValue(null, "URL:archblox Protocol");
|
||||
regKey.SetValue("URL Protocol", "");
|
||||
|
||||
regKey = regKey.CreateSubKey(@"shell\open\command");
|
||||
regKey.SetValue(null, _launch);
|
||||
}
|
||||
|
||||
private static void RegisterWin8()
|
||||
{
|
||||
RegisterWin7();
|
||||
|
||||
var regKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes")
|
||||
.CreateSubKey(_ProtocolHandler);
|
||||
|
||||
regKey.SetValue(null, _Protocol);
|
||||
|
||||
regKey.CreateSubKey("DefaultIcon")
|
||||
.SetValue(null, string.Format("{0}{1},1{0}", (char)34,
|
||||
Application.ExecutablePath));
|
||||
|
||||
regKey.CreateSubKey(@"shell\open\command").SetValue(null, _launch);
|
||||
|
||||
Registry.LocalMachine.CreateSubKey(string.Format(
|
||||
@"SOFTWARE\{0}\{1}\Capabilities\ApplicationDescription\URLAssociations",
|
||||
Application.CompanyName, Application.ProductName))
|
||||
.SetValue(_Protocol, _ProtocolHandler);
|
||||
|
||||
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications")
|
||||
.SetValue(Application.ProductName, string.Format(
|
||||
@"SOFTWARE\{0}\Capabilities", Application.ProductName));
|
||||
}
|
||||
|
||||
internal static void Unregister()
|
||||
{
|
||||
if (!_isWin8)
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree("archblox", false);
|
||||
return;
|
||||
}
|
||||
|
||||
// extra work required.
|
||||
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes")
|
||||
.DeleteSubKeyTree(_ProtocolHandler, false);
|
||||
|
||||
Registry.LocalMachine.DeleteSubKeyTree(string.Format(@"SOFTWARE\{0}\{1}",
|
||||
Application.CompanyName, Application.ProductName));
|
||||
|
||||
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications")
|
||||
.DeleteValue(Application.ProductName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
128067f77a5132928ef0df2bcb245ccf31195143
|
||||
385c2bf7542a20aa95b73838276be171671d87eb
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
a55a3629e84240fda0adac3b720301c89ebdfc41
|
||||
4651e0e314f61e88d5433c1b3fbe41abe99d39a3
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
f1fedbda7f00c658ab970e51562779c105404b1c
|
||||
8627b0f4c4219191e032f43f8955ac859e5a6336
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue