Exemplo n.º 1
0
        static string GenerateFileContent(List <IDWithComment> list, string @namespace, string baseClassName)
        {
            if (string.IsNullOrEmpty(@namespace))
            {
                @namespace = "Wugner.Localize";
            }
            if (string.IsNullOrEmpty(baseClassName))
            {
                baseClassName = "IDS";
            }

            list.Sort((s1, s2) => s1.ID.CompareTo(s2.ID));

            var classInfo = new ClassInfo(1, "");

            foreach (var entry in list)
            {
                classInfo.TryAdd(entry.ID, entry.Comment);
            }

            var str = new StringBuilder();

            AppendLineWithIndent(str, 0, "namespace ", @namespace);
            AppendLineWithIndent(str, 0, "{");
            AppendLineWithIndent(str, 1, "public static class ", baseClassName);
            AppendLineWithIndent(str, 1, "{");

            classInfo.AppendString(str);

            AppendLineWithIndent(str, 1, "}");
            AppendLineWithIndent(str, 0, "}");

            return(str.ToString());
        }