Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LastExceed committed Aug 31, 2017
1 parent ffc7643 commit cda0979
Show file tree
Hide file tree
Showing 14 changed files with 1,265 additions and 0 deletions.
22 changes: 22 additions & 0 deletions UniversalAionLauncher.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.15
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalAionLauncher", "UniversalAionLauncher\UniversalAionLauncher.csproj", "{13EC85D9-6590-40CE-9367-7689746863C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13EC85D9-6590-40CE-9367-7689746863C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13EC85D9-6590-40CE-9367-7689746863C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13EC85D9-6590-40CE-9367-7689746863C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13EC85D9-6590-40CE-9367-7689746863C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions UniversalAionLauncher/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
513 changes: 513 additions & 0 deletions UniversalAionLauncher/Form1.Designer.cs

Large diffs are not rendered by default.

230 changes: 230 additions & 0 deletions UniversalAionLauncher/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows.Forms;
using System.Drawing;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace UniversalAionLauncher {
public partial class Form1 : Form {
string currentDir = Directory.GetCurrentDirectory();
bool busy = false;
string cmd;
const string savefile = "UAL_profiles.json";
List<Profile> profiles = new List<Profile>();

public Form1() {
InitializeComponent();
if (File.Exists(savefile)) {
profiles = JsonConvert.DeserializeObject<List<Profile>>(File.ReadAllText(savefile));
}
foreach (Profile profile in profiles) {
listBoxProfile.Items.Add(profile.name);
}
}
private void SaveToFile() {
File.WriteAllText(savefile, JsonConvert.SerializeObject(profiles));
}

private void ButtonProfileNew_Click(object sender, EventArgs e) {
listBoxProfile.Items.Add("#");
profiles.Add(new Profile());
listBoxProfile.SelectedIndex = listBoxProfile.Items.Count - 1;
ProfileUpdated();
}
private void ButtonProfileRemove_Click(object sender, EventArgs e) {
profiles.RemoveAt(listBoxProfile.SelectedIndex);
listBoxProfile.Items.RemoveAt(listBoxProfile.SelectedIndex);
ProfileUpdated();
}
private void TextBoxProfile_TextChanged(object sender, EventArgs e) {
if (!busy) {
listBoxProfile.Items[listBoxProfile.SelectedIndex] = textBoxProfile.Text;
profiles[listBoxProfile.SelectedIndex].name = listBoxProfile.Text;
}
}
private void ListBoxProfile_Click(object sender, EventArgs e) {
ProfileUpdated();
}
private void ProfileUpdated() {
busy = true;
listBoxVersion.Items.Clear();
if (listBoxProfile.SelectedIndex == -1) {
buttonServerRemove.Enabled = false;
textBoxProfile.Enabled = false;
textBoxProfile.Text = string.Empty;
textBoxIP.Text = string.Empty;

groupBoxClient.Enabled = false;
} else {
buttonServerRemove.Enabled = true;
textBoxProfile.Enabled = true;
textBoxProfile.Text = listBoxProfile.Text;
profiles[listBoxProfile.SelectedIndex].name = listBoxProfile.Text;
textBoxIP.Text = profiles[listBoxProfile.SelectedIndex].ip;
numericUpDownCC.Value = profiles[listBoxProfile.SelectedIndex].cc;

groupBoxClient.Enabled = true;
foreach (var directory in Directory.GetDirectories(currentDir)) {
listBoxVersion.Items.Add(directory.Substring(currentDir.Length + 1));
}
listBoxVersion.Text = profiles[listBoxProfile.SelectedIndex].version;
VersionUpdated();
}
Invoke(new Action(StatusReset));
SaveToFile();
busy = false;
}

private void ListBoxVersion_SelectedIndexChanged(object sender, EventArgs e) {
VersionUpdated();
profiles[listBoxProfile.SelectedIndex].version = listBoxVersion.Text;
}
private void VersionUpdated() {
listBoxLanguage.Items.Clear();
groupBoxLaunchParams.Enabled = false;
if (listBoxVersion.SelectedIndex != -1) {
string parentDir = currentDir + @"\" + listBoxVersion.Items[listBoxVersion.SelectedIndex].ToString() + @"\l10n";
foreach (var directory in Directory.GetDirectories(parentDir)) {
listBoxLanguage.Items.Add(directory.Substring(parentDir.Length + 1));
}
}
listBoxLanguage.Enabled = true;
listBoxLanguage.Text = profiles[listBoxProfile.SelectedIndex].language;
}
private void ListBoxLanguage_SelectedIndexChanged(object sender, EventArgs e) {
profiles[listBoxProfile.SelectedIndex].language = listBoxLanguage.Text;
groupBoxLaunchParams.Enabled = (listBoxLanguage.SelectedIndex != -1);
}
private void TextBoxIP_TextChanged(object sender, EventArgs e) {
profiles[listBoxProfile.SelectedIndex].ip = textBoxIP.Text;
Invoke(new Action(StatusReset));
}
private void NumericUpDownPort_ValueChanged(object sender, EventArgs e) {
profiles[listBoxProfile.SelectedIndex].port = (ushort)numericUpDownPort.Value;
Invoke(new Action(StatusReset));
}
private void NumericUpDownCC_ValueChanged(object sender, EventArgs e) {
profiles[listBoxProfile.SelectedIndex].cc = (byte)numericUpDownCC.Value;
}

private void ButtonParamAdd_Click(object sender, EventArgs e) {
checkedListBoxParams.Items.Add(string.Empty);
textBoxParam.Text = string.Empty;
//profiles.Add(new Profile());
checkedListBoxParams.SelectedIndex = checkedListBoxParams.Items.Count - 1;
}
private void ButtonParamRemove_Click(object sender, EventArgs e) {
checkedListBoxParams.Items.RemoveAt(checkedListBoxParams.SelectedIndex);
}
private void CheckedListBoxParams_SelectedIndexChanged(object sender, EventArgs e) {
busy = true;
if (checkedListBoxParams.SelectedIndex == -1) {
textBoxParam.Text = string.Empty;
textBoxParam.Enabled = false;
buttonParamRemove.Enabled = false;
} else {
textBoxParam.Text = checkedListBoxParams.Text;
textBoxParam.Enabled = true;
buttonParamRemove.Enabled = true;
}
busy = false;
}
private void TextBoxParam_TextChanged(object sender, EventArgs e) {
if (!busy) {
checkedListBoxParams.Items[checkedListBoxParams.SelectedIndex] = textBoxParam.Text;
//profiles[listBoxProfile.SelectedIndex].name = listBoxProfile.Text;
}
}

private void ButtonRefresh_Click(object sender, EventArgs e) {
StatusReset();
Task.Factory.StartNew(() => ContactServer(labelStatusLogin, (int)numericUpDownPort.Value));
Task.Factory.StartNew(() => ContactServer(labelStatusGame, 7777));
Task.Factory.StartNew(() => ContactServer(labelStatusChat, 10241));
//Task.Factory.StartNew(() => ContactServer(labelStatusWeb, 80));
Task.Factory.StartNew(Ping);
SaveToFile();
}
private void ContactServer(Label label, int port) {
var client = new TcpClient();
if (client.ConnectAsync(IPAddress.Parse(textBoxIP.Text), port).Wait(5000)) {
Invoke(new Action(() => label.Text = "online"));
Invoke(new Action(() => label.ForeColor = Color.Green));
Invoke(new Action(progressBar1.PerformStep));
} else {
Invoke(new Action(() => label.Text = "offline"));
Invoke(new Action(() => label.ForeColor = Color.Red));
}
}
private void Ping() {
PingReply x = new Ping().Send(textBoxIP.Text);
if (x.Status == IPStatus.Success) {
Invoke(new Action(() => labelStatusPing.Text = x.RoundtripTime + ""));
Invoke(new Action(progressBar1.PerformStep));
} else {
Invoke(new Action(() => labelStatusPing.Text = x.Status + ""));
}
}
private void StatusReset() {
labelStatusLogin.Text = "??";
labelStatusLogin.ForeColor = Color.Black;
labelStatusGame.Text = "??";
labelStatusGame.ForeColor = Color.Black;
labelStatusChat.Text = "??";
labelStatusChat.ForeColor = Color.Black;
labelStatusPing.Text = "??";
progressBar1.Value = 0;
}

private void ButtonExecute_Click(object sender, EventArgs e) {
Process process = new Process() {
StartInfo = new ProcessStartInfo() {
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "cmd.exe",
Arguments = "/c" + cmd
}
};
process.Start();
SaveToFile();
Application.Exit();
}
private void Timer1_Tick(object sender, EventArgs e) {
bool ready = true;

string clientFolder = "???";
if (listBoxVersion.SelectedIndex != -1) {
clientFolder = listBoxVersion.Text;
} else {
ready = false;
}
string ip = textBoxIP.Text;
if (IPAddress.TryParse(ip, out var x)) {
groupBoxStatus.Enabled = true;
} else {
ip = "???";
ready = false;
groupBoxStatus.Enabled = false;
}
string language = "???";
if (listBoxLanguage.SelectedIndex != -1) {
language = listBoxLanguage.Text;
} else {
ready = false;
}

cmd = "start " + currentDir + string.Format(@"\{0}\bin32\aion.bin -ip:{1} -port:{2} -cc:{3} -lang:{4}", clientFolder, ip, numericUpDownPort.Value, numericUpDownCC.Value, language);
foreach (var index in checkedListBoxParams.CheckedIndices) {
cmd += " -" + checkedListBoxParams.Items[(int)index].ToString();
}

textBoxOutput.Text = cmd;
buttonExecute.Enabled = ready;
}
}
}
123 changes: 123 additions & 0 deletions UniversalAionLauncher/Form1.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
Loading

0 comments on commit cda0979

Please sign in to comment.