Added network config

This commit is contained in:
GittyMac 2022-04-23 00:03:34 -04:00
parent 26e0168045
commit dfdb929f07
7 changed files with 312 additions and 12 deletions

View File

@ -40,6 +40,17 @@
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.OnlineToggle = new System.Windows.Forms.CheckBox();
this.HTTPBox1 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.TCPHostBox = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.TCPPortBox = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.HTTPBox2 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// QualityCB
@ -49,7 +60,7 @@
"0 - High",
"1 - Medium",
"2 - Low"});
this.QualityCB.Location = new System.Drawing.Point(171, 64);
this.QualityCB.Location = new System.Drawing.Point(204, 64);
this.QualityCB.Name = "QualityCB";
this.QualityCB.Size = new System.Drawing.Size(121, 21);
this.QualityCB.TabIndex = 0;
@ -85,7 +96,7 @@
"1 - Crop (Vert-)",
"2 - Stretch",
"3 - Pixel-based"});
this.ScaleCB.Location = new System.Drawing.Point(171, 104);
this.ScaleCB.Location = new System.Drawing.Point(204, 104);
this.ScaleCB.Name = "ScaleCB";
this.ScaleCB.Size = new System.Drawing.Size(121, 21);
this.ScaleCB.TabIndex = 3;
@ -93,11 +104,11 @@
//
// ExitButton
//
this.ExitButton.Location = new System.Drawing.Point(243, 150);
this.ExitButton.Location = new System.Drawing.Point(248, 283);
this.ExitButton.Name = "ExitButton";
this.ExitButton.Size = new System.Drawing.Size(75, 23);
this.ExitButton.Size = new System.Drawing.Size(101, 23);
this.ExitButton.TabIndex = 4;
this.ExitButton.Text = "Close";
this.ExitButton.Text = "Save and Close";
this.ExitButton.UseVisualStyleBackColor = true;
this.ExitButton.Click += new System.EventHandler(this.button1_Click);
//
@ -127,7 +138,7 @@
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(166, 22);
this.label1.Location = new System.Drawing.Point(199, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(130, 16);
this.label1.TabIndex = 9;
@ -137,7 +148,7 @@
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(166, 48);
this.label2.Location = new System.Drawing.Point(199, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(39, 13);
this.label2.TabIndex = 10;
@ -147,7 +158,7 @@
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(166, 88);
this.label3.Location = new System.Drawing.Point(199, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(42, 13);
this.label3.TabIndex = 11;
@ -163,11 +174,124 @@
this.label4.TabIndex = 12;
this.label4.Text = "Game Settings";
//
// OnlineToggle
//
this.OnlineToggle.AutoSize = true;
this.OnlineToggle.Location = new System.Drawing.Point(134, 176);
this.OnlineToggle.Name = "OnlineToggle";
this.OnlineToggle.Size = new System.Drawing.Size(92, 17);
this.OnlineToggle.TabIndex = 14;
this.OnlineToggle.Text = "Enable Online";
this.OnlineToggle.UseVisualStyleBackColor = true;
this.OnlineToggle.CheckedChanged += new System.EventHandler(this.OnlineToggle_CheckedChanged);
//
// HTTPBox1
//
this.HTTPBox1.Location = new System.Drawing.Point(78, 218);
this.HTTPBox1.Name = "HTTPBox1";
this.HTTPBox1.Size = new System.Drawing.Size(100, 20);
this.HTTPBox1.TabIndex = 15;
this.HTTPBox1.Text = "localhost";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(75, 202);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(70, 13);
this.label6.TabIndex = 16;
this.label6.Text = "HTTP Host 1";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(73, 241);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(53, 13);
this.label7.TabIndex = 17;
this.label7.Text = "TCP Host";
//
// TCPHostBox
//
this.TCPHostBox.Location = new System.Drawing.Point(78, 257);
this.TCPHostBox.Name = "TCPHostBox";
this.TCPHostBox.Size = new System.Drawing.Size(100, 20);
this.TCPHostBox.TabIndex = 18;
this.TCPHostBox.Text = "localhost";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(12, 293);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(88, 13);
this.label8.TabIndex = 19;
this.label8.Text = "OpenFK v0.0.0.0";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label9.Location = new System.Drawing.Point(184, 241);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(50, 13);
this.label9.TabIndex = 20;
this.label9.Text = "TCP Port";
//
// TCPPortBox
//
this.TCPPortBox.Location = new System.Drawing.Point(187, 257);
this.TCPPortBox.Name = "TCPPortBox";
this.TCPPortBox.Size = new System.Drawing.Size(100, 20);
this.TCPPortBox.TabIndex = 21;
this.TCPPortBox.Text = "80";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label10.Location = new System.Drawing.Point(184, 202);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(70, 13);
this.label10.TabIndex = 23;
this.label10.Text = "HTTP Host 2";
//
// HTTPBox2
//
this.HTTPBox2.Location = new System.Drawing.Point(187, 218);
this.HTTPBox2.Name = "HTTPBox2";
this.HTTPBox2.Size = new System.Drawing.Size(100, 20);
this.HTTPBox2.TabIndex = 22;
this.HTTPBox2.Text = "localhost";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(118, 152);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(124, 16);
this.label5.TabIndex = 13;
this.label5.Text = "Network Settings";
//
// ConfigForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(330, 185);
this.ClientSize = new System.Drawing.Size(361, 311);
this.Controls.Add(this.label10);
this.Controls.Add(this.HTTPBox2);
this.Controls.Add(this.TCPPortBox);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.TCPHostBox);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.HTTPBox1);
this.Controls.Add(this.OnlineToggle);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
@ -202,5 +326,16 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox OnlineToggle;
private System.Windows.Forms.TextBox HTTPBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox TCPHostBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox TCPPortBox;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox HTTPBox2;
private System.Windows.Forms.Label label5;
}
}

