Example #1
0
        private static string ActionEvaluator(ActionBlock action, ArticleData data, Dictionary <string, object> localVariables)
        {
            StringBuilder sb      = new StringBuilder();
            string        keyword = action.ActionExpression.TrimStart().Split(' ')[0];

            switch (keyword)
            {
            case "for":
                IEnumerable collection = ActionForGetEnumerable(action.ActionExpression, data, localVariables);
                if (collection != null)
                {
                    string enumeratorVariable = ActionForGetEnumeratorVariable(action.ActionExpression);
                    foreach (var element in collection)
                    {
                        localVariables[enumeratorVariable] = element;
                        sb.Append(Assemble(data, action.Elements, localVariables));
                    }
                }
                break;

            case "if":
                string expression = ActionIfGetExpression(action.ActionExpression);
                if (_interpreter.Eval <bool>(expression))
                {
                    sb.Append(Assemble(data, action.Elements, localVariables));
                }
                break;

            default:
                Console.WriteLine($"Action '{keyword}' is not a valid keyword!", ConsoleColor.Red);
                break;
            }

            return(sb.ToString());
        }
Example #2
0
        public void Create(string parentPath)
        {
            string path = System.IO.Path.Combine(parentPath, Name);

            Console.WriteLine("Generating File: " + path, ConsoleColor.Yellow);
            System.IO.File.WriteAllBytes(path, Content);
        }
Example #3
0
        public void Create(string parentPath)
        {
            string path = System.IO.Path.Combine(parentPath, Name);

            if (System.IO.Directory.Exists(path))
            {
                System.IO.Directory.Delete(path, true);
            }

            Console.WriteLine("Generating Directory: " + path, ConsoleColor.Yellow);
            System.IO.Directory.CreateDirectory(path);


            foreach (Directory d in Directories)
            {
                if (d != null)
                {
                    d.Create(path);
                }
            }
            foreach (File f in Files)
            {
                if (f != null)
                {
                    f.Create(path);
                }
            }
        }
Example #4
0
        private static string TextEvaluator(TextBlock text, ArticleData data, Dictionary <string, object> localVariables)
        {
            string code = text.TextExpression.Trim();

            // Set local variables
            foreach (KeyValuePair <string, object> localVariable in localVariables)
            {
                _interpreter.SetVariable(localVariable.Key, localVariable.Value);
            }

            try
            {
                object result = _interpreter.Eval <object>(code);
                return(result == null ? "null" : result.ToString());
            }
            catch
            {
                try
                {
                    return(_interpreter.Eval <string>(code + ".ToString()"));
                }
                catch (ParseException pe)
                {
                    Console.WriteLine($"Action Error: Failed to evaluate '{code}'. Parse Exception: {pe.Message}", ConsoleColor.Red);
                    return(Settings.EvaluateError);
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Action Error: Failed to evaluate '{code}'. Unknown exception: {e.Message}", ConsoleColor.Red);
                    return(Settings.EvaluateError);
                }
            }
        }
Example #5
0
        public void tasksDefaultCommand()
        {
            var requestResult = _taskRepository.List(Helper.GetDefaultProjectId()).Result;

            if (requestResult != null)
            {
                foreach (var task in requestResult.ToList())
                {
                    Console.Write($"{task.Id} - {task.Description} | ");
                    switch (task.TaskStatus)
                    {
                    case DAL.Enums.TaskStatus.Planned:
                        Console.WriteLine($"{task.TaskStatus}", ConsoleColor.Blue);
                        break;

                    case DAL.Enums.TaskStatus.Fighting:
                        Console.WriteLine($"{task.TaskStatus}", ConsoleColor.Yellow);
                        break;

                    case DAL.Enums.TaskStatus.Conquered:
                        Console.WriteLine($"{task.TaskStatus}", ConsoleColor.Green);
                        break;

                    default:
                        break;
                    }
                }
            }
            else
            {
                Console.WriteLine("There are no tasks yet. Use 'add' and start working!");
            }
        }
Example #6
0
        public void SetDefaultProject(int projectid)
        {
            ConfigurationWriter configurationWriter = new ConfigurationWriter();

            configurationWriter.AddOrUpdateAppSetting <int>(Constants.DEFAULT_PROJECTID, projectid);

            Console.WriteLine("Default Project was successfuly set.", ConsoleColor.Green);
        }
Example #7
0
        public void ShowDefaultProject()
        {
            IProjectRepository _projectRepository = new ProjectRepository();

            var currentDefaultProject = _projectRepository.Get(Helper.GetDefaultProjectId()).Result;

            Console.WriteLine($"{currentDefaultProject.Id} - {currentDefaultProject.Title} is the current default project.", ConsoleColor.Blue);
        }
Example #8
0
 public void Delete(int id)
 {
     try
     {
         _taskRepository.Delete(id).Wait();
         Console.WriteLine($"The task was successfuly deleted", ConsoleColor.Green);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Sorry, the system failed to delete from the list of projects", ConsoleColor.Green);
         Console.WriteLine(ex.Message);
     }
 }
Example #9
0
 public void Add(string description)
 {
     try
     {
         _taskRepository.Add(new Task {
             Description = description, Id_Project = Helper.GetDefaultProjectId(), TaskStatus = DAL.Enums.TaskStatus.Planned
         }).Wait();
         Console.WriteLine($"{description} was added to the list of tasks!", ConsoleColor.Green);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Sorry, the system failed to add to the list of tasks", ConsoleColor.Red);
         Console.WriteLine(ex.Message);
     }
 }
 public void Add(string title)
 {
     try
     {
         _projectRepository.Add(new Project {
             Title = title
         }).Wait();
         Console.WriteLine($"{title} was added to the list of projects!", ConsoleColor.Green);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Sorry, the system failed to add to the list of projects");
         Console.WriteLine(ex.Message);
     }
 }
Example #11
0
 public void Conquer(int id)
 {
     try
     {
         var specificTask = _taskRepository.Get(id).Result;
         specificTask.TaskStatus = DAL.Enums.TaskStatus.Conquered;
         _taskRepository.Update(specificTask).Wait();
         Console.WriteLine($"{specificTask.Description} is now conquered!", ConsoleColor.Green);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Sorry, the system failed to add to the list of projects", ConsoleColor.Red);
         Console.WriteLine(ex.Message);
     }
 }
Example #12
0
        public void Assemble(string outputDirectory)
        {
            Lexer  lexer  = new Lexer(File.OpenText(sourceFile));
            Parser parser = new Parser(lexer.Tokenize());
            Node   ast    = parser.Parse();

            Console.WriteLine("Building: " + strategy.GetTargetFileType());
            Console.WriteLine("Architecture: " + strategy.GetTargetPlatformName());
            byte[] source  = strategy.Assemble(ast); // Handle AST
            string infile  = Path.GetFileName(sourceFile);
            string outfile = Path.GetFileNameWithoutExtension(sourceFile) + strategy.GetTargetFileExtension();

            Console.WriteLine("Successfully assembled " + infile + " to " + outfile);
            File.WriteAllBytes(Path.Combine(outputDirectory, outfile), source);
        }
Example #13
0
 public void Fight(int id)
 {
     try
     {
         var specificTask = _taskRepository.Get(id).Result;
         specificTask.TaskStatus = DAL.Enums.TaskStatus.Fighting;
         _taskRepository.Update(specificTask).Wait();
         Console.WriteLine($"{specificTask.Description} is now being fought!", ConsoleColor.Green);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Sorry, the system failed to update the task", ConsoleColor.Red);
         Console.WriteLine(ex.Message);
     }
 }
        public void Rename(int id, string newTitle)
        {
            try
            {
                var specificProject = _projectRepository.Get(id).Result;
                var oldTitle        = specificProject.Title;

                specificProject.Title = newTitle;

                _projectRepository.Update(specificProject).Wait();

                Console.WriteLine($"{oldTitle} is now kwon as {newTitle}!", ConsoleColor.Green);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Sorry, the system failed to delete from the list of projects");
                Console.WriteLine(ex.Message);
            }
        }
Example #15
0
        private static IEnumerable ActionForGetEnumerable(string actionExpression, ArticleData data, Dictionary <string, object> localVariables)
        {
            string collection = actionExpression.Split("in")[1].Trim();

            // Interpreter collectionInterpreter = new Interpreter();
            foreach (KeyValuePair <string, object> variable in localVariables)
            {
                _interpreter.SetVariable(variable.Key, variable.Value);
            }

            try
            {
                return(_interpreter.Eval <IEnumerable>(collection));
            }
            catch { }

            Console.WriteLine($"Action Error: Could not find collection '{collection}'!", ConsoleColor.Red);
            return(null);
        }
Example #16
0
        static bool Prompt(string message, bool ignoreCase, params string[] acceptedInput)
        {
            Console.Write(message);
            string ans = Console.ReadLine();

            if (ignoreCase)
            {
                ans = ans.ToLower();
            }
            for (int i = 0; i < acceptedInput.Length; i++)
            {
                if (acceptedInput[i].Equals(ans))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #17
0
        public void Rename(int id, string newDescription)
        {
            try
            {
                var specificTask   = _taskRepository.Get(id).Result;
                var oldDescription = specificTask.Description;

                specificTask.Description = newDescription;

                _taskRepository.Update(specificTask).Wait();

                Console.WriteLine($"{oldDescription} is now kwon as {newDescription}!", ConsoleColor.Green);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Sorry, the system failed to add to the list of tasks", ConsoleColor.Red);
                Console.WriteLine(ex.Message);
            }
        }
 public void projectsDefaultCommand()
 {
     try
     {
         var listOfProjects = _projectRepository.Get().Result.ToList();
         if (listOfProjects.Count > 0)
         {
             listOfProjects.ForEach(project => Console.WriteLine($"{project.Id} - {project.Title}"));
         }
         else
         {
             Console.WriteLine("There are no projects yet!");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Sorry, the system failed to recover the list of projects");
         Console.WriteLine(ex.Message);
     }
 }
Example #19
0
        public static ArticleHeadInfo Parse(string article, ArticleHeadInfo fallback)
        {
            string content = File.ReadAllText(article);
            Match  info    = Regex.Match(content, @"{[^}]+}");

            if (info.Success)
            {
                try
                {
                    return(JsonConvert.DeserializeObject <ArticleHeadInfo>(info.Value));
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Error while parsing '{article}':", ConsoleColor.Red);
                    Console.WriteLine(e.Message, ConsoleColor.Red);
                    // ignored, return fallback
                }
            }
            Console.WriteLine($"Using DefaultArticleInfo for article '{article}'", ConsoleColor.Yellow);
            return(fallback);
        }
Example #20
0
        static Config LoadConfig(Arguments a)
        {
            if (a.Keyless.Count > 1)
            {
                string configFile = a.Keyless[1];
                Console.WriteLine("Loading config '" + configFile + "'...", ConsoleColor.Yellow);
                if (!File.Exists(configFile))
                {
                    Console.WriteLine("Config file did not exist! Please enter a valid filepath.", ConsoleColor.Red);
                }
                else if (Path.GetExtension(configFile).ToLower() != ".json")
                {
                    Console.WriteLine("Config file did not exist! Please enter a valid filepath.", ConsoleColor.Red);
                }
                else
                {
                    return(JsonConvert.DeserializeObject <Config>(File.ReadAllText(configFile)));
                }
            }

            return(null);
        }
Example #21
0
        /// <summary>
        /// Generates the file structure from config file
        /// </summary>
        /// <param name="projectDirectory">Project directory</param>
        /// <param name="config">Configuration</param>
        public static void Compile(string projectDirectory, Config config, bool debug = false)
        {
            string articlesPath  = Path.Combine(projectDirectory, config.ArticlesPath);
            string templatesPath = Path.Combine(projectDirectory, config.TemplatesPath);
            string stylesPath    = Path.Combine(projectDirectory, config.StylesPath);
            string outputPath    = Path.Combine(projectDirectory, config.OutputPath);

            if (!Directory.Exists(articlesPath))
            {
                Console.WriteLine("Articles directory could not be found!", ConsoleColor.Red);
            }
            else if (!Directory.Exists(templatesPath))
            {
                Console.WriteLine("Templates directory could not be found!", ConsoleColor.Red);
            }
            else if (!Directory.Exists(stylesPath))
            {
                Console.WriteLine("Styles directory could not be found!", ConsoleColor.Red);
            }
            else
            {
                if (!Directory.Exists(outputPath))
                {
                    Directory.CreateDirectory(outputPath);
                }

                #region Compile Articles

                void CompileArticleDirectory(string directoryPath, string relativePath)
                {
                    // Compile all articles using the templates.
                    string[] articles = Directory.GetFiles(directoryPath);
                    foreach (var article in articles)
                    {
                        ArticleHeadInfo ahi = ArticleHeadInfoParser.Parse(article, config.DefaultArticleInfo);

                        string fileOutput = Path.Combine(outputPath, Path.Combine(relativePath, Path.GetFileNameWithoutExtension(article))) + ".html";
                        Console.WriteLine($"Compiling '{article}' to '{fileOutput}' using template '{ahi.TemplateFileName()}'...", ConsoleColor.Yellow);

                        string template = String.Empty;
                        if (File.Exists(Path.Combine(templatesPath, ahi.Template)))
                        {
                            template = Path.Combine(templatesPath, ahi.Template);
                        }
                        else if (File.Exists(Path.Combine(templatesPath, ahi.TemplateFileName())))
                        {
                            template = Path.Combine(templatesPath, ahi.TemplateFileName());
                        }
                        else
                        {
                            Console.WriteLine($"Template '{ahi.TemplateFileName()}' not found in '{templatesPath}'! Please enter a valid filepath.", ConsoleColor.Red);
                            continue;
                        }

                        ArticleData ad = ArticleParser.Parse(article, ahi, debug);

                        TemplateAssembler.InitializeInterpreter(ad);
                        string result = TemplateAssembler.AssembleFile(ad, template);

                        File.WriteAllText(fileOutput, result);
                    }

                    string[] parts = Directory.GetDirectories(directoryPath);
                    foreach (string part in parts)
                    {
                        CompileArticleDirectory(Path.Combine(directoryPath, part), part);
                    }
                }

                CompileArticleDirectory(articlesPath, string.Empty);

                #endregion

                #region Move Styles



                #endregion
            }
        }
Example #22
0
        static void Main(string[] args)
        {
            args = new [] { "build", @"C:\Users\willi\Desktop\pond test\config.json" };

            Arguments a = Arguments.Parse(args);

            if (a.ContainsKey("h") || a.ContainsKey("?") || args.Length == 0 || a.Keyless.Count == 0)
            {
                At.ShowManual();
            }
            else if (a.Keyless[0] == "init")
            {
                // Initialize new Pond project
                #region Initialize

                string cd         = Directory.GetCurrentDirectory();
                string json       = JsonConvert.SerializeObject(Config.Default, Formatting.Indented);
                string configPath = Path.Combine(cd, "config.json");
                Console.WriteLine($"Creating {configPath}...");
                File.WriteAllText(configPath, json);

                #region Folders

                Directory.CreateDirectory(Path.Combine(cd, Config.Default.ArticlesPath));
                Directory.CreateDirectory(Path.Combine(cd, Config.Default.TemplatesPath));
                Directory.CreateDirectory(Path.Combine(cd, Config.Default.StylesPath));
                Directory.CreateDirectory(Path.Combine(cd, Config.Default.OutputPath));

                #endregion

                string buildPath = Path.Combine(cd, "build.bat");
                Console.WriteLine($"Creating {buildPath}...");
                File.WriteAllText(buildPath, $@"@echo off
Pond build ""{configPath}""
pause
");
                Console.WriteLine("Done. Project was successfully initialized!", ConsoleColor.Green);

                #endregion
            }
            else if (a.Keyless.Count >= 2 && a.Keyless[0] == "build")
            {
                // Run Pond
                #region Build

                string configDirectory = Path.GetDirectoryName(a.Keyless[1]);

                Console.WriteLine("Building project...", ConsoleColor.Yellow);
                Config config = LoadConfig(a);

                if (config != null)
                {
                    PondCompiler.Compile(configDirectory, config, Debug);

                    Console.WriteLine("Done. Website was successfully built!", ConsoleColor.Green);
                }
                else
                {
                    Console.WriteLine("Could not load config!", ConsoleColor.Red);
                }

                #endregion
            }
            else
            {
                Console.WriteLine("Unknown command, please use /? or /h for more help.", ConsoleColor.Red);
            }
        }
Example #23
0
        static void Main(string[] args)
        {
            Console.Write("=== "); Console.Write("Cake", ConsoleColor.Red); Console.Write("Lang", ConsoleColor.White); Console.WriteLine(" Demo ===");

            Console.WriteLine("For version: " + CakeLang.CakeLang.Version.ToString() + '\n', ConsoleColor.DarkYellow);

            // --- Data Pack Code -----------------------------------------

            DataPack demoPack = new DataPack("Demo Pack", "A demonstration of CakeLang!", "demopack");

            string message = "Hello friend";

            demoPack.Functions.Add(new Function("fun2",
                                                AsAt("s", Run(
                                                         Tellraw('s', JSON.Text(message, JSON.StyleFormattings.Color(Colors.Aqua), JSON.StyleFormattings.Bold))
                                                         ))
                                                ));
            demoPack.Functions.Add(new Function("flying",
                                                If.Block("~ ~-1 ~", Namespace("air"),
                                                         Run(
                                                             Tellraw('s', JSON.Text("Bro, you're flying!", JSON.StyleFormattings.Color(Colors.Yellow), JSON.StyleFormattings.Italic))
                                                             )
                                                         ),
                                                Unless.Block("~ ~-1 ~", Namespace("air"),
                                                             Run(
                                                                 Tellraw('s', JSON.Text("Nah, not flyin' yet", JSON.StyleFormattings.Color(Colors.Yellow), JSON.StyleFormattings.Underlined))
                                                                 )
                                                             )
                                                ));

            ArgumentsFunction introduce = new ArgumentsFunction("introduce", new System.Collections.Generic.Dictionary <string, Type>()
            {
                ["name"]     = typeof(string),
                ["position"] = typeof(float[])
            },
                                                                Tellraw(Selector.Executor, JSON.ArrayBuilder(
                                                                            JSON.Text("My name is ", JSON.StyleFormattings.Bold, JSON.StyleFormattings.Color(Colors.Gold)),
                                                                            JSON.FunctionVariable("introduce", "name", JSON.StyleFormattings.Italic, JSON.StyleFormattings.Color(Colors.Yellow)),
                                                                            JSON.Text(", I'm at ", JSON.StyleFormattings.Bold, JSON.StyleFormattings.Color(Colors.Gold)),
                                                                            JSON.FunctionVariable("introduce", "position[0]", JSON.StyleFormattings.Italic, JSON.StyleFormattings.Color(Colors.Yellow)),
                                                                            JSON.Text(" "),
                                                                            JSON.FunctionVariable("introduce", "position[1]", JSON.StyleFormattings.Italic, JSON.StyleFormattings.Color(Colors.Yellow)),
                                                                            JSON.Text(" "),
                                                                            JSON.FunctionVariable("introduce", "position[2]", JSON.StyleFormattings.Italic, JSON.StyleFormattings.Color(Colors.Yellow)),
                                                                            JSON.Text(" "),
                                                                            JSON.Text("!", JSON.StyleFormattings.Bold, JSON.StyleFormattings.Color(Colors.Gold))
                                                                            ))
                                                                );

            demoPack.Functions.Add(introduce);

            demoPack.Functions.Add(new Function("introducePeople",
                                                introduce.Call("Jeff", new[] { 0.5f, 2f, -4f }),
                                                introduce.Call("Monica", new[] { 0, 0, 0 }),
                                                introduce.Call("Boobo", new[] { 6, 6, 9, -2 })
                                                ));

            // --- Data Pack Code -----------------------------------------

            try
            {
                demoPack.CompileAndInject("CakeLang Demo");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message, ConsoleColor.Red);
            }
        }
 public static void Throw(System.Exception exception) => Console.WriteLine(exception.StackTrace, ConsoleColor.Red);
Example #25
0
        public Pack Compile()
        {
            Console.WriteLine("Compiling Data Pack...", ConsoleColor.Yellow);

            Directory ns = new Directory(Namespace);

            if (Advancements.Count > 0)
            {
                ns.Add(new Directory("advancements", null, ToFiles(Advancements.ToArray())));
            }
            if (Functions.Count > 0)
            {
                ns.Add(new Directory("functions", null, ToFiles(Functions.ToArray())));
            }
            if (LootTables.Count > 0)
            {
                ns.Add(new Directory("loot_tables", null, ToFiles(LootTables.ToArray())));
            }
            if (Predicates.Count > 0)
            {
                ns.Add(new Directory("predicates", null, ToFiles(Predicates.ToArray())));
            }
            if (Recipes.Count > 0)
            {
                ns.Add(new Directory("recipes", null, ToFiles(Recipes.ToArray())));
            }
            if (Structures.Count > 0)
            {
                ns.Add(new Directory("structures", null, ToFiles(Structures.ToArray())));
            }

            if (Tags.HasTags)
            {
                ns.Add(new Directory("tags", Tags.ToDirectories()));
            }

            if (Dimensions.Count > 0)
            {
                List <Directory> dimensionNamespaces = new List <Directory>();
                for (int i = 0; i < Dimensions.Count; i++)
                {
                    dimensionNamespaces.Add(Dimensions[0].ToDimensionType());
                }
                ns.Add(new Directory("dimension_type‌", dimensionNamespaces.ToArray()));

                List <Directory> dimensions = new List <Directory>();
                for (int i = 0; i < Dimensions.Count; i++)
                {
                    dimensions.Add(Dimensions[0].ToDimension());
                }
                ns.Add(new Directory("dimension‌", dimensions.ToArray()));
            }

            return(new Pack(
                       new Directory(Name,
                                     new Directory("data", ns),
                                     new File("pack.mcmeta",
                                              JSON.JSON.ObjectBuilder(true, "", true, new KeyValuePair <string, object>("pack",
                                                                                                                        JSON.JSON.ObjectBuilder(true, "\t", false,
                                                                                                                                                new KeyValuePair <string, object>("pack_format", pack_format),
                                                                                                                                                new KeyValuePair <string, object>("description", Description)
                                                                                                                                                )
                                                                                                                        ))
                                              )
                                     )
                       ));
        }
Example #26
0
        public static ArticleData Parse(string article, ArticleHeadInfo articleHeadInfo, bool debug = false)
        {
            string      content = File.ReadAllText(article);
            ArticleData ad      = new ArticleData(articleHeadInfo);

            MarkdownDocument document = new MarkdownDocument();

            document.Parse(content);

            List <MarkdownBlock> elements        = new List <MarkdownBlock>();
            List <ChapterData>   chapters        = new List <ChapterData>();
            ChapterData          chapter         = new ChapterData();
            List <MarkdownBlock> chapterElements = new List <MarkdownBlock>();

            void AddChapter()
            {
                if (chapterElements.Count > 0)
                {
                    chapter.Elements = chapterElements.ToArray();
                    chapters.Add(chapter);
                }
            }

            void NewChapter(HeaderBlock header)
            {
                // Add old
                AddChapter();
                // New chapter
                chapter = new ChapterData {
                    Title = header.ToString().Trim()
                };
                chapterElements = new List <MarkdownBlock>();
            }

            for (int i = 0; i < document.Blocks.Count; i++)
            {
                MarkdownBlock block = document.Blocks[i];
                if (debug)
                {
                    Console.Write($"{block.Type}: ", ConsoleColor.Cyan);
                }

                if (!IsCommentParagraph(block))
                {
                    elements.Add(block);
                }

                if (block is HeaderBlock header)
                {
                    if (header.HeaderLevel <= 2)
                    {
                        if (header.HeaderLevel == 1 && ad.TITLE == null)
                        {
                            ad.TITLE = header.ToString().Trim();
                        }
                        NewChapter(header);
                        continue;
                    }
                }

                if (!IsCommentParagraph(block))
                {
                    chapterElements.Add(block);
                }

                if (block is ParagraphBlock paragraph)
                {
                    if (debug)
                    {
                        Console.WriteLine();
                    }
                    for (int j = 0; j < paragraph.Inlines.Count; j++)
                    {
                        MarkdownInline inline = paragraph.Inlines[j];
                        if (debug)
                        {
                            Console.Write($"    {inline.Type}: ", ConsoleColor.DarkCyan);
                        }
                        if (debug)
                        {
                            Console.WriteLine(inline.ToString());
                        }
                        if (inline.Type != MarkdownInlineType.Comment)
                        {
                        }
                    }
                    if (debug)
                    {
                        Console.WriteLine("\n" + block.ToHtml());
                    }
                }
                else
                {
                    if (debug)
                    {
                        Console.WriteLine(block + "\n" + block.ToHtml());
                    }
                }
            }

            AddChapter();
            ad.CHAPTERS = chapters.ToArray();
            ad.ELEMENTS = elements.ToArray();

            return(ad);
        }
Example #27
0
 static void Main(string[] args)
 {
     Console.WriteLine("Hello World!", ConsoleColor.Red, ConsoleColor.DarkYellow);
 }