Ejemplo n.º 1
0
        public static configObject renewconfig(Boolean AskToSave)
        {
            Console.Clear();
            Write.ascii();
            Colorful.Console.WriteLine("Author Name:", Color.White);
            config.Author = Console.ReadLine();
            Colorful.Console.WriteLine("Module Name:", Color.White);
            config.ModuleName = Console.ReadLine();
            Colorful.Console.WriteLine("Post Url:", Color.White);
            config.postUrl = Console.ReadLine();
            Colorful.Console.WriteLine("Post Data:", Color.White);
            config.postData = Console.ReadLine();
            Colorful.Console.WriteLine("Good Keycheck:", Color.White);
            config.goodkeycheck = Console.ReadLine();
            Colorful.Console.WriteLine("Bad Keycheck:", Color.White);
            config.Badkeycheck = Console.ReadLine();
            Colorful.Console.WriteLine("Post Type:", Color.White);
            config.posttype = Console.ReadLine();
nigger:
            System.IO.File.WriteAllText("compiled.json", JsonConvert.SerializeObject(config));
            Console.WriteLine("Compiled Successfully...", Color.LawnGreen);
            Thread.Sleep(500);
            mainmenu.menu();
            return(config);
        }
Ejemplo n.º 2
0
 public static string licenseInformation()
 {
     using (HttpRequest httpRequest = new HttpRequest())
     {
         Console.WriteLineFormatted("\n{0}{1}{2} License:", Color.White, design.colors);
         Console.WriteFormatted(" {3} ", Color.White, design.colors);
         string license = Console.ReadLine();
         try
         {
             string             result      = httpRequest.Get("https://developers.auth.gg/LICENSES/?type=fetch&authorization=" + Program.AuthorizationKey + "&license=" + license).ToString();
             informationLicense infoLicense = JsonConvert.DeserializeObject <informationLicense>(result);
             Console.WriteLineFormatted("\n{0}{1}{2} Status: " + infoLicense.status, Color.White, design.colors);
             Console.WriteLineFormatted("{0}{1}{2} License: " + infoLicense.license, Color.White, design.colors);
             Console.WriteLineFormatted("{0}{1}{2} Rank: " + infoLicense.rank, Color.White, design.colors);
             Console.WriteLineFormatted("{0}{1}{2} Used: " + infoLicense.used, Color.White, design.colors);
             Console.WriteLineFormatted("{0}{1}{2} Used_by: " + infoLicense.used_by, Color.White, design.colors);
             Console.WriteLineFormatted("{0}{1}{2} Created: " + infoLicense.created, Color.White, design.colors);
             return("done");
         }
         catch (Exception ex)
         {
             Console.WriteLine("\n " + ex.Message, Color.Red);
             Console.ReadLine();
             Environment.Exit(0);
             return(null);
         }
     }
 }
