wanshenmean
2026-03-13 0500b9903e5b7fcdbdc5b3bd0cc9b373779d64d8
分支
用户 wanshenmean <cathay_xy@163.com>
星期五, 三月 13, 2026 12:47 +0800
提交者 wanshenmean <cathay_xy@163.com>
星期五, 三月 13, 2026 12:47 +0800
提交0500b9903e5b7fcdbdc5b3bd0cc9b373779d64d8
目录 d671223097e256cb9f99ffca9a16e2f2ff5640f5 目录 | zip | gz
上一版本 e5d171107520aa5d40b00b8e3fb8cd26e32531e8 查看 | 对比
feat: implement DB region (Data Blocks)

Implement DBRegion class supporting multiple DB blocks with comprehensive type-specific read/write operations following TDD approach.

**Test Coverage (18 tests):**
- Constructor and basic region creation
- Multi-DB block management (read/write separate blocks)
- Type-specific operations: Int, DInt, Real, Bool
- S7 string format support (max length + actual length + data)
- Error handling: invalid DB number, out of bounds
- Memory clearing and disposal

**Implementation Details:**
- Dictionary<ushort, byte[]> for multiple DB blocks
- Thread-safe with ReaderWriterLockSlim
- Auto-creates DB blocks on write if not exists
- Big-endian for Int/DInt, IEEE 754 for Real
- S7 string format: [maxLen(1)][actualLen(1)][data]
- Default DB1 for base interface methods
- Proper disposal clears blocks dictionary

**Files:**
- WIDESEAWCS_S7Simulator.Core/Memory/DBRegion.cs
- WIDESEAWCS_S7Simulator.UnitTests/Memory/DBRegionTests.cs

All tests passing: 18/18 DBRegion + 11 existing = 29/29 total

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
已添加2个文件
753 ■■■■■ 文件已修改
Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Core/Memory/DBRegion.cs 490 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.UnitTests/Memory/DBRegionTests.cs 263 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史