Example #1
0
        /// <summary>
        /// Parses doctags supporting simple format for the 1st release.
        /// </summary>
        /// <param name="comments"></param>
        /// <returns></returns>
        public static Tuple <DocTags, List <string> > ParseDocTags(List <Token> comments)
        {
            var tags     = new DocTags();
            var warnings = new List <string>();

            // What was the last comment type
            var lastType = "";

            foreach (var c in comments)
            {
                var comment = c.Text;
                if (comment.StartsWith("#"))
                {
                    comment = comment.Substring(1);
                }

                comment = comment.Trim();

                if (comment.Contains("@summary"))
                {
                    Try(() => tags.Summary = comment.Replace("@summary:", "").Trim(), "summary", comment, 1, warnings);
                    lastType = "sum";
                }
                else if (comment.Contains("@arg"))
                {
                    Try(() => tags.Args.Add(ParseArg(comment)), "arg", comment, 1, warnings);
                    lastType = "arg";
                }
                else if (comment.Contains("@example"))
                {
                    Try(() => tags.Examples.Add(ParseExample(comment)), "example", comment, 1, warnings);
                    lastType = "ex";
                }
                else if (comment.StartsWith("@"))
                {
                    Try(() =>
                    {
                        var tag = ParseCustomTag(comment);
                        tags.CustomTags.Add(tag);
                        lastType = tag.Name;
                    }, "custom tag", comment, 1, warnings);
                }
                else if (lastType != "sum" && string.IsNullOrEmpty(comment))
                {
                    continue;
                }
                else
                {
                    if (lastType == "sum")
                    {
                        tags.Summary += " " + comment;
                    }
                }
            }
            return(new Tuple <DocTags, List <string> >(tags, warnings));
        }
Example #2
0
        private void showDataButton_Click(object sender, EventArgs e)
        {
            DocTags docTags1 = new DocTags();

            docTags1.Id           = 1;
            docTags1.Title        = "Java";
            docTags1.CreationDate = new DateTime(2018, 1, 16, 16, 1, 48);

            DocTags docTags2 = new DocTags();

            docTags2.Id           = 2;
            docTags2.Title        = "PHP";
            docTags2.CreationDate = new DateTime(2019, 12, 16, 16, 1, 48);

            DocTags docTags3 = new DocTags();

            docTags3.Id           = 3;
            docTags3.Title        = "Javascript";
            docTags3.CreationDate = new DateTime(2020, 12, 16, 16, 1, 48);

            DocTags docTags4 = new DocTags();

            docTags4.Id           = 4;
            docTags4.Title        = "Swift";
            docTags4.CreationDate = new DateTime(2021, 12, 16, 16, 1, 48);

            DocTags docTags5 = new DocTags();

            docTags5.Id           = 5;
            docTags5.Title        = "PHP";
            docTags5.CreationDate = new DateTime(2022, 12, 16, 16, 1, 48);

            DocTags docTags6 = new DocTags();

            docTags6.Id           = 6;
            docTags6.Title        = "Swift";
            docTags6.CreationDate = new DateTime(2023, 12, 16, 16, 1, 48);

            DocTags docTags7 = new DocTags();

            docTags7.Id           = 7;
            docTags7.Title        = "Javascript";
            docTags7.CreationDate = new DateTime(2024, 12, 16, 16, 1, 48);

            DocTags docTags8 = new DocTags();

            docTags8.Id           = 8;
            docTags8.Title        = "PHP";
            docTags8.CreationDate = new DateTime(2025, 12, 16, 16, 1, 48);

            DocTags docTags9 = new DocTags();

            docTags9.Id           = 9;
            docTags9.Title        = "Java";
            docTags9.CreationDate = new DateTime(2026, 12, 16, 16, 1, 48);

            DocTags docTags10 = new DocTags();

            docTags10.Id           = 10;
            docTags10.Title        = "Swift";
            docTags10.CreationDate = new DateTime(2027, 12, 16, 16, 1, 48);

            DocTags docTags11 = new DocTags();

            docTags11.Id           = 11;
            docTags11.Title        = "PHP";
            docTags11.CreationDate = new DateTime(2028, 12, 16, 16, 1, 48);

            List <DocTags> list = new List <DocTags>();

            list.Add(docTags1);
            list.Add(docTags2);
            list.Add(docTags3);
            list.Add(docTags4);
            list.Add(docTags5);
            list.Add(docTags6);
            list.Add(docTags7);
            list.Add(docTags8);
            list.Add(docTags9);
            list.Add(docTags10);
            list.Add(docTags11);

            listView1.Items.Clear();
            listLoadedInListView = list;

            foreach (DocTags listItem in list)
            {
                string[]     item         = { Convert.ToString(listItem.Id), listItem.Title, Convert.ToString(listItem.CreationDate) };
                ListViewItem listViewItem = new ListViewItem(item);
                listView1.Items.Add(listViewItem);
            }

            languageComboBox.SelectedIndex = -1;
            searchTextBox.Clear();
        }