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


C# Processor类代码示例

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


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

示例1: ImageLoader

 static ImageLoader()
 {
     string baseDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "..");
     _cacheDir = Path.Combine (baseDir, "tmp/");
     _queue = new Processor<GetImageRequest>(Download);
     _requests = new Dictionary<GetImageRequest, Action<UpdateImage>>();
 }
开发者ID:follesoe,项目名称:FacebookBigProfile,代码行数:7,代码来源:ImageLoader.cs

示例2: CanDisplayHelp

 public void CanDisplayHelp()
 {
     const string text = "Supplies a value for tests.";
     var proc = new Processor(defaultArgument: "--test");
     proc.Handle("--test").Describe(text);
     Assert.That(proc.Help(), Is.StringContaining(text));
 }
开发者ID:sciolist,项目名称:adoption,代码行数:7,代码来源:WhenProcessing.cs

示例3: Main

        static void Main()
        {
            Components mcardVLC = new MotherBoard("VLC", (decimal)185.98);
            Components vcardRadeon = new GraphicsCard("Radeon", (decimal)102.34, "the best grafic card forever");
            Components vcardGeForce = new GraphicsCard("GeForce", (decimal)154.45, "is not worth");

            Components procIntel = new Processor("Intel", (decimal)346.563, "can be better");
            Components procAMD = new Processor("AMD", (decimal)405.239, "always the best");
            Components procMac = new Processor("IOS", 2000m, "It is okaaaay");

            Computer mac = new Computer("Mac", new List<Components>() { mcardVLC, vcardRadeon, vcardGeForce });
            Computer windows = new Computer("Windows");
            windows.Components.Add(procIntel);
            windows.Components.Add(procAMD);
            windows.Components.Add(procMac);
            //Console.WriteLine(windows);

            Computer linux = new Computer("Linux", new List<Components>() { mcardVLC, vcardGeForce, vcardRadeon, procAMD, procIntel, procMac });

            List<Computer> computers = new List<Computer>() { mac, windows, linux };

            computers.OrderBy(p => p.TotalPrice).ToList().ForEach(p => Console.WriteLine(p.ToString()));


            //or

            //computers.OrderBy(a => a.TotalPrice);

            //foreach (var computer in computers)
            //{
            //    Console.WriteLine(computer);
            //}
        }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:33,代码来源:Test.cs

示例4: SocketServer

 public SocketServer(FitSocket socket, Processor<Cell> service, ProgressReporter reporter, bool suiteSetUpIsAnonymous)
 {
     this.service = service;
     this.reporter = reporter;
     this.socket = socket;
     IMaybeProcessingSuiteSetup = suiteSetUpIsAnonymous;
 }
开发者ID:russelyang,项目名称:fitsharp,代码行数:7,代码来源:SocketServer.cs

示例5: OnStart

		protected override void OnStart(string[] args)
		{
			Core.Data.GainLogger.Write("Application started");

			_processor = new Processor();
			_processor.Start();
		}
开发者ID:evkap,项目名称:ExactTarget,代码行数:7,代码来源:ExactTargetWinService.cs

示例6: AddChangedFile

    public void AddChangedFile()
    {
        var fileName = Path.GetTempFileName();
        try
        {
            var expected = File.GetLastWriteTimeUtc(fileName);
            var loggerMock = new Mock<BuildLogger>();
            loggerMock.Setup(x => x.LogDebug(It.IsAny<string>()));

            var processor = new Processor
                            {
                                Logger = loggerMock.Object,
                                ConfigFiles = new List<string>
                                              {
                                                  fileName
                                              }
                            };
            processor.CheckForWeaversXmlChanged();
            File.SetLastWriteTimeUtc(fileName, DateTime.Now.AddHours(1));
            processor.CheckForWeaversXmlChanged();

            loggerMock.Verify();

            Assert.AreEqual(expected, Processor.TimeStamps.First().Value);
        }
        finally
        {
            File.Delete(fileName);
            Processor.TimeStamps.Clear();
        }
    }
开发者ID:GeertvanHorrik,项目名称:Fody,代码行数:31,代码来源:WeaversXmlHistoryTests.cs

示例7: Execute

 public void Execute(Processor processor, params string[] parameters)
 {
     if (parameters.Length > 0)
     {
         if (parameters[0].Equals("start", StringComparison.InvariantCultureIgnoreCase))
         {
             if (parameters.Length > 1)
             {
                 processor.StartBeacon(parameters[1]);
             }
             else
             {
                 processor.StartBeacon();
             }
         }
         else if (parameters[0].Equals("stop", StringComparison.InvariantCultureIgnoreCase))
         {
             processor.StopBeacon();
         }
     }
     else
     {
         Console.WriteLine("Parameters: start/stop [friendly name]");
     }
 }
开发者ID:redsoxfantom,项目名称:RemoteControl,代码行数:25,代码来源:BeaconCommand.cs

示例8: WeeklyProcessor

        // For viewing previous weeks processing
        public WeeklyProcessor(Processor ProcA, Processor ProcB)
        {
            FormType = 2;
            weeksProcessData = Global.Util.DeepClone<Processor>(ProcA);
            PreviousWeekProc = Global.Util.DeepClone<Processor>(ProcB);
            InitializeComponent();
            dataGridView_Previous.DataSource = PreviousWeekProc.Portfolio.Stocks;
            dataGridView_Current.DataSource = weeksProcessData.Portfolio.Stocks;

            dataGridView_Universe.AutoGenerateColumns = false;
            dataGridView_Universe.DataSource = weeksProcessData.Universe.TrendsUniverseContents;
            DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
            col.DataPropertyName = "Symbol";
            dataGridView_Universe.Columns.Add(col);

            textBox_StockPick.Text = weeksProcessData.StockPick;
            button_Finish.Text = "Return";

            foreach (Control ctrl in this.tableLayoutPanel1.Controls)
            {
                if (ctrl is Button)
                    ctrl.Enabled = false;
            }
            button_Finish.Enabled = true;
            RefreshLabels();
        }
开发者ID:erikprat61,项目名称:Stocks,代码行数:27,代码来源:WeeklyProcessor.cs

示例9: TThreadedServer

 public TThreadedServer(Processor processor, ServerTransport serverTransport)
     : this(processor, serverTransport,
          new TransportFactory(), new TransportFactory(),
          new BinaryProtocol.Factory(), new BinaryProtocol.Factory(),
          DEFAULT_MAX_THREADS, DefaultLogDelegate)
 {
 }
开发者ID:tritao,项目名称:flood,代码行数:7,代码来源:ThreadedServer.cs

示例10: FormatCollector

        public void FormatCollector(Dictionary<string, string> parameters, Dictionary<string, string> collectorDict, System.Xml.Linq.XElement collectorElement, Type collectorType, Processor processor)
        {
            CollectorHelpers.IsCollectorFormatterValid(collectorType, "NasuTek.Monitoring.Service.BuiltIn.Collectors.FileCollector");

            switch (collectorType.FullName)
            {
                case "NasuTek.Monitoring.Service.BuiltIn.Collectors.FileCollector":
                    {
                        string[] files = collectorDict["Files"].Split(',');
                        var dictRet = new Dictionary<string, Dictionary<string, string>>();

                        foreach (var file in files)
                        {
                            var xmlDoc = XDocument.Load(file);
                            foreach (var xmlRefVal in collectorElement.Elements("XmlRefToKeyValue"))
                            {
                                processor.AddDomain(xmlRefVal.Attribute("domain").Value, Path.GetFileName(file));

                                XElement ele = xmlDoc.XPathSelectElement(xmlRefVal.Attribute("name").Value);
                                if (ele != null)
                                    processor.GetDomain(xmlRefVal.Attribute("domain").Value, Path.GetFileName(file))[xmlRefVal.Attribute("domain_key").Value] = ele.Value;
                            }
                        }
                    }
                    break;
            }
        }
开发者ID:NasuTek,项目名称:NasuTek-Monitoring,代码行数:27,代码来源:XmlFormatter.cs

示例11: ProcessorMT

        public ProcessorMT(Processor processor, int cThreads)
        {
            this.processor = processor;

            //(1) setting up threads to compute the best splits
            this.cThreads = (cThreads > MAX_THREADS) ? MAX_THREADS : cThreads;
            this.cThreads = (this.cThreads > processor.cJobs) ? processor.cJobs : this.cThreads;

            this.processorThreadObjs = new ProcessorThreadObj[this.cThreads];
            this.processorThreads = new Thread[this.cThreads];

            this.StartEvents = new ManualResetEvent[this.cThreads];
            this.DoneEvents = new ManualResetEvent[this.cThreads];

            for (int i = 0; i < this.cThreads; i++)
            {
                ProcessorThread processorThread = processor.CreatePerThread();

                this.StartEvents[i] = new ManualResetEvent(false);
                this.DoneEvents[i] = new ManualResetEvent(true);

                ProcessorThreadObj processorThreadObj = new ProcessorThreadObj(StartEvents[i], DoneEvents[i], processorThread);
                this.processorThreadObjs[i] = processorThreadObj;

                ThreadStart threadStart = new ThreadStart(processorThreadObj.Process);
                Thread thread = new Thread(threadStart);
                this.processorThreads[i] = thread;

                thread.Start();
            }
        }
开发者ID:zbxzc35,项目名称:BoostTree,代码行数:31,代码来源:ProcessorMT.cs

示例12: RunProcessor

 private void RunProcessor(API.Request request, Processor processor, string processorName)
 {
     API.Response response = null;
     try
     {
         // Threadpooling
         response = processor.process(request);
     }
     catch (Exception e)
     {
         Logger.Error("Failed to process message with processor " + processor.GetType() + " : " + e.Message, e);
         try
         {
             Type responseType = Type.GetType("Gwupe.Cloud.Messaging.Response." + processorName + "Rs");
             response = (API.Response) responseType.GetConstructor(Type.EmptyTypes).Invoke(new object[] {});
             response.error = "UNKNOWN_ERROR";
             response.errorMessage = e.Message;
         }
         catch (Exception exception)
         {
             Logger.Error("Failed to determine return type for " + processorName);
             response = new ErrorRs
                 {
                     errorMessage = "Failed to determine return type for " + processorName,
                     error = "INTERNAL_SERVER_ERROR"
                 };
         }
     }
     finally
     {
         SendResponse(response, request);
     }
 }
开发者ID:gwupe,项目名称:Gwupe,代码行数:33,代码来源:WebSocketServer.cs

示例13: Transform

        public string Transform(string baseDir, string sourceXml, string releaseType, string version)
        {
            var sourceXsl = SchematronBuilder.CheckForNewerSchematron(baseDir, releaseType, version);

            // Create a Processor instance.
            var processor = new Processor();

            var result = new StringBuilder();

            var xmlDocumentBuilder = processor.NewDocumentBuilder();
            xmlDocumentBuilder.BaseUri = new Uri(baseDir);

            var xsltCompiler = processor.NewXsltCompiler();
            xsltCompiler.ErrorList = new ArrayList();
            var xmlToValidate = xmlDocumentBuilder.Build(new StringReader(sourceXml));
            var compiledXsl = xsltCompiler.Compile(new XmlTextReader(sourceXsl));
            var xmlValidator = compiledXsl.Load();

            // Set the root node of the source document to be the initial context node.
            xmlValidator.InitialContextNode = xmlToValidate;

            // BaseOutputUri is only necessary for xsl:result-document.
            xmlValidator.BaseOutputUri = new Uri(Path.Combine(baseDir, "output.xml"));

            var validationSerializer = new Serializer();

            using (var resultsWriter = new StringWriter(result))
            {
                validationSerializer.SetOutputWriter(resultsWriter);
                xmlValidator.Run(validationSerializer);
            }

            return result.ToString();
        }
开发者ID:eddleston,项目名称:DDEX-Validator,代码行数:34,代码来源:DdexValidator.cs

示例14: ToProcessors

        public void ToProcessors()
        {
            string xElementProcessors =
                "<processors>" + "\r\n  " +
                "<processor ID=\"0\" Name=\"ATMega128\">" + "\r\n    " +
                "<eepromSize>0x1000</eepromSize>" + "\r\n    " +
                "<flashSize>0x20000</flashSize>" + "\r\n    " +
                "<bootStartAddress>0x1E000</bootStartAddress>" + "\r\n    " +
                "<bootEndAddress>0x1FFFF</bootEndAddress>" + "\r\n  " +
                "</processor>" + "\r\n  " +
                "<processor ID=\"1\" Name=\"ATMega2560\">" + "\r\n    " +
                "<eepromSize>0x1000</eepromSize>" + "\r\n    " +
                "<flashSize>0x40000</flashSize>" + "\r\n    " +
                "<bootStartAddress>0x3E000</bootStartAddress>" + "\r\n    " +
                "<bootEndAddress>0x3FFFF</bootEndAddress>" + "\r\n  " +
                "</processor>" + "\r\n" +
                "</processors>";

            XElement xElement = XElement.Parse(xElementProcessors);
            var processors = xElement.ToProcessors(XNamespace.None).ToList();

            Assert.AreEqual(2, processors.Count);

            Processor expectedProcessor1 = new Processor(0, "ATMega128",
                0x1000, 0x20000, 0x1E000, 0x1FFFF);
            Processor expectedProcessor2 = new Processor(1, "ATMega2560",
                0x1000, 0x40000, 0x3E000, 0x3FFFF);

            Assert.IsTrue(expectedProcessor1.Equals(processors[0]));
            Assert.IsTrue(expectedProcessor2.Equals(processors[1]));
        }
开发者ID:KiselevKN,项目名称:BootMega,代码行数:31,代码来源:ProcessorExtensionsTests.cs

示例15: ExecuteReport

        public void ExecuteReport(Dictionary<string, string> parameters, Processor processor)
        {
            foreach (var domain in processor.GetAllDomains())
            {
                Console.WriteLine("Domain: " + domain.Key);

                if (domain.Value.ContainsKey("Global"))
                {
                    foreach (var value in domain.Value["Global"])
                    {
                        Console.WriteLine("\tKey: " + value.Key);
                        Console.WriteLine("\t\tValue: " + value.Value);
                    }
                }

                foreach (var subdomain in domain.Value.Where(v => v.Key != "Global"))
                {
                    Console.WriteLine("\tSubdomain: " + subdomain.Key);
                    foreach (var value in subdomain.Value)
                    {
                        Console.WriteLine("\t\tKey: " + value.Key);
                        Console.WriteLine("\t\t\tValue: " + value.Value);
                    }
                }
            }
        }
开发者ID:NasuTek,项目名称:NasuTek-Monitoring,代码行数:26,代码来源:ConsoleReporter.cs


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