| | |
| | | /// 内存操作控制器 |
| | | /// </summary> |
| | | [ApiController] |
| | | [Route("api/instances/{id}/[controller]")] |
| | | [Route("api/[controller]")] |
| | | public class MemoryController : ControllerBase |
| | | { |
| | | private readonly ISimulatorInstanceManager _instanceManager; |
| | |
| | | /// <summary> |
| | | /// 读取内存数据 |
| | | /// </summary> |
| | | [HttpGet] |
| | | [HttpGet("ReadMemory")] |
| | | [ProducesResponseType(typeof(Dictionary<string, byte[]>), StatusCodes.Status200OK)] |
| | | [ProducesResponseType(StatusCodes.Status404NotFound)] |
| | | public ActionResult<Dictionary<string, byte[]>> ReadMemory(string id) |
| | |
| | | /// <summary> |
| | | /// 写入内存数据 |
| | | /// </summary> |
| | | [HttpPost] |
| | | [HttpPost("WriteMemory")] |
| | | [ProducesResponseType(StatusCodes.Status200OK)] |
| | | [ProducesResponseType(StatusCodes.Status404NotFound)] |
| | | [ProducesResponseType(StatusCodes.Status400BadRequest)] |
| | | public ActionResult WriteMemory(string id, [FromBody] Dictionary<string, byte[]> data) |
| | | public ActionResult WriteMemory(string id, Dictionary<string, byte[]> data) |
| | | { |
| | | try |
| | | { |
| | |
| | | /// <summary> |
| | | /// 清空内存数据 |
| | | /// </summary> |
| | | [HttpDelete] |
| | | [HttpDelete("ClearMemory")] |
| | | [ProducesResponseType(StatusCodes.Status200OK)] |
| | | [ProducesResponseType(StatusCodes.Status404NotFound)] |
| | | public ActionResult ClearMemory(string id) |
| | |
| | | /// <summary> |
| | | /// 保存内存快照 |
| | | /// </summary> |
| | | [HttpPost("save")] |
| | | [HttpPost("SaveMemorySnapshot")] |
| | | [ProducesResponseType(StatusCodes.Status200OK)] |
| | | [ProducesResponseType(StatusCodes.Status404NotFound)] |
| | | public ActionResult SaveMemorySnapshot(string id, [FromQuery] string? snapshotName = null) |
| | | public ActionResult SaveMemorySnapshot(string id, string? snapshotName = null) |
| | | { |
| | | try |
| | | { |
| | |
| | | /// <summary> |
| | | /// 加载内存快照 |
| | | /// </summary> |
| | | [HttpPost("load")] |
| | | [HttpPost("LoadMemorySnapshot")] |
| | | [ProducesResponseType(StatusCodes.Status200OK)] |
| | | [ProducesResponseType(StatusCodes.Status404NotFound)] |
| | | [ProducesResponseType(StatusCodes.Status400BadRequest)] |
| | | public ActionResult LoadMemorySnapshot(string id, [FromBody] Dictionary<string, byte[]> snapshotData) |
| | | public ActionResult LoadMemorySnapshot(string id, Dictionary<string, byte[]> snapshotData) |
| | | { |
| | | try |
| | | { |