diff --git a/ControlApp/ControlApp.cs b/ControlApp/ControlApp.cs index 3c24940..f5cc03e 100644 --- a/ControlApp/ControlApp.cs +++ b/ControlApp/ControlApp.cs @@ -330,56 +330,63 @@ public class ControlApp : Form } } - public void chk_next() - { - System.Windows.Forms.Cursor.Show(); - Cursor cursor = System.Windows.Forms.Cursor.Current; - System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; - try - { - string user = ConfigurationManager.AppSettings["UserName"].ToString(); - string pwd = ConfigurationManager.AppSettings["Password"].ToString(); - string vrs = "012"; - string result = utils.getcmd(user, pwd, vrs, "Outstanding"); - string[] ret = utils.seperate_string(result); - Nocomds.Text = ret[0]; - whonxtlbl.Text = ret[1]; - if (ret[2] == "0") - { - varified = false; - } - else - { - varified = true; - } - ScoreTxt.Text = ret[3]; - if (Nocomds.Text != "0") - { - try - { - if (ConfigurationManager.AppSettings["OutstandRemind"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["OutstandRemind"].ToString())) - { - if (Nocomds.Text == "1") - { - new CustomMessage("You have " + Nocomds.Text + " outstanding command.", "", 0, tts: true).ShowDialog(); - } - else if (Convert.ToInt16(Nocomds.Text) > 1) - { - new CustomMessage("You have " + Nocomds.Text + " outstanding commands.", "", 0, tts: true).ShowDialog(); - } - } - } - catch - { - } - } - } - catch (Exception ex) - { - utils.writetolog("Error checking for count", "Error checking for count :" + ex.Message); - } - System.Windows.Forms.Cursor.Current = cursor; - } + public void chk_next() + { + System.Windows.Forms.Cursor.Show(); + Cursor cursor = System.Windows.Forms.Cursor.Current; + System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; + + string user = ConfigurationManager.AppSettings["UserName"].ToString(); + string pwd = ConfigurationManager.AppSettings["Password"].ToString(); + + if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(pwd)) + { + return; + } + + try + { + string vrs = "012"; + string result = utils.getcmd(user, pwd, vrs, "Outstanding"); + string[] ret = utils.seperate_string(result); + Nocomds.Text = ret[0]; + whonxtlbl.Text = ret[1]; + if (ret[2] == "0") + { + varified = false; + } + else + { + varified = true; + } + ScoreTxt.Text = ret[3]; + if (Nocomds.Text != "0") + { + try + { + if (ConfigurationManager.AppSettings["OutstandRemind"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["OutstandRemind"].ToString())) + { + if (Nocomds.Text == "1") + { + new CustomMessage("You have " + Nocomds.Text + " outstanding command.", "", 0, tts: true).ShowDialog(); + } + else if (Convert.ToInt16(Nocomds.Text) > 1) + { + new CustomMessage("You have " + Nocomds.Text + " outstanding commands.", "", 0, tts: true).ShowDialog(); + } + } + } + catch + { + } + } + } + catch (Exception ex) + { + utils.writetolog("Error checking for count", "Error checking for count :" + ex.Message); + } + System.Windows.Forms.Cursor.Current = cursor; + } private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { diff --git a/ControlApp/Utils.cs b/ControlApp/Utils.cs index 9b1d524..8cbb314 100644 --- a/ControlApp/Utils.cs +++ b/ControlApp/Utils.cs @@ -33,20 +33,30 @@ internal class Utils public string[] blist = new string[1] { "" }; - public void writetolog(string shortvr, string longvr) - { - if (ConfigurationManager.AppSettings["Logging"] == "On") - { - if (ConfigurationManager.AppSettings["Logging"] == "On") - { - File.AppendAllText("log.txt", shortvr); - } - else - { - File.AppendAllText("log.txt", longvr); - } - } - } + public void writetolog(string shortvr, string longvr) + { + shortvr = CleanStringForLog(shortvr); + longvr = CleanStringForLog(longvr); + + if (ConfigurationManager.AppSettings["Logging"] == "On") + { + File.AppendAllText("log.txt", shortvr+ "\n"); + } + else + { + File.AppendAllText("log.txt", longvr+ "\n"); + } + } + + public string CleanStringForLog(string stringinput) + { + stringinput = Decrypt(stringinput); + if (stringinput.EndsWith("&&&")) + { + stringinput = stringinput.Substring(0, stringinput.Length - 3); + } + return stringinput; + } public string[] GetLatestItem() { @@ -586,7 +596,8 @@ internal class Utils if (inbanned) { new CustomMessage("Message contains potential bad stuff closing", "", 4, tts: false).ShowDialog(); - break; + writetolog("Banned content found in message", what); + break; } if (what.Substring(0, 3) == "FTP") { diff --git a/app.config b/app.config index ae8a7f6..85da067 100644 --- a/app.config +++ b/app.config @@ -1,4 +1,4 @@ - + @@ -46,5 +46,11 @@ + + + + + + \ No newline at end of file