Esempio n. 1
0
        /// <summary>
        /// Creates a new router database.
        /// </summary>
        public RouterDb(MemoryMap map, RoutingNetworkProfile profile, float maxEdgeDistance = Constants.DefaultMaxEdgeDistance)
        {
            _network      = new RoutingNetwork(map, profile, maxEdgeDistance);
            _edgeProfiles = new AttributesIndex(map, AttributesIndexMode.IncreaseOne |
                                                AttributesIndexMode.ReverseCollectionIndex | AttributesIndexMode.ReverseStringIndex);
            _meta   = new AttributesIndex(map);
            _dbMeta = new AttributeCollection();

            _supportedProfiles = new HashSet <string>();
            _contracted        = new Dictionary <string, ContractedDb>();
            _restrictionDbs    = new Dictionary <string, RestrictionsDb>();
            _shortcutsDbs      = new Dictionary <string, ShortcutsDb>();

            _guid = Guid.NewGuid();
        }
Esempio n. 2
0
        /// <summary>
        /// A new shape index.
        /// </summary>
        public ShapesArray(MemoryMap map, long size)
        {
            _index       = new Array <ulong>(map, size);
            _coordinates = new Array <float>(map, size * 2 * ESTIMATED_SIZE);

            for (long i = 0; i < _index.Length; i++)
            {
                _index[i] = 0;
            }

            for (long i = 0; i < _coordinates.Length; i++)
            {
                _coordinates[i] = float.MinValue;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Creates a new routing network.
 /// </summary>
 public RoutingNetwork(MemoryMap map, RoutingNetworkProfile profile,
                       float maxEdgeDistance = Constants.DefaultMaxEdgeDistance)
 {
     _maxEdgeDistance = maxEdgeDistance;
     if (profile == null)
     {
         _graph    = new GeometricGraph(map, 1);
         _edgeData = new Array <uint>(map, _edgeDataSize * _graph.EdgeCount);
     }
     else
     {
         _graph    = new GeometricGraph(map, profile.GeometricGraphProfile, 1);
         _edgeData = new Array <uint>(map, _edgeDataSize * _graph.EdgeCount, profile.EdgeDataProfile);
     }
 }
Esempio n. 4
0
    private unsafe void LoadBoundingBoxes(MemoryMap m)
    {
        var defaultColors = new Color[4] {
            Color.red, Color.green, Color.magenta, Color.blue
        };

        var buffer     = new EntityCommandBuffer(Allocator.TempJob);
        var grid       = buffer.CreateEntity();
        var layers     = buffer.AddBuffer <Layers>(grid);
        var colors     = buffer.AddBuffer <Colors>(grid);
        var dimensions = buffer.AddBuffer <Dimensions>(grid);

        layers.Reserve(m.Layers);
        colors.Reserve(m.Layers);
        dimensions.Reserve(m.Layers);
        var ptr = m.BoundsCenters;
        var dim = m.Dimensions;

        for (int i = 0; i < m.Layers; i++)
        {
            var e = buffer.CreateEntity();
            layers.Add(new Layers {
                Value = e
            });
            dimensions.Add(new Dimensions {
                Value = ((int3 *)m.mDimensions)[i]
            });
            colors.Add(new Colors {
                Value = defaultColors[i % defaultColors.Length]
            });
            var voxels = buffer.AddBuffer <VoxelAABB>(e);

            int size = m.Dimensions[i].z * m.Dimensions[i].y * m.Dimensions[i].x;
            voxels.Reserve(size);

            for (long j = 0; j < size; j++, ptr++)
            {
                voxels.Add(new VoxelAABB {
                    Value = new AABB {
                        Center = *ptr, Extents = m.VoxelSizes[i] / 2
                    }
                });
            }
        }

        buffer.Playback(EntityManager);
        buffer.Dispose();
    }
Esempio n. 5
0
        /// <summary>
        /// Creates a new router database.
        /// </summary>
        public RouterDb(MemoryMap map, float maxEdgeDistance = Constants.DefaultMaxEdgeDistance)
        {
            _network      = new RoutingNetwork(map, RoutingNetworkProfile.NoCache, maxEdgeDistance);
            _edgeProfiles = new AttributesIndex(AttributesIndexMode.IncreaseOne
                                                | AttributesIndexMode.ReverseAll);
            _meta   = new AttributesIndex(map, AttributesIndexMode.ReverseStringIndexKeysOnly);
            _dbMeta = new AttributeCollection();

            _supportedVehicles = new Dictionary <string, Vehicle>();
            _supportedProfiles = new Dictionary <string, Profile>();
            _contracted        = new Dictionary <string, ContractedDb>();
            _restrictionDbs    = new Dictionary <string, RestrictionsDb>();
            _shortcutsDbs      = new Dictionary <string, ShortcutsDb>();

            _guid = Guid.NewGuid();
        }
Esempio n. 6
0
        public void AddWorksWithOverlap7()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0100, 0x10FF, MemorySectionType.ByteArray));

            // --- Act
            mm.Add(new MemorySection(0x0100, 0x10FF));

            // --- Assert
            mm.Count.ShouldBe(1);
            mm[0].StartAddress.ShouldBe((ushort)0x0100);
            mm[0].EndAddress.ShouldBe((ushort)0x10FF);
            mm[0].SectionType.ShouldBe(MemorySectionType.Disassemble);
        }
Esempio n. 7
0
        public static void Test(string expected, params byte[] opCodes)
        {
            var map = new MemoryMap
            {
                new MemorySection(0x0000, (ushort)(opCodes.Length - 1))
            };
            var disassembler = new Z80Disassembler(map, opCodes);
            var output       = disassembler.Disassemble();

            output.OutputItems.Count.ShouldBe(1);
            var item = output.OutputItems[0];

            item.Instruction.ToLower().ShouldBe(expected.ToLower());
            item.LastAddress.ShouldBe((ushort)(opCodes.Length - 1));
            item.OpCodes.Trim().ShouldBe(string.Join(" ", opCodes.Select(o => $"{o:X2}")));
        }
Esempio n. 8
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);

            if (param1 == InstructionParam2.Value)
            {
                MemoryMap.Write(VM.Instance.CurrentCore.Register.Stack.Peek32(), (uint)param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Set(factory.m_pRegisters [param1V].Name, VM.Instance.CurrentCore.Register.Stack.Peek32());
            }

            return(true);
        }
Esempio n. 9
0
        /// <summary>
        /// Copies an array to the given stream.
        /// </summary>
        public virtual void CopyFrom(Stream stream)
        {
            var position = stream.Position;
            var i        = 0;

            using (var accessor = MemoryMap.GetCreateAccessorFuncFor <T>()(new MemoryMapStream(), 0))
            {
                var element = default(T);
                while (i < this.Length)
                {
                    accessor.ReadFrom(stream, stream.Position, ref element);
                    this[i] = element;
                    i++;
                }
            }
        }
Esempio n. 10
0
        public ROM()
        {
            cells = new byte[Memory.BYTES_16K];

            Address = new BusConnector <ushort>();
            Data    = new BusConnector <byte>();

            string sourcePath           = "zxspectrum.asm";
            Stream romProgramFileStream = PlatformSpecific.GetStreamForProjectFile(sourcePath);

            Program = Assembler.ParseProgram(sourcePath, romProgramFileStream, Encoding.UTF8, false);
            MemoryMap programBytes = new MemoryMap(cells.Length);

            Assembler.CompileProgram(Program, 0, programBytes);
            cells = programBytes.MemoryCells;
        }
        public MemoryMapViewModel(ProcessViewModel process, DriverInterface driver, IList <TabItemViewModelBase> tabs, IUIServices ui)
        {
            _process  = process;
            _tabs     = tabs;
            _ui       = ui;
            _hProcess = driver.OpenProcessHandle(ProcessAccessMask.AllAccess, process.Id);
            if (_hProcess == null)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            _memoryMap = new MemoryMap(_hProcess);

            Text = $"Map - {process.Name} ({process.Id})";
            Icon = "/icons/memory.ico";
        }
Esempio n. 12
0
        /// <summary>
        /// Creates a new using the given file.
        /// </summary>
        public Graph(MemoryMap map, int edgeDataSize, long estimatedSize)
        {
            _edgeDataSize = edgeDataSize;
            _edgeSize     = MINIMUM_EDGE_SIZE + edgeDataSize;

            _vertices = new Array <uint>(map, estimatedSize);
            for (int i = 0; i < _vertices.Length; i++)
            {
                _vertices[i] = Constants.NO_VERTEX;
            }
            _edges = new Array <uint>(map, estimatedSize * 3 * _edgeSize);
            for (int i = 0; i < _edges.Length; i++)
            {
                _edges[i] = Constants.NO_EDGE;
            }
        }
    private int GetObjectCount(int layer, int idx, MemoryMap map)
    {
        var dimensions = map.Dimensions;
        int offset     = 0;

        for (int i = 0; i < layer; i++)
        {
            offset += dimensions[i].x * dimensions[i].y * dimensions[i].z;
        }

        var begin       = map.Contains[offset + idx].Begin;
        var end         = map.Contains[offset + idx].End;
        var objectCount = end - begin;

        return(objectCount);
    }
Esempio n. 14
0
        public void AddWorksWithOverlap3()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0000, 0x0FFF));

            // --- Act
            mm.Add(new MemorySection(0x0100, 0x10FF));

            // --- Assert
            mm.Count.ShouldBe(2);
            mm[0].StartAddress.ShouldBe((ushort)0x0000);
            mm[0].EndAddress.ShouldBe((ushort)0x00FF);
            mm[1].StartAddress.ShouldBe((ushort)0x0100);
            mm[1].EndAddress.ShouldBe((ushort)0x10FF);
        }
Esempio n. 15
0
        public static void Test()
        {
            InitArguments arguments = new InitArguments(8, -1, 0, true);

            using (ScopeGuard.Get(arguments))
            {
                EagleFordLatLong[] EagleFordLatLongs;

                using (MemoryMap mm = new MemoryMap("T:/EagleFordLatLongs.csv"))
                {
                    MappedCsvReader csvReader = new MappedCsvReader(mm);

                    (_, List <string[]> rows) = csvReader.ReadFile(1);

                    EagleFordLatLongs = new EagleFordLatLong[rows.Count];

                    Parallel.ForEach(Partitioner.Create(0, rows.Count),
                                     (row) =>
                    {
                        for (int i = row.Item1; i < row.Item2; i++)
                        {
                            EagleFordLatLongs[i] = new EagleFordLatLong(rows[i]);
                        }
                    });
                }

                View <double, OpenMP> latlongdegrees = new View <double, OpenMP>("latlongdegrees", EagleFordLatLongs.Length, 2, 2);

                for (ulong i = 0; i < latlongdegrees.Extent(0); ++i)
                {
                    latlongdegrees[i, 0, 0] = EagleFordLatLongs[i].SurfaceLatitude;
                    latlongdegrees[i, 0, 1] = EagleFordLatLongs[i].SurfaceLongitude;
                    latlongdegrees[i, 1, 0] = EagleFordLatLongs[i].BottomLatitude;
                    latlongdegrees[i, 1, 1] = EagleFordLatLongs[i].BottomLongitude;
                }

                View <double, OpenMP> neighbors = SpatialMethods <double, OpenMP> .NearestNeighbor(latlongdegrees);

                neighbors.ToCsv("T:/neighbors.csv");

                //for(int i = 0; i < EagleFordLatLongs.Length; ++i)
                //{
                //    Console.WriteLine($"{EagleFordLatLongs[i].Api} {neighbors[i]}");
                //}
            }
        }
Esempio n. 16
0
        public CheatFinderForm(MemoryMap memoryMap, CheatSystem cheatSystem)
        {
            InitializeComponent();

            this.memoryMap   = memoryMap;
            this.cheatSystem = cheatSystem;

            this.searchType = -1;

            if (currentValues.Count == 0 && previousValues.Count == 0)
            {
                ResetValueMaps();
            }

            UpdateValueMaps();
            PopulateResultsList();
        }
Esempio n. 17
0
        /// <summary>
        /// 计算编码数据长度
        /// </summary>
        /// <param name="value"></param>
        /// <param name="values"></param>
        /// <returns></returns>
        private unsafe static int getLength(valueType value, string[] values)
        {
            valueGetter(value, values);
            int       length = 0, index = 0;
            MemoryMap utf8Map = new MemoryMap(isUtf8.Byte);

            foreach (string name in names)
            {
                string valueString = values[index];
                if (!string.IsNullOrEmpty(valueString))
                {
                    length += 2 + name.Length + (utf8Map.Get(index) == 0 ? valueString.Length : System.Text.Encoding.UTF8.GetByteCount(valueString));
                }
                ++index;
            }
            return(length);
        }
 public static MappedAccessor <MockObject> CreateAccessor(MemoryMap map, long sizeInBytes)
 {
     return(map.CreateVariable <MockObject>(sizeInBytes, new MemoryMap.ReadFromDelegate <MockObject>(
                                                (Stream stream, long position, ref MockObject value) =>
     {
         var payload = string.Empty;
         var size = MemoryMapDelegates.ReadFromString(stream, position, ref payload);
         value = new MockObject(payload);
         return size;
     }),
                                            new MemoryMap.WriteToDelegate <MockObject>(
                                                (Stream stream, long position, ref MockObject value) =>
     {
         var payload = value.Payload;
         return MemoryMapDelegates.WriteToString(stream, position, ref payload);
     })));
 }
Esempio n. 19
0
        /// <summary>
        /// Copies a sorted list of elements to a stream.
        /// </summary>
        public static long CopyTo <T>(this IList <T> list, Stream stream)
        {
            var position = stream.Position;
            var i        = 0;

            using (var accessor = MemoryMap.GetCreateAccessorFuncFor <T>()(new MemoryMapStream(), 0))
            {
                var element = default(T);
                while (i < list.Count)
                {
                    element = list[i];
                    accessor.WriteTo(stream, stream.Position, ref element);
                    i++;
                }
            }
            return(stream.Position - position);
        }
Esempio n. 20
0
        public override void Execute(CpuRegisters registers, MemoryMap memory, Opcode opCode)
        {
            //SetFlags(Registers.A, arg1, 2, 1, 2, 2);
            //Registers.Cycles += 4;
            //Registers.PC++;
            //break;

            var sourceRegister = _registerMap[opCode.addrInt];

            var registerValue  = (byte)registers[sourceRegister];
            var valueToCompare = (ushort)ValueFrom(opCode.operand1, registers);

            var result = registerValue - valueToCompare;


            Debug.WriteLine($"CP_n {opCode.Operand1.Value}");
        }
Esempio n. 21
0
        /// <summary>
        /// Copies an array to the given stream.
        /// </summary>
        public virtual long CopyTo(Stream stream)
        {
            var position = stream.Position;
            var i        = 0;

            using (var accessor = MemoryMap.GetCreateAccessorFuncFor <T>()(new MemoryMapStream(), 0))
            {
                var element = default(T);
                while (i < this.Length)
                {
                    element = this[i];
                    accessor.WriteTo(stream, stream.Position, ref element);
                    i++;
                }
            }
            return(stream.Position - position);
        }
Esempio n. 22
0
        public void Test_CompareModifiedRegisters(string xmlName)
        {
            Func <Func <dynamic>, bool> test = this.TestExpression;

            // Dynamic memory map generation
            byte[]  memory = new byte[400];
            dynamic map    = null;

            Assert.True(test(() => { return(map = new MemoryMap(memory, xmlName, false, this.GetPath())); }), Error(ERROR_MMAP));

            // If memory map can't be created, test finishes
            if (map == null)
            {
                return;
            }

            byte[]  memory2 = new byte[400];
            dynamic map2    = null;

            Assert.True(test(() => { return(map2 = new MemoryMap(memory2, xmlName, false, this.GetPath())); }), Error(ERROR_MMAP));

            map.Shipbit             = true;
            map.MessageOverlapCount = 200;
            map.P1MeterType         = 321;
            map.P1MeterId           = 1357;
            map.EncryptionKey       = "123456789876543";

            map2.Shipbit             = false;
            map2.MessageOverlapCount = 200; // Same value
            map2.P1MeterType         = 32;
            map2.P1MeterId           = 135;
            map2.EncryptionKey       = "12345678987654";

            string[] difs     = map.GetModifiedRegistersDifferences(map2);
            bool     areEqual = map.ValidateModifiedRegisters(map2);

            Assert.True(!areEqual, ERROR_COMPARE_MAP);

            List <string> list = new List <string> (difs);

            Assert.True(!list.Contains("MessageOverlapCount"), ERROR_COMPARE_REG);
            Assert.True(list.Contains("Shipbit"), ERROR_COMPARE_REG);
            Assert.True(list.Contains("P1MeterType"), ERROR_COMPARE_REG);
            Assert.True(list.Contains("P1MeterId"), ERROR_COMPARE_REG);
            Assert.True(list.Contains("EncryptionKey"), ERROR_COMPARE_REG);
        }
Esempio n. 23
0
 /// <summary>
 /// Copies the data from the stream to this index.
 /// </summary>
 public static Index <T> CreateFrom(Stream stream, long size, bool useAsMap = false)
 {
     if (useAsMap)
     { // use the existing stream as map.
         var map      = new MemoryMapStream(new CappedStream(stream, stream.Position, size));
         var accessor = MemoryMap.GetCreateAccessorFuncFor <T>()(map, size);
         return(new Index <T>(accessor));
     }
     else
     { // copy to memory stream and release the given stream.
         var data     = new byte[size];
         var position = stream.Position;
         stream.Read(data, 0, (int)size);
         var map      = new MemoryMapStream(new CappedStream(new MemoryStream(data), 0, size));
         var accessor = MemoryMap.GetCreateAccessorFuncFor <T>()(map, size);
         return(new Index <T>(accessor));
     }
 }
Esempio n. 24
0
        public void NormalizeWorksWithThreeAdjacentSections()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0100, 0x01FF));
            mm.Add(new MemorySection(0x0200, 0x02FF));
            mm.Add(new MemorySection(0x0300, 0x03FF));

            // --- Act
            mm.Normalize();

            // --- Assert
            mm.Count.ShouldBe(1);
            mm[0].StartAddress.ShouldBe((ushort)0x0100);
            mm[0].EndAddress.ShouldBe((ushort)0x03FF);
            mm[0].SectionType.ShouldBe(MemorySectionType.Disassemble);
        }
Esempio n. 25
0
        public static void Test(SpectrumSpecificDisassemblyFlags flags, string[] expected, params byte[] opCodes)
        {
            var map = new MemoryMap
            {
                new MemorySection(0x0000, (ushort)(opCodes.Length - 1))
            };
            var disassembler = new Z80Disassembler(map, opCodes,
                                                   new Dictionary <int, SpectrumSpecificDisassemblyFlags> {
                { 0, flags }
            });
            var output = disassembler.Disassemble();

            output.OutputItems.Count.ShouldBe(expected.Length);
            for (var i = 0; i < expected.Length; i++)
            {
                output.OutputItems[i].Instruction.ToLower().ShouldBe(expected[i]);
            }
        }
Esempio n. 26
0
        public void TestDecodeOp()
        {
            MemoryMap   map = new MemoryMap();
            MachineCode mc  = new MachineCode();

            for (int i = 0; i < 256; i++)
            {
                if (map.cells[i].address > 0x7F)
                {
                    Assert.AreEqual(op_type.OP_MEMB, mc.decodeOpType(map.cells[i].name), string.Format("Błąd dekodowania operandu {0}", map.cells[i].name));
                }
                else
                {
                    Assert.AreEqual(op_type.OP_MEMW, mc.decodeOpType(map.cells[i].name), string.Format("Błąd dekodowania operandu {0}", map.cells[i].name));
                }
            }
            Assert.AreEqual(op_type.OP_OV, mc.decodeOpType("OV"), "Błąd dekodowania operandu OV");
        }
    private byte *GetGuid(int layer, int voxelIdx, MemoryMap map, int objectIdx)
    {
        var dimensions = map.Dimensions;
        int offset     = 0;

        for (int i = 0; i < layer; i++)
        {
            offset += dimensions[i].x * dimensions[i].y * dimensions[i].z;
        }

        var begin       = map.Contains[offset + voxelIdx].Begin;
        var end         = map.Contains[offset + voxelIdx].End;
        var objectCount = end - begin;

        Debug.Assert(objectCount > 0);

        return(&map.mNames[(begin + objectIdx) * 22]);
    }
Esempio n. 28
0
        static ViewTreeBuilder()
        {
            AutoCSer.Memory.Pointer buffer = Unmanaged.GetStaticPointer(atMapSize + commandUniqueHashDataCount * commandUniqueHashDataSize, true);
            atMap = new MemoryMap(buffer.Data);
            atMap.Set('0', 10);
            atMap.Set('A', 26);
            atMap.Set('a', 26);
            atMap.Set('.');
            atMap.Set('_');

            commandUniqueHashData = new Pointer {
                Data = buffer.Byte + atMapSize
            };
            for (byte *start = commandUniqueHashData.Byte, end = start + commandUniqueHashDataCount * commandUniqueHashDataSize; start != end; start += commandUniqueHashDataSize)
            {
                *(int *)start = int.MinValue;
            }
            foreach (ViewTreeCommand command in System.Enum.GetValues(typeof(ViewTreeCommand)))
            {
                string commandString = command.ToString();
                if (sizeof(int) + (commandString.Length << 1) > commandUniqueHashDataSize)
                {
                    throw new IndexOutOfRangeException();
                }

                fixed(char *commandFixed = commandString)
                {
                    int code = ((*commandFixed >> 1) ^ (commandFixed[commandString.Length >> 2] >> 2)) & ((1 << 4) - 1);

                    if (command == ViewTreeCommand.Client)
                    {
                        clientCommandIndex = code;
                    }
                    byte *data = commandUniqueHashData.Byte + (code * commandUniqueHashDataSize);

                    if (*(int *)data != int.MinValue)
                    {
                        throw new IndexOutOfRangeException();
                    }
                    *(int *)data = commandString.Length;
                    AutoCSer.Memory.Common.CopyNotNull(commandFixed, data + sizeof(int), commandString.Length << 1);
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// DataTable 包装
        /// </summary>
        /// <param name="table"></param>
        /// <param name="builder">数据流包装器</param>
        private unsafe void from(System.Data.DataTable table, DataWriter builder)
        {
            int index = 0;

            columnNames = new string[table.Columns.Count];
            fixed(byte *columnFixed = columnTypes = new byte[columnNames.Length])
            {
                byte *columnIndex = columnFixed;

                foreach (System.Data.DataColumn column in table.Columns)
                {
                    if (!typeIndexs.TryGetValue(column.DataType, out *columnIndex))
                    {
                        *columnIndex = 255;
                    }
                    ++columnIndex;
                    columnNames[index++] = column.ColumnName;
                }

                fixed(byte *nullFixed = dbNull = new byte[(columnNames.Length *rowCount + 7) >> 3])
                {
                    MemoryMap nullMap = new MemoryMap(nullFixed);

                    index = 0;
                    foreach (System.Data.DataRow row in table.Rows)
                    {
                        columnIndex = columnFixed;
                        foreach (object value in row.ItemArray)
                        {
                            if (value == DBNull.Value)
                            {
                                nullMap.Set(index);
                            }
                            else
                            {
                                builder.Append(value, *columnIndex);
                            }
                            ++index;
                            ++columnIndex;
                        }
                    }
                }
            }
        }
Esempio n. 30
0
        static void Main()
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var memoryMap     = new MemoryMap <BigDataParent>("SomeKey");
            var sampleBigData = memoryMap.Load();

            Console.WriteLine(
                $"memoryMap.Load elapsed time: {stopWatch.Elapsed}");

            Console.WriteLine(
                $"Loaded '{sampleBigData.Description}'");
            Console.WriteLine(
                $"Total SomeDouble: {sampleBigData.BigDataChildren.Sum(x => x.SomeDouble)}");

            Console.ReadKey();
        }
Esempio n. 31
0
 public static MappedAccessor<MockObject> CreateAccessor(MemoryMap map, long sizeInBytes)
 {
     return map.CreateVariable<MockObject>(sizeInBytes, new MemoryMap.ReadFromDelegate<MockObject>(
         (Stream stream, long position, ref MockObject value) =>
         {
             var payload = string.Empty;
             var size = MemoryMapDelegates.ReadFromString(stream, position, ref payload);
             value = new MockObject(payload);
             return size;
         }),
         new MemoryMap.WriteToDelegate<MockObject>(
             (Stream stream, long position, ref MockObject value) =>
             {
                 var payload = value.Payload;
                 return MemoryMapDelegates.WriteToString(stream, position, ref payload);
             }));
 }
Esempio n. 32
0
 public Map(Vector3 playerPos)
 {
     memoryMap = new MemoryMap(playerPos, false);
     cubes = new Cube[0];
 }