예제 #1
0
        public ExpandedUnions?TryExpandUnions(ConfigurationRegistry configuration)
        {
            ExpandedUnions?result     = null;
            var            startIndex = 0;

            for (var i = 0; i < contracts.Count; i++)
            {
                var contract = contracts[i];
                var union    = configuration.GetContractsUnionOrNull(contract);
                if (union == null)
                {
                    if (result != null)
                    {
                        result.Value.contracts[i - startIndex] = new[] { contract }
                    }
                    ;
                }
                else
                {
                    if (result == null)
                    {
                        startIndex = i;

                        result = new ExpandedUnions
                        {
                            contracts        = new string[contracts.Count - startIndex][],
                            unionedContracts = new List <UnionedContact>(1)
                        };
                    }
                    result.Value.unionedContracts.Add(new UnionedContact {
                        children = union, parent = contract
                    });
                    result.Value.contracts[i - startIndex] = union.ToArray();
                }
            }
            return(result);
        }
    }
예제 #2
0
 public ExpandedUnions? TryExpandUnions(ConfigurationRegistry configuration)
 {
     ExpandedUnions? result = null;
     var startIndex = 0;
     for (var i = 0; i < contracts.Count; i++)
     {
         var contract = contracts[i];
         var union = configuration.GetContractsUnionOrNull(contract);
         if (union == null)
         {
             if (result != null)
                 result.Value.contracts[i - startIndex] = new[] {contract};
         }
         else
         {
             if (result == null)
             {
                 startIndex = i;
                 result = new ExpandedUnions
                 {
                     contracts = new string[contracts.Count - startIndex][],
                     unionedContracts = new List<UnionedContact>(1)
                 };
             }
             result.Value.unionedContracts.Add(new UnionedContact {children = union, parent = contract});
             result.Value.contracts[i - startIndex] = union.ToArray();
         }
     }
     return result;
 }