Konami code using C # and ASP.net

http://en.wikipedia.org/wiki/Konami_Code

I already did this using full javascript, but how to do it on a C # / asp.net website (not winform). thank..

+5
source share
4 answers

So, you mean that the user should not learn about your secret code by cones when viewing the source?

It is not possible to do this completely on the server side unless you need a postback every time you press a key, which is inconvenient.

You can compress and obfuscate javascript, but I think a user with a strong definition can still figure it out.

Silverlight, XAP DLL .

, AJAX (, , ), . . . push, .

+4

# . , Javascript ( , )

, #. WPF, .

    private static readonly Key[] _konamiCode = new[] { Key.Up, Key.Up, Key.Down, Key.Down, Key.Left, Key.Right, Key.Left, Key.Right, Key.B, Key.A };
    int _konamiCurrentIndex = 0;

    protected override void OnPreviewKeyDown(KeyEventArgs e)
    {
        base.OnPreviewKeyDown(e);
        if (e.Key == _konamiCode[_konamiCurrentIndex])
        {
            _konamiCurrentIndex++;
            if (_konamiCurrentIndex == _konamiCode.Length)
            {
                _konamiCurrentIndex = 0;
                KonamiEasterEgg();
            }
        }
        else
        {
            _konamiCurrentIndex = 0;
        }
    }

    void KonamiEasterEgg()
    {
        // whatever you want to do when the Konami code is entered...
    }
+3

, #. - JavaScript + AJAX #... :)

: ( 10 ) JavaScript ( ascii - ) AJAX, html, , . , . JavaScript ( ), 2 ( ) ajax 1 , .

JQuery !

:)


0

. herzmeister der welten

, AJAX (, , ), . . . push, .

, , , - .

( , )

0

All Articles