Example #1
0
        public string FindString(string needle, Wildcards wildcards)
        {
            if (data == null || data.Length == 0)
            {
                return(null);
            }

            int  dataLength   = data.Length;
            int  needleLength = needle.Length;
            int  searchLength = dataLength - needleLength;
            bool found        = false;

            for (int d = 0; d < searchLength; d++)
            {
                found = true;
                for (int n = 0; n < needleLength; n++)
                {
                    if (needle[n] != data[d + n] && false == wildcards.IsMatch(needle[n], (char)data[d + n]))
                    {
                        found = false;
                        break;
                    }
                }
                if (found)
                {
                    return(ASCIIEncoding.UTF8.GetString(data, d, needleLength));
                }
            }
            return(null);
        }
        public string FindString(string needle, Wildcards wildcards)
        {
            if (data == null || data.Length == 0) return null;

            int dataLength = data.Length;
            int needleLength = needle.Length;
            int searchLength = dataLength - needleLength;
            bool found = false;

            for (int d = 0; d < searchLength; d++)
            {
                found = true;
                for (int n = 0; n < needleLength; n++)
                {
                    if (needle[n] != data[d + n] && false == wildcards.IsMatch(needle[n], (char)data[d + n]))
                    {
                        found = false;
                        break;
                    }
                }
                if (found)
                {
                    return ASCIIEncoding.UTF8.GetString(data, d, needleLength);
                }
            }
            return null;
        }
 public string FindString(string needle, Wildcards wildcards)
 {
     foreach (var kvp in memoryCache)
     {
         if (kvp.Value != null && kvp.Value.Data != null)
         {
             string result = kvp.Value.FindString(needle, wildcards);
             if (result != null)
             {
                 return result;
             }
             else
             {
                 kvp.Value.Unload();
             }
         }
     }
     return null;
 }
Example #4
0
 public string FindString(string needle, Wildcards wildcards)
 {
     foreach (var kvp in memoryCache)
     {
         if (kvp.Value != null && kvp.Value.Data != null)
         {
             string result = kvp.Value.FindString(needle, wildcards);
             if (result != null)
             {
                 return(result);
             }
             else
             {
                 kvp.Value.Unload();
             }
         }
     }
     return(null);
 }