Скрытое содержимое
namespace BattlefieldHeroesBetaKeyFinder
{
using System;
using System.Globalization;
using WatiN.Core;
public class Program
{
//private const string BetaKeyFormat = "16D57-47H26-E5120-43E4H";
private const string BetaKeyFormat = "16D57-47H26-E5120-43{0}";
private const string AccountName = "TestUser";
private const string AccountPassword = "Password";
private static char[] Slot1Digits = { 'E' };//{ 'B', 'D', 'E', 'F' };
private static char[] Slot2Digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'L', 'R', 'T' };
private static char[] Slot3Digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'L', 'R', 'T' };
private static int slot1Offset;
private static int slot2Offset;
private static int slot3Offset;
[STAThread]
static void Main(string[] args)
{
string betaKey = "Not yet assigned";
using (IE ie = new IE("http://beta.battlefield-heroes.com/activate"))
{
do
{
string digits = Program.GetNextDigits();
if (digits == null)
{
betaKey = "No key found";
break;
}
betaKey = String.Format(CultureInfo.InvariantCulture, Program.BetaKeyFormat, digits);
Console.Write("Trying - " + betaKey);
//Console.WriteLine();
ie.TextField(Find.ByName("key")).TypeText(betaKey);
ie.TextField(Find.ByName("sec_name")).TypeText(Program.AccountName);
ie.TextField(Find.ByName("sec_pass")).TypeText(Program.AccountPassword);
ie.TextField(Find.ByName("sec_pass_confirm")).TypeText(Program.AccountPassword);
ie.CheckBox(Find.ByName("agreement")).Checked = true;
ie.Button(Find.ByValue("Activate My Key")).Click();
if (ie.ContainsText("That key appears to be invalid."))
{
Console.WriteLine(", FAILED");
}
else if (ie.ContainsText("That key has already been activated."))
{
Console.WriteLine(", IN USE");
}
else
{
Console.WriteLine(", SUCCESS!");
break;
}
}
while (true);
Console.ReadKey(true);
}
}
private static string GetNextDigits()
{
if (slot3Offset >= Program.Slot3Digits.Length)
{
slot3Offset = 0;
slot2Offset++;
}
if (slot2Offset >= Program.Slot2Digits.Length)
{
slot2Offset = 0;
slot1Offset++;
}
if (slot1Offset >= Program.Slot1Digits.Length)
{
return null;
}
return new string(new char[] { Program.Slot1Digits[slot1Offset], Program.Slot2Digits[slot2Offset], Program.Slot3Digits[slot3Offset++] });
{
using System;
using System.Globalization;
using WatiN.Core;
public class Program
{
//private const string BetaKeyFormat = "16D57-47H26-E5120-43E4H";
private const string BetaKeyFormat = "16D57-47H26-E5120-43{0}";
private const string AccountName = "TestUser";
private const string AccountPassword = "Password";
private static char[] Slot1Digits = { 'E' };//{ 'B', 'D', 'E', 'F' };
private static char[] Slot2Digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'L', 'R', 'T' };
private static char[] Slot3Digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'L', 'R', 'T' };
private static int slot1Offset;
private static int slot2Offset;
private static int slot3Offset;
[STAThread]
static void Main(string[] args)
{
string betaKey = "Not yet assigned";
using (IE ie = new IE("http://beta.battlefield-heroes.com/activate"))
{
do
{
string digits = Program.GetNextDigits();
if (digits == null)
{
betaKey = "No key found";
break;
}
betaKey = String.Format(CultureInfo.InvariantCulture, Program.BetaKeyFormat, digits);
Console.Write("Trying - " + betaKey);
//Console.WriteLine();
ie.TextField(Find.ByName("key")).TypeText(betaKey);
ie.TextField(Find.ByName("sec_name")).TypeText(Program.AccountName);
ie.TextField(Find.ByName("sec_pass")).TypeText(Program.AccountPassword);
ie.TextField(Find.ByName("sec_pass_confirm")).TypeText(Program.AccountPassword);
ie.CheckBox(Find.ByName("agreement")).Checked = true;
ie.Button(Find.ByValue("Activate My Key")).Click();
if (ie.ContainsText("That key appears to be invalid."))
{
Console.WriteLine(", FAILED");
}
else if (ie.ContainsText("That key has already been activated."))
{
Console.WriteLine(", IN USE");
}
else
{
Console.WriteLine(", SUCCESS!");
break;
}
}
while (true);
Console.ReadKey(true);
}
}
private static string GetNextDigits()
{
if (slot3Offset >= Program.Slot3Digits.Length)
{
slot3Offset = 0;
slot2Offset++;
}
if (slot2Offset >= Program.Slot2Digits.Length)
{
slot2Offset = 0;
slot1Offset++;
}
if (slot1Offset >= Program.Slot1Digits.Length)
{
return null;
}
return new string(new char[] { Program.Slot1Digits[slot1Offset], Program.Slot2Digits[slot2Offset], Program.Slot3Digits[slot3Offset++] });
если нет то удаляйте тему...