Skip to content

Commit 12c57fe

Browse files
committed
Новый релиз
1 parent 43e109e commit 12c57fe

55 files changed

Lines changed: 5219 additions & 527 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using ScriptEngine.Machine.Contexts;
2+
using ScriptEngine.Machine;
3+
4+
namespace oscs
5+
{
6+
public class DoAtServerArgs : oscs.EventArgs
7+
{
8+
public new CsDoAtServerArgs dll_obj;
9+
private string methodName;
10+
private ScriptEngine.HostedScript.Library.ArrayImpl parametersArray;
11+
private bool returnResult;
12+
13+
public DoAtServerArgs(string p1, ScriptEngine.HostedScript.Library.ArrayImpl p2, bool p3)
14+
{
15+
methodName = p1;
16+
parametersArray = p2;
17+
returnResult = p3;
18+
}
19+
20+
public string MethodName
21+
{
22+
get { return methodName; }
23+
set { methodName = value; }
24+
}
25+
26+
public ScriptEngine.HostedScript.Library.ArrayImpl ParametersArray
27+
{
28+
get { return parametersArray; }
29+
set { parametersArray = value; }
30+
}
31+
32+
public bool ReturnResult
33+
{
34+
get { return returnResult; }
35+
set { returnResult = value; }
36+
}
37+
}
38+
39+
[ContextClass ("КсВыполнитьНаСервереАрг", "CsDoAtServerArgs")]
40+
public class CsDoAtServerArgs : AutoContext<CsDoAtServerArgs>
41+
{
42+
public CsDoAtServerArgs(DoAtServerArgs p1)
43+
{
44+
DoAtServerArgs DoAtServerArgs1 = p1;
45+
DoAtServerArgs1.dll_obj = this;
46+
Base_obj = DoAtServerArgs1;
47+
}
48+
49+
public oscs.DoAtServerArgs Base_obj;
50+
51+
[ContextProperty("ВернутьРезультат", "ReturnResult")]
52+
public bool ReturnResult
53+
{
54+
get { return Base_obj.ReturnResult; }
55+
}
56+
57+
[ContextProperty("Действие", "EventAction")]
58+
public ScriptEngine.HostedScript.Library.DelegateAction EventAction
59+
{
60+
get { return Base_obj.EventAction; }
61+
set { Base_obj.EventAction = value; }
62+
}
63+
64+
[ContextProperty("ИмяМетода", "MethodName")]
65+
public string MethodName
66+
{
67+
get { return Base_obj.MethodName; }
68+
}
69+
70+
[ContextProperty("МассивПараметров", "ParametersArray")]
71+
public ScriptEngine.HostedScript.Library.ArrayImpl ParametersArray
72+
{
73+
get { return Base_obj.ParametersArray; }
74+
}
75+
76+
[ContextProperty("Отправитель", "Sender")]
77+
public IValue Sender
78+
{
79+
get { return Base_obj.Sender.dll_obj; }
80+
}
81+
82+
}
83+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Hik.Communication.ScsServices.Service;
2+
3+
namespace oscs
4+
{
5+
[ScsService]
6+
public interface IMyService
7+
{
8+
void DoAtServer(string str, System.Collections.ArrayList parametersArray = null);
9+
dynamic DoAtServerWithResalt(string str, System.Collections.ArrayList parametersArray = null);
10+
string ToString();
11+
}
12+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using Hik.Communication.ScsServices.Service;
2+
using ScriptEngine.Machine;
3+
4+
namespace oscs
5+
{
6+
public class MyService : ScsService, IMyService
7+
{
8+
9+
public void DoAtServer(string str, System.Collections.ArrayList parametersArray = null)
10+
{
11+
ScriptEngine.HostedScript.Library.ArrayImpl arrayImpl = null;
12+
if (parametersArray != null)
13+
{
14+
arrayImpl = new ScriptEngine.HostedScript.Library.ArrayImpl();
15+
for (int i = 0; i < parametersArray.Count; i++)
16+
{
17+
dynamic val = (dynamic)parametersArray[i];
18+
if (val.GetType() == typeof(System.Byte[]))
19+
{
20+
var binaryDataContext = new ScriptEngine.HostedScript.Library.Binary.BinaryDataContext(val);
21+
arrayImpl.Add(binaryDataContext);
22+
}
23+
else
24+
{
25+
IValue ival = ValueFactory.Create(val);
26+
arrayImpl.Add(ival);
27+
}
28+
}
29+
}
30+
31+
oscs.OneScriptClientServer.CurrentServiceApplication.ParametersArray = arrayImpl;
32+
oscs.OneScriptClientServer.CurrentServiceApplication.ReturnResult = false;
33+
oscs.OneScriptClientServer.CurrentServiceApplication.MethodName = str;
34+
}
35+
36+
public dynamic DoAtServerWithResalt(string str, System.Collections.ArrayList parametersArray = null)
37+
{
38+
ScriptEngine.HostedScript.Library.ArrayImpl arrayImpl = null;
39+
if (parametersArray != null)
40+
{
41+
arrayImpl = new ScriptEngine.HostedScript.Library.ArrayImpl();
42+
for (int i = 0; i < parametersArray.Count; i++)
43+
{
44+
dynamic val = (dynamic)parametersArray[i];
45+
if (val.GetType() == typeof(System.Byte[]))
46+
{
47+
var binaryDataContext = new ScriptEngine.HostedScript.Library.Binary.BinaryDataContext(val);
48+
arrayImpl.Add(binaryDataContext);
49+
}
50+
else
51+
{
52+
IValue ival = ValueFactory.Create(val);
53+
arrayImpl.Add(ival);
54+
}
55+
}
56+
}
57+
58+
oscs.OneScriptClientServer.CurrentServiceApplication.ParametersArray = arrayImpl;
59+
oscs.OneScriptClientServer.CurrentServiceApplication.ReturnResult = true;
60+
oscs.OneScriptClientServer.CurrentServiceApplication.MethodName = str;
61+
62+
while (oscs.OneScriptClientServer.CurrentServiceApplication.resalt.ToString() == "92b55f72-41f9-4b03-8d64-01c7bd10325f")
63+
{
64+
System.Threading.Thread.Sleep(17);
65+
}
66+
return OneScriptClientServer.DefineTypeIValue(oscs.OneScriptClientServer.CurrentServiceApplication.Resalt);
67+
}
68+
69+
public override string ToString()
70+
{
71+
return base.ToString();
72+
}
73+
}
74+
}

OneScriptClientServer/OneScriptClientServer/OneScriptClientServer.cs

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace oscs
1010
public class OneScriptClientServer : AutoContext<OneScriptClientServer>
1111
{
1212
private static CsCommunicationStates cs_CommunicationStates = new CsCommunicationStates();
13+
public static CsServiceApplication CurrentServiceApplication = null;
1314
public static IValue Event = null;
1415
public static DelegateAction EventAction = null;
1516
public static ConcurrentQueue<dynamic> EventQueue = new ConcurrentQueue<dynamic>();
@@ -26,13 +27,6 @@ public static IRuntimeContextInstance Constructor()
2627

2728
public OneScriptClientServer Base_obj;
2829

29-
[ContextProperty("РежимСтороннегоКлиента", "ThirdPartyClientMode")]
30-
public bool ThirdPartyClientMode
31-
{
32-
get { return thirdPartyClientMode; }
33-
set { thirdPartyClientMode = value; }
34-
}
35-
3630
[ContextProperty("АргументыСобытия", "EventArgs")]
3731
public IValue EventArgs
3832
{
@@ -51,6 +45,13 @@ public bool GoOn
5145
get { return goOn; }
5246
set { goOn = value; }
5347
}
48+
49+
[ContextProperty("РежимСтороннегоКлиента", "ThirdPartyClientMode")]
50+
public bool ThirdPartyClientMode
51+
{
52+
get { return thirdPartyClientMode; }
53+
set { thirdPartyClientMode = value; }
54+
}
5455

5556
[ContextProperty("СостояниеСоединения", "CommunicationStates")]
5657
public CsCommunicationStates CommunicationStates
@@ -76,6 +77,13 @@ public CsTcpServer TcpServer(int p1)
7677
return new CsTcpServer(p1);
7778
}
7879

80+
[ContextMethod("ВызватьМетод", "CallMethod")]
81+
public void CallMethod(IRuntimeContextInstance p1, string p2, ScriptEngine.HostedScript.Library.ArrayImpl p3)
82+
{
83+
ReflectorContext reflector = new ReflectorContext();
84+
reflector.CallMethod(p1, p2, p3);
85+
}
86+
7987
[ContextMethod("ПолучитьСобытие", "DoEvents")]
8088
public ScriptEngine.HostedScript.Library.DelegateAction DoEvents()
8189
{
@@ -95,6 +103,18 @@ public static ScriptEngine.HostedScript.Library.DelegateAction EventHandling()
95103
return EventAction;
96104
}
97105

106+
[ContextMethod("ПриложениеКлиент", "ServiceClient")]
107+
public CsServiceClient ServiceClient(CsTcpEndPoint p1)
108+
{
109+
return new CsServiceClient(p1);
110+
}
111+
112+
[ContextMethod("ПриложениеСервис", "ServiceApplication")]
113+
public CsServiceApplication ServiceApplication(int p1, IRuntimeContextInstance p2)
114+
{
115+
return new CsServiceApplication(p1, p2);
116+
}
117+
98118
[ContextMethod("СообщениеБайты", "ByteMessage")]
99119
public CsByteMessage ByteMessage(ScriptEngine.HostedScript.Library.Binary.BinaryDataContext p1 = null)
100120
{
@@ -133,6 +153,12 @@ public CsNumberMessage NumberMessage(IValue p1 = null)
133153
return new CsNumberMessage(p1);
134154
}
135155

156+
[ContextMethod("ВыполнитьНаСервереАрг", "DoAtServerArgs")]
157+
public CsDoAtServerArgs DoAtServerArgs()
158+
{
159+
return (CsDoAtServerArgs)Event;
160+
}
161+
136162
[ContextMethod("СообщениеАрг", "MessageEventArgs")]
137163
public CsMessageEventArgs MessageEventArgs()
138164
{
@@ -145,6 +171,12 @@ public CsServerClientEventArgs ServerClientEventArgs()
145171
return (CsServerClientEventArgs)Event;
146172
}
147173

174+
[ContextMethod("ПриложениеКлиентАрг", "ServiceClientEventArgs")]
175+
public CsServiceClientEventArgs ServiceClientEventArgs()
176+
{
177+
return (CsServiceClientEventArgs)Event;
178+
}
179+
148180
public static IValue RevertObj(dynamic initialObject)
149181
{
150182
//ScriptEngine.Machine.Values.NullValue NullValue1;
@@ -297,6 +329,10 @@ public static dynamic DefineTypeIValue(dynamic p1)
297329
{
298330
return p1.AsDate();
299331
}
332+
else if (p1.GetType() == typeof(ScriptEngine.HostedScript.Library.Binary.BinaryDataContext))
333+
{
334+
return p1.Buffer;
335+
}
300336
else
301337
{
302338
return p1;

OneScriptClientServer/OneScriptClientServer/OneScriptClientServer.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,20 @@
5353
<Compile Include="ByteMessage.cs" />
5454
<Compile Include="CommunicationStates.cs" />
5555
<Compile Include="DateTimeMessage.cs" />
56+
<Compile Include="DoAtServerArgs.cs" />
5657
<Compile Include="EventArgs.cs" />
58+
<Compile Include="IMyService.cs" />
5759
<Compile Include="MessageEventArgs.cs" />
60+
<Compile Include="MyService.cs" />
5861
<Compile Include="NumberMessage.cs" />
5962
<Compile Include="OneScriptClientServer.cs" />
60-
<Compile Include="PingMessage.cs" />
6163
<Compile Include="Properties\AssemblyInfo.cs" />
6264
<Compile Include="ScsSupport.cs" />
6365
<Compile Include="ServerClient.cs" />
6466
<Compile Include="ServerClientEventArgs.cs" />
67+
<Compile Include="ServiceApplication.cs" />
68+
<Compile Include="ServiceClient.cs" />
69+
<Compile Include="ServiceClientEventArgs.cs" />
6570
<Compile Include="TcpClient.cs" />
6671
<Compile Include="TcpEndPoint.cs" />
6772
<Compile Include="TcpServer.cs" />

OneScriptClientServer/OneScriptClientServer/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("")]
1212
[assembly: AssemblyProduct("OneScriptClientServer")]
13-
[assembly: AssemblyCopyright("Copyright © ahyahy 2022")]
13+
[assembly: AssemblyCopyright("Copyright © ahyahy 2022 - 2023")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -32,5 +32,5 @@
3232
// Можно задать все значения или принять номера сборки и редакции по умолчанию
3333
// используя "*", как показано ниже:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0.0")]
36-
[assembly: AssemblyFileVersion("1.2.0.0")]
35+
[assembly: AssemblyVersion("1.3.0.0")]
36+
[assembly: AssemblyFileVersion("1.3.0.0")]

0 commit comments

Comments
 (0)