Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.Write("Enter file name of noun list: ");
            AescStr filename = new AescStr(Console.ReadLine());

            Console.WriteLine();
            StreamReader input = null;

            try
            {
                input = new StreamReader(filename.RealString());

                var nouns = GetNouns(input);

                Console.WriteLine("Operations in progress.  This might take a while...");
                RemoveDupes(nouns);
                CapitalizeFirst(nouns);
                SortList(nouns);

                StreamWriter output = null;
                try
                {
                    output = new StreamWriter("Sorted.txt");

                    foreach (AescStr str in nouns)
                    {
                        output.WriteLine(str.RealString());
                    }
                }
                catch (IOException e)
                {
                    Console.WriteLine("Something went wrong! " + e.Message);
                }
                finally
                {
                    if (output != null)
                    {
                        output.Close();
                    }
                }
                Console.WriteLine("We're all done here, your nouns are now sorted.  Have a nice day!");
            }
            catch (IOException e)
            {
                Console.WriteLine("We have errors captain! " + e.Message);
            }
            finally
            {
                if (input != null)
                {
                    input.Close();
                }
            }

            Console.ReadLine();
        }
        public bool IsEqualTo(AescStr other)
        {
            if (characters.Count != other.characters.Count)
            {
                return(false);
            }
            else
            {
                for (int i = 0; i < characters.Count; ++i)
                {
                    if (characters[i] != other.characters[i])
                    {
                        return(false);
                    }
                }

                return(true);
            }
        }