当前位置: 首页>>代码示例>>C#>>正文


C# Processor.Process方法代码示例

本文整理汇总了C#中Processor.Process方法的典型用法代码示例。如果您正苦于以下问题:C# Processor.Process方法的具体用法?C# Processor.Process怎么用?C# Processor.Process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Processor的用法示例。


在下文中一共展示了Processor.Process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoThing

        public void DoThing()
        {
            var args1 = new byte[] {1, 2, 3};
            var args2 = new byte[] {1, 2, 3};
            var t = new Processor();

            // Both lambdas share a backing class, so the scope of args1 or args2
            // may be wider than you think. Only way to suppress is with an
            // annotation attribute to tell ReSharper that the closure's scope
            // is constrained to the called method only
            DoesSomethingWithAction(() => t.Process(args1));
            DoesSomethingWithAction(() => t.Process(args2));
        }
开发者ID:evilz,项目名称:Tidbits,代码行数:13,代码来源:ImplicitlyCapturedClosure.cs

示例2: Process

        public async Task Process()
        {
            var bytes = File.ReadAllBytes(Environment.CurrentDirectory + @"\icon.png");

            var versions = this.Versions();
            var version = versions.Values.First();

            var queued = new ImageQueued
            {
                Identifier = Guid.NewGuid(),
                OriginalExtension = Naming.DefaultExtension,
                
            };
            queued.FileNameFormat = queued.Identifier.ToString() + "_{0}.{1}";

            await this.container.Save(string.Format("{0}_original.jpeg", queued.Identifier), bytes);

            var store = new DataStore(connectionString);

            var processor = new Processor(new DataStore(connectionString), versions);
            await processor.Process(queued);

            var data = await this.container.Get(string.Format("{0}_test.gif", queued.Identifier));
            Assert.IsNotNull(data);

            var entities = await this.table.QueryByRow<ImageEntity>("test");
            var entity = entities.FirstOrDefault();

            Assert.IsNotNull(entity);
            Assert.AreEqual(version.Format.MimeType, entity.MimeType);
            Assert.AreEqual(string.Format(Naming.PathFormat, this.container.Name, entity.FileName), entity.RelativePath);
        }
开发者ID:shoshindes,项目名称:King.Azure.Imaging,代码行数:32,代码来源:ProcessorTests.cs

示例3: ImageProcessing

 /// <summary>
 /// Image Processing
 /// </summary>
 /// <param name="image">image</param>
 public static void ImageProcessing([QueueTrigger("imaging")] string img)
 {
     var connectionString = CloudConfigurationManager.GetSetting("StorageAccount");
     var image = JsonConvert.DeserializeObject<ImageQueued>(img);
     var processor = new Processor(new DataStore(connectionString), versions.Images);
     processor.Process(image).Wait();
 }
开发者ID:shoshindes,项目名称:King.Azure.Imaging,代码行数:11,代码来源:Functions.cs

示例4: CrashesOnUnassignedRequiredValues

 public void CrashesOnUnassignedRequiredValues()
 {
     var proc = new Processor(defaultArgument: "--test");
     proc.Handle("--test").Required();
     Assert.Throws<ValueRequiredException>(
         () => proc.Process(new string[0])
         );
 }
开发者ID:sciolist,项目名称:adoption,代码行数:8,代码来源:WhenProcessing.cs

示例5: DoSomething

        public override string DoSomething(string val1)
        {
            Processor processor = new Processor();

            var str = processor.Process(val1, new BaseType());

            return str;
        }
开发者ID:adamjmoon,项目名称:Siege,代码行数:8,代码来源:SubType.cs

示例6: CanImplyFlagWhenPassingMultipleKeys

        public void CanImplyFlagWhenPassingMultipleKeys()
        {
            var proc = new Processor(defaultArgument: "--test");
            var test = proc.Handle("--test");
            var set = new[] { "--bar", "--test", "foo" };
            proc.Process(set);

            Assert.That(test.Value, Is.EqualTo("foo"));
        }
开发者ID:sciolist,项目名称:adoption,代码行数:9,代码来源:WhenProcessing.cs

示例7: CanAddOptionsToDefaultArgument

        public void CanAddOptionsToDefaultArgument()
        {
            var proc = new Processor(defaultArgument: "--test");
            var test = proc.Handle("--test").TakesManyValues();
            var set = new[] { "foo", "bar" };
            proc.Process(set);

            Assert.That(test.Value, Is.EquivalentTo(set));
        }
开发者ID:sciolist,项目名称:adoption,代码行数:9,代码来源:WhenProcessing.cs

示例8: Main

        static void Main(string[] args)
        {
            Logger.Setup("Error.log");

            try
            {
                ExtractorConfig config;
                bool showUI;

                if (File.Exists(ExtractorConfig.DefualtConfigPath))
                {
                    config = new ExtractorConfig(ExtractorConfig.DefualtConfigPath);
                    showUI = !args.Contains("-q");
                }
                else
                {
                    config = new ExtractorConfig();
                    showUI = true;
                }

                if (showUI)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    MainWindow window = new MainWindow(config);
                    DialogResult result = window.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        return;
                    }

                    config.Save(ExtractorConfig.DefualtConfigPath);
                }

                Processor processor = new Processor(config);
                processor.Process();

                Thread.Sleep(3000);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
            finally
            {
                Logger.Teardown();
            }
        }
开发者ID:karamanolev,项目名称:MoovyScanner,代码行数:49,代码来源:Program.cs

示例9: Show

        private static void Show(params string[] args)
        {
            var processor = new Processor(defaultArgument: "--method");
            processor.Handle("--configuration", "-c").Required();
            var method = processor.Handle("--method", "-m");
            var full = processor.Handle("--full").Flag(false);
            processor.Process(args);

            var showFull = full.Enabled;
            switch(method.Value.ToString())
            {
                case "name":
                    Console.WriteLine("Name: {0}", showFull ? "Adoption Option Parser" : "adoption");
                    break;
                case "description":
                    Console.WriteLine("Description: {0}", showFull ? "Parses command line options!" : "option parser");
                    break;
            }
        }
开发者ID:sciolist,项目名称:adoption,代码行数:19,代码来源:Example.cs

示例10: Process_ProperOverloadOfMethodIsChoosen

        public void Process_ProperOverloadOfMethodIsChoosen()
        {
            var processor = new Processor();
            var listOfTuples = new List<Tuple<IColorable, IColorable, string>>();
            IColorable redColor = new RedColor();
            IColorable greenColor = new GreenColor();
            listOfTuples.Add(Tuple.Create(greenColor, redColor, "GreenRed"));
            listOfTuples.Add(Tuple.Create(redColor, greenColor, "RedGreen"));
            listOfTuples.Add(Tuple.Create(greenColor, greenColor, "GreenGreen"));
            listOfTuples.Add(Tuple.Create(redColor, redColor, "RedRed"));

            foreach (var tuple in listOfTuples)
            {
                var firstColor = tuple.Item1;
                var secondColor = tuple.Item2;
                var expectedColotCombination = tuple.Item3;
                var actualColorCombination = processor.Process(firstColor, secondColor);
                Assert.AreEqual(expectedColotCombination, actualColorCombination);
            }
        }
开发者ID:Confirmit,项目名称:Students,代码行数:20,代码来源:ColorLibary.UnitTests.cs

示例11: CanSpecifyDefaultArgument

 public void CanSpecifyDefaultArgument()
 {
     var proc = new Processor(defaultArgument: "--test");
     proc.Process(new[] { "foo" });
     Assert.That(proc["--test"], Is.EqualTo("foo"));
 }
开发者ID:sciolist,项目名称:adoption,代码行数:6,代码来源:WhenProcessing.cs

示例12: CanGetUnresolvedParts

 public void CanGetUnresolvedParts()
 {
     var proc = new Processor();
     proc.Process(new[] { "--test1", "foo" });
     Assert.AreEqual(new[] {"--test1", "foo" }, proc.UnresolvedParts);
 }
开发者ID:sciolist,项目名称:adoption,代码行数:6,代码来源:WhenProcessing.cs

示例13: Main

 static void Main(string[] args)
 {
     Processor p = new Processor();
     p.Process(args);
 }
开发者ID:Tradehelm-Inc,项目名称:Testt,代码行数:5,代码来源:Program.cs

示例14: SetLanguage

		/// <summary>
		/// 
		/// </summary>
		/// <param name="infos"></param>
		/// <returns></returns>
		public Return<object> SetLanguage(List<InfoGrp_Class> infos)
		{
			Return<object> _answer = new Return<object>();
			if (infos == null)
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(new ArgumentNullException("infos"), this.GetType());
			}
			else
			{
				try
				{
					List<InfoGrp_Class> _infosNoLanguage = infos.Where(i => !i.language.HasValue).ToList();
					if (_infosNoLanguage.Any())
					{
						int _numberSubprocess = _infosNoLanguage.Count < this.numberSubprocessLanguageIdentification ? _infosNoLanguage.Count : this.numberSubprocessLanguageIdentification;
						List<object> _objects = new List<object>();
						for (int _i = 0; _i < _numberSubprocess; _i++)
						{
							LanguageIdentificationUtility _object = new LanguageIdentificationUtility();
							Return<object> _answerLoadDefaultModels = _object.LoadDefaultModels();
							if (_answerLoadDefaultModels.theresError)
							{
								_answer.theresError = true;
								_answer.error = _answerLoadDefaultModels.error;
							}
							else
								_objects.Add(_object);

							if (_answer.theresError)
								break;
						}

						if (!_answer.theresError)
						{
							Stopwatch _stopwatch = new Stopwatch();
							string _tiempo = string.Empty;
							_stopwatch.Start();

							using (Processor<InfoGrp_Class> _processor = new Processor<InfoGrp_Class>(_numberSubprocess, MILLISECONDS_PAUSE_LANGUAGE_IDENTIFICATION, _objects))
							{
								_processor.ErrorProcessEntity += processorSetLanguage_ErrorProcessEntity;
								_processor.Progress += processorSetLanguage_Progress;

								_answer = _numberSubprocess == 1 ? _processor.ProcessSynchronously(_infosNoLanguage, SetLanguage)
																	: _processor.Process(_infosNoLanguage, SetLanguage);
								_processor.ErrorProcessEntity -= processorSetLanguage_ErrorProcessEntity;
								_processor.Progress -= processorSetLanguage_Progress;
							}

							_stopwatch.Stop();
							_tiempo = string.Format("{0} Ticks", _stopwatch.Elapsed.Ticks);
						}
					}
				}
				catch (Exception _ex)
				{
					_answer.theresError = true;
					_answer.error = Utility.GetError(_ex, this.GetType());
				}
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:68,代码来源:GrpClassUtility.cs

示例15: CountBeginningOfSentence

        /// <summary>
        /// Performs a count of occurrences of a string into a beginning of a sentence
        /// </summary>
        /// <param name="countSubprocesses"></param>
        /// <param name="text">The sentences where to search into</param>
        /// <param name="strings">The strings to search</param>
        /// <returns>searched text, count of occurrences</returns>
        private Return<List<WritableTuple<string, int>>> CountBeginningOfSentence(int countSubprocesses, List<string> sentences, List<string> strings)
        {
            Return<List<WritableTuple<string, int>>> _answer = new Return<List<WritableTuple<string, int>>>() { data = new List<WritableTuple<string, int>>() };

            {
                try
                {
                    List<List<string>> _partitions = strings.PartitionAccordingSizeOfPartitions(SIZE_PARTITION_STRINGS);
                    List<CountWrapper> _wrappers = _partitions.Select(p => new CountWrapper()
                                                                                            {
                                                                                                sentences = sentences
                                                                                                ,
                                                                                                textToFind = p.Select(s => new WritableTuple<string, int>(s, 0)).ToList()
                                                                                            }
                                                                                ).ToList();

                    int _countSubprocesses = _wrappers.Count < countSubprocesses ? _wrappers.Count : countSubprocesses;

                    errorsMultithreadedProcess.Clear();
                    Return<object> _answerProcess = new Return<object>();
                    using (Processor<CountWrapper> _processor
                                = new Processor<CountWrapper>(_countSubprocesses, PAUSE_MILISECONDS_PROCESSOR))
                    {
                        _processor.ErrorProcessEntity += processorCountExistingStrings_ErrorProcessEntity;
                        _processor.Progress += processorCountExistingStrings_Progress;
                        _answerProcess = _countSubprocesses == 1 ? _processor.ProcessSynchronously(_wrappers, CountBeginningOfSentenceDirtyHands)
                                                                        : _processor.Process(_wrappers, CountBeginningOfSentenceDirtyHands);
                        _processor.Progress -= processorCountExistingStrings_Progress;
                        _processor.ErrorProcessEntity -= processorCountExistingStrings_ErrorProcessEntity;
                    }
                    if (_answerProcess.theresError)
                    {
                        _answer.theresError = true;
                        _answer.error = _answerProcess.error;
                    }
                    else
                        if (errorsMultithreadedProcess.Any())
                        {
                            _answer.theresError = true;
                            _answer.error = errorsMultithreadedProcess.First().Item2;
                        }
                        else
                        {
                            _answer.data = _wrappers.SelectMany(c => c.textToFind).ToList();
                        }
                }
                catch (Exception _ex)
                {
                    _answer.theresError = true;
                    _answer.error = Utility.GetError(_ex, this.GetType());
                }
            }
            return _answer;
        }
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:61,代码来源:LanguageIdentificationUtility.cs


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