Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using KeepOnGoing.Properties;
- using Microsoft.Win32;
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Media;
- using System.Net;
- using System.Reflection;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- namespace KeepOnGoing
- {
- internal class Program
- {
- public static StreamWriter writer;
- public static string user;
- public static string pass;
- public static string level;
- public static string hint = "Level 4 Tip:look for me in the Registry!";
- public static string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\account.txt";
- private static RegistryKey key;
- public static void SignUp()
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Welcome to KeepOnGoing!");
- Console.WriteLine(string.Concat(new string[]
- {
- "In this challenge you have to pass 5 levels , but first-let's sign-up!",
- Environment.NewLine,
- Environment.NewLine,
- "Remember-once you have signed up you cannot sign up anymore!",
- Environment.NewLine,
- "Your user details are unique and cannot be changed in the future."
- }));
- while (true)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Enter your new username : ");
- Console.ForegroundColor = ConsoleColor.White;
- Program.user = Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Enter your new Password : ");
- Console.ForegroundColor = ConsoleColor.White;
- Program.pass = Console.ReadLine();
- bool flag = string.IsNullOrEmpty(Program.user) || string.IsNullOrEmpty(Program.pass);
- if (!flag)
- {
- break;
- }
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("No empty fields please!" + Environment.NewLine);
- }
- WebRequest webRequest = WebRequest.Create("http://1fxpchallenge.esy.es/index.php?action=insert&user=" + Program.user + "&pass=" + Program.pass);
- WebResponse response = webRequest.GetResponse();
- string a;
- using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
- {
- a = streamReader.ReadToEnd();
- }
- bool flag2 = a == "insert";
- if (flag2)
- {
- Program.writer = new StreamWriter(Program.path);
- Program.writer.WriteLine(Program.user);
- Program.writer.WriteLine(Program.pass);
- Program.writer.WriteLine("1");
- Program.writer.Close();
- File.SetAttributes(Program.path, FileAttributes.Hidden);
- Console.WriteLine("The challenge has started!");
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Goodluck from Fxp");
- }
- else
- {
- Console.WriteLine("somthing went wrong...");
- }
- Console.ReadKey();
- Environment.Exit(0);
- }
- public static string NeedUpdate(string level)
- {
- int num = 0;
- Settings.Default.needupdate = true;
- Settings.Default.Save();
- File.SetAttributes(Program.path, FileAttributes.Normal);
- Program.writer = new StreamWriter(Program.path);
- Program.writer.WriteLine(Program.user);
- Program.writer.WriteLine(Program.pass);
- bool flag = level == "Done";
- if (flag)
- {
- Program.writer.WriteLine(level);
- }
- else
- {
- num = Convert.ToInt32(level);
- Program.writer.WriteLine(++num);
- }
- Program.writer.Close();
- File.SetAttributes(Program.path, FileAttributes.Hidden);
- return num.ToString();
- }
- public static int DecreaseTries()
- {
- int num = Convert.ToInt32(Program.key.GetValue("tries"));
- Program.key.SetValue("tries", --num);
- return num;
- }
- public static void level4()
- {
- Program.key = Registry.CurrentUser.OpenSubKey("KeepOnGoing", RegistryKeyPermissionCheck.ReadWriteSubTree);
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("From now on,you have only 100 attempts to win this level");
- Console.WriteLine("Change it at least to 200!");
- Console.WriteLine("Tip: a reflector/hex editor might help");
- Program.key = Registry.CurrentUser.OpenSubKey("KeepOnGoing", RegistryKeyPermissionCheck.ReadWriteSubTree);
- int i = Convert.ToInt32(Program.key.GetValue("tries"));
- while (i < 200)
- {
- bool flag = i < 1;
- if (flag)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Sorry,but you have consumed all the attempts");
- Console.Read();
- Environment.Exit(0);
- }
- else
- {
- Console.ReadLine();
- i = Program.DecreaseTries();
- Console.WriteLine("You have only " + i + " attempts.");
- }
- }
- Console.WriteLine(Environment.NewLine + Environment.NewLine + Environment.NewLine);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Congratulations,You made it! lets move on to level the final stage!");
- Program.level = Program.NeedUpdate(Program.level);
- Program.level5();
- }
- public static string Base64Decode(string base64EncodedData)
- {
- byte[] bytes = Convert.FromBase64String(base64EncodedData);
- return Encoding.UTF8.GetString(bytes);
- }
- public static void level3()
- {
- Console.WriteLine("Convert the following phase to ternary");
- Console.BackgroundColor = ConsoleColor.Red;
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("\r\n if (x > 1)\r\n Console.WriteLine(\"Congratulations\");\r\n else\r\n Console.WriteLine(\"Try again please\");\r\n");
- Console.BackgroundColor = ConsoleColor.Black;
- string text = "Console.WriteLine(x > 1 ? \"Congratulations\" : \"Try again please\");";
- string text2 = Console.ReadLine();
- while (!text2.Trim().Equals(text.Trim()))
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Incorrect.Please try again.");
- Console.ForegroundColor = ConsoleColor.White;
- text2 = Console.ReadLine();
- }
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Congratulations,You made it! lets move on to level 4!");
- RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("KeepOnGoing", RegistryKeyPermissionCheck.ReadWriteSubTree);
- registryKey.SetValue("tries", 100);
- Program.level = Program.NeedUpdate(Program.level);
- Program.level4();
- }
- public static void level5()
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Wow" + Environment.NewLine);
- Console.WriteLine("I must admit-i wouldn't belive you'll reach the final stage!");
- Console.WriteLine("Just Press enter to win...");
- string a = Console.ReadLine();
- while (a != "enter")
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Damnn you are so close!");
- a = Console.ReadLine();
- }
- SoundPlayer soundPlayer = new SoundPlayer(Resources.sound);
- soundPlayer.Play();
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Woah!Unbelievable!");
- Console.WriteLine("You have won!!!");
- Console.WriteLine("Fxp is proud of you!");
- Thread.Sleep(5000);
- Program.NeedUpdate("Done");
- Program.FinalReward();
- }
- public static void FinalReward()
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("In order to achieve the reward you will have to enter your Fxp Nickname");
- Console.WriteLine("Fill it carefully");
- string text = "";
- string a = "n";
- while (a != "y")
- {
- Console.WriteLine("Enter your nickname:");
- text = Console.ReadLine();
- Console.WriteLine("Are you sure that this is your Fxp user?" + Environment.NewLine + "Type y or n");
- a = Console.ReadLine();
- }
- File.AppendAllText(Program.path, text);
- WebRequest webRequest = WebRequest.Create(string.Concat(new string[]
- {
- "http://1fxpchallenge.esy.es/index.php?action=update&user=",
- Program.user,
- "&pass=",
- Program.pass,
- "&nick=",
- text,
- "&level=Done"
- }));
- WebResponse response = webRequest.GetResponse();
- string a2;
- using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
- {
- a2 = streamReader.ReadToEnd();
- }
- bool flag = a2 == "nick";
- if (flag)
- {
- Console.WriteLine(string.Concat(new string[]
- {
- "Thank you for participating in the challenge,",
- text,
- ".",
- Environment.NewLine,
- "We all wish you happy passover:)"
- }));
- Program.CleanUp();
- }
- }
- public static void level2()
- {
- string text = string.Concat(File.ReadLines("settings.txt"));
- bool flag = Program.Base64Decode(text).Equals("can_play=true");
- if (flag)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Congratulations,You made it! lets move on to level 3!");
- Console.ForegroundColor = ConsoleColor.White;
- Program.level = Program.NeedUpdate(Program.level);
- Program.level3();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Oh,it seems like somthing went wrong in the settings...");
- Console.WriteLine("Try to fix it so you can keep on playing.....");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine(text);
- Thread.Sleep(1000000);
- }
- }
- public static void CleanUp()
- {
- Console.WriteLine("Cleaning up");
- Process.Start(new ProcessStartInfo
- {
- Arguments = "/C choice /C Y /N /D Y /T 0 & Del \"" + Application.ExecutablePath + "\"",
- WindowStyle = ProcessWindowStyle.Hidden,
- CreateNoWindow = true,
- FileName = "cmd.exe"
- });
- }
- public static int UpdateLevel(string level)
- {
- WebRequest webRequest = WebRequest.Create(string.Concat(new string[]
- {
- "http://1fxpchallenge.esy.es/index.php?action=update&user=",
- Program.user,
- "&pass=",
- Program.pass,
- "&level=",
- level
- }));
- WebResponse response = webRequest.GetResponse();
- string a;
- using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
- {
- a = streamReader.ReadToEnd();
- }
- bool flag = a == "update";
- int result;
- if (flag)
- {
- result = 0;
- }
- else
- {
- result = -1;
- }
- return result;
- }
- private static void Main(string[] args)
- {
- bool flag = !File.Exists(Program.path);
- if (flag)
- {
- Program.SignUp();
- }
- else
- {
- StreamReader streamReader = new StreamReader(Program.path);
- Program.user = streamReader.ReadLine().Trim();
- Program.pass = streamReader.ReadLine().Trim();
- Program.level = streamReader.ReadLine().Trim();
- try
- {
- object obj = streamReader.ReadLine().Trim();
- Console.WriteLine("Seems like you've already won...");
- Console.Read();
- streamReader.Close();
- }
- catch
- {
- streamReader.Close();
- bool flag2 = Program.level == "1";
- if (flag2)
- {
- bool flag3 = args.Length != 2;
- if (flag3)
- {
- Console.WriteLine("Usage [username] [password]");
- Environment.Exit(0);
- }
- bool flag4 = args[0].Trim() == Program.user && args[1].Trim() == Program.pass;
- if (flag4)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Congratulations,You made it! lets move on to level 2");
- Console.WriteLine("..........");
- Program.level = Program.NeedUpdate(Program.level);
- File.WriteAllText("settings.txt", "Y2FuX3BsYXk9ZmFsc2U=");
- Program.level2();
- }
- else
- {
- Console.WriteLine("wrong Username/Password");
- }
- }
- else
- {
- bool flag5 = Program.level.ToString() != "Done";
- if (flag5)
- {
- bool needupdate = Settings.Default.needupdate;
- if (needupdate)
- {
- Program.UpdateLevel(Program.level);
- Settings.Default.needupdate = false;
- Settings.Default.Save();
- }
- string name = "level" + Program.level.ToString();
- Type typeFromHandle = typeof(Program);
- MethodInfo method = typeFromHandle.GetMethod(name);
- method.Invoke(null, null);
- }
- else
- {
- Program.FinalReward();
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement