forked from LagrangeDev/Lagrange.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/sisi0318/Lagrange.Core
- Loading branch information
Showing
22 changed files
with
504 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Lagrange.Core.Common.Entity | ||
{ | ||
[Serializable] | ||
public class ImageOcrResult | ||
{ | ||
[JsonPropertyName("texts")] public List<TextDetection> Texts { get; set; } | ||
|
||
[JsonPropertyName("language")] public string Language { get; set; } | ||
|
||
public ImageOcrResult(List<TextDetection> texts, string language) | ||
{ | ||
Texts = texts; | ||
Language = language; | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class TextDetection | ||
{ | ||
[JsonPropertyName("text")] public string Text { get; set; } | ||
|
||
[JsonPropertyName("confidence")] public int Confidence { get; set; } | ||
|
||
[JsonPropertyName("coordinates")] public List<Coordinate> Coordinates { get; set; } | ||
|
||
public TextDetection(string text, int confidence, List<Coordinate> coordinates) | ||
{ | ||
Text = text; | ||
Confidence = confidence; | ||
Coordinates = coordinates; | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class Coordinate | ||
{ | ||
[JsonPropertyName("x")] public int X { get; set; } | ||
|
||
[JsonPropertyName("y")] public int Y { get; set; } | ||
|
||
public Coordinate(int x, int y) | ||
{ | ||
X = x; | ||
Y = y; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Lagrange.Core.Event.EventArg; | ||
|
||
public class GroupMemberEnterEvent : EventBase | ||
{ | ||
public uint GroupUin { get; } | ||
|
||
public uint GroupMemberUin { get; } | ||
|
||
public uint StyleId { get; } | ||
|
||
internal GroupMemberEnterEvent(uint groupUin, uint groupMemberUin, uint styleId) | ||
{ | ||
GroupUin = groupUin; | ||
GroupMemberUin = groupMemberUin; | ||
StyleId = styleId; | ||
|
||
EventMessage = $"[{nameof(GroupMemberEnterEvent)}]: {GroupMemberUin} Enter {GroupUin} | {StyleId}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Lagrange.Core.Common.Entity; | ||
|
||
namespace Lagrange.Core.Internal.Event.Action; | ||
|
||
internal class ImageOcrEvent : ProtocolEvent | ||
{ | ||
public string Url { get; } = string.Empty; | ||
|
||
public ImageOcrResult ImageOcrResult { get; } | ||
|
||
private ImageOcrEvent(string url) : base(true) | ||
{ | ||
Url = url; | ||
ImageOcrResult = new ImageOcrResult(new List<TextDetection>(), ""); | ||
} | ||
|
||
private ImageOcrEvent(int resultCode, ImageOcrResult result) : base(resultCode) | ||
{ | ||
ImageOcrResult = result; | ||
} | ||
|
||
public static ImageOcrEvent Create(string url) => new(url); | ||
|
||
public static ImageOcrEvent Result(int resultCode, ImageOcrResult result) => new(resultCode, result); | ||
} |
20 changes: 20 additions & 0 deletions
20
Lagrange.Core/Internal/Event/Notify/GroupSysMemberEnterEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Lagrange.Core.Internal.Event.Notify; | ||
|
||
internal class GroupSysMemberEnterEvent : ProtocolEvent | ||
{ | ||
public uint GroupUin { get; } | ||
|
||
public uint GroupMemberUin { get; } | ||
|
||
public uint StyleId { get; } | ||
|
||
private GroupSysMemberEnterEvent(uint groupUin, uint groupMemberUin, uint styleId) : base(0) | ||
{ | ||
GroupUin = groupUin; | ||
GroupMemberUin = groupMemberUin; | ||
StyleId = styleId; | ||
} | ||
|
||
public static GroupSysMemberEnterEvent Result(uint groupUin, uint groupMemberUin, uint styleId) => | ||
new(groupUin, groupMemberUin, styleId); | ||
} |
62 changes: 62 additions & 0 deletions
62
Lagrange.Core/Internal/Packets/Message/Notify/GroupMemberEnter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using ProtoBuf; | ||
|
||
#pragma warning disable CS8618 | ||
|
||
namespace Lagrange.Core.Internal.Packets.Message.Notify; | ||
|
||
[ProtoContract] | ||
internal class GroupMemberEnter | ||
{ | ||
[ProtoMember(1)] public bool Field1 { get; set; } | ||
|
||
[ProtoMember(2)] public GroupMemberEnterContentBody Body { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class GroupMemberEnterContentBody | ||
{ | ||
[ProtoMember(1)] public GroupMemberEnterContentBodyField1 Field1 { get; set; } | ||
|
||
[ProtoMember(2)] public uint GroupId { get; set; } | ||
|
||
[ProtoMember(3)] public uint Field3 { get; set; } | ||
|
||
[ProtoMember(4)] public GroupMemberEnterInfo Info { get; set; } | ||
|
||
[ProtoMember(5)] public uint Field5 { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class GroupMemberEnterContentBodyField1 | ||
{ | ||
[ProtoMember(1)] public uint Field1 { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class GroupMemberEnterInfo | ||
{ | ||
[ProtoMember(2)] public uint Field2 { get; set; } | ||
|
||
[ProtoMember(3)] public GroupMemberEnterDetail Detail { get; set; } | ||
|
||
[ProtoMember(4)] public uint Field4 { get; set; } | ||
|
||
[ProtoMember(5)] public uint Field5 { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class GroupMemberEnterDetail | ||
{ | ||
[ProtoMember(3)] public uint GroupMemberUin { get; set; } | ||
[ProtoMember(4)] public uint GroupId { get; set; } | ||
[ProtoMember(5)] public uint Field5 { get; set; } | ||
[ProtoMember(6)] public uint Field6 { get; set; } | ||
[ProtoMember(20)] public GroupMemberEnterStyle Style { get; set; } | ||
[ProtoMember(21)] public uint Field21 { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class GroupMemberEnterStyle | ||
{ | ||
[ProtoMember(1)] public uint StyleId { get; set; } | ||
} |
41 changes: 41 additions & 0 deletions
41
Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp.0xE07_0.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using ProtoBuf; | ||
|
||
#pragma warning disable CS8618 | ||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Lagrange.Core.Internal.Packets.Service.Oidb.Request; | ||
|
||
[ProtoContract] | ||
[OidbSvcTrpcTcp(0xE07, 0)] | ||
internal class OidbSvcTrpcTcp0xE07_0 | ||
{ | ||
[ProtoMember(1)] public uint Version { get; set; } | ||
|
||
[ProtoMember(2)] public uint Client { get; set; } | ||
|
||
[ProtoMember(3)] public uint Entrance { get; set; } | ||
|
||
[ProtoMember(10)] public OcrReqBody OcrReqBody { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class OcrReqBody | ||
{ | ||
[ProtoMember(1)] public string ImageUrl { get; set; } | ||
|
||
[ProtoMember(2)] public uint LanguageType { get; set; } | ||
|
||
[ProtoMember(3)] public uint Scene { get; set; } | ||
|
||
[ProtoMember(10)] public string OriginMd5 { get; set; } | ||
|
||
[ProtoMember(11)] public string AfterCompressMd5 { get; set; } | ||
|
||
[ProtoMember(12)] public string AfterCompressFileSize { get; set; } | ||
|
||
[ProtoMember(13)] public string AfterCompressWeight { get; set; } | ||
|
||
[ProtoMember(14)] public string AfterCompressHeight { get; set; } | ||
|
||
[ProtoMember(15)] public bool IsCut { get; set; } | ||
} |
72 changes: 72 additions & 0 deletions
72
Lagrange.Core/Internal/Packets/Service/Oidb/Response/OidbSvcTrpcTcp0xE07_0Response.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using ProtoBuf; | ||
|
||
#pragma warning disable CS8618 | ||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Lagrange.Core.Internal.Packets.Service.Oidb.Response; | ||
|
||
[ProtoContract] | ||
internal class OidbSvcTrpcTcp0xE07_0_Response | ||
{ | ||
[ProtoMember(1)] public int RetCode { get; set; } | ||
|
||
[ProtoMember(2)] public string ErrMsg { get; set; } | ||
|
||
[ProtoMember(3)] public string Wording { get; set; } | ||
|
||
[ProtoMember(10)] public OcrRspBody OcrRspBody { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class OcrRspBody | ||
{ | ||
[ProtoMember(1)] public List<TextDetection> TextDetections { get; set; } | ||
|
||
[ProtoMember(2)] public string Language { get; set; } | ||
|
||
[ProtoMember(3)] public string RequestId { get; set; } | ||
|
||
[ProtoMember(101)] public List<string> OcrLanguageList { get; set; } | ||
|
||
[ProtoMember(102)] public List<string> DstTranslateLanguageList { get; set; } | ||
|
||
[ProtoMember(103)] public List<Language> LanguageList { get; set; } | ||
|
||
[ProtoMember(111)] public uint AfterCompressWeight { get; set; } | ||
|
||
[ProtoMember(112)] public uint AfterCompressHeight { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class TextDetection | ||
{ | ||
[ProtoMember(1)] public string DetectedText { get; set; } | ||
|
||
[ProtoMember(2)] public uint Confidence { get; set; } | ||
|
||
[ProtoMember(3)] public Polygon Polygon { get; set; } | ||
|
||
[ProtoMember(4)] public string AdvancedInfo { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Polygon | ||
{ | ||
[ProtoMember(1)] public List<Coordinate> Coordinates { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Coordinate | ||
{ | ||
[ProtoMember(1)] public int X { get; set; } | ||
|
||
[ProtoMember(2)] public int Y { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Language | ||
{ | ||
[ProtoMember(1)] public string LanguageCode { get; set; } | ||
|
||
[ProtoMember(2)] public string LanguageDesc { get; set; } | ||
} |
Oops, something went wrong.