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


C# System.Machine类代码示例

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


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

示例1: Main

        public static void Main(string[] args)
        {
            // Change the console window
            Terminal term = new Terminal();
            term.Title = "Terminal Window Title";
            term.DisplayMode = (int)ConsoleDisplayModeForSet.CONSOLE_FULLSCREEN_MODE;

            //Console.WriteLine("Terminal Title: {0}", term.Title);
            term.WriteLine("Terminal Window Title - has been set");
            COORD fontSize = term.FontSize;
            Console.WriteLine("Terminal Font Size: X = {0}, Y = {1}", fontSize.X, fontSize.Y);
            Console.WriteLine("mouse buttons: {0}", term.MouseButtons);

            // Instantiate a machine
            Machine aMachine = new Machine();

            // Print some properties
            Console.WriteLine("Name: {0}", aMachine.ShortName);
            Console.WriteLine("Domain: {0}", aMachine.DomainName);

            Environment environ = new Environment();
            Console.WriteLine("Command Line: {0}", environ.CommandLine);

            // Get the name of the process image that this process is running
            //Process aProc = new Process();
            //PrintProcess(aProc);
            //PrintAllProcesses();

            PrintAllDrives();
            //PrintVolumes();

            Console.ReadLine();
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:33,代码来源:Program.cs

示例2: Process__bubbles_processed_dive_before_saving_dive

        public void Process__bubbles_processed_dive_before_saving_dive()
        {
            var accessed = 0;

            var parserMock = new Mock<IImageParser>();
            var pixels = new[] { new Pixel(2, 3), new Pixel(3, 4), new Pixel(5, 4) };
            parserMock.Setup(d => d.ReadDocument()).Returns(pixels);

            var dives = new[] { new Dive(15, 50, 23, ""), new Dive(24, 20, 33, "") };
            var dr = new Mock<IDiveRepository>();
            dr.Setup(inp => inp.LoadDives()).Returns(dives);

            var sf = new Mock<ISampleFactory>();
            var processed = new[] { new ProcessedDive(dives[0]), new ProcessedDive(dives[0]) };
            sf.Setup(inp => inp.Create(It.IsAny<IEnumerable<Pixel>>(), dives[0])).Returns(processed[0]);
            sf.Setup(inp => inp.Create(It.IsAny<IEnumerable<Pixel>>(), dives[1])).Returns(processed[1]);

            Func<DlImageParsr.Model.Dive, IImageParser> facFunc = d => { return parserMock.Object; };

            var machine = new Machine(dr.Object, sf.Object, facFunc);
            machine.BeforeSavingDive += (dive) => accessed += dive.DiveLogId;
            machine.Process();

            accessed.Should().BeGreaterOrEqualTo(25);
        }
开发者ID:Krizzzn,项目名称:DLImageParsr,代码行数:25,代码来源:MachineTest.cs

示例3: RemotingHostServer

        public RemotingHostServer(Machine machine, int port, string name)
            : base(machine)
        {
            this.port = port;
            this.name = name;

            // TODO review this name, get machine name
            this.hostname = "localhost";

            // According to http://www.thinktecture.com/resourcearchive/net-remoting-faq/changes2003
            // in order to have ObjRef accessible from client code
            BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
            serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();

            IDictionary props = new Hashtable();
            props["port"] = port;

            TcpChannel channel = new TcpChannel(props, clientProv, serverProv);

            if (!registered)
            {
                ChannelServices.RegisterChannel(channel, false);
                registered = true;
            }

            // end of "according"

            // TODO review other options to publish an object
            this.objref = RemotingServices.Marshal(this, name);
        }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:32,代码来源:RemotingHostServer.cs

示例4: Apply

        public object Apply(Machine machine, ValueEnvironment environment, object[] arguments)
        {
            object name = arguments[0];

            object result = machine.Evaluate(name, environment);

            Type type = null;

            if (!(result is Type))
            {
                if (name is INamed || name is string)
                    type = Utilities.GetType(name);

                if (type == null)
                    throw new ArgumentException("New should receive a type name");
            }
            else
                type = (Type)result;

            object[] parameters = new object[arguments.Length - 1];

            for (int k = 1; k < arguments.Length; k++)
                parameters[k - 1] = machine.Evaluate(arguments[k], environment);

            return Activator.CreateInstance(type, parameters);
        }
开发者ID:ajlopez,项目名称:AjSharpure,代码行数:26,代码来源:NewPrimitive.cs

示例5: TestReport

        public void TestReport()
        {
            ArrayList line = new ArrayList();
            line.Add(new Machine("mixer", "left"));

            Machine extruder = new Machine("extruder", "center");
            extruder.Put("paste");
            line.Add(extruder);

            Machine oven = new Machine("oven", "right");
            oven.Put("chips");
            line.Add(oven);

            Robot robot = new Robot();
            robot.MoveTo(extruder);
            robot.Pick();

            StringWriter writer = new StringWriter();
            RobotReport.Report(writer, line, robot);

            String expected =
                "FACTORY REPORT\n" +
                "Machine mixer\nMachine extruder\n" +
                "Machine oven bin=chips\n\n" +
                "Robot location=extruder bin=paste\n" +
                "========\n";

            Assert.That(writer.ToString(), Is.EqualTo(expected));
        }
开发者ID:chrisross10,项目名称:Refactoring-Workbook,代码行数:29,代码来源:ReportTest.cs

示例6: SunxiHighSpeedTimer

        public SunxiHighSpeedTimer(Machine machine, long frequency)
        {
            irqEnableRegister = new DoubleWordRegister(this);
            irqStatusRegister = new DoubleWordRegister(this);
            
            timers = new SunxiHighSpeedTimerUnit[4];
            interruptFlags = new IFlagRegisterField[4];
            enableFlags = new IFlagRegisterField[4];

            for(var i = 0; i < 4; ++i)
            {
                var j = i;
                timers[i] = new SunxiHighSpeedTimerUnit(machine, frequency);
                timers[i].LimitReached += () => OnTimerLimitReached(j);
                interruptFlags[i] = irqStatusRegister.DefineFlagField(i, FieldMode.WriteOneToClear, name: "Tx_IRQ_PEND");
                enableFlags[i] = irqEnableRegister.DefineFlagField(i, name: "Tx_INT_EN");
            }

            var innerConnections = new Dictionary<int, IGPIO>();
            for(var i = 0; i < 4; ++i)
            {
                innerConnections[i] = new GPIO();
            }
            Connections = new ReadOnlyDictionary<int, IGPIO>(innerConnections);
        }
开发者ID:rte-se,项目名称:emul8,代码行数:25,代码来源:SunxiHighSpeedTimer.cs

示例7: DoIt

        public void DoIt()
        {
            var machine = new Machine(_stateFactory, _persister);

            machine.Configure(p => p
                 .Setup<StateA>(x => x.Reached5)
                 .Setup<StateA>(x => x.Reaced10)
                     .TransitionTo<StateB>()
                     .TransitionTo<StateC>());

            machine.Configure(p => p
                .Setup<StateB>(x => x.Reached15)
                .Setup<StateC>(x => x.Reached20)
                    .TransitionTo<StateD>());

            string descriptions = machine.GetDescriptions();

            var fooData = new FooData();
            fooData.Id = Guid.NewGuid();

            for (int i = 0; i < 50; i++)
            {
                machine.Process(fooData);
                App.Worker.Increase();
            }
        }
开发者ID:trulstveoy,项目名称:Sandbox,代码行数:26,代码来源:ConfigurationTest.cs

示例8: InterruptTest

		public void InterruptTest()
		{
    			var machine = new Machine ();
    			var efm32ggi2ccontroller = new EFM32GGI2CController (machine);
    			machine.SystemBus.Register(efm32ggi2ccontroller, new BusRangeRegistration(0x4000A000, 0x400));
    			efm32ggi2ccontroller.Reset ();

    			// Enable I2C controller
    			efm32ggi2ccontroller.WriteDoubleWord (0x0, 0x1);
    			// Enable all interrupts, bits 0-16
    			efm32ggi2ccontroller.WriteDoubleWord (0x34, 0x1FFFF);
    			// Clear all interrupts
    			efm32ggi2ccontroller.WriteDoubleWord (0x30, 0x1FFFF);
    			Assert.AreEqual (efm32ggi2ccontroller.ReadDoubleWord (0x28), 0x0);
    			// Set Start, ACK, NACK interrupt flags
    			uint interruptMask = 0x1 | 0x40 | 0x80;
    			efm32ggi2ccontroller.WriteDoubleWord (0x2C, interruptMask);
    			// Check the result on interrupt register
    			Assert.AreEqual (efm32ggi2ccontroller.ReadDoubleWord (0x28), interruptMask);
    			// Clear all interrupts
    			efm32ggi2ccontroller.WriteDoubleWord (0x30, 0x1FFFF);
    			Assert.AreEqual (efm32ggi2ccontroller.ReadDoubleWord (0x28), 0x0);
    			// Send start command and check that start interrupt is flagged
    			efm32ggi2ccontroller.WriteDoubleWord (0x4, 0x1);
    			Assert.AreEqual (efm32ggi2ccontroller.ReadDoubleWord (0x28) & 0x1, 0x1);
		}
开发者ID:rte-se,项目名称:emul8,代码行数:26,代码来源:EFM32GGI2CControllerTest.cs

示例9: EnumerableBehavior

        public EnumerableBehavior(IBehavior behavior, IBehavior superclass, Machine machine)
            : base(behavior, superclass, machine, typeof(IEnumerable))
        {
            string dosource = @"
            do: aBlock
            | enumerator |

            enumerator := self !GetEnumerator.

            [enumerator !MoveNext] whileTrue:
            [ aBlock value: enumerator !Current ]
            ";
            string selectsource = @"
            select: aBlock
            | enumerator list |

            enumerator := self !GetEnumerator.
            list := @System.Collections.ArrayList !new.

            [enumerator !MoveNext] whileTrue:
            [ | item |
              item := enumerator !Current.
            (aBlock value: item) ifTrue:  [ list add: item ]
            ].
            ^list
            ";

            Parser parser = new Parser(dosource);
            this.DefineInstanceMethod(parser.CompileInstanceMethod(this));
            parser = new Parser(selectsource);
            this.DefineInstanceMethod(parser.CompileInstanceMethod(this));
            this.DefineInstanceMethod(new FunctionalMethod("includes:", this, this.IncludesMethod));
        }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:33,代码来源:EnumerableBehavior.cs

示例10: CreateNotCurrentMachine

        public void CreateNotCurrentMachine()
        {
            Machine machine = new Machine(false);

            Assert.IsTrue(machine != Machine.Current);
            Assert.IsNotNull(machine.Environment);
        }
开发者ID:ajlopez,项目名称:AjSharp,代码行数:7,代码来源:MachineTests.cs

示例11: TegraTimer

 public TegraTimer(Machine machine)
 {
     IRQ = new GPIO();
     sync = new object();
     clockSource = machine.ObtainClockSource();
     Reset();
 }
开发者ID:rte-se,项目名称:emul8,代码行数:7,代码来源:TegraTimer.cs

示例12: NS16550

 public NS16550(Machine machine, bool wideRegisters = false)
 {
     this.machine = machine;
     mode32 = wideRegisters;
     IRQ = new GPIO();
     Reset();
 }
开发者ID:rte-se,项目名称:emul8,代码行数:7,代码来源:NS16550.cs

示例13: Evaluate

 protected override object Evaluate(string text, Machine machine)
 {
     Parser parser = new Parser(text);
     Block block = parser.CompileBlock();
     Process process = new Process(block, null, machine);
     return process.Execute();
 }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:7,代码来源:EvaluateProcessTests.cs

示例14: FT5336

 public FT5336(Machine machine, bool isRotated = false)
 {
     this.machine = machine;
     this.isRotated = isRotated;
     IRQ = new GPIO();
     Reset();
 }
开发者ID:rte-se,项目名称:emul8,代码行数:7,代码来源:FT5336.cs

示例15: CadenceUart

        public CadenceUart(Machine machine)
        {
            this.machine = machine;
		    buffer = new Queue<byte>();
		    Reset();
            IRQ = new GPIO();
        }
开发者ID:rte-se,项目名称:emul8,代码行数:7,代码来源:CadenceUart.cs


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