コード例 #1
0
        private static void WriteCodeTemplates(IList <LanguageProcessor.DocCode> list, IndentedTextWriter indentedWriter, IList <CodeTemplate> templates)
        {
            Dictionary <string, List <string> >       dictionary = new Dictionary <string, List <string> > ((IEqualityComparer <string>)StringComparer.CurrentCultureIgnoreCase);
            Dictionary <string, List <CodeTemplate> > dict       = new Dictionary <string, List <CodeTemplate> > ();

            for (int index = 0; index < templates.Count; ++index)
            {
                string humanString = ((IEnumerable <string>)list [index].languages).ToHumanString <string> ();
                dict.GetOldOrSetNew <string, List <CodeTemplate> > (humanString).Add(templates [index]);
                foreach (TemplateParameter templateParameter in templates[index])
                {
                    dictionary.GetOldOrSetNew <string, List <string> > (templateParameter.name).AddRange((IEnumerable <string>)list [index].parameterDocs [templateParameter.name]);
                }
            }
            foreach (KeyValuePair <string, List <CodeTemplate> > keyValuePair in dict)
            {
                indentedWriter.WriteLine(keyValuePair.Key + ":");
                ++indentedWriter.Indent;
                foreach (CodeTemplate code in keyValuePair.Value)
                {
                    CodeTemplate.WriteDoc((TextWriter)indentedWriter, code);
                }
                --indentedWriter.Indent;
            }
            ++indentedWriter.Indent;
            List <string> stringList = new List <string> ();

            foreach (LanguageProcessor.DocCode docCode in (IEnumerable <LanguageProcessor.DocCode>)list)
            {
                if (docCode.mainDoc.Count > 0)
                {
                    stringList.AddRange((IEnumerable <string>)docCode.mainDoc);
                    break;
                }
            }
            if (stringList.Count > 0)
            {
                indentedWriter.WriteLineNoTabs("");
                foreach (string str in stringList)
                {
                    indentedWriter.WriteLine(str);
                }
            }
            if (dictionary.Count > 0)
            {
                LanguageProcessor.WriteParameters(indentedWriter, dictionary);
            }
            --indentedWriter.Indent;
        }