Exemple #1
0
 public PartedString Filter(PartedString ToFilter)
 {
     for (int i = 0; i < ToFilter.Count; i++)
     {
         if (_config.BlackList.Contains(ToFilter[i]))
         {
             ToFilter.RemoveAt(i);
             i--;
         }
         else
         {
             string dummy = "";
             foreach (var curse in Curses)
             {
                 dummy = curse.TryFix(ToFilter[i]);
                 if (curse.Fixed)
                 {
                     ToFilter[i] = dummy;
                     break;
                 }
             }
         }
     }
     return ToFilter;
 }
        public PartedString Filter(PartedString part)
        {
            execute(part);
            part.ReSplit(true);

            return part;
        }
        public void should_kill_multiple_internet_matches()
        {
            InternetStuffCleaner cleaner = new InternetStuffCleaner();

            List<Tuple<string, string>> testCases = new List<Tuple<string, string>>()
            {
                Tuple.Create("Atreyu-Congregation_Of_The_Damned[www.mp3boo.com][blub.org]", "Atreyu-Congregation_Of_The_Damned[][]"),
                Tuple.Create("[www.mp3boo.com]Atreyu-Congregation_Of_The_Damned[blub.org]", "[]Atreyu-Congregation_Of_The_Damned[]"),
                Tuple.Create("{www.google.com]", "{]"),
                Tuple.Create("blub.org", "")
            };

            foreach (var item in testCases)
            {
                PartedString have = new PartedString(item.Item1);

                PartedString result = null;
                result = cleaner.Filter(have);

                Assert.IsNotNull(result);
                //Assert.AreSame(result, have);
                var resText = result.ToString();
                Assert.AreEqual(item.Item2, resText);
            }
        }
 public void SingleItemsAreEqual(Action<PartedString, PartedString> processor, PartedString B, string TestName)
 {
     for (int i = 0; i < Have.Count; i++)
     {
         processor(Have[i], B);
         PartedAreEqual(expected[i], Have[i], TestName);
     }
 }
Exemple #5
0
 //-----------------------------------------------------------------------------------------------------------------------
 //-----------------------------------------------------------------------------------------------------------------------
 private void SeekAndDestroy(PartedString ps)
 {
     for (int i = 0; i < ps.Count; i++)
     {
         if (StringsToDelete.Contains(ps[i]))
         {
             ps.RemoveAt(i);
             i--;
         }
     }
 }
Exemple #6
0
        public void SetByDepth(int depth, string value)
        {
            LevelValue = new PartedString(value);

            //switch (depth)
            //{
            //    case 0 : Artist = value; break;
            //    case 1 : Album = value; break;
            //    case 3 : SongName = value; break;
            //}
        }
 // just look for macthing string
 // hand remove this part
 private void execute(PartedString parted)
 {
     for (int i = 0; i < parted.Count; i++)
     {
         var match = Reg.Match(parted[i]);
         if (match.Success)
         {
             parted.RemoveAt(i);
             i--;
         }
     }
 }
Exemple #8
0
    public static void Main(string[] args)
    {
        PartedString s = new PartedString();

        s.add_literal("0123456789");
        s.add_literal('-');
        s.add_part(PartT.RandomPool, 0, 5);
        s.add_part(PartT.Plain, 1, 2);
        s.add_part(PartT.Clone, 0);
        //Console.WriteLine("test: {0}", s.pout());
        for (int i = 0; i < 10; ++i)
        {
            Console.WriteLine(s);
        }
        Console.WriteLine("I found {0}.", s.firsts("123"));
        //Console.WriteLine("here {0}",a.t);
    }
 private void PartedAreEqual(PartedString expect, PartedString actual, string TestName)
 {
     var exp = expect.ToString();
     var res = actual.ToString();
     Assert.AreEqual(exp, res, TestName);
 }
 public void setByKey(CleanIIS key, PartedString value)
 {
     base.setByKey<PartedString>((int)key, value);
 }