fix a few unhandled errors

This commit is contained in:
Merith 2025-02-25 22:09:00 -08:00
parent bc90f68f66
commit 2b9430101e
3 changed files with 90 additions and 66 deletions

View file

@ -335,10 +335,17 @@ public class ControlApp : Form
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();
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);

View file

@ -35,17 +35,27 @@ internal class Utils
public void writetolog(string shortvr, string longvr)
{
shortvr = CleanStringForLog(shortvr);
longvr = CleanStringForLog(longvr);
if (ConfigurationManager.AppSettings["Logging"] == "On")
{
if (ConfigurationManager.AppSettings["Logging"] == "On")
{
File.AppendAllText("log.txt", shortvr);
File.AppendAllText("log.txt", shortvr+ "\n");
}
else
{
File.AppendAllText("log.txt", longvr);
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,6 +596,7 @@ internal class Utils
if (inbanned)
{
new CustomMessage("Message contains potential bad stuff closing", "", 4, tts: false).ShowDialog();
writetolog("Banned content found in message", what);
break;
}
if (what.Substring(0, 3) == "FTP")

View file

@ -46,5 +46,11 @@
<add key="DTTS" value="False" />
<add key="DDisM" value="False" />
<add key="DPopSet" value="Short" />
<add key="LocalDrive" value="Downloads" />
<add key="AutoRun" value="False" />
<add key="UserName" value="" />
<add key="Password" value="" />
<add key="RunAll" value="False" />
<add key="Delay" value="30" />
</appSettings>
</configuration>