Exemple #1
0
 internal DiffDataTypeMember(DiffDataType diffType, int index)
 {
     this.diffType = diffType;
     this.index    = index;
     this.item1    = index < diffType.SourceItem1.Items.Count ? diffType.SourceItem1.Items[index] : null;
     this.item2    = index < diffType.SourceItem2.Items.Count ? diffType.SourceItem2.Items[index] : null;
 }
Exemple #2
0
        private void InitializeTypes(IProgress progress)
        {
            var types1   = this.dataSet1.Types.ToList();
            var types2   = this.dataSet2.Types.ToList();
            var typeList = new List <DiffDataType>();

            foreach (var item in types1.ToArray())
            {
                var targetItems = types2.ToArray();
                var dataType2   = this.resolver.Resolve(item, targetItems);
                if (dataType2 == null)
                {
                    continue;
                }

                var dataType1 = item;
                var diffType1 = DiffDataType.Create(this.diffSet1, dataType1.TypeName);
                var diffType2 = DiffDataType.Create(this.diffSet2, dataType2.TypeName);
                var diffType  = new DiffDataType(diffType1, diffType2, dataType1, dataType2);
                typeList.Add(diffType);
                types1.Remove(dataType1);
                types2.Remove(dataType2);
            }

            foreach (var item in types1)
            {
                var dataType1 = item;
                if (this.dataSet2.Types.Contains(dataType1.TypeName) == true)
                {
                    var dataType2 = this.dataSet2.Types[dataType1.TypeName];
                    var diffType1 = DiffDataType.Create(this.diffSet1, dataType1.TypeName);
                    var diffType2 = DiffDataType.Create(this.diffSet2, DiffUtility.DiffDummyKey + dataType2.TypeName);
                    var diffType  = new DiffDataType(diffType1, diffType2, dataType1, dataType2);
                    typeList.Add(diffType);
                    types2.Remove(dataType2);
                }
                else
                {
                    var diffType1 = DiffDataType.Create(new CremaDataSet(), dataType1.TypeName);
                    var diffType2 = DiffDataType.Create(new CremaDataSet(), dataType1.TypeName);
                    var diffType  = new DiffDataType(diffType1, diffType2, dataType1, null);
                    typeList.Add(diffType);
                }
            }

            foreach (var item in types2)
            {
                var dataType2 = item;
                var diffType1 = DiffDataType.Create(new CremaDataSet(), dataType2.TypeName);
                var diffType2 = DiffDataType.Create(this.diffSet2, dataType2.TypeName);
                var diffType  = new DiffDataType(diffType1, diffType2, null, dataType2);
                typeList.Add(diffType);
            }

            foreach (var item in typeList)
            {
                item.DiffSet = this;
            }

#if USE_PARALLEL
            Parallel.ForEach(typeList, item =>
            {
                item.Diff();
            });
#else
            foreach (var item in typeList)
            {
                item.Diff();
            }
#endif

            this.types = typeList.OrderBy(item => item.SourceItem1.TypeName).ToArray();
        }