forked from NewEraCracker/LOIC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11ba01a
commit 0ae244a
Showing
4 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* LOIC - Low Orbit Ion Cannon | ||
* Released to the public domain | ||
* Enjoy getting v&, kids. | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Windows.Forms; | ||
|
||
namespace LOIC | ||
{ | ||
public class Konami | ||
{ | ||
private static short KonamiState = 0; | ||
private static Keys[] KonamiKeys = {Keys.Up, Keys.Up, Keys.Down, Keys.Down, Keys.Left, Keys.Right, Keys.Left, Keys.Right, Keys.B, Keys.A, Keys.Enter}; | ||
|
||
public static bool Check(Form frm) | ||
{ | ||
bool on = Settings.HasKonamiCode(); | ||
if(!on) { | ||
frm.KeyUp += new KeyEventHandler(HandleKonamiKeyPress); | ||
} | ||
return on; | ||
} | ||
|
||
|
||
public static void HandleKonamiKeyPress(object sender, KeyEventArgs e) | ||
{ | ||
if (KonamiKeys[KonamiState] == e.KeyCode) { | ||
KonamiState++; | ||
if (KonamiState >= KonamiKeys.Length) { | ||
KonamiState = 0; | ||
e.Handled = true; | ||
Settings.SaveKonamiCode(); | ||
MessageBox.Show("Close and re-open the application to apply the changes.", "Konami Success", MessageBoxButtons.OK, MessageBoxIcon.Information); | ||
} | ||
} else if (KonamiState != 0) { | ||
KonamiState = 0; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters