Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions Lagrange.Core.NativeAPI/NativeModel/Event/IEventStruct.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;

namespace Lagrange.Core.NativeAPI.NativeModel.Event
namespace Lagrange.Core.NativeAPI.NativeModel.Event
{
public interface IEventStruct
{
Expand Down
Loading