1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x02000024 RID: 36
|
||||
public class AgvInfo
|
||||
{
|
||||
// Token: 0x17000033 RID: 51
|
||||
// (get) Token: 0x0600021D RID: 541 RVA: 0x0004F888 File Offset: 0x0004DA88
|
||||
// (set) Token: 0x0600021E RID: 542 RVA: 0x0004F8AA File Offset: 0x0004DAAA
|
||||
public int Agv_ID
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)Convert.ToInt16(this.agv_id.Text);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.agv_id.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000034 RID: 52
|
||||
// (get) Token: 0x0600021F RID: 543 RVA: 0x0004F8C0 File Offset: 0x0004DAC0
|
||||
// (set) Token: 0x06000220 RID: 544 RVA: 0x0004F8E2 File Offset: 0x0004DAE2
|
||||
public int Location_Display
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)Convert.ToInt16(this.location_display.Text);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.location_display.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000035 RID: 53
|
||||
// (get) Token: 0x06000221 RID: 545 RVA: 0x0004F8F8 File Offset: 0x0004DAF8
|
||||
// (set) Token: 0x06000222 RID: 546 RVA: 0x0004F915 File Offset: 0x0004DB15
|
||||
public string Warn_info
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.warn_info.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.warn_info.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000036 RID: 54
|
||||
// (get) Token: 0x06000223 RID: 547 RVA: 0x0004F928 File Offset: 0x0004DB28
|
||||
// (set) Token: 0x06000224 RID: 548 RVA: 0x0004F945 File Offset: 0x0004DB45
|
||||
public string Task_Descrption
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.task_descrption.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.task_descrption.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000037 RID: 55
|
||||
// (get) Token: 0x06000225 RID: 549 RVA: 0x0004F958 File Offset: 0x0004DB58
|
||||
// (set) Token: 0x06000226 RID: 550 RVA: 0x0004F985 File Offset: 0x0004DB85
|
||||
public bool Have_Goods
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.have_goods.Text == "有货";
|
||||
}
|
||||
set
|
||||
{
|
||||
this.have_goods.Text = ((!value) ? "" : "有货");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040005C3 RID: 1475
|
||||
public Label agv_id = new Label();
|
||||
|
||||
// Token: 0x040005C4 RID: 1476
|
||||
public int Internal_ID;
|
||||
|
||||
// Token: 0x040005C5 RID: 1477
|
||||
public bool bPlcLinked = false;
|
||||
|
||||
// Token: 0x040005C6 RID: 1478
|
||||
public string IP;
|
||||
|
||||
// Token: 0x040005C7 RID: 1479
|
||||
public int Port;
|
||||
|
||||
// Token: 0x040005C8 RID: 1480
|
||||
public int Type;
|
||||
|
||||
// Token: 0x040005C9 RID: 1481
|
||||
public bool Enable;
|
||||
|
||||
// Token: 0x040005CA RID: 1482
|
||||
public int Control_PLC = 1;
|
||||
|
||||
// Token: 0x040005CB RID: 1483
|
||||
public int AssemblyLine;
|
||||
|
||||
// Token: 0x040005CC RID: 1484
|
||||
public string AssemblyName;
|
||||
|
||||
// Token: 0x040005CD RID: 1485
|
||||
public Label location_display = new Label();
|
||||
|
||||
// Token: 0x040005CE RID: 1486
|
||||
public int Rfid_Value = 0;
|
||||
|
||||
// Token: 0x040005CF RID: 1487
|
||||
public int Path_Display = 0;
|
||||
|
||||
// Token: 0x040005D0 RID: 1488
|
||||
public int Cross_Location_Go = 0;
|
||||
|
||||
// Token: 0x040005D1 RID: 1489
|
||||
public string go_info = "";
|
||||
|
||||
// Token: 0x040005D2 RID: 1490
|
||||
public int Cross_Path_Id = 0;
|
||||
|
||||
// Token: 0x040005D3 RID: 1491
|
||||
public string Warn_ID = "0";
|
||||
|
||||
// Token: 0x040005D4 RID: 1492
|
||||
public Label warn_info = new Label();
|
||||
|
||||
// Token: 0x040005D5 RID: 1493
|
||||
public int Warn_Level = 0;
|
||||
|
||||
// Token: 0x040005D6 RID: 1494
|
||||
public int Area;
|
||||
|
||||
// Token: 0x040005D7 RID: 1495
|
||||
public Socket Soc;
|
||||
|
||||
// Token: 0x040005D8 RID: 1496
|
||||
public double Mileage = 0.0;
|
||||
|
||||
// Token: 0x040005D9 RID: 1497
|
||||
public DateTime Read_dt;
|
||||
|
||||
// Token: 0x040005DA RID: 1498
|
||||
public byte Run_Status;
|
||||
|
||||
// Token: 0x040005DB RID: 1499
|
||||
public byte Run_Direction = 0;
|
||||
|
||||
// Token: 0x040005DC RID: 1500
|
||||
public byte Go_Direction = 1;
|
||||
|
||||
// Token: 0x040005DD RID: 1501
|
||||
public byte Run_Speed = 0;
|
||||
|
||||
// Token: 0x040005DE RID: 1502
|
||||
public float Voltage = 0f;
|
||||
|
||||
// Token: 0x040005DF RID: 1503
|
||||
public float Voltage_precent = 0f;
|
||||
|
||||
// Token: 0x040005E0 RID: 1504
|
||||
public byte Bank_Model = 0;
|
||||
|
||||
// Token: 0x040005E1 RID: 1505
|
||||
public int Task_ID = 0;
|
||||
|
||||
// Token: 0x040005E2 RID: 1506
|
||||
public int Task_Temp = 0;
|
||||
|
||||
// Token: 0x040005E3 RID: 1507
|
||||
public Label task_descrption = new Label();
|
||||
|
||||
// Token: 0x040005E4 RID: 1508
|
||||
public int WorkType = 0;
|
||||
|
||||
// Token: 0x040005E5 RID: 1509
|
||||
public Label have_goods = new Label();
|
||||
|
||||
// Token: 0x040005E6 RID: 1510
|
||||
public Channel[] Up_Channel;
|
||||
|
||||
// Token: 0x040005E7 RID: 1511
|
||||
public Channel[] Down_Channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x02000025 RID: 37
|
||||
public class Channel
|
||||
{
|
||||
// Token: 0x040005E8 RID: 1512
|
||||
public string Material_ID = "";
|
||||
|
||||
// Token: 0x040005E9 RID: 1513
|
||||
public byte Goods_Satus = 0;
|
||||
|
||||
// Token: 0x040005EA RID: 1514
|
||||
public int Goods_Qty = 0;
|
||||
|
||||
// Token: 0x040005EB RID: 1515
|
||||
public int Box_ID1 = 0;
|
||||
|
||||
// Token: 0x040005EC RID: 1516
|
||||
public int Box_ID2 = 0;
|
||||
|
||||
// Token: 0x040005ED RID: 1517
|
||||
public int Channel_Task_ID = 0;
|
||||
|
||||
// Token: 0x040005EE RID: 1518
|
||||
public int Machine_ID = 0;
|
||||
|
||||
// Token: 0x040005EF RID: 1519
|
||||
public byte Do_Status = 0;
|
||||
|
||||
// Token: 0x040005F0 RID: 1520
|
||||
public byte Do_Up_Status = 0;
|
||||
|
||||
// Token: 0x040005F1 RID: 1521
|
||||
public byte Do_Down_Status = 0;
|
||||
|
||||
// Token: 0x040005F2 RID: 1522
|
||||
public byte Do_HgQty_Status = 0;
|
||||
|
||||
// Token: 0x040005F3 RID: 1523
|
||||
public byte Do_Bxg_Status = 0;
|
||||
|
||||
// Token: 0x040005F4 RID: 1524
|
||||
public long Mes_Task_ID = 0L;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x02000026 RID: 38
|
||||
internal class Cls_Mc_Mitsubishi
|
||||
{
|
||||
// Token: 0x14000005 RID: 5
|
||||
// (add) Token: 0x06000229 RID: 553 RVA: 0x0004FB00 File Offset: 0x0004DD00
|
||||
// (remove) Token: 0x0600022A RID: 554 RVA: 0x0004FB38 File Offset: 0x0004DD38
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public event Cls_Mc_Mitsubishi.ReceiveMsgHandler OnMsgReceived;
|
||||
|
||||
// Token: 0x14000006 RID: 6
|
||||
// (add) Token: 0x0600022B RID: 555 RVA: 0x0004FB70 File Offset: 0x0004DD70
|
||||
// (remove) Token: 0x0600022C RID: 556 RVA: 0x0004FBA8 File Offset: 0x0004DDA8
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public event Cls_Mc_Mitsubishi.StartListenHandler StartListenThread;
|
||||
|
||||
// Token: 0x14000007 RID: 7
|
||||
// (add) Token: 0x0600022D RID: 557 RVA: 0x0004FBE0 File Offset: 0x0004DDE0
|
||||
// (remove) Token: 0x0600022E RID: 558 RVA: 0x0004FC18 File Offset: 0x0004DE18
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public event Cls_Mc_Mitsubishi.SendCompleted OnSended;
|
||||
|
||||
// Token: 0x0600022F RID: 559 RVA: 0x0004FC50 File Offset: 0x0004DE50
|
||||
public Cls_Mc_Mitsubishi(string hostName, int port, int PLCStaion)
|
||||
{
|
||||
this.Plcport = PLCStaion;
|
||||
IPAddress[] hostAddresses = Dns.GetHostAddresses(hostName);
|
||||
this.hostEndPoint = new IPEndPoint(hostAddresses[hostAddresses.Length - 1], port);
|
||||
this.clientSocket = new Socket(this.hostEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
}
|
||||
|
||||
// Token: 0x06000230 RID: 560 RVA: 0x0004FCAC File Offset: 0x0004DEAC
|
||||
private bool Connect()
|
||||
{
|
||||
bool result;
|
||||
using (SocketAsyncEventArgs socketAsyncEventArgs = new SocketAsyncEventArgs())
|
||||
{
|
||||
socketAsyncEventArgs.UserToken = this.clientSocket;
|
||||
socketAsyncEventArgs.RemoteEndPoint = this.hostEndPoint;
|
||||
socketAsyncEventArgs.Completed += this.OnConnect;
|
||||
this.clientSocket.ConnectAsync(socketAsyncEventArgs);
|
||||
bool flag = Cls_Mc_Mitsubishi.autoConnectEvent.WaitOne(1000);
|
||||
bool flag2 = flag;
|
||||
if (flag2)
|
||||
{
|
||||
this.listenerSocketAsyncEventArgs = new SocketAsyncEventArgs();
|
||||
byte[] array = new byte[255];
|
||||
this.listenerSocketAsyncEventArgs.UserToken = this.clientSocket;
|
||||
this.listenerSocketAsyncEventArgs.SetBuffer(array, 0, array.Length);
|
||||
this.listenerSocketAsyncEventArgs.Completed += this.OnReceive;
|
||||
this.StartListenThread();
|
||||
this.clientSocket.SetKeepAlive(3000UL, 1000UL);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000231 RID: 561 RVA: 0x0004FDB0 File Offset: 0x0004DFB0
|
||||
private void Listen()
|
||||
{
|
||||
(this.listenerSocketAsyncEventArgs.UserToken as Socket).ReceiveAsync(this.listenerSocketAsyncEventArgs);
|
||||
}
|
||||
|
||||
// Token: 0x06000232 RID: 562 RVA: 0x0004FDD0 File Offset: 0x0004DFD0
|
||||
private void Send(byte[] message)
|
||||
{
|
||||
bool flag = this.connected;
|
||||
if (flag)
|
||||
{
|
||||
SocketAsyncEventArgs senderSocketAsyncEventArgs = null;
|
||||
List<SocketAsyncEventArgs> obj = Cls_Mc_Mitsubishi.s_lst;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag3 = Cls_Mc_Mitsubishi.s_lst.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
senderSocketAsyncEventArgs = Cls_Mc_Mitsubishi.s_lst[Cls_Mc_Mitsubishi.s_lst.Count - 1];
|
||||
Cls_Mc_Mitsubishi.s_lst.RemoveAt(Cls_Mc_Mitsubishi.s_lst.Count - 1);
|
||||
}
|
||||
}
|
||||
bool flag4 = senderSocketAsyncEventArgs == null;
|
||||
if (flag4)
|
||||
{
|
||||
senderSocketAsyncEventArgs = new SocketAsyncEventArgs();
|
||||
senderSocketAsyncEventArgs.UserToken = this.clientSocket;
|
||||
senderSocketAsyncEventArgs.RemoteEndPoint = this.hostEndPoint;
|
||||
senderSocketAsyncEventArgs.Completed += delegate(object sender, SocketAsyncEventArgs _e)
|
||||
{
|
||||
List<SocketAsyncEventArgs> obj2 = Cls_Mc_Mitsubishi.s_lst;
|
||||
lock (obj2)
|
||||
{
|
||||
Cls_Mc_Mitsubishi.s_lst.Add(senderSocketAsyncEventArgs);
|
||||
}
|
||||
};
|
||||
}
|
||||
senderSocketAsyncEventArgs.SetBuffer(message, 0, message.Length);
|
||||
this.clientSocket.SendAsync(senderSocketAsyncEventArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connected = false;
|
||||
}
|
||||
this.SendMess = message;
|
||||
}
|
||||
|
||||
// Token: 0x06000233 RID: 563 RVA: 0x0004FF04 File Offset: 0x0004E104
|
||||
private bool Disconnect()
|
||||
{
|
||||
bool result = true;
|
||||
try
|
||||
{
|
||||
this.clientSocket.Shutdown(SocketShutdown.Both);
|
||||
this.clientSocket.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000234 RID: 564 RVA: 0x0004FF50 File Offset: 0x0004E150
|
||||
private void OnConnect(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
Cls_Mc_Mitsubishi.autoConnectEvent.Set();
|
||||
this.connected = (e.SocketError == 0);
|
||||
}
|
||||
|
||||
// Token: 0x06000235 RID: 565 RVA: 0x0004FF70 File Offset: 0x0004E170
|
||||
private void OnReceive(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
bool flag = e.BytesTransferred == 0;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = this.clientSocket.Connected;
|
||||
if (flag2)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.clientSocket.Shutdown(SocketShutdown.Both);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
bool flag3 = this.clientSocket.Connected;
|
||||
if (flag3)
|
||||
{
|
||||
this.clientSocket.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
byte[] info = new byte[]
|
||||
{
|
||||
0
|
||||
};
|
||||
this.OnMsgReceived(info);
|
||||
this.connected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] buffer = e.Buffer;
|
||||
this.OnMsgReceived(buffer);
|
||||
this.Listen();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000236 RID: 566 RVA: 0x00050034 File Offset: 0x0004E234
|
||||
private void OnSend(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
bool flag = e.SocketError == 0;
|
||||
if (flag)
|
||||
{
|
||||
this.OnSended(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.OnSended(false);
|
||||
this.ProcessError(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000237 RID: 567 RVA: 0x00050078 File Offset: 0x0004E278
|
||||
private void ProcessError(SocketAsyncEventArgs e)
|
||||
{
|
||||
Socket socket = e.UserToken as Socket;
|
||||
bool flag = socket.Connected;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
socket.Shutdown(SocketShutdown.Both);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
bool flag2 = socket.Connected;
|
||||
if (flag2)
|
||||
{
|
||||
socket.Close();
|
||||
}
|
||||
}
|
||||
this.connected = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000238 RID: 568 RVA: 0x000500EC File Offset: 0x0004E2EC
|
||||
public void Dispose()
|
||||
{
|
||||
Cls_Mc_Mitsubishi.autoConnectEvent.Close();
|
||||
bool flag = this.clientSocket.Connected;
|
||||
if (flag)
|
||||
{
|
||||
this.clientSocket.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000239 RID: 569 RVA: 0x00050124 File Offset: 0x0004E324
|
||||
private void OmronFINS_OnSended(bool successorfalse)
|
||||
{
|
||||
bool flag = !successorfalse;
|
||||
if (flag)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600023A RID: 570 RVA: 0x00050140 File Offset: 0x0004E340
|
||||
private void OmronFINS_OnMsgReceived(byte[] info)
|
||||
{
|
||||
bool sendmessHas = this.SendmessHas;
|
||||
if (sendmessHas)
|
||||
{
|
||||
bool flag = info[0] > 0;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = info.Length > 24;
|
||||
if (flag2)
|
||||
{
|
||||
string str = "";
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
str += info[i].ToString("X").PadLeft(2, '0');
|
||||
}
|
||||
bool flag3 = int.Parse(info[23].ToString("X").Trim(), NumberStyles.HexNumber) == this.Plcport;
|
||||
if (flag3)
|
||||
{
|
||||
this.PCS = info[19];
|
||||
this.PLCS = info[23];
|
||||
this.SendmessHas = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = info[0] > 0;
|
||||
if (flag4)
|
||||
{
|
||||
bool flag5 = this.SendOrRev2 == 1;
|
||||
if (flag5)
|
||||
{
|
||||
this.SendBack = info;
|
||||
this.SendOrRev2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag6 = this.SendOrRev == 2;
|
||||
if (flag6)
|
||||
{
|
||||
this.RecvBack = info;
|
||||
this.SendOrRev = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag7 = this.SendOrRev2 == 1;
|
||||
if (flag7)
|
||||
{
|
||||
this.SendBack = new byte[1];
|
||||
this.SendBack[0] = 0;
|
||||
this.SendOrRev2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag8 = this.SendOrRev == 2;
|
||||
if (flag8)
|
||||
{
|
||||
this.RecvBack = new byte[1];
|
||||
this.RecvBack[0] = 0;
|
||||
this.SendOrRev = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600023B RID: 571 RVA: 0x000502BD File Offset: 0x0004E4BD
|
||||
private void OmronFINS_StartListenThread()
|
||||
{
|
||||
this.Listen();
|
||||
}
|
||||
|
||||
// Token: 0x0600023C RID: 572 RVA: 0x000502C8 File Offset: 0x0004E4C8
|
||||
public bool OpenLinkPLC()
|
||||
{
|
||||
this.StartListenThread += this.OmronFINS_StartListenThread;
|
||||
this.OnMsgReceived += this.OmronFINS_OnMsgReceived;
|
||||
this.OnSended += this.OmronFINS_OnSended;
|
||||
return this.Connect();
|
||||
}
|
||||
|
||||
// Token: 0x0600023D RID: 573 RVA: 0x00050320 File Offset: 0x0004E520
|
||||
public bool CloseLinkPLC()
|
||||
{
|
||||
return this.Disconnect();
|
||||
}
|
||||
|
||||
// Token: 0x0600023E RID: 574 RVA: 0x00050338 File Offset: 0x0004E538
|
||||
public bool WritePlcData(int address, int value)
|
||||
{
|
||||
byte[] message = new byte[]
|
||||
{
|
||||
80,
|
||||
0,
|
||||
0,
|
||||
byte.MaxValue,
|
||||
byte.MaxValue,
|
||||
3,
|
||||
0,
|
||||
14,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
20,
|
||||
0,
|
||||
0,
|
||||
Convert.ToByte(address % 256),
|
||||
Convert.ToByte(address / 256),
|
||||
0,
|
||||
168,
|
||||
1,
|
||||
0,
|
||||
Convert.ToByte(value % 256),
|
||||
Convert.ToByte(value / 256)
|
||||
};
|
||||
bool result = false;
|
||||
this.SendOrRev2 = 1;
|
||||
this.Send(message);
|
||||
int num = 0;
|
||||
while (this.SendOrRev2 != 0 & this.connected & num < 1000)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
num++;
|
||||
}
|
||||
bool flag = num < 1000;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool flag2 = this.SendBack[0] == 208 && this.SendBack[5] == 3 && this.SendBack[7] == 2 && this.SendBack[10] == 0;
|
||||
result = flag2;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SendOrRev2 = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600023F RID: 575 RVA: 0x000504B4 File Offset: 0x0004E6B4
|
||||
public bool ReadPlcData(int address, int length, out int[] IntValue)
|
||||
{
|
||||
bool result = false;
|
||||
IntValue = new int[length];
|
||||
this.Send(new byte[]
|
||||
{
|
||||
80,
|
||||
0,
|
||||
0,
|
||||
byte.MaxValue,
|
||||
byte.MaxValue,
|
||||
3,
|
||||
0,
|
||||
12,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
Convert.ToByte(address % 256),
|
||||
Convert.ToByte(address / 256),
|
||||
0,
|
||||
168,
|
||||
Convert.ToByte(length % 256),
|
||||
Convert.ToByte(length / 256)
|
||||
});
|
||||
this.SendOrRev = 2;
|
||||
int num = 0;
|
||||
while (this.SendOrRev != 0 & this.connected & num < 1000)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
num++;
|
||||
}
|
||||
bool flag = num < 1000;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool flag2 = this.RecvBack[0] == 208 && this.RecvBack[5] == 3 && this.RecvBack[7] == 22 && this.RecvBack[10] == 0;
|
||||
if (flag2)
|
||||
{
|
||||
result = true;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
IntValue[i] = (int)this.RecvBack[11 + 2 * i] + (int)this.RecvBack[12 + 2 * i] * 256;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SendOrRev = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x040005F5 RID: 1525
|
||||
public Socket clientSocket;
|
||||
|
||||
// Token: 0x040005F6 RID: 1526
|
||||
public bool connected = false;
|
||||
|
||||
// Token: 0x040005F7 RID: 1527
|
||||
private byte[] SendMess;
|
||||
|
||||
// Token: 0x040005F8 RID: 1528
|
||||
private IPEndPoint hostEndPoint;
|
||||
|
||||
// Token: 0x040005F9 RID: 1529
|
||||
private static AutoResetEvent autoConnectEvent = new AutoResetEvent(false);
|
||||
|
||||
// Token: 0x040005FD RID: 1533
|
||||
private SocketAsyncEventArgs listenerSocketAsyncEventArgs;
|
||||
|
||||
// Token: 0x040005FE RID: 1534
|
||||
private int Plcport;
|
||||
|
||||
// Token: 0x040005FF RID: 1535
|
||||
public static List<SocketAsyncEventArgs> s_lst = new List<SocketAsyncEventArgs>();
|
||||
|
||||
// Token: 0x04000600 RID: 1536
|
||||
private byte PCS;
|
||||
|
||||
// Token: 0x04000601 RID: 1537
|
||||
private byte PLCS;
|
||||
|
||||
// Token: 0x04000602 RID: 1538
|
||||
private int SendOrRev;
|
||||
|
||||
// Token: 0x04000603 RID: 1539
|
||||
private int SendOrRev2;
|
||||
|
||||
// Token: 0x04000604 RID: 1540
|
||||
private byte[] SendBack;
|
||||
|
||||
// Token: 0x04000605 RID: 1541
|
||||
private byte[] RecvBack;
|
||||
|
||||
// Token: 0x04000606 RID: 1542
|
||||
private bool SendmessHas = false;
|
||||
|
||||
// Token: 0x02000041 RID: 65
|
||||
// (Invoke) Token: 0x060002ED RID: 749
|
||||
public delegate void ReceiveMsgHandler(byte[] info);
|
||||
|
||||
// Token: 0x02000042 RID: 66
|
||||
// (Invoke) Token: 0x060002F1 RID: 753
|
||||
public delegate void StartListenHandler();
|
||||
|
||||
// Token: 0x02000043 RID: 67
|
||||
// (Invoke) Token: 0x060002F5 RID: 757
|
||||
public delegate void SendCompleted(bool successorfalse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x02000027 RID: 39
|
||||
public class Cls_Plc_Info
|
||||
{
|
||||
// Token: 0x02000045 RID: 69
|
||||
public enum Op_Info
|
||||
{
|
||||
// Token: 0x0400068E RID: 1678
|
||||
length_read = 11,
|
||||
// Token: 0x0400068F RID: 1679
|
||||
length_write = 1,
|
||||
// Token: 0x04000690 RID: 1680
|
||||
addr_read = 600,
|
||||
// Token: 0x04000691 RID: 1681
|
||||
addr_write_go = 500,
|
||||
// Token: 0x04000692 RID: 1682
|
||||
addr_mb = 504
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using s7api.net;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x02000028 RID: 40
|
||||
internal class Cls_Profinet_Siemens
|
||||
{
|
||||
// Token: 0x06000242 RID: 578 RVA: 0x00050688 File Offset: 0x0004E888
|
||||
public Cls_Profinet_Siemens(string ip, int rack, int slot)
|
||||
{
|
||||
this.Rack = rack;
|
||||
this.Slot = slot;
|
||||
this.IpAddress = ip;
|
||||
}
|
||||
|
||||
// Token: 0x06000243 RID: 579 RVA: 0x000506D8 File Offset: 0x0004E8D8
|
||||
public bool Connect()
|
||||
{
|
||||
int num = this.client_profinet.ConnectTo(this.IpAddress, this.Rack, this.Slot);
|
||||
return num == 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000244 RID: 580 RVA: 0x00050718 File Offset: 0x0004E918
|
||||
public bool Disconnect()
|
||||
{
|
||||
int num = this.client_profinet.Disconnect();
|
||||
return num == 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000245 RID: 581 RVA: 0x00050748 File Offset: 0x0004E948
|
||||
public bool Read(int dbNumber, int start_address, int size, byte[] buffer)
|
||||
{
|
||||
int num = this.client_profinet.DBRead(dbNumber, start_address, size, buffer);
|
||||
bool flag = num != 0;
|
||||
return !flag;
|
||||
}
|
||||
|
||||
// Token: 0x06000246 RID: 582 RVA: 0x0005077C File Offset: 0x0004E97C
|
||||
public bool Write(int dbNumber, int start_address, int size, byte[] buffer)
|
||||
{
|
||||
int num = this.client_profinet.DBWrite(dbNumber, start_address, size, buffer);
|
||||
bool flag = num != 0;
|
||||
return !flag;
|
||||
}
|
||||
|
||||
// Token: 0x04000607 RID: 1543
|
||||
private S7Client client_profinet = new S7Client();
|
||||
|
||||
// Token: 0x04000608 RID: 1544
|
||||
private int Rack = 0;
|
||||
|
||||
// Token: 0x04000609 RID: 1545
|
||||
private int Slot = 0;
|
||||
|
||||
// Token: 0x0400060A RID: 1546
|
||||
private string IpAddress = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x02000029 RID: 41
|
||||
public class FileRW
|
||||
{
|
||||
// Token: 0x06000247 RID: 583
|
||||
[DllImport("kernel32")]
|
||||
public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
|
||||
// Token: 0x06000248 RID: 584
|
||||
[DllImport("kernel32")]
|
||||
public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
|
||||
|
||||
// Token: 0x06000249 RID: 585 RVA: 0x000507B0 File Offset: 0x0004E9B0
|
||||
public static string ReadIniValue(string Section, string Key, string file)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(1024);
|
||||
FileRW.GetPrivateProfileString(Section, Key, "", stringBuilder, 1024, file);
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x0600024A RID: 586 RVA: 0x000507E8 File Offset: 0x0004E9E8
|
||||
public static long WriteIniValue(string Section, string Key, string value, string file)
|
||||
{
|
||||
return FileRW.WritePrivateProfileString(Section, Key, value, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,519 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x0200002B RID: 43
|
||||
internal class OmrlonHostlink
|
||||
{
|
||||
// Token: 0x1400000B RID: 11
|
||||
// (add) Token: 0x06000270 RID: 624 RVA: 0x00052504 File Offset: 0x00050704
|
||||
// (remove) Token: 0x06000271 RID: 625 RVA: 0x0005253C File Offset: 0x0005073C
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public event OmrlonHostlink.StartListeHandler StartListen;
|
||||
|
||||
// Token: 0x1400000C RID: 12
|
||||
// (add) Token: 0x06000272 RID: 626 RVA: 0x00052574 File Offset: 0x00050774
|
||||
// (remove) Token: 0x06000273 RID: 627 RVA: 0x000525AC File Offset: 0x000507AC
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public event OmrlonHostlink.ReceiveMsgHandler OnMsgReceived;
|
||||
|
||||
// Token: 0x06000274 RID: 628 RVA: 0x000525E4 File Offset: 0x000507E4
|
||||
public OmrlonHostlink(string hostName, int port)
|
||||
{
|
||||
this.IPAdress = hostName;
|
||||
IPAddress[] hostAddresses = Dns.GetHostAddresses(hostName);
|
||||
this.hostEndPoint = new IPEndPoint(hostAddresses[hostAddresses.Length - 1], port);
|
||||
this.clientSocket = new Socket(this.hostEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
}
|
||||
|
||||
// Token: 0x06000275 RID: 629 RVA: 0x00052650 File Offset: 0x00050850
|
||||
private bool Connect()
|
||||
{
|
||||
bool result;
|
||||
using (SocketAsyncEventArgs socketAsyncEventArgs = new SocketAsyncEventArgs())
|
||||
{
|
||||
socketAsyncEventArgs.UserToken = this.clientSocket;
|
||||
socketAsyncEventArgs.RemoteEndPoint = this.hostEndPoint;
|
||||
socketAsyncEventArgs.Completed += this.OnConnect;
|
||||
this.clientSocket.ConnectAsync(socketAsyncEventArgs);
|
||||
bool flag = this.autoConnectEvent.WaitOne(1000);
|
||||
bool flag2 = flag;
|
||||
if (flag2)
|
||||
{
|
||||
this.lisnterSocketAsyncEventArgs = new SocketAsyncEventArgs();
|
||||
byte[] array = new byte[50];
|
||||
this.lisnterSocketAsyncEventArgs.UserToken = this.clientSocket;
|
||||
this.lisnterSocketAsyncEventArgs.SetBuffer(array, 0, array.Length);
|
||||
this.lisnterSocketAsyncEventArgs.Completed += this.OnReceive;
|
||||
this.StartListen();
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000276 RID: 630 RVA: 0x00052738 File Offset: 0x00050938
|
||||
private void OnConnect(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
this.connected = (e.SocketError == 0);
|
||||
this.autoConnectEvent.Set();
|
||||
}
|
||||
|
||||
// Token: 0x06000277 RID: 631 RVA: 0x00052758 File Offset: 0x00050958
|
||||
public void Send(string mes)
|
||||
{
|
||||
bool flag = this.connected;
|
||||
if (flag)
|
||||
{
|
||||
EventHandler<SocketAsyncEventArgs> eventHandler = null;
|
||||
byte[] bytes = Encoding.Default.GetBytes(mes);
|
||||
SocketAsyncEventArgs senderSocketAsyncEventArgs = null;
|
||||
List<SocketAsyncEventArgs> obj = this.s_lst;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag3 = this.s_lst.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
senderSocketAsyncEventArgs = this.s_lst[this.s_lst.Count - 1];
|
||||
this.s_lst.RemoveAt(this.s_lst.Count - 1);
|
||||
}
|
||||
}
|
||||
bool flag4 = senderSocketAsyncEventArgs == null;
|
||||
if (flag4)
|
||||
{
|
||||
senderSocketAsyncEventArgs = new SocketAsyncEventArgs();
|
||||
senderSocketAsyncEventArgs.UserToken = this.clientSocket;
|
||||
senderSocketAsyncEventArgs.RemoteEndPoint = this.clientSocket.RemoteEndPoint;
|
||||
bool flag5 = eventHandler == null;
|
||||
if (flag5)
|
||||
{
|
||||
eventHandler = delegate(object sender, SocketAsyncEventArgs _e)
|
||||
{
|
||||
List<SocketAsyncEventArgs> obj2 = this.s_lst;
|
||||
lock (obj2)
|
||||
{
|
||||
this.s_lst.Add(senderSocketAsyncEventArgs);
|
||||
}
|
||||
};
|
||||
}
|
||||
senderSocketAsyncEventArgs.Completed += eventHandler;
|
||||
}
|
||||
senderSocketAsyncEventArgs.SetBuffer(bytes, 0, bytes.Length);
|
||||
this.clientSocket.SendAsync(senderSocketAsyncEventArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connected = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000278 RID: 632 RVA: 0x000528B4 File Offset: 0x00050AB4
|
||||
public void Listen()
|
||||
{
|
||||
bool flag = this.connected && this.clientSocket != null;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
(this.lisnterSocketAsyncEventArgs.UserToken as Socket).ReceiveAsync(this.lisnterSocketAsyncEventArgs);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000279 RID: 633 RVA: 0x00052914 File Offset: 0x00050B14
|
||||
private int Disconnect()
|
||||
{
|
||||
int result = 0;
|
||||
try
|
||||
{
|
||||
this.clientSocket.Shutdown(SocketShutdown.Both);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
this.clientSocket.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
this.connected = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600027A RID: 634 RVA: 0x00052978 File Offset: 0x00050B78
|
||||
private void OnReceive(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
bool flag = e.BytesTransferred == 0;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.clientSocket.Shutdown(SocketShutdown.Both);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
bool flag2 = this.clientSocket.Connected;
|
||||
if (flag2)
|
||||
{
|
||||
this.clientSocket.Close();
|
||||
}
|
||||
}
|
||||
byte[] info = new byte[1];
|
||||
this.OnMsgReceived(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = new byte[e.BytesTransferred];
|
||||
for (int i = 0; i < e.BytesTransferred; i++)
|
||||
{
|
||||
array[i] = e.Buffer[i];
|
||||
}
|
||||
this.OnMsgReceived(array);
|
||||
this.Listen();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600027B RID: 635 RVA: 0x00052A4C File Offset: 0x00050C4C
|
||||
private void OmrlonSocketClient_OnMsgReceived(byte[] info)
|
||||
{
|
||||
bool flag = info[0] > 0;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = this.SendOrRecv == 1;
|
||||
if (flag2)
|
||||
{
|
||||
this.SendDataPro = info;
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = this.SendOrRecv == 2;
|
||||
if (flag3)
|
||||
{
|
||||
this.SendData = info;
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = this.SendOrRecv == 3;
|
||||
if (flag4)
|
||||
{
|
||||
this.RecvDataPro = info;
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = this.SendOrRecv == 4;
|
||||
if (flag5)
|
||||
{
|
||||
this.RecvData = info;
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag6 = this.SendOrRecv == 1;
|
||||
if (flag6)
|
||||
{
|
||||
this.SendDataPro = new byte[1];
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag7 = this.SendOrRecv == 2;
|
||||
if (flag7)
|
||||
{
|
||||
this.SendData = new byte[1];
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag8 = this.SendOrRecv == 3;
|
||||
if (flag8)
|
||||
{
|
||||
this.RecvDataPro = new byte[1];
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag9 = this.SendOrRecv == 4;
|
||||
if (flag9)
|
||||
{
|
||||
this.RecvData = new byte[1];
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600027C RID: 636 RVA: 0x00052B84 File Offset: 0x00050D84
|
||||
public bool OpenLinkPLC()
|
||||
{
|
||||
this.StartListen += this.OmrlonSocketClient_StartListen;
|
||||
this.OnMsgReceived += this.OmrlonSocketClient_OnMsgReceived;
|
||||
bool flag = this.Connect();
|
||||
bool flag2 = !flag;
|
||||
return !flag2 || flag;
|
||||
}
|
||||
|
||||
// Token: 0x0600027D RID: 637 RVA: 0x00052BD4 File Offset: 0x00050DD4
|
||||
public int CloseLinkPLC()
|
||||
{
|
||||
return this.Disconnect();
|
||||
}
|
||||
|
||||
// Token: 0x0600027E RID: 638 RVA: 0x00052BEC File Offset: 0x00050DEC
|
||||
private void OmrlonSocketClient_StartListen()
|
||||
{
|
||||
this.Listen();
|
||||
}
|
||||
|
||||
// Token: 0x0600027F RID: 639 RVA: 0x00052BF8 File Offset: 0x00050DF8
|
||||
private string FCS(string Value)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < Value.Length; i++)
|
||||
{
|
||||
byte[] bytes = Encoding.ASCII.GetBytes(Value.Substring(i, 1));
|
||||
num ^= (int)bytes[0];
|
||||
}
|
||||
return num.ToString("X");
|
||||
}
|
||||
|
||||
// Token: 0x06000280 RID: 640 RVA: 0x00052C4C File Offset: 0x00050E4C
|
||||
public int WritePlcDMValue(string stationNO, int address, string value)
|
||||
{
|
||||
int result = -1;
|
||||
string text = address.ToString().PadLeft(4, '0');
|
||||
stationNO = stationNO.PadLeft(2, '0');
|
||||
string text2 = string.Concat(new string[]
|
||||
{
|
||||
"@",
|
||||
stationNO,
|
||||
"WD",
|
||||
text,
|
||||
value
|
||||
});
|
||||
text2 = string.Concat(new object[]
|
||||
{
|
||||
text2,
|
||||
this.FCS(text2),
|
||||
"*",
|
||||
'\r'
|
||||
});
|
||||
this.SendOrRecv = 1;
|
||||
int num = 0;
|
||||
this.Send(text2);
|
||||
while (this.SendOrRecv != 0 && num < 500)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
num++;
|
||||
}
|
||||
bool flag = num < 500;
|
||||
if (flag)
|
||||
{
|
||||
string @string = Encoding.Default.GetString(this.SendDataPro, 0, this.SendDataPro.Length);
|
||||
bool flag2 = @string.Length > 7;
|
||||
if (flag2)
|
||||
{
|
||||
bool flag3 = @string.Substring(5, 2) == "00" && @string.Substring(3, 2) == "WD" && @string.Substring(0, 1) == "@" && @string.Substring(@string.Length - 1, 1) == "\r";
|
||||
if (flag3)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000281 RID: 641 RVA: 0x00052DD0 File Offset: 0x00050FD0
|
||||
public int ReadPlcDMValue(string PlcNo, int Addr, out int value)
|
||||
{
|
||||
bool flag = Addr == 3000;
|
||||
if (flag)
|
||||
{
|
||||
}
|
||||
int result = -1;
|
||||
value = -1;
|
||||
string text = Addr.ToString().PadLeft(4, '0');
|
||||
PlcNo = PlcNo.PadLeft(2, '0');
|
||||
string text2 = string.Concat(new string[]
|
||||
{
|
||||
"@",
|
||||
PlcNo,
|
||||
"RD",
|
||||
text,
|
||||
"0001"
|
||||
});
|
||||
text2 = string.Concat(new object[]
|
||||
{
|
||||
text2,
|
||||
this.FCS(text2),
|
||||
"*",
|
||||
'\r'
|
||||
});
|
||||
this.SendOrRecv = 3;
|
||||
int num = 0;
|
||||
this.Send(text2);
|
||||
while (this.SendOrRecv != 0 && num < 500)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
num++;
|
||||
}
|
||||
bool flag2 = num < 500;
|
||||
if (flag2)
|
||||
{
|
||||
string @string = Encoding.Default.GetString(this.RecvDataPro, 0, this.RecvDataPro.Length);
|
||||
bool flag3 = @string.Length > 11;
|
||||
if (flag3)
|
||||
{
|
||||
bool flag4 = @string.Substring(5, 2) == "00" && @string.Substring(3, 2) == "RD" && @string.Substring(0, 1) == "@" && @string.Substring(@string.Length - 1, 1) == "\r";
|
||||
if (flag4)
|
||||
{
|
||||
value = int.Parse(@string.Trim().Substring(7, 4), NumberStyles.HexNumber);
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000282 RID: 642 RVA: 0x00052F8C File Offset: 0x0005118C
|
||||
public int ReadPlcHRValue(string PlcNo, int Addr, out int Value)
|
||||
{
|
||||
int result = -1;
|
||||
Value = -1;
|
||||
string text = Addr.ToString().PadLeft(4, '0');
|
||||
PlcNo = PlcNo.PadLeft(2, '0');
|
||||
string text2 = string.Concat(new string[]
|
||||
{
|
||||
"@",
|
||||
PlcNo,
|
||||
"RH",
|
||||
text,
|
||||
"0001"
|
||||
});
|
||||
text2 = string.Concat(new object[]
|
||||
{
|
||||
text2,
|
||||
this.FCS(text2),
|
||||
"*",
|
||||
'\r'
|
||||
});
|
||||
this.SendOrRecv = 4;
|
||||
int num = 0;
|
||||
this.Send(text2);
|
||||
while (this.SendOrRecv != 0 && num < 500)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
num++;
|
||||
}
|
||||
bool flag = num < 500;
|
||||
if (flag)
|
||||
{
|
||||
string @string = Encoding.Default.GetString(this.RecvData, 0, this.RecvData.Length);
|
||||
bool flag2 = @string.Length > 11;
|
||||
if (flag2)
|
||||
{
|
||||
bool flag3 = @string.Substring(5, 2) == "00" && @string.Substring(3, 2) == "RH" && @string.Substring(0, 1) == "@" && @string.Substring(@string.Length - 1, 1) == "\r";
|
||||
if (flag3)
|
||||
{
|
||||
Value = int.Parse(@string.Trim().Substring(7, 4), NumberStyles.HexNumber);
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SendOrRecv = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000283 RID: 643 RVA: 0x00053130 File Offset: 0x00051330
|
||||
public void Dispose()
|
||||
{
|
||||
bool flag = this.clientSocket.Connected;
|
||||
if (flag)
|
||||
{
|
||||
this.clientSocket.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400061F RID: 1567
|
||||
public string IPAdress;
|
||||
|
||||
// Token: 0x04000620 RID: 1568
|
||||
public bool connected = false;
|
||||
|
||||
// Token: 0x04000621 RID: 1569
|
||||
public Socket clientSocket;
|
||||
|
||||
// Token: 0x04000622 RID: 1570
|
||||
private IPEndPoint hostEndPoint;
|
||||
|
||||
// Token: 0x04000623 RID: 1571
|
||||
private byte[] SendDataPro;
|
||||
|
||||
// Token: 0x04000624 RID: 1572
|
||||
private byte[] RecvDataPro;
|
||||
|
||||
// Token: 0x04000625 RID: 1573
|
||||
private byte[] SendData;
|
||||
|
||||
// Token: 0x04000626 RID: 1574
|
||||
private byte[] RecvData;
|
||||
|
||||
// Token: 0x04000627 RID: 1575
|
||||
private byte SendOrRecv;
|
||||
|
||||
// Token: 0x04000628 RID: 1576
|
||||
private AutoResetEvent autoConnectEvent = new AutoResetEvent(false);
|
||||
|
||||
// Token: 0x04000629 RID: 1577
|
||||
private SocketAsyncEventArgs lisnterSocketAsyncEventArgs;
|
||||
|
||||
// Token: 0x0400062C RID: 1580
|
||||
private List<SocketAsyncEventArgs> s_lst = new List<SocketAsyncEventArgs>();
|
||||
|
||||
// Token: 0x0200004A RID: 74
|
||||
// (Invoke) Token: 0x06000309 RID: 777
|
||||
public delegate void StartListeHandler();
|
||||
|
||||
// Token: 0x0200004B RID: 75
|
||||
// (Invoke) Token: 0x0600030D RID: 781
|
||||
public delegate void ReceiveMsgHandler(byte[] info);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,174 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using Agv_Info;
|
||||
using IO_Card_1730U;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x0200002C RID: 44
|
||||
public class Param
|
||||
{
|
||||
// Token: 0x0400062D RID: 1581
|
||||
public static bool Exit_Lg_Flag = false;
|
||||
|
||||
// Token: 0x0400062E RID: 1582
|
||||
public static bool StartFlag = false;
|
||||
|
||||
// Token: 0x0400062F RID: 1583
|
||||
public static string UserName = "";
|
||||
|
||||
// Token: 0x04000630 RID: 1584
|
||||
public static string Password = "";
|
||||
|
||||
// Token: 0x04000631 RID: 1585
|
||||
public static string UserName_temp = "";
|
||||
|
||||
// Token: 0x04000632 RID: 1586
|
||||
public static string Password_temp = "";
|
||||
|
||||
// Token: 0x04000633 RID: 1587
|
||||
public static Color backcolor;
|
||||
|
||||
// Token: 0x04000634 RID: 1588
|
||||
public static int Icon_Size = 32;
|
||||
|
||||
// Token: 0x04000635 RID: 1589
|
||||
public static bool Write_log;
|
||||
|
||||
// Token: 0x04000636 RID: 1590
|
||||
public static bool Display_CrossID = true;
|
||||
|
||||
// Token: 0x04000637 RID: 1591
|
||||
public static bool Hand1_St = false;
|
||||
|
||||
// Token: 0x04000638 RID: 1592
|
||||
public static bool Hand2_St = false;
|
||||
|
||||
// Token: 0x04000639 RID: 1593
|
||||
public static int Hand1_Agv_St = 0;
|
||||
|
||||
// Token: 0x0400063A RID: 1594
|
||||
public static int Hand2_Agv_St = 0;
|
||||
|
||||
// Token: 0x0400063B RID: 1595
|
||||
public static bool HandLoc1_Go = false;
|
||||
|
||||
// Token: 0x0400063C RID: 1596
|
||||
public static bool HandLoc2_Go = false;
|
||||
|
||||
// Token: 0x0400063D RID: 1597
|
||||
public static bool BY1_GO = false;
|
||||
|
||||
// Token: 0x0400063E RID: 1598
|
||||
public static bool BY1_Leave = false;
|
||||
|
||||
// Token: 0x0400063F RID: 1599
|
||||
public static bool BY2_GO = false;
|
||||
|
||||
// Token: 0x04000640 RID: 1600
|
||||
public static bool BY2_Leave = false;
|
||||
|
||||
// Token: 0x04000641 RID: 1601
|
||||
public static string map1_path = "";
|
||||
|
||||
// Token: 0x04000642 RID: 1602
|
||||
public static string map2_path = "";
|
||||
|
||||
// Token: 0x04000643 RID: 1603
|
||||
public static string map3_path = "";
|
||||
|
||||
// Token: 0x04000644 RID: 1604
|
||||
public static bool map1_status = true;
|
||||
|
||||
// Token: 0x04000645 RID: 1605
|
||||
public static bool map2_status = false;
|
||||
|
||||
// Token: 0x04000646 RID: 1606
|
||||
public static bool map3_status = false;
|
||||
|
||||
// Token: 0x04000647 RID: 1607
|
||||
public static bool Location_ID_Dispaly = true;
|
||||
|
||||
// Token: 0x04000648 RID: 1608
|
||||
public static string connectStr = "";
|
||||
|
||||
// Token: 0x04000649 RID: 1609
|
||||
public static string Pro_id = "";
|
||||
|
||||
// Token: 0x0400064A RID: 1610
|
||||
public static string Pro_factory = "";
|
||||
|
||||
// Token: 0x0400064B RID: 1611
|
||||
public static string Pro_remark = "";
|
||||
|
||||
// Token: 0x0400064C RID: 1612
|
||||
public static int Day_Count = 15;
|
||||
|
||||
// Token: 0x0400064D RID: 1613
|
||||
public static int Card1_Interval = 0;
|
||||
|
||||
// Token: 0x0400064E RID: 1614
|
||||
public static int Card2_Interval = 0;
|
||||
|
||||
// Token: 0x0400064F RID: 1615
|
||||
public static int Card3_Interval = 0;
|
||||
|
||||
// Token: 0x04000650 RID: 1616
|
||||
public static IO_Card card1;
|
||||
|
||||
// Token: 0x04000651 RID: 1617
|
||||
public static IO_Card card2;
|
||||
|
||||
// Token: 0x04000652 RID: 1618
|
||||
public static IO_Card card3;
|
||||
|
||||
// Token: 0x04000653 RID: 1619
|
||||
public static Thread[] th_GetData;
|
||||
|
||||
// Token: 0x04000654 RID: 1620
|
||||
public static byte AGV_Qty = 0;
|
||||
|
||||
// Token: 0x04000655 RID: 1621
|
||||
public static AgvInfo agvinfocls = new AgvInfo();
|
||||
|
||||
// Token: 0x04000656 RID: 1622
|
||||
public static Type t;
|
||||
|
||||
// Token: 0x04000657 RID: 1623
|
||||
public static bool Auto_Control = false;
|
||||
|
||||
// Token: 0x04000658 RID: 1624
|
||||
public static bool Load_Path_His = false;
|
||||
|
||||
// Token: 0x04000659 RID: 1625
|
||||
public static byte PLC_Type = 0;
|
||||
|
||||
// Token: 0x0400065A RID: 1626
|
||||
public static bool Agv_Location_Auto_Display = false;
|
||||
|
||||
// Token: 0x0400065B RID: 1627
|
||||
public static byte Map_ID = 1;
|
||||
|
||||
// Token: 0x0400065C RID: 1628
|
||||
public static int Thread_Count = -1;
|
||||
|
||||
// Token: 0x0400065D RID: 1629
|
||||
public static bool Frm_Ischild = false;
|
||||
|
||||
// Token: 0x0400065E RID: 1630
|
||||
public static string Xj_Time1 = "";
|
||||
|
||||
// Token: 0x0400065F RID: 1631
|
||||
public static string Xj_Time2 = "";
|
||||
|
||||
// Token: 0x04000660 RID: 1632
|
||||
public static bool Exit_Flag = false;
|
||||
|
||||
// Token: 0x04000661 RID: 1633
|
||||
public static int Wait_Time1 = 0;
|
||||
|
||||
// Token: 0x04000662 RID: 1634
|
||||
public static int Wait_Time2 = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using AGVSystem.A17168;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x0200002D RID: 45
|
||||
internal class Path_Reset
|
||||
{
|
||||
// Token: 0x06000286 RID: 646 RVA: 0x000532C0 File Offset: 0x000514C0
|
||||
public static void label12_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
bool flag = ((Label)sender).Tag.ToString() == "";
|
||||
if (!flag)
|
||||
{
|
||||
bool flag2 = MessageBox.Show("是否复位该路口?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No;
|
||||
if (!flag2)
|
||||
{
|
||||
int[] array = new int[]
|
||||
{
|
||||
(int)Convert.ToInt16(((Label)sender).Tag.ToString().Split(new char[]
|
||||
{
|
||||
'-'
|
||||
})[0]),
|
||||
(int)Convert.ToInt16(((Label)sender).Tag.ToString().Split(new char[]
|
||||
{
|
||||
'-'
|
||||
})[1])
|
||||
};
|
||||
Path_Reset.ClearOtherLand(array[1]);
|
||||
for (int i = 0; i < mainfrm.ds_CrossInfo.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
string text = mainfrm.ds_CrossInfo.Tables[0].Rows[i]["当前地标编号"].ToString();
|
||||
string text2 = mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"].ToString();
|
||||
bool flag3 = mainfrm.ds_CrossInfo.Tables[0].Rows[i]["当前产线编号"].ToString() == array[0].ToString() && mainfrm.ds_CrossInfo.Tables[0].Rows[i]["当前地标编号"].ToString() == array[1].ToString() && mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"].ToString() != "0";
|
||||
if (flag3)
|
||||
{
|
||||
MessageBox.Show("AGV-" + mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"].ToString() + "占用路口信息被清除!");
|
||||
mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000287 RID: 647 RVA: 0x00053524 File Offset: 0x00051724
|
||||
private static void ClearOtherLand(int land)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (TrafficModel trafficModel in Frm_A17168.autoLeavedDic)
|
||||
{
|
||||
bool flag = trafficModel.agvId == 0 || trafficModel.areaCode != land.ToString();
|
||||
if (!flag)
|
||||
{
|
||||
bool flag2 = Frm_A17168.businessCtrl.ByLeaved(trafficModel.agvId.ToString(), land.ToString(), trafficModel.areaCode.ToString());
|
||||
WriteTxt.SaveLog1(trafficModel.areaCode.ToString() + "手动释放,返回的值" + flag2.ToString(), "放行日志" + trafficModel.agvId.ToString(), "插件日志");
|
||||
bool flag3 = flag2;
|
||||
if (flag3)
|
||||
{
|
||||
Frm_A17168.leavedDic[trafficModel.agvId] = 0;
|
||||
trafficModel.agvId = 0;
|
||||
WriteTxt.SaveLog1(trafficModel.areaCode.ToString() + "路口已手动归还", "放行日志" + trafficModel.agvId.ToString(), "插件日志");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
// Token: 0x0200002E RID: 46
|
||||
public static class SocketExtensions
|
||||
{
|
||||
// Token: 0x06000289 RID: 649 RVA: 0x00053698 File Offset: 0x00051898
|
||||
public static bool SetKeepAlive(this Socket socket, ulong time, ulong interval)
|
||||
{
|
||||
try
|
||||
{
|
||||
ulong[] array = new ulong[]
|
||||
{
|
||||
(time == 0UL || interval == 0UL) ? 0UL : 1UL,
|
||||
time,
|
||||
interval
|
||||
};
|
||||
byte[] array2 = new byte[12];
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array2[i * 4 + 3] = (byte)(array[i] >> 24 & 255UL);
|
||||
array2[i * 4 + 2] = (byte)(array[i] >> 16 & 255UL);
|
||||
array2[i * 4 + 1] = (byte)(array[i] >> 8 & 255UL);
|
||||
array2[i * 4] = (byte)(array[i] & 255UL);
|
||||
}
|
||||
byte[] bytes = BitConverter.GetBytes(0);
|
||||
socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.KeepAlive, true);
|
||||
socket.IOControl((IOControlCode)((ulong)-1744830460), array2, bytes);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
Console.WriteLine("Failed to set keep-alive: {0} {1}", ex.ErrorCode, ex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x04000663 RID: 1635
|
||||
private const int BytesPerLong = 4;
|
||||
|
||||
// Token: 0x04000664 RID: 1636
|
||||
private const int BitsPerByte = 8;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user