View File

@ -21,6 +21,13 @@ namespace OpenFK
QualityCB.SelectedIndex = Properties.Settings.Default.Quality;
ScaleCB.SelectedIndex = Properties.Settings.Default.ScaleMode;
USBToggle.Checked = Properties.Settings.Default.USBSupport;
OnlineToggle.Checked = Properties.Settings.Default.IsOnline;
HTTPBox1.Text = Properties.Settings.Default.HTTPHost1;
HTTPBox2.Text = Properties.Settings.Default.HTTPHost2;
TCPHostBox.Text = Properties.Settings.Default.TCPHost;
TCPPortBox.Text = Properties.Settings.Default.TCPPort;
label8.Text = "OpenFK v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
UpdateTextboxes();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
@ -59,6 +66,11 @@ namespace OpenFK
private void button1_Click(object sender, EventArgs e)
{
Properties.Settings.Default.HTTPHost1 = HTTPBox1.Text;
Properties.Settings.Default.HTTPHost2 = HTTPBox2.Text;
Properties.Settings.Default.TCPHost = TCPHostBox.Text;
Properties.Settings.Default.TCPPort = TCPPortBox.Text;
Properties.Settings.Default.Save();
Application.Exit();
}
@ -83,5 +95,35 @@ namespace OpenFK
Properties.Settings.Default.USBSupport = false;
Properties.Settings.Default.Save();
}
private void OnlineToggle_CheckedChanged(object sender, EventArgs e)
{
if (OnlineToggle.Checked)
{
Properties.Settings.Default.IsOnline = true;
}
else
Properties.Settings.Default.IsOnline = false;
Properties.Settings.Default.Save();
UpdateTextboxes();
}
void UpdateTextboxes()
{
if (Properties.Settings.Default.IsOnline)
{
HTTPBox1.Enabled = true;
HTTPBox2.Enabled = true;
TCPHostBox.Enabled = true;
TCPPortBox.Enabled = true;
}
else
{
HTTPBox1.Enabled = false;
HTTPBox2.Enabled = false;
TCPHostBox.Enabled = false;
TCPPortBox.Enabled = false;
}
}
}
}

View File

@ -349,6 +349,14 @@ namespace OpenFK
setRP("Exploring", "Paradox Green", currentBitty, currentBittyName);
}
}
if (Properties.Settings.Default.IsOnline)
{
if (e.args.Contains(@"=""config"""))
{
}
}
}
}
@ -561,6 +569,12 @@ namespace OpenFK
}
}
//TRUNK UPDATE CHECKS
if (e.args.Contains("<commands><checktrunkupdate"))
{
setVar(@"<checktrunkupdate result=""0"" reason=""Everything is up to date."" />");
}
//UPDATE CHECKS (Not standard netcommands)
if (e.args.Contains("<commands><checkupdate"))
{
@ -836,6 +850,25 @@ namespace OpenFK
{
XmlDocument configData = new XmlDocument();
configData.LoadXml(filedata);
if (Properties.Settings.Default.IsOnline)
{
XmlAttribute host = (XmlAttribute)configData.SelectSingleNode("/settings/host/@value");
host.Value = Properties.Settings.Default.HTTPHost1;
XmlAttribute host1 = (XmlAttribute)configData.SelectSingleNode("/settings/host1/@value");
host1.Value = Properties.Settings.Default.HTTPHost2;
XmlAttribute tcpHost = (XmlAttribute)configData.SelectSingleNode("/settings/arkone_host/@value");
tcpHost.Value = Properties.Settings.Default.TCPHost;
XmlAttribute tcpPort = (XmlAttribute)configData.SelectSingleNode("/settings/arkone_port/@value");
tcpPort.Value = Properties.Settings.Default.TCPPort;
filedata = configData.OuterXml;
index = @"<commands><load section=""" + file + @""" name=""" + folder + @""" result=""0"" reason="""">" + filedata + @"</load></commands>";
}
XmlNodeList xnList1 = configData.SelectNodes("/settings/host"); //filters xml to the load info;
foreach (XmlNode xn in xnList1) //fetches the information to load
{

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GittyMac")]
[assembly: AssemblyProduct("OpenFK")]
[assembly: AssemblyCopyright("Copyright © GittyMac 2021")]
[assembly: AssemblyCopyright("Copyright © GittyMac 2022")]
[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.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]

View File

@ -94,5 +94,65 @@ namespace OpenFK.Properties {
this["USBSupport"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool IsOnline {
get {
return ((bool)(this["IsOnline"]));
}
set {
this["IsOnline"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("localhost")]
public string HTTPHost1 {
get {
return ((string)(this["HTTPHost1"]));
}
set {
this["HTTPHost1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("localhost")]
public string HTTPHost2 {
get {
return ((string)(this["HTTPHost2"]));
}
set {
this["HTTPHost2"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("localhost")]
public string TCPHost {
get {
return ((string)(this["TCPHost"]));
}
set {
this["TCPHost"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("80")]
public string TCPPort {
get {
return ((string)(this["TCPPort"]));
}
set {
this["TCPPort"] = value;
}
}
}
}

View File

@ -20,5 +20,20 @@
<Setting Name="USBSupport" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="IsOnline" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="HTTPHost1" Type="System.String" Scope="User">
<Value Profile="(Default)">localhost</Value>
</Setting>
<Setting Name="HTTPHost2" Type="System.String" Scope="User">
<Value Profile="(Default)">localhost</Value>
</Setting>
<Setting Name="TCPHost" Type="System.String" Scope="User">
<Value Profile="(Default)">localhost</Value>
</Setting>
<Setting Name="TCPPort" Type="System.String" Scope="User">
<Value Profile="(Default)">80</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -25,6 +25,21 @@
<setting name="USBSupport" serializeAs="String">
<value>False</value>
</setting>
<setting name="IsOnline" serializeAs="String">
<value>False</value>
</setting>
<setting name="HTTPHost1" serializeAs="String">
<value>localhost</value>
</setting>
<setting name="HTTPHost2" serializeAs="String">
<value>localhost</value>
</setting>
<setting name="TCPHost" serializeAs="String">
<value>localhost</value>
</setting>
<setting name="TCPPort" serializeAs="String">
<value>80</value>
</setting>
</OpenFK.Properties.Settings>
</userSettings>
<runtime>