Exemple #1
0
        // Resolve conflicts for a property
        public static void ResolvePropertyConflicts(ThreeWayConflictType conflictType, IList <EntityComponentProperty>[] lists, int[] indices, IList <EntityComponentProperty> result)
        {
            switch (conflictType)
            {
            case ThreeWayConflictType.Modified1And2:
                result.Add(lists[1][indices[1]]);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Exemple #2
0
        // Resolve conflicts for an entity
        public static void ResolveEntityConflicts(ThreeWayConflictType conflictType, IList <EntityDefinition>[] lists, int[] indices, IList <EntityDefinition> result)
        {
            switch (conflictType)
            {
            case ThreeWayConflictType.Modified1And2:
                var entityDefinition = new EntityDefinition(lists[0][indices[0]].Guid);
                ThreeWayMergeOrdered.Merge(entityDefinition.Components, lists[0][indices[0]].Components, lists[1][indices[1]].Components, lists[2][indices[2]].Components, x => x.Name, (x, y) => x == y, ResolveComponentConflicts);
                result.Add(entityDefinition);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Exemple #3
0
 // Resolve conflicts for a property
 public static void ResolvePropertyConflicts(ThreeWayConflictType conflictType, IList<EntityComponentProperty>[] lists, int[] indices, IList<EntityComponentProperty> result)
 {
     switch (conflictType)
     {
         case ThreeWayConflictType.Modified1And2:
             result.Add(lists[1][indices[1]]);
             break;
         default:
             throw new NotImplementedException();
     }
 }
Exemple #4
0
 // Resolve conflicts for a component
 public static void ResolveComponentConflicts(ThreeWayConflictType conflictType, IList<EntityComponentDefinition>[] lists, int[] indices, IList<EntityComponentDefinition> result)
 {
     switch (conflictType)
     {
         case ThreeWayConflictType.Modified1And2:
             var componentDefinition = new EntityComponentDefinition { Name = lists[0][indices[0]].Name, Properties = new List<EntityComponentProperty>() };
             ThreeWayMergeOrdered.Merge(componentDefinition.Properties, lists[0][indices[0]].Properties, lists[1][indices[1]].Properties, lists[2][indices[2]].Properties, x => x.Name, (x, y) => x == y, ResolvePropertyConflicts);
             result.Add(componentDefinition);
             break;
         default:
             throw new NotImplementedException();
     }
 }