Исходный код вики Сценарии
Редактировал(а) Alexandr Fokin 2024/12/24 14:44
Скрыть последних авторов
author | version | line-number | content |
---|---|---|---|
![]() |
1.3 | 1 | |(% style="width:215px" %)Получение id схемы из binary сообщения|(% style="width:1278px" %){{code language="c#"}}// c# |
![]() |
1.2 | 2 | public int GetSchemaId(byte[] data) |
3 | { | ||
4 | var magicByte = data[0]; | ||
5 | if (magicByte != 0) | ||
6 | { | ||
7 | throw new Exception($"magic byte should be 0, not {magicByte}"); | ||
8 | } | ||
9 | |||
10 | var id = IPAddress.NetworkToHostOrder( | ||
11 | BinaryPrimitives.ReadInt32LittleEndian(data.AsSpan(1, 4))); | ||
12 | |||
13 | return id; | ||
14 | }{{/code}} | ||
![]() |
1.3 | 15 | |(% style="width:215px" %) |(% style="width:1278px" %) |
16 | |(% style="width:215px" %) |(% style="width:1278px" %) | ||
![]() |
1.2 | 17 | |
18 |