D
Deatheaven
Guest
I'm a newbie to Programming, but i found this HTML Script and i want to convert to VB2010 Code.
</h4>
<hr>
<form id="key-gen">
<input id="name" type="text" placeholder="Name">
<button id="generate" type="submit">Generate</button>
</form>
<h2>Registration Code</h2>
<div id="code"></div>
<script>
function shift8b(name) {
return name.replace(/[8B]/, function (match) {
return match == '8' ? 'B' : '8';
});
}
function getCode(name) {
var professionals_code = [0x10051981, 0x4011995, 0x2061997, 0x12091999, 0x16062004, 0x21042002, 0x13062004, 0x9112005, 0x24112005],
codes = [],
length = name.length,
v = length,
code = 0x47694C; // Magic String Standard Version
name = name.toUpperCase();
for (var i = 0; i < length; i++) {
if ((i % 14) == 0) {
v = 39;
}
code += v * name.charCodeAt(i);
v *= ((i + 3) % 14) ? 3 : 7;
}
// standard registration code
// codes.push(shift8b(code.toString(16).toUpperCase()));
for (var i = 0; i < professionals_code.length; i++) {
// Magic String Professional Version
codes.push(shift8b(
(code + professionals_code[i]).toString(16).toUpperCase()
));
}
return codes;
}
function onClickKeyGen(e) {
var nameNode = document.getElementById('name'),
codeNode = document.getElementById('code');
codeNode.innerHTML = getCode(nameNode.value).join('<br>');
// for IE
if (!e) return false;
e.preventDefault();
}
var keyGenNode = document.getElementById('key-gen');
if (document.addEventListener) {
keyGenNode.addEventListener('submit', onClickKeyGen);
} else {
// for IE
keyGenNode.onsubmit = onClickKeyGen;
}
But i don't find any good converters to do it
Continue reading...
</h4>
<hr>
<form id="key-gen">
<input id="name" type="text" placeholder="Name">
<button id="generate" type="submit">Generate</button>
</form>
<h2>Registration Code</h2>
<div id="code"></div>
<script>
function shift8b(name) {
return name.replace(/[8B]/, function (match) {
return match == '8' ? 'B' : '8';
});
}
function getCode(name) {
var professionals_code = [0x10051981, 0x4011995, 0x2061997, 0x12091999, 0x16062004, 0x21042002, 0x13062004, 0x9112005, 0x24112005],
codes = [],
length = name.length,
v = length,
code = 0x47694C; // Magic String Standard Version
name = name.toUpperCase();
for (var i = 0; i < length; i++) {
if ((i % 14) == 0) {
v = 39;
}
code += v * name.charCodeAt(i);
v *= ((i + 3) % 14) ? 3 : 7;
}
// standard registration code
// codes.push(shift8b(code.toString(16).toUpperCase()));
for (var i = 0; i < professionals_code.length; i++) {
// Magic String Professional Version
codes.push(shift8b(
(code + professionals_code[i]).toString(16).toUpperCase()
));
}
return codes;
}
function onClickKeyGen(e) {
var nameNode = document.getElementById('name'),
codeNode = document.getElementById('code');
codeNode.innerHTML = getCode(nameNode.value).join('<br>');
// for IE
if (!e) return false;
e.preventDefault();
}
var keyGenNode = document.getElementById('key-gen');
if (document.addEventListener) {
keyGenNode.addEventListener('submit', onClickKeyGen);
} else {
// for IE
keyGenNode.onsubmit = onClickKeyGen;
}
But i don't find any good converters to do it
Continue reading...