コード例 #1
0
 private AdressesList RelativeComplementOperation(AdressesList parameterListOne, AdressesList paramListTwo)
 {
     return(new AdressesList()
     {
         Address = parameterListOne.Address.Except(paramListTwo.Address).ToList()
     });
 }
コード例 #2
0
 private AdressesList UnionOperation(AdressesList parameterListOne, AdressesList paramListTwo)
 {
     return(new AdressesList()
     {
         Address = parameterListOne.Address.Union(paramListTwo.Address).ToList()
     });
 }
コード例 #3
0
        public AdressesList MakeOperation(AdressesList parameterListOne, AdressesList paramListTwo, Operation operation)
        {
            AdressesList result = new AdressesList()
            {
                Address = new List <string>()
                {
                }
            };

            switch (operation.Operator)
            {
            case "u":
                result = UnionOperation(paramListTwo, parameterListOne);
                break;

            case "n":
                result = IntersectionOperation(paramListTwo, parameterListOne);
                break;

            case "\\":
                result = RelativeComplementOperation(paramListTwo, parameterListOne);
                break;
            }
            return(result);
        }
 private static void FilterCorrectMacAdressFromList(ref AdressesList filteredAdresses, string adress)
 {
     if (MacProducers.Where(mac => adress.StartsWith(mac)).SingleOrDefault() != null)
     {
         filteredAdresses.Address.Add(adress);
     }
 }
        public static AdressesList Filter(AdressesList addressesList)
        {
            AdressesList filteredAdresses = new AdressesList()
            {
                Address = new List <string> {
                }
            };

            foreach (string adress in addressesList.Address)
            {
                FilterCorrectMacAdressFromList(ref filteredAdresses, adress);
            }

            return(filteredAdresses);
        }
コード例 #6
0
 private static void IsRegexMatchMethod(ref List <IExpressionElement> expressions, string arg)
 {
     if (Regex.IsMatch(arg, FILE_REGEXP))
     {
         var filePath     = Const.GetPath(arg);
         var adressesList = new AdressesList()
         {
             Address = LoadMacAdressesFromFile(filePath)
         };
         expressions.Add(ProducersFilterHelper.Filter(adressesList));
     }
     else if (Regex.IsMatch(arg, OPERATION_REGEXP))
     {
         expressions.Add(new Operation {
             Operator = arg
         });
     }
     else
     {
         throw new WrongInputParameterException("Podano zle parametry");
     }
 }