Пример #1
0
        public double regex(byte[] input)
        {
            if (settings.RegEx == null)
            {
                GuiLogMessage("There is no Regular Expression to be searched for. Please insert regex in the 'Regular Expression' - Textarea", NotificationLevel.Error);
                return(-1.0);
            }

            if (lastRegex != settings.RegEx || lastCaseInsensitive != settings.CaseInsensitive)
            {
                regularexpression   = new RegEx(settings.RegEx, settings.CaseInsensitive);
                lastRegex           = settings.RegEx;
                lastCaseInsensitive = settings.CaseInsensitive;
            }

            try
            {
                return(regularexpression.MatchesValue(input));
            }
            catch (Exception e)
            {
                GuiLogMessage(e.Message, NotificationLevel.Error);
                return(Double.NegativeInfinity);
            }
        }
Пример #2
0
        public string ModifyOpenCLCode(string code)
        {
            switch (settings.FunctionType)
            {
            case 0:     //Index of coincidence
                return(ModifyOpenCLCodeIndexOfCoincidence(code, bytesToUse()));

            case 1:     //Entropy
                return(ModifyOpenCLCodeEntropy(code, bytesToUse()));

            case 5:     // Regular Expression
                var regex = new RegEx(settings.RegEx, settings.CaseInsensitive);
                return(regex.ModifyOpenCLCode(code, bytesToUse()));

            default:
                throw new NotImplementedException("The value " + settings.FunctionType + " is not implemented for OpenCL.");
            }//end switch
        }