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

C# IInstruction类代码示例

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

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



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

示例1: Parse_All

		public void Parse_All()
		{
			var reader = ConsolePlatformTester.LoadInput("input.simple.txt");
			var actual = Instruction.Read(reader).ToArray();

			var expected = new IInstruction[]
			{
				// Settings
				new HandsPerLevelInstruction(10),
				new StartingStackInstruction(2000),
				new YourBotInstruction(PlayerName.player1),
				new TimeBankInstruction(TimeSpan.FromSeconds(10)),
				new TimePerMoveInstruction(TimeSpan.FromMilliseconds(500)),
				// Match
				new RoundInstruction(1),
				new SmallBlindInstruction(10),
				new BigBlindInstruction(20),
				// Player
				new OnButtonInstruction(PlayerName.player2),
				new StackInstruction(PlayerName.player1, 2000),
				new StackInstruction(PlayerName.player2, 2000),
				new PostInstruction(PlayerName.player2, 10),
				new PostInstruction(PlayerName.player1, 20),
				new HandInstruction(PlayerName.player1, Cards.Parse("[9c,7h]")),
				new ActionInstruction(PlayerName.player2, GameAction.Call),
			};

			CollectionAssert.AreEqual(expected, actual.Take(expected.Length).ToArray());
			Assert.AreEqual(0, actual.Length);
		}
开发者ID:Corniel,项目名称:AIGames.TexasHoldEm.ACDC,代码行数:30,代码来源:InstructionTest.cs


示例2: ResolveLables

 public void ResolveLables(IInstruction[] instructions)
 {
     if (IsResolved) return;
     int pos = 0;
     for(int i = 0; i < instructions.Length; i++)
     {
         if(this.labels.AsEnumerable().Any(x => x == instructions[i].Label))
         {
             if (this.additional.Length == 1)
             {
                 this.additional[0] = (ushort) pos;
                 this.IsResolved = true;
             } else if(this.additional.Length== 2)
             {
                 if (this.labels.First() == instructions[i].Label)
                 {
                     this.additional[0] = (ushort)pos;
                     this.labels[0] = string.Empty;
                 }
                 if(this.labels[1] == instructions[i].Label)
                 {
                     this.additional[1] = (ushort) pos;
                     this.labels[1] = string.Empty;
                 }
                 this.IsResolved = this.labels.All(s => s == string.Empty);
             }
         }
         pos += instructions[i].Size;
     }
 }
开发者ID:FredrikL,项目名称:DCPU16,代码行数:30,代码来源:Instruction.cs


示例3: InstructionWidget

        public InstructionWidget( IInstruction op )
        {
            InitializeComponent();
            this.Font    = new Font("Lucida Console", 8.25f);
            m_ItalicFont = new Font(this.Font, FontStyle.Italic);

            this.Height = 15;
            this.Executed = true;
            m_Op = op;
            Selected = false;

            if (op is Scrutinizer.ISamplingInstruction)
            {
                Panel panel = new Panel();
                m_FilterBox = CreateFilterBox(op);
                m_FormatBox = CreateFormatBox(op);
                panel.Anchor = AnchorStyles.Right;
                panel.Width = m_FilterBox.Width + m_FormatBox.Width;
                m_FilterBox.Left = m_FormatBox.Width;
                panel.Controls.Add(m_FilterBox);
                panel.Controls.Add(m_FormatBox);
                this.Controls.Add(panel);
            }
            else if (op is Scrutinizer.ITextureInstruction)
            {
                m_FormatBox = CreateFormatBox(op);
                m_FormatBox.Anchor = AnchorStyles.Right;
                this.Controls.Add(m_FormatBox);
            }
        }
开发者ID:bobvodka,项目名称:Pyramid,代码行数:30,代码来源:InstructionWidget.cs


示例4: Execute

 public void Execute(IInstruction instruction)
 {
     var jtype = instruction as JTypeInstruction;
     if (jtype != null)
         JTypeExecutors[jtype.JumpType](jtype);
     else
     {
         var itype = instruction as ITypeInstruction;
         if (itype != null)
         {
             var cl = ITypeExecutors[itype.Opcode];
             cl(itype);
         }
         else
         {
             var rtype = instruction as RTypeInstruction;
             if (rtype != null)
                 RTypeExecutors[rtype.Function](rtype);
             else
             {
                 var coins = instruction as CoProcessorInstruction;
                 if (coins != null)
                     CoProcessorExecutors[coins.Format](coins);
             }
         }
     }
 }
开发者ID:bngreen,项目名称:Plasma-Emulator,代码行数:27,代码来源:InstructionExecutor.cs


示例5: InstructionWidget

        public InstructionWidget( IInstruction op )
        {
            InitializeComponent();
            this.Font   = new Font("Lucida Console", 8.25f);
            this.Height = 15;
            m_Op = op;
            this.Brush = Brushes.Black;

            if (op is Scrutinizer.ITexelLoadInstruction)
            {
                ComboBox cb = CreateFormatBox(op);
                cb.Anchor = AnchorStyles.Right;
                this.Controls.Add(cb);
            }
            if (op is Scrutinizer.ISamplingInstruction)
            {
                Panel panel = new Panel();
                ComboBox cbFilter = CreateFilterBox(op);
                ComboBox cbFormat = CreateFormatBox(op);
                panel.Anchor = AnchorStyles.Right;
                panel.Width = cbFilter.Width + cbFormat.Width;
                cbFilter.Left = cbFormat.Width;
                panel.Controls.Add(cbFilter);
                panel.Controls.Add(cbFormat);
                this.Controls.Add(panel);
            }
        }
开发者ID:Samana,项目名称:Pyramid,代码行数:27,代码来源:InstructionWidget.cs


示例6: GenerateFromInstruction

 private static string GenerateFromInstruction(IInstruction instruction)
 {
     var bytes = instruction.GetReportData();
     var sb = new StringBuilder();
     sb.Append("WR ");
     AppendBytesAsString(bytes, sb);
     return sb.ToString();
 }
开发者ID:TransistorLabs,项目名称:GlowBeanGlow,代码行数:8,代码来源:HidCodeGenerator.cs


示例7: ResolveSymbolicInstructions

        public IEnumerable<IInstruction> ResolveSymbolicInstructions(IInstruction[] instructions)
        {
            // must go through labels first, removing them when they've been added to the symbol table
            var linesWithLabelsRemoved = _hackLabelResolver.ResolveLabels(_symbolTable, instructions).ToArray();

            // then go through variables, resolving them after adding to table if not already there
            return _hackVariableResolver.ResolveVariables(_symbolTable, linesWithLabelsRemoved).ToArray();
        }
开发者ID:pavlosmcg,项目名称:furry-octo-computing-machine,代码行数:8,代码来源:HackSymbolResolver.cs


示例8: Apply

		public bool Apply(IInstruction instruction)
		{
			if (Mapping.ContainsKey(instruction.GetType()))
			{
				Mapping[instruction.GetType()].Invoke(instruction, this);
				return true;
			}
			return false;
		}
开发者ID:Corniel,项目名称:AIGames.BlockBattle.Kubisme,代码行数:9,代码来源:GameState.cs


示例9: BreakpointViewModel

        public BreakpointViewModel(IGameBoy gameboy, IInstruction inst)
        {
            _gameboy = gameboy;
              _instruction = inst;

              OriginalAddress = inst.Address;
              Address = "0x" + inst.Address.ToString("x2");
              Name = inst.Name;
        }
开发者ID:cristiandonosoc,项目名称:GBSharp,代码行数:9,代码来源:BreakpointViewModel.cs


示例10: PortfolioCompareSetting

        /// <summary>
        /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.PortfolioComparer.PortfolioCompareSetting">PortfolioCompareSetting</see> class.
        /// </summary>
        /// <param name="compareAction">
        /// When this argument equals 'CloseOrders' it is checked whether positions exist that do not exist in the modelportfolio. 
        /// When this is the case this will result in only sell close size based orders.
        /// When the argument equals 'Rebalance' a normal rebalance is done.
        /// However the method will generate an error when positions do exist that do not exist in the modelportfolio.
        /// When the argument equals 'CashFundOrders' the remaining cash will be transferred to cash fund.
        /// </param>
        /// <param name="instruction">The instruction that generated the orders</param>
        /// <param name="engineParams">The parameters used in porfolio compare action</param>
        public PortfolioCompareSetting(PortfolioCompareAction compareAction, IInstruction instruction, InstructionEngineParameters engineParams)
        {
            if (instruction == null)
                throw new ApplicationException("The instruction is mandatory");

            this.CompareAction = compareAction;
            this.Instruction = instruction;
            this.EngineParams = engineParams;
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:21,代码来源:PortfolioCompareSetting.cs


示例11: Instruction

 public Instruction(IInstruction src)
 {
     Operation = src.Operation;
     Modifier = src.Modifier;
     ModeA = src.ModeA;
     ValueA = src.ValueA;
     ModeB = src.ModeB;
     ValueB = src.ValueB;
 }
开发者ID:pavelsavara,项目名称:nMars,代码行数:9,代码来源:Instruction.cs


示例12: CancelInstruction

        /// <summary>
        /// This method tries to cancel the instruction (if allowed).
        /// </summary>
        /// <param name="instruction">The <see cref="T:B4F.TotalGiro.Accounts.Instructions.Instruction">Instruction</see> to process</param>
        /// <param name="cancelOrders">The cancelled orders that might result from the processing</param>
        /// <returns>true when succesfull</returns>
        public bool CancelInstruction(IInstruction instruction)
        {
            int oldStatus = instruction.Status;
            string oldMessage = instruction.Message;
            int nextStatus;

            nextStatus = stateMachine.SetStatus(getStateTable(instruction.InstructionType), (int)oldStatus, (int)InstructionEvents.evCancel, (IStateMachineClient)instruction);
            if (nextStatus != 0)
                instruction.Status = nextStatus;
            return (instruction.Status != oldStatus || instruction.Message != oldMessage);
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:17,代码来源:InstructionEngine.cs


示例13: Given

        public override void Given()
        {
            this.StubbedRover = stub_a<IRover>();
            this.StubbedPlateau = stub_a<IPlateau>();
            this.StubbedInstruction = stub_a<IInstruction>();
            this.StubbedPositionChecks = stub_a<List<IPositionCheck>>();

            this.PlateauController = new PlateauController(this.StubbedPlateau);
            this.PlateauController.PositionChecks = this.StubbedPositionChecks;
            this.StubbedRover.Instruction = this.StubbedInstruction;
        }
开发者ID:blair55,项目名称:MarsRover,代码行数:11,代码来源:ObjectTests.cs


示例14: LogInstruction

 private void LogInstruction(IInstruction instruction, byte opCode)
 {
     var instructionSize = instruction.Variants[opCode].InstructionSize();
     var instructionBytes = mem.SequenceFrom(state.Pc).Take(instructionSize).ToArray();
     Console.WriteLine("{0:X2}  {1,-10}{2,-32}A:{3:X2} X:{4:X2} Y:{5:X2} P:{6:X2} SP:{7:X2}", // TODO: Cycle and scanline goes at the end
         state.Pc,
         string.Join(" ", instructionBytes.Select(x => x.ToString("X2"))),
         instruction.Disassemble(instructionBytes),
         state.A,
         state.X,
         state.Y,
         state.StatusRegister,
         state.Sp);
 }
开发者ID:Cyberlane,项目名称:LeetNES,代码行数:14,代码来源:Cpu.cs


示例15: Program

        /// <summary>
        /// Creates a new Program
        /// </summary>
        /// <param name="processor">the processor for this program</param>
        /// <param name="instructions">the program instructions</param>
        /// <param name="debugInfo">optional program debug information</param>
        public Program(Processor processor, IList<IInstruction> instructions,
                        ProgramDebugInfo debugInfo = null)
        {
            this.DebugInfo = debugInfo;
            this.Processor = processor;

            // Check instructions size
            if (instructions.Count > processor.RomSize)
            {
                throw new ArgumentException("Number of instructions > size of instruction ROM");
            }

            // Create new readonly instructions array
            IInstruction[] instructionArray = new IInstruction[processor.RomSize];
            instructions.CopyTo(instructionArray, 0);
            this.Instructions = new ReadOnlyCollection<IInstruction>(instructionArray);
        }
开发者ID:jcowgill,项目名称:PicoBlazeSim,代码行数:23,代码来源:Program.cs


示例16: ResolveLables

 public void ResolveLables(IInstruction[] instructions)
 {
     //    if (IsResolved) return;
     //    int pos = 0;
     //    for (int i = 0; i < instructions.Length; i++)
     //    {
     //        if (this.labels.AsEnumerable().Any(x => x == instructions[i].Label))
     //        {
     //            if (this.additional.Length == 1)
     //            {
     //                this.additional[0] = (ushort)pos;
     //                this.IsResolved = true;
     //            }
     //        }
     //        pos += instructions[i].Size;
     //    }
 }
开发者ID:FredrikL,项目名称:DCPU16,代码行数:17,代码来源:RawData.cs


示例17: disassemble

        public UInt32 disassemble(ulong offset, out IInstruction instr, ref DISASM_INOUT_PARAMS param)
        {
            byte[] bt = assembly.ReadBytes(offset, 10);
            dsm = new TUP.AsmResolver.ASM.x86Disassembler(bt);
            dsm.CurrentOffset = 0;
            Instr instr1 = new Instr();
            instr1.Addr = offset;
            instr1.ins = dsm.DisassembleNextInstruction();
            instr1.bytes = assembly.ReadBytes(offset, instr1.ins.Size);

            if (instr1.bytes[0] == 0xFF)
                if (instr1.bytes[1] == 0x15)
                    if (instr1.ins.Operand1 != null)
                        instr1.disp.value.d64 = ((Offset)instr1.ins.Operand1.Value).Va;//Call ExitProcess probably

            instr = instr1;
            return (UInt32)instr1.ins.Size;
        }
开发者ID:Rex-Hays,项目名称:GNIDA2,代码行数:18,代码来源:DasmerTUP.cs


示例18: CreateFilterBox

        private ComboBox CreateFilterBox( IInstruction op )
        {
            ComboBox cb = new ComboBox();
            foreach (string s in Enum.GetNames(typeof(Scrutinizer.TextureFilter)))
                cb.Items.Add(s);
            cb.Width = 96;
            cb.SelectedIndex = (int)Scrutinizer.TextureFilter.TRILINEAR;
            cb.DropDownStyle = ComboBoxStyle.DropDownList;
            cb.SelectedIndexChanged += delegate(object s, EventArgs e)
            {
                if (op is ISamplingInstruction)
                {
                    ISamplingInstruction samp = op as ISamplingInstruction;
                    samp.Filter = (TextureFilter)cb.SelectedIndex;
                }
            };

            return cb;
        }
开发者ID:Samana,项目名称:Pyramid,代码行数:19,代码来源:InstructionWidget.cs


示例19: Add

        /// <summary>
        /// Adds a new instruction to the program
        /// </summary>
        /// <param name="instruction">instruction to add</param>
        /// <param name="line">optional line number for this instruction</param>
        /// <remarks>
        /// <para>The instruction is inserted at <see cref="Address"/> and <see cref="Address"/> is
        /// then incremented.</para>
        /// <para>You are not allowed to "rewrite" instructions by decrementing Address and then
        /// adding another instruction</para>
        /// </remarks>
        /// <exception cref="ImportException">
        /// If you attempt to "rewrite" an instruction
        /// </exception>
        public void Add(IInstruction instruction, int? line = null)
        {
            // Ensure store is large enough
            if (Address >= store.Count)
            {
                store.AddRange(Enumerable.Repeat<IInstruction>(null, Address - store.Count + 1));
            }
            else if (store[Address] != null)
            {
                throw new ImportException("You cannot insert 2 instructions at the same address");
            }

            // Store line number
            if (line.HasValue)
                lineNumbers[Address] = line.Value;

            // Insert instruction
            store[Address] = instruction;
            Address++;
        }
开发者ID:jcowgill,项目名称:PicoBlazeSim,代码行数:34,代码来源:ProgramBuilder.cs


示例20: InstructionViewModel

        public InstructionViewModel(ICPU cpu, IInstruction instruction)
        {
            _cpu = cpu;

              _instruction = instruction;
              originalAddress = instruction.Address;
              Address = "0x" + instruction.Address.ToString("x2");
              Opcode = "0x" + instruction.OpCode.ToString("x2");
              Name = instruction.Name;
              Literal = "0x" + instruction.Literal.ToString("x2");
              Description = instruction.Description;

              if (!instruction.CB)
              {
            Ticks = CPUSpace.Dictionaries.CPUInstructionClocks.Get((byte)instruction.OpCode);
              }
              else
              {
            Ticks = CPUSpace.Dictionaries.CPUCBInstructionClocks.Get((byte)instruction.OpCode);
              }
        }
开发者ID:cristiandonosoc,项目名称:GBSharp,代码行数:21,代码来源:InstructionViewModel.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IInstructionDecoder类代码示例发布时间:2022-05-24
下一篇:
C# IInputStream类代码示例发布时间: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