Esempio n. 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine(ProgramUtil.Factorial(5));
            Console.WriteLine(ProgramUtil.ParseInt("-23"));
            Console.WriteLine(ProgramUtil.TryParseInt("-50"));
            Console.WriteLine(ProgramUtil.ReadFile(@"C:\Users\Tyler\Desktop\Games\Crying.txt"));
            string input = "I'm crying because I don't remember why I created this txt file.";

            ProgramUtil.WriteToFile(@"C:\Users\Tyler\Desktop\Games\Crying.txt", input);
        }
Esempio n. 2
0
        private static void LoadCards()
        {
            Console.WriteLine();
            Console.WriteLine("Which file would you like to load?");
            string location = Console.ReadLine();
            string path     = location;

            if (!File.Exists(path))
            {
                Console.WriteLine("The path you indicated is invalid.");
                ManageFlashCards();
            }
            else
            {
                string lines = ProgramUtil.ReadFile(path);
                Console.WriteLine(lines);
                int      k          = 0;
                int      v          = 2;
                int      t          = 0;
                string[] splitLines = lines.Split('\t');
                foreach (string s in splitLines)
                {
                    Console.WriteLine(s);
                    string[] splitS = s.Split(' ');
                    foreach (string i in splitS)
                    {
                        Console.WriteLine("SplitS LgntH: " + splitS.Length);
                        Console.WriteLine("I lgnth: " + i.Length);
                        Console.WriteLine("SplitLines lgnth: " + splitLines.Length);
                        int totallngth = splitLines.Length * splitS.Length;
                        Console.WriteLine("Total (SplitS & Lines): " + totallngth);
                        string[] addingStrings = new string[totallngth];
                        addingStrings[0] = i;
                        if (k >= totallngth || v >= totallngth)
                        {
                            Console.WriteLine("Moo");
                        }
                        else
                        {
                            keyList.Add(addingStrings[k]);
                            Console.WriteLine("Added Key");
                            Console.WriteLine("Key: " + k);
                            valueList.Add(addingStrings[v]);
                            Console.WriteLine("Added Value");
                            Console.WriteLine("Value: " + v);
                            k += 3;
                            v += 3;
                        }
                    }
                }
            }
            Console.WriteLine();
            MainMenu();
        }