예제 #1
0
        private static Program.UserOption convertLivePost(Blog b, List<BloggerManager.PostInfo> postInfoList)
        {
            Console.Clear();

            PostConverter pc = new PostConverter("_converted-" + b.Id, "_temp-" + b.Id);
            directoryCleanUp(pc);

            Console.Clear();
            Console.WriteLine("Converting posts");

            for (int i = 0; i < postInfoList.Count; i++)
            {
                Console.WriteLine("Saving \" " + postInfoList[i].Title + " \" ( " + (i + 1) + " of " + (postInfoList.Count + 1) + " )");
                pc.SavePost(postInfoList[i]);
                Console.CursorTop--;
                Console.WriteLine(new string(' ', Console.WindowWidth - 1));
                Console.CursorTop--;
            }
            Console.Clear();
            string[] dis = {
                            Environment.NewLine,
                             "Done converting " + postInfoList.Count + " posts",
                             "Converted posts save in folder '_converted-" + b.Id + "'",
                             "Raw post saved in folder '_temp-" + b.Id + "'",
                             Environment.NewLine,
                             "Waning: Some of the formatting in posts may not be converted correctly",
                             "such as code highlight, table and links",
                             "you may use the gBloggerToJekyll's  tool - link convertsion helper for helping you to convert links that link inside blog"
                         };
            Console.WriteLine(string.Join(Environment.NewLine,dis));
            menuBack(1);
            menuExit(2);
            int selected = promptUserSelect(2);
            while (selected == -1)
            {
                selected = promptUserSelect(2);
            }
            switch (selected)
            {
                case 1:
                    return UserOption.BackToPrevius;
                default:
                    Environment.Exit(-1);
                    return UserOption.Exit;
            }
        }
예제 #2
0
 private static void directoryCleanUp(PostConverter pc)
 {
     if (pc.CleanUp(true) == true)
     {
         string[] dis = {
                            "'_converted' and '_temp' folder still exsist",
                            "These folder need to be deleted before converting posts",
                            "Please backup your '_converted' folder that contain the converted posts if needed"
                        };
         Console.WriteLine(string.Join(Environment.NewLine, dis));
         displayAnyKeyContinue();
         pc.CleanUp(false);
     }
 }