Ejemplo n.º 3
0
 public static void tryingAuthorizationKey()
 {
     try
     {
         using (HttpRequest httpRequest = new HttpRequest())
         {
             string result = httpRequest.Get("https://developers.auth.gg/USERS/?type=count&authorization=" + Program.AuthorizationKey).ToString();
             if (result.Contains("\"status\":\"failed\""))
             {
                 Console.WriteLine("\nSomething went wrong, please check your authorization key or renew it.", Color.Red);
             }
             else if (result.Contains("\"status\":\"success\""))
             {
                 Console.Clear();
                 Program.Menu();
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("\n " + ex.Message, Color.Red);
         Console.ReadLine();
         Environment.Exit(0);
     }
 }
Ejemplo n.º 4
0
 public static string editPassword()
 {
     using (HttpRequest httpRequest = new HttpRequest())
     {
         Console.WriteLineFormatted("\n{0}{1}{2} User:"******" {3} ", Color.White, design.colors);
         string userSearch = Console.ReadLine();
         Console.WriteLineFormatted("\n{0}{1}{2} new Password:"******" {3} ", Color.White, design.colors);
         string newPassword = Console.ReadLine();
         try
         {
             string       result = httpRequest.Get("https://developers.auth.gg/USERS/?type=changepw&authorization=" + Program.AuthorizationKey + "&user="******"&password="******"\n{0}{1}{2} Status: " + user.status, Color.White, design.colors);
             Console.WriteLineFormatted("{0}{1}{2} Info: " + user.info, Color.White, design.colors);
             return("done");
         }
         catch (Exception ex)
         {
             Console.WriteLine("\n " + ex.Message, Color.Red);
             Console.ReadLine();
             Environment.Exit(0);
             return(null);
         }
     }
 }
Ejemplo n.º 5
0
        }//InitiateSalesReport

        public void FeedMoney()
        {
            List<string> allowedBills = new List<string> { "1", "2", "5", "10", "20" };
            //const bool Counterfeit = false;
            //bool isFeedMoneyAccepted = Counterfeit;

            MasterPage();
            Console.WriteLine("FEED MONEY\n", Color.LimeGreen);
            Console.WriteLine("Please enter whole dollar amount (1, 2, 5, 10, 20):");
            string dollarFeedInput = Console.ReadLine();

            if (allowedBills.Contains(dollarFeedInput))
            {

                int dollarFeed = 0;
                int.TryParse(dollarFeedInput, out dollarFeed);
                vendingMachine.AddTender(dollarFeed);

            }
            else
            {
                ErrorMessage();
                Console.WriteLine("Valid U.S. currency ONLY\n");
                Console.ReadLine();

            }


        }//FeedMoney
Ejemplo n.º 6
0
        public bool User_Login_Panel()
        {
            {
                List <NewUser> Personn2 = null;
                string         json     = File.ReadAllText("Person.json");
                Personn2 = JsonConvert.DeserializeObject <List <NewUser> >(json);
                JsonSerializer ser = new JsonSerializer();
                System.Console.WriteLine("Enter User Name");
                string User_Name1 = Console.ReadLine();


                foreach (var item in Personn2)
                {
                    if (item.User_Name == User_Name1)
                    {
                        string User_Passworld1 = Console.ReadLine();
                        if (item.User_Passworld == User_Passworld1)
                        {
                            return(true);
                        }

                        else
                        {
                            Console.WriteLine("Passworld Error", ColorTranslator.FromHtml("#00FFFF"));
                        }
                    }
                }
                System.Console.WriteLine("User Name Error");
                return(false);
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            var game       = new Logic.Core.Game();
            var gameState  = game.CheckedGameState();
            var styleSheet = CreateStyleSheet();

            while (gameState == GameState.Game)
            {
                Console.Clear();
                Console.WriteLineStyled(DrawBoard.Draw(game), styleSheet);

                if (game.CurrentPlayer.IsEnemy)
                {
                    Thread.Sleep(1000);
                    game.MakeMove(GeneratorBot.GeneratedMove(game.Player.Board));
                }
                else
                {
                    game.MakeMove(GameInput.DoMove());
                }
            }


            System.Console.WriteLine(gameState);
            Console.ReadLine();
        }
Ejemplo n.º 8
0
 internal static bool InputInsoCookie(out string Cookie)
 {
     Console.WriteLine("请输入浏览器储存在 inso.link 域名下命名为 do_not_remove_this_0w0 的Cookie 值。");
     Console.WriteLine("或按 回车键 跳过。");
     while (true)
     {
         string s = Console.ReadLine();
         if (s != "")
         {
             if (DownloadEngine.Servers.Inso.IsCookieValid(s))
             {
                 WriteStatus(Status.Ok);
                 Cookie = s;
                 return(true);
             }
             else
             {
                 WriteStatus(Status.Fail);
             }
         }
         else
         {
             WriteStatus(Status.Skip);
             Cookie = null;
             return(false);
         }
     }
 }
Ejemplo n.º 9
0
        public void new_user()
        {
            NewUser k1 = new NewUser();
            {
                Console.WriteLine("Login");
                k1.User_Name = Console.ReadLine();
                Console.WriteLine("PASSWORLD");
                k1.User_Passworld = Console.ReadLine();
                Console.WriteLine("@Email");
                k1.User_Email = Console.ReadLine();

                List <NewUser> Personn2 = null;
                string         json     = File.ReadAllText("Person.json");
                Personn2 = JsonConvert.DeserializeObject <List <NewUser> >(json);
                Personn2.Add(k1);

                JsonSerializer ser = new JsonSerializer();
                using (var sw = new StreamWriter("Person.json"))
                {
                    using (var jw = new JsonTextWriter(sw))
                    {
                        jw.Formatting = Formatting.Indented;
                        ser.Serialize(jw, Personn2);
                    }
                }
            }//creat new user
        }
Ejemplo n.º 10
0
        // This displays after the user assigns their traits and begins the game
        public static void DisplayGameIntro()
        {
            Console.ReplaceAllColorsWithDefaults();

            var enterKeyPressed = false;
            var r = 255;
            var g = 255;
            var b = 255;

            foreach (var line in ConsoleStrings.GameIntro)
            {
                if (enterKeyPressed)
                {
                    Console.WriteLine(line, Color.FromArgb(r, g, b));
                }
                else
                {
                    enterKeyPressed = TypingAnimation.Animate(line, Color.FromArgb(r, g, b));
                }

                g -= 25;
                b -= 25;
            }

            Console.WriteWithGradient(ConsoleStrings.PressEnterPrompt, Color.Yellow, Color.DarkRed, 4);
            Console.ReadLine();
        }
Ejemplo n.º 11
0
        internal static bool InputBloodcatCookie(out string Cookie)
        {
            Console.WriteLine("请输入浏览器储存在 bloodcat.com 域名下命名为 obm_human 的Cookie 值。");
            Console.WriteLine("或按 回车键 跳过。");
            while (true)
            {
                string s = Console.ReadLine();
                if (s != "")
                {
                    string[] a = s.Split('.');
                    s = a[0] + '.' + "eyJpYXQiOjE1MzYwMTg3OTQsImlwIjoiMTgyLjEwOS41OC4xMDkiLCJ1YSI6MzgzODg2ODg0OH0" + '.' + a[2];

                    if (DownloadEngine.Servers.Bloodcat.IsCookieValid(s))
                    {
                        WriteStatus(Status.Ok);
                        Cookie = s;
                        return(true);
                    }
                    else
                    {
                        WriteStatus(Status.Fail);
                    }
                }
                else
                {
                    WriteStatus(Status.Skip);
                    Cookie = null;
                    return(false);
                }
            }
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            int DA = 244;
            int V  = 212;
            int ID = 255;

            Console.WriteAscii("Test: Web Server...", Color.FromArgb(DA, V, ID));
            DirectoryInfo di     = new DirectoryInfo(Environment.CurrentDirectory);
            var           server = new WebServer("http://*:51111/", $@"{di.FullName}\..\..\..\webroot");

            try
            {
                server.Start();

                Console.WriteLine("Server running... press Enter to stop", Color.YellowGreen);
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message, Color.OrangeRed);
            }
            finally
            {
                server.Stop();
            }

            Console.WriteLine("Server shutting down...", Color.OrangeRed);
            Thread.Sleep(2000);
        }
Ejemplo n.º 13
0
        public bool PridejClenaCommand(string arg = "")
        {
            CrewMember newMember = new CrewMember();

            Console.Write("Zadejte Jméno: ");
            newMember.Name = Console.ReadLine();
            Console.Write("Zadejte Příjmení: ");
            newMember.Surname = Console.ReadLine();
            Console.Write("Zadejte Barvu Týmu: ");
            newMember.Team = Console.ReadLine();

            List <CrewMember> expected = Repository.ExpectedCrewMembers;

            List <CrewMember> matching = expected.Where(e => e.Name == newMember.Name &&
                                                        e.Surname == newMember.Surname &&
                                                        e.Team == newMember.Team).ToList();

            if (matching.Count() == 0)
            {
                Console.WriteLine("Tato osoba se na lodi nenachází! (Zkontrolujte Jméno, Příjmení a Tým");
                return(false);
            }

            List <CrewMember> members = Repository.CrewMembers;

            members.Add(newMember);
            Repository.CrewMembers = members;

            Console.WriteLine("Člen úspěšně přidán");

            return(true);
        }
Ejemplo n.º 14
0
 public static void FatalError(string message = "")
 {
     Log(message, Level.Fatal, LogTarget.Console, LogTarget.File);
     Console.Write("Press Enter to Quit...", Color.Red);
     Console.ReadLine();
     Environment.Exit(1);
 }
Ejemplo n.º 15
0
        public static void Menu()
        {
            design.Logo();
            Console.WriteLineFormatted("\n {0}{4}{2} Users", Color.White, design.colors);
            Console.WriteLineFormatted(" {0}{5}{2} Licenses", Color.White, design.colors);
            Console.WriteLineFormatted(" {0}{6}{2} HWID", Color.White, design.colors);
            Console.WriteFormatted("  {3} ", Color.White, design.colors);
            string option = Console.ReadLine();

            switch (option)
            {
            case "1":
                Console.Clear();
                Users();
                break;

            case "2":
                Console.Clear();
                LicenseMenu();
                break;

            case "3":
                Console.Clear();
                HWIDMenu();
                break;
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Start of program to require settings.
 /// </summary>
 private static string[] RequireInput()
 {
     Console.WriteLine(
         "\nDescription: Move all audio files in a given directory in a sorted way to the destination directory.\n");
     ShowHelp();
     Console.Write("Options: ");
     return(Console.ReadLine().Split(' '));
 }
Ejemplo n.º 17
0
        private static string GetAppleCode()
        {
            WriteTitle("Get Apple Code");

            var loginUri = _client.GetLoginUri();

            WriteInfo("1 - Go to {0}\n2 - Login\n3 - Enter the apple code received on your callback:", loginUri);
            return(Console.ReadLine());
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Checks for existing dirs with same name or similar name.
        /// Using Damerau–Levenshtein distance from http://mihkeltt.blogspot.de/2009/04/dameraulevenshtein-distance.html.
        /// </summary>
        private static string CreateDirOrSelectExisting(string destination)
        {
            //if the directory exists, nothing to create or check
            if (Directory.Exists(destination))
            {
                return(destination);
            }

            //get parent dir
            var parent_info = new DirectoryInfo(destination.Substring(0, destination.LastIndexOf('\\')));

            var destination_name = destination.Substring(destination.LastIndexOf('\\'), destination.Length - destination.LastIndexOf('\\'));

            var possbile_dirs = (from child_dir in Directory.GetDirectories(parent_info.FullName)
                                 let child_info = new DirectoryInfo(child_dir)
                                                  let distance = destination_name.DamerauLevenshteinDistanceTo(child_info.Name)
                                                                 where distance <= 3
                                                                 select child_dir).
                                ToList();

            //if no similar dirs exists, create the destination dir
            if (possbile_dirs.Count == 0)
            {
                Directory.CreateDirectory(destination);
                return(destination);
            }
            else
            {
                Console.WriteLine("Similar folders found to " + destination_name + ". " +
                                  "Pleaes select one by typing in the number or type 0 for creating the folder.");

                for (var i = 0; i < possbile_dirs.Count; i++)
                {
                    var possbile_Dir = possbile_dirs[i];
                    Console.Write(i + 1 + ". ");
                    Console.WriteLine(possbile_Dir, Color.Tomato);
                }

                Console.Write("Selection: ");
                var selection = -1;
                while (selection < 0 || selection > possbile_dirs.Count)
                {
                    TryParse(Console.ReadLine(), out selection);
                }

                if (selection == 0)
                {
                    Directory.CreateDirectory(destination);
                    return(destination);
                }
                else
                {
                    Directory.CreateDirectory(possbile_dirs[selection - 1]);
                    return(possbile_dirs[selection - 1]);
                }
            }
        }
Ejemplo n.º 19
0
 }//SelectProduct
 public void FinishTransaction()
 {
     MasterPage();
     Console.WriteLine("ENJOY YOUR SNACK!\n", Color.LimeGreen);
     Console.WriteLine($"Your change is {vendingMachine.TransactionBalance.ToString("C")}\n");
     int[] change = vendingMachine.DispenseChange();  //display change from decimal [] 
     Console.WriteLine($"{change[0]} quarters, {change[1]} dimes, {change[2]} nickels", Color.LimeGreen);
     Console.ReadLine();
 }//FinishTransaction
Ejemplo n.º 20
0
        protected override void DoWhatYouGottaDo()
        {
            List <CrewMember> crewMembers = Repository.CrewMembers;

            Console.WriteLine("Počet členů: " + crewMembers.Count);

            int input = 0;

            while (input <= 0 || input > crewMembers.Count)
            {
                try
                {
                    Console.Write("Zadejte počet týmů (číslo větší než nula): ");
                    input = Convert.ToInt32(Console.ReadLine());
                }
                catch (System.FormatException)
                {
                }
            }

            List <List <CrewMember> > teams = new List <List <CrewMember> >();

            for (int i = 0; i < input; i = i + 1)
            {
                List <CrewMember> team = new List <CrewMember>();

                teams.Add(team);
            }

            int NumberMember = 0;
            int NumberTeam   = 0;

            foreach (CrewMember member in crewMembers)
            {
                teams[NumberTeam].Add(member);
                NumberTeam++;
                if (NumberTeam == input)
                {
                    NumberTeam = 0;
                }
            }

            foreach (var team in teams)
            {
                Console.WriteLine("Team " + (teams.IndexOf(team) + 1));

                foreach (var member in team)
                {
                    Console.Write(member.Name + " ");
                    Console.WriteLine(member.Surname);
                }

                Console.WriteLine();
            }

            Console.ReadLine();
        }
Ejemplo n.º 21
0
 static void GetWords()
 {
     //ask player to enter words
     for (int i = 0; i < Words.Length; i++)
     {
         Console.Write(Repeat(' ', 4) + "Please enter a/an " + Prompts[i] + ": ", Color.DeepSkyBlue);
         Words[i] = Console.ReadLine();
     }
 }
Ejemplo n.º 22
0
        private static void DisplayUsageError()
        {
            Formatter[] message = new Formatter[]
            {
                new Formatter("ENTER", Color.Crimson),
            };

            Console.WriteLineFormatted("Press {0} to quit", Color.Gray, message);
            Console.ReadLine();
        }
Ejemplo n.º 23
0
 static void Main(string[] args)
 {
     design.Logo();
     Console.Title = "Auth.GG | Manager - Application made by bnja#0606";
     Console.WriteLineFormatted("\n{0}{1}{2} Authorization key (https://auth.gg/dashboard/applications/settings.php):", Color.White, design.colors);
     Console.WriteFormatted(" {3} ", Color.White, design.colors);
     AuthorizationKey = Console.ReadLine();
     Req.tryingAuthorizationKey();
     Console.ReadLine();
 }
Ejemplo n.º 24
0
        }//RunInterface
        public bool Menu()
        {
            
            MasterPage();
            StyleSheet styleSheetMM = new StyleSheet(Color.White);
            styleSheetMM.AddStyle("MAIN MENU", (Color.LimeGreen));
            Console.WriteLine("MAIN MENU", Color.LimeGreen);
            Console.WriteLine("\n(1) Display Vending Machine Items\n(2) Make A Purchase\n(3) End Program\n");
            string menuInput = Console.ReadLine();

           
            const bool StopMenu = false;
            const bool ContinueMenu = true;
            const bool Incomplete = false;
            bool isPurchaseTransactionComplete = Incomplete;
            const string DisplaySelction = "1";
            const string PurchaseSelection = "2";
            const string SecretReport = "9";
            const string EndProgram = "3";

            if (menuInput == DisplaySelction)
            {
                Display();
                Console.WriteLineStyled("\n\nPress enter to return to the MAIN MENU...", styleSheetMM);
                Console.ReadLine();
                return StopMenu;
            }
            else if (menuInput == PurchaseSelection)
            {
                while (isPurchaseTransactionComplete == Incomplete)
                {
                    isPurchaseTransactionComplete = Purchase();
                }
                return StopMenu;
            }
            else if (menuInput == EndProgram)
            {
                return ContinueMenu;
            }
            else if (menuInput == SecretReport)
            {
                Console.WriteLine("Generating sales report...", Color.LimeGreen);
                InitiateSalesReport();
                Console.ReadLine();
                Console.Clear();
                return StopMenu;
            }
            else
            {
                ErrorMessage();                    
                Console.WriteLineStyled("SELECTION NOT VALID! Press enter to return to the MAIN MENU.", styleSheetMM);
                Console.ReadLine();
                return StopMenu;
            }
        }//Menu
Ejemplo n.º 25
0
        /// <summary> Inserts one url to txt </summary>
        static bool insertOneUrl(string line, int counterLines)
        {
            List <string> success = new List <string>();

            try {
                if (line.Split(';').Count() != 2)
                {
                    throw new ArgumentException("number of (;)seperator");
                }
                string comment = line.Split(';')[1];
                string URL     = line.Split(';')[0];
                Regex  regx    = new Regex("^[a-zA-Z0-9]*$");
                // only alphanumeric chars allowed when inserting from this App
                // otherwise (like old inputs) this control is not in charge
                if (regx.IsMatch(comment) == false)
                {
                    throw new ArgumentException("(not alphanumeric)comment");
                }
                if (searchExactUrl(URL) == true) // if not already exists, add it
                {
                    throw new ArgumentException("\t!│ URL already exist");
                }

                // syntax is like = "*GivenUrl*" "GivenComment dd.mm.yy username" + linebreak
                string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\')[1];
                if (userName == "unknown")
                {
                    Console.WriteLine(" │ Enter your User Name: ");
                    userName = Console.ReadLine();
                }
                string textToWrite = "\"*"
                                     + URL
                                     + "*\" \""
                                     + comment
                                     + " "
                                     + DateTime.Now.ToString("dd.MM.yy HH:mm")
                                     + " "
                                     + userName
                                     + "\"";
                // double check can be safer, so check the text that ll be written to file
                if (checkLine(textToWrite, counterLines) == true)
                {
                    success.Add(textToWrite);
                    writeListToFile(urlblissFileName, success);
                    return(true);
                }
            } // try
            catch (Exception e) {
                Helpers.printProblematic(e.Message, counterLines, line);
                new SoundPlayer(URLbliss.Properties.Resources.gurg).Play();
            }
            return(false);
        }
Ejemplo n.º 26
0
        public static Enum AskEnum(Type enumtype, string question, Enum @default, Func <object, bool> validation)
        {
            if (enumtype.IsEnum == false)
            {
                throw new InvalidOperationException($"Given enum type is not an enum! ({enumtype.Name})");
            }

            Console.Write("[INPUT] ", Color.DarkGray);
            Console.Write(question, Color.White);
            Console.Write($"{(question.Last() == ' ' ? "" : " ")}(default:[", Color.Aqua);
            Console.Write(@default == null?"null":$"{ enumtype.Name}.{@default}", Color.White);
            Console.WriteLine("],[exit])", Color.Aqua);
            var vals = Enum.GetValues(enumtype).Cast <object>().OrderByDescending(o => o.ToString()).ToArray();

            for (int i = 0; i < vals.Length; i++)
            {
                var val = vals[i];
                Console.Write($"    [{i}] ", Color.OrangeRed);
                Console.WriteLine($"{enumtype.Name}.{val}", Color.White);
            }
            goto _skipbeep;
_retry:
            SystemSounds.Beep.Play();
_skipbeep:
            Console.Write(">", Color.DarkGray);
            Console.ResetColor();
            var commandid = Console.ReadLine().Trim();

            if (commandid == "q" || commandid == "exit")
            {
                return(null);
            }
            if (string.IsNullOrEmpty(commandid))
            {
                System.Console.WriteLine($"Selected default:");
                Console.WriteLine($"{enumtype.Name}.{@default}");
                return(@default);
            }

            if (commandid.IsNumeric() == false)
            {
                goto _retry;
            }

            var @out = Convert.ToInt32(commandid);

            if (@out > vals.Length || @out < 0)
            {
                goto _retry;
            }

            return((Enum)vals[@out]);
        }
Ejemplo n.º 27
0
        public static T AskArray <T>(T[] arr, string question, T @default, string @default_text, Func <T, string> totext)
        {
            if (arr == null || arr.Length == 0)
            {
                return(default(T));
            }

            Console.Write("[INPUT] ", Color.DarkGray);
            Console.Write(question, Color.White);
            Console.Write($"{(question.Last() == ' ' ? "" : " ")}(default:[", Color.Aqua);
            Console.Write($"{ @default_text}", Color.White);
            Console.WriteLine("],[exit])", Color.Aqua);
            for (int i = 0; i < arr.Length; i++)
            {
                var val = arr[i];
                Console.Write($"    [{i}] ", Color.OrangeRed);
                Console.WriteLine($"{totext(val)}", Color.White);
            }
            goto _skipbeep;
_retry:
            SystemSounds.Beep.Play();
_skipbeep:
            Console.Write(">", Color.DarkGray);
            Console.ResetColor();
            var commandid = Console.ReadLine().Trim();

            if (commandid == "q" || commandid == "exit")
            {
                return(default(T));
            }
            if (string.IsNullOrEmpty(commandid))
            {
                System.Console.WriteLine($"Selected default:");
                Console.WriteLine($"{ @default_text}", Color.White);
                return(@default);
            }

            if (commandid.IsNumeric() == false)
            {
                goto _retry;
            }

            var @out = Convert.ToInt32(commandid);

            if (@out > arr.Length || @out < 0)
            {
                goto _retry;
            }

            return(arr[@out]);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Main
        /// </summary>
        private static void Main()
        {
            Console.WriteAscii("AFS BY ROBI", Color.Gold);

            var correct_options = false;

            //parse the options
            while (!correct_options)
            {
                try
                {
                    var options = RequireInput();
                    parameters.Parse(options);

                    if (source_dir == null)
                    {
                        throw new OptionException("\nMissing parameter", source_dir);
                    }
                    if (destination_dir == null)
                    {
                        throw new OptionException("\nMissing parameter", destination_dir);
                    }
                    if (!Directory.Exists(destination_dir))
                    {
                        throw new OptionException("\nDirectory does not exist.", destination_dir);
                    }
                    if (!Directory.Exists(source_dir))
                    {
                        throw new OptionException("\nDirectory does not exist.", source_dir);
                    }

                    //else the options are correct
                    correct_options = true;
                }
                catch (OptionException ex)
                {
                    Console.Write(ex.Message + "\n", Color.Red);
                }
            }

            //Add custom media formats
            media_formats.AddRange(custom_formats);

            CreateDirStructur();

            ProcessDirectory();

            Console.WriteLine("\n\nFinished");

            Console.ReadLine();
        }
Ejemplo n.º 29
0
Archivo: Game.cs Proyecto: CMS18/Grupp2
        public void Menu()
        {
            bool validInput = true;

            while (validInput)
            {
                Console.Clear();
                string text = @"
                                ***************************************
                                * Aloha and welcome to your Adventure *
                                ***************************************
                                
                                Please make a choice

                                1. New Game
                                2. Command List
                                3. Are you a little dumb? L2P and RTFM
                                4. Exit";
                Formatting(text);
                Console.Write("> ", Color.DeepPink);
                string input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    CreatePlayer();
                    break;

                case "2":
                    RulesAndCommands.Commands();
                    break;

                case "3":
                    RulesAndCommands.Rules();
                    break;

                case "4":
                    Console.Clear();
                    Console.WriteLine("I knew you didn't have it in you. Peasant.");
                    ExitGame();
                    Console.ReadLine();
                    Environment.Exit(0);
                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Wrong input! Please chose a valid number!");
                    Console.ReadLine();
                    break;
                }
            }
        }
Ejemplo n.º 30
0
        static void DownloadAudio()
        {
            Console.Clear();
            Console.WriteLine("Enter Post URL:", Color.SkyBlue);
            string url = Console.ReadLine();

            Console.Clear();
            Console.WriteLine("Pulling Data...", Color.CadetBlue);
            PullJSON(url);
            client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
            client.DownloadFile(tko.props.pageProps.musicInfo.music.coverThumb, "Audio//" + tko.props.pageProps.musicData.musicName + " - " + tko.props.pageProps.musicData.musicName + ".jpeg");
            client.DownloadFileAsync(new Uri(tko.props.pageProps.musicInfo.music.playUrl), "Audio//" + tko.props.pageProps.musicData.musicName + " - " + tko.props.pageProps.musicData.musicName + ".mp3");
            Console.ReadLine();
        }