Skip to content

Instantly share code, notes, and snippets.

@kg
Created March 20, 2012 14:30
Show Gist options
  • Save kg/2136187 to your computer and use it in GitHub Desktop.
Save kg/2136187 to your computer and use it in GitHub Desktop.
JSIL Code Sample: Goto
using System;
public static class Program {
public static void Main (string[] args) {
int i = 0;
a:
i += 1;
Console.WriteLine("a");
for (; i < 16; i++) {
if (i == 8)
goto a;
else
goto c;
c:
Console.WriteLine("c");
}
}
}
JSIL.MakeStaticClass("Program", true, [], function ($) {
$.Method({Static:true , Public:true }, "Main",
$sig.get(1, null, [$jsilcore.TypeRef("System.Array", [$.String])], []),
function Main (args) {
var i = 0;
$loop0:
while (true) {
var $label0 = "$entry0";
$labelgroup0:
while (true) {
switch ($label0) {
case "$entry0":
$label0 = "IL_03";
continue $labelgroup0;
case "IL_03":
++i;
$asm01.System.Console.WriteLine("a");
for (; i < 16; ++i) {
if (i === 8) {
$label0 = "IL_03";
continue $labelgroup0;
}
$asm01.System.Console.WriteLine("c");
}
break $loop0;
}
}
}
}
);
});
@pan2112
Copy link

pan2112 commented Jan 21, 2014

public static string GetAppKey()
{
RSACrypto crypto;
string str;
byte[] buffer;
byte[] buffer2;
if (appKey.Trim().Equals("") != null)
{
goto Label_001C;
}
return appKey;
Label_001C:
crypto = new RSACrypto(0x200);
crypto.PaddingProvider = new PKCS1v1_5();
str = TaoUtils.GetResourceFile("RsaInfo.txt");
crypto.FromXmlString(str);
buffer = TaoUtils.HexStringToByteArray("3B 56 6A 93 C2 97 93 38 EB 48 A4 9C 9F 8B F9 0F 77 A2 19 22 91 0D C4 A9 B5 B8 B5 C3 A7 2A 9F D4 F1 3C 62 BD 88 5D DB 89 2A D4 90 FB C5 8A DF C5 FC 24 63 F2 BA 73 4C 5C E5 51 98 93 D8 23 40 61 ");
buffer2 = crypto.Decrypt(buffer);
appKey = Encoding.UTF8.GetString(buffer2, 0, (int) buffer2.Length);
return appKey;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment