Allow HISP Noobs to run even w a web server already running

This commit is contained in:
SilicaAndPina 2022-03-19 15:46:44 +13:00
parent 62e1a7a122
commit 994dc382c8
4 changed files with 260 additions and 247 deletions

View file

@ -1,71 +1,71 @@
using HISP.Server;
using System;
using System.Diagnostics;
using HISP.Server;
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace HISP
{
public partial class SystemTrayIcon : Form
{
Process clientProcess = new Process();
public SystemTrayIcon()
{
InitializeComponent();
disableSwearFilterToolStripMenuItem.Checked = !ConfigReader.BadWords;
disableCorrectionsToolStripMenuItem.Checked = !ConfigReader.DoCorrections;
disableNonvioChecksToolStripMenuItem.Checked = !ConfigReader.DoNonViolations;
disableSpamFilterToolStripMenuItem.Checked = !ConfigReader.EnableSpamFilter;
using System.Windows.Forms;
namespace HISP
{
public partial class SystemTrayIcon : Form
{
Process clientProcess = new Process();
public SystemTrayIcon()
{
InitializeComponent();
disableSwearFilterToolStripMenuItem.Checked = !ConfigReader.BadWords;
disableCorrectionsToolStripMenuItem.Checked = !ConfigReader.DoCorrections;
disableNonvioChecksToolStripMenuItem.Checked = !ConfigReader.DoNonViolations;
disableSpamFilterToolStripMenuItem.Checked = !ConfigReader.EnableSpamFilter;
allUsersSubscribedToolStripMenuItem.Checked = ConfigReader.AllUsersSubbed;
fixOfficalBugsToolStripMenuItem.Checked = ConfigReader.FixOfficalBugs;
}
private void createNewUserToolStripMenuItem_Click(object sender, EventArgs e)
{
RegisterForm frm = new RegisterForm();
frm.ShowDialog();
}
private void closeServerToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void SystemTrayIcon_Load(object sender, EventArgs e)
{
clientProcess.StartInfo.FileName = "flash.dll";
clientProcess.StartInfo.Arguments = "http://127.0.0.1/horseisle.swf?SERVER=127.0.0.1&PORT=12321";
clientProcess.StartInfo.RedirectStandardOutput = true;
clientProcess.StartInfo.RedirectStandardError = true;
clientProcess.EnableRaisingEvents = true;
clientProcess.Exited += clientExited;
clientProcess.Start();
}
private void clientExited(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(() =>
{
this.Close();
});
}
else
{
this.Close();
}
}
private void SystemTrayIcon_FormClosing(object sender, FormClosingEventArgs e)
{
HispNotifyIcon.Visible = false;
clientProcess.Kill();
fixOfficalBugsToolStripMenuItem.Checked = ConfigReader.FixOfficalBugs;
}
private void createNewUserToolStripMenuItem_Click(object sender, EventArgs e)
{
RegisterForm frm = new RegisterForm();
frm.ShowDialog();
}
private void closeServerToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void SystemTrayIcon_Load(object sender, EventArgs e)
{
clientProcess.StartInfo.FileName = "flash.dll";
clientProcess.StartInfo.Arguments = "http://"+ Program.IP +"/horseisle.swf?SERVER="+ Program.IP +"&PORT=12321";
clientProcess.StartInfo.RedirectStandardOutput = true;
clientProcess.StartInfo.RedirectStandardError = true;
clientProcess.EnableRaisingEvents = true;
clientProcess.Exited += clientExited;
clientProcess.Start();
}
private void clientExited(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(() =>
{
this.Close();
});
}
else
{
this.Close();
}
}
private void SystemTrayIcon_FormClosing(object sender, FormClosingEventArgs e)
{
HispNotifyIcon.Visible = false;
clientProcess.Kill();
}
private void editServerPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
@ -87,20 +87,20 @@ namespace HISP
private void ModifyConfig(string okey, string value)
{
string[] configFile = File.ReadAllLines(ConfigReader.ConfigurationFileName);
for (int i = 0; i < configFile.Length; i++)
{
string setting = configFile[i];
if (setting.Length < 1)
continue;
if (setting[0] == '#')
continue;
if (!setting.Contains("="))
continue;
string[] dataPair = setting.Split('=');
string[] configFile = File.ReadAllLines(ConfigReader.ConfigurationFileName);
for (int i = 0; i < configFile.Length; i++)
{
string setting = configFile[i];
if (setting.Length < 1)
continue;
if (setting[0] == '#')
continue;
if (!setting.Contains("="))
continue;
string[] dataPair = setting.Split('=');
string key = dataPair[0];
if (key == okey)
@ -114,7 +114,7 @@ namespace HISP
private void resetUserPasswordToolStripMenuItem_Click(object sender, EventArgs e)
{
ResetForm frm = new ResetForm();
ResetForm frm = new ResetForm();
frm.ShowDialog();
}
@ -165,5 +165,5 @@ namespace HISP
ConfigReader.FixOfficalBugs = enab;
}
}
}
}
}