Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.IO;
- namespace Custom
- {
- class Program
- {
- // Definere paths til permanente txt hukommelse
- static string userpath = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Username.txt";
- static string firstpath = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Bools\Firststartup.txt";
- static string passpath = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Password.txt";
- static string colorpath = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Color.txt";
- //Note paths txt
- static string Note1path = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Notes\Note1.txt";
- static string Note2path = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Notes\Note2.txt";
- static string Note3path = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Notes\Note3.txt";
- static string Note4path = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Notes\Note4.txt";
- static string Note5path = @"C:\Users\Tobias\source\repos\Password\Password\Resources\Notes\Note5.txt";
- //Sætter strings til txt filers indhold
- static string Firsttime = File.ReadAllText(firstpath);
- static string Username = File.ReadAllText(userpath);
- static string Password = File.ReadAllText(passpath);
- static string Note1txt = File.ReadAllText(Note1path);
- static string Note2txt = File.ReadAllText(Note2path);
- static string Note3txt = File.ReadAllText(Note3path);
- static string Note4txt = File.ReadAllText(Note4path);
- static string Note5txt = File.ReadAllText(Note5path);
- static string colorSelected = File.ReadAllText(colorpath);
- static bool dowhile = false;
- //Hemmeligt keyword for at troubleshoot password
- static string sendnudes = "69 1337";
- //Universal input readline string
- static string input;
- static void colorChosen()
- {
- switch (colorSelected)
- {
- case "1":
- Console.ForegroundColor = ConsoleColor.White;
- Console.Clear();
- break;
- case "2":
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.Clear();
- break;
- case "3":
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Clear();
- break;
- case "4":
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Clear();
- break;
- case "5":
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.Clear();
- break;
- default:
- break;
- }
- }
- static void Loading()
- {
- colorChosen();
- Console.BackgroundColor = ConsoleColor.Black;
- Console.CursorVisible = false;
- Console.SetCursorPosition(1, 1);
- for (int i = 0; i <= 100; i++)
- {
- for (int y = 0; y < i; y++)
- {
- Console.Write("█");
- }
- Console.WriteLine(i + "/100");
- Console.SetCursorPosition(1, 1);
- System.Threading.Thread.Sleep(51);
- }
- Console.WriteLine("LOADING COMPLETE!");
- Thread.Sleep(869);
- Console.Clear();
- Console.CursorVisible = true;
- }
- static void Getinput()
- {
- input = Convert.ToString(Console.ReadKey().KeyChar);
- }
- static void Firststartup()
- {
- Console.WriteLine("Thank you for using KAB OS 1.0!\n" +
- "Press F11 for full experience\n" +
- "We see that this is the first time you started the program.\n" +
- "We will now open a first time setup.\n" +
- "You can edit your username and password at any time by pressing 0 in the menu!\n" +
- "Press any key to continue . . .");
- Console.ReadKey();
- Console.Clear();
- Console.WriteLine("What new username do you want?");
- File.WriteAllText(userpath, Console.ReadLine());
- Console.WriteLine("Your username has now been set!\nPress any button to continue . . .");
- Console.ReadKey();
- Console.Clear();
- Console.WriteLine("What password do you want?");
- File.WriteAllText(passpath, Console.ReadLine());
- Console.WriteLine("Your password has now been set!\nPress any button to continue . . .");
- Console.ReadKey();
- Console.Clear();
- Console.WriteLine("What color would you like your theme to be?" +
- "\n" +
- "1. White" +
- "\n" +
- "2. Blue" +
- "\n" +
- "3. Red" +
- "\n" +
- "4. Green" +
- "\n" +
- "5. Yellow" +
- "\n" +
- "E. Exit");
- Getinput();
- switch (input)
- {
- case "1":
- File.WriteAllText(colorpath, "1");
- break;
- case "2":
- File.WriteAllText(colorpath, "2");
- break;
- case "3":
- File.WriteAllText(colorpath, "3");
- break;
- case "4":
- File.WriteAllText(colorpath, "4");
- break;
- case "5":
- File.WriteAllText(colorpath, "5");
- break;
- default:
- break;
- }
- colorSelected = File.ReadAllText(colorpath);
- colorChosen();
- Firsttime = File.ReadAllText(firstpath);
- Username = File.ReadAllText(userpath);
- Password = File.ReadAllText(passpath);
- File.WriteAllText(firstpath, "1");
- Menu();
- }
- static void SettingsChange()
- {
- Console.Clear();
- Console.WriteLine("What setting would you like to change?" +
- "\n" +
- "1. Password" +
- "\n" +
- "2. Username" +
- "\n" +
- "3. Change theme" +
- "\n" +
- "F. Factoryreset" +
- "\n" +
- "E. Exit");
- Getinput();
- switch (input)
- {
- case "1":
- Console.Clear();
- Console.WriteLine("Welcome To the Password-changing\nWhat new password do you want?");
- File.WriteAllText(passpath, Console.ReadLine());
- Console.WriteLine("Your password has now been changed!\nPress any button to continue . . .");
- break;
- case "2":
- Console.Clear();
- Console.WriteLine("Welcome To the Username-changing\nWhat new username do you want?");
- File.WriteAllText(userpath, Console.ReadLine());
- Console.WriteLine("Your username has now been changed!\nPress any button to continue . . .");
- Username = File.ReadAllText(userpath);
- break;
- case "3":
- Console.Clear();
- Console.WriteLine("What color would you like your theme to be?" +
- "\n" +
- "1. White" +
- "\n" +
- "2. Blue" +
- "\n" +
- "3. Red" +
- "\n" +
- "4. Green" +
- "\n" +
- "5. Yellow" +
- "\n" +
- "E. Exit");
- Getinput();
- switch (input)
- {
- case "1":
- File.WriteAllText(colorpath, "1"); colorChosen();
- break;
- case "2":
- File.WriteAllText(colorpath, "2");
- break;
- case "3":
- File.WriteAllText(colorpath, "3");
- break;
- case "4":
- File.WriteAllText(colorpath, "4");
- break;
- case "5":
- File.WriteAllText(colorpath, "5");
- break;
- default:
- break;
- }
- colorSelected = File.ReadAllText(colorpath);
- colorChosen();
- break;
- case "f":
- case "F":
- Console.Clear();
- Console.WriteLine("Are you sure you want to factory reset" +
- "\n" +
- "Y/N?");
- Getinput();
- if (input == "Y" || input == "y")
- {
- File.WriteAllText(firstpath, "0");
- Console.Clear();
- Console.WriteLine("Your pc will now shutdown . . .");
- System.Threading.Thread.Sleep(1500);
- Environment.Exit(0);
- }
- break;
- case "e":
- case "E":
- Menu();
- break;
- default:
- SettingsChange();
- break;
- }
- }
- static void Main(string[] args)
- {
- Console.Title = "KAB OS 1.0";
- colorChosen();
- //Remove scrollbar
- Console.BufferWidth = Console.WindowWidth = 125;
- Console.BufferHeight = Console.WindowHeight;
- //Permanent colorsets
- Console.BackgroundColor = ConsoleColor.Black;
- Console.Clear();
- if (Firsttime == "0")
- {
- // Default color
- File.WriteAllText(colorpath, "4");
- colorSelected = File.ReadAllText(colorpath);
- colorChosen();
- }
- Loading();
- //Checks for first time launch
- if (Firsttime == "0")
- {
- // Default color
- File.WriteAllText(colorpath, "4");
- colorSelected = File.ReadAllText(colorpath);
- colorChosen();
- Firststartup();
- }
- else
- {
- Console.Write("Welcome to KAB OS 0.1 Beta {0}!" +
- "\n" +
- "You will need to enter a password to use the OS" +
- "\n" +
- "Press F11 for full experience\n", Username);
- }
- //Goto for secret code
- do
- {
- Console.WriteLine("\nEnter Password: ");
- input = Console.ReadLine();
- if (input == Password)
- {
- Console.WriteLine("Welcome!");
- Menu();
- }
- else if (input == sendnudes)
- {
- Console.WriteLine(Password.ToString());
- }
- else
- {
- Console.Clear();
- Console.WriteLine("Wrong password\nEnter to try again!");
- }
- } while (true);
- }
- static void Menu()
- {
- Console.Clear();
- Console.WriteLine("Hello {0}" +
- "\n" +
- "Enter the number to access the desired program" +
- "\n" +
- "0. Change Settings" +
- "\n" +
- "1. Games" +
- "\n" +
- "2. Notes" +
- "\n" +
- "E. To exit", Username);
- Getinput();
- switch (input)
- {
- case "0":
- Console.Clear();
- SettingsChange();
- Menu();
- break;
- case "1":
- Console.Clear();
- Gamemenu();
- Menu();
- break;
- case "2":
- Console.Clear();
- Notes();
- Menu();
- break;
- case "3":
- Calculator();
- break;
- case "4":
- case "5":
- case "6":
- case "7":
- case "8":
- case "9":
- break;
- case "e":
- case "E":
- case "q":
- case "Q":
- Console.WriteLine("\n");
- Environment.Exit(0);
- break;
- default:
- Menu();
- break;
- }
- }
- static void Notes()
- {
- Console.WriteLine("What note do you want to Interact with?" +
- "\n" +
- "1. Note" +
- "\n" +
- "2. Note" +
- "\n" +
- "3. Note" +
- "\n" +
- "4. Note" +
- "\n" +
- "5. Note");
- Getinput();
- switch (input)
- {
- case "1":
- Console.Clear();
- Console.WriteLine("If you do not write anything your note will stay the same");
- Console.WriteLine(Note1txt);
- input = Console.ReadLine();
- if (input != "")
- {
- File.WriteAllText(Note1path, input);
- }
- break;
- case "2":
- Console.Clear();
- Console.WriteLine("If you do not write anything your note will stay the same");
- Console.WriteLine(Note2txt);
- input = Console.ReadLine();
- if (input != "")
- {
- File.WriteAllText(Note2path, input);
- }
- break;
- case "3":
- Console.Clear();
- Console.WriteLine("If you do not write anything your note will stay the same");
- Console.WriteLine(Note3txt);
- input = Console.ReadLine();
- if (input != "")
- {
- File.WriteAllText(Note3path, input);
- }
- break;
- case "4":
- Console.Clear();
- Console.WriteLine("If you do not write anything your note will stay the same");
- Console.WriteLine(Note4txt);
- input = Console.ReadLine();
- if (input != "")
- {
- File.WriteAllText(Note4path, input);
- }
- break;
- case "5":
- Console.Clear();
- Console.WriteLine("If you do not write anything your note will stay the same");
- Console.WriteLine(Note5txt);
- input = Console.ReadLine();
- if (input != "")
- {
- File.WriteAllText(Note5path, input);
- }
- break;
- default:
- Console.Clear();
- Notes();
- break;
- }
- Note1txt = File.ReadAllText(Note1path);
- Note2txt = File.ReadAllText(Note2path);
- Note3txt = File.ReadAllText(Note3path);
- Note4txt = File.ReadAllText(Note4path);
- Note5txt = File.ReadAllText(Note5path);
- }
- static void Gamemenu()
- {
- Console.Clear();
- Console.WriteLine("Hello {0}" +
- "\n" +
- "Enter the number to access the desired game!" +
- "\n" +
- "" +
- "\n" +
- "1. Math-Games!" +
- "\n" +
- "E. To exit", Username);
- Getinput();
- switch (input)
- {
- case "0":
- case "1":
- Console.Clear();
- Mathgame();
- break;
- case "2":
- case "3":
- case "4":
- case "5":
- case "6":
- case "7":
- case "8":
- case "9":
- break;
- case "e":
- case "E":
- case "q":
- case "Q":
- Menu();
- break;
- default:
- Mathgame();
- break;
- }
- }
- static void Mathgame()
- {
- Console.Clear();
- Console.Title = "Math-Game";
- do
- {
- Console.WriteLine("Velkommen til matematik spillet" +
- "\n" +
- "Hvilket spil kunne du tænke dig at spille?" +
- "\n" +
- "1. Plus-Spil" +
- "\n" +
- "2. Minus-Spil" +
- "\n" +
- "3. Gange-Spil" +
- "\n" +
- "E. To exit");
- Getinput();
- switch (input)
- {
- case "1":
- Console.Clear();
- plusgame();
- Mathgame();
- break;
- case "2":
- Console.Clear();
- minusgame();
- Mathgame();
- break;
- case "3":
- Console.Clear();
- multigame();
- Mathgame();
- break;
- case "e":
- case "E":
- Menu();
- break;
- default:
- Console.Clear();
- break;
- }
- } while (true);
- Console.ReadKey();
- }
- static void plusgame()
- {
- int Spørgnr = 1;
- int Rigtignr = 0;
- do
- {
- Random rnd = new Random();
- int nr1 = rnd.Next(1, 100);
- int nr2 = rnd.Next(1, 100);
- Console.WriteLine("Spørgsmål nr {0}, du har {1} rigtige" +
- "\n" +
- "Hvad er {2} + {3}?" +
- "\n" +
- "Skriv exit for at lukke spillet", Spørgnr, Rigtignr, nr1, nr2);
- input = Console.ReadLine();
- if (input == Convert.ToString(nr1 + nr2))
- {
- Console.WriteLine("Det er nemlig rigtigt!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- Spørgnr++;
- Rigtignr++;
- }
- else if (input == "exit" || input == "Exit")
- {
- dowhile = true;
- }
- else
- {
- Console.WriteLine("Fejl");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- Spørgnr++;
- }
- } while (dowhile == false);
- dowhile = false;
- }
- static void minusgame()
- {
- int Spørgnr = 1;
- int Rigtignr = 0;
- do
- {
- Random rnd = new Random();
- int nr1 = rnd.Next(1, 100);
- int nr2 = rnd.Next(1, 100);
- Console.WriteLine("Spørgsmål nr {0}, du har {1} rigtige" +
- "\n" +
- "Hvad er {2} - {3}?" +
- "\n" +
- "Skriv exit for at lukke spillet", Spørgnr, Rigtignr, nr1, nr2);
- input = Console.ReadLine();
- if (input == Convert.ToString(nr1 - nr2))
- {
- Console.WriteLine("Det er nemlig rigtigt!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- Spørgnr++;
- Rigtignr++;
- }
- else if (input == "exit" || input == "Exit")
- {
- }
- else
- {
- Console.WriteLine("Fejl");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- Spørgnr++;
- }
- } while (dowhile == false);
- dowhile = false;
- }
- static void multigame()
- {
- int Spørgnr = 1;
- int Rigtignr = 0;
- do {
- Random rnd = new Random();
- int nr1 = rnd.Next(1, 10);
- int nr2 = rnd.Next(1, 10);
- Console.WriteLine("Spørgsmål nr {0}, du har {1} rigtige" +
- "\n" +
- "Hvad er {2} * {3}?" +
- "\n" +
- "Skriv exit for at lukke spillet", Spørgnr, Rigtignr, nr1, nr2);
- input = Console.ReadLine();
- if (input == Convert.ToString(nr1 * nr2))
- {
- Console.WriteLine("Det er nemlig rigtigt!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- Spørgnr++;
- Rigtignr++;
- }
- else if (input == "exit" || input == "Exit")
- {
- }
- else
- {
- Console.WriteLine("Fejl");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- Spørgnr++;
- }
- } while (dowhile == false);
- dowhile = false;
- }
- static void Calculator()
- {
- Console.WriteLine("Enter the first number: ");
- float num1 = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Enter the second number: ");
- float num2 = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Select the operation you want me to perform: ");
- Console.WriteLine("_________________________________________");
- Console.WriteLine("1: Multiplication");
- Console.WriteLine("2: Addition");
- Console.WriteLine("3: Subtraction");
- Console.WriteLine("4: Division");
- Console.WriteLine("__________________________________________");
- Console.WriteLine("Now please enter your choice from: ");
- int choice = Convert.ToInt32(Console.ReadLine());
- if (choice == 1)
- {
- Console.WriteLine("The result is: " + (num1 * num2));
- Console.Read();
- }
- else if (choice == 2)
- {
- Console.WriteLine("The result is: " + (num1 + num2));
- Console.Read();
- }
- else if (choice == 3)
- {
- Console.WriteLine("The result is: " + (num1 - num2));
- Console.Read();
- }
- else if (choice == 4)
- {
- Console.WriteLine("The result is: " + (num1 / num2));
- Console.Read();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement