diff --git a/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupInviteNotificationStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupInviteNotificationStruct.cs new file mode 100644 index 00000000..61962f8b --- /dev/null +++ b/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupInviteNotificationStruct.cs @@ -0,0 +1,25 @@ +using System.Runtime.InteropServices; +using System.Text; +using Lagrange.Core.Common.Entity; + +namespace Lagrange.Core.NativeAPI.NativeModel.Common; +[StructLayout(LayoutKind.Sequential)] +public class BotGroupInviteNotificationStruct(BotGroupInviteNotification e) : BotGroupNotificationBaseStruct(e) +{ + public int State = (int)e.State; + + public long OperatorUin = e.OperatorUin ?? 0; + + public ByteArrayNative OperatorUid = Encoding.UTF8.GetBytes(e.OperatorUid ?? ""); + + public long InviterUin = e.InviterUin; + + public ByteArrayNative InviterUid = Encoding.UTF8.GetBytes(e.InviterUid); + + public bool IsFiltered = e.IsFiltered; + + public static implicit operator BotGroupInviteNotificationStruct(BotGroupInviteNotification e) + { + return new BotGroupInviteNotificationStruct(e); + } +} diff --git a/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupJoinNotificationStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupJoinNotificationStruct.cs new file mode 100644 index 00000000..2c07ae27 --- /dev/null +++ b/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupJoinNotificationStruct.cs @@ -0,0 +1,23 @@ +using System.Runtime.InteropServices; +using System.Text; +using Lagrange.Core.Common.Entity; + +namespace Lagrange.Core.NativeAPI.NativeModel.Common; +[StructLayout(LayoutKind.Sequential)] +public class BotGroupJoinNotificationStruct(BotGroupJoinNotification notification) : BotGroupNotificationBaseStruct(notification) +{ + public int State = (int)notification.State; + + public long OperatorUin = notification.OperatorUin ?? 0; + + public ByteArrayNative OperatorUid { get; } = Encoding.UTF8.GetBytes(notification.OperatorUid ?? ""); + + public ByteArrayNative Comment { get; } = Encoding.UTF8.GetBytes(notification.Comment); + + public bool IsFiltered { get; } = notification.IsFiltered; + + public static implicit operator BotGroupJoinNotificationStruct(BotGroupJoinNotification e) + { + return new BotGroupJoinNotificationStruct(e); + } +} diff --git a/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupNotificationBaseStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupNotificationBaseStruct.cs new file mode 100644 index 00000000..f2d453ea --- /dev/null +++ b/Lagrange.Core.NativeAPI/NativeModel/Common/BotGroupNotificationBaseStruct.cs @@ -0,0 +1,18 @@ +using System.Runtime.InteropServices; +using System.Text; +using Lagrange.Core.Common.Entity; + +namespace Lagrange.Core.NativeAPI.NativeModel.Common; +[StructLayout(LayoutKind.Sequential)] +public abstract class BotGroupNotificationBaseStruct(BotGroupNotificationBase e) +{ + public long GroupUin = e.GroupUin; + + public ulong Sequence = e.Sequence; + + public int Type = (int)e.Type; + + public long TargetUin = e.TargetUin; + + public ByteArrayNative TargetUid = Encoding.UTF8.GetBytes(e.TargetUid); +} \ No newline at end of file diff --git a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupInviteNotificationEventStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupInviteNotificationEventStruct.cs index 325f1d03..1a15c81f 100644 --- a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupInviteNotificationEventStruct.cs +++ b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupInviteNotificationEventStruct.cs @@ -1,27 +1,16 @@ using System.Runtime.InteropServices; using Lagrange.Core.Common.Entity; using Lagrange.Core.Events.EventArgs; +using Lagrange.Core.NativeAPI.NativeModel.Common; -namespace Lagrange.Core.NativeAPI.NativeModel.Event +namespace Lagrange.Core.NativeAPI.NativeModel.Event; +[StructLayout(LayoutKind.Sequential)] +public struct BotGroupInviteNotificationEventStruct(BotGroupInviteNotification notification) : IEventStruct { - [StructLayout(LayoutKind.Sequential)] - public struct BotGroupInviteNotificationEventStruct(BotGroupInviteNotification notification) : IEventStruct - { - public BotGroupInviteNotification Notification = notification; - - //public static implicit operator BotGroupMemberDecreaseEvent(BotGroupMemberDecreaseEventStruct e) - //{ - // return new BotGroupMemberDecreaseEvent( - // e.GroupUin, e.UserUin, e.OperatorUin - // ); - //} + public BotGroupInviteNotificationStruct Notification = notification; - public static implicit operator BotGroupInviteNotificationEventStruct(BotGroupInviteNotificationEvent e) - { - return new BotGroupInviteNotificationEventStruct() - { - Notification = e.Notification - }; - } + public static implicit operator BotGroupInviteNotificationEventStruct(BotGroupInviteNotificationEvent e) + { + return new BotGroupInviteNotificationEventStruct(e.Notification); } -} \ No newline at end of file +} diff --git a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupJoinNotificationEventStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupJoinNotificationEventStruct.cs index dbd3b6be..5683f8a8 100644 --- a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupJoinNotificationEventStruct.cs +++ b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupJoinNotificationEventStruct.cs @@ -1,27 +1,18 @@ using System.Runtime.InteropServices; using Lagrange.Core.Common.Entity; using Lagrange.Core.Events.EventArgs; +using Lagrange.Core.NativeAPI.NativeModel.Common; namespace Lagrange.Core.NativeAPI.NativeModel.Event { [StructLayout(LayoutKind.Sequential)] public struct BotGroupJoinNotificationEventStruct(BotGroupJoinNotification notification) : IEventStruct { - public BotGroupJoinNotification Notification = notification; - - //public static implicit operator BotGroupJoinNotificationEvent(BotGroupJoinNotificationEventStruct e) - //{ - // return new BotGroupJoinNotificationEvent( - // e.Notification - // ); - //} + public BotGroupJoinNotificationStruct Notification = notification; public static implicit operator BotGroupJoinNotificationEventStruct(BotGroupJoinNotificationEvent e) { - return new BotGroupJoinNotificationEventStruct() - { - Notification = e.Notification - }; + return new BotGroupJoinNotificationEventStruct(e.Notification); } } } \ No newline at end of file diff --git a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupMemberDecreaseEventStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupMemberDecreaseEventStruct.cs index 9778522b..e444b8dd 100644 --- a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupMemberDecreaseEventStruct.cs +++ b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupMemberDecreaseEventStruct.cs @@ -7,16 +7,12 @@ namespace Lagrange.Core.NativeAPI.NativeModel.Event public struct BotGroupMemberDecreaseEventStruct : IEventStruct { public BotGroupMemberDecreaseEventStruct() { } - public Int64 GroupUin = 0; - public Int64 UserUin = 0; - public Int64 OperatorUin = 0; - //public static implicit operator BotGroupMemberDecreaseEvent(BotGroupMemberDecreaseEventStruct e) - //{ - // return new BotGroupMemberDecreaseEvent( - // e.GroupUin, e.UserUin, e.OperatorUin - // ); - //} + public long GroupUin = 0; + + public long UserUin = 0; + + public long OperatorUin = 0; public static implicit operator BotGroupMemberDecreaseEventStruct(BotGroupMemberDecreaseEvent e) { diff --git a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupNudgeEventStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupNudgeEventStruct.cs index c254ced5..d60719cf 100644 --- a/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupNudgeEventStruct.cs +++ b/Lagrange.Core.NativeAPI/NativeModel/Event/BotGroupNudgeEventStruct.cs @@ -9,10 +9,14 @@ namespace Lagrange.Core.NativeAPI.NativeModel.Event public struct BotGroupNudgeEventStruct : IEventStruct { public BotGroupNudgeEventStruct() { } - public Int64 GroupUin = 0; - public Int64 OperatorUin = 0; + + public long GroupUin = 0; + + public long OperatorUin = 0; + public ByteArrayNative Action = new(); - public Int64 TargetUin = 0; + public long TargetUin = 0; + public ByteArrayNative Suffix = new(); public static implicit operator BotGroupNudgeEvent(BotGroupNudgeEventStruct e) diff --git a/Lagrange.Core.NativeAPI/NativeModel/Event/IEventStruct.cs b/Lagrange.Core.NativeAPI/NativeModel/Event/IEventStruct.cs index 2c388d16..3d9b3968 100644 --- a/Lagrange.Core.NativeAPI/NativeModel/Event/IEventStruct.cs +++ b/Lagrange.Core.NativeAPI/NativeModel/Event/IEventStruct.cs @@ -1,6 +1,4 @@ -using System.Runtime.InteropServices; - -namespace Lagrange.Core.NativeAPI.NativeModel.Event +namespace Lagrange.Core.NativeAPI.NativeModel.Event { public interface IEventStruct {