• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Pipeline类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Pipeline的典型用法代码示例。如果您正苦于以下问题:C# Pipeline类的具体用法?C# Pipeline怎么用?C# Pipeline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Pipeline类属于命名空间,在下文中一共展示了Pipeline类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Should_load_all_filters_in_assembly

		public void Should_load_all_filters_in_assembly()
		{
			var pipeline = new Pipeline<int, string>(serviceProvider)
				.AddAssembly(typeof(AddFiltersInAssemblyTests).Assembly);

			Assert.That(pipeline.Count, Is.EqualTo(5));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:7,代码来源:AddFiltersInAssemblyTests.cs


示例2: TestAsyncStateChangeFake

    public void TestAsyncStateChangeFake()
    {
        bool done = false;
        Pipeline pipeline = new Pipeline();
        Assert.IsNotNull (pipeline, "Could not create pipeline");

        Element src = ElementFactory.Make ("fakesrc");
        Element sink = ElementFactory.Make ("fakesink");

        Bin bin = (Bin) pipeline;
        bin.Add (src, sink);
        src.Link (sink);

        Bus bus = pipeline.Bus;

        Assert.AreEqual ( ( (Element) pipeline).SetState (State.Playing), StateChangeReturn.Async);

        while (!done) {
          State old, newState, pending;
          Message message = bus.Poll (MessageType.StateChanged, -1);
          if (message != null) {
        message.ParseStateChanged (out old, out newState, out pending);
        if (message.Src == (Gst.Object) pipeline && newState == State.Playing)
          done = true;
          }
        }

        Assert.AreEqual ( ( (Element) pipeline).SetState (State.Null), StateChangeReturn.Success);
    }
开发者ID:Forage,项目名称:gstreamer-sharp,代码行数:29,代码来源:PipelineTest.cs


示例3: Main

        static void Main(string[] args)
        {
            var pump = new FileDataSource(new StreamReader(@"data\TestData.txt"));
            var shifter = new CircularShifter();
            var alphabetizer = new Alphabetizer();

            #region Modifying the requirement - add a 'noise' list to remove words from the index

            //var noiseWords = new FileDataSource(new StreamReader(@"data\noise.txt")).Begin();
            //var noiseRemover = new NoiseRemoval(noiseWords);
            //pump.Successor = noiseRemover;
            //noiseRemover.Successor = shifter;

            #endregion

            pump.Successor = shifter;
            shifter.Successor = alphabetizer;

            var pipeline = new Pipeline<string>(pump: pump, sink: new ConsoleWriter());
            Console.WriteLine("Begin Execution At:{0}", DateTime.UtcNow);
            pipeline.Execute();
            Console.WriteLine("Stop Execution At:{0}", DateTime.UtcNow);

            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
开发者ID:uzigula,项目名称:Styles,代码行数:26,代码来源:Program.cs


示例4: DefaultCtorSplitsAtDashes

        public void DefaultCtorSplitsAtDashes()
        {
            // Given
            Engine engine = new Engine();
            Metadata metadata = new Metadata(engine);
            Pipeline pipeline = new Pipeline("Pipeline", engine, null);
            IExecutionContext context = new ExecutionContext(engine, pipeline);
            IDocument[] inputs = { new Document(metadata).Clone(@"FM1
            FM2
            ---
            Content1
            Content2") };
            string frontMatterContent = null;
            FrontMatter frontMatter = new FrontMatter(new Execute(x =>
            {
                frontMatterContent = x.Content;
                return new [] {x};
            }));

            // When
            IEnumerable<IDocument> documents = frontMatter.Execute(inputs, context);

            // Then
            Assert.AreEqual(1, documents.Count());
            Assert.AreEqual(@"FM1
            FM2
            ", frontMatterContent);
            Assert.AreEqual(@"Content1
            Content2", documents.First().Content);
        }
开发者ID:Rohansi,项目名称:Wyam,代码行数:30,代码来源:FrontMatterFixture.cs


示例5: TestAsyncStateChangeEmpty

    public void TestAsyncStateChangeEmpty()
    {
        Pipeline pipeline = new Pipeline();
        Assert.IsNotNull (pipeline, "Could not create pipeline");

        Assert.AreEqual ( ( (Element) pipeline).SetState (State.Playing), StateChangeReturn.Success);
    }
开发者ID:Forage,项目名称:gstreamer-sharp,代码行数:7,代码来源:PipelineTest.cs


示例6: ClearPipeline

 /// <summary>
 /// Deletes the pipeline and sets its corresponding property to null.
 /// </summary>
 /// <param name="p">The pipeline that will be deleted.</param>
 public override void ClearPipeline(Pipeline p)
 {
     if (this.IncomePipeline == p)
     {
         this.IncomePipeline = null;
     }
 }
开发者ID:preslavgerchev,项目名称:OOD2,代码行数:11,代码来源:Sink.cs


示例7: testMultiProperty

        public void testMultiProperty()
        {
            var _Graph    = TinkerGraphFactory.CreateTinkerGraph();
            var _Marko    = _Graph.VertexById(1);

            var _EVP      = new InVertexPipe<UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object>();

            var _PPipe    = new PropertyPipe<String, Object>(Keys: "name");

            var _Pipeline = new Pipeline<IGenericPropertyEdge<UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object>, String>(_EVP, _PPipe);

            _Pipeline.SetSourceCollection(_Marko.OutEdges());

            var _Counter = 0;
            while (_Pipeline.MoveNext())
            {
                var _Name = _Pipeline.Current;
                Assert.IsTrue(_Name.Equals("vadas") || _Name.Equals("josh") || _Name.Equals("lop"));
                _Counter++;
            }

            Assert.AreEqual(3, _Counter);
        }
开发者ID:subbuballa,项目名称:Balder,代码行数:29,代码来源:PropertyPipeTest.cs


示例8: Stencil

        internal override void Stencil(Pipeline pipeline)
        {
            if (Glyphs == null || _vertices == null)
                return;

            pipeline.StencilInstancedGlyphs(Font.FillRule, this);
        }
开发者ID:liwq-net,项目名称:XnaVG,代码行数:7,代码来源:GPUBufferedString.cs


示例9: Main

  public static void Main (string [] args) {
    Application.Init();

    if (args.Length != 1) {
      Console.Error.WriteLine ("usage: mono queueexample.exe <filename>\n");
      return;
    }

    Element pipeline = new Pipeline ("pipeline");

    Element filesrc = ElementFactory.Make ("filesrc", "disk_source");
    filesrc.SetProperty ("location", args[0]);
    Element decode = ElementFactory.Make ("mad", "decode");
    Element queue = ElementFactory.Make ("queue", "queue");

    Element audiosink = ElementFactory.Make ("alsasink", "play_audio");

    Bin bin = (Bin) pipeline;
    bin.AddMany (filesrc, decode, queue, audiosink);

    Element.LinkMany (filesrc, decode, queue, audiosink);

    pipeline.SetState (State.Playing);

    EventLoop (pipeline);

    pipeline.SetState (State.Null);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:28,代码来源:QueueExample.cs


示例10: MessageRegistration

		public MessageRegistration(Type messageType, Type handlerType, Pipeline pipeline, IReadOnlyCollection<Type> dependancies, IReadOnlyCollection<Type> scopedDependancies)
		{
			if (messageType == null) throw new ArgumentNullException(nameof(messageType));
			if (handlerType == null) throw new ArgumentNullException(nameof(handlerType));
			if (pipeline == null) throw new ArgumentNullException(nameof(pipeline));
			if (dependancies == null) throw new ArgumentNullException(nameof(dependancies));
			if (scopedDependancies == null) throw new ArgumentNullException(nameof(scopedDependancies));

			var messageTypeInfo = messageType.GetTypeInfo();

			if (!typeof(IMessage).GetTypeInfo().IsAssignableFrom(messageTypeInfo)) throw new ArgumentException($"Parameter {nameof(messageType)} must implement IMessage", nameof(messageType));

			if (typeof(ICommand).GetTypeInfo().IsAssignableFrom(messageTypeInfo)) {
				GetValue(new[] { messageType }, messageType, handlerType, type => typeof(ICommandHandler<>).MakeGenericType(type));

			} else if (typeof(IEvent).GetTypeInfo().IsAssignableFrom(messageTypeInfo)) {
				GetValue(MessagesHelper.ExpandType(messageType).Where(x => x != typeof(IMessage)), messageType, handlerType, type => typeof(IEventHandler<>).MakeGenericType(type));

			} else if (typeof(IQuery).GetTypeInfo().IsAssignableFrom(messageTypeInfo)) {

				var genericArguments = messageTypeInfo.ImplementedInterfaces.Single(x => x.GetTypeInfo().IsGenericType && x.GetGenericTypeDefinition() == typeof(IQuery<,>)).GenericTypeArguments;
				GetValue(new[] { messageType }, messageType, handlerType, type => typeof(IQueryHandler<,>).MakeGenericType(genericArguments));
			}

			this.MessageType = messageType;
			this.Pipeline = pipeline;
			this.Handler = handlerType;

			Dependancies = dependancies;
			ScopedDependancies = scopedDependancies;
		}
开发者ID:Sandboxed-Forks,项目名称:Enexure.MicroBus,代码行数:31,代码来源:MessageRegistration.cs


示例11: GetDefaultContext

 static LinkContext GetDefaultContext(Pipeline pipeline)
 {
     LinkContext context = new LinkContext (pipeline);
     context.CoreAction = AssemblyAction.Skip;
     context.OutputDirectory = "output";
     return context;
 }
开发者ID:kumpera,项目名称:ildep,代码行数:7,代码来源:Main.cs


示例12: testSelfFilter

        public void testSelfFilter()
        {

            var _List     = new List<String>() { "marko", "antonio", "rodriguez", "was", "here", "." };
            var _Pipe1    = new AggregatorPipe<String>(new List<String>());
            var _Pipe2    = new CollectionFilterPipe<String>(_Pipe1.SideEffect, ComparisonFilter.NOT_EQUAL);
            var _Pipeline = new Pipeline<String, String>(_Pipe1, _Pipe2);
            _Pipeline.SetSourceCollection(_List);

            var _Counter = 0;
            while (_Pipeline.MoveNext())
                _Counter++;

            Assert.AreEqual(6, _Counter);


            _Pipe1    = new AggregatorPipe<String>(new List<String>());
            _Pipe2    = new CollectionFilterPipe<String>(_Pipe1.SideEffect, ComparisonFilter.EQUAL);
            _Pipeline = new Pipeline<String, String>(_Pipe1, _Pipe2);
            _Pipeline.SetSourceCollection(_List);

            _Counter = 0;
            while (_Pipeline.MoveNext())
                _Counter++;

            Assert.AreEqual(0, _Counter);

        }
开发者ID:subbuballa,项目名称:Styx,代码行数:28,代码来源:AggregatorPipeTests.cs


示例13: Main

    public static void Main(string [] args)
    {
        Application.Init ();

        Pipeline pipeline = new Pipeline ("pipeline");
        Element source = ElementFactory.Make ("filesrc", "source");
        typefind = TypeFindElement.Make ("typefind");
        Element sink = ElementFactory.Make ("fakesink", "sink");

        source.SetProperty ("location", args[0]);

        typefind.HaveType += OnHaveType;

        pipeline.AddMany (source, typefind, sink);
        source.Link (typefind);
        typefind.Link (sink);

        pipeline.SetState (State.Paused);
        pipeline.SetState (State.Null);

        source.Dispose ();
        typefind.Dispose ();
        sink.Dispose ();
        pipeline.Dispose ();
    }
开发者ID:draek,项目名称:cil-bindings,代码行数:25,代码来源:TypeFind.cs


示例14: ExecuteCommand

 void ExecuteCommand()
 {
     var pipeline = currentPipeline;
     try
     {
         pipeline.Invoke();
         foreach (PSObject errorRecord in pipeline.Error.ReadToEnd())
         {
             var errorMessage = "Error executing powershell: " + errorRecord;
             LogTo.Error(errorMessage);
             LogError(errorMessage);
         }
     }
     finally
     {
         try
         {
             if (pipeline != null)
             {
                 pipeline.Dispose();
             }
         }
         finally
         {
             currentPipeline = null;
         }
     }
 }
开发者ID:nulltoken,项目名称:PlatformInstaller,代码行数:28,代码来源:PowerShellRunner.cs


示例15: Main

    public static int Main(string[] args) {
        if (args.Length < 3) {
            Console.Error.WriteLine("Usage: RunUDPipe input_format(tokenize|conllu|horizontal|vertical) output_format(conllu) model");
            return 1;
        }

        Console.Error.Write("Loading model: ");
        Model model = Model.load(args[2]);
        if (model == null) {
            Console.Error.WriteLine("Cannot load model from file '{0}'", args[2]);
            return 1;
        }
        Console.Error.WriteLine("done");

        Pipeline pipeline = new Pipeline(model, args[0], Pipeline.DEFAULT, Pipeline.DEFAULT, args[1]);
        ProcessingError error = new ProcessingError();

        // Read whole input
        StringBuilder textBuilder = new StringBuilder();
        string line;
        while ((line = Console.In.ReadLine()) != null)
            textBuilder.Append(line).Append('\n');

        // Process data
        string text = textBuilder.ToString();
        string processed = pipeline.process(text, error);

        if (error.occurred()) {
            Console.Error.WriteLine("An error occurred in RunUDPipe: {0}", error.message);
            return 1;
        }
        Console.Write(processed);

        return 0;
    }
开发者ID:ufal,项目名称:udpipe,代码行数:35,代码来源:RunUDPipe.cs


示例16: TestBufferOwnership

  public void TestBufferOwnership () {
    MyTransformIp.Register ();

    Pipeline pipeline = new Pipeline ();
    Element src = ElementFactory.Make ("fakesrc");
    src["num-buffers"] = 10;
    Element transform = new MyTransformIp ();
    Element sink = ElementFactory.Make ("fakesink");

    pipeline.Add (src, transform, sink);
    Element.Link (src, transform, sink);

    Gst.GLib.MainLoop loop = new Gst.GLib.MainLoop ();

    pipeline.Bus.AddWatch (delegate (Bus bus, Message message) {
                             switch (message.Type) {
                             case MessageType.Error:
                                 Enum err;
                                 string msg;

                                 message.ParseError (out err, out msg);
                                 Assert.Fail (String.Format ("Error message: {0}", msg));
                                 loop.Quit ();
                                 break;
                               case MessageType.Eos:
                                   loop.Quit ();
                                   break;
                                 }
                                 return true;
                               });

    pipeline.SetState (State.Playing);
    loop.Run ();
    pipeline.SetState (State.Null);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:35,代码来源:BaseTransformTest.cs


示例17: Main

        static void Main(string[] args)
        {
            // create a set of functions that we want to pipleline together
            Func<int, double> func1 = (input => Math.Pow(input, 2));
            Func<double, double> func2 = (input => input / 2);
            Func<double, bool> func3 = (input => input % 2 == 0 && input > 100);

            // define a callback
            Action<int, bool> callback = (input, output) => {
                if (output) {
                    Console.WriteLine("Found value {0} with result {1}", input, output);
                }
            };

            // create the pipeline
            Pipeline<int, bool> pipe = new Pipeline<int, double>(func1).AddFunction(func2).AddFunction(func3);
            // start the pipeline
            pipe.StartProcessing();

            // generate values and push them into the pipeline
            for (int i = 0; i < 1000; i++) {
                Console.WriteLine("Added value {0}", i);
                pipe.AddValue(i, callback);
            }

            // stop the pipeline
            pipe.StopProcessing();

            // wait for input before exiting
            Console.WriteLine("Press enter to finish");
            Console.ReadLine();
        }
开发者ID:clp-takekawa,项目名称:codes-from-books,代码行数:32,代码来源:Use_Pipeline.cs


示例18: Main

  public static void Main (string[] args) {
    Application.Init();
    loop = new MainLoop();

    // Construct all the elements
    pipeline = new Pipeline();
    appsrc = new Gst.App.AppSrc ("AppSrcDemo");
    Element color = ElementFactory.Make ("ffmpegcolorspace");
    Element sink = ElementFactory.Make ("autovideosink");

    // Link the elements
    pipeline.Add (appsrc, color, sink);
    Element.Link (appsrc, color, sink);

    // Set the caps on the AppSrc to RGBA, 640x480, 4 fps, square pixels
    Gst.Video.VideoFormat fmt = (BitConverter.IsLittleEndian) ? Gst.Video.VideoFormat.BGRA : Gst.Video.VideoFormat.ARGB;
    appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps (fmt, 640, 480, 4, 1, 1, 1);

    // Connect the handlers
    appsrc.NeedData += PushAppData;
    pipeline.Bus.AddSignalWatch();
    pipeline.Bus.Message += MessageHandler;

    // Run, loop, run!
    pipeline.SetState (State.Playing);
    loop.Run();
    pipeline.SetState (State.Null);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:28,代码来源:AppSrc.cs


示例19: testListProperty

        public void testListProperty()
        {
            var _Graph    = TinkerGraphFactory.CreateTinkerGraph();
            var _Marko    = _Graph.VertexById(1);
            var _Vadas    = _Graph.VertexById(2);

            var _Pipe = new PropertyPipe<String, Object>(Keys: "name");

            var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object>, String>(_Pipe);

            _Pipeline.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object>>() { _Marko, _Vadas }.GetEnumerator());

            var _Counter = 0;
            while (_Pipeline.MoveNext())
            {
                var _Name = _Pipeline.Current;
                Assert.IsTrue(_Name.Equals("vadas") || _Name.Equals("marko"));
                _Counter++;
            }

            Assert.AreEqual(2, _Counter);
        }
开发者ID:subbuballa,项目名称:Balder,代码行数:28,代码来源:PropertyPipeTest.cs


示例20: Stencil

 internal override void Stencil(Pipeline pipeline)
 {
     int len = _glyphs.Length;
     pipeline.BeginCPUTextStenciling(Font.FillRule);
     for (int i = 0; i < len; i++)
         pipeline.StencilGlyph(_glyphs[i], ref _offsets[i]);
 }
开发者ID:liwq-net,项目名称:XnaVG,代码行数:7,代码来源:CPUString.cs



注:本文中的Pipeline类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PipelineArgs类代码示例发布时间:2022-05-24
下一篇:
C# PipeTransmissionMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap