Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
3c15e477
Commit
3c15e477
authored
Nov 12, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 FObject.Reflect NodeDispose node.Obj 不是 INotifyPropertyChanged 时,出错
parent
9e6a0e4b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
30 deletions
+68
-30
COMMON.cs
Project.FLY.FObjSys/FObjBaseReflect/COMMON.cs
+1
-1
Reflect_Proxy.cs
Project.FLY.FObjSys/FObjBaseReflect/Reflect_Proxy.cs
+4
-0
Reflect_SeviceClient.cs
Project.FLY.FObjSys/FObjBaseReflect/Reflect_SeviceClient.cs
+63
-29
No files found.
Project.FLY.FObjSys/FObjBaseReflect/COMMON.cs
View file @
3c15e477
...
@@ -224,7 +224,7 @@ namespace FObjBase.Reflect
...
@@ -224,7 +224,7 @@ namespace FObjBase.Reflect
{
{
if
(!
node
.
IsArray
)
if
(!
node
.
IsArray
)
{
{
if
(
node
.
Obj
!=
null
)
if
(
node
.
Obj
!=
null
&&
node
.
Obj
is
INotifyPropertyChanged
)
((
INotifyPropertyChanged
)(
node
.
Obj
)).
PropertyChanged
-=
node
.
PropertyChanged
;
((
INotifyPropertyChanged
)(
node
.
Obj
)).
PropertyChanged
-=
node
.
PropertyChanged
;
}
}
...
...
Project.FLY.FObjSys/FObjBaseReflect/Reflect_Proxy.cs
View file @
3c15e477
...
@@ -379,6 +379,10 @@ namespace FObjBase.Reflect
...
@@ -379,6 +379,10 @@ namespace FObjBase.Reflect
public
IFConn
from
;
public
IFConn
from
;
public
UInt32
srcid
;
public
UInt32
srcid
;
public
UInt32
magic
;
public
UInt32
magic
;
/// <summary>
/// CALL_MethodInvoke 时使用
/// </summary>
public
string
methodName
;
public
string
methodName
;
}
}
}
}
...
...
Project.FLY.FObjSys/FObjBaseReflect/Reflect_SeviceClient.cs
View file @
3c15e477
...
@@ -227,7 +227,7 @@ namespace FObjBase.Reflect
...
@@ -227,7 +227,7 @@ namespace FObjBase.Reflect
name
=
COMMON
.
GetNodePath
(
node
),
name
=
COMMON
.
GetNodePath
(
node
),
data
=
jObject
data
=
jObject
};
};
reponse
_CALL_SetProperty
(
rData
);
send
_CALL_SetProperty
(
rData
);
}
}
...
@@ -252,7 +252,7 @@ namespace FObjBase.Reflect
...
@@ -252,7 +252,7 @@ namespace FObjBase.Reflect
name
=
methodName
,
name
=
methodName
,
data
=
parameters
==
null
?
null
:
JObject
.
FromObject
(
parameters
)
data
=
parameters
==
null
?
null
:
JObject
.
FromObject
(
parameters
)
};
};
reponse
_CALL_MethodInvoke
(
rData
,
asyncDelegate
,
asyncContext
);
send
_CALL_MethodInvoke
(
rData
,
asyncDelegate
,
asyncContext
);
}
}
protected
void
Call
(
string
methodName
,
object
parameters
)
protected
void
Call
(
string
methodName
,
object
parameters
)
...
@@ -265,13 +265,40 @@ namespace FObjBase.Reflect
...
@@ -265,13 +265,40 @@ namespace FObjBase.Reflect
Call
(
methodName
,
null
,
null
,
null
);
Call
(
methodName
,
null
,
null
,
null
);
}
}
void
request_CALL_GetAllProperties
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
/// <summary>
/// 处理 从服务器 回复的 CALL_GetAllProperties
/// </summary>
/// <param name="rData"></param>
void
receive_CALL_GetAllProperties
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
{
{
re
quest
_PUSH_PropertyChanged
(
rData
);
re
ceive
_PUSH_PropertyChanged
(
rData
);
IsSynced
=
true
;
IsSynced
=
true
;
DealPushInfoList
();
DealPushInfoList
();
}
}
void
request_PUSH_PropertyChanged
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
/// <summary>
/// 处理全部 缓存的推送数据
/// </summary>
void
DealPushInfoList
()
{
for
(
int
i
=
0
;
i
<
pushInfoList
.
Count
();
i
++)
{
var
pushInfoData
=
pushInfoList
[
i
];
if
(
pushInfoData
.
isPushPropertyChanged
)
receive_PUSH_PropertyChanged
(
pushInfoData
.
rData
);
else
receive_PUSH_Event
(
pushInfoData
.
rData
);
}
pushInfoList
.
Clear
();
}
/// <summary>
/// 处理 从服务器 回复的 PUSH_PropertyChanged
/// </summary>
/// <param name="rData"></param>
void
receive_PUSH_PropertyChanged
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
{
{
ignoreSet
=
true
;
ignoreSet
=
true
;
IsInPushValue
=
true
;
IsInPushValue
=
true
;
...
@@ -289,7 +316,12 @@ namespace FObjBase.Reflect
...
@@ -289,7 +316,12 @@ namespace FObjBase.Reflect
IsInPushValue
=
false
;
IsInPushValue
=
false
;
ignoreSet
=
false
;
ignoreSet
=
false
;
}
}
void
request_PUSH_Event
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
/// <summary>
/// 处理 从服务器 回复的 PUSH_Event
/// </summary>
/// <param name="rData"></param>
void
receive_PUSH_Event
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
{
{
if
(
InterfaceType
==
null
)
if
(
InterfaceType
==
null
)
return
;
return
;
...
@@ -309,7 +341,14 @@ namespace FObjBase.Reflect
...
@@ -309,7 +341,14 @@ namespace FObjBase.Reflect
//出错,就提示,肯定是客户端忘记写 "Trigger_XXXX"
//出错,就提示,肯定是客户端忘记写 "Trigger_XXXX"
methodInfo
.
Invoke
(
this
,
new
object
[]
{
obj
});
methodInfo
.
Invoke
(
this
,
new
object
[]
{
obj
});
}
}
void
request_CALL_MethodInvoke
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
/// <summary>
/// 处理 从服务器 回复的 CALL_MethodInvoke
/// </summary>
/// <param name="rData"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
void
receive_CALL_MethodInvoke
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
{
var
anyCall
=
anyCalls
.
Find
(
ac
=>
ac
.
name
==
rData
.
name
);
var
anyCall
=
anyCalls
.
Find
(
ac
=>
ac
.
name
==
rData
.
name
);
if
(
anyCall
==
null
)
if
(
anyCall
==
null
)
...
@@ -324,7 +363,14 @@ namespace FObjBase.Reflect
...
@@ -324,7 +363,14 @@ namespace FObjBase.Reflect
}
}
#
endregion
#
endregion
void
reponse_CALL_MethodInvoke
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
/// <summary>
/// 发送 CALL_MethodInvoke 请求到服务器
/// </summary>
/// <param name="rData"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
void
send_CALL_MethodInvoke
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
{
string
json
=
JsonConvert
.
SerializeObject
(
rData
);
string
json
=
JsonConvert
.
SerializeObject
(
rData
);
...
@@ -334,7 +380,11 @@ namespace FObjBase.Reflect
...
@@ -334,7 +380,11 @@ namespace FObjBase.Reflect
asyncDelegate
,
asyncContext
);
asyncDelegate
,
asyncContext
);
}
}
void
reponse_CALL_SetProperty
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
/// <summary>
/// 发送 CALL_SetProperty 请求到服务器
/// </summary>
/// <param name="rData"></param>
void
send_CALL_SetProperty
(
Reflect_OBJ_INTERFACE
.
ReflectData
rData
)
{
{
string
json
=
JsonConvert
.
SerializeObject
(
rData
);
string
json
=
JsonConvert
.
SerializeObject
(
rData
);
...
@@ -386,9 +436,9 @@ namespace FObjBase.Reflect
...
@@ -386,9 +436,9 @@ namespace FObjBase.Reflect
}
}
if
(
infoid
==
Reflect_OBJ_INTERFACE
.
PUSH_PropertyChanged
)
if
(
infoid
==
Reflect_OBJ_INTERFACE
.
PUSH_PropertyChanged
)
re
quest
_PUSH_PropertyChanged
(
rData
);
re
ceive
_PUSH_PropertyChanged
(
rData
);
else
else
re
quest
_PUSH_Event
(
rData
);
re
ceive
_PUSH_Event
(
rData
);
}
}
break
;
break
;
...
@@ -396,22 +446,6 @@ namespace FObjBase.Reflect
...
@@ -396,22 +446,6 @@ namespace FObjBase.Reflect
}
}
/// <summary>
/// 处理全部 缓存的推送数据
/// </summary>
void
DealPushInfoList
()
{
for
(
int
i
=
0
;
i
<
pushInfoList
.
Count
();
i
++)
{
var
pushInfoData
=
pushInfoList
[
i
];
if
(
pushInfoData
.
isPushPropertyChanged
)
request_PUSH_PropertyChanged
(
pushInfoData
.
rData
);
else
request_PUSH_Event
(
pushInfoData
.
rData
);
}
pushInfoList
.
Clear
();
}
public
override
void
PushCallFunction
(
IFConn
from
,
uint
srcid
,
uint
magic
,
ushort
funcid
,
byte
[]
retdata
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
public
override
void
PushCallFunction
(
IFConn
from
,
uint
srcid
,
uint
magic
,
ushort
funcid
,
byte
[]
retdata
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
{
...
@@ -422,7 +456,7 @@ namespace FObjBase.Reflect
...
@@ -422,7 +456,7 @@ namespace FObjBase.Reflect
string
json
=
Misc
.
Converter
.
BytesToString
(
retdata
);
string
json
=
Misc
.
Converter
.
BytesToString
(
retdata
);
var
rData
=
JsonConvert
.
DeserializeObject
<
Reflect_OBJ_INTERFACE
.
ReflectData
>(
json
);
var
rData
=
JsonConvert
.
DeserializeObject
<
Reflect_OBJ_INTERFACE
.
ReflectData
>(
json
);
re
quest
_CALL_GetAllProperties
(
rData
);
re
ceive
_CALL_GetAllProperties
(
rData
);
}
}
break
;
break
;
case
Reflect_OBJ_INTERFACE
.
CALL_MethodInvoke
:
case
Reflect_OBJ_INTERFACE
.
CALL_MethodInvoke
:
...
@@ -433,7 +467,7 @@ namespace FObjBase.Reflect
...
@@ -433,7 +467,7 @@ namespace FObjBase.Reflect
string
json
=
Misc
.
Converter
.
BytesToString
(
retdata
);
string
json
=
Misc
.
Converter
.
BytesToString
(
retdata
);
var
rData
=
JsonConvert
.
DeserializeObject
<
Reflect_OBJ_INTERFACE
.
ReflectData
>(
json
);
var
rData
=
JsonConvert
.
DeserializeObject
<
Reflect_OBJ_INTERFACE
.
ReflectData
>(
json
);
re
quest
_CALL_MethodInvoke
(
rData
,
asyncDelegate
,
asyncContext
);
re
ceive
_CALL_MethodInvoke
(
rData
,
asyncDelegate
,
asyncContext
);
}
}
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment