Commit 0ca05810 authored by 潘栩锋's avatar 潘栩锋 🚴

修改 RevCtrl_Proxy 继承于 Reflect_Proxy, 全部 代理服务逻辑写再 WsServiceProxy

parent 1b3c276f
......@@ -34,8 +34,8 @@ namespace WSCF.RevCtrl.Test.Server
public void SendMsgToGroupChat(string msg, AsyncCBHandler asyncDelegate, object asyncContext)
{
var cc = asyncContext as WSCF.RevCtrl.CC;
var customerContext = customerContexts.Find(c => c.revCtrl_Proxy == cc.revCtrl_Proxy);
var cc = asyncContext as WSCF.CC;
var customerContext = customerContexts.Find(c => c.revCtrl_Proxy == cc.proxy);
if (customerContext == null) {
//异常,居然之前没有记录
throw new Exception("有人在群聊,居然之前没有记录");
......@@ -56,8 +56,8 @@ namespace WSCF.RevCtrl.Test.Server
public void SendMsgToPrivateChat(string targetGuid, string msg, AsyncCBHandler asyncDelegate, object asyncContext)
{
var cc = asyncContext as WSCF.RevCtrl.CC;
var customerContext = customerContexts.Find(c => c.revCtrl_Proxy == cc.revCtrl_Proxy);
var cc = asyncContext as WSCF.CC;
var customerContext = customerContexts.Find(c => c.revCtrl_Proxy == cc.proxy);
if (customerContext == null)
{
//异常,居然之前没有记录
......@@ -80,10 +80,10 @@ namespace WSCF.RevCtrl.Test.Server
asyncDelegate?.Invoke(asyncContext, new SendMsgToPrivateChatReponse() { isSuccess = true });
}
public void OnOpen(RevCtrl_Proxy behavior)
public void OnOpen(RevCtrl_Proxy proxy)
{
//有人上线了
var customerContext = customerContexts.Find(cc => cc.revCtrl_Proxy == behavior);
var customerContext = customerContexts.Find(cc => cc.revCtrl_Proxy == proxy);
if (customerContext == null)
{
//这是个新顾客
......@@ -101,13 +101,13 @@ namespace WSCF.RevCtrl.Test.Server
updateCustomerInfos();
}
};
behavior.AddClient("Customer", customer);
proxy.AddClient("Customer", customer);
//记录这个顾客的上下文
customerContext = new CustomerContext()
{
revCtrl_Proxy = behavior,
revCtrl_Proxy = proxy,
customer = customer,
guid = Guid.NewGuid().ToString()
};
......@@ -140,10 +140,10 @@ namespace WSCF.RevCtrl.Test.Server
}
public void OnClose(RevCtrl_Proxy behavior)
public void OnClose(RevCtrl_Proxy proxy)
{
//有人下线了
var customerContext = customerContexts.Find(cc => cc.revCtrl_Proxy == behavior);
var customerContext = customerContexts.Find(cc => cc.revCtrl_Proxy == proxy);
if (customerContext == null)
{
//异常,居然之前没有记录
......@@ -159,9 +159,9 @@ namespace WSCF.RevCtrl.Test.Server
}
}
public void OnDispose(RevCtrl_Proxy behavior)
public void OnDispose(RevCtrl_Proxy proxy)
{
OnClose(behavior);
OnClose(proxy);
}
}
......
......@@ -7,7 +7,7 @@ using WSCF.RevCtrl.Test.IService;
namespace WSCF.RevCtrl.Test.Server.ServiceClient
{
public class CustomerServiceClient: WsSeviceClient,ICustomerService
public class CustomerServiceClient: WsServiceClient,ICustomerService
{
protected override Type InterfaceType => typeof(ICustomerService);
......
......@@ -9,7 +9,7 @@
<PackageProjectUrl>http://private.flyautomation.net:82/panruising/wscf</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>2.0.1</Version>
<Version>2.1.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
......@@ -25,7 +25,9 @@
<Compile Include="..\WSCF\Reflect_Proxy.cs" Link="Reflect_Proxy.cs" />
<Compile Include="..\WSCF\Reflect_SeviceClient.cs" Link="Reflect_SeviceClient.cs" />
<Compile Include="..\WSCF\WebSocketClient.cs" Link="WebSocketClient.cs" />
<Compile Include="..\WSCF\ReflectSeviceClientCore.cs" Link="ReflectSeviceClientCore.cs" />
<Compile Include="..\WSCF\IReflectSeviceClientCore.cs" Link="IReflectSeviceClientCore.cs" />
<Compile Include="..\WSCF\WsServiceProxy.cs" Link="WsServiceProxy.cs" />
<Compile Include="..\WSCF\WsServiceClient.cs" Link="WsServiceClient.cs" />
</ItemGroup>
<ItemGroup>
......@@ -35,4 +37,10 @@
<PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\WSCF\RevCtrl\IRevCtrlAdmin.cs" Link="RevCtrl\IRevCtrlAdmin.cs" />
<Compile Include="..\WSCF\RevCtrl\RevCtrl_Proxy.cs" Link="RevCtrl\RevCtrl_Proxy.cs" />
<Compile Include="..\WSCF\RevCtrl\RevCtrl_ServiceClient.cs" Link="RevCtrl\RevCtrl_ServiceClient.cs" />
</ItemGroup>
</Project>
......@@ -27,7 +27,7 @@ namespace WSCF
bool IsInPushValue { get; set; }
}
public class ReflectSeviceClientAssistant: IDisposable
class ReflectSeviceClientAssistant: IDisposable
{
public event PropertyChangedEventHandler PropertyChanged;
......
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
......@@ -7,7 +7,7 @@ using System.Linq;
using System.Reflection;
using WebSocketSharp;
using WebSocketSharp.Server;
using static WSCF.Reflect_OBJ_INTERFACE;
namespace WSCF
{
......@@ -28,444 +28,49 @@ namespace WSCF
/// public event EventHandler TempFrameChanged;
///
/// </summary>
public class Reflect_Proxy : WebSocketBehavior, IDisposable
public class Reflect_Proxy:WebSocketBehavior, IDisposable
{
static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
#region Core
/// <summary>
/// 对象的接口类型
/// </summary>
Type interfaceType;
/// <summary>
/// 代理对象
/// </summary>
object obj;
/// <summary>
/// 忽略设置
/// </summary>
public bool ignoreSet = false;
/// <summary>
/// 对象的全部event
/// </summary>
List<AnyEvent> anyEvents = new List<AnyEvent>();
/// <summary>
/// [PropertyPush] 标签树
/// </summary>
SubPropertyNode rootNode;
/// <summary>
/// interfaceType 及其父类 的全部属性
/// 服务器中, 提供的全部服务
/// </summary>
List<string> properties = new List<string>();
#endregion
public bool isAlive = false;
protected WsServiceProxy Proxy;
public Reflect_Proxy()
{
}
#region Core
public void Init(Type interfaceType, object obj)
{
this.interfaceType = interfaceType;
this.obj = obj;
rootNode = new SubPropertyNode
{
Obj = obj,
InterfaceType = interfaceType,
SubPropertyChanged = Sub_PropertyChanged
};
//注册 obj 的PropertyChanged 事件,获取 interfaceType 全部属性名称,包括它的父类的全部属性名称
InitPropertyChanged();
//处理[PropertyPush]
COMMON.InitPropertyPush(rootNode);
//处理[Push]
InitEventPush();
}
void InitPropertyChanged()
{
if (!typeof(INotifyPropertyChanged).IsAssignableFrom(interfaceType))
return;
//继承了INotifyPropertyChanged
((INotifyPropertyChanged)(this.obj)).PropertyChanged += rootNode.PropertyChanged;
var propertyInfos = COMMON.GetAllPropertyInfos(this.interfaceType);//获取全部属性, 包括父类的属性
foreach (var propertyInfo in propertyInfos)
{
if (propertyInfo.GetCustomAttribute<JsonIgnoreAttribute>() != null)
continue;//这个不需要推送
if (properties.Contains(propertyInfo.Name))
continue;
properties.Add(propertyInfo.Name);
}
}
void InitEventPush()
{
var interfaceTypes = new List<Type>();
interfaceTypes.Add(this.interfaceType);
interfaceTypes.AddRange(this.interfaceType.GetInterfaces());
var eventInfos = new List<EventInfo>();
foreach (var ifaceType in interfaceTypes)
{
eventInfos.AddRange(ifaceType.GetEvents());
}
foreach (var eventInfo in eventInfos)
{
var pushAttribute = eventInfo.GetCustomAttribute<PushAttribute>();
if (pushAttribute == null)
continue;
if (anyEvents.Any(ae => ae.eventName == eventInfo.Name))
continue;//已经添加了
var anyEvent = new AnyEvent()
{
eventName = eventInfo.Name,
PushObjInfoEx = (rd) => reponse_PushObjInfoEx(rd, true)
};
//这个事件需要推送
eventInfo.AddEventHandler(obj, anyEvent.eventHandler);
anyEvents.Add(anyEvent);
}
}
void Sub_PropertyChanged(SubPropertyNode node, PropertyChangedEventArgs e)
{
//if (ignoreSet)//从服务器接收的数据,不用再推送给服务器
// return;
var type = node.Obj.GetType();
var propertyInfo = type.GetProperty(e.PropertyName);
if (propertyInfo == null)
return;//获取失败!!!
if (propertyInfo.GetCustomAttribute<JsonIgnoreAttribute>() != null)
return;//这个不需要推送
var v = propertyInfo.GetValue(node.Obj);
var jObject = new JObject();
if (v == null)
jObject.Add(propertyInfo.Name, null);
else
jObject.Add(propertyInfo.Name, JToken.FromObject(v));
var rData = new Reflect_OBJ_INTERFACE.ReflectData
{
name = COMMON.GetNodePath(node),
data = jObject
};
reponse_PushObjInfoEx(rData, false);
var proxy = new WsServiceProxy();
proxy.Init(interfaceType, obj);
proxy.SetSendEx(SendTo, null);
Proxy = proxy;
}
Reflect_OBJ_INTERFACE.ReflectData request_CALL_GetAllProperties()
{
var jObject = new JObject();
var type = obj.GetType();
foreach (var propertyName in properties)
{
var propertyInfo = type.GetProperty(propertyName);
var v = propertyInfo.GetValue(obj);
if (v == null)
jObject.Add(propertyInfo.Name, null);
else
jObject.Add(propertyInfo.Name, JToken.FromObject(v));
}
var rData = new Reflect_OBJ_INTERFACE.ReflectData
{
data = jObject
};
return rData;
}
void request_CALL_SetProperty(Reflect_OBJ_INTERFACE.ReflectData rData)
protected override void OnMessage(MessageEventArgs e)
{
//ignoreSet = true;
//sub property
var node = COMMON.FindNode(rootNode, rData.name);
if (node == null)
{
//异常
//客户端乱发过来
if (!e.IsText)
return;
}
string json = e.Data;
string json = rData.data.ToString();
JsonConvert.PopulateObject(json, node.Obj);
var pkgData = Newtonsoft.Json.JsonConvert.DeserializeObject<PkgData>(json);
//ignoreSet = false;
}
void request_CALL_MethodInvoke(Reflect_OBJ_INTERFACE.ReflectData rData, CC cc)
{
var type = obj.GetType();
var paramNames_req = rData.data.Children().OfType<JProperty>().Select(p => p.Name);
MethodInfo methodInfo = GetMethodInfo(type, rData.name, paramNames_req);
if (methodInfo == null)
{
//不能找到,
throw new Exception($"程序写错了, 不能找到 rData.name={rData.name} 或者 参数名称不对,没法完全匹配");
}
//客户端 向 服务器 中的 服务 请求
Proxy.OnMessage(this, pkgData);
var parameterInfos = methodInfo.GetParameters();
object[] parameters = new object[parameterInfos.Count()];
for (int i = 0; i < parameters.Count(); i++)
{
var ptype = parameterInfos[i].ParameterType;
var pname = parameterInfos[i].Name;
if (string.Compare(pname, Reflect_OBJ_INTERFACE.paramName_asyncDelegate, true) == 0)
{
parameters[i] = new AsyncCBHandler(asyncDelegate);
}
else if (string.Compare(pname, Reflect_OBJ_INTERFACE.paramName_asyncContext, true) == 0)
{
cc.methodName = rData.name;
parameters[i] = cc;
}
else
{
parameters[i] = rData.data[pname].ToObject(ptype);
}
}
methodInfo.Invoke(obj, parameters);
}
void asyncDelegate(object asyncContext, object retData)
{
var cc = (CC)asyncContext;
var rData = new Reflect_OBJ_INTERFACE.ReflectData()
{
name = cc.methodName,
data = retData == null ? null : JToken.FromObject(retData)
};
reponse_CALL_MethodInvoke(rData, cc);
}
MethodInfo GetMethodInfo(Type type, string name, IEnumerable<string> parameterNames)
public virtual void SendTo(string msg)
{
var methodInfos = from mi in type.GetMethods() where mi.Name == name select mi;
if (methodInfos.Count() == 0)
return null;
if (methodInfos.Count() == 1)
return methodInfos.First();
//必须完全匹配
foreach (var methodInfo in methodInfos)
{
var parameterInfos = methodInfo.GetParameters();
//全部参数名称
var names = parameterInfos.Select(pi => pi.Name).ToList();
//删除掉 asyncDelegate,asyncContext
names.Remove(Reflect_OBJ_INTERFACE.paramName_asyncDelegate);
names.Remove(Reflect_OBJ_INTERFACE.paramName_asyncContext);
var names_req = parameterNames;
if (names.Count() != names_req.Count())
continue;//数量不一致,肯定不同
var sames = names_req.Intersect(names);
if (sames.Count() != names_req.Count())
continue;// names 与 names_req 的交集数量与names_req不一样,肯定不同
//就是它
return methodInfo;
}
return null;
base.Send(msg);
}
public void Dispose()
{
if (typeof(INotifyPropertyChanged).IsAssignableFrom(interfaceType))
{
//继承了INotifyPropertyChanged
((INotifyPropertyChanged)(this.obj)).PropertyChanged -= rootNode.PropertyChanged;
}
//释放subProperties
COMMON.NodeDispose(rootNode);
}
#endregion
void reponse_PushObjInfoEx(Reflect_OBJ_INTERFACE.ReflectData rData, bool isEvent)
{
//数据推送!!!
//再嵌套
var pkgName = isEvent ? Reflect_OBJ_INTERFACE.PkgName.PUSH_Event : Reflect_OBJ_INTERFACE.PkgName.PUSH_PropertyChanged;
Reflect_OBJ_INTERFACE.PkgData pkgData = new Reflect_OBJ_INTERFACE.PkgData()
{
guid = Guid.NewGuid().ToString(),
name = pkgName.ToString(),
data = JToken.FromObject(rData)
};
string json = JsonConvert.SerializeObject(pkgData);
SendEx(json);
}
void reponse_CALL_MethodInvoke(Reflect_OBJ_INTERFACE.ReflectData rData, CC cc)
{
Reflect_OBJ_INTERFACE.PkgData pkgData = new Reflect_OBJ_INTERFACE.PkgData()
{
guid = cc.guid,
name = Reflect_OBJ_INTERFACE.PkgName.CALL_MethodInvoke.ToString(),
data = JToken.FromObject(rData)
};
string json = JsonConvert.SerializeObject(pkgData);
SendEx(json);
}
void reponse_CALL_GetAllProperties(Reflect_OBJ_INTERFACE.ReflectData rData, CC cc)
{
Reflect_OBJ_INTERFACE.PkgData pkgData = new Reflect_OBJ_INTERFACE.PkgData()
{
guid = cc.guid,
name = Reflect_OBJ_INTERFACE.PkgName.CALL_GetAllProperties.ToString(),
data = JToken.FromObject(rData)
};
string json = JsonConvert.SerializeObject(pkgData);
SendEx(json);
}
void OnMessage(Reflect_OBJ_INTERFACE.PkgData pkgData)
{
var pkgName = Enum.Parse(typeof(Reflect_OBJ_INTERFACE.PkgName), pkgData.name);
switch (pkgName)
{
case Reflect_OBJ_INTERFACE.PkgName.CALL_GetAllProperties:
{
var rData = request_CALL_GetAllProperties();
reponse_CALL_GetAllProperties(rData, new CC() { guid = pkgData.guid });
}
break;
case Reflect_OBJ_INTERFACE.PkgName.CALL_SetProperty:
{
//ignoreSet = true;
var rData = pkgData.data.ToObject<Reflect_OBJ_INTERFACE.ReflectData>();
request_CALL_SetProperty(rData);
}
break;
case Reflect_OBJ_INTERFACE.PkgName.CALL_MethodInvoke:
{
var rData = pkgData.data.ToObject<Reflect_OBJ_INTERFACE.ReflectData>();
request_CALL_MethodInvoke(rData, new CC() { guid = pkgData.guid });
}
break;
}
}
class CC
{
public string guid;
/// <summary>
/// CALL_MethodInvoke 时使用
/// </summary>
public string methodName;
}
void SendEx(string msg)
{
try
{
Send(msg);
}
catch (Exception e)
{
//异常,通常是断开了!!
logger.Error(e);
}
}
protected override void OnOpen()
{
base.OnOpen();
isAlive = true;
AfterOpen?.Invoke(this);
}
public Action<Reflect_Proxy> AfterOpen;
protected override void OnClose(CloseEventArgs e)
{
base.OnClose(e);
isAlive = false;
Dispose();
}
protected override void OnMessage(MessageEventArgs e)
{
if (!e.IsText)
return;
string json = e.Data;
var p = JsonConvert.DeserializeObject<Reflect_OBJ_INTERFACE.PkgData>(json);
OnMessage(p);
}
}
/// <summary>
/// 事件推送包装
/// </summary>
class AnyEvent
{
/// <summary>
/// 事件名称
/// </summary>
public string eventName;
/// <summary>
/// json包装后的ReflectData 推送
/// </summary>
public Action<Reflect_OBJ_INTERFACE.ReflectData> PushObjInfoEx;
/// <summary>
/// 给 EventInfo 调用
/// </summary>
public EventHandler eventHandler;
public AnyEvent()
{
eventHandler = new EventHandler(Obj_AnyEvent);
}
void Obj_AnyEvent(object sender, EventArgs e)
{
var rData = new Reflect_OBJ_INTERFACE.ReflectData()
{
name = eventName,
data = JObject.FromObject(e)
};
PushObjInfoEx?.Invoke(rData);
Proxy.Dispose();
}
}
}
......@@ -11,9 +11,10 @@ namespace WSCF.RevCtrl
/// </summary>
public interface IRevCtrlAdmin
{
void OnOpen(RevCtrl_Proxy revCtrl_Proxy);
void OnClose(RevCtrl_Proxy revCtrl_Proxy);
void OnOpen(RevCtrl_Proxy proxy);
void OnDispose(RevCtrl_Proxy revCtrl_Proxy);
void OnClose(RevCtrl_Proxy proxy);
void OnDispose(RevCtrl_Proxy proxy);
}
}
......@@ -10,21 +10,16 @@ using static WSCF.Reflect_OBJ_INTERFACE;
namespace WSCF.RevCtrl
{
public class RevCtrl_Proxy : WebSocketBehavior, IDisposable
public class RevCtrl_Proxy : Reflect_Proxy
{
public event PropertyChangedEventHandler PropertyChanged;
public bool IsConnected { get; private set; }
public bool IsConnected { get; set; }
/// <summary>
/// 服务器中, 提供的全部服务
/// </summary>
WsServiceProxy Proxy;
IRevCtrlAdmin admin;
/// <summary>
/// 服务器中,反向控制客户端,对于客户端每个服务的客户端
/// </summary>
Dictionary<string, WsSeviceClient> Clients = new Dictionary<string, WsSeviceClient>();
Dictionary<string, WsServiceClient> Clients = new Dictionary<string, WsServiceClient>();
public RevCtrl_Proxy()
......@@ -34,10 +29,7 @@ namespace WSCF.RevCtrl
public void Init(Type interfaceType, IRevCtrlAdmin admin)
{
this.admin = admin;
var proxy = new WsServiceProxy();
proxy.Init(interfaceType, admin);
proxy.SetSendEx(SendTo, null);
Proxy = proxy;
base.Init(interfaceType, admin);
}
protected override void OnOpen()
......@@ -102,14 +94,14 @@ namespace WSCF.RevCtrl
public void SendTo(string msg)
public override void SendTo(string msg)
{
if (IsConnected == false)
return;
base.Send(msg);
}
public void AddClient(string serviceName, WsSeviceClient client)
public void AddClient(string serviceName, WsServiceClient client)
{
client.SetSendEx(SendTo, serviceName);
Clients.Add(serviceName, client);
......@@ -119,12 +111,5 @@ namespace WSCF.RevCtrl
}
}
public void Dispose()
{
//TODO
//卸载全部
//Proxys, 与 Clients
}
}
}
......@@ -56,6 +56,5 @@ namespace WSCF.RevCtrl
proxy.OnMessage(null, pkgData);
}
}
}
}
......@@ -48,7 +48,7 @@
<Compile Include="RevCtrl\RevCtrl_ServiceClient.cs" />
<Compile Include="RevCtrl\RevCtrl_Proxy.cs" />
<Compile Include="RevCtrl\IRevCtrlAdmin.cs" />
<Compile Include="WsSeviceClient.cs" />
<Compile Include="WsServiceClient.cs" />
<Compile Include="WsServiceProxy.cs" />
<Compile Include="CallAttribute.cs" />
<Compile Include="COMMON.cs" />
......@@ -58,7 +58,7 @@
<Compile Include="Reflect_Proxy.cs" />
<Compile Include="Reflect_SeviceClient.cs" />
<Compile Include="WebSocketClient.cs" />
<Compile Include="ReflectSeviceClientCore.cs" />
<Compile Include="IReflectSeviceClientCore.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
......
......@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace WSCF.RevCtrl
{
public abstract class WsSeviceClient : IReflectSeviceClientCore
public abstract class WsServiceClient : IReflectSeviceClientCore
{
public event PropertyChangedEventHandler PropertyChanged;
......@@ -38,7 +38,7 @@ namespace WSCF.RevCtrl
ReflectSeviceClientAssistant assistant;
public WsSeviceClient()
public WsServiceClient()
{
assistant = new ReflectSeviceClientAssistant();
assistant.Init(InterfaceType, this);
......
......@@ -5,11 +5,9 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using WebSocketSharp;
using WebSocketSharp.Server;
using static WSCF.Reflect_OBJ_INTERFACE;
namespace WSCF.RevCtrl
namespace WSCF
{
/// <summary>
/// obj 服务代理;
......@@ -227,7 +225,7 @@ namespace WSCF.RevCtrl
//ignoreSet = false;
}
void request_CALL_MethodInvoke(ReflectData rData, string guid, RevCtrl_Proxy revCtrl_Proxy)
void request_CALL_MethodInvoke(ReflectData rData, string guid, Reflect_Proxy proxy)
{
var type = obj.GetType();
var paramNames_req = rData.data.Children().OfType<JProperty>().Select(p => p.Name);
......@@ -250,7 +248,7 @@ namespace WSCF.RevCtrl
}
else if (string.Compare(pname, Reflect_OBJ_INTERFACE.paramName_asyncContext, true) == 0)
{
parameters[i] = new CC() { revCtrl_Proxy = revCtrl_Proxy, guid = guid, methodName = rData.name };
parameters[i] = new CC() { proxy = proxy, guid = guid, methodName = rData.name };
}
else
{
......@@ -368,7 +366,7 @@ namespace WSCF.RevCtrl
#region WsService 调用
public void OnMessage(RevCtrl_Proxy revCtrl_Proxy, PkgData pkgData)
public void OnMessage(Reflect_Proxy proxy, PkgData pkgData)
{
var pkgName = Enum.Parse(typeof(PkgName), pkgData.name);
switch (pkgName)
......@@ -392,7 +390,7 @@ namespace WSCF.RevCtrl
{
var rData = pkgData.data.ToObject<ReflectData>();
request_CALL_MethodInvoke(rData, pkgData.guid, revCtrl_Proxy);
request_CALL_MethodInvoke(rData, pkgData.guid, proxy);
}
break;
......@@ -430,7 +428,7 @@ namespace WSCF.RevCtrl
/// <summary>
/// json包装后的ReflectData 推送
/// </summary>
public Action<Reflect_OBJ_INTERFACE.ReflectData> PushObjInfoEx;
public Action<ReflectData> PushObjInfoEx;
/// <summary>
/// 给 EventInfo 调用
/// </summary>
......@@ -441,7 +439,7 @@ namespace WSCF.RevCtrl
}
void Obj_AnyEvent(object sender, EventArgs e)
{
var rData = new Reflect_OBJ_INTERFACE.ReflectData()
var rData = new ReflectData()
{
name = eventName,
data = JObject.FromObject(e)
......@@ -455,7 +453,8 @@ namespace WSCF.RevCtrl
/// <summary>
/// 连接
/// </summary>
public RevCtrl_Proxy revCtrl_Proxy;
public Reflect_Proxy proxy;
public string guid;
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment