mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-20 11:09:35 +08:00
项目结构调整
This commit is contained in:
parent
4664bfbc29
commit
ea682b90ff
@ -1,8 +1,8 @@
|
||||
using System.Collections;
|
||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Library.Exception;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Transmittal
|
||||
{
|
||||
@ -78,6 +78,16 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
|
||||
Worker.SendRequest();
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步向服务器发送数据请求
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<RequestResult> SendRequestAsync()
|
||||
{
|
||||
await Worker.SendRequestAsync();
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定key对应的反序列化对象
|
||||
@ -90,7 +100,7 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
|
||||
return GetHashtableJsonObject<T>(Worker.ResultData, key);
|
||||
}
|
||||
|
||||
private class Request : BaseSocketHandlerModel
|
||||
private class Request : SocketHandlerModel
|
||||
{
|
||||
public Hashtable RequestData { get; } = new();
|
||||
public Hashtable ResultData => _ResultData;
|
||||
@ -204,7 +214,7 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
|
||||
/// <returns></returns>
|
||||
public static T? GetHashtableJsonObject<T>(Hashtable hashtable, string key)
|
||||
{
|
||||
return Utility.NetworkUtility.JsonDeserializeFromHashtable<T>(hashtable, key);
|
||||
return Service.JsonManager.GetObject<T>(hashtable, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Net.Mail;
|
||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
using Milimoe.FunGame.Core.Service;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Transmittal
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Data;
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Transmittal
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
/// <returns></returns>
|
||||
public static T? JsonDeserializeFromHashtable<T>(Hashtable hashtable, string key)
|
||||
{
|
||||
return Service.JsonManager.GetObject<T>(hashtable, key);
|
||||
return Transmittal.DataRequest.GetHashtableJsonObject<T>(hashtable, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
namespace Milimoe.FunGame.Core.Controller
|
||||
{
|
||||
public abstract class BaseSocketHandlerController
|
||||
public abstract class SocketHandlerController
|
||||
{
|
||||
/// <summary>
|
||||
/// 重写此方法并调用Model的Dispose方法,否则将无法正常将监听Socket的事件移除!
|
@ -1,6 +1,6 @@
|
||||
using System.Data;
|
||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Interface.Base
|
||||
{
|
||||
|
@ -1,8 +1,10 @@
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
{
|
||||
/// <summary>
|
||||
/// 继承这个类可以获得异步等待的功能
|
||||
/// <para>参考实现 <see cref="BaseSocketHandlerModel"/></para>
|
||||
/// <para>参考实现 <see cref="SocketHandlerModel"/></para>
|
||||
/// </summary>
|
||||
public abstract class AsyncAwaiter<T>
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
namespace Milimoe.FunGame.Core.Model
|
||||
{
|
||||
public class SQLServerInfo
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
namespace Milimoe.FunGame.Core.Model
|
||||
{
|
||||
public class SmtpClientInfo : IMailSender
|
||||
{
|
@ -1,16 +1,17 @@
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||
using Milimoe.FunGame.Core.Service;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
namespace Milimoe.FunGame.Core.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>继承 AsyncWorker 用法:</para>
|
||||
/// <para>继承 AsyncAwaiter 用法:</para>
|
||||
/// <para>1、调用Socket.Send()前,请设置为等待状态:SetWorking();</para>
|
||||
/// <para>2、调用Socket.Send() == Success后,请等待任务完成:WaitForWorkDone();</para>
|
||||
/// <para>3、在其他任何地方修改Working状态,均会使任务终止。</para>
|
||||
/// </summary>
|
||||
public class BaseSocketHandlerModel : AsyncAwaiter<SocketObject>, ISocketHandler, IDisposable
|
||||
public class SocketHandlerModel : AsyncAwaiter<SocketObject>, ISocketHandler, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// 接收到的SocketObject实例
|
||||
@ -26,7 +27,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
/// 继承请调用base构造
|
||||
/// </summary>
|
||||
/// <param name="socket">Socket</param>
|
||||
public BaseSocketHandlerModel(Socket? socket)
|
||||
public SocketHandlerModel(Socket? socket)
|
||||
{
|
||||
if (socket != null)
|
||||
{
|
||||
@ -35,14 +36,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
}
|
||||
else throw new SocketCreateReceivingException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 继承请重写此方法
|
||||
/// </summary>
|
||||
/// <param name="SocketObject">SocketObject</param>
|
||||
public virtual void SocketHandler(SocketObject SocketObject)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
@ -1,10 +1,10 @@
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||
using Milimoe.FunGame.Core.Library.Common.Architecture;
|
||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Library.Exception;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user