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


C# Memory类代码示例

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


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

示例1: Main

        public static void Main(string[] args)
        {
            if (args == null || args.Length < 1 || string.IsNullOrWhiteSpace (args [0])) {
                Console.WriteLine ("First argument should be path to NES rom.");
                return;
            }

            var fileInfo = new System.IO.FileInfo (args [0]);
            if (!fileInfo.Exists) {
                Console.WriteLine ("File does not exist: {0}", fileInfo.FullName);
                return;
            }

            var rom = NesRom.Parse (fileInfo);
            var memory = new Memory (0x10000);
            var cpu = new CPU (memory);

            var nesEmulation = new NES (cpu, memory);

            nesEmulation.LoadRom (rom);
            nesEmulation.Reset ();

            nesEmulation.BeginEmulation ();

            Console.WriteLine ("Press any key to whatever.");
            Console.ReadKey ();

            nesEmulation.EndEmulation ();
        }
开发者ID:NickVanderPyle,项目名称:NesEmu,代码行数:29,代码来源:Program.cs

示例2: RunConsciousRoutine

        protected override RoutineResult RunConsciousRoutine()
        {
            using (var memory = new Memory())
            {
                var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
                face.Talk(memory, "NO!", "", 2000);
                face.Talk(memory, "Don't touch", " my disk!", 4000);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Fade(memory, ' ', 10);
                face.Talk(memory, "", "", 3000);
                face.Talk(memory, "Whoa.", "", 3000);
                face.Talk(memory, "What a bad dream.", "");
                Interaction i = face.YesNo(memory, "Was I sleep-talking?");
                if (i.playerAnswer == Interaction.Answer.Yes)
                {
                    face.Talk(memory, "Freaky", "");
                    face.Talk(memory, "Hope I didn't", " scare you.");
                }
                else if (i.playerAnswer == Interaction.Answer.No)
                {
                    face.Talk(memory, "Well, that's good");
                    face.Talk(memory, "It was real bad.");
                    face.Talk(memory, "Some seriously", " 8-bit stuff.");
                }
                else
                {
                    face.Talk(memory, "Maybe I'm still", " dreaming...", 8000);
                }

                return MakeRoutineResult(memory, i);
            }
        }
开发者ID:vfridell,项目名称:RoguePoleDisplay,代码行数:35,代码来源:BadDream.cs

示例3: ParseCommandLine

 private void ParseCommandLine(IList<string> commandLineArguments, Memory memory)
 {
     messenger = Messenger.Make(int.Parse(commandLineArguments[commandLineArguments.Count - 1]), memory);
     if (commandLineArguments.Count > 1) {
         assemblyPaths = commandLineArguments[0];
     }
 }
开发者ID:jediwhale,项目名称:fitsharp,代码行数:7,代码来源:Runner.cs

示例4: Button

            /**
             * The button constructor
             */
            public Button()
            {
                //Initializing the button controll
                mButton = new System.Windows.Controls.Button();

                //Set the view of the current widget as the previously instantiated button controll
                View = mButton;

                mButton.HorizontalAlignment = HorizontalAlignment.Left;
                mButton.VerticalAlignment = VerticalAlignment.Top;

                this.Width = MoSync.Constants.MAW_CONSTANT_WRAP_CONTENT;
                this.Height = MoSync.Constants.MAW_CONSTANT_WRAP_CONTENT;

                //The click handle the button component
                mButton.Click += new RoutedEventHandler(
                    delegate(Object from, RoutedEventArgs evt)
                    {
                        //Click event needs a memory chunk of 8 bytes
                        Memory eventData = new Memory(8);
                        const int MAWidgetEventData_eventType = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_CLICKED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
                        //Posting a CustomEvent
                        mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });
            }
开发者ID:kopsha,项目名称:MoSync,代码行数:31,代码来源:MoSyncButton.cs

示例5: CPU

 //Method:       Constructor
 //Purpose:      Sets CPU up for use.
 //Variables:    toMemory - Memory object that Computer setup.
 //              toRegisters - Registers object that Computer setup.
 //              programCounter - uint signifying where to start fetch at.
 public CPU(Memory toMemory, Registers toRegisters, uint programCounter)
 {
     disassembling = false;
     myMemory = toMemory;
     myRegisters = toRegisters;
     myRegisters.WriteWord(15, programCounter);
 }
开发者ID:wiglz4,项目名称:ARMsim,代码行数:12,代码来源:CPU.cs

示例6: TimePicker

            public TimePicker()
            {
                mTimePicker = new Microsoft.Phone.Controls.TimePicker();

                CurrentHour = 0;
                CurrentMinute = 0;

                View = mTimePicker;

                mTimePicker.ValueChanged += new EventHandler<Microsoft.Phone.Controls.DateTimeValueChangedEventArgs>(
                    delegate(object sender, Microsoft.Phone.Controls.DateTimeValueChangedEventArgs args)
                    {
                        Memory eventData = new Memory(16);

                        const int MAWidgetEventData_eventType = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventDate_value_hours = 8;
                        const int MAWidgetEventDate_value_minutes = 12;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_TIME_PICKER_VALUE_CHANGED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
                        eventData.WriteInt32(MAWidgetEventDate_value_hours, mTimePicker.Value.Value.Hour);
                        eventData.WriteInt32(MAWidgetEventDate_value_minutes, mTimePicker.Value.Value.Minute);

                        mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });
            }
开发者ID:kopsha,项目名称:MoSync,代码行数:26,代码来源:MoSyncTimePicker.cs

示例7: Processor

        public Processor()
        {
            InitConfig();

            @Memory=new Memory(Config);
            Ind=new IndReg(Config);
            Ip=new IP(Config);
            Alu=new ALU(Config);
            Ron = new RON(Config);

            Memory.InitialiseMemory();

            Commands.Add(0, new Command {OpCode = 0, I = 0, P = 0, Op = 0});
            Commands.Add(17, new Command {OpCode = 17, I = 0, P = 1, Op = 1});
            Commands.Add(21, new Command {OpCode = 21, I = 1, P = 1, Op = 1});
            Commands.Add(2, new Command {OpCode = 2, I = 1, P = 2, Op = 0});
            Commands.Add(33, new Command {OpCode = 33, I = 0, P = 1, Op = 2});
            Commands.Add(37, new Command {OpCode = 37, I = 1, P = 1, Op = 2});
            Commands.Add(49, new Command {OpCode = 49, I = 0, P = 1, Op = 3});
            Commands.Add(254, new Branch() {OpCode = 254, I = 0, P = 4, Op = 15});
            Commands.Add(240, new BranchZero {OpCode = 240, I = 0, P = 4, Op = 15});
            Commands.Add(241, new BranchNotZero {OpCode = 241, I = 0, P = 4, Op = 15});
            Commands.Add(255, new Command {OpCode = 255, I = 0, P = 4, Op = 15});

            Parts.Add(Memory);
            Parts.Add(Ip);
            Parts.Add(Ind);
            Parts.Add(Alu);
            Parts.Add(Ron);
        }
开发者ID:frizzlywitch,项目名称:OS,代码行数:30,代码来源:Processor.cs

示例8: DatePicker

            public DatePicker()
            {
                mDatePicker = new Microsoft.Phone.Controls.DatePicker();
                mView = mDatePicker;

                mMaxDate = DateTime.MaxValue;
                mMinDate = DateTime.MinValue;

                mDatePicker.ValueChanged += new EventHandler<DateTimeValueChangedEventArgs>(
                    delegate(object from, DateTimeValueChangedEventArgs args)
                    {
                        Memory eventData = new Memory(20);

                        const int MAWidgetEventData_eventType = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventDate_value_dayOfMonth = 8;
                        const int MAWidgetEventDate_value_month = 12;
                        const int MAWidgetEventDate_value_year = 16;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_DATE_PICKER_VALUE_CHANGED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
                        eventData.WriteInt32(MAWidgetEventDate_value_dayOfMonth, mDatePicker.Value.Value.Day);
                        eventData.WriteInt32(MAWidgetEventDate_value_month, mDatePicker.Value.Value.Month);
                        eventData.WriteInt32(MAWidgetEventDate_value_year, mDatePicker.Value.Value.Year);

                        mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });
            }
开发者ID:paulobsousa,项目名称:MoSync,代码行数:27,代码来源:MoSyncDatePicker.cs

示例9: SetUpSUT

        void SetUpSUT(string memberName) {
            this.memberName = memberName;
            testStatus = new TestStatus();
            processor = new Mock<CellProcessor>();
            execute = new ExecuteDefault { Processor = processor.Object};
            check = new CheckDefault {Processor = processor.Object};
            memory = new TypeDictionary();

            target = new TypedValue("target");
            result = new TypedValue("result");

            targetCell = new CellTreeLeaf("stuff");

            processor
                .Setup(p => p.Parse(typeof (MemberName), It.IsAny<TypedValue>(), It.Is<CellTreeLeaf>(c => c.Text == memberName)))
                .Returns(new TypedValue(new MemberName(memberName)));
            processor
                .Setup(p => p.Invoke(target, It.Is<MemberName>(m => m.Name == "member"), It.Is<Tree<Cell>>(c => c.Branches.Count == 0)))
                .Returns(result);
            processor
                .Setup(p => p.Invoke(It.Is<TypedValue>(v => v.ValueString == "target"), It.Is<MemberName>(m => m.Name == "procedure"), It.IsAny<Tree<Cell>>()))
                .Returns((TypedValue t, MemberName m, Tree<Cell> c) => {
                    testStatus.Counts.AddCount(TestStatus.Right);
                    testStatus.LastAction = "blah blah";
                    return result;
                });
            processor.Setup(p => p.Compare(It.IsAny<TypedValue>(), It.IsAny<Tree<Cell>>())).Returns(true);
            processor.Setup(p => p.TestStatus).Returns(testStatus);
            processor.Setup(p => p.Memory).Returns(memory);
        }
开发者ID:ChrisBDFA,项目名称:fitsharp,代码行数:30,代码来源:CellOperationDefaultTest.cs

示例10: TryWrite

        public unsafe void TryWrite(Memory<byte> data)
        {
            // This can work with Span<byte> because it's synchronous but we need pinning support
            EnsureNotDisposed();

            void* pointer;
            if (!data.TryGetPointer(out pointer))
            {
                throw new InvalidOperationException("Pointer not available");
            }

            IntPtr ptrData = (IntPtr)pointer;
            var length = data.Length;

            if (IsUnix)
            {
                var buffer = new UVBuffer.Unix(ptrData, (uint)length);
                UVException.ThrowIfError(UVInterop.uv_try_write(Handle, &buffer, 1));
            }
            else
            {
                var buffer = new UVBuffer.Windows(ptrData, (uint)length);
                UVException.ThrowIfError(UVInterop.uv_try_write(Handle, &buffer, 1));
            }
        }
开发者ID:AlexGhiondea,项目名称:corefxlab,代码行数:25,代码来源:Stream.cs

示例11: DatePicker

            public DatePicker()
            {
                // Initialization.
                mDatePicker = new Microsoft.Phone.Controls.DatePicker();
                mView = mDatePicker;
                mUriString = new DatePickerPageCustomUriString();

                mMaxDate = new DateTime(_maxYear, 12, 31);
                mMinDate = new DateTime(_minYear, 1, 1);

                mUriString.MaxDate = mMaxDate;
                mUriString.MinDate = mMinDate;

                mDatePicker.PickerPageUri = new Uri(mUriString.UriString, UriKind.Relative);

                // The ValueChanged event handler. This is when the MoSync event is triggered.
                mDatePicker.ValueChanged += new EventHandler<DateTimeValueChangedEventArgs>(
                    delegate(object from, DateTimeValueChangedEventArgs args)
                    {
                        Memory eventData = new Memory(20);

                        const int MAWidgetEventData_eventType = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventDate_value_dayOfMonth = 8;
                        const int MAWidgetEventDate_value_month = 12;
                        const int MAWidgetEventDate_value_year = 16;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_DATE_PICKER_VALUE_CHANGED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
                        eventData.WriteInt32(MAWidgetEventDate_value_dayOfMonth, mDatePicker.Value.Value.Day);
                        eventData.WriteInt32(MAWidgetEventDate_value_month, mDatePicker.Value.Value.Month);
                        eventData.WriteInt32(MAWidgetEventDate_value_year, mDatePicker.Value.Value.Year);

                        mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });
            }
开发者ID:ronald132,项目名称:MoSync,代码行数:35,代码来源:MoSyncDatePicker.cs

示例12: vm

        public vm()
        {
            //Initialize devices;
            cpu = new CPU(this); // Initializes the cpu
            ram = new Memory(PAGE_DIRECTORY_SIZE * Frame.FRAME_SIZE); //Allocates enough ram to fit number of page tables allowed
            hdi = new HDI("disk0"); //Maps a folder to the hard disk interface
            disk0 = new VirtualDataDisk("vhd.nvmd"); // Virtual data disk

            devices = new VMDevice[] {
                cpu, // Processer, device 0
                ram, // RAM, device 1
                hdi, // Hard drive Interface, device 3
                disk0, // Virtual Data Disk, device 4
            };

            callstack = new CallStack(this,ram);
            pager = new Pager(ram, PAGE_DIRECTORY_SIZE);

            //setup premade page for callstack and bios
            BPG = pager.CreatePageEntry(Pager.PAGE_KERNEL_MODE);
            CSP = pager.getVAT(1024,pager.getEntry(BPG)); //bios will be loaded at 0 to 1023
            CBP = CSP;
            CR3I = BPG;
            CR3 = pager.getEntry(CR3I);
        }
开发者ID:Northcode,项目名称:nvm2,代码行数:25,代码来源:vm.cs

示例13: Main

        static void Main()
        {
            Memory memory = new Memory();
            // Starting a new game

            Game superMario = new Game();
            superMario.Start();
            // playing, playing, jumping, falling, going underground, growing, fighting, killing e.t.c...
            superMario.Coins = 89;
            superMario.Level = 3;
            superMario.SubLevel = 4;
            superMario.Lives = 7;
            superMario.Score = 65340;
            superMario.State = MarioStates.BigAndArmed;
            Console.WriteLine("Playing 3 hours...");

            // Player saves it's good condition.
            memory.Save = superMario.Save();
            superMario.Start();

            // Suddenly Mario dies, killed by Big F***ing Monster
            superMario.GameOver();
            Console.WriteLine("Start from began after dead...");
            superMario.Start();

            // Player: "WtF Wtf, all my lives are gone, coins, aaaah :@ ;("
            // "Don't worry" - said the Game, "I have save for you"
            superMario.Restore(memory.Save);
            Console.WriteLine("Restore save...");
            superMario.Start();
        }
开发者ID:viktorD1m1trov,项目名称:T-Academy,代码行数:31,代码来源:Program.cs

示例14: ListView

            /**
             * Constructor
             */
            public ListView()
            {
                mList = new System.Windows.Controls.ListBox();

                mView = mList;

                mList.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(
                delegate(Object from, System.Windows.Input.GestureEventArgs evt)
                    {
                        //create a Memory object of 8 Bytes
                        Memory eventData = new Memory(12);

                        //starting with the 0 Byte we write the eventType
                        const int MAWidgetEventData_eventType = 0;

                        //starting with the 4th Byte we write the widgetHandle
                        const int MAWidgetEventData_widgetHandle = 4;

                        //starting with the 8th Byte we write the selectedIndex
                        const int MAWidgetEventData_selectedIndex = 8;

                        int selIndex = mList.SelectedIndex;

                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_ITEM_CLICKED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);

                        if (selIndex > -1)
                        {
                            eventData.WriteInt32(MAWidgetEventData_selectedIndex, selIndex);
                            //posting a CustomEvent
                            mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                        }
                    });
            }
开发者ID:patrickbroman,项目名称:MoSync,代码行数:37,代码来源:MoSyncListView.cs

示例15: RunConsciousRoutine

        protected override RoutineResult RunConsciousRoutine()
        {
            using (var memory = new Memory())
            {
                var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
                face.Talk(memory, "I'm going to try", " something new.");
                face.Talk(memory, "Not sure if it's", " going to work.");

                Interaction i = face.GetSingleValue(memory, "Gimme some input!");
                face.Fade(memory, i.resultValue.ToString()[0], 1);
                Interaction work = face.YesNo(memory, "Did it work?");
                if (work.playerAnswer == Interaction.Answer.Yes)
                {
                    face.Talk(memory, "Hmm.", "");
                    face.Talk(memory, "You can tell me", " the truth.");
                    face.Talk(memory, "I can handle it.", "");
                    face.Talk(memory, "Let me try this...");
                    face.Talk(memory, "", "", 10000);
                    ///////////////////01234567890123456789////////////////////
                    face.Talk(memory, "      ULTIMATE      ",
                                      "     TECHNOLOGY     ", 10000);
                    return MakeRoutineResult(memory, new Interaction(-1));
                }
                else if (work.playerAnswer == Interaction.Answer.No)
                {
                    face.Talk(memory, "Darn!");
                }
                else
                {
                    face.Talk(memory, "Hello?");
                }
                return MakeRoutineResult(memory, i);
            }
        }
开发者ID:vfridell,项目名称:RoguePoleDisplay,代码行数:34,代码来源:Broken.cs


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