コード例 #1
0
        public string Analysis()
        {
            var Result = "";
            var i      = 0;

            while (i < Template.Count)
            {
                var Line = Template[i].Trim();
                if (Line.Contains("[PRIMITIVEPROPERTIES]") || Line.Contains("[OBJECTPROPERTIES]") ||
                    Line.Contains("[ARRAYPROPERTIES]"))
                {
                    var Block  = "";
                    var j      = i + 1;
                    var Blocks = new List <string>();

                    #region Process create block and replace data

                    while (j < Template.Count && !Template[j].Contains("[END]"))
                    {
                        Block += Template[j] + "\n";
                        j++;
                    }
                    if (Line.Contains("[PRIMITIVEPROPERTIES]"))
                    {
                        foreach (var Pair in Primitivepropertities)
                        {
                            var Replace = Block.Replace("[ITEM.NAME]", Pair.Key);
                            Replace = Replace.Replace("[ITEM.TYPE]", Pair.Value);
                            Replace = Replace.Replace("[ITEM.TYPES]", LanguageProcessService.ToPlural(Pair.Value));
                            Blocks.Add(Replace);
                        }
                    }
                    else if (Line.Contains("[OBJECTPROPERTIES]"))
                    {
                        foreach (var Pair in Objectpropertities)
                        {
                            var Replace = Block.Replace("[ITEM.NAME]", Pair.Key);
                            Replace = Replace.Replace("[ITEM.TYPE]", Pair.Value);
                            Replace = Replace.Replace("[ITEM.TYPES]", LanguageProcessService.ToPlural(Pair.Value));
                            Blocks.Add(Replace);
                        }
                    }
                    else if (Line.Contains("[ARRAYPROPERTIES]"))
                    {
                        foreach (var Pair in Arraypropertities)
                        {
                            var Replace = Block.Replace("[ITEM.NAME]", Pair.Key);
                            Replace = Replace.Replace("[ITEM.TYPE]", Pair.Value);
                            Replace = Replace.Replace("[ITEM.TYPES]", LanguageProcessService.ToPlural(Pair.Value));
                            Blocks.Add(Replace);
                        }
                    }

                    #endregion

                    i    = j;
                    Line = string.Join("\n", Blocks);
                }
                Result += Replace(Line) + "\n";
                i++;
            }
            return(AnalysisConditional(Result));
        }