Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Implemented a number of changes/features suggested by https://github.…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumbridge committed Mar 29, 2018
1 parent 73796fb commit 6445d01
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
Binary file modified .vs/MixerSmiteCodeRedeemer/v14/.suo
Binary file not shown.
6 changes: 4 additions & 2 deletions SmiteMixerCodeGrabberGUI/Classes/AllCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public static void AddCodeToCodeList(string code, bool isActive)
_AllCodes.Add(new SmiteCode(code));
if (Properties.Settings.Default.notificationSetting)
DisplayNotification("New potential code added to active codes: \n" + code);
}
else
if (Properties.Settings.Default.notificationSound)
PlayNotificationSound();
}
else
{
Console.WriteLine("Added Expried code: " + code + " to the code list.");
_AllCodes.Add(new SmiteCode(code, isActive));
Expand Down
16 changes: 10 additions & 6 deletions SmiteMixerCodeGrabberGUI/Classes/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ class Common
{
public static void DisplayNotification(string msg)
{
if (Properties.Settings.Default.notificationSound)
MessageBox.Show(msg, "Smite Code Grabber Notification", MessageBoxButtons.OK);
}

public static void PlayNotificationSound()
{
try
{
try {
System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Settings.Default.notificationSoundFilePath);
player.Play();
} catch { Console.WriteLine("Unable to play notification sound (invalid file format/path)."); }
System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Settings.Default.notificationSoundFilePath);
player.Play();
}
MessageBox.Show(msg, "Smite Code Grabber Notification", MessageBoxButtons.OK);
catch { Console.WriteLine("Unable to play notification sound (invalid file format/path)."); }

}
}
}
19 changes: 16 additions & 3 deletions SmiteMixerCodeGrabberGUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ private static void Chat_OnMessageReceived(ChatMessageEventArgs e)
{
if (!Properties.Settings.Default.whitelistOnly)
{
if (e.Message.Contains("AP"))
if (e.Message.Contains(Properties.Settings.Default.codesStartWith))
{
var m = e.Message;
try
{
var code = m.Substring(m.IndexOf(Properties.Settings.Default.codesStartWith), 17);
var code = m.Substring(m.IndexOf(Properties.Settings.Default.codesStartWith), Properties.Settings.Default.codeLength);

if (GetActiveCodes().Find(x => x.GetCode() == code) == null && GetExpiredCodes().Find(x => x.GetCode() == code) == null && !code.Contains(" "))
{
Expand All @@ -101,14 +101,16 @@ private static void Chat_OnMessageReceived(ChatMessageEventArgs e)
var m = e.Message;
try
{
var code = m.Substring(m.IndexOf("AP"), 17);
var code = m.Substring(m.IndexOf(Properties.Settings.Default.codesStartWith), Properties.Settings.Default.codeLength);

if (GetActiveCodes().Find(x => x.GetCode() == code) == null && GetExpiredCodes().Find(x => x.GetCode() == code) == null && !code.Contains(" "))
{
AddCodeToCodeList(code, true);
Write("Code: " + code + " added to active codes (Grabbed from whitelisted user: " + e.User + ".");
if (Properties.Settings.Default.notificationSetting)
DisplayNotification("New potential code added to active codes: \n" + code);
if (Properties.Settings.Default.notificationSound)
PlayNotificationSound();
}
else
{
Expand All @@ -120,6 +122,15 @@ private static void Chat_OnMessageReceived(ChatMessageEventArgs e)
}
catch { }
}
else
{
try
{
var m = e.Message;
var code = m.Substring(m.IndexOf(Properties.Settings.Default.codesStartWith), Properties.Settings.Default.codeLength);
Write("Code matching specified criteria was observed: " + code + " posted by user: " + e.User);
} catch { }
}
}
}

Expand Down Expand Up @@ -188,6 +199,8 @@ private void checkbox_AFKMode_CheckedChanged(object sender, EventArgs e)
private void button_sendTestEmail_Click(object sender, EventArgs e)
{
DisplayNotification("This is a test notification.");
if (Properties.Settings.Default.notificationSound)
PlayNotificationSound();
}
private void numberbox_codeLength_ValueChanged(object sender, EventArgs e)
{
Expand Down

0 comments on commit 6445d01

Please sign in to comment.