Exemple #1
0
        private static void OnColor()
        {
            IUrlGeneraterRunner p1 = new MultiUrlGeneraterRunner();
            IUrl2UrlRunner p2 = new BlockedUrl2UrlRunner();
            IUrl2ResultRunner p3 = new AsyncUrl2ResultRunner();

            var result = new List<UserColor>();

            p1.From(new UserColorUrlGenerater(1, 132));
            p1.To(p2);
            p2.To(p3);
            p2.SetProcessor(new UserColorUrl2Url(4));
            p3.To(new UserColorResult(result));

            p3.Start();
            p2.Start();
            p1.Start();

            Console.ReadKey();
            using (var fs = new FileStream("Color.json", FileMode.Create, FileAccess.ReadWrite))
            {
                using (var writer = new StreamWriter(fs))
                {
                    writer.Write(JsonConvert.SerializeObject(result));
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            IUrlGeneraterRunner p1   = new MultiUrlGeneraterRunner();
            IUrl2UrlRunner p2       = new BlockedUrl2UrlRunner();
            IUrl2ResultRunner p3    = new AsyncUrl2ResultRunner();

            p1.From(new TestUrlGenerater());
            p1.To(p2);
            p2.To(p3);
            p2.SetProcessor(new TestUrl2Url());
            p3.To(new TestUrl2Result());

            p3.Start();
            p2.Start();
            p1.Start();
        }