コード例 #1
0
        public bool Filter(string value)
        {
            if (_stringFilter != null)
            {
                return(_stringFilter.ScanQuick(value));
            }

            return(false);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: stellarbear/strings-sharp
        static void Main(string[] args)
        {
            string filename          = @"strings";
            string configurationFile = @"strings";

            try
            {
                //  Unicode
                using (StringsSharp.StringsSharp ss = new StringsSharp.StringsSharp(1200, "[\u0020-\u007E]", 4, 16))
                {
                    foreach (MatchCollection matches in ss.Scan(filename))
                    {
                        //  Process matches here
                    }
                }

                //  ASCII
                using (StringsSharp.StringsSharp ss = new StringsSharp.StringsSharp(1251, "[\x20-\x7E]"))
                {
                    using (StringsSharp.StringFilter sf = new StringFilter(configurationFile))
                    {
                        foreach (MatchCollection matches in ss.Scan(filename, 256))
                        {
                            foreach (Match match in matches)
                            {
                                if (sf.ScanQuick(match.Value))
                                {
                                    //  Process string here
                                }
                                foreach (string regexpTag in sf.Scan(match.Value))
                                {
                                    //  Process string here
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //  Handle errors here
            }
        }