Example #1
0
        private bool ProcessOperation(string[] firstNumbers, string[] secondNumbers, OperationEnumeration operation)
        {

            if (operatorHelper.IsEqualsOperation(operation))
            {
                return this.ProcessEqualsOperation(firstNumbers, secondNumbers, operation);
            }
            else if (operatorHelper.IsNotEqualsOperation(operation))
            {
                return !this.ProcessEqualsOperation(firstNumbers, secondNumbers, OperationEnumeration.equals);
            }
            else if (operatorHelper.IsLessThanOperation(operation))
            {
                return this.ProcessLessThanAndGreaterThanOperation(firstNumbers, secondNumbers, operation);
            }
            else if (operatorHelper.IsGreaterThanOperation(operation))
            {
                return this.ProcessLessThanAndGreaterThanOperation(firstNumbers, secondNumbers, operation);
            }
            else if (operatorHelper.IsLessThanOrEqualOperation(operation))
            {
                return this.ProcessLessThanAndGreaterThanOperation(firstNumbers, secondNumbers, operation);
            }
            else if (operatorHelper.IsGreaterThanOrEqualOperation(operation))
            {
                return this.ProcessLessThanAndGreaterThanOperation(firstNumbers, secondNumbers, operation);
            }
            
            return true;


        }
Example #2
0
 private bool processOperation(OperationEnumeration operation, float firstFloatElement, float secondFloatElement)
 {
     if (this.operatorHelper.IsEqualsOperation(operation))
     {
         return firstFloatElement == secondFloatElement;
     }
     else if (this.operatorHelper.IsNotEqualsOperation(operation))
     {
         return firstFloatElement != secondFloatElement;
     }
     else if (this.operatorHelper.IsGreaterThanOperation(operation))
     {
         return firstFloatElement > secondFloatElement;
     }
     else if (this.operatorHelper.IsGreaterThanOrEqualOperation(operation))
     {
         return firstFloatElement >= secondFloatElement;
     }
     else if (this.operatorHelper.IsLessThanOperation(operation))
     {
         return firstFloatElement < secondFloatElement;
     }
     else if (this.operatorHelper.IsLessThanOrEqualOperation(operation))
     {
         return firstFloatElement <= secondFloatElement;
     }
     else
     {
         throw new ArgumentException(string.Format(INVALID_ENTITY_OPERATION_FOR_FLOAT_TYPE, operation.ToString()));
     }
 }
 private static OvalEntityOperationBase resolveOvalEntityOperation(OperationEnumeration operation)
 {
     switch (operation)
     {
         case OperationEnumeration.equals:
             return new EqualsEntityOperation();
         case OperationEnumeration.notequal:
             return new NotEqualsEntityOperation();
         case OperationEnumeration.caseinsensitiveequals:
             return new CaseInsentiveEqualsOperation();
         case OperationEnumeration.caseinsensitivenotequal:
             return new CaseInsensitiveNotEqualsOperation();
         case OperationEnumeration.greaterthan:
             throw new NotImplementedException(string.Format(NOT_IMPLEMENTED_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
         case OperationEnumeration.lessthan:
             throw new NotImplementedException(string.Format(NOT_IMPLEMENTED_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
         case OperationEnumeration.greaterthanorequal:
             throw new NotImplementedException(string.Format(NOT_IMPLEMENTED_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
         case OperationEnumeration.lessthanorequal:
             throw new NotImplementedException(string.Format(NOT_IMPLEMENTED_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
         case OperationEnumeration.bitwiseand:
             throw new NotImplementedException(string.Format(NOT_IMPLEMENTED_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
         case OperationEnumeration.bitwiseor:
             throw new NotImplementedException(string.Format(NOT_IMPLEMENTED_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
         case OperationEnumeration.patternmatch:
             return new PatternMatchEntityOperation();
         default:
             throw new NotImplementedException(string.Format(INVALID_ENTITY_OPERATION_ERROR_MESSAGE, operation.ToString()));
     }
 }
Example #4
0
        public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
        {
            var firstBooleanElement = this.TryConvertToBoolean(firstElement);
            var secondBooleanElement = this.TryConvertToBoolean(secondElement);

            return ProcessOperation(operation, firstBooleanElement, secondBooleanElement);
        }
Example #5
0
        public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
        {
            var firstEvrString = new EvrString(firstElement);
            var secondEvrString = new EvrString(secondElement);

            var evrIsEqual = ProcessEvrComparisionForEquals(firstEvrString, secondEvrString);
            var evrIsGreaterThan = ProcessEvrComparisionFor(firstEvrString, secondEvrString, ComparisionResults.IsGreaterThan);
            var evrIsLessThan = ProcessEvrComparisionFor(firstEvrString, secondEvrString, ComparisionResults.IsLessThan);

            switch (operation)
            {
                case OperationEnumeration.equals:
                    return evrIsEqual;
                case OperationEnumeration.notequal:
                    return !evrIsEqual;
                case OperationEnumeration.greaterthan:
                    return evrIsGreaterThan;
                case OperationEnumeration.lessthan:
                    return evrIsLessThan;
                case OperationEnumeration.greaterthanorequal:
                    return evrIsGreaterThan || evrIsEqual;
                case OperationEnumeration.lessthanorequal:
                    return evrIsLessThan || evrIsEqual;
                default:
                    throw new InvalidOvalOperationException();
            }
        }
 public EvrStringComparatorTestsBase(OperationEnumeration ovalOperation)
 {
     switch (ovalOperation)
     {
         case OperationEnumeration.equals:
             this.MakeSureThatThe = new EvrStringComparatorChecker().Using().EqualsOperation();
             break;
         case OperationEnumeration.notequal:
             this.MakeSureThatThe = new EvrStringComparatorChecker().Using().NotEqualOperation();
             break;
         case OperationEnumeration.greaterthan:
             this.MakeSureThatThe = new EvrStringComparatorChecker().Using().GreaterThanOperation();
             break;
         case OperationEnumeration.lessthan:
             this.MakeSureThatThe = new EvrStringComparatorChecker().Using().LessThanOperation();
             break;
         case OperationEnumeration.greaterthanorequal:
             this.MakeSureThatThe = new EvrStringComparatorChecker().Using().GreaterOrEqualThanOperation();
             break;
         case OperationEnumeration.lessthanorequal:
             this.MakeSureThatThe = new EvrStringComparatorChecker().Using().LessOrEqualThanOperation();
             break;
         default:
             throw new InvalidOvalOperationException();
     }
 }
Example #7
0
        public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
        {
            float firstFloatElement = this.TryConvertToFloat(firstElement);
            float secondFloatElement = this.TryConvertToFloat(secondElement);

            return this.processOperation(operation, firstFloatElement, secondFloatElement);
        }        
Example #8
0
 public static bool IsEntityValuesEquals(OperationEnumeration entityOperation, string entityValue1, string entityValue2)
 {
     var comparisonMethod = resolveStringComparisonMethod(entityOperation);
     if (entityValue1 == null)
         return entityValue2 == null;
     
     return entityValue1.Equals(entityValue2, comparisonMethod);
 }
Example #9
0
        public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
        {
            if (this.operatorHelper.IsEqualsOperation(operation) || (this.operatorHelper.IsNotEqualsOperation(operation)))
                return stringComparator.Compare(firstElement, secondElement, operation);
            else
                throw new ArgumentException(string.Format(INVALID_ENTITY_OPERATION_FOR_BINARY_TYPE, operation.ToString()));

        }
Example #10
0
        public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
        {
            long firstIntElement = this.TryConvertToInt(firstElement);
            long secondIntElement = this.TryConvertToInt(secondElement);

            return processOperation(operation, firstIntElement, secondIntElement);
                
        }
Example #11
0
        private static StringComparison resolveStringComparisonMethod(OperationEnumeration operation)
        {
            if ((operation == OperationEnumeration.equals) || (operation == OperationEnumeration.notequal))
                return StringComparison.CurrentCulture;
            else if ((operation == OperationEnumeration.caseinsensitiveequals) || (operation == OperationEnumeration.caseinsensitivenotequal))
                return StringComparison.CurrentCultureIgnoreCase;

            throw new Exception(string.Format(INVALID_ENTITY_OPERATION, operation.ToString()));
        }
        private IList<string> ProcessOperationDifferentOfEquals(OperationEnumeration operation, IEnumerable<String> allEnntityValues)
        {
            var allGroupSIDs = this.getAllGroupSIDsOnTargetMachine();
            var result = new List<String>();
            foreach (var entityValue in allEnntityValues)
                result.AddRange(this.processOperation(allGroupSIDs.ToArray(), entityValue, operation));

            return result;
        }
Example #13
0
        public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
        {
            string[] firstNumbers = Regex.Split(firstElement, "[^0-9]+");
            string[] secondNumbers = Regex.Split(secondElement, "[^0-9]+");
            firstNumbers = this.CompleteArrayWithZeros(firstNumbers, secondNumbers);
            secondNumbers = this.CompleteArrayWithZeros(secondNumbers, firstNumbers);

            return this.ProcessOperation(firstNumbers, secondNumbers, operation);
        }
        private IEnumerable<ItemType> ProcessOperationForTrusteeSidEntity(
            string path, string filename, string trusteeSID, OperationEnumeration operation)
        {
            if (operation.Equals(OperationEnumeration.equals) || operation.Equals(OperationEnumeration.caseinsensitiveequals))
            {
                var newItemToCollect = this.NewFileEffectiveRightsItem(path, filename, trusteeSID);
                newItemToCollect.status = StatusEnumeration.notcollected;
                return new ItemType[] { newItemToCollect };
            }

            return this.ObjectCollector.CollectItems(Path.Combine(path, filename), trusteeSID, operation);
        }
Example #15
0
        public user_object NewObjectWithVariable(
            string variableReference,
            OperationEnumeration operation = OperationEnumeration.equals)
        {
            var userEntity = new EntityObjectStringType()
            {
                operation = operation,
                var_ref = variableReference
            };

            return this.CreateUserObject(userEntity);
        }
        public static IEnumerable<string> EvaluateOperationsDifferentsOfPatternMatch(
            OperationEnumeration operation, string entityValue, IEnumerable<string> valuesToMatch)
        {
            IOvalComparator comparator = new OvalComparatorFactory().GetComparator(SimpleDatatypeEnumeration.@string);
            List<string> values = new List<string>();
            foreach (string valueToMatch in valuesToMatch)
            {
                if (comparator.Compare(entityValue, valueToMatch, operation))
                    values.Add(valueToMatch);
            }

            return values;
        }
Example #17
0
        public user_object NewObject(
            string userEntityValue,
            OperationEnumeration operation = OperationEnumeration.equals)
        {
            var userEntity =
                new EntityObjectStringType()
                {
                    operation = operation,
                    Value = userEntityValue
                };

            return this.CreateUserObject(userEntity);
        }
Example #18
0
 private bool ProcessOperation(OperationEnumeration operation, bool firstBooleanElement, bool secondBooleanElement)
 {
     if (OperatorHelper.IsEqualsOperation(operation))
     {
         return firstBooleanElement == secondBooleanElement;
     }
     else if (OperatorHelper.IsNotEqualsOperation(operation))
     {
         return firstBooleanElement != secondBooleanElement;
     }
     else
     {
         throw new ArgumentException(string.Format(INVALID_ENTITY_OPERATION_FOR_BOOLEAN_TYPE, operation.ToString()));
     }
 }
Example #19
0
 /// <summary>
 /// It compares a given value against a found value in target system using Oval operations.
 /// </summary>
 /// <param name="firstElement">Found Value.</param>
 /// <param name="secondElement">Expected value (entity value).</param>
 /// <param name="operation">Entity Operation.</param>
 /// <returns>The comparison result.</returns>
 public bool Compare(string firstElement, string secondElement, OperationEnumeration operation)
 {
     if (this.IsEqualsOperation(operation))
     {
         return OvalEntityComparer.IsEntityValuesEquals(operation,firstElement,secondElement);
     }
     else if (this.IsNotEqualsOperation(operation))
     {
         return OvalEntityComparer.IsEntityValuesNotEqual(operation, firstElement, secondElement);
     }
     else if (this.IsRegularExpression(operation))
     {
         return this.processRegex(firstElement, secondElement);
     }
     else
     {
         throw new ArgumentException(string.Format(INVALID_ENTITY_OPERATION_FOR_STRING_TYPE,operation.ToString()));
     }
 }
Example #20
0
 private bool processOperation(OperationEnumeration operation, long firstIntElement, long secondIntElement)
 {
     if (this.operatorHelper.IsEqualsOperation(operation))
     {
         return (firstIntElement == secondIntElement);
     }
     else if (this.operatorHelper.IsNotEqualsOperation(operation))
     {
         return (firstIntElement != secondIntElement);
     }
     else if (this.operatorHelper.IsGreaterThanOperation(operation))
     {
         return (firstIntElement > secondIntElement);
     }
     else if (this.operatorHelper.IsGreaterThanOrEqualOperation(operation))
     {
         return (firstIntElement >= secondIntElement);
     }
     else if (this.operatorHelper.IsLessThanOperation(operation))
     {
         return (firstIntElement < secondIntElement);
     }
     else if (this.operatorHelper.IsLessThanOrEqualOperation(operation))
     {
         return (firstIntElement <= secondIntElement);
     }
     else if (this.operatorHelper.IsBitwiseAndOperation(operation))
     {
         return this.processBitwiseAndOperation(firstIntElement,secondIntElement);
     }
     else if (this.operatorHelper.IsBitwiseOrOperation(operation))
     {
         return this.processBitwiseOrOperation(firstIntElement,secondIntElement);
     }
     else                        
     {
         throw new ArgumentException(string.Format(INVALID_ENTITY_OPERATION_FOR_INT_TYPE,operation.ToString()));
     }                        
 }
 public EvrStringComparatorChecker EqualsOperation()
 {
     this.Operation = OperationEnumeration.equals;
     return(this);
 }
Example #22
0
        private IList <String> processOperation(string[] allGroupSIDs, string entityValue, OperationEnumeration operation)
        {
            var comparator = new OvalComparatorFactory().GetComparator(SimpleDatatypeEnumeration.@string);

            var processingResult = new List <String>();

            foreach (var groupSID in allGroupSIDs)
            {
                if (comparator.Compare(groupSID, entityValue, operation))
                {
                    processingResult.Add(groupSID);
                }
            }

            return(processingResult);
        }
Example #23
0
        private bool Compare(string foundUserSID, string expectedUserSID, OperationEnumeration operation)
        {
            var ovalCompartor = new OvalComparatorFactory().GetComparator(SimpleDatatypeEnumeration.@string);

            return(ovalCompartor.Compare(foundUserSID, expectedUserSID, operation));
        }
Example #24
0
 public bool IsNotEqualsOperation(OperationEnumeration operation)
 {
     return((operation == OperationEnumeration.notequal) || (operation == OperationEnumeration.caseinsensitivenotequal));
 }
Example #25
0
        public static bool IsEntityValuesEquals(OperationEnumeration entityOperation, string entityValue1, string entityValue2)
        {
            StringComparison comparisonMethod = resolveStringComparisonMethod(entityOperation);

            return(entityValue1.Equals(entityValue2, comparisonMethod));
        }
        private IEnumerable<string> EvaluateOperation(OperationEnumeration operation, string entityValue, RegistryObject registryObject, bool isKeyEntity)
        {
            IEnumerable<string> valuesToMatch = null;
            if (operatorHelper.IsRegularExpression(operation))
            {
                if (isKeyEntity)
                    valuesToMatch = this.getSubKeysRecursive(registryObject.Hive, registryObject.Key);
                else
                {
                    registryObject.ClearNameEntity();
                    valuesToMatch = this.getKeyValues(registryObject);
                }

                return new MultiLevelPatternMatchOperation(FamilyEnumeration.windows).applyPatternMatch(entityValue, valuesToMatch);
            }
            else
            {
                valuesToMatch = this.GetValuesToMatchForOperationsDifferentsOfPatternMatch(isKeyEntity, registryObject);
                return NonPatternMatchOperationEvaluator.
                    EvaluateOperationsDifferentsOfPatternMatch(operation, entityValue, valuesToMatch);
            }
        }
Example #27
0
 public bool IsGreaterThanOperation(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.greaterthan);
 }
        private bool ProcessSidEntityOperation(string entityValue, string collectedUser, OperationEnumeration entityOperation)
        {
            if (entityOperation == OperationEnumeration.patternmatch)
                return Regex.IsMatch(collectedUser, entityValue);

            if (entityOperation == OperationEnumeration.notequal || entityOperation == OperationEnumeration.caseinsensitivenotequal)
                return !collectedUser.Equals(entityValue, StringComparison.InvariantCultureIgnoreCase);

            return false;
        }
Example #29
0
 public bool IsBitwiseAndOperation(OperationEnumeration operation)
 {
     return (operation == OperationEnumeration.bitwiseand);
 }
Example #30
0
 public bool IsLessThanOperation(OperationEnumeration operation)
 {
     return (operation == OperationEnumeration.lessthan);
 }
Example #31
0
 private bool IsNotEqualsOperation(OperationEnumeration operation)
 {
     return(this.operatorHelper.IsNotEqualsOperation(operation));
 }
 public EvrStringComparatorChecker()
 {
     this.Operation = OperationEnumeration.equals;
 }
Example #33
0
 public bool IsBitwiseOrOperation(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.bitwiseor);
 }
Example #34
0
 private bool IsRegularExpression(OperationEnumeration operation)
 {
     return(this.operatorHelper.IsRegularExpression(operation));
 }
Example #35
0
        public virtual IEnumerable <ItemType> CollectItems(string filepath, string trusteeSidPattern, OperationEnumeration operation)
        {
            var cachedItems = this.TryToGetCollectedItemsFromCache(filepath, trusteeSidPattern);

            if (cachedItems != null)
            {
                return(cachedItems.Select(item => CloneItemType(item)));
            }

            var    invokeMethodInfo = CreateInvokeMethodInfo(filepath);
            object managementACEs   = null;

            try
            {
                managementACEs = WmiProvider.InvokeMethodByWmiPath(invokeMethodInfo);
            }
            catch (InvalidInvokeMethodException)
            {
                var notExistItem = CreateItemToCollect(filepath, trusteeSidPattern, StatusEnumeration.doesnotexist);
                return(new ItemType[] { notExistItem });
            }

            var allUsers = DaclDisassembler.GetAllSecurityDescriptorsFromManagementObject(managementACEs).ToList();

            var usersDACLs = new Dictionary <string, List <WMIWinACE> >();

            foreach (var userACL in allUsers)
            {
                var sid = userACL.Trustee.SIDString;
                if (usersDACLs.ContainsKey(sid))
                {
                    usersDACLs[sid].Add(userACL);
                }
                else
                {
                    usersDACLs.Add(sid, new WMIWinACE[] { userACL }.ToList());
                }
            }

            var ovalComparator = new OvalComparatorFactory().GetComparator(SimpleDatatypeEnumeration.@string);
            var collectedItems = new List <fileeffectiverights_item>();

            foreach (var dacl in usersDACLs)
            {
                var trusteeSID = dacl.Key;
                var userDACLs  = dacl.Value;

                if (ovalComparator.Compare(trusteeSID, trusteeSidPattern, operation))
                {
                    cachedItems = this.TryToGetCollectedItemsFromCache(filepath, trusteeSID);
                    if (cachedItems != null)
                    {
                        collectedItems.AddRange(cachedItems.Select(item => CloneItemType(item)));
                        continue;
                    }

                    var newCollectedItem = this.CreateItemToCollect(filepath, trusteeSID);
                    FillCollectedItem(newCollectedItem, userDACLs);
                    collectedItems.Add(newCollectedItem);
                    this.AddToFlatCache(filepath, trusteeSID, newCollectedItem);
                }
            }

            if (collectedItems.Count == 0)
            {
                var newNotExistsItem = CreateItemToCollect(filepath, trusteeSidPattern, StatusEnumeration.doesnotexist);
                collectedItems.Add(newNotExistsItem);
                this.AddToFlatCache(filepath, trusteeSidPattern, newNotExistsItem);
            }

            this.AddToCache(filepath, trusteeSidPattern, collectedItems);

            return(collectedItems);
        }
Example #36
0
 public bool IsGreaterThanOrEqualOperation(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.greaterthanorequal);
 }
 public EvrStringComparatorChecker NotEqualOperation()
 {
     this.Operation = OperationEnumeration.notequal;
     return(this);
 }
 public EvrStringComparatorChecker GreaterOrEqualThanOperation()
 {
     this.Operation = OperationEnumeration.greaterthanorequal;
     return(this);
 }
Example #39
0
 public bool IsBitwiseAndOperation(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.bitwiseand);
 }
Example #40
0
 public bool IsLessThanOrEqualOperation(OperationEnumeration operation)
 {
     return (operation == OperationEnumeration.lessthanorequal);
 }
Example #41
0
 public bool IsEqualsOperation(OperationEnumeration operation)
 {
     return((operation == OperationEnumeration.equals) || (operation == OperationEnumeration.caseinsensitiveequals));
 }
Example #42
0
 public bool IsBitwiseOrOperation(OperationEnumeration operation)
 {
     return (operation == OperationEnumeration.bitwiseor);
 }
Example #43
0
 public bool IsLessThanOrEqualOperation(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.lessthanorequal);
 }
        public IEnumerable<ItemType> CollectItemsApplyingOperation(string regHive, string regKey, string sidEntityValue, OperationEnumeration sidEntityOperation)
        {
            Dictionary<string, uint> allUsersDACL = null;
            try
            {
                var hiveID = RegistryHelper.GetRegistryHiveFromHiveName(regHive);//(RegistryHive)RegistryHelper.GetHiveKeyIdFromHiveName(regHive);
                allUsersDACL = AccessControlListProvider.GetRegKeyDACLs(this.TargetInfo, hiveID.ToString(), regKey);
            }
            catch (RegistryKeyEffectiveRightsNotFoundException)
            {
                var newNotExistsItem = new regkeyeffectiverights_item() { status = StatusEnumeration.doesnotexist };
                newNotExistsItem.hive = new EntityItemRegistryHiveType() { Value = regHive };
                newNotExistsItem.key = new EntityItemStringType() { Value = regKey, status = StatusEnumeration.doesnotexist };
                return new ItemType[] { newNotExistsItem };
            }
            catch (RegistryKeyEffectiveRightsAccessDenied regKeyAccessDeniedException)
            {
                var messageType = new MessageType() { level = MessageLevelEnumeration.error, Value = regKeyAccessDeniedException.Message };
                var newErrorItem =
                    new regkeyeffectiverights_item()
                    {
                        hive = new EntityItemRegistryHiveType() { Value = regHive },
                        key = new EntityItemStringType() { Value = regKey },
                        status = StatusEnumeration.error,
                        message = new MessageType[] { messageType }
                    };

                return new ItemType[] { newErrorItem };
            }

            var collectedItems = new List<ItemType>();
            foreach (var userDacl in allUsersDACL)
            {
                var userSid = userDacl.Key;
                var dacl = userDacl.Value;

                if (ProcessSidEntityOperation(sidEntityValue, userSid, sidEntityOperation))
                {
                    var winACE = this.DaclDisassembler.GetSecurityDescriptorFromAccessMask(dacl);
                    var newCollectedItem = CreateItemTypeFromWinACE(winACE, regHive, regKey, userSid);
                    collectedItems.Add(newCollectedItem);
                }
            }

            return collectedItems;
        }
Example #45
0
 public bool IsLessThanOperation(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.lessthan);
 }
 public static OvalEntityOperationBase CreateOperationForOvalEntity(OperationEnumeration operation)
 {
     OvalEntityOperationBase newEntityOperation = resolveOvalEntityOperation(operation);
     return newEntityOperation;
 }
Example #47
0
 private bool ProcessEqualsOperation(string[] firstNumbers, string[] secondNumbers, OperationEnumeration operation)
 {
     for (int i = 0; i < firstNumbers.Length; i++)
     {
         if (!integerComparator.Compare(firstNumbers[i], secondNumbers[i], operation))
         {
             return(false);
         }
     }
     return(true);
 }
Example #48
0
 public bool IsRegularExpression(OperationEnumeration operation)
 {
     return(operation == OperationEnumeration.patternmatch);
 }
Example #49
0
 private bool ProcessLessThanAndGreaterThanOperation(string[] firstNumbers, string[] secondNumbers, OperationEnumeration operation)
 {
     for (int i = 0; i < firstNumbers.Length; i++)
     {
         if (integerComparator.Compare(firstNumbers[i], secondNumbers[i], operation))
         {
             return(true);
         }
         else
         {
             if (!integerComparator.Compare(firstNumbers[i], secondNumbers[i], OperationEnumeration.equals))
             {
                 return(false);
             }
         }
     }
     if (operatorHelper.IsGreaterThanOrEqualOperation(operation) || operatorHelper.IsLessThanOrEqualOperation(operation))
     {
         return(this.ProcessLessThanOrEqualAndGreatherThanOrEqualOperation(firstNumbers, secondNumbers, operation));
     }
     return(false);
 }
Example #50
0
        private IEnumerable<string> getValuesToApplyOperation(OperationEnumeration entityOperation, string entityValue)
        {
            bool isEqualOperation =
                ((entityOperation == OperationEnumeration.equals) ||
                 (entityOperation == OperationEnumeration.caseinsensitiveequals));

            return isEqualOperation ? new string[] { entityValue } : this.searchUsers(entityValue);
        }
Example #51
0
        private bool ProcessLessThanOrEqualAndGreatherThanOrEqualOperation(string[] firstNumbers, string[] secondNumbers, OperationEnumeration operation)
        {
            string firstLastElement  = firstNumbers.Last();
            string secondLastElement = secondNumbers.Last();

            return(integerComparator.Compare(firstLastElement, secondLastElement, operation));
        }
 public EvrStringComparatorChecker LessThanOperation()
 {
     this.Operation = OperationEnumeration.lessthan;
     return(this);
 }
Example #53
0
 public static bool IsEntityValuesNotEqual(OperationEnumeration entityOperation, string entityValue1, string entityValue2)
 {
     return(!IsEntityValuesEquals(entityOperation, entityValue1, entityValue2));
 }
Example #54
0
 public static bool IsEntityValuesNotEqual(OperationEnumeration entityOperation, string entityValue1, string entityValue2)
 {
     return (!IsEntityValuesEquals(entityOperation, entityValue1, entityValue2));
 }
Example #55
0
        private IEnumerable <string> EvaluateOperation(string value, IEnumerable <string> valuesToMatch, OperationEnumeration operation)
        {
            IOvalComparator comparator = new OvalComparatorFactory().GetComparator(SimpleDatatypeEnumeration.@string);
            List <string>   values     = new List <string>();

            foreach (string valueToMatch in valuesToMatch)
            {
                if (comparator.Compare(value, valueToMatch, operation))
                {
                    values.Add(value);
                }
            }

            return(values);
        }