本文整理汇总了C#中Offset.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# Offset.Disconnect方法的具体用法?C# Offset.Disconnect怎么用?C# Offset.Disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Offset
的用法示例。
在下文中一共展示了Offset.Disconnect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FSUIPC_GetBit
public bool FSUIPC_GetBit(int offset, int bit, int bytes, ref bool data)
{
if (_FSUIPCConnection == false)
return false;
Offset<BitArray> testoffset = new Offset<BitArray>(offset, bytes);
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
data = testoffset.Value[bit];
testoffset.Disconnect();
return true;
}
示例2: FSUIPC_SendBytes
/// <summary>
/// Send multiple bytes to FSUIPC
/// </summary>
/// <param name="offset">Offset to send data to</param>
/// <param name="data">Data to send as a Long</param>
/// <param name="length">Length of the offset</param>
/// <returns></returns>
public bool FSUIPC_SendBytes(int offset, long data, int length)
{
if (_FSUIPCConnection == false)
return false;
Offset<byte[]> testoffset = new Offset<byte[]>(offset, length);
byte[] offsetvalue = new byte[length];
byte[] rawvalue = BitConverter.GetBytes(data);
for (int i = 0; i < length; i++)
{
offsetvalue[i] = rawvalue[i];
}
testoffset.Value = offsetvalue;
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
testoffset.Disconnect();
return true;
}
示例3: tmrCheckFSUIPC_Tick
private void tmrCheckFSUIPC_Tick(object sender, EventArgs e)
{
if (!_FSUIPCConnection)
{
try
{
FSUIPCConnection.Open();
_FSUIPCConnection = true;
}
catch (Exception)
{
FSUIPCConnection.Close();
_FSUIPCConnection = false;
}
}
if (_FSUIPCConnection)
{
// Test FSUIPC Connection
Offset<byte[]> testoffset = new Offset<byte[]>(0x0264, 2);
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
FSUIPCConnection.Close();
}
testoffset.Disconnect();
}
if (_FSUIPCConnection)
lblFSUIPCConnection.Caption = "FSUIPC Connection: Connected";
else
lblFSUIPCConnection.Caption = "FSUIPC Connection: Disconnected";
}
示例4: FSUIPC_SendByte
/// <summary>
/// Send a single byte to FSUIPC
/// </summary>
/// <param name="offset">Offset to send data to</param>
/// <param name="data">Data to send as a Long</param>
/// <returns></returns>
public bool FSUIPC_SendByte(int offset, long data)
{
if (_FSUIPCConnection == false)
return false;
Offset<byte> testoffset = new Offset<byte>(offset);
byte offsetvalue = Convert.ToByte(data);
testoffset.Value = offsetvalue;
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
testoffset.Disconnect();
return true;
}
示例5: FSUIPC_SendBit
public bool FSUIPC_SendBit(int offset, int bit, bool value, int length)
{
if (_FSUIPCConnection == false)
return false;
//int bitnum = Convert.ToInt32(bit);
//double bittest = bitnum / 8;
//int length = Convert.ToInt32(Math.Floor(bittest)) + 1;
Offset<BitArray> testoffset = new Offset<BitArray>(offset, length);
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
testoffset.Value[bit] = value;
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
testoffset.Disconnect();
return true;
}
示例6: FSUIPC_GetBytes
public bool FSUIPC_GetBytes(int offset, int length, ref long data)
{
if (_FSUIPCConnection == false)
return false;
Offset<byte[]> testoffset = new Offset<byte[]>(offset, length);
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
//data = BitConverter.ToInt64(testoffset.Value, 0);
data = BitConverter.ToInt32(testoffset.Value, 0);
testoffset.Disconnect();
return true;
}
示例7: FSUIPC_GetByte
public bool FSUIPC_GetByte(int offset, ref int data)
{
if (_FSUIPCConnection == false)
return false;
Offset<byte> testoffset = new Offset<byte>(offset);
try
{
FSUIPCConnection.Process();
}
catch (Exception)
{
_FSUIPCConnection = false;
testoffset.Disconnect();
FSUIPCConnection.Close();
return false;
}
data = testoffset.Value;
testoffset.Disconnect();
return true;
}