Compare commits
3 commits
cb0a3ece4c
...
7a27345f0a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a27345f0a | ||
|
|
0a3b58f73d | ||
|
|
ea8ee8040a |
5 changed files with 39 additions and 43 deletions
|
|
@ -378,7 +378,6 @@ namespace DMX2
|
|||
if (tickThread != null) {
|
||||
running = false;
|
||||
tickThread.Join (50);
|
||||
tickThread.Abort ();
|
||||
}
|
||||
foreach (var seq in sequenceurs) {
|
||||
IDisposable idis = seq as IDisposable;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Net;
|
|||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DMX2
|
||||
{
|
||||
|
|
@ -10,26 +11,22 @@ namespace DMX2
|
|||
{
|
||||
|
||||
UdpClient udpCli=null;
|
||||
Thread pollThread = null;
|
||||
bool running=true;
|
||||
|
||||
|
||||
|
||||
public OSCServer ()
|
||||
{
|
||||
pollThread = new Thread(new ThreadStart(Loop));
|
||||
pollThread.Start();
|
||||
udpCli = new UdpClient(7772);
|
||||
udpCli.BeginReceive(UdpCliReceive,null);
|
||||
|
||||
}
|
||||
|
||||
void Loop ()
|
||||
void UdpCliReceive(IAsyncResult ar)
|
||||
{
|
||||
udpCli = new UdpClient (7772);
|
||||
if (!ar.IsCompleted) return;
|
||||
byte[] recv;
|
||||
IPEndPoint remep = new IPEndPoint(IPAddress.Any, 0);
|
||||
|
||||
|
||||
try {
|
||||
while (running) {
|
||||
recv = udpCli.Receive (ref remep);
|
||||
//Console.WriteLine(remep);
|
||||
recv = udpCli.EndReceive(ar, ref remep);
|
||||
OSCMessage msg = new OSCMessage(recv);
|
||||
#if DEBUG
|
||||
Console.Write(msg.Address);
|
||||
|
|
@ -37,17 +34,16 @@ namespace DMX2
|
|||
foreach (var arg in msg.Args)
|
||||
Console.WriteLine(arg.GetString());
|
||||
#endif
|
||||
try{
|
||||
try
|
||||
{
|
||||
ProcessMessage(msg, remep);
|
||||
}catch{}
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
}
|
||||
finally {
|
||||
}
|
||||
catch { }
|
||||
udpCli.BeginReceive(UdpCliReceive, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// /master <X---
|
||||
/// /masterseq/
|
||||
|
|
@ -347,15 +343,8 @@ namespace DMX2
|
|||
protected virtual void Dispose (bool disposing)
|
||||
{
|
||||
if (disposing) {
|
||||
running=false;
|
||||
if(udpCli!=null)
|
||||
udpCli.Close();
|
||||
if(pollThread!=null)
|
||||
{
|
||||
if(!pollThread.Join(100))
|
||||
pollThread.Abort();
|
||||
pollThread=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ namespace DMX2
|
|||
var cmd = regexCommand2.Match(commands[i]);
|
||||
if(cmd.Success){
|
||||
int ef = int.Parse(cmd.Groups["effet"].Value);
|
||||
if (ef-1>index) {
|
||||
if (ef>index) {
|
||||
ef++;
|
||||
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ namespace DMX2
|
|||
var cmd = regexCommand2.Match(commands[i]);
|
||||
if(cmd.Success){
|
||||
int ef = int.Parse(cmd.Groups["effet"].Value);
|
||||
if (ef-1>index) {
|
||||
if (ef>index) {
|
||||
ef++;
|
||||
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ namespace DMX2
|
|||
string[] data = enCours.Commande.Split(' ');
|
||||
|
||||
OSCMessage message = new OSCMessage(data[0]);
|
||||
if (data.Length < 2) return;
|
||||
for (int i = 1; i < data.Length; i++)
|
||||
{
|
||||
if (int.TryParse(data[i], out int di))
|
||||
|
|
@ -320,8 +321,15 @@ namespace DMX2
|
|||
|
||||
|
||||
var buff = message.Encode();
|
||||
try
|
||||
{
|
||||
udpClient.Send(buff, buff.Length);
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -479,7 +487,7 @@ namespace DMX2
|
|||
var cmd = regexCommand2.Match(commands[i]);
|
||||
if(cmd.Success){
|
||||
int ef = int.Parse(cmd.Groups["effet"].Value);
|
||||
if (ef-1>index) {
|
||||
if (ef>index) {
|
||||
ef++;
|
||||
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue