Skip to content

Commit 680edb4

Browse files
committed
Релиз 2.0.1.0
1 parent dc4b6fd commit 680edb4

6 files changed

Lines changed: 8761 additions & 40 deletions

File tree

OneScriptClientServer/OneScriptClientServer/ServiceApplication.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,10 @@ public ArrayImpl Clients
482482
}
483483

484484
[ContextProperty("ПриОтключенииКлиента", "ClientDisconnected")]
485-
public DelegateAction ClientDisconnected { get; set; }
485+
public IValue ClientDisconnected { get; set; }
486486

487487
[ContextProperty("ПриПодключенииКлиента", "ClientConnected")]
488-
public DelegateAction ClientConnected { get; set; }
488+
public IValue ClientConnected { get; set; }
489489

490490
[ContextProperty("Результат", "Resalt")]
491491
public IValue Resalt

OneScriptClientServer/OneScriptClientServer/ServiceClient.cs

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,52 @@ private void M_ServiceClient_Connected(object sender, System.EventArgs e)
151151

152152
if (dll_obj.Connected != null)
153153
{
154-
try
154+
IValue Action1 = dll_obj.Connected;
155+
if (Action1 != null)
155156
{
156-
dll_obj.Connected.CallAsProcedure(0, null);
157+
if (Action1.GetType() == typeof(CsAction))
158+
{
159+
ReflectorContext reflector = new ReflectorContext();
160+
try
161+
{
162+
reflector.CallMethod(((CsAction)Action1).Script, ((CsAction)Action1).MethodName, null);
163+
}
164+
catch { }
165+
}
166+
else
167+
{
168+
try
169+
{
170+
((DelegateAction)Action1).CallAsProcedure(0, null);
171+
}
172+
catch { }
173+
}
157174
}
158-
catch { }
159175
}
160176
}
161177

162178
private void M_ServiceClient_Disconnected(object sender, System.EventArgs e)
163179
{
164-
if (dll_obj.Disconnected != null)
180+
IValue Action1 = dll_obj.Disconnected;
181+
if (Action1 != null)
165182
{
166-
try
183+
if (Action1.GetType() == typeof(CsAction))
184+
{
185+
ReflectorContext reflector = new ReflectorContext();
186+
try
187+
{
188+
reflector.CallMethod(((CsAction)Action1).Script, ((CsAction)Action1).MethodName, null);
189+
}
190+
catch { }
191+
}
192+
else
167193
{
168-
dll_obj.Disconnected.CallAsProcedure(0, null);
194+
try
195+
{
196+
((DelegateAction)Action1).CallAsProcedure(0, null);
197+
}
198+
catch { }
169199
}
170-
catch { }
171200
}
172201
}
173202

@@ -362,10 +391,10 @@ public StructureImpl Tag
362391
}
363392

364393
[ContextProperty("ПриОтключении", "Disconnected")]
365-
public DelegateAction Disconnected { get; set; }
394+
public IValue Disconnected { get; set; }
366395

367396
[ContextProperty("ПриПодключении", "Connected")]
368-
public DelegateAction Connected { get; set; }
397+
public IValue Connected { get; set; }
369398

370399
[ContextProperty("Результат", "Resalt")]
371400
public IValue Resalt
@@ -451,29 +480,10 @@ public void Connect()
451480
{
452481
Base_obj.Connect();
453482
}
454-
455-
456-
457-
//=======================================
458-
private object _lock3 = new object();
483+
459484
[ContextMethod("ПолучитьИнформациюКлиентов", "GetClientsInfo")]
460485
public ArrayImpl GetClientsInfo()
461486
{
462-
//ArrayImpl arrayImpl = new ArrayImpl();
463-
//lock (_lock3)
464-
//{
465-
// ClientInfo[] array = Base_obj.Proxy.GetClientsList();
466-
// for (int i = 0; i < array.Length; i++)
467-
// {
468-
// ClientInfo ClientInfo1 = (ClientInfo)array[i];
469-
// CsClientInfo CsClientInfo1 = new CsClientInfo(ClientInfo1.ClientGuid, ClientInfo1.ClientName, ClientInfo1.Tag);
470-
// arrayImpl.Add(CsClientInfo1);
471-
// }
472-
//}
473-
//return arrayImpl;
474-
475-
476-
477487
ClientInfo[] array = Base_obj.Proxy.GetClientsList();
478488
ArrayImpl arrayImpl = new ArrayImpl();
479489
for (int i = 0; i < array.Length; i++)

OneScriptClientServer/OneScriptClientServer/ServiceClientEventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public CsServiceClientEventArgs(Hik.Communication.ScsServices.Service.ServiceCli
7676

7777

7878
[ContextProperty("Действие", "EventAction")]
79-
public DelegateAction EventAction
79+
public IValue EventAction
8080
{
8181
get { return Base_obj.EventAction; }
8282
set { Base_obj.EventAction = value; }

OneScriptClientServer/OneScriptClientServer/TcpClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,16 @@ public CsTcpClient(CsTcpEndPoint p1)
119119
public TcpClient Base_obj;
120120

121121
[ContextProperty("ПриОтключении", "Disconnected")]
122-
public DelegateAction Disconnected { get; set; }
122+
public IValue Disconnected { get; set; }
123123

124124
[ContextProperty("ПриОтправкеСообщения", "MessageSent")]
125-
public DelegateAction MessageSent { get; set; }
125+
public IValue MessageSent { get; set; }
126126

127127
[ContextProperty("ПриПодключении", "Connected")]
128-
public DelegateAction Connected { get; set; }
128+
public IValue Connected { get; set; }
129129

130130
[ContextProperty("ПриПолученииСообщения", "MessageReceived")]
131-
public DelegateAction MessageReceived { get; set; }
131+
public IValue MessageReceived { get; set; }
132132

133133
[ContextProperty("СостояниеСоединения", "CommunicationState")]
134134
public int CommunicationState

OneScriptClientServer/OneScriptClientServer/TcpServer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Hik.Communication.Scs.Communication.EndPoints.Tcp;
66
using Hik.Communication.Scs.Communication.Channels;
77
using Hik.Communication.Scs.Communication.Channels.Tcp;
8+
using ScriptEngine.Machine;
89

910
namespace Hik.Communication.Scs.Server.Tcp
1011
{
@@ -128,20 +129,20 @@ public ArrayImpl Clients
128129
}
129130

130131
[ContextProperty("ПриОтключенииКлиента", "ClientDisconnected")]
131-
public DelegateAction ClientDisconnected { get; set; }
132+
public IValue ClientDisconnected { get; set; }
132133

133134
[ContextProperty("ПриОтправкеСообщения", "MessageSent")]
134-
public DelegateAction MessageSent
135+
public IValue MessageSent
135136
{
136137
get { return OneScriptClientServer.ServerMessageSent; }
137138
set { OneScriptClientServer.ServerMessageSent = value; }
138139
}
139140

140141
[ContextProperty("ПриПодключенииКлиента", "ClientConnected")]
141-
public DelegateAction ClientConnected { get; set; }
142+
public IValue ClientConnected { get; set; }
142143

143144
[ContextProperty("ПриПолученииСообщения", "MessageReceived")]
144-
public DelegateAction MessageReceived
145+
public IValue MessageReceived
145146
{
146147
get { return OneScriptClientServer.ServerMessageReceived; }
147148
set { OneScriptClientServer.ServerMessageReceived = value; }

0 commit comments

Comments
 (0)