Ejemplo n.º 1
0
        static void DisplayEditor(string fileName, string headline)
        {
            Dictionary <string, List <string> > headlineTextPairs = DiaryFile.GetHeadlineTextPairs(fileName);
            List <string> lines = headlineTextPairs[headline];

            DisplayEditor(headline, lines);
            SaveChanges(headlineTextPairs, fileName);
        }
Ejemplo n.º 2
0
        static void ViewFile(string fileName)
        {
            ClearConsole();
            WriteMessage("Viewing file: " + fileName + " (Press a key to exit)\n");
            Dictionary <string, List <string> > headlineTextPairs = DiaryFile.GetHeadlineTextPairs(fileName);

            string[]        headlines = headlineTextPairs.Keys.ToArray();
            List <string>[] text      = headlineTextPairs.Values.ToArray();
            for (int i = 0; i < headlines.Length; i++)
            {
                string        headline  = headlines[i];
                List <string> paragraph = text[i];
                WriteMessage(headline + "\n");
                foreach (string line in paragraph)
                {
                    WriteMessage(line + "\n");
                }
                WriteMessage("\n");
            }
            WaitForKeyPress();
        }