コード例 #1
0
        static void Main(string[] args)
        {
            var textfileadapter = new TextfileAdapter();
            var formatter       = new Formatter();

            var config = new FlowRuntimeConfiguration()
                         .AddStreamsFrom("TelegramProblem.run.flow", Assembly.GetExecutingAssembly())

                         .AddAction <string>("read", textfileadapter.Read).MakeAsync()
                         .AddAction <string>("write", textfileadapter.Write, true)

                         .AddAction <string, string>("decompose", formatter.Decompose)
                         .AddAction <string, string>("concatenate", formatter.Concatenate)

                         .AddAction <Tuple <string, string> >("textfileadapter_config", textfileadapter.Config)
                         .AddAction <int>("formatter_config", formatter.Config);

            using (var fr = new FlowRuntime(config))
            {
                fr.UnhandledException += Console.WriteLine;

                fr.Process(".configFilenames", new Tuple <string, string>("source.txt", "target.txt"));
                fr.Process(".configLineWidth", 60);

                fr.Process(".run");

                fr.WaitForResult();

                Console.WriteLine(File.ReadAllText("target.txt"));
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: kennychou0529/NPantaRhei
        static void Main(string[] args)
        {
            var textfileadapter = new TextfileAdapter();
            var formatter = new Formatter();

            var config = new FlowRuntimeConfiguration()
                .AddStreamsFrom("TelegramProblem.run.flow", Assembly.GetExecutingAssembly())

                .AddAction<string>("read", textfileadapter.Read).MakeAsync()
                .AddAction<string>("write", textfileadapter.Write, true)

                .AddAction<string, string>("decompose", formatter.Decompose)
                .AddAction<string, string>("concatenate", formatter.Concatenate)

                .AddAction<Tuple<string, string>>("textfileadapter_config", textfileadapter.Config)
                .AddAction<int>("formatter_config", formatter.Config);

            using(var fr = new FlowRuntime(config))
            {
                fr.UnhandledException += Console.WriteLine;

                fr.Process(".configFilenames", new Tuple<string,string>("source.txt", "target.txt"));
                fr.Process(".configLineWidth", 60);

                fr.Process(".run");

                fr.WaitForResult();

                Console.WriteLine(File.ReadAllText("target.txt"));
            }
        }