This repository was archived by the owner on Oct 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ using ProtoBuf ;
2+
3+ namespace Lagrange . Core . Internal . Packets . Message . Element . Implementation . Extra ;
4+
5+ [ ProtoContract ]
6+ public class StreamExtra
7+ {
8+ [ ProtoMember ( 43 ) ] public ulong Field43 { get ; init ; }
9+
10+ [ ProtoMember ( 103 ) ] public ulong Sequence { get ; init ; }
11+ }
Original file line number Diff line number Diff line change 1+ using Lagrange . Core . Internal . Packets . Message . Element ;
2+ using Lagrange . Core . Internal . Packets . Message . Element . Implementation ;
3+ using Lagrange . Core . Internal . Packets . Message . Element . Implementation . Extra ;
4+ using ProtoBuf ;
5+
6+ namespace Lagrange . Core . Message . Entity ;
7+
8+ public class StreamEntity : IMessageEntity
9+ {
10+ public string Text { get ; }
11+
12+ public StreamEntity ( string text )
13+ {
14+ Text = text ;
15+ }
16+
17+ IEnumerable < Elem > IMessageEntity . PackElement ( )
18+ {
19+ byte [ ] extra ;
20+ using ( MemoryStream stream = new ( ) )
21+ {
22+ Serializer . Serialize ( stream , new StreamExtra
23+ {
24+ Field43 = ( ulong ) Random . Shared . NextInt64 ( ) ,
25+ Sequence = 1
26+ } ) ;
27+ extra = stream . ToArray ( ) ;
28+ }
29+
30+ return new Elem [ ] {
31+ new ( ) {
32+ Text = new Text {
33+ Str = Text
34+ }
35+ } ,
36+ new ( ) {
37+ GeneralFlags = new GeneralFlags {
38+ PbReserve = extra
39+ }
40+ }
41+ } ;
42+ }
43+
44+ IMessageEntity ? IMessageEntity . UnpackElement ( Elem elem ) => throw new NotImplementedException ( ) ;
45+
46+ string IMessageEntity . ToPreviewString ( ) => $ "[Stream] { Text } ";
47+ }
You can’t perform that action at this time.
0 commit comments