Skip to content

Commit 7cfba70

Browse files
committed
Обновление
1 parent 6837ea7 commit 7cfba70

12 files changed

Lines changed: 534 additions & 197 deletions

OneScriptClientServer/OneScriptClientServer/ByteMessage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public CsByteMessage(ScriptEngine.HostedScript.Library.Binary.BinaryDataContext
4949
Base_obj = ByteMessage1;
5050
ByteMessage1.MessageData = p1.Buffer;
5151
}
52+
5253
public CsByteMessage()
5354
{
5455
ByteMessage ByteMessage1 = new ByteMessage();

OneScriptClientServer/OneScriptClientServer/OneScriptClientServer.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
using System;
22
using ScriptEngine.Machine.Contexts;
33
using ScriptEngine.Machine;
4-
using System.Reflection;
4+
using ScriptEngine.HostedScript.Library;
5+
using System.Collections.Concurrent;
56

67
namespace oscs
78
{
@@ -10,11 +11,12 @@ public class OneScriptClientServer : AutoContext<OneScriptClientServer>
1011
{
1112
private static CsCommunicationStates cs_CommunicationStates = new CsCommunicationStates();
1213
public static IValue Event = null;
13-
public static ScriptEngine.HostedScript.Library.DelegateAction EventAction = null;
14-
public static System.Collections.ArrayList EventQueue = new System.Collections.ArrayList();
14+
public static DelegateAction EventAction = null;
15+
public static ConcurrentQueue<dynamic> EventQueue = new ConcurrentQueue<dynamic>();
1516
public static bool goOn = true;
16-
public static ScriptEngine.HostedScript.Library.DelegateAction ServerMessageReceived;
17-
public static ScriptEngine.HostedScript.Library.DelegateAction ServerMessageSent;
17+
public static DelegateAction ServerMessageReceived;
18+
public static DelegateAction ServerMessageSent;
19+
public static bool thirdPartyClientMode = false;
1820

1921
[ScriptConstructor]
2022
public static IRuntimeContextInstance Constructor()
@@ -24,6 +26,13 @@ public static IRuntimeContextInstance Constructor()
2426

2527
public OneScriptClientServer Base_obj;
2628

29+
[ContextProperty("РежимСтороннегоКлиента", "ThirdPartyClientMode")]
30+
public bool ThirdPartyClientMode
31+
{
32+
get { return thirdPartyClientMode; }
33+
set { thirdPartyClientMode = value; }
34+
}
35+
2736
[ContextProperty("АргументыСобытия", "EventArgs")]
2837
public IValue EventArgs
2938
{
@@ -72,17 +81,17 @@ public ScriptEngine.HostedScript.Library.DelegateAction DoEvents()
7281
{
7382
while (EventQueue.Count == 0)
7483
{
75-
System.Threading.Thread.Sleep(10);
84+
System.Threading.Thread.Sleep(7);
7685
}
7786
return EventHandling();
7887
}
7988

8089
public static ScriptEngine.HostedScript.Library.DelegateAction EventHandling()
8190
{
82-
dynamic EventArgs1 = (dynamic)EventQueue[0];
91+
dynamic EventArgs1;
92+
EventQueue.TryDequeue(out EventArgs1);
8393
Event = EventArgs1.dll_obj;
8494
EventAction = EventArgs1.EventAction;
85-
EventQueue.RemoveAt(0);
8695
return EventAction;
8796
}
8897

OneScriptClientServer/OneScriptClientServer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Можно задать все значения или принять номера сборки и редакции по умолчанию
3333
// используя "*", как показано ниже:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.1.0.0")]
36-
[assembly: AssemblyFileVersion("1.1.0.0")]
35+
[assembly: AssemblyVersion("1.2.0.0")]
36+
[assembly: AssemblyFileVersion("1.2.0.0")]

0 commit comments

Comments
 (0)