Example #1
0
        private static void InitializeChildRows(CremaDataRow diffRow1, CremaDataRow diffRow2, CremaDataRow dataRow1, CremaDataRow dataRow2, CremaDataTable diffChildTable1, CremaDataTable diffChildTable2, CremaDataTable childTable1, CremaDataTable childTable2)
        {
            var emptyRows     = new CremaDataRow[] { };
            var inlineBuilder = new SideBySideDiffBuilder(new Differ());

            var childRows1 = dataRow1 != null && childTable1 != null?dataRow1.GetChildRows(childTable1) : emptyRows;

            var childRows2 = dataRow2 != null && childTable2 != null?dataRow2.GetChildRows(childTable2) : emptyRows;

            var rowText1 = GetString(childRows1);
            var rowText2 = GetString(childRows2);
            var rowDiff  = inlineBuilder.BuildDiffModel(rowText1, rowText2);

            FillChildRow(diffRow1, dataRow1, diffChildTable1, childTable1, childRows1, rowDiff.OldText.Lines);
            FillChildRow(diffRow2, dataRow2, diffChildTable2, childTable2, childRows2, rowDiff.NewText.Lines);
        }
Example #2
0
        static void Write(string outputPath, CremaDataRow dataRow)
        {
            var localPath   = dataRow.Field <string>("ProjectPath").Replace(PathUtility.SeparatorChar, Path.DirectorySeparatorChar);
            var projectPath = Path.Combine(outputPath, localPath);

            var projectXml  = File.ReadAllText(projectPath);
            var projectInfo = new ProjectInfo(projectXml);

            foreach (var item in projectInfo.ResxInfos)
            {
                var dataTable = FindDataTable(item);
                if (dataTable == null)
                {
                    continue;
                }

                Write(Path.GetDirectoryName(projectPath), item, dataTable);

                if (item.ResgenFileName != string.Empty)
                {
                    WriteDesigner(Path.GetDirectoryName(projectPath), projectInfo, item);
                }
            }

            CremaDataTable FindDataTable(ResxInfo resxInfo)
            {
                foreach (var item in dataRow.GetChildRows("ExportInfo"))
                {
                    if (item.Field <string>("FileName") == resxInfo.Name)
                    {
                        var tableName = item.Field <string>("TableName");
                        return(dataRow.Table.DataSet.Tables[tableName]);
                    }
                }
                return(null);
            }
        }