Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from timi137137/develop
Browse files Browse the repository at this point in the history
Fix can't use request event bug
  • Loading branch information
timi137137 authored May 3, 2021
2 parents 3535c8c + 961277e commit 932ae3c
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 4 deletions.
72 changes: 72 additions & 0 deletions AuroraNative/Attributes/RequestTypeAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using AuroraNative.Enum;
using System;

namespace AuroraNative.Attributes
{
/// <summary>
/// 请求事件 特性
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
[PostType(PostType.Request)]
public class RequestTypeAttribute : Base, IEquatable<RequestTypeAttribute>
{
#region --属性--

/// <summary>
/// 请求事件 枚举
/// </summary>
public RequestType RequestType { get => Utils.GetEnumByDescription<RequestType>(Type); set => Type = value.ToString(); }

#endregion

#region --构造函数--

/// <summary>
/// 请求事件类型构造函数,初始化 <see cref="Base"/> 类的实例
/// </summary>
/// <param name="RequestType">请求事件类型</param>
public RequestTypeAttribute(RequestType RequestType)
{
this.RequestType = RequestType;
}

#endregion

#region --公开函数--

/// <summary>
///
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return base.GetHashCode();
}

/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public override bool Equals(object obj)
{
return Equals(obj as MessageTypeAttribute);
}

/// <summary>
///
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
public bool Equals(RequestTypeAttribute other)
{
if (other != null)
{
return RequestType == other.RequestType;
}
return false;
}

#endregion
}
}
6 changes: 3 additions & 3 deletions AuroraNative/AuroraNative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AssemblyVersion>1.1.3.0415</AssemblyVersion>
<FileVersion>1.1.3.0415</FileVersion>
<AssemblyVersion>1.2.0.0503</AssemblyVersion>
<FileVersion>1.2.0.0503</FileVersion>
<PackageIcon>Icon.png</PackageIcon>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
<AssemblyName>AuroraNative</AssemblyName>
<RootNamespace>AuroraNative</RootNamespace>
<Version>1.1.3-Beta</Version>
<Version>1.2.0-Beta</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
Expand Down
51 changes: 51 additions & 0 deletions AuroraNative/AuroraNative.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions AuroraNative/Enum/RequestType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace AuroraNative.Enum
{
/// <summary>
/// 请求事件 枚举
/// </summary>
public enum RequestType
{
/// <summary>
/// 加好友
/// </summary>
friend = 1,
/// <summary>
/// 加群
/// </summary>
group = 2
}
}
5 changes: 4 additions & 1 deletion AuroraNative/Utils/Event.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AuroraNative.Enum;
using AuroraNative.Attributes;
using AuroraNative.Enum;
using AuroraNative.EventArgs;
using AuroraNative.WebSockets;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -60,13 +61,15 @@ public virtual void GroupMessage(GroupMessageArgs e) { }
/// </summary>
/// <param name="e">好友请求参数</param>
[PostType(PostType.Request)]
[RequestType(RequestType.friend)]
public virtual void FriendAddRequest(FriendAddRequsetArgs e) { }

/// <summary>
/// 请求事件 - 群请求
/// </summary>
/// <param name="e">群请求参数</param>
[PostType(PostType.Request)]
[RequestType(RequestType.group)]
public virtual void GroupAddRequest(GroupAddRequestArgs e) { }

#endregion
Expand Down

0 comments on commit 932ae3c

Please sign in to comment.