Пример #1
0
        public string[] Filter(string[] a, string sourcePath, bool isFile)
        {
            if (isFile)
            {
                if (NameCond.Any <Struct_NameCond>())
                {
                    foreach (Struct_NameCond s in NameCond)
                    {
                        a = NameFilter(a, s.s, s.i);
                    }
                }
                if (NameCond_Extension.Any <string>())
                {
                    foreach (string s in NameCond_Extension)
                    {
                        a = ExtensionFilter(a, s);
                    }
                }
                if (DateCond.Any <Struct_DateCond>())
                {
                    foreach (Struct_DateCond dt in DateCond)
                    {
                        a = DateFilter(a, dt.dt, dt.i, sourcePath, isFile);
                    }
                }
                if (LengthCond.Any <Struct_LengthCond>())
                {
                    foreach (Struct_LengthCond i in LengthCond)
                    {
                        a = LengthFilter(a, i.l, i.i, sourcePath);
                    }
                }
                if (DateCond_Interval.Any <Struct_DateCond_Interval>())
                {
                    foreach (Struct_DateCond_Interval dt in DateCond_Interval)
                    {
                        a = DateFilter(a, dt.dtA, dt.dtB, dt.i, sourcePath, isFile);
                    }
                }
                if (LengthCond_Interval.Any <Struct_LengthCond_Interval>())
                {
                    foreach (Struct_LengthCond_Interval i in LengthCond_Interval)
                    {
                        a = LengthFilter(a, i.lA, i.lB, i.i, sourcePath);
                    }
                }
            }
            else
            {
                if (NameCond.Any <Struct_NameCond>())
                {
                    foreach (Struct_NameCond s in NameCond)
                    {
                        a = NameFilter(a, s.s, s.i);
                    }
                }
                if (DateCond.Any <Struct_DateCond>())
                {
                    foreach (Struct_DateCond dt in DateCond)
                    {
                        a = DateFilter(a, dt.dt, dt.i, sourcePath, isFile);
                    }
                }
                if (DateCond_Interval.Any <Struct_DateCond_Interval>())
                {
                    foreach (Struct_DateCond_Interval dt in DateCond_Interval)
                    {
                        a = DateFilter(a, dt.dtA, dt.dtB, dt.i, sourcePath, isFile);
                    }
                }
            }

            return(a);
        }
Пример #2
0
        public string[] Filter(string[] a, string sourcePath, bool isFile)
        {
            //List<string> aList = a.ToList();
            //List<string> tempList;
            //string[] temp;
            //string[] temp2;

            if (isFile)
            {
                if (NameCond.Any <Struct_NameCond>())
                {
                    foreach (Struct_NameCond s in NameCond)
                    {
                        a = NameFilter(a, s.s, s.i);

                        /*
                         * if (s.OR)
                         * {
                         *  temp2 = NameFilter(a, s.s, s.i);
                         *  tempList = temp2.ToList();
                         *  aList = aList.Union(tempList).ToList();
                         * }
                         * else
                         * {
                         *  temp = aList.ToArray();
                         *  temp = NameFilter(temp, s.s, s.i);
                         *  aList = temp.ToList();
                         * }*/
                    }
                }
                if (NameCond_Extension.Any <string>())
                {
                    foreach (string s in NameCond_Extension)
                    {
                        a = ExtensionFilter(a, s);

                        /*
                         * if (s.OR)
                         * {
                         *  temp2 = ExtensionFilter(a, s.s);
                         *  tempList = temp2.ToList();
                         *  aList = aList.Union(tempList).ToList();
                         * }
                         * else
                         * {
                         *  temp = aList.ToArray();
                         *  temp = ExtensionFilter(temp, s.s);
                         *  aList = temp.ToList();
                         * }*/
                    }
                }
                if (DateCond.Any <Struct_DateCond>())
                {
                    foreach (Struct_DateCond dt in DateCond)
                    {
                        a = DateFilter(a, dt.dt, dt.i, sourcePath, isFile);
                    }
                }
                if (LengthCond.Any <Struct_LengthCond>())
                {
                    foreach (Struct_LengthCond i in LengthCond)
                    {
                        a = LengthFilter(a, i.l, i.i, sourcePath);
                    }
                }
                if (DateCond_Interval.Any <Struct_DateCond_Interval>())
                {
                    foreach (Struct_DateCond_Interval dt in DateCond_Interval)
                    {
                        a = DateFilter(a, dt.dtA, dt.dtB, dt.i, sourcePath, isFile);
                    }
                }
                if (LengthCond_Interval.Any <Struct_LengthCond_Interval>())
                {
                    foreach (Struct_LengthCond_Interval i in LengthCond_Interval)
                    {
                        a = LengthFilter(a, i.lA, i.lB, i.i, sourcePath);
                    }
                }
            }
            else
            {
                if (NameCond.Any <Struct_NameCond>())
                {
                    foreach (Struct_NameCond s in NameCond)
                    {
                        a = NameFilter(a, s.s, s.i);
                    }
                }
                if (DateCond.Any <Struct_DateCond>())
                {
                    foreach (Struct_DateCond dt in DateCond)
                    {
                        a = DateFilter(a, dt.dt, dt.i, sourcePath, isFile);
                    }
                }
                if (DateCond_Interval.Any <Struct_DateCond_Interval>())
                {
                    foreach (Struct_DateCond_Interval dt in DateCond_Interval)
                    {
                        a = DateFilter(a, dt.dtA, dt.dtB, dt.i, sourcePath, isFile);
                    }
                }
            }
            //a = aList.ToArray();
            return(a);
        }