示例#1
0
文件: Program.cs 项目: xxy1991/cozy
        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));
                }
            }
        }
示例#2
0
文件: Program.cs 项目: xxy1991/cozy
        static void Main(string[] args)
        {
            IUrlGeneraterRunner p1 = new MultiUrlGeneraterRunner();
            IUrl2ResultRunner p3 = new AsyncUrl2ResultRunner();

            IUrlGenerater gen1 = new TestUrlGenerater();
            IUrlGenerater gen2 = new TestUrlGenerater2();
            IUrl2Result to1 = new TestUrl2Result();
            IUrl2Result to2 = new TestUrl2Result2();

            p1.From(gen1);
            p1.From(gen2);
            p1.To(to1);
            p1.To(p3);
            p3.To(to2);

            p3.Start();
            p1.Start();
        }
示例#3
0
文件: Program.cs 项目: xxy1991/cozy
        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();
        }