示例#1
0
        public static void InitializeMembers(CremaDataType diffSource1, CremaDataType diffSource2, CremaDataType dataType1, CremaDataType dataType2)
        {
            //var hashValue1 = dataType1?.HashValue;
            //var hashValue2 = dataType2?.HashValue;

            diffSource1.BeginLoadData();
            diffSource2.BeginLoadData();
            //if (dataType1.HashValue != null && dataType1.HashValue == dataType2.HashValue)
            {
                var inlineBuilder = new SideBySideDiffBuilder(new Differ());
                var memberText1   = dataType1 == null?DiffInternalUtility.GetString(dataType2.Items) : DiffInternalUtility.GetString(dataType1.Items);

                var memberText2 = dataType2 == null?DiffInternalUtility.GetString(dataType1.Items) : DiffInternalUtility.GetString(dataType2.Items);

                var memberDiff = inlineBuilder.BuildDiffModel(memberText1, memberText2);
                DiffInternalUtility.FillMember(diffSource1, dataType1 ?? dataType2, memberDiff.OldText.Lines);
                DiffInternalUtility.FillMember(diffSource2, dataType2 ?? dataType1, memberDiff.NewText.Lines);
            }
            //else
            //{

            //}
            diffSource1.EndLoadData();
            diffSource2.EndLoadData();
        }
示例#2
0
        public static CremaDataTypeMember AddEmptyMember(this CremaDataType dataType)
        {
            dataType.BeginLoadData();
            var member = dataType.NewMember();

            member.EmptyFields();
            member.SetAttribute(DiffUtility.DiffEnabledKey, false);
            member.SetAttribute(DiffUtility.DiffStateKey, DiffState.Imaginary);
            dataType.Members.Add(member);
            dataType.EndLoadData();
            return(member);
        }