Esempio n. 1
0
 public OcadDiff GetDiff()
 {
     var source = new OcadFileReader(SourceFile).ReadProject();
     var target = new OcadFileReader(TargetFile).ReadProject();
     var diff = new OcadDiff() {Source = source, Target = target};
     CompareObjects(source, target, diff);
     return diff;
 }
Esempio n. 2
0
        public OcadDiff GetDiff()
        {
            var source = new OcadFileReader(SourceFile).ReadProject();
            var target = new OcadFileReader(TargetFile).ReadProject();
            var diff   = new OcadDiff()
            {
                Source = source, Target = target
            };

            CompareObjects(source, target, diff);
            return(diff);
        }
Esempio n. 3
0
        private void CompareObjects(OcadBaseProject source, OcadBaseProject target, OcadDiff diff)
        {
            // Copy object lists
            var srcObjects = new List<OcadFileOcadObject>(source.Objects);
            var tarObjects = new List<OcadFileOcadObject>(target.Objects);
            foreach (var obj in srcObjects)
            {
                var foundObject = tarObjects.FirstOrDefault(_ => _.Equals(obj));
                if (foundObject == null)
                {
                    diff.DeletedObjects.Add(obj);
                }
                else
                {
                    tarObjects.Remove(foundObject);
                }
            }

            diff.AddedObjects.AddRange(tarObjects);
        }
Esempio n. 4
0
        private void CompareObjects(OcadBaseProject source, OcadBaseProject target, OcadDiff diff)
        {
            // Copy object lists
            var srcObjects = new List <OcadFileOcadObject>(source.Objects);
            var tarObjects = new List <OcadFileOcadObject>(target.Objects);

            foreach (var obj in srcObjects)
            {
                var foundObject = tarObjects.FirstOrDefault(_ => _.Equals(obj));
                if (foundObject == null)
                {
                    diff.DeletedObjects.Add(obj);
                }
                else
                {
                    tarObjects.Remove(foundObject);
                }
            }

            diff.AddedObjects.AddRange(tarObjects);
        }