2017-05-17 update 1 Add Comments and Reformat code.

This commit is contained in:
parallelbgls
2017-05-17 11:18:21 +08:00
parent 34b0777cc7
commit b61ea1759a
113 changed files with 2490 additions and 1557 deletions

View File

@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="COM" value="COM1"/> <add key="COM" value="COM1" />
<add key="FBoxOpcDaHost" value="opcda://localhost/FBoxOpcServer"/> <add key="FBoxOpcDaHost" value="opcda://localhost/FBoxOpcServer" />
<add key="IP" value="192.168.1.1"/> <add key="IP" value="192.168.1.1" />
<add key="IPConnectionTimeout" value="5000"/> <add key="IPConnectionTimeout" value="5000" />
<add key="ModbusPort" value="502"/> <add key="ModbusPort" value="502" />
<add key="OpcDaHost" value="opcda://localhost/..."/> <add key="OpcDaHost" value="opcda://localhost/..." />
<add key="OpcUaHost" value="opc.tcp://localhost/..."/> <add key="OpcUaHost" value="opc.tcp://localhost/..." />
<add key="SiemensPort" value="102"/> <add key="SiemensPort" value="102" />
</appSettings> </appSettings>
</configuration> </configuration>

View File

@@ -1,20 +1,39 @@
using System.Collections.Generic;
using System.IO; using System.IO;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
namespace Modbus.Net namespace Modbus.Net
{ {
/// <summary>
/// Simulate ConfigurationManager in System.Configuration
/// </summary>
public static class ConfigurationManager public static class ConfigurationManager
{ {
private static IConfigurationBuilder builder = new ConfigurationBuilder() /// <summary>
.SetBasePath(Directory.GetCurrentDirectory()) /// Configuration Builder
/// </summary>
private static readonly IConfigurationBuilder Builder = new ConfigurationBuilder()
.SetBasePath(RootPath ?? Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json") .AddJsonFile("appsettings.json")
.AddXmlFile("App.config"); .AddXmlFile("App.config");
private static IConfigurationRoot Configuration => builder.Build(); /// <summary>
/// RootPath of App.config and appsettings.json
/// </summary>
public static string RootPath { get; set; } = null;
/// <summary>
/// Configuration Root
/// </summary>
private static IConfigurationRoot Configuration => Builder.Build();
/// <summary>
/// AppSettings
/// </summary>
public static IConfigurationSection AppSettings => Configuration.GetSection("AppSettings"); public static IConfigurationSection AppSettings => Configuration.GetSection("AppSettings");
/// <summary>
/// ConnectionStrings
/// </summary>
public static IConfigurationSection ConnectionStrings => Configuration.GetSection("ConnectionStrings"); public static IConfigurationSection ConnectionStrings => Configuration.GetSection("ConnectionStrings");
} }
} }

View File

@@ -12,10 +12,12 @@ namespace Modbus.Net.Modbus
/// 读功能码 /// 读功能码
/// </summary> /// </summary>
protected Dictionary<string, AreaOutputDef> ReadFunctionCodeDictionary; protected Dictionary<string, AreaOutputDef> ReadFunctionCodeDictionary;
/// <summary> /// <summary>
/// 功能码翻译至标准Modbus地址位置 /// 功能码翻译至标准Modbus地址位置
/// </summary> /// </summary>
protected Dictionary<string, int> TransDictionary; protected Dictionary<string, int> TransDictionary;
/// <summary> /// <summary>
/// 写功能码 /// 写功能码
/// </summary> /// </summary>
@@ -201,6 +203,7 @@ namespace Modbus.Net.Modbus
/// 读功能码 /// 读功能码
/// </summary> /// </summary>
protected Dictionary<string, AreaOutputDef> ReadFunctionCodeDictionary; protected Dictionary<string, AreaOutputDef> ReadFunctionCodeDictionary;
/// <summary> /// <summary>
/// 写功能码 /// 写功能码
/// </summary> /// </summary>

View File

@@ -8,7 +8,8 @@ namespace Modbus.Net.Modbus
/// </summary> /// </summary>
public class ModbusAsciiProtocalLinker : ComProtocalLinker public class ModbusAsciiProtocalLinker : ComProtocalLinker
{ {
public ModbusAsciiProtocalLinker(string com, int slaveAddress) : base(com, 9600, Parity.None, StopBits.One, 8, slaveAddress) public ModbusAsciiProtocalLinker(string com, int slaveAddress)
: base(com, 9600, Parity.None, StopBits.One, 8, slaveAddress)
{ {
} }
@@ -18,14 +19,10 @@ namespace Modbus.Net.Modbus
//CRC校验失败 //CRC校验失败
var contentString = Encoding.ASCII.GetString(content); var contentString = Encoding.ASCII.GetString(content);
if (!Crc16.GetInstance().LrcEfficacy(contentString)) if (!Crc16.GetInstance().LrcEfficacy(contentString))
{
throw new ModbusProtocalErrorException(501); throw new ModbusProtocalErrorException(501);
}
//Modbus协议错误 //Modbus协议错误
if (byte.Parse(contentString.Substring(3, 2)) > 127) if (byte.Parse(contentString.Substring(3, 2)) > 127)
{
throw new ModbusProtocalErrorException(byte.Parse(contentString.Substring(5, 2))); throw new ModbusProtocalErrorException(byte.Parse(contentString.Substring(5, 2)));
}
return true; return true;
} }
} }

View File

@@ -47,7 +47,8 @@ namespace Modbus.Net.Modbus
/// </summary> /// </summary>
public abstract class ModbusProtocal : BaseProtocal public abstract class ModbusProtocal : BaseProtocal
{ {
protected ModbusProtocal(byte slaveAddress, byte masterAddress, Endian endian) : base(slaveAddress, masterAddress, endian) protected ModbusProtocal(byte slaveAddress, byte masterAddress, Endian endian)
: base(slaveAddress, masterAddress, endian)
{ {
} }
@@ -73,7 +74,8 @@ namespace Modbus.Net.Modbus
var translateAddress = addressTranslator.AddressTranslate(startAddress, true); var translateAddress = addressTranslator.AddressTranslate(startAddress, true);
FunctionCode = (byte) translateAddress.Area; FunctionCode = (byte) translateAddress.Area;
StartAddress = (ushort) translateAddress.Address; StartAddress = (ushort) translateAddress.Address;
GetCount = (ushort) Math.Ceiling(getCount/addressTranslator.GetAreaByteLength(translateAddress.AreaString)); GetCount =
(ushort) Math.Ceiling(getCount / addressTranslator.GetAreaByteLength(translateAddress.AreaString));
} }
public byte SlaveAddress { get; } public byte SlaveAddress { get; }
@@ -140,7 +142,7 @@ namespace Modbus.Net.Modbus
StartAddress = (ushort) translateAddress.Address; StartAddress = (ushort) translateAddress.Address;
var writeByteValue = ValueHelper.GetInstance(endian).ObjectArrayToByteArray(writeValue); var writeByteValue = ValueHelper.GetInstance(endian).ObjectArrayToByteArray(writeValue);
WriteCount = WriteCount =
(ushort) (writeByteValue.Length/addressTranslator.GetAreaByteLength(translateAddress.AreaString)); (ushort) (writeByteValue.Length / addressTranslator.GetAreaByteLength(translateAddress.AreaString));
WriteByteCount = (byte) writeByteValue.Length; WriteByteCount = (byte) writeByteValue.Length;
WriteValue = writeByteValue; WriteValue = writeByteValue;
} }

View File

@@ -61,9 +61,7 @@ namespace Modbus.Net.Modbus
var newContent = new List<byte>(); var newContent = new List<byte>();
newContent.AddRange(Encoding.ASCII.GetBytes(":")); newContent.AddRange(Encoding.ASCII.GetBytes(":"));
foreach (var number in content) foreach (var number in content)
{
newContent.AddRange(Encoding.ASCII.GetBytes(number.ToString("X2"))); newContent.AddRange(Encoding.ASCII.GetBytes(number.ToString("X2")));
}
newContent.AddRange(Encoding.ASCII.GetBytes(Crc16.GetInstance().GetLRC(content))); newContent.AddRange(Encoding.ASCII.GetBytes(Crc16.GetInstance().GetLRC(content)));
newContent.Add(0x0d); newContent.Add(0x0d);
newContent.Add(0x0a); newContent.Add(0x0a);

View File

@@ -7,7 +7,8 @@ namespace Modbus.Net.Modbus
/// </summary> /// </summary>
public class ModbusRtuProtocalLinker : ComProtocalLinker public class ModbusRtuProtocalLinker : ComProtocalLinker
{ {
public ModbusRtuProtocalLinker(string com, int slaveAddress) : base(com, 9600, Parity.None, StopBits.One, 8, slaveAddress) public ModbusRtuProtocalLinker(string com, int slaveAddress)
: base(com, 9600, Parity.None, StopBits.One, 8, slaveAddress)
{ {
} }
@@ -16,14 +17,10 @@ namespace Modbus.Net.Modbus
if (!base.CheckRight(content).Value) return false; if (!base.CheckRight(content).Value) return false;
//CRC校验失败 //CRC校验失败
if (!Crc16.GetInstance().CrcEfficacy(content)) if (!Crc16.GetInstance().CrcEfficacy(content))
{
throw new ModbusProtocalErrorException(501); throw new ModbusProtocalErrorException(501);
}
//Modbus协议错误 //Modbus协议错误
if (content[1] > 127) if (content[1] > 127)
{
throw new ModbusProtocalErrorException(content[2]); throw new ModbusProtocalErrorException(content[2]);
}
return true; return true;
} }
} }

View File

@@ -12,7 +12,8 @@ namespace Modbus.Net.Modbus
{ {
} }
public ModbusTcpProtocal(string ip, byte slaveAddress, byte masterAddress, Endian endian) : base(slaveAddress, masterAddress, endian) public ModbusTcpProtocal(string ip, byte slaveAddress, byte masterAddress, Endian endian)
: base(slaveAddress, masterAddress, endian)
{ {
ProtocalLinker = new ModbusTcpProtocalLinker(ip); ProtocalLinker = new ModbusTcpProtocalLinker(ip);
} }

View File

@@ -7,7 +7,8 @@ namespace Modbus.Net.Modbus
/// </summary> /// </summary>
public class ModbusTcpProtocalLinker : TcpProtocalLinker public class ModbusTcpProtocalLinker : TcpProtocalLinker
{ {
public ModbusTcpProtocalLinker(string ip) : base(ip, int.Parse(ConfigurationManager.AppSettings["ModbusPort"] ?? "502")) public ModbusTcpProtocalLinker(string ip)
: base(ip, int.Parse(ConfigurationManager.AppSettings["ModbusPort"] ?? "502"))
{ {
} }
@@ -20,14 +21,10 @@ namespace Modbus.Net.Modbus
if (!base.CheckRight(content).Value) return false; if (!base.CheckRight(content).Value) return false;
//长度校验失败 //长度校验失败
if (content[5] != content.Length - 6) if (content[5] != content.Length - 6)
{
throw new ModbusProtocalErrorException(500); throw new ModbusProtocalErrorException(500);
}
//Modbus协议错误 //Modbus协议错误
if (content[7] > 127) if (content[7] > 127)
{
throw new ModbusProtocalErrorException(content[2] > 0 ? content[2] : content[8]); throw new ModbusProtocalErrorException(content[2] > 0 ? content[2] : content[8]);
}
return true; return true;
} }
} }

View File

@@ -27,14 +27,15 @@ namespace Modbus.Net.Modbus
/// <summary> /// <summary>
/// Modbus基础Api入口 /// Modbus基础Api入口
/// </summary> /// </summary>
public class ModbusUtility : BaseUtility, IUtilityMethodTime public class ModbusUtility : BaseUtility, IIUtilityMethodTime
{ {
/// <summary> /// <summary>
/// Modbus协议类型 /// Modbus协议类型
/// </summary> /// </summary>
private ModbusType _modbusType; private ModbusType _modbusType;
public ModbusUtility(int connectionType, byte slaveAddress, byte masterAddress, Endian endian = Endian.BigEndianLsb) public ModbusUtility(int connectionType, byte slaveAddress, byte masterAddress,
Endian endian = Endian.BigEndianLsb)
: base(slaveAddress, masterAddress) : base(slaveAddress, masterAddress)
{ {
Endian = endian; Endian = endian;
@@ -43,7 +44,8 @@ namespace Modbus.Net.Modbus
AddressTranslator = new AddressTranslatorModbus(); AddressTranslator = new AddressTranslatorModbus();
} }
public ModbusUtility(ModbusType connectionType, string connectionString, byte slaveAddress, byte masterAddress, Endian endian = Endian.BigEndianLsb) public ModbusUtility(ModbusType connectionType, string connectionString, byte slaveAddress, byte masterAddress,
Endian endian = Endian.BigEndianLsb)
: base(slaveAddress, masterAddress) : base(slaveAddress, masterAddress)
{ {
Endian = endian; Endian = endian;
@@ -120,6 +122,47 @@ namespace Modbus.Net.Modbus
} }
} }
/// <summary>
/// 读时间
/// </summary>
/// <returns>设备的时间</returns>
public async Task<DateTime> GetTimeAsync()
{
try
{
var inputStruct = new GetSystemTimeModbusInputStruct(SlaveAddress);
var outputStruct =
await Wrapper.SendReceiveAsync<GetSystemTimeModbusOutputStruct>(
Wrapper[typeof(GetSystemTimeModbusProtocal)], inputStruct);
return outputStruct?.Time ?? DateTime.MinValue;
}
catch (Exception)
{
return DateTime.MinValue;
}
}
/// <summary>
/// 写时间
/// </summary>
/// <param name="setTime">需要写入的时间</param>
/// <returns>写入是否成功</returns>
public async Task<bool> SetTimeAsync(DateTime setTime)
{
try
{
var inputStruct = new SetSystemTimeModbusInputStruct(SlaveAddress, setTime);
var outputStruct =
await Wrapper.SendReceiveAsync<SetSystemTimeModbusOutputStruct>(
Wrapper[typeof(SetSystemTimeModbusProtocal)], inputStruct);
return outputStruct?.WriteCount > 0;
}
catch (Exception)
{
return false;
}
}
public override void SetConnectionType(int connectionType) public override void SetConnectionType(int connectionType)
{ {
ModbusType = (ModbusType) connectionType; ModbusType = (ModbusType) connectionType;
@@ -138,7 +181,8 @@ namespace Modbus.Net.Modbus
var inputStruct = new ReadDataModbusInputStruct(SlaveAddress, startAddress, var inputStruct = new ReadDataModbusInputStruct(SlaveAddress, startAddress,
(ushort) getByteCount, AddressTranslator); (ushort) getByteCount, AddressTranslator);
var outputStruct = await var outputStruct = await
Wrapper.SendReceiveAsync<ReadDataModbusOutputStruct>(Wrapper[typeof (ReadDataModbusProtocal)], inputStruct); Wrapper.SendReceiveAsync<ReadDataModbusOutputStruct>(Wrapper[typeof(ReadDataModbusProtocal)],
inputStruct);
return outputStruct?.DataValue; return outputStruct?.DataValue;
} }
catch catch
@@ -160,7 +204,8 @@ namespace Modbus.Net.Modbus
var inputStruct = new WriteDataModbusInputStruct(SlaveAddress, startAddress, setContents, var inputStruct = new WriteDataModbusInputStruct(SlaveAddress, startAddress, setContents,
AddressTranslator, Endian); AddressTranslator, Endian);
var outputStruct = await var outputStruct = await
Wrapper.SendReceiveAsync<WriteDataModbusOutputStruct>(Wrapper[typeof (WriteDataModbusProtocal)], inputStruct); Wrapper.SendReceiveAsync<WriteDataModbusOutputStruct>(Wrapper[typeof(WriteDataModbusProtocal)],
inputStruct);
return outputStruct?.WriteCount == setContents.Length; return outputStruct?.WriteCount == setContents.Length;
} }
catch catch
@@ -168,44 +213,5 @@ namespace Modbus.Net.Modbus
return false; return false;
} }
} }
/// <summary>
/// 读时间
/// </summary>
/// <returns>设备的时间</returns>
public async Task<DateTime> GetTimeAsync()
{
try
{
var inputStruct = new GetSystemTimeModbusInputStruct(SlaveAddress);
var outputStruct =
await Wrapper.SendReceiveAsync<GetSystemTimeModbusOutputStruct>(Wrapper[typeof(GetSystemTimeModbusProtocal)], inputStruct);
return outputStruct?.Time ?? DateTime.MinValue;
}
catch (Exception)
{
return DateTime.MinValue;
}
}
/// <summary>
/// 写时间
/// </summary>
/// <param name="setTime">需要写入的时间</param>
/// <returns>写入是否成功</returns>
public async Task<bool> SetTimeAsync(DateTime setTime)
{
try
{
var inputStruct = new SetSystemTimeModbusInputStruct(SlaveAddress, setTime);
var outputStruct =
await Wrapper.SendReceiveAsync<SetSystemTimeModbusOutputStruct>(Wrapper[typeof(SetSystemTimeModbusProtocal)], inputStruct);
return outputStruct?.WriteCount > 0;
}
catch (Exception)
{
return false;
}
}
} }
} }

View File

@@ -6,7 +6,8 @@ namespace Modbus.Net.OPC
/// <summary> /// <summary>
/// Opc地址编码器 /// Opc地址编码器
/// </summary> /// </summary>
public class AddressFormaterOpc<TMachineKey,TUnitKey> : AddressFormater where TMachineKey : IEquatable<TMachineKey> where TUnitKey : IEquatable<TUnitKey> public class AddressFormaterOpc<TMachineKey, TUnitKey> : AddressFormater where TMachineKey : IEquatable<TMachineKey>
where TUnitKey : IEquatable<TUnitKey>
{ {
/// <summary> /// <summary>
/// 协议构造器 /// 协议构造器
@@ -14,7 +15,8 @@ namespace Modbus.Net.OPC
/// <param name="tagGeter">如何通过BaseMachine和AddressUnit构造Opc的标签</param> /// <param name="tagGeter">如何通过BaseMachine和AddressUnit构造Opc的标签</param>
/// <param name="machine">调用这个编码器的设备</param> /// <param name="machine">调用这个编码器的设备</param>
/// <param name="seperator">每两个标签之间用什么符号隔开,默认为/</param> /// <param name="seperator">每两个标签之间用什么符号隔开,默认为/</param>
public AddressFormaterOpc(Func<BaseMachine<TMachineKey, TUnitKey>, AddressUnit<TUnitKey>, string[]> tagGeter, BaseMachine<TMachineKey, TUnitKey> machine, public AddressFormaterOpc(Func<BaseMachine<TMachineKey, TUnitKey>, AddressUnit<TUnitKey>, string[]> tagGeter,
BaseMachine<TMachineKey, TUnitKey> machine,
char seperator = '/') char seperator = '/')
{ {
Machine = machine; Machine = machine;
@@ -35,9 +37,7 @@ namespace Modbus.Net.OPC
var strings = TagGeter(Machine, findAddress); var strings = TagGeter(Machine, findAddress);
var ans = ""; var ans = "";
for (var i = 0; i < strings.Length; i++) for (var i = 0; i < strings.Length; i++)
{
ans += strings[i].Trim().Replace(" ", "") + Seperator; ans += strings[i].Trim().Replace(" ", "") + Seperator;
}
ans = ans.Substring(0, ans.Length - 1); ans = ans.Substring(0, ans.Length - 1);
return ans; return ans;
} }

View File

@@ -1,16 +1,16 @@
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Hylasoft.Opc.Common; using Hylasoft.Opc.Common;
using Hylasoft.Opc.Da; using Hylasoft.Opc.Da;
using Opc;
using Opc.Da;
using System.Collections.Generic;
using Hylasoft.Opc.Ua; using Hylasoft.Opc.Ua;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
public interface IClientExtend : IDisposable public interface IClientExtend : IDisposable
{ {
Node RootNodeBase { get; }
void Connect(); void Connect();
T Read<T>(string tag); T Read<T>(string tag);
@@ -24,8 +24,6 @@ namespace Modbus.Net.OPC
Task<Node> FindNodeAsync(string tag); Task<Node> FindNodeAsync(string tag);
Task<IEnumerable<Node>> ExploreFolderAsync(string tag); Task<IEnumerable<Node>> ExploreFolderAsync(string tag);
Node RootNodeBase { get; }
} }
public class MyDaClient : DaClient, IClientExtend public class MyDaClient : DaClient, IClientExtend

View File

@@ -1,27 +1,20 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net.OPC.FBox namespace Modbus.Net.OPC.FBox
{ {
public class FBoxOpcDaMachine : OpcDaMachine public class FBoxOpcDaMachine : OpcDaMachine
{ {
public string LocalSequence { get; set; }
public string LinkerName { get; set; }
public FBoxOpcDaMachine(string localSequence, string linkerName, public FBoxOpcDaMachine(string localSequence, string linkerName,
IEnumerable<AddressUnit> getAddresses, bool keepConnect) : base(ConfigurationManager.AppSettings["FBoxOpcDaHost"], getAddresses, keepConnect) IEnumerable<AddressUnit> getAddresses, bool keepConnect)
: base(ConfigurationManager.AppSettings["FBoxOpcDaHost"], getAddresses, keepConnect)
{ {
LocalSequence = localSequence; LocalSequence = localSequence;
LinkerName = linkerName; LinkerName = linkerName;
AddressFormater = AddressFormater =
new AddressFormaterOpc<string,string>( new AddressFormaterOpc<string, string>(
(machine, unit) => (machine, unit) =>
new string[] new[]
{ {
"(.*)", ((FBoxOpcDaMachine) machine).LinkerName, ((FBoxOpcDaMachine) machine).LocalSequence, "(.*)", ((FBoxOpcDaMachine) machine).LinkerName, ((FBoxOpcDaMachine) machine).LocalSequence,
unit.Name unit.Name
@@ -33,5 +26,9 @@ namespace Modbus.Net.OPC.FBox
: this(localSequence, linkerName, getAddresses, false) : this(localSequence, linkerName, getAddresses, false)
{ {
} }
public string LocalSequence { get; set; }
public string LinkerName { get; set; }
} }
} }

View File

@@ -1,25 +1,25 @@
using Hylasoft.Opc.Common; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Hylasoft.Opc.Common;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
public abstract class OpcConnector : BaseConnector<OpcParamIn, OpcParamOut> public abstract class OpcConnector : BaseConnector<OpcParamIn, OpcParamOut>
{ {
protected IClientExtend Client;
protected bool _connect; protected bool _connect;
public override string ConnectionToken { get; } protected IClientExtend Client;
public override bool IsConnected => _connect;
protected OpcConnector(string host) protected OpcConnector(string host)
{ {
ConnectionToken = host; ConnectionToken = host;
} }
public override string ConnectionToken { get; }
public override bool IsConnected => _connect;
public override bool Disconnect() public override bool Disconnect()
{ {
@@ -56,15 +56,12 @@ namespace Modbus.Net.OPC
private void FoldWith(List<string> tagSplitList, char splitChar, char startChar, char endChar) private void FoldWith(List<string> tagSplitList, char splitChar, char startChar, char endChar)
{ {
for (int i = 0; i < tagSplitList.Count; i++) for (var i = 0; i < tagSplitList.Count; i++)
{ if (tagSplitList[i].Count(ch => ch == startChar) > tagSplitList[i].Count(ch => ch == endChar))
if (tagSplitList[i].Count(ch=>ch == startChar) > tagSplitList[i].Count(ch=>ch == endChar)) for (var j = i + 1; j < tagSplitList.Count; j++)
{
for (int j = i + 1; j < tagSplitList.Count; j++)
{
if (tagSplitList[j].Contains(endChar)) if (tagSplitList[j].Contains(endChar))
{ {
for (int k = i + 1; k <= j; k++) for (var k = i + 1; k <= j; k++)
{ {
tagSplitList[i] += splitChar + tagSplitList[i + 1]; tagSplitList[i] += splitChar + tagSplitList[i + 1];
tagSplitList.RemoveAt(i + 1); tagSplitList.RemoveAt(i + 1);
@@ -72,9 +69,6 @@ namespace Modbus.Net.OPC
i--; i--;
break; break;
} }
}
}
}
} }
private string[] SplitTag(string tag, char split) private string[] SplitTag(string tag, char split)
@@ -108,7 +102,7 @@ namespace Modbus.Net.OPC
Value = BigEndianValueHelper.Instance.GetBytes(result, result.GetType()) Value = BigEndianValueHelper.Instance.GetBytes(result, result.GetType())
}; };
} }
return new OpcParamOut() return new OpcParamOut
{ {
Success = false, Success = false,
Value = Encoding.ASCII.GetBytes("NoData") Value = Encoding.ASCII.GetBytes("NoData")
@@ -132,17 +126,17 @@ namespace Modbus.Net.OPC
catch (Exception e) catch (Exception e)
{ {
AddInfo("opc write exception:" + e.Message); AddInfo("opc write exception:" + e.Message);
return new OpcParamOut() return new OpcParamOut
{ {
Success = false Success = false
}; };
} }
return new OpcParamOut() return new OpcParamOut
{ {
Success = true Success = true
}; };
} }
return new OpcParamOut() return new OpcParamOut
{ {
Success = false Success = false
}; };
@@ -151,7 +145,7 @@ namespace Modbus.Net.OPC
catch (Exception e) catch (Exception e)
{ {
AddInfo("opc client exception:" + e.Message); AddInfo("opc client exception:" + e.Message);
return new OpcParamOut() return new OpcParamOut
{ {
Success = false, Success = false,
Value = Encoding.ASCII.GetBytes("NoData") Value = Encoding.ASCII.GetBytes("NoData")
@@ -203,4 +197,4 @@ namespace Modbus.Net.OPC
return Task.FromResult(Connect()); return Task.FromResult(Connect());
} }
} }
} }

View File

@@ -1,9 +1,5 @@
using Hylasoft.Opc.Common; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {

View File

@@ -3,7 +3,8 @@ using System.Collections.Generic;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
public class OpcDaMachine<TKey, TUnitKey> : OpcMachine<TKey, TUnitKey> where TKey : IEquatable<TKey> where TUnitKey : IEquatable<TUnitKey> public class OpcDaMachine<TKey, TUnitKey> : OpcMachine<TKey, TUnitKey> where TKey : IEquatable<TKey>
where TUnitKey : IEquatable<TUnitKey>
{ {
public OpcDaMachine(string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool keepConnect) public OpcDaMachine(string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool keepConnect)
: base(getAddresses, keepConnect) : base(getAddresses, keepConnect)
@@ -21,12 +22,12 @@ namespace Modbus.Net.OPC
public class OpcDaMachine : OpcMachine public class OpcDaMachine : OpcMachine
{ {
public OpcDaMachine(string connectionString, IEnumerable<AddressUnit> getAddresses, bool keepConnect) public OpcDaMachine(string connectionString, IEnumerable<AddressUnit> getAddresses, bool keepConnect)
: base(getAddresses, keepConnect) : base(getAddresses, keepConnect)
{ {
BaseUtility = new OpcDaUtility(connectionString); BaseUtility = new OpcDaUtility(connectionString);
((OpcUtility)BaseUtility).GetSeperator += ((OpcUtility) BaseUtility).GetSeperator +=
() => ((AddressFormaterOpc<string, string>)AddressFormater).Seperator; () => ((AddressFormaterOpc<string, string>) AddressFormater).Seperator;
} }
public OpcDaMachine(string connectionString, IEnumerable<AddressUnit> getAddresses) public OpcDaMachine(string connectionString, IEnumerable<AddressUnit> getAddresses)

View File

@@ -1,10 +1,9 @@
using System.Configuration; using System.Configuration;
using System.Text;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
/// <summary> /// <summary>
/// Opc Da协议连接器 /// Opc Da协议连接器
/// </summary> /// </summary>
public class OpcDaProtocalLinker : OpcProtocalLinker public class OpcDaProtocalLinker : OpcProtocalLinker
{ {

View File

@@ -1,7 +1,4 @@
using System; namespace Modbus.Net.OPC
using System.Threading.Tasks;
namespace Modbus.Net.OPC
{ {
/// <summary> /// <summary>
/// Opc Da协议Api入口 /// Opc Da协议Api入口

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
@@ -32,4 +29,4 @@ namespace Modbus.Net.OPC
AddressCombinerSet = new AddressCombinerSingle(); AddressCombinerSet = new AddressCombinerSingle();
} }
} }
} }

View File

@@ -1,6 +1,4 @@
using System.Text; namespace Modbus.Net.OPC
namespace Modbus.Net.OPC
{ {
/// <summary> /// <summary>
/// Opc协议 /// Opc协议
@@ -41,7 +39,7 @@ namespace Modbus.Net.OPC
public override OpcParamIn Format(IInputStruct message) public override OpcParamIn Format(IInputStruct message)
{ {
var r_message = (ReadRequestOpcInputStruct) message; var r_message = (ReadRequestOpcInputStruct) message;
return new OpcParamIn() return new OpcParamIn
{ {
IsRead = true, IsRead = true,
Tag = r_message.Tag, Tag = r_message.Tag,
@@ -88,7 +86,7 @@ namespace Modbus.Net.OPC
public override OpcParamIn Format(IInputStruct message) public override OpcParamIn Format(IInputStruct message)
{ {
var r_message = (WriteRequestOpcInputStruct) message; var r_message = (WriteRequestOpcInputStruct) message;
return new OpcParamIn() return new OpcParamIn
{ {
IsRead = false, IsRead = false,
Tag = r_message.Tag, Tag = r_message.Tag,

View File

@@ -1,7 +1,4 @@
using System; using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
@@ -51,10 +48,8 @@ namespace Modbus.Net.OPC
{ {
if (content == null || !content.Success) return false; if (content == null || !content.Success) return false;
if (content.Value.Length == 6 && Encoding.ASCII.GetString(content.Value) == "NoData") if (content.Value.Length == 6 && Encoding.ASCII.GetString(content.Value) == "NoData")
{
return null; return null;
}
return base.CheckRight(content); return base.CheckRight(content);
} }
} }
} }

View File

@@ -1,11 +1,5 @@
using Hylasoft.Opc.Common; using System;
using Hylasoft.Opc.Ua;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
@@ -31,4 +25,4 @@ namespace Modbus.Net.OPC
return _instances[host]; return _instances[host];
} }
} }
} }

View File

@@ -1,19 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
public class OpcUaMachine<TKey, TUnitKey> : OpcMachine<TKey, TUnitKey> where TKey : IEquatable<TKey> where TUnitKey : IEquatable<TUnitKey> public class OpcUaMachine<TKey, TUnitKey> : OpcMachine<TKey, TUnitKey> where TKey : IEquatable<TKey>
where TUnitKey : IEquatable<TUnitKey>
{ {
public OpcUaMachine(string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool keepConnect) public OpcUaMachine(string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool keepConnect)
: base(getAddresses, keepConnect) : base(getAddresses, keepConnect)
{ {
BaseUtility = new OpcUaUtility(connectionString); BaseUtility = new OpcUaUtility(connectionString);
((OpcUtility)BaseUtility).GetSeperator += ((OpcUtility) BaseUtility).GetSeperator +=
() => ((AddressFormaterOpc<string, string>)AddressFormater).Seperator; () => ((AddressFormaterOpc<string, string>) AddressFormater).Seperator;
} }
public OpcUaMachine(string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses) public OpcUaMachine(string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses)
@@ -28,8 +26,8 @@ namespace Modbus.Net.OPC
: base(getAddresses, keepConnect) : base(getAddresses, keepConnect)
{ {
BaseUtility = new OpcUaUtility(connectionString); BaseUtility = new OpcUaUtility(connectionString);
((OpcUtility)BaseUtility).GetSeperator += ((OpcUtility) BaseUtility).GetSeperator +=
() => ((AddressFormaterOpc<string, string>)AddressFormater).Seperator; () => ((AddressFormaterOpc<string, string>) AddressFormater).Seperator;
} }
public OpcUaMachine(string connectionString, IEnumerable<AddressUnit> getAddresses) public OpcUaMachine(string connectionString, IEnumerable<AddressUnit> getAddresses)
@@ -37,4 +35,4 @@ namespace Modbus.Net.OPC
{ {
} }
} }
} }

View File

@@ -1,8 +1,4 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
@@ -33,4 +29,4 @@ namespace Modbus.Net.OPC
return true; return true;
} }
} }
} }

View File

@@ -1,14 +1,9 @@
using System; using System.Configuration;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
/// <summary> /// <summary>
/// Opc Da协议连接器 /// Opc Da协议连接器
/// </summary> /// </summary>
public class OpcUaProtocalLinker : OpcProtocalLinker public class OpcUaProtocalLinker : OpcProtocalLinker
{ {
@@ -21,4 +16,4 @@ namespace Modbus.Net.OPC
BaseConnector = OpcUaConnector.Instance(host); BaseConnector = OpcUaConnector.Instance(host);
} }
} }
} }

View File

@@ -1,10 +1,4 @@
using System; namespace Modbus.Net.OPC
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net.OPC
{ {
/// <summary> /// <summary>
/// Opc Da协议Api入口 /// Opc Da协议Api入口
@@ -16,4 +10,4 @@ namespace Modbus.Net.OPC
Wrapper = new OpcUaProtocal(ConnectionString); Wrapper = new OpcUaProtocal(ConnectionString);
} }
} }
} }

View File

@@ -1,25 +1,22 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Modbus.Net.OPC namespace Modbus.Net.OPC
{ {
public abstract class OpcUtility : BaseUtility<OpcParamIn, OpcParamOut, ProtocalUnit<OpcParamIn, OpcParamOut>> public abstract class OpcUtility : BaseUtility<OpcParamIn, OpcParamOut, ProtocalUnit<OpcParamIn, OpcParamOut>>
{ {
public delegate char GetSeperatorDelegate();
protected OpcUtility(string connectionString) : base(0, 0) protected OpcUtility(string connectionString) : base(0, 0)
{ {
ConnectionString = connectionString; ConnectionString = connectionString;
AddressTranslator = new AddressTranslatorOpc(); AddressTranslator = new AddressTranslatorOpc();
} }
public delegate char GetSeperatorDelegate(); public override Endian Endian => Endian.BigEndianLsb;
public event GetSeperatorDelegate GetSeperator; public event GetSeperatorDelegate GetSeperator;
public override Endian Endian => Endian.BigEndianLsb;
public override void SetConnectionType(int connectionType) public override void SetConnectionType(int connectionType)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@@ -33,7 +30,8 @@ namespace Modbus.Net.OPC
var readRequestOpcInputStruct = new ReadRequestOpcInputStruct(startAddress, split); var readRequestOpcInputStruct = new ReadRequestOpcInputStruct(startAddress, split);
var readRequestOpcOutputStruct = var readRequestOpcOutputStruct =
await await
Wrapper.SendReceiveAsync<ReadRequestOpcOutputStruct>(Wrapper[typeof(ReadRequestOpcProtocal)], readRequestOpcInputStruct); Wrapper.SendReceiveAsync<ReadRequestOpcOutputStruct>(Wrapper[typeof(ReadRequestOpcProtocal)],
readRequestOpcInputStruct);
return readRequestOpcOutputStruct?.GetValue; return readRequestOpcOutputStruct?.GetValue;
} }
catch (Exception) catch (Exception)
@@ -50,7 +48,8 @@ namespace Modbus.Net.OPC
var writeRequestOpcInputStruct = new WriteRequestOpcInputStruct(startAddress, split, setContents[0]); var writeRequestOpcInputStruct = new WriteRequestOpcInputStruct(startAddress, split, setContents[0]);
var writeRequestOpcOutputStruct = var writeRequestOpcOutputStruct =
await await
Wrapper.SendReceiveAsync<WriteRequestOpcOutputStruct>(Wrapper[typeof(WriteRequestOpcProtocal)], writeRequestOpcInputStruct); Wrapper.SendReceiveAsync<WriteRequestOpcOutputStruct>(Wrapper[typeof(WriteRequestOpcProtocal)],
writeRequestOpcInputStruct);
return writeRequestOpcOutputStruct?.WriteResult == true; return writeRequestOpcOutputStruct?.WriteResult == true;
} }
catch (Exception e) catch (Exception e)
@@ -59,4 +58,4 @@ namespace Modbus.Net.OPC
} }
} }
} }
} }

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="H.Opc" version="0.8.1" targetFramework="net45" />
</packages>

View File

@@ -17,7 +17,7 @@
} }
/// <summary> /// <summary>
/// Siemens地址格式化Siemens格式 /// Siemens地址格式化Siemens格式
/// </summary> /// </summary>
public class AddressFormaterSimenseStandard : AddressFormater public class AddressFormaterSimenseStandard : AddressFormater
{ {
@@ -25,26 +25,16 @@
{ {
if (area.Length > 1 && if (area.Length > 1 &&
area.ToUpper().Substring(0, 2) == "DB") area.ToUpper().Substring(0, 2) == "DB")
{
return area.ToUpper() + "." + "DB" + address; return area.ToUpper() + "." + "DB" + address;
} return area.ToUpper() + address;
else
{
return area.ToUpper() + address;
}
} }
public override string FormatAddress(string area, int address, int subAddress) public override string FormatAddress(string area, int address, int subAddress)
{ {
if (area.Length > 1 && if (area.Length > 1 &&
area.ToUpper().Substring(0, 2) == "DB") area.ToUpper().Substring(0, 2) == "DB")
{
return area.ToUpper() + "." + "DB" + address + "." + subAddress; return area.ToUpper() + "." + "DB" + address + "." + subAddress;
} return area.ToUpper() + address + "." + subAddress;
else
{
return area.ToUpper() + address + "." + subAddress;
}
} }
} }
} }

View File

@@ -53,7 +53,7 @@ namespace Modbus.Net.Siemens
return new AddressDef return new AddressDef
{ {
AreaString = "DB" + head, AreaString = "DB" + head,
Area = int.Parse(head)*256 + AreaCodeDictionary["DB"], Area = int.Parse(head) * 256 + AreaCodeDictionary["DB"],
Address = int.Parse(tail), Address = int.Parse(tail),
SubAddress = int.Parse(sub) SubAddress = int.Parse(sub)
}; };
@@ -96,7 +96,7 @@ namespace Modbus.Net.Siemens
{"Q", 0x82}, {"Q", 0x82},
{"M", 0x83}, {"M", 0x83},
{"DB", 0x84}, {"DB", 0x84},
{"V", 0x184}, {"V", 0x184}
}; };
} }
@@ -118,15 +118,13 @@ namespace Modbus.Net.Siemens
SubAddress = addressSplit.Length == 2 ? 0 : int.Parse(addressSplit[2]) SubAddress = addressSplit.Length == 2 ? 0 : int.Parse(addressSplit[2])
}; };
} }
int i = 0; var i = 0;
int t; int t;
while (!int.TryParse(address[i].ToString(), out t) && i < address.Length) while (!int.TryParse(address[i].ToString(), out t) && i < address.Length)
{
i++; i++;
}
if (i == 0 || i >= address.Length) throw new FormatException(); if (i == 0 || i >= address.Length) throw new FormatException();
string head = address.Substring(0, i); var head = address.Substring(0, i);
string[] tail = address.Substring(i).Split('.'); var tail = address.Substring(i).Split('.');
return new AddressDef return new AddressDef
{ {
AreaString = head, AreaString = head,

View File

@@ -29,9 +29,7 @@ namespace Modbus.Net.Siemens
public override async Task<byte[]> SendReceiveAsync(params object[] content) public override async Task<byte[]> SendReceiveAsync(params object[] content)
{ {
if (ProtocalLinker == null || !ProtocalLinker.IsConnected) if (ProtocalLinker == null || !ProtocalLinker.IsConnected)
{
await ConnectAsync(); await ConnectAsync();
}
return await base.SendReceiveAsync(Endian, content); return await base.SendReceiveAsync(Endian, content);
} }
@@ -51,17 +49,17 @@ namespace Modbus.Net.Siemens
var inputStruct = new ComCreateReferenceSiemensInputStruct(SlaveAddress, MasterAddress); var inputStruct = new ComCreateReferenceSiemensInputStruct(SlaveAddress, MasterAddress);
var outputStruct = var outputStruct =
await await await await
ForceSendReceiveAsync(this[typeof (ComCreateReferenceSiemensProtocal)], ForceSendReceiveAsync(this[typeof(ComCreateReferenceSiemensProtocal)],
inputStruct). inputStruct).
ContinueWith(async answer => ContinueWith(async answer =>
{ {
if (!ProtocalLinker.IsConnected) return false; if (!ProtocalLinker.IsConnected) return false;
var inputStruct2 = new ComConfirmMessageSiemensInputStruct(SlaveAddress, MasterAddress); var inputStruct2 = new ComConfirmMessageSiemensInputStruct(SlaveAddress, MasterAddress);
var outputStruct2 = var outputStruct2 =
(ComConfirmMessageSiemensOutputStruct) (ComConfirmMessageSiemensOutputStruct)
await await
ForceSendReceiveAsync(this[typeof (ComConfirmMessageSiemensProtocal)], ForceSendReceiveAsync(this[typeof(ComConfirmMessageSiemensProtocal)],
inputStruct2); inputStruct2);
return outputStruct2 != null; return outputStruct2 != null;
}); });
return outputStruct; return outputStruct;

View File

@@ -65,15 +65,11 @@ namespace Modbus.Net.Siemens
if (!base.CheckRight(content).Value) return false; if (!base.CheckRight(content).Value) return false;
var fcsCheck = 0; var fcsCheck = 0;
if (content.Length == 1 && content[0] == 0xe5) if (content.Length == 1 && content[0] == 0xe5)
{
return true; return true;
}
if (content.Length == 6 && content[3] == 0) return true; if (content.Length == 6 && content[3] == 0) return true;
for (var i = 4; i < content.Length - 2; i++) for (var i = 4; i < content.Length - 2; i++)
{
fcsCheck += content[i]; fcsCheck += content[i];
} fcsCheck = fcsCheck % 256;
fcsCheck = fcsCheck%256;
if (fcsCheck != content[content.Length - 2]) return false; if (fcsCheck != content[content.Length - 2]) return false;
if (content[content.Length - 1] != 0x16) return false; if (content[content.Length - 1] != 0x16) return false;
if (content[1] != content.Length - 6) return false; if (content[1] != content.Length - 6) return false;

View File

@@ -104,7 +104,8 @@ namespace Modbus.Net.Siemens
public abstract class SiemensProtocal : BaseProtocal public abstract class SiemensProtocal : BaseProtocal
{ {
protected SiemensProtocal(byte slaveAddress, byte masterAddress) : base(slaveAddress, masterAddress, Endian.BigEndianLsb) protected SiemensProtocal(byte slaveAddress, byte masterAddress)
: base(slaveAddress, masterAddress, Endian.BigEndianLsb)
{ {
} }
} }
@@ -142,7 +143,7 @@ namespace Modbus.Net.Siemens
public override byte[] Format(IInputStruct message) public override byte[] Format(IInputStruct message)
{ {
var r_message = (ComCreateReferenceSiemensInputStruct) message; var r_message = (ComCreateReferenceSiemensInputStruct) message;
var crc = (r_message.SlaveAddress + r_message.MasterAddress + 0x49)%256; var crc = (r_message.SlaveAddress + r_message.MasterAddress + 0x49) % 256;
return Format((byte) 0x10, r_message.SlaveAddress, r_message.MasterAddress, (byte) 0x49, (byte) crc, return Format((byte) 0x10, r_message.SlaveAddress, r_message.MasterAddress, (byte) 0x49, (byte) crc,
(byte) 0x16); (byte) 0x16);
} }
@@ -274,7 +275,7 @@ namespace Modbus.Net.Siemens
public override byte[] Format(IInputStruct message) public override byte[] Format(IInputStruct message)
{ {
var r_message = (ComConfirmMessageSiemensInputStruct) message; var r_message = (ComConfirmMessageSiemensInputStruct) message;
var crc = r_message.SlaveAddress + r_message.MasterAddress + 0x5c%256; var crc = r_message.SlaveAddress + r_message.MasterAddress + 0x5c % 256;
return Format((byte) 0x10, r_message.SlaveAddress, r_message.MasterAddress, (byte) 0x5c, (byte) crc, return Format((byte) 0x10, r_message.SlaveAddress, r_message.MasterAddress, (byte) 0x5c, (byte) crc,
(byte) 0x16); (byte) 0x16);
} }
@@ -370,8 +371,8 @@ namespace Modbus.Net.Siemens
var address = addressTranslator.AddressTranslate(startAddress, true); var address = addressTranslator.AddressTranslate(startAddress, true);
Offset = address.Address; Offset = address.Address;
var area = address.Area; var area = address.Area;
Area = (byte) (area%256); Area = (byte) (area % 256);
DbBlock = Area == 0x84 ? (ushort) (area/256) : (ushort) 0; DbBlock = Area == 0x84 ? (ushort) (area / 256) : (ushort) 0;
NumberOfElements = getCount; NumberOfElements = getCount;
} }
@@ -426,7 +427,7 @@ namespace Modbus.Net.Siemens
var numberOfElements = r_message.NumberOfElements; var numberOfElements = r_message.NumberOfElements;
var dbBlock = r_message.DbBlock; var dbBlock = r_message.DbBlock;
var area = r_message.Area; var area = r_message.Area;
var offsetBit = r_message.Offset*8; var offsetBit = r_message.Offset * 8;
var offsetBitBytes = BigEndianValueHelper.Instance.GetBytes(offsetBit); var offsetBitBytes = BigEndianValueHelper.Instance.GetBytes(offsetBit);
return Format(new byte[4], slaveAddress, masterAddress, (byte) 0x6c, protoId, rosctr, redId, pduRef, parLg, return Format(new byte[4], slaveAddress, masterAddress, (byte) 0x6c, protoId, rosctr, redId, pduRef, parLg,
datLg, serviceId, numberOfVariables datLg, serviceId, numberOfVariables
@@ -442,7 +443,7 @@ namespace Modbus.Net.Siemens
var accessResult = BigEndianValueHelper.Instance.GetByte(messageBytes, ref pos); var accessResult = BigEndianValueHelper.Instance.GetByte(messageBytes, ref pos);
var dataType = BigEndianValueHelper.Instance.GetByte(messageBytes, ref pos); var dataType = BigEndianValueHelper.Instance.GetByte(messageBytes, ref pos);
var length = BigEndianValueHelper.Instance.GetUShort(messageBytes, ref pos); var length = BigEndianValueHelper.Instance.GetUShort(messageBytes, ref pos);
var byteLength = length/8; var byteLength = length / 8;
var values = new byte[byteLength]; var values = new byte[byteLength];
Array.Copy(messageBytes, pos, values, 0, byteLength); Array.Copy(messageBytes, pos, values, 0, byteLength);
return new ReadRequestSiemensOutputStruct(pduRef, (SiemensAccessResult) accessResult, return new ReadRequestSiemensOutputStruct(pduRef, (SiemensAccessResult) accessResult,
@@ -465,8 +466,8 @@ namespace Modbus.Net.Siemens
var address = addressTranslator.AddressTranslate(startAddress, true); var address = addressTranslator.AddressTranslate(startAddress, true);
Offset = address.Address; Offset = address.Address;
var area = address.Area; var area = address.Area;
Area = (byte) (area%256); Area = (byte) (area % 256);
DbBlock = Area == 0x84 ? (ushort) (area/256) : (ushort) 0; DbBlock = Area == 0x84 ? (ushort) (area / 256) : (ushort) 0;
WriteValue = writeValue; WriteValue = writeValue;
} }
@@ -514,11 +515,11 @@ namespace Modbus.Net.Siemens
var numberOfElements = (ushort) valueBytes.Length; var numberOfElements = (ushort) valueBytes.Length;
var dbBlock = r_message.DbBlock; var dbBlock = r_message.DbBlock;
var area = r_message.Area; var area = r_message.Area;
var offsetBit = r_message.Offset*8; var offsetBit = r_message.Offset * 8;
var offsetBitBytes = BigEndianValueHelper.Instance.GetBytes(offsetBit); var offsetBitBytes = BigEndianValueHelper.Instance.GetBytes(offsetBit);
const byte reserved = 0x00; const byte reserved = 0x00;
const byte type = (byte) SiemensDataType.OtherAccess; const byte type = (byte) SiemensDataType.OtherAccess;
var numberOfWriteBits = (ushort) (valueBytes.Length*8); var numberOfWriteBits = (ushort) (valueBytes.Length * 8);
return Format(new byte[4], slaveAddress, masterAddress, (byte) 0x7c, protoId, rosctr, redId, pduRef, parLg, return Format(new byte[4], slaveAddress, masterAddress, (byte) 0x7c, protoId, rosctr, redId, pduRef, parLg,
datLg, serviceId, numberOfVariables datLg, serviceId, numberOfVariables
, variableSpec, vAddrLg, syntaxId, typeR, numberOfElements, dbBlock, area, , variableSpec, vAddrLg, syntaxId, typeR, numberOfElements, dbBlock, area,

View File

@@ -35,10 +35,8 @@ namespace Modbus.Net.Siemens
0, 4); 0, 4);
var check = 0; var check = 0;
for (var i = 4; i < newContent.Length - 2; i++) for (var i = 4; i < newContent.Length - 2; i++)
{
check += newContent[i]; check += newContent[i];
} check = check % 256;
check = check%256;
newContent[newContent.Length - 2] = (byte) check; newContent[newContent.Length - 2] = (byte) check;
newContent[newContent.Length - 1] = 0x16; newContent[newContent.Length - 1] = 0x16;
return newContent; return newContent;

View File

@@ -19,12 +19,16 @@ namespace Modbus.Net.Siemens
private int _connectTryCount; private int _connectTryCount;
public SiemensTcpProtocal(byte tdpuSize, ushort tsapSrc, ushort tsapDst, ushort maxCalling, ushort maxCalled, public SiemensTcpProtocal(byte tdpuSize, ushort tsapSrc, ushort tsapDst, ushort maxCalling, ushort maxCalled,
ushort maxPdu) : this(tdpuSize, tsapSrc, tsapDst, maxCalling, maxCalled, maxPdu, ConfigurationManager.AppSettings["IP"]) ushort maxPdu)
: this(tdpuSize, tsapSrc, tsapDst, maxCalling, maxCalled, maxPdu, ConfigurationManager.AppSettings["IP"])
{ {
} }
public SiemensTcpProtocal(byte tdpuSize, ushort tsapSrc, ushort tsapDst, ushort maxCalling, ushort maxCalled, public SiemensTcpProtocal(byte tdpuSize, ushort tsapSrc, ushort tsapDst, ushort maxCalling, ushort maxCalled,
ushort maxPdu, string ip) : this(tdpuSize, tsapSrc, tsapDst, maxCalling, maxCalled, maxPdu, ip, int.Parse(ConfigurationManager.AppSettings["SiemensPort"])) ushort maxPdu, string ip)
: this(
tdpuSize, tsapSrc, tsapDst, maxCalling, maxCalled, maxPdu, ip,
int.Parse(ConfigurationManager.AppSettings["SiemensPort"] ?? "102"))
{ {
} }
@@ -50,9 +54,7 @@ namespace Modbus.Net.Siemens
public override async Task<byte[]> SendReceiveAsync(params object[] content) public override async Task<byte[]> SendReceiveAsync(params object[] content)
{ {
if (ProtocalLinker == null || !ProtocalLinker.IsConnected) if (ProtocalLinker == null || !ProtocalLinker.IsConnected)
{
await ConnectAsync(); await ConnectAsync();
}
return await base.SendReceiveAsync(Endian, content); return await base.SendReceiveAsync(Endian, content);
} }
@@ -92,7 +94,7 @@ namespace Modbus.Net.Siemens
return return
//先建立连接,然后建立设备的引用 //先建立连接,然后建立设备的引用
await await await await
ForceSendReceiveAsync(this[typeof (CreateReferenceSiemensProtocal)], inputStruct) ForceSendReceiveAsync(this[typeof(CreateReferenceSiemensProtocal)], inputStruct)
.ContinueWith(async answer => .ContinueWith(async answer =>
{ {
if (!ProtocalLinker.IsConnected) return false; if (!ProtocalLinker.IsConnected) return false;
@@ -101,9 +103,9 @@ namespace Modbus.Net.Siemens
_maxPdu); _maxPdu);
var outputStruct2 = var outputStruct2 =
(EstablishAssociationSiemensOutputStruct) (EstablishAssociationSiemensOutputStruct)
await await
SendReceiveAsync(this[typeof (EstablishAssociationSiemensProtocal)], SendReceiveAsync(this[typeof(EstablishAssociationSiemensProtocal)],
inputStruct2); inputStruct2);
return outputStruct2 != null; return outputStruct2 != null;
}); });
} }

View File

@@ -183,7 +183,8 @@ namespace Modbus.Net.Siemens
0xd3c7, SiemensTypeCode.Byte, startAddress, (ushort) getByteCount, AddressTranslator); 0xd3c7, SiemensTypeCode.Byte, startAddress, (ushort) getByteCount, AddressTranslator);
var readRequestSiemensOutputStruct = var readRequestSiemensOutputStruct =
await await
Wrapper.SendReceiveAsync<ReadRequestSiemensOutputStruct>(Wrapper[typeof (ReadRequestSiemensProtocal)], Wrapper.SendReceiveAsync<ReadRequestSiemensOutputStruct>(
Wrapper[typeof(ReadRequestSiemensProtocal)],
readRequestSiemensInputStruct); readRequestSiemensInputStruct);
return readRequestSiemensOutputStruct?.GetValue; return readRequestSiemensOutputStruct?.GetValue;
} }
@@ -207,7 +208,8 @@ namespace Modbus.Net.Siemens
0xd3c8, startAddress, setContents, AddressTranslator); 0xd3c8, startAddress, setContents, AddressTranslator);
var writeRequestSiemensOutputStruct = var writeRequestSiemensOutputStruct =
await await
Wrapper.SendReceiveAsync<WriteRequestSiemensOutputStruct>(Wrapper[typeof (WriteRequestSiemensProtocal)], Wrapper.SendReceiveAsync<WriteRequestSiemensOutputStruct>(
Wrapper[typeof(WriteRequestSiemensProtocal)],
writeRequestSiemensInputStruct); writeRequestSiemensInputStruct);
return writeRequestSiemensOutputStruct?.AccessResult == SiemensAccessResult.NoError; return writeRequestSiemensOutputStruct?.AccessResult == SiemensAccessResult.NoError;
} }

View File

@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="COM" value="COM1"/> <add key="COM" value="COM1" />
<add key="FBoxOpcDaHost" value="opcda://localhost/FBoxOpcServer"/> <add key="FBoxOpcDaHost" value="opcda://localhost/FBoxOpcServer" />
<add key="IP" value="192.168.1.1"/> <add key="IP" value="192.168.1.1" />
<add key="ComConnectionTimeout" value="3000"/> <add key="ComConnectionTimeout" value="3000" />
<add key="IPConnectionTimeout" value="5000"/> <add key="IPConnectionTimeout" value="5000" />
<add key="ModbusPort" value="502"/> <add key="ModbusPort" value="502" />
<add key="OpcDaHost" value="opcda://localhost/..."/> <add key="OpcDaHost" value="opcda://localhost/..." />
<add key="OpcUaHost" value="opc.tcp://localhost/..."/> <add key="OpcUaHost" value="opc.tcp://localhost/..." />
<add key="SiemensPort" value="102"/> <add key="SiemensPort" value="102" />
</appSettings> </appSettings>
</configuration> </configuration>

View File

@@ -9,8 +9,14 @@ using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
{ {
/// <summary>
/// 具有发送锁的串口
/// </summary>
public class SerialPortLock : SerialPort public class SerialPortLock : SerialPort
{ {
/// <summary>
/// 发送锁
/// </summary>
public object Lock { get; set; } = new object(); public object Lock { get; set; } = new object();
} }
@@ -19,42 +25,87 @@ namespace Modbus.Net
/// </summary> /// </summary>
public class ComConnector : BaseConnector, IDisposable public class ComConnector : BaseConnector, IDisposable
{ {
public delegate byte[] GetDate(byte[] bts); /// <summary>
/// 波特率
private static Dictionary<string, SerialPortLock> Connectors { get; } = new Dictionary<string, SerialPortLock>(); /// </summary>
private static Dictionary<string, string> Linkers { get; } = new Dictionary<string, string>();
private readonly int _baudRate; private readonly int _baudRate;
//private GetDate mygetDate; /// <summary>
/// 串口地址
/// </summary>
private readonly string _com; private readonly string _com;
/// <summary>
/// 数据位
/// </summary>
private readonly int _dataBits; private readonly int _dataBits;
/// <summary>
/// 奇偶校验
/// </summary>
private readonly Parity _parity; private readonly Parity _parity;
private readonly StopBits _stopBits;
private readonly int _timeoutTime; /// <summary>
/// 从站号
/// </summary>
private readonly string _slave; private readonly string _slave;
private bool m_disposed = false; /// <summary>
/// 停止位
/// </summary>
private readonly StopBits _stopBits;
/// <summary>
/// 超时时间
/// </summary>
private readonly int _timeoutTime;
/// <summary>
/// Dispose是否执行
/// </summary>
private bool m_disposed;
/// <summary>
/// 构造器
/// </summary>
/// <param name="com">串口地址:从站号</param>
/// <param name="baudRate">波特率</param>
/// <param name="parity">校验位</param>
/// <param name="stopBits">停止位</param>
/// <param name="dataBits">数据位</param>
/// <param name="timeoutTime">超时时间</param>
public ComConnector(string com, int baudRate, Parity parity, StopBits stopBits, int dataBits, int timeoutTime) public ComConnector(string com, int baudRate, Parity parity, StopBits stopBits, int dataBits, int timeoutTime)
{ {
_com = com.Split(':')[0];
_timeoutTime = timeoutTime;
_baudRate = baudRate;
_parity = parity;
_stopBits = stopBits;
_dataBits = dataBits;
_slave = com.Split(':')[1];
//端口号 //端口号
_com = com.Split(':')[0];
//读超时 //读超时
//比特率 _timeoutTime = timeoutTime;
//奇偶校验 //波特率
_baudRate = baudRate;
//奇偶校验
_parity = parity;
//停止位 //停止位
_stopBits = stopBits;
//数据位 //数据位
//从站号标识 _dataBits = dataBits;
//从站号
_slave = com.Split(':')[1];
} }
/// <summary>
/// 连接中的串口
/// </summary>
private static Dictionary<string, SerialPortLock> Connectors { get; } = new Dictionary<string, SerialPortLock>()
;
/// <summary>
/// 连接中的连接器
/// </summary>
private static Dictionary<string, string> Linkers { get; } = new Dictionary<string, string>();
/// <summary>
/// 连接关键字(串口号:从站号)
/// </summary>
public override string ConnectionToken => _slave + ":" + _com; public override string ConnectionToken => _slave + ":" + _com;
private SerialPortLock SerialPort private SerialPortLock SerialPort
@@ -72,7 +123,7 @@ namespace Modbus.Net
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);
//.NET Framework 类库 //.NET Framework 类库
// GC..::.SuppressFinalize 方法 // GC..::.SuppressFinalize 方法
//请求系统不要调用指定对象的终结器。 //请求系统不要调用指定对象的终结器。
@@ -117,7 +168,9 @@ namespace Modbus.Net
} }
else if (nReadLen == 0) else if (nReadLen == 0)
{
nBytelen += 1; nBytelen += 1;
}
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -146,7 +199,6 @@ namespace Modbus.Net
SerialPort.ReadTimeout = ByteTime; SerialPort.ReadTimeout = ByteTime;
while (nBytelen < ReadRoom - 1 && SerialPort.BytesToRead > 0) while (nBytelen < ReadRoom - 1 && SerialPort.BytesToRead > 0)
{
try try
{ {
ReadBuf[nBytelen] = (byte) SerialPort.ReadByte(); ReadBuf[nBytelen] = (byte) SerialPort.ReadByte();
@@ -156,7 +208,6 @@ namespace Modbus.Net
{ {
throw new Exception(ex.Message); throw new Exception(ex.Message);
} }
}
ReadBuf[nBytelen] = 0x00; ReadBuf[nBytelen] = 0x00;
return nBytelen; return nBytelen;
} }
@@ -171,9 +222,7 @@ namespace Modbus.Net
{ {
var StringOut = ""; var StringOut = "";
foreach (var InByte in InBytes) foreach (var InByte in InBytes)
{
StringOut = StringOut + string.Format("{0:X2}", InByte) + " "; StringOut = StringOut + string.Format("{0:X2}", InByte) + " ";
}
return StringOut.Trim(); return StringOut.Trim();
} }
@@ -190,9 +239,7 @@ namespace Modbus.Net
byte[] ByteOut; byte[] ByteOut;
ByteOut = new byte[ByteStrings.Length]; ByteOut = new byte[ByteStrings.Length];
for (var i = 0; i <= ByteStrings.Length - 1; i++) for (var i = 0; i <= ByteStrings.Length - 1; i++)
{
ByteOut[i] = byte.Parse(ByteStrings[i], NumberStyles.HexNumber); ByteOut[i] = byte.Parse(ByteStrings[i], NumberStyles.HexNumber);
}
return ByteOut; return ByteOut;
} }
@@ -207,7 +254,7 @@ namespace Modbus.Net
InString = InString.Replace(" ", ""); InString = InString.Replace(" ", "");
try try
{ {
var ByteStrings = new string[InString.Length/2]; var ByteStrings = new string[InString.Length / 2];
var j = 0; var j = 0;
for (var i = 0; i < ByteStrings.Length; i++) for (var i = 0; i < ByteStrings.Length; i++)
{ {
@@ -217,9 +264,7 @@ namespace Modbus.Net
ByteOut = new byte[ByteStrings.Length]; ByteOut = new byte[ByteStrings.Length];
for (var i = 0; i <= ByteStrings.Length - 1; i++) for (var i = 0; i <= ByteStrings.Length - 1; i++)
{
ByteOut[i] = byte.Parse(ByteStrings[i], NumberStyles.HexNumber); ByteOut[i] = byte.Parse(ByteStrings[i], NumberStyles.HexNumber);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -285,24 +330,28 @@ namespace Modbus.Net
#region #region
/// <summary>
/// 是否正在连接
/// </summary>
public override bool IsConnected public override bool IsConnected
{ {
get get
{ {
if (SerialPort != null && !SerialPort.IsOpen) if (SerialPort != null && !SerialPort.IsOpen)
{
SerialPort.Dispose(); SerialPort.Dispose();
}
return SerialPort != null && SerialPort.IsOpen && Linkers.ContainsKey(_slave); return SerialPort != null && SerialPort.IsOpen && Linkers.ContainsKey(_slave);
} }
} }
/// <summary>
/// 连接串口
/// </summary>
/// <returns>是否连接成功</returns>
public override bool Connect() public override bool Connect()
{ {
try try
{ {
if (!Connectors.ContainsKey(_com)) if (!Connectors.ContainsKey(_com))
{
Connectors.Add(_com, new SerialPortLock Connectors.Add(_com, new SerialPortLock
{ {
PortName = _com, PortName = _com,
@@ -312,29 +361,33 @@ namespace Modbus.Net
DataBits = _dataBits, DataBits = _dataBits,
ReadTimeout = _timeoutTime ReadTimeout = _timeoutTime
}); });
}
if (!Linkers.ContainsKey(_slave)) if (!Linkers.ContainsKey(_slave))
{
Linkers.Add(_slave, _com); Linkers.Add(_slave, _com);
}
SerialPort.Open(); SerialPort.Open();
return true; return true;
} }
catch (Exception e) catch (Exception)
{ {
return false; return false;
} }
} }
/// <summary>
/// 连接串口
/// </summary>
/// <returns>是否连接成功</returns>
public override Task<bool> ConnectAsync() public override Task<bool> ConnectAsync()
{ {
return Task.FromResult(Connect()); return Task.FromResult(Connect());
} }
/// <summary>
/// 断开串口
/// </summary>
/// <returns>是否断开成功</returns>
public override bool Disconnect() public override bool Disconnect()
{ {
if (Linkers.ContainsKey(_slave) && Connectors.ContainsKey(_com)) if (Linkers.ContainsKey(_slave) && Connectors.ContainsKey(_com))
{
try try
{ {
Dispose(); Dispose();
@@ -344,28 +397,43 @@ namespace Modbus.Net
{ {
return false; return false;
} }
}
return false; return false;
} }
public void SendMsg(string senStr) /// <summary>
/// 带返回发送数据
/// </summary>
/// <param name="sendStr">需要发送的数据</param>
/// <returns>是否发送成功</returns>
public string SendMsg(string sendStr)
{ {
var myByte = StringToByte_2(senStr); var myByte = StringToByte_2(sendStr);
SendMsg(myByte); var returnBytes = SendMsg(myByte);
return ByteToString(returnBytes);
} }
/// <summary>
/// 无返回发送数据
/// </summary>
/// <param name="message">需要发送的数据</param>
/// <returns>是否发送成功</returns>
public override Task<bool> SendMsgWithoutReturnAsync(byte[] message) public override Task<bool> SendMsgWithoutReturnAsync(byte[] message)
{ {
return Task.FromResult(SendMsgWithoutReturn(message)); return Task.FromResult(SendMsgWithoutReturn(message));
} }
/// <summary>
/// 带返回发送数据
/// </summary>
/// <param name="sendbytes">需要发送的数据</param>
/// <returns>是否发送成功</returns>
public override byte[] SendMsg(byte[] sendbytes) public override byte[] SendMsg(byte[] sendbytes)
{ {
try try
{ {
if (!SerialPort.IsOpen) if (!SerialPort.IsOpen)
{
try try
{ {
SerialPort.Open(); SerialPort.Open();
@@ -375,7 +443,6 @@ namespace Modbus.Net
Dispose(); Dispose();
SerialPort.Open(); SerialPort.Open();
} }
}
lock (SerialPort.Lock) lock (SerialPort.Lock)
{ {
SerialPort.Write(sendbytes, 0, sendbytes.Length); SerialPort.Write(sendbytes, 0, sendbytes.Length);
@@ -389,17 +456,26 @@ namespace Modbus.Net
} }
} }
/// <summary>
/// 带返回发送数据
/// </summary>
/// <param name="message">需要发送的数据</param>
/// <returns>是否发送成功</returns>
public override Task<byte[]> SendMsgAsync(byte[] message) public override Task<byte[]> SendMsgAsync(byte[] message)
{ {
return Task.FromResult(SendMsg(message)); return Task.FromResult(SendMsg(message));
} }
/// <summary>
/// 无返回发送数据
/// </summary>
/// <param name="sendbytes">需要发送的数据</param>
/// <returns>是否发送成功</returns>
public override bool SendMsgWithoutReturn(byte[] sendbytes) public override bool SendMsgWithoutReturn(byte[] sendbytes)
{ {
try try
{ {
if (!SerialPort.IsOpen) if (!SerialPort.IsOpen)
{
try try
{ {
SerialPort.Open(); SerialPort.Open();
@@ -409,7 +485,6 @@ namespace Modbus.Net
Dispose(); Dispose();
SerialPort.Open(); SerialPort.Open();
} }
}
lock (SerialPort.Lock) lock (SerialPort.Lock)
{ {
SerialPort.Write(sendbytes, 0, sendbytes.Length); SerialPort.Write(sendbytes, 0, sendbytes.Length);
@@ -422,24 +497,12 @@ namespace Modbus.Net
} }
} }
public string ReadMsgStr() private byte[] ReadMsg()
{
var rd = "";
var data = ReadMsg();
rd = ByteToString(data);
return rd;
}
public byte[] ReadMsg()
{ {
try try
{ {
if (!SerialPort.IsOpen) if (!SerialPort.IsOpen)
{
SerialPort.Open(); SerialPort.Open();
}
byte[] data; byte[] data;
Thread.Sleep(100); Thread.Sleep(100);

View File

@@ -15,6 +15,7 @@ namespace Modbus.Net
/// <param name="parity">校验位</param> /// <param name="parity">校验位</param>
/// <param name="stopBits">停止位</param> /// <param name="stopBits">停止位</param>
/// <param name="dataBits">数据位</param> /// <param name="dataBits">数据位</param>
/// <param name="slaveAddress">从站地址</param>
protected ComProtocalLinker(int baudRate, Parity parity, StopBits stopBits, int dataBits, int slaveAddress) protected ComProtocalLinker(int baudRate, Parity parity, StopBits stopBits, int dataBits, int slaveAddress)
: this(ConfigurationManager.AppSettings["COM"], baudRate, parity, stopBits, dataBits, slaveAddress) : this(ConfigurationManager.AppSettings["COM"], baudRate, parity, stopBits, dataBits, slaveAddress)
{ {
@@ -28,6 +29,7 @@ namespace Modbus.Net
/// <param name="parity">校验位</param> /// <param name="parity">校验位</param>
/// <param name="stopBits">停止位</param> /// <param name="stopBits">停止位</param>
/// <param name="dataBits">数据位</param> /// <param name="dataBits">数据位</param>
/// <param name="slaveAddress">从站地址</param>
protected ComProtocalLinker(string com, int baudRate, Parity parity, StopBits stopBits, int dataBits, protected ComProtocalLinker(string com, int baudRate, Parity parity, StopBits stopBits, int dataBits,
int slaveAddress) int slaveAddress)
: this( : this(
@@ -45,10 +47,12 @@ namespace Modbus.Net
/// <param name="stopBits">停止位</param> /// <param name="stopBits">停止位</param>
/// <param name="dataBits">数据位</param> /// <param name="dataBits">数据位</param>
/// <param name="connectionTimeout">超时时间</param> /// <param name="connectionTimeout">超时时间</param>
/// <param name="slaveAddress">从站地址</param>
protected ComProtocalLinker(string com, int baudRate, Parity parity, StopBits stopBits, int dataBits, protected ComProtocalLinker(string com, int baudRate, Parity parity, StopBits stopBits, int dataBits,
int connectionTimeout, int slaveAddress) int connectionTimeout, int slaveAddress)
{ {
BaseConnector = new ComConnector(com + ":" + slaveAddress, baudRate, parity, stopBits, dataBits, connectionTimeout); BaseConnector = new ComConnector(com + ":" + slaveAddress, baudRate, parity, stopBits, dataBits,
connectionTimeout);
} }
} }
} }

View File

@@ -34,7 +34,8 @@ namespace Modbus.Net
/// </summary> /// </summary>
/// <param name="addressTranslator">地址转换器</param> /// <param name="addressTranslator">地址转换器</param>
/// <param name="maxLength">单个发送协议允许的数据最长长度(字节)</param> /// <param name="maxLength">单个发送协议允许的数据最长长度(字节)</param>
public AddressCombinerContinus(AddressTranslator addressTranslator, int maxLength) : base(addressTranslator, maxLength) public AddressCombinerContinus(AddressTranslator addressTranslator, int maxLength)
: base(addressTranslator, maxLength)
{ {
} }
} }
@@ -44,11 +45,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public class AddressCombinerContinus<TKey> : AddressCombiner<TKey> where TKey : IEquatable<TKey> public class AddressCombinerContinus<TKey> : AddressCombiner<TKey> where TKey : IEquatable<TKey>
{ {
/// <summary>
/// 协议的数据最长长度(字节)
/// </summary>
protected int MaxLength { get; set; }
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
/// </summary> /// </summary>
@@ -60,6 +56,11 @@ namespace Modbus.Net
MaxLength = maxLength; MaxLength = maxLength;
} }
/// <summary>
/// 协议的数据最长长度(字节)
/// </summary>
protected int MaxLength { get; set; }
/// <summary> /// <summary>
/// 地址转换器 /// 地址转换器
/// </summary> /// </summary>
@@ -75,8 +76,8 @@ namespace Modbus.Net
//按从小到大的顺序对地址进行排序 //按从小到大的顺序对地址进行排序
var groupedAddresses = from address in addresses var groupedAddresses = from address in addresses
orderby orderby
AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress, AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress,
AddressTranslator.GetAreaByteLength(address.Area)) AddressTranslator.GetAreaByteLength(address.Area))
group address by address.Area group address by address.Area
into grouped into grouped
select grouped; select grouped;
@@ -111,7 +112,7 @@ namespace Modbus.Net
{ {
//如果当前地址小于已经记录的地址域,表示这个地址的开始已经记录过了 //如果当前地址小于已经记录的地址域,表示这个地址的开始已经记录过了
if (AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress, if (AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress,
AddressTranslator.GetAreaByteLength(address.Area)) < AddressTranslator.GetAreaByteLength(address.Area)) <
AddressHelper.GetProtocalCoordinateNextPosition(preNum, AddressHelper.GetProtocalCoordinateNextPosition(preNum,
preType, preType,
AddressTranslator.GetAreaByteLength(address.Area))) AddressTranslator.GetAreaByteLength(address.Area)))
@@ -119,20 +120,18 @@ namespace Modbus.Net
originalAddresses.Add(address); originalAddresses.Add(address);
//如果当前地址的末尾被记录,表示地址被记录的地址域覆盖,这个地址没有记录的必要 //如果当前地址的末尾被记录,表示地址被记录的地址域覆盖,这个地址没有记录的必要
if (AddressHelper.GetProtocalCoordinateNextPosition( if (AddressHelper.GetProtocalCoordinateNextPosition(
AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress, AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress,
AddressTranslator.GetAreaByteLength(address.Area)), AddressTranslator.GetAreaByteLength(address.Area)),
address.DataType, address.DataType,
AddressTranslator.GetAreaByteLength(address.Area)) <= AddressTranslator.GetAreaByteLength(address.Area)) <=
AddressHelper.GetProtocalCoordinateNextPosition(preNum, AddressHelper.GetProtocalCoordinateNextPosition(preNum,
preType, preType,
AddressTranslator.GetAreaByteLength(address.Area))) AddressTranslator.GetAreaByteLength(address.Area)))
{
continue; continue;
}
} }
//如果当前地址大于记录的地址域的开头,则表示地址已经不连续了 //如果当前地址大于记录的地址域的开头,则表示地址已经不连续了
else if (AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress, else if (AddressHelper.GetProtocalCoordinate(address.Address, address.SubAddress,
AddressTranslator.GetAreaByteLength(address.Area)) > AddressTranslator.GetAreaByteLength(address.Area)) >
AddressHelper.GetProtocalCoordinateNextPosition(preNum, AddressHelper.GetProtocalCoordinateNextPosition(preNum,
preType, preType,
AddressTranslator.GetAreaByteLength(address.Area))) AddressTranslator.GetAreaByteLength(address.Area)))
@@ -144,12 +143,12 @@ namespace Modbus.Net
Address = (int) Math.Floor(initNum), Address = (int) Math.Floor(initNum),
GetCount = GetCount =
(int) (int)
Math.Ceiling( Math.Ceiling(
AddressHelper.MapProtocalGetCountToAbstractByteCount( AddressHelper.MapProtocalGetCountToAbstractByteCount(
preNum - (int) Math.Floor(initNum), preNum - (int) Math.Floor(initNum),
AddressTranslator.GetAreaByteLength(address.Area), AddressTranslator.GetAreaByteLength(address.Area),
BigEndianValueHelper.Instance.ByteLength[preType.FullName])), BigEndianValueHelper.Instance.ByteLength[preType.FullName])),
DataType = typeof (byte), DataType = typeof(byte),
OriginalAddresses = originalAddresses.ToList() OriginalAddresses = originalAddresses.ToList()
}); });
initNum = address.Address; initNum = address.Address;
@@ -174,24 +173,25 @@ namespace Modbus.Net
Address = (int) Math.Floor(initNum), Address = (int) Math.Floor(initNum),
GetCount = GetCount =
(int) (int)
Math.Ceiling( Math.Ceiling(
AddressHelper.MapProtocalGetCountToAbstractByteCount( AddressHelper.MapProtocalGetCountToAbstractByteCount(
preNum - (int) Math.Floor(initNum), AddressTranslator.GetAreaByteLength(area), preNum - (int) Math.Floor(initNum), AddressTranslator.GetAreaByteLength(area),
BigEndianValueHelper.Instance.ByteLength[preType.FullName])), BigEndianValueHelper.Instance.ByteLength[preType.FullName])),
DataType = typeof (byte), DataType = typeof(byte),
OriginalAddresses = originalAddresses.ToList() OriginalAddresses = originalAddresses.ToList()
}); });
} }
List<CommunicationUnit<TKey>> newAns = new List<CommunicationUnit<TKey>>(); var newAns = new List<CommunicationUnit<TKey>>();
foreach (var communicationUnit in ans) foreach (var communicationUnit in ans)
{ {
double oldByteCount = communicationUnit.GetCount * BigEndianValueHelper.Instance.ByteLength[communicationUnit.DataType.FullName]; var oldByteCount = communicationUnit.GetCount *
BigEndianValueHelper.Instance.ByteLength[communicationUnit.DataType.FullName];
while (oldByteCount * BigEndianValueHelper.Instance.ByteLength[communicationUnit.DataType.FullName] > while (oldByteCount * BigEndianValueHelper.Instance.ByteLength[communicationUnit.DataType.FullName] >
MaxLength) MaxLength)
{ {
var newOriginalAddresses = new List<AddressUnit<TKey>>(); var newOriginalAddresses = new List<AddressUnit<TKey>>();
var oldOriginalAddresses = communicationUnit.OriginalAddresses.ToList(); var oldOriginalAddresses = communicationUnit.OriginalAddresses.ToList();
var newByteCount = 0.0; var newByteCount = 0.0;
do do
{ {
var currentAddressUnit = oldOriginalAddresses.First(); var currentAddressUnit = oldOriginalAddresses.First();
@@ -200,7 +200,6 @@ namespace Modbus.Net
oldByteCount -= BigEndianValueHelper.Instance.ByteLength[currentAddressUnit.DataType.FullName]; oldByteCount -= BigEndianValueHelper.Instance.ByteLength[currentAddressUnit.DataType.FullName];
newOriginalAddresses.Add(currentAddressUnit); newOriginalAddresses.Add(currentAddressUnit);
oldOriginalAddresses.RemoveAt(0); oldOriginalAddresses.RemoveAt(0);
} while (newByteCount < MaxLength); } while (newByteCount < MaxLength);
var newCommunicationUnit = new CommunicationUnit<TKey> var newCommunicationUnit = new CommunicationUnit<TKey>
{ {
@@ -212,9 +211,9 @@ namespace Modbus.Net
(int) (int)
Math.Ceiling(newByteCount / Math.Ceiling(newByteCount /
BigEndianValueHelper.Instance.ByteLength[communicationUnit.DataType.FullName]), BigEndianValueHelper.Instance.ByteLength[communicationUnit.DataType.FullName]),
OriginalAddresses = newOriginalAddresses, OriginalAddresses = newOriginalAddresses
}; };
newAns.Add(newCommunicationUnit); newAns.Add(newCommunicationUnit);
} }
communicationUnit.GetCount = communicationUnit.GetCount =
@@ -334,12 +333,12 @@ namespace Modbus.Net
EndUnit = continusAddress, EndUnit = continusAddress,
GapNumber = GapNumber =
(int) (int)
Math.Ceiling(AddressHelper.MapProtocalCoordinateToAbstractCoordinate( Math.Ceiling(AddressHelper.MapProtocalCoordinateToAbstractCoordinate(
continusAddress.Address, preCommunicationUnit.Address, continusAddress.Address, preCommunicationUnit.Address,
AddressTranslator.GetAreaByteLength(continusAddress.Area)) - AddressTranslator.GetAreaByteLength(continusAddress.Area)) -
preCommunicationUnit.GetCount* preCommunicationUnit.GetCount *
BigEndianValueHelper.Instance.ByteLength[ BigEndianValueHelper.Instance.ByteLength[
preCommunicationUnit.DataType.FullName]) preCommunicationUnit.DataType.FullName])
}; };
addressesGaps.Add(gap); addressesGaps.Add(gap);
} }
@@ -350,12 +349,14 @@ namespace Modbus.Net
var jumpNumberInner = JumpNumber; var jumpNumberInner = JumpNumber;
foreach (var orderedGap in orderedGaps) foreach (var orderedGap in orderedGaps)
{ {
if (orderedGap.GapNumber <= 0) continue; if (orderedGap.GapNumber <= 0) continue;
var nowAddress = orderedGap.EndUnit; var nowAddress = orderedGap.EndUnit;
var index = continusAddresses.IndexOf(nowAddress); var index = continusAddresses.IndexOf(nowAddress);
index--; index--;
var preAddress = continusAddresses[index]; var preAddress = continusAddresses[index];
if (nowAddress.GetCount*BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName] + preAddress.GetCount*BigEndianValueHelper.Instance.ByteLength[preAddress.DataType.FullName] + orderedGap.GapNumber > MaxLength) continue; if (nowAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName] +
preAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[preAddress.DataType.FullName] +
orderedGap.GapNumber > MaxLength) continue;
jumpNumberInner -= orderedGap.GapNumber; jumpNumberInner -= orderedGap.GapNumber;
if (jumpNumberInner < 0) break; if (jumpNumberInner < 0) break;
continusAddresses.RemoveAt(index); continusAddresses.RemoveAt(index);
@@ -367,11 +368,11 @@ namespace Modbus.Net
Address = preAddress.Address, Address = preAddress.Address,
GetCount = GetCount =
(int) (int)
(preAddress.GetCount*BigEndianValueHelper.Instance.ByteLength[preAddress.DataType.FullName]) + (preAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[preAddress.DataType.FullName]) +
orderedGap.GapNumber + orderedGap.GapNumber +
(int) (int)
(nowAddress.GetCount*BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName]), (nowAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName]),
DataType = typeof (byte), DataType = typeof(byte),
OriginalAddresses = preAddress.OriginalAddresses.ToList().Union(nowAddress.OriginalAddresses) OriginalAddresses = preAddress.OriginalAddresses.ToList().Union(nowAddress.OriginalAddresses)
}; };
continusAddresses.Insert(index, newAddress); continusAddresses.Insert(index, newAddress);
@@ -430,8 +431,9 @@ namespace Modbus.Net
var addressUnits = addresses as IList<AddressUnit<TKey>> ?? addresses.ToList(); var addressUnits = addresses as IList<AddressUnit<TKey>> ?? addresses.ToList();
var count = addressUnits.Sum(address => BigEndianValueHelper.Instance.ByteLength[address.DataType.FullName]); var count = addressUnits.Sum(address => BigEndianValueHelper.Instance.ByteLength[address.DataType.FullName]);
return return
new AddressCombinerNumericJump<TKey>((int) (count*Percentage/100.0), MaxLength, AddressTranslator).Combine( new AddressCombinerNumericJump<TKey>((int) (count * Percentage / 100.0), MaxLength, AddressTranslator)
addressUnits); .Combine(
addressUnits);
} }
} }
} }

View File

@@ -17,7 +17,7 @@ namespace Modbus.Net
public static double MapAbstractCoordinateToProtocalCoordinate(double abstractAddress, int startAddress, public static double MapAbstractCoordinateToProtocalCoordinate(double abstractAddress, int startAddress,
double byteLength) double byteLength)
{ {
return abstractAddress/byteLength + startAddress; return abstractAddress / byteLength + startAddress;
} }
/// <summary> /// <summary>
@@ -30,7 +30,7 @@ namespace Modbus.Net
public static double MapProtocalCoordinateToAbstractCoordinate(double protocalAddress, int startAddress, public static double MapProtocalCoordinateToAbstractCoordinate(double protocalAddress, int startAddress,
double byteLength) double byteLength)
{ {
return (protocalAddress - startAddress)*byteLength; return (protocalAddress - startAddress) * byteLength;
} }
/// <summary> /// <summary>
@@ -43,7 +43,7 @@ namespace Modbus.Net
public static double MapProtocalGetCountToAbstractByteCount(double protocalGetCount, double areaLength, public static double MapProtocalGetCountToAbstractByteCount(double protocalGetCount, double areaLength,
double byteLength) double byteLength)
{ {
return protocalGetCount*areaLength + byteLength; return protocalGetCount * areaLength + byteLength;
} }
/// <summary> /// <summary>
@@ -55,7 +55,7 @@ namespace Modbus.Net
/// <returns></returns> /// <returns></returns>
public static double GetProtocalCoordinate(int address, int subAddress, double byteLength) public static double GetProtocalCoordinate(int address, int subAddress, double byteLength)
{ {
return address + subAddress*(0.125/byteLength); return address + subAddress * (0.125 / byteLength);
} }
/// <summary> /// <summary>
@@ -66,7 +66,7 @@ namespace Modbus.Net
/// <returns></returns> /// <returns></returns>
public static double GetAbstractCoordinate(int address, int subAddress) public static double GetAbstractCoordinate(int address, int subAddress)
{ {
return address + subAddress*0.125; return address + subAddress * 0.125;
} }
/// <summary> /// <summary>
@@ -80,7 +80,7 @@ namespace Modbus.Net
double byteLength) double byteLength)
{ {
return protocalAddress + return protocalAddress +
BigEndianValueHelper.Instance.ByteLength[nextPositionBetweenType.FullName]/byteLength; BigEndianValueHelper.Instance.ByteLength[nextPositionBetweenType.FullName] / byteLength;
} }
/// <summary> /// <summary>

View File

@@ -11,14 +11,17 @@ namespace Modbus.Net
/// 地址区域的字符串描述 /// 地址区域的字符串描述
/// </summary> /// </summary>
public string AreaString { get; set; } public string AreaString { get; set; }
/// <summary> /// <summary>
/// 地址区域的数字描述 /// 地址区域的数字描述
/// </summary> /// </summary>
public int Area { get; set; } public int Area { get; set; }
/// <summary> /// <summary>
/// 地址 /// 地址
/// </summary> /// </summary>
public int Address { get; set; } public int Address { get; set; }
/// <summary> /// <summary>
/// 子地址 /// 子地址
/// </summary> /// </summary>
@@ -34,6 +37,7 @@ namespace Modbus.Net
/// 地址区域的编码 /// 地址区域的编码
/// </summary> /// </summary>
public int Code { get; set; } public int Code { get; set; }
/// <summary> /// <summary>
/// 地址区域的单个地址占用的字节数 /// 地址区域的单个地址占用的字节数
/// </summary> /// </summary>
@@ -79,26 +83,22 @@ namespace Modbus.Net
if (split.Length == 2) if (split.Length == 2)
{ {
if (int.TryParse(split[0], out num1) && int.TryParse(split[1], out num2)) if (int.TryParse(split[0], out num1) && int.TryParse(split[1], out num2))
{
return new AddressDef return new AddressDef
{ {
Area = num1, Area = num1,
Address = num2 Address = num2
}; };
}
} }
else if (split.Length == 3) else if (split.Length == 3)
{ {
if (int.TryParse(split[0], out num1) && int.TryParse(split[1], out num2) && if (int.TryParse(split[0], out num1) && int.TryParse(split[1], out num2) &&
int.TryParse(split[3], out num3)) int.TryParse(split[3], out num3))
{
return new AddressDef return new AddressDef
{ {
Area = num1, Area = num1,
Address = num2, Address = num2,
SubAddress = num3 SubAddress = num3
}; };
}
} }
throw new FormatException(); throw new FormatException();
} }

View File

@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
{ {
/// <summary> /// <summary>
/// AsyncHelper Class /// AsyncHelper Class
/// </summary> /// </summary>
public static class AsyncHelper public static class AsyncHelper
{ {

View File

@@ -28,7 +28,7 @@ namespace Modbus.Net
/// <summary> /// <summary>
/// Id /// Id
/// </summary> /// </summary>
Id Id
} }
@@ -54,7 +54,7 @@ namespace Modbus.Net
/// <summary> /// <summary>
/// Id /// Id
/// </summary> /// </summary>
Id Id
} }
@@ -80,7 +80,7 @@ namespace Modbus.Net
/// <summary> /// <summary>
/// Id /// Id
/// </summary> /// </summary>
Id Id
} }
@@ -125,7 +125,8 @@ namespace Modbus.Net
/// </summary> /// </summary>
/// <typeparam name="TKey">设备的Id类型</typeparam> /// <typeparam name="TKey">设备的Id类型</typeparam>
/// <typeparam name="TUnitKey">设备中使用的AddressUnit的Id类型</typeparam> /// <typeparam name="TUnitKey">设备中使用的AddressUnit的Id类型</typeparam>
public abstract class BaseMachine<TKey, TUnitKey> : IMachineMethodData, IMachineProperty<TKey> where TKey : IEquatable<TKey> public abstract class BaseMachine<TKey, TUnitKey> : IMachineMethodData, IMachineProperty<TKey>
where TKey : IEquatable<TKey>
where TUnitKey : IEquatable<TUnitKey> where TUnitKey : IEquatable<TUnitKey>
{ {
private readonly int _maxErrorCount = 3; private readonly int _maxErrorCount = 3;
@@ -166,11 +167,6 @@ namespace Modbus.Net
private int ErrorCount { get; set; } private int ErrorCount { get; set; }
/// <summary>
/// 是否处于连接状态
/// </summary>
public bool IsConnected => BaseUtility.IsConnected;
/// <summary> /// <summary>
/// 地址编码器 /// 地址编码器
/// </summary> /// </summary>
@@ -206,11 +202,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public IEnumerable<AddressUnit<TUnitKey>> GetAddresses { get; set; } public IEnumerable<AddressUnit<TUnitKey>> GetAddresses { get; set; }
/// <summary>
/// 是否保持连接
/// </summary>
public bool KeepConnect { get; set; }
/// <summary> /// <summary>
/// 从站号 /// 从站号
/// </summary> /// </summary>
@@ -221,31 +212,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public byte MasterAddress { get; set; } public byte MasterAddress { get; set; }
/// <summary>
/// 设备的连接器
/// </summary>
public IUtilityProperty BaseUtility { get; protected set; }
/// <summary>
/// 设备的Id
/// </summary>
public TKey Id { get; set; }
/// <summary>
/// 设备所在工程的名称
/// </summary>
public string ProjectName { get; set; }
/// <summary>
/// 设备的名称
/// </summary>
public string MachineName { get; set; }
/// <summary>
/// 标识设备的连接关键字
/// </summary>
public string ConnectionToken => BaseUtility.ConnectionToken;
/// <summary> /// <summary>
/// 读取数据 /// 读取数据
/// </summary> /// </summary>
@@ -267,9 +233,7 @@ namespace Modbus.Net
var ans = new Dictionary<string, ReturnUnit>(); var ans = new Dictionary<string, ReturnUnit>();
//检测并连接设备 //检测并连接设备
if (!BaseUtility.IsConnected) if (!BaseUtility.IsConnected)
{
await BaseUtility.ConnectAsync(); await BaseUtility.ConnectAsync();
}
//如果无法连接,终止 //如果无法连接,终止
if (!BaseUtility.IsConnected) return null; if (!BaseUtility.IsConnected) return null;
//遍历每一个实际向设备获取数据的连续地址 //遍历每一个实际向设备获取数据的连续地址
@@ -282,17 +246,17 @@ namespace Modbus.Net
AddressFormater.FormatAddress(communicateAddress.Area, communicateAddress.Address, AddressFormater.FormatAddress(communicateAddress.Area, communicateAddress.Address,
communicateAddress.SubAddress), communicateAddress.SubAddress),
(int) (int)
Math.Ceiling(communicateAddress.GetCount* Math.Ceiling(communicateAddress.GetCount *
BigEndianValueHelper.Instance.ByteLength[ BigEndianValueHelper.Instance.ByteLength[
communicateAddress.DataType.FullName])); communicateAddress.DataType.FullName]));
//如果没有数据,终止 //如果没有数据,终止
if (datas == null || (datas.Length != 0 && datas.Length < if (datas == null || datas.Length != 0 && datas.Length <
(int) (int)
Math.Ceiling(communicateAddress.GetCount* Math.Ceiling(communicateAddress.GetCount *
BigEndianValueHelper.Instance.ByteLength[ BigEndianValueHelper.Instance.ByteLength[
communicateAddress.DataType.FullName]))) communicateAddress.DataType.FullName]))
return null; return null;
@@ -300,13 +264,13 @@ namespace Modbus.Net
{ {
//字节坐标的位置 //字节坐标的位置
var localPos = AddressHelper.MapProtocalCoordinateToAbstractCoordinate(address.Address, var localPos = AddressHelper.MapProtocalCoordinateToAbstractCoordinate(address.Address,
communicateAddress.Address, communicateAddress.Address,
AddressTranslator.GetAreaByteLength(communicateAddress.Area)) + AddressTranslator.GetAreaByteLength(communicateAddress.Area)) +
address.SubAddress*0.125; address.SubAddress * 0.125;
//字节坐标的主地址位置 //字节坐标的主地址位置
var localMainPos = (int) localPos; var localMainPos = (int) localPos;
//字节坐标的子地址位置 //字节坐标的子地址位置
var localSubPos = (int) ((localPos - localMainPos)*8); var localSubPos = (int) ((localPos - localMainPos) * 8);
//根据类型选择返回结果的键是通讯标识还是地址 //根据类型选择返回结果的键是通讯标识还是地址
string key; string key;
@@ -341,16 +305,12 @@ namespace Modbus.Net
//如果没有数据返回空 //如果没有数据返回空
if (datas.Length == 0) if (datas.Length == 0)
{
ans.Add(key, new ReturnUnit ans.Add(key, new ReturnUnit
{ {
PlcValue = null, PlcValue = null,
UnitExtend = address.UnitExtend UnitExtend = address.UnitExtend
}); });
}
else else
{
//将获取的数据和对应的通讯标识对应
ans.Add(key, ans.Add(key,
new ReturnUnit new ReturnUnit
{ {
@@ -358,17 +318,14 @@ namespace Modbus.Net
Convert.ToDouble( Convert.ToDouble(
ValueHelper.GetInstance(BaseUtility.Endian) ValueHelper.GetInstance(BaseUtility.Endian)
.GetValue(datas, ref localMainPos, ref localSubPos, .GetValue(datas, ref localMainPos, ref localSubPos,
address.DataType))*address.Zoom, address.DataType)) * address.Zoom,
UnitExtend = address.UnitExtend UnitExtend = address.UnitExtend
}); });
}
} }
} }
//如果不保持连接,断开连接 //如果不保持连接,断开连接
if (!KeepConnect) if (!KeepConnect)
{
BaseUtility.Disconnect(); BaseUtility.Disconnect();
}
//返回数据 //返回数据
if (ans.All(p => p.Value.PlcValue == null)) ans = null; if (ans.All(p => p.Value.PlcValue == null)) ans = null;
ErrorCount = 0; ErrorCount = 0;
@@ -379,9 +336,7 @@ namespace Modbus.Net
Console.WriteLine(ConnectionToken + " " + e.Message); Console.WriteLine(ConnectionToken + " " + e.Message);
ErrorCount++; ErrorCount++;
if (ErrorCount >= _maxErrorCount) if (ErrorCount >= _maxErrorCount)
{
Disconnect(); Disconnect();
}
return null; return null;
} }
} }
@@ -409,9 +364,7 @@ namespace Modbus.Net
{ {
//检测并连接设备 //检测并连接设备
if (!BaseUtility.IsConnected) if (!BaseUtility.IsConnected)
{
await BaseUtility.ConnectAsync(); await BaseUtility.ConnectAsync();
}
//如果设备无法连接,终止 //如果设备无法连接,终止
if (!BaseUtility.IsConnected) return false; if (!BaseUtility.IsConnected) return false;
var addresses = new List<AddressUnit<TUnitKey>>(); var addresses = new List<AddressUnit<TUnitKey>>();
@@ -428,8 +381,8 @@ namespace Modbus.Net
GetAddresses.SingleOrDefault( GetAddresses.SingleOrDefault(
p => p =>
AddressFormater.FormatAddress(p.Area, p.Address, p.SubAddress) == value.Key || AddressFormater.FormatAddress(p.Area, p.Address, p.SubAddress) == value.Key ||
(p.DataType != typeof (bool) && p.DataType != typeof(bool) &&
AddressFormater.FormatAddress(p.Area, p.Address) == value.Key)); AddressFormater.FormatAddress(p.Area, p.Address) == value.Key);
break; break;
} }
case MachineSetDataType.CommunicationTag: case MachineSetDataType.CommunicationTag:
@@ -478,10 +431,11 @@ namespace Modbus.Net
var addressStart = AddressFormater.FormatAddress(communicateAddress.Area, var addressStart = AddressFormater.FormatAddress(communicateAddress.Area,
communicateAddress.Address); communicateAddress.Address);
var datasReturn = await BaseUtility.InvokeUtilityMethod<IUtilityMethodData, Task<byte[]>>("GetDatasAsync", var datasReturn =
AddressFormater.FormatAddress(communicateAddress.Area, communicateAddress.Address, 0), await BaseUtility.InvokeUtilityMethod<IUtilityMethodData, Task<byte[]>>("GetDatasAsync",
(int) AddressFormater.FormatAddress(communicateAddress.Area, communicateAddress.Address, 0),
Math.Ceiling(communicateAddress.GetCount* (int)
Math.Ceiling(communicateAddress.GetCount *
BigEndianValueHelper.Instance.ByteLength[ BigEndianValueHelper.Instance.ByteLength[
communicateAddress.DataType.FullName])); communicateAddress.DataType.FullName]));
@@ -492,9 +446,9 @@ namespace Modbus.Net
//如果没有数据,终止 //如果没有数据,终止
if (datas == null || datas.Length < if (datas == null || datas.Length <
(int) (int)
Math.Ceiling(communicateAddress.GetCount* Math.Ceiling(communicateAddress.GetCount *
BigEndianValueHelper.Instance.ByteLength[ BigEndianValueHelper.Instance.ByteLength[
communicateAddress.DataType.FullName])) communicateAddress.DataType.FullName]))
return false; return false;
foreach (var addressUnit in communicateAddress.OriginalAddresses) foreach (var addressUnit in communicateAddress.OriginalAddresses)
@@ -503,21 +457,21 @@ namespace Modbus.Net
var byteCount = var byteCount =
AddressHelper.MapProtocalGetCountToAbstractByteCount( AddressHelper.MapProtocalGetCountToAbstractByteCount(
addressUnit.Address - communicateAddress.Address + addressUnit.Address - communicateAddress.Address +
addressUnit.SubAddress*0.125/ addressUnit.SubAddress * 0.125 /
AddressTranslator.GetAreaByteLength(communicateAddress.Area), AddressTranslator.GetAreaByteLength(communicateAddress.Area),
AddressTranslator.GetAreaByteLength(communicateAddress.Area), 0); AddressTranslator.GetAreaByteLength(communicateAddress.Area), 0);
//字节坐标主地址 //字节坐标主地址
var mainByteCount = (int) byteCount; var mainByteCount = (int) byteCount;
//字节坐标自地址 //字节坐标自地址
var localByteCount = (int) ((byteCount - (int) byteCount)*8); var localByteCount = (int) ((byteCount - (int) byteCount) * 8);
//协议坐标地址 //协议坐标地址
var localPos = byteCount/AddressTranslator.GetAreaByteLength(communicateAddress.Area); var localPos = byteCount / AddressTranslator.GetAreaByteLength(communicateAddress.Area);
//协议坐标子地址 //协议坐标子地址
var subPos = var subPos =
(int) (int)
((localPos - (int) localPos)/ ((localPos - (int) localPos) /
(0.125/AddressTranslator.GetAreaByteLength(communicateAddress.Area))); (0.125 / AddressTranslator.GetAreaByteLength(communicateAddress.Area)));
//协议主地址字符串 //协议主地址字符串
var address = AddressFormater.FormatAddress(communicateAddress.Area, var address = AddressFormater.FormatAddress(communicateAddress.Area,
communicateAddress.Address + (int) localPos, subPos); communicateAddress.Address + (int) localPos, subPos);
@@ -536,7 +490,7 @@ namespace Modbus.Net
//获取要写入的值 //获取要写入的值
value = value =
values.SingleOrDefault( values.SingleOrDefault(
p => p.Key == address || (address2 != null && p.Key == address2)); p => p.Key == address || address2 != null && p.Key == address2);
break; break;
} }
case MachineSetDataType.CommunicationTag: case MachineSetDataType.CommunicationTag:
@@ -561,22 +515,20 @@ namespace Modbus.Net
} }
} }
//将要写入的值加入队列 //将要写入的值加入队列
var data = Convert.ChangeType(value.Value/addressUnit.Zoom, dataType); var data = Convert.ChangeType(value.Value / addressUnit.Zoom, dataType);
if (!valueHelper.SetValue(datas, mainByteCount, localByteCount, data)) if (!valueHelper.SetValue(datas, mainByteCount, localByteCount, data))
return false; return false;
} }
//写入数据 //写入数据
await await
BaseUtility.InvokeUtilityMethod<IUtilityMethodData, Task<bool>>("SetDatasAsync",addressStart, BaseUtility.InvokeUtilityMethod<IUtilityMethodData, Task<bool>>("SetDatasAsync", addressStart,
valueHelper.ByteArrayToObjectArray(datas, valueHelper.ByteArrayToObjectArray(datas,
new KeyValuePair<Type, int>(communicateAddress.DataType, communicateAddress.GetCount))); new KeyValuePair<Type, int>(communicateAddress.DataType, communicateAddress.GetCount)));
} }
//如果不保持连接,断开连接 //如果不保持连接,断开连接
if (!KeepConnect) if (!KeepConnect)
{
BaseUtility.Disconnect(); BaseUtility.Disconnect();
}
} }
catch (Exception e) catch (Exception e)
{ {
@@ -587,22 +539,39 @@ namespace Modbus.Net
} }
/// <summary> /// <summary>
/// 通过Id获取数据字段定义 /// 是否处于连接状态
/// </summary> /// </summary>
/// <param name="addressUnitId">数据字段Id</param> public bool IsConnected => BaseUtility.IsConnected;
/// <returns>数据字段</returns>
public AddressUnit<TUnitKey> GetAddressUnitById(TUnitKey addressUnitId) /// <summary>
{ /// 是否保持连接
try /// </summary>
{ public bool KeepConnect { get; set; }
return GetAddresses.SingleOrDefault(p => p.Id.Equals(addressUnitId));
} /// <summary>
catch (Exception) /// 设备的连接器
{ /// </summary>
Console.WriteLine("Id重复请检查"); public IUtilityProperty BaseUtility { get; protected set; }
return null;
} /// <summary>
} /// 设备的Id
/// </summary>
public TKey Id { get; set; }
/// <summary>
/// 设备所在工程的名称
/// </summary>
public string ProjectName { get; set; }
/// <summary>
/// 设备的名称
/// </summary>
public string MachineName { get; set; }
/// <summary>
/// 标识设备的连接关键字
/// </summary>
public string ConnectionToken => BaseUtility.ConnectionToken;
/// <summary> /// <summary>
/// 调用Machine中的方法 /// 调用Machine中的方法
@@ -617,24 +586,14 @@ namespace Modbus.Net
{ {
if (this is TMachineMethod) if (this is TMachineMethod)
{ {
Type t = typeof(TMachineMethod); var t = typeof(TMachineMethod);
object returnValue = t.GetRuntimeMethod(methodName, parameters.Select(p => p.GetType()).ToArray()) var returnValue = t.GetRuntimeMethod(methodName, parameters.Select(p => p.GetType()).ToArray())
.Invoke(this, parameters); .Invoke(this, parameters);
return (TReturnType) returnValue; return (TReturnType) returnValue;
} }
throw new InvalidCastException($"Machine未实现{typeof(TMachineMethod).Name}的接口"); throw new InvalidCastException($"Machine未实现{typeof(TMachineMethod).Name}的接口");
} }
/// <summary>
/// 获取Utility
/// </summary>
/// <typeparam name="TUtilityMethod">Utility实现的接口名称</typeparam>
/// <returns></returns>
public TUtilityMethod GetUtility<TUtilityMethod>() where TUtilityMethod : class, IUtilityMethod
{
return BaseUtility as TUtilityMethod;
}
/// <summary> /// <summary>
/// 连接设备 /// 连接设备
/// </summary> /// </summary>
@@ -670,6 +629,34 @@ namespace Modbus.Net
{ {
return Id.ToString(); return Id.ToString();
} }
/// <summary>
/// 通过Id获取数据字段定义
/// </summary>
/// <param name="addressUnitId">数据字段Id</param>
/// <returns>数据字段</returns>
public AddressUnit<TUnitKey> GetAddressUnitById(TUnitKey addressUnitId)
{
try
{
return GetAddresses.SingleOrDefault(p => p.Id.Equals(addressUnitId));
}
catch (Exception)
{
Console.WriteLine("Id重复请检查");
return null;
}
}
/// <summary>
/// 获取Utility
/// </summary>
/// <typeparam name="TUtilityMethod">Utility实现的接口名称</typeparam>
/// <returns></returns>
public TUtilityMethod GetUtility<TUtilityMethod>() where TUtilityMethod : class, IUtilityMethod
{
return BaseUtility as TUtilityMethod;
}
} }
internal class BaseMachineEqualityComparer<TKey> : IEqualityComparer<IMachineProperty<TKey>> internal class BaseMachineEqualityComparer<TKey> : IEqualityComparer<IMachineProperty<TKey>>
@@ -832,7 +819,7 @@ namespace Modbus.Net
/// <returns>是否一致</returns> /// <returns>是否一致</returns>
public bool Equals(AddressUnit<TKey> other) public bool Equals(AddressUnit<TKey> other)
{ {
return (Area.ToUpper() == other.Area.ToUpper() && Address == other.Address) || Id.Equals(other.Id); return Area.ToUpper() == other.Area.ToUpper() && Address == other.Address || Id.Equals(other.Id);
} }
} }
@@ -915,6 +902,6 @@ namespace Modbus.Net
/// <summary> /// <summary>
/// Id /// Id
/// </summary> /// </summary>
TKey Id { get; set; } TKey Id { get; set; }
} }
} }

View File

@@ -20,7 +20,7 @@ namespace Modbus.Net
return (from getValue in getValues return (from getValue in getValues
where getValue.Value.PlcValue != null where getValue.Value.PlcValue != null
select new KeyValuePair<string, double>(getValue.Key, getValue.Value.PlcValue.Value)).ToDictionary( select new KeyValuePair<string, double>(getValue.Key, getValue.Value.PlcValue.Value)).ToDictionary(
p => p.Key, p => p.Value); p => p.Key, p => p.Value);
} }
} }
} }

View File

@@ -13,7 +13,8 @@ namespace Modbus.Net
/// <summary> /// <summary>
/// 构造器 /// 构造器
/// </summary> /// </summary>
protected BaseProtocal(byte slaveAddress, byte masterAddress, Endian endian) : base(slaveAddress, masterAddress, endian) protected BaseProtocal(byte slaveAddress, byte masterAddress, Endian endian)
: base(slaveAddress, masterAddress, endian)
{ {
} }
@@ -25,13 +26,9 @@ namespace Modbus.Net
public override async Task<byte[]> SendReceiveAsync(params object[] content) public override async Task<byte[]> SendReceiveAsync(params object[] content)
{ {
if (ProtocalLinker == null || !ProtocalLinker.IsConnected) if (ProtocalLinker == null || !ProtocalLinker.IsConnected)
{
await ConnectAsync(); await ConnectAsync();
}
if (ProtocalLinker != null) if (ProtocalLinker != null)
{
return await ProtocalLinker.SendReceiveAsync(ProtocalUnit.TranslateContent(Endian, content)); return await ProtocalLinker.SendReceiveAsync(ProtocalUnit.TranslateContent(Endian, content));
}
return null; return null;
} }
} }
@@ -39,7 +36,8 @@ namespace Modbus.Net
/// <summary> /// <summary>
/// 基本协议 /// 基本协议
/// </summary> /// </summary>
public abstract class BaseProtocal<TParamIn, TParamOut, TProtocalUnit> : IProtocal<TParamIn, TParamOut, TProtocalUnit> where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut> public abstract class BaseProtocal<TParamIn, TParamOut, TProtocalUnit> :
IProtocal<TParamIn, TParamOut, TProtocalUnit> where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut>
{ {
/// <summary> /// <summary>
/// 构造器 /// 构造器
@@ -56,11 +54,12 @@ namespace Modbus.Net
/// 协议的端格式 /// 协议的端格式
/// </summary> /// </summary>
protected Endian Endian { get; set; } protected Endian Endian { get; set; }
/// <summary> /// <summary>
/// 从站地址 /// 从站地址
/// </summary> /// </summary>
public byte SlaveAddress { get; set; } public byte SlaveAddress { get; set; }
/// <summary> /// <summary>
/// 主站地址 /// 主站地址
/// </summary> /// </summary>
@@ -82,12 +81,10 @@ namespace Modbus.Net
{ {
var protocalName = type.FullName; var protocalName = type.FullName;
if (Protocals.ContainsKey(protocalName)) if (Protocals.ContainsKey(protocalName))
{
return Protocals[protocalName]; return Protocals[protocalName];
}
//自动寻找存在的协议并将其加载 //自动寻找存在的协议并将其加载
var protocalUnit = var protocalUnit =
Activator.CreateInstance(type.GetTypeInfo().Assembly.GetType(protocalName)) as TProtocalUnit; Activator.CreateInstance(type.GetTypeInfo().Assembly.GetType(protocalName)) as TProtocalUnit;
if (protocalUnit == null) throw new InvalidCastException("没有相应的协议内容"); if (protocalUnit == null) throw new InvalidCastException("没有相应的协议内容");
protocalUnit.Endian = Endian; protocalUnit.Endian = Endian;
Register(protocalUnit); Register(protocalUnit);
@@ -100,16 +97,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
protected Dictionary<string, TProtocalUnit> Protocals { get; } protected Dictionary<string, TProtocalUnit> Protocals { get; }
/// <summary>
/// 注册一个协议
/// </summary>
/// <param name="linkProtocal">需要注册的协议</param>
protected void Register(TProtocalUnit linkProtocal)
{
if (linkProtocal == null) return;
Protocals.Add(linkProtocal.GetType().FullName, linkProtocal);
}
/// <summary> /// <summary>
/// 发送协议,通过传入需要使用的协议内容和输入结构 /// 发送协议,通过传入需要使用的协议内容和输入结构
/// </summary> /// </summary>
@@ -121,18 +108,6 @@ namespace Modbus.Net
return AsyncHelper.RunSync(() => SendReceiveAsync(unit, content)); return AsyncHelper.RunSync(() => SendReceiveAsync(unit, content));
} }
/// <summary>
/// 发送协议,通过传入需要使用的协议内容和输入结构
/// </summary>
/// <param name="unit">协议的实例</param>
/// <param name="content">输入信息的结构化描述</param>
/// <returns>输出信息的结构化描述</returns>
/// <typeparam name="T">IOutputStruct的具体类型</typeparam>
public virtual T SendReceive<T>(TProtocalUnit unit, IInputStruct content) where T : class, IOutputStruct
{
return AsyncHelper.RunSync(() => SendReceiveAsync<T>(unit, content));
}
/// <summary> /// <summary>
/// 发送协议,通过传入需要使用的协议内容和输入结构 /// 发送协议,通过传入需要使用的协议内容和输入结构
/// </summary> /// </summary>
@@ -141,40 +116,9 @@ namespace Modbus.Net
/// <returns>输出信息的结构化描述</returns> /// <returns>输出信息的结构化描述</returns>
public virtual async Task<IOutputStruct> SendReceiveAsync(TProtocalUnit unit, IInputStruct content) public virtual async Task<IOutputStruct> SendReceiveAsync(TProtocalUnit unit, IInputStruct content)
{ {
return await SendReceiveAsync<IOutputStruct>(unit, content); return await SendReceiveAsync<IOutputStruct>(unit, content);
} }
/// <summary>
/// 发送协议,通过传入需要使用的协议内容和输入结构
/// </summary>
/// <param name="unit">协议的实例</param>
/// <param name="content">输入信息的结构化描述</param>
/// <returns>输出信息的结构化描述</returns>
/// <typeparam name="T">IOutputStruct的具体类型</typeparam>
public virtual async Task<T> SendReceiveAsync<T>(TProtocalUnit unit, IInputStruct content) where T : class, IOutputStruct
{
var t = 0;
var formatContent = unit.Format(content);
if (formatContent != null)
{
TParamOut receiveContent;
//如果为特别处理协议的话,跳过协议扩展收缩
if (unit is ISpecialProtocalUnit)
{
receiveContent = await ProtocalLinker.SendReceiveWithoutExtAndDecAsync(formatContent);
}
else
{
receiveContent = await ProtocalLinker.SendReceiveAsync(formatContent);
}
if (receiveContent != null)
{
return unit.Unformat<T>(receiveContent, ref t);
}
}
return null;
}
/// <summary> /// <summary>
/// 发送协议内容并接收,一般方法 /// 发送协议内容并接收,一般方法
/// </summary> /// </summary>
@@ -195,6 +139,54 @@ namespace Modbus.Net
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary>
/// 注册一个协议
/// </summary>
/// <param name="linkProtocal">需要注册的协议</param>
protected void Register(TProtocalUnit linkProtocal)
{
if (linkProtocal == null) return;
Protocals.Add(linkProtocal.GetType().FullName, linkProtocal);
}
/// <summary>
/// 发送协议,通过传入需要使用的协议内容和输入结构
/// </summary>
/// <param name="unit">协议的实例</param>
/// <param name="content">输入信息的结构化描述</param>
/// <returns>输出信息的结构化描述</returns>
/// <typeparam name="T">IOutputStruct的具体类型</typeparam>
public virtual T SendReceive<T>(TProtocalUnit unit, IInputStruct content) where T : class, IOutputStruct
{
return AsyncHelper.RunSync(() => SendReceiveAsync<T>(unit, content));
}
/// <summary>
/// 发送协议,通过传入需要使用的协议内容和输入结构
/// </summary>
/// <param name="unit">协议的实例</param>
/// <param name="content">输入信息的结构化描述</param>
/// <returns>输出信息的结构化描述</returns>
/// <typeparam name="T">IOutputStruct的具体类型</typeparam>
public virtual async Task<T> SendReceiveAsync<T>(TProtocalUnit unit, IInputStruct content)
where T : class, IOutputStruct
{
var t = 0;
var formatContent = unit.Format(content);
if (formatContent != null)
{
TParamOut receiveContent;
//如果为特别处理协议的话,跳过协议扩展收缩
if (unit is ISpecialProtocalUnit)
receiveContent = await ProtocalLinker.SendReceiveWithoutExtAndDecAsync(formatContent);
else
receiveContent = await ProtocalLinker.SendReceiveAsync(formatContent);
if (receiveContent != null)
return unit.Unformat<T>(receiveContent, ref t);
}
return null;
}
/// <summary> /// <summary>
/// 协议连接开始 /// 协议连接开始
/// </summary> /// </summary>
@@ -214,9 +206,7 @@ namespace Modbus.Net
public virtual bool Disconnect() public virtual bool Disconnect()
{ {
if (ProtocalLinker != null) if (ProtocalLinker != null)
{
return ProtocalLinker.Disconnect(); return ProtocalLinker.Disconnect();
}
return false; return false;
} }
} }

View File

@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
/// <summary> /// <summary>
@@ -13,10 +12,12 @@ public enum Endian
/// 小端 /// 小端
/// </summary> /// </summary>
LittleEndianLsb, LittleEndianLsb,
/// <summary> /// <summary>
/// 大端-小端位 /// 大端-小端位
/// </summary> /// </summary>
BigEndianLsb, BigEndianLsb,
/// <summary> /// <summary>
/// 大端-大端位 /// 大端-大端位
/// </summary> /// </summary>
@@ -26,7 +27,7 @@ public enum Endian
namespace Modbus.Net namespace Modbus.Net
{ {
/// <summary> /// <summary>
/// 基础Api入口 /// 基础Api入口
/// </summary> /// </summary>
public abstract class BaseUtility : BaseUtility<byte[], byte[], ProtocalUnit> public abstract class BaseUtility : BaseUtility<byte[], byte[], ProtocalUnit>
{ {
@@ -35,14 +36,14 @@ namespace Modbus.Net
/// </summary> /// </summary>
protected BaseUtility(byte slaveAddress, byte masterAddress) : base(slaveAddress, masterAddress) protected BaseUtility(byte slaveAddress, byte masterAddress) : base(slaveAddress, masterAddress)
{ {
} }
} }
/// <summary> /// <summary>
/// 基础Api入口 /// 基础Api入口
/// </summary> /// </summary>
public abstract class BaseUtility<TParamIn, TParamOut, TProtocalUnit> : IUtilityProperty, IUtilityMethodData where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut> public abstract class BaseUtility<TParamIn, TParamOut, TProtocalUnit> : IUtilityProperty, IUtilityMethodData
where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut>
{ {
/// <summary> /// <summary>
/// 协议收发主体 /// 协议收发主体
@@ -68,37 +69,12 @@ namespace Modbus.Net
/// 从站号 /// 从站号
/// </summary> /// </summary>
public byte SlaveAddress { get; set; } public byte SlaveAddress { get; set; }
/// <summary> /// <summary>
/// 主站号 /// 主站号
/// </summary> /// </summary>
public byte MasterAddress { get; set; } public byte MasterAddress { get; set; }
/// <summary>
/// 协议是否遵循小端格式
/// </summary>
public abstract Endian Endian { get; }
/// <summary>
/// 设备是否已经连接
/// </summary>
public bool IsConnected => Wrapper?.ProtocalLinker != null && Wrapper.ProtocalLinker.IsConnected;
/// <summary>
/// 标识设备的连接关键字
/// </summary>
public string ConnectionToken => Wrapper?.ProtocalLinker == null ? ConnectionString : Wrapper.ProtocalLinker.ConnectionToken;
/// <summary>
/// 地址翻译器
/// </summary>
public AddressTranslator AddressTranslator { get; set; }
/// <summary>
/// 设置连接类型
/// </summary>
/// <param name="connectionType">连接类型</param>
public abstract void SetConnectionType(int connectionType);
/// <summary> /// <summary>
/// 获取数据 /// 获取数据
/// </summary> /// </summary>
@@ -144,17 +120,16 @@ namespace Modbus.Net
var typeName = getTypeAndCount.Key.FullName; var typeName = getTypeAndCount.Key.FullName;
var bCount = BigEndianValueHelper.Instance.ByteLength[typeName]; var bCount = BigEndianValueHelper.Instance.ByteLength[typeName];
var getReturnValue = await GetDatasAsync(startAddress, var getReturnValue = await GetDatasAsync(startAddress,
(int) Math.Ceiling(bCount*getTypeAndCount.Value)); (int) Math.Ceiling(bCount * getTypeAndCount.Value));
var getBytes = getReturnValue; var getBytes = getReturnValue;
return ValueHelper.GetInstance(Endian).ByteArrayToObjectArray(getBytes, getTypeAndCount); return ValueHelper.GetInstance(Endian).ByteArrayToObjectArray(getBytes, getTypeAndCount);
} }
catch (Exception) catch (Exception)
{ {
return null; return null;
} }
} }
/// <summary> /// <summary>
/// 获取数据 /// 获取数据
/// </summary> /// </summary>
@@ -181,7 +156,7 @@ namespace Modbus.Net
try try
{ {
var getBytes = await GetDatasAsync(startAddress, var getBytes = await GetDatasAsync(startAddress,
new KeyValuePair<Type, int>(typeof (T), getByteCount)); new KeyValuePair<Type, int>(typeof(T), getByteCount));
return ValueHelper.GetInstance(Endian).ObjectArrayToDestinationArray<T>(getBytes); return ValueHelper.GetInstance(Endian).ObjectArrayToDestinationArray<T>(getBytes);
} }
catch (Exception) catch (Exception)
@@ -203,7 +178,7 @@ namespace Modbus.Net
AsyncHelper.RunSync(() => GetDatasAsync(startAddress, getTypeAndCountList)); AsyncHelper.RunSync(() => GetDatasAsync(startAddress, getTypeAndCountList));
} }
/// <summary>GetEndian /// <summary>
/// 获取数据 /// 获取数据
/// </summary> /// </summary>
/// <param name="startAddress">开始地址</param> /// <param name="startAddress">开始地址</param>
@@ -219,7 +194,7 @@ namespace Modbus.Net
from getTypeAndCount in translateTypeAndCount from getTypeAndCount in translateTypeAndCount
let typeName = getTypeAndCount.Key.FullName let typeName = getTypeAndCount.Key.FullName
let bCount = BigEndianValueHelper.Instance.ByteLength[typeName] let bCount = BigEndianValueHelper.Instance.ByteLength[typeName]
select (int) Math.Ceiling(bCount*getTypeAndCount.Value)).Sum(); select (int) Math.Ceiling(bCount * getTypeAndCount.Value)).Sum();
var getReturnValue = await GetDatasAsync(startAddress, bAllCount); var getReturnValue = await GetDatasAsync(startAddress, bAllCount);
var getBytes = getReturnValue; var getBytes = getReturnValue;
return ValueHelper.GetInstance(Endian).ByteArrayToObjectArray(getBytes, translateTypeAndCount); return ValueHelper.GetInstance(Endian).ByteArrayToObjectArray(getBytes, translateTypeAndCount);
@@ -249,6 +224,27 @@ namespace Modbus.Net
/// <returns>是否设置成功</returns> /// <returns>是否设置成功</returns>
public abstract Task<bool> SetDatasAsync(string startAddress, object[] setContents); public abstract Task<bool> SetDatasAsync(string startAddress, object[] setContents);
/// <summary>
/// 协议是否遵循小端格式
/// </summary>
public abstract Endian Endian { get; }
/// <summary>
/// 设备是否已经连接
/// </summary>
public bool IsConnected => Wrapper?.ProtocalLinker != null && Wrapper.ProtocalLinker.IsConnected;
/// <summary>
/// 标识设备的连接关键字
/// </summary>
public string ConnectionToken
=> Wrapper?.ProtocalLinker == null ? ConnectionString : Wrapper.ProtocalLinker.ConnectionToken;
/// <summary>
/// 地址翻译器
/// </summary>
public AddressTranslator AddressTranslator { get; set; }
/// <summary> /// <summary>
/// 连接设备 /// 连接设备
/// </summary> /// </summary>
@@ -289,13 +285,19 @@ namespace Modbus.Net
{ {
if (this is TUtilityMethod) if (this is TUtilityMethod)
{ {
Type t = typeof(TUtilityMethod); var t = typeof(TUtilityMethod);
object returnValue = t.GetRuntimeMethod(methodName, parameters.Select(p => p.GetType()).ToArray(), false) var returnValue = t.GetRuntimeMethod(methodName, parameters.Select(p => p.GetType()).ToArray(), false)
.Invoke(this, parameters); .Invoke(this, parameters);
return (TReturnType)returnValue; return (TReturnType) returnValue;
} }
throw new InvalidCastException($"Utility未实现{typeof(TUtilityMethod).Name}的接口"); throw new InvalidCastException($"Utility未实现{typeof(TUtilityMethod).Name}的接口");
} }
/// <summary>
/// 设置连接类型
/// </summary>
/// <param name="connectionType">连接类型</param>
public abstract void SetConnectionType(int connectionType);
} }
/// <summary> /// <summary>
@@ -312,6 +314,7 @@ namespace Modbus.Net
/// 设备是否已经连接 /// 设备是否已经连接
/// </summary> /// </summary>
bool IsConnected { get; } bool IsConnected { get; }
/// <summary> /// <summary>
/// 标识设备的连接关键字 /// 标识设备的连接关键字
/// </summary> /// </summary>

View File

@@ -14,16 +14,15 @@ namespace Modbus.Net
{ {
private static Crc16 _crc16; private static Crc16 _crc16;
private Crc16()
{
}
/// <summary> /// <summary>
/// CRC验证表 /// CRC验证表
/// </summary> /// </summary>
private byte[] crc_table = new byte[512]; private byte[] crc_table = new byte[512];
private Crc16()
{
}
/// <summary> /// <summary>
/// 获取校验工具实例 /// 获取校验工具实例
/// </summary> /// </summary>
@@ -31,9 +30,7 @@ namespace Modbus.Net
public static Crc16 GetInstance() public static Crc16 GetInstance()
{ {
if (_crc16 == null) if (_crc16 == null)
{
_crc16 = new Crc16(); _crc16 = new Crc16();
}
return _crc16; return _crc16;
} }
@@ -51,7 +48,9 @@ namespace Modbus.Net
CRC = 0xFFFF; CRC = 0xFFFF;
//set all 1 //set all 1
if (Len <= 0) if (Len <= 0)
{
CRC = 0; CRC = 0;
}
else else
{ {
Len--; Len--;
@@ -59,13 +58,10 @@ namespace Modbus.Net
{ {
CRC = CRC ^ message[IX]; CRC = CRC ^ message[IX];
for (IY = 0; IY <= 7; IY++) for (IY = 0; IY <= 7; IY++)
{
if ((CRC & 1) != 0) if ((CRC & 1) != 0)
CRC = (CRC >> 1) ^ 0xA001; CRC = (CRC >> 1) ^ 0xA001;
else else
CRC = CRC >> 1; CRC = CRC >> 1;
//
}
} }
} }
Rcvbuf[1] = (byte) ((CRC & 0xff00) >> 8); //高位置 Rcvbuf[1] = (byte) ((CRC & 0xff00) >> 8); //高位置
@@ -91,9 +87,7 @@ namespace Modbus.Net
Array.Copy(byteframe, 0, byteArr, 0, byteArr.Length); Array.Copy(byteframe, 0, byteArr, 0, byteArr.Length);
GetCRC(byteArr, ref recvbuff); GetCRC(byteArr, ref recvbuff);
if (recvbuff[0] == byteframe[byteframe.Length - 2] && recvbuff[1] == byteframe[byteframe.Length - 1]) if (recvbuff[0] == byteframe[byteframe.Length - 2] && recvbuff[1] == byteframe[byteframe.Length - 1])
{
return true; return true;
}
return false; return false;
} }
@@ -121,7 +115,7 @@ namespace Modbus.Net
for (var t = 0; t <= hexArray.GetUpperBound(0); t++) for (var t = 0; t <= hexArray.GetUpperBound(0); t++)
{ {
if ((hexArray[t] >= 48) && (hexArray[t] <= 57)) if (hexArray[t] >= 48 && hexArray[t] <= 57)
decNum = hexArray[t] - 48; decNum = hexArray[t] - 48;
@@ -130,7 +124,7 @@ namespace Modbus.Net
if (msb) if (msb)
{ {
decNumMSB = decNum*16; decNumMSB = decNum * 16;
msb = false; msb = false;
} }
else else
@@ -154,12 +148,11 @@ namespace Modbus.Net
for (i = 0; decByteTotal > 0; i++) for (i = 0; decByteTotal > 0; i++)
{ {
//b = Convert.ToInt32(System.Math.Pow(16.0, i)); //b = Convert.ToInt32(System.Math.Pow(16.0, i));
var a = decByteTotal%16; var a = decByteTotal % 16;
decByteTotal /= 16; decByteTotal /= 16;
if (a <= 9) if (a <= 9)
hexByte = a.ToString(); hexByte = a.ToString();
else else
{
switch (a) switch (a)
{ {
case 10: case 10:
@@ -181,7 +174,6 @@ namespace Modbus.Net
hexByte = "F"; hexByte = "F";
break; break;
} }
}
hexTotal = string.Concat(hexByte, hexTotal); hexTotal = string.Concat(hexByte, hexTotal);
} }
return hexTotal == checkString; return hexTotal == checkString;
@@ -200,15 +192,12 @@ namespace Modbus.Net
{ {
byte sum = 0; byte sum = 0;
foreach (var b in code) foreach (var b in code)
{
sum += b; sum += b;
} sum = (byte) (~sum + 1); //取反+1
sum = (byte)(~sum + 1); //取反+1
var lrc = sum.ToString("X2"); var lrc = sum.ToString("X2");
return lrc; return lrc;
} }
#endregion #endregion
} }
} }

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
@@ -11,7 +8,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public interface IMachineMethod public interface IMachineMethod
{ {
} }
/// <summary> /// <summary>

View File

@@ -1,8 +1,4 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
{ {
@@ -12,7 +8,8 @@ namespace Modbus.Net
/// <typeparam name="TParamIn">向Connector传入的类型</typeparam> /// <typeparam name="TParamIn">向Connector传入的类型</typeparam>
/// <typeparam name="TParamOut">从Connector返回的类型</typeparam> /// <typeparam name="TParamOut">从Connector返回的类型</typeparam>
/// <typeparam name="TProtocalUnit">协议单元的类型</typeparam> /// <typeparam name="TProtocalUnit">协议单元的类型</typeparam>
public interface IProtocal<TParamIn, TParamOut, in TProtocalUnit> where TProtocalUnit : IProtocalFormatting<TParamIn, TParamOut> public interface IProtocal<TParamIn, TParamOut, in TProtocalUnit>
where TProtocalUnit : IProtocalFormatting<TParamIn, TParamOut>
{ {
/// <summary> /// <summary>
/// 发送协议内容并接收,一般方法 /// 发送协议内容并接收,一般方法
@@ -44,4 +41,4 @@ namespace Modbus.Net
/// <returns>输出信息的结构化描述</returns> /// <returns>输出信息的结构化描述</returns>
Task<IOutputStruct> SendReceiveAsync(TProtocalUnit unit, IInputStruct content); Task<IOutputStruct> SendReceiveAsync(TProtocalUnit unit, IInputStruct content);
} }
} }

View File

@@ -5,7 +5,6 @@
/// </summary> /// </summary>
public interface IProtocalFormatting : IProtocalFormatting<byte[], byte[]> public interface IProtocalFormatting : IProtocalFormatting<byte[], byte[]>
{ {
} }
/// <summary> /// <summary>
@@ -38,12 +37,12 @@
IOutputStruct Unformat(TParamOut messageBytes, ref int pos); IOutputStruct Unformat(TParamOut messageBytes, ref int pos);
/// <summary> /// <summary>
/// 把仪器返回的内容填充到输出结构中 /// 把仪器返回的内容填充到输出结构中
/// </summary> /// </summary>
/// <param name="messageBytes">返回数据的字节流</param> /// <param name="messageBytes">返回数据的字节流</param>
/// <param name="pos">转换标记位</param> /// <param name="pos">转换标记位</param>
/// <typeparam name="T">IOutputStruct的具体类型</typeparam> /// <typeparam name="T">IOutputStruct的具体类型</typeparam>
/// <returns>结构化的输出数据</returns> /// <returns>结构化的输出数据</returns>
T Unformat<T>(TParamOut messageBytes, ref int pos) where T : class, IOutputStruct; T Unformat<T>(TParamOut messageBytes, ref int pos) where T : class, IOutputStruct;
} }
} }

View File

@@ -1,8 +1,4 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
{ {
@@ -62,4 +58,4 @@ namespace Modbus.Net
/// <returns>缩减后的协议内容</returns> /// <returns>缩减后的协议内容</returns>
TParamOut BytesDecact(TParamOut content); TParamOut BytesDecact(TParamOut content);
} }
} }

View File

@@ -5,7 +5,6 @@
/// </summary> /// </summary>
public interface IProtocalLinkerBytesExtend : IProtocalLinkerBytesExtend<byte[], byte[]> public interface IProtocalLinkerBytesExtend : IProtocalLinkerBytesExtend<byte[], byte[]>
{ {
} }
/// <summary> /// <summary>

View File

@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
@@ -11,7 +9,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public interface IUtilityMethod public interface IUtilityMethod
{ {
} }
/// <summary> /// <summary>
@@ -19,6 +16,14 @@ namespace Modbus.Net
/// </summary> /// </summary>
public interface IUtilityMethodData : IUtilityMethod public interface IUtilityMethodData : IUtilityMethod
{ {
/// <summary>
/// 获取数据
/// </summary>
/// <param name="startAddress">开始地址</param>
/// <param name="getByteCount">获取字节数个数</param>
/// <returns>接收到的byte数据</returns>
byte[] GetDatas(string startAddress, int getByteCount);
/// <summary> /// <summary>
/// 获取数据 /// 获取数据
/// </summary> /// </summary>
@@ -69,7 +74,7 @@ namespace Modbus.Net
/// <returns>获取数据的对象数组,请强制转换成相应类型</returns> /// <returns>获取数据的对象数组,请强制转换成相应类型</returns>
object[] GetDatas(string startAddress, IEnumerable<KeyValuePair<Type, int>> getTypeAndCountList); object[] GetDatas(string startAddress, IEnumerable<KeyValuePair<Type, int>> getTypeAndCountList);
/// <summary>GetEndian /// <summary>
/// 获取数据 /// 获取数据
/// </summary> /// </summary>
/// <param name="startAddress">开始地址</param> /// <param name="startAddress">开始地址</param>
@@ -94,11 +99,10 @@ namespace Modbus.Net
} }
/// <summary> /// <summary>
/// Utility的时间读写接口 /// Utility的时间读写接口
/// </summary> /// </summary>
public interface IUtilityMethodTime : IUtilityMethod public interface IUtilityMethodTime : IUtilityMethod
{ {
/// <summary> /// <summary>
/// 获取PLC时间 /// 获取PLC时间
/// </summary> /// </summary>
@@ -111,6 +115,5 @@ namespace Modbus.Net
/// <param name="setTime">设置PLC时间</param> /// <param name="setTime">设置PLC时间</param>
/// <returns>设置是否成功</returns> /// <returns>设置是否成功</returns>
Task<bool> SetTimeAsync(DateTime setTime); Task<bool> SetTimeAsync(DateTime setTime);
} }
} }

View File

@@ -45,7 +45,8 @@ namespace Modbus.Net
{ {
//自动查找相应的协议放缩类,命令规则为——当前的实际类名(注意是继承后的)+"BytesExtend"。 //自动查找相应的协议放缩类,命令规则为——当前的实际类名(注意是继承后的)+"BytesExtend"。
var bytesExtend = var bytesExtend =
Activator.CreateInstance(GetType().GetTypeInfo().Assembly.GetType(GetType().FullName + "BytesExtend")) as Activator.CreateInstance(GetType().GetTypeInfo().Assembly.GetType(GetType().FullName + "BytesExtend"))
as
IProtocalLinkerBytesExtend; IProtocalLinkerBytesExtend;
return bytesExtend?.BytesExtend(content); return bytesExtend?.BytesExtend(content);
} }
@@ -59,7 +60,8 @@ namespace Modbus.Net
{ {
//自动查找相应的协议放缩类,命令规则为——当前的实际类名(注意是继承后的)+"BytesExtend"。 //自动查找相应的协议放缩类,命令规则为——当前的实际类名(注意是继承后的)+"BytesExtend"。
var bytesExtend = var bytesExtend =
Activator.CreateInstance(GetType().GetTypeInfo().Assembly.GetType(GetType().FullName + "BytesExtend")) as Activator.CreateInstance(GetType().GetTypeInfo().Assembly.GetType(GetType().FullName + "BytesExtend"))
as
IProtocalLinkerBytesExtend; IProtocalLinkerBytesExtend;
return bytesExtend?.BytesDecact(content); return bytesExtend?.BytesDecact(content);
} }
@@ -85,33 +87,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public bool IsConnected => BaseConnector != null && BaseConnector.IsConnected; public bool IsConnected => BaseConnector != null && BaseConnector.IsConnected;
/// <summary>
/// 连接设备
/// </summary>
/// <returns>设备是否连接成功</returns>
public bool Connect()
{
return BaseConnector.Connect();
}
/// <summary>
/// 连接设备
/// </summary>
/// <returns>设备是否连接成功</returns>
public async Task<bool> ConnectAsync()
{
return await BaseConnector.ConnectAsync();
}
/// <summary>
/// 断开设备
/// </summary>
/// <returns>设备是否断开成功</returns>
public bool Disconnect()
{
return BaseConnector.Disconnect();
}
/// <summary> /// <summary>
/// 发送并接收数据 /// 发送并接收数据
/// </summary> /// </summary>
@@ -192,5 +167,32 @@ namespace Modbus.Net
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary>
/// 连接设备
/// </summary>
/// <returns>设备是否连接成功</returns>
public bool Connect()
{
return BaseConnector.Connect();
}
/// <summary>
/// 连接设备
/// </summary>
/// <returns>设备是否连接成功</returns>
public async Task<bool> ConnectAsync()
{
return await BaseConnector.ConnectAsync();
}
/// <summary>
/// 断开设备
/// </summary>
/// <returns>设备是否断开成功</returns>
public bool Disconnect()
{
return BaseConnector.Disconnect();
}
} }
} }

View File

@@ -7,7 +7,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public abstract class ProtocalUnit : ProtocalUnit<byte[], byte[]> public abstract class ProtocalUnit : ProtocalUnit<byte[], byte[]>
{ {
} }
/// <summary> /// <summary>
@@ -20,12 +19,12 @@ namespace Modbus.Net
/// </summary> /// </summary>
public Endian Endian { get; set; } = Endian.BigEndianLsb; public Endian Endian { get; set; } = Endian.BigEndianLsb;
/// <summary> /// <summary>
/// 从输入结构格式化 /// 从输入结构格式化
/// </summary>s /// </summary>
/// <param name="message">结构化的输入数据</param> /// <param name="message">结构化的输入数据</param>
/// <returns>格式化后的字节流</returns> /// <returns>格式化后的字节流</returns>
public abstract TParamIn Format(IInputStruct message); public abstract TParamIn Format(IInputStruct message);
/// <summary> /// <summary>
/// 从对象的参数数组格式化 /// 从对象的参数数组格式化
@@ -37,25 +36,25 @@ namespace Modbus.Net
return TranslateContent(Endian, message); return TranslateContent(Endian, message);
} }
/// <summary> /// <summary>
/// 把仪器返回的内容填充到输出结构中 /// 把仪器返回的内容填充到输出结构中
/// </summary> /// </summary>
/// <param name="messageBytes">返回数据的字节流</param> /// <param name="messageBytes">返回数据的字节流</param>
/// <param name="pos">转换标记位</param> /// <param name="pos">转换标记位</param>
/// <returns>结构化的输出数据</returns> /// <returns>结构化的输出数据</returns>
public abstract IOutputStruct Unformat(TParamOut messageBytes, ref int pos); public abstract IOutputStruct Unformat(TParamOut messageBytes, ref int pos);
/// <summary> /// <summary>
/// 把仪器返回的内容填充到输出结构中 /// 把仪器返回的内容填充到输出结构中
/// </summary> /// </summary>
/// <param name="messageBytes">返回数据的字节流</param> /// <param name="messageBytes">返回数据的字节流</param>
/// <param name="pos">转换标记位</param> /// <param name="pos">转换标记位</param>
/// <typeparam name="T">IOutputStruct的具体类型</typeparam> /// <typeparam name="T">IOutputStruct的具体类型</typeparam>
/// <returns>结构化的输出数据</returns> /// <returns>结构化的输出数据</returns>
public T Unformat<T>(TParamOut messageBytes, ref int pos) where T : class, IOutputStruct public T Unformat<T>(TParamOut messageBytes, ref int pos) where T : class, IOutputStruct
{ {
return Unformat(messageBytes, ref pos) as T; return Unformat(messageBytes, ref pos) as T;
} }
/// <summary> /// <summary>
/// 转换静态方法,把对象数组转换为字节数组。 /// 转换静态方法,把对象数组转换为字节数组。
@@ -64,8 +63,8 @@ namespace Modbus.Net
/// <param name="contents">对象数组</param> /// <param name="contents">对象数组</param>
/// <returns>字节数组</returns> /// <returns>字节数组</returns>
public static byte[] TranslateContent(Endian endian, params object[] contents) public static byte[] TranslateContent(Endian endian, params object[] contents)
{ {
return ValueHelper.GetInstance(endian).ObjectArrayToByteArray(contents); return ValueHelper.GetInstance(endian).ObjectArrayToByteArray(contents);
} }
} }

View File

@@ -17,7 +17,6 @@ namespace Modbus.Net
/// </summary> /// </summary>
public class DataReturnDef : DataReturnDef<string> public class DataReturnDef : DataReturnDef<string>
{ {
} }
/// <summary> /// <summary>
@@ -29,6 +28,7 @@ namespace Modbus.Net
/// 设备的Id /// 设备的Id
/// </summary> /// </summary>
public TMachineKey MachineId { get; set; } public TMachineKey MachineId { get; set; }
/// <summary> /// <summary>
/// 返回的数据值 /// 返回的数据值
/// </summary> /// </summary>
@@ -141,7 +141,7 @@ namespace Modbus.Net
TryExecuteTask(item); TryExecuteTask(item);
} }
} }
// We're done processing items on the current thread // We're done processing items on the current thread
finally finally
{ {
_currentThreadIsProcessingItems = false; _currentThreadIsProcessingItems = false;
@@ -176,7 +176,10 @@ namespace Modbus.Net
/// </returns> /// </returns>
protected sealed override bool TryDequeue(Task task) protected sealed override bool TryDequeue(Task task)
{ {
lock (_tasks) return _tasks.Remove(task); lock (_tasks)
{
return _tasks.Remove(task);
}
} }
/// <summary> /// <summary>
@@ -213,7 +216,7 @@ namespace Modbus.Net
private readonly TaskFactory _tasks; private readonly TaskFactory _tasks;
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
/// </summary> /// </summary>
/// <param name="machine">设备</param> /// <param name="machine">设备</param>
/// <param name="taskFactory">任务工厂</param> /// <param name="taskFactory">任务工厂</param>
@@ -278,11 +281,9 @@ namespace Modbus.Net
/// <returns>是否停止成功</returns> /// <returns>是否停止成功</returns>
public bool StopAllTimers() public bool StopAllTimers()
{ {
bool ans = true; var ans = true;
foreach (var task in TasksWithTimer) foreach (var task in TasksWithTimer)
{
ans = ans && StopTimer(task.Name); ans = ans && StopTimer(task.Name);
}
return ans; return ans;
} }
@@ -308,11 +309,9 @@ namespace Modbus.Net
/// <returns>是否暂停成功</returns> /// <returns>是否暂停成功</returns>
public bool PauseAllTimers() public bool PauseAllTimers()
{ {
bool ans = true; var ans = true;
foreach (var task in TasksWithTimer) foreach (var task in TasksWithTimer)
{
ans = ans && PauseTimer(task.Name); ans = ans && PauseTimer(task.Name);
}
return ans; return ans;
} }
@@ -338,11 +337,9 @@ namespace Modbus.Net
/// <returns>是否恢复成功</returns> /// <returns>是否恢复成功</returns>
public bool ContinueAllTimers() public bool ContinueAllTimers()
{ {
bool ans = true; var ans = true;
foreach (var task in TasksWithTimer) foreach (var task in TasksWithTimer)
{
ans = ans && ContinueTimer(task.Name); ans = ans && ContinueTimer(task.Name);
}
return ans; return ans;
} }
@@ -427,7 +424,7 @@ namespace Modbus.Net
return new DataReturnDef return new DataReturnDef
{ {
MachineId = machine.GetMachineIdString(), MachineId = machine.GetMachineIdString(),
ReturnValues = ans, ReturnValues = ans
}; };
}; };
Params = null; Params = null;
@@ -436,7 +433,7 @@ namespace Modbus.Net
TimerTime = getCycle; TimerTime = getCycle;
} }
} }
/// <summary> /// <summary>
/// 写入数据的预定义任务 /// 写入数据的预定义任务
/// </summary> /// </summary>
@@ -461,7 +458,7 @@ namespace Modbus.Net
MachineSetDataType.CommunicationTag).WithCancellation(cts.Token)); MachineSetDataType.CommunicationTag).WithCancellation(cts.Token));
return ans; return ans;
}; };
Params = new object[]{values}; Params = new object[] {values};
Return = returnFunc; Return = returnFunc;
} }
} }
@@ -472,46 +469,51 @@ namespace Modbus.Net
/// <typeparam name="TInterType">任务返回值的类型</typeparam> /// <typeparam name="TInterType">任务返回值的类型</typeparam>
public class TaskItem<TInterType> : ITaskItem, IEquatable<TaskItem<TInterType>> public class TaskItem<TInterType> : ITaskItem, IEquatable<TaskItem<TInterType>>
{ {
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary> /// <summary>
/// 定时器 /// 定时器
/// </summary> /// </summary>
private Timer Timer { get; set; } private Timer Timer { get; set; }
/// <summary> /// <summary>
/// 定时器的时间 /// 定时器的时间
/// </summary> /// </summary>
public int TimerTime { get; set; } public int TimerTime { get; set; }
/// <summary> /// <summary>
/// 离线定时器 /// 离线定时器
/// </summary> /// </summary>
private Timer TimerDisconnected { get; set; } private Timer TimerDisconnected { get; set; }
/// <summary> /// <summary>
/// 离线定时器的时间 /// 离线定时器的时间
/// </summary> /// </summary>
public int TimerDisconnectedTime { get; set; } public int TimerDisconnectedTime { get; set; }
/// <summary> /// <summary>
/// 执行的任务 /// 执行的任务
/// </summary> /// </summary>
public Func<IMachinePropertyWithoutKey, TaskFactory, object[], Task<TInterType>> Invoke { get; set; } public Func<IMachinePropertyWithoutKey, TaskFactory, object[], Task<TInterType>> Invoke { get; set; }
/// <summary> /// <summary>
/// 检测设备的在线状态 /// 检测设备的在线状态
/// </summary> /// </summary>
internal Func<bool> DetectConnected { get; set; } internal Func<bool> DetectConnected { get; set; }
/// <summary> /// <summary>
/// 任务执行的参数 /// 任务执行的参数
/// </summary> /// </summary>
public object[] Params { get; set; } public object[] Params { get; set; }
/// <summary> /// <summary>
/// 返回值的处理函数 /// 返回值的处理函数
/// </summary> /// </summary>
public Action<TInterType> Return { get; set; } public Action<TInterType> Return { get; set; }
/// <summary> /// <summary>
/// 获取设备 /// 获取设备
/// </summary> /// </summary>
internal Func<IMachinePropertyWithoutKey> GetMachine { get; set; } internal Func<IMachinePropertyWithoutKey> GetMachine { get; set; }
/// <summary> /// <summary>
/// 获取任务工厂 /// 获取任务工厂
/// </summary> /// </summary>
@@ -527,6 +529,11 @@ namespace Modbus.Net
return Name == other?.Name; return Name == other?.Name;
} }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary> /// <summary>
/// 启动定时器 /// 启动定时器
/// </summary> /// </summary>
@@ -537,6 +544,17 @@ namespace Modbus.Net
return true; return true;
} }
/// <summary>
/// 停止定时器
/// </summary>
/// <returns></returns>
public bool StopTimer()
{
DeactivateTimer();
DeactivateTimerDisconnected();
return true;
}
/// <summary> /// <summary>
/// 激活定时器 /// 激活定时器
/// </summary> /// </summary>
@@ -545,7 +563,7 @@ namespace Modbus.Net
Timer = new Timer(async state => Timer = new Timer(async state =>
{ {
if (!DetectConnected()) TimerChangeToDisconnect(); if (!DetectConnected()) TimerChangeToDisconnect();
var ans = await Invoke(GetMachine(),GetTaskFactory(),Params); var ans = await Invoke(GetMachine(), GetTaskFactory(), Params);
Return?.Invoke(ans); Return?.Invoke(ans);
}, null, 0, TimerTime); }, null, 0, TimerTime);
} }
@@ -601,17 +619,6 @@ namespace Modbus.Net
ActivateTimerDisconnected(); ActivateTimerDisconnected();
return true; return true;
} }
/// <summary>
/// 停止定时器
/// </summary>
/// <returns></returns>
public bool StopTimer()
{
DeactivateTimer();
DeactivateTimerDisconnected();
return true;
}
} }
/// <summary> /// <summary>
@@ -719,16 +726,6 @@ namespace Modbus.Net
_tasks = new TaskFactory(_cts.Token, TaskCreationOptions.None, TaskContinuationOptions.None, _scheduler); _tasks = new TaskFactory(_cts.Token, TaskCreationOptions.None, TaskContinuationOptions.None, _scheduler);
} }
/// <summary>
/// 强制停止所有正在运行的任务
/// </summary>
public void TaskHalt()
{
_cts.Cancel();
_cts = new CancellationTokenSource();
_tasks = new TaskFactory(_cts.Token, TaskCreationOptions.None, TaskContinuationOptions.None, _scheduler);
}
/// <summary> /// <summary>
/// 保持连接 /// 保持连接
/// </summary> /// </summary>
@@ -742,9 +739,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
machine.Machine.KeepConnect = _keepConnect; machine.Machine.KeepConnect = _keepConnect;
}
} }
ContinueTimerAll(); ContinueTimerAll();
} }
@@ -791,6 +786,7 @@ namespace Modbus.Net
/// 设备读数据的关键字 /// 设备读数据的关键字
/// </summary> /// </summary>
public MachineGetDataType GetDataType { get; set; } public MachineGetDataType GetDataType { get; set; }
/// <summary> /// <summary>
/// 设备写数据的关键字 /// 设备写数据的关键字
/// </summary> /// </summary>
@@ -810,6 +806,16 @@ namespace Modbus.Net
} }
} }
/// <summary>
/// 强制停止所有正在运行的任务
/// </summary>
public void TaskHalt()
{
_cts.Cancel();
_cts = new CancellationTokenSource();
_tasks = new TaskFactory(_cts.Token, TaskCreationOptions.None, TaskContinuationOptions.None, _scheduler);
}
/// <summary> /// <summary>
/// 添加一台设备 /// 添加一台设备
/// </summary> /// </summary>
@@ -834,9 +840,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in machines) foreach (var machine in machines)
{
AddMachine(machine); AddMachine(machine);
}
} }
} }
@@ -922,7 +926,7 @@ namespace Modbus.Net
{ {
lock (_machines) lock (_machines)
{ {
_machines.RemoveWhere(p=>p.Machine.Equals(machine)); _machines.RemoveWhere(p => p.Machine.Equals(machine));
} }
} }
@@ -938,9 +942,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
ans &= machine.InvokeTimer(item); ans &= machine.InvokeTimer(item);
}
} }
return ans; return ans;
} }
@@ -955,9 +957,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
ans &= machine.StopAllTimers(); ans &= machine.StopAllTimers();
}
} }
return ans; return ans;
} }
@@ -973,9 +973,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
ans &= machine.StopTimer(taskItemName); ans &= machine.StopTimer(taskItemName);
}
} }
return ans; return ans;
} }
@@ -990,9 +988,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
ans &= machine.PauseAllTimers(); ans &= machine.PauseAllTimers();
}
} }
return ans; return ans;
} }
@@ -1008,9 +1004,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
ans &= machine.PauseTimer(taskItemName); ans &= machine.PauseTimer(taskItemName);
}
} }
return ans; return ans;
} }
@@ -1025,9 +1019,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
ans &= machine.ContinueAllTimers(); ans &= machine.ContinueAllTimers();
}
} }
return ans; return ans;
} }
@@ -1042,9 +1034,7 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
machine.ContinueTimer(taskItemName); machine.ContinueTimer(taskItemName);
}
} }
return true; return true;
} }
@@ -1061,12 +1051,10 @@ namespace Modbus.Net
lock (_machines) lock (_machines)
{ {
foreach (var machine in _machines) foreach (var machine in _machines)
{
tasks.Add(machine.InvokeOnce(item)); tasks.Add(machine.InvokeOnce(item));
}
} }
var ans = await Task.WhenAll(tasks); var ans = await Task.WhenAll(tasks);
return ans.All(p=>p); return ans.All(p => p);
} }
/// <summary> /// <summary>
@@ -1080,9 +1068,7 @@ namespace Modbus.Net
{ {
var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId)); var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId));
if (machine != null) if (machine != null)
{
return await machine.InvokeOnce(item); return await machine.InvokeOnce(item);
}
return false; return false;
} }
@@ -1097,9 +1083,7 @@ namespace Modbus.Net
{ {
var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId)); var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId));
if (machine != null) if (machine != null)
{
return machine.InvokeTimer(item); return machine.InvokeTimer(item);
}
return false; return false;
} }
@@ -1113,9 +1097,7 @@ namespace Modbus.Net
{ {
var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId)); var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId));
if (machine != null) if (machine != null)
{
return machine.StopTimer(taskItemName); return machine.StopTimer(taskItemName);
}
return false; return false;
} }
@@ -1129,9 +1111,7 @@ namespace Modbus.Net
{ {
var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId)); var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId));
if (machine != null) if (machine != null)
{
return machine.PauseTimer(taskItemName); return machine.PauseTimer(taskItemName);
}
return false; return false;
} }
@@ -1145,9 +1125,7 @@ namespace Modbus.Net
{ {
var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId)); var machine = _machines.FirstOrDefault(p => p.Machine.Id.Equals(machineId));
if (machine != null) if (machine != null)
{
return machine.ContinueTimer(taskItemName); return machine.ContinueTimer(taskItemName);
}
return false; return false;
} }
} }

View File

@@ -74,9 +74,7 @@ namespace Modbus.Net
{ {
_timeoutTime = value; _timeoutTime = value;
if (_socketClient != null) if (_socketClient != null)
{
_socketClient.ReceiveTimeout = _timeoutTime; _socketClient.ReceiveTimeout = _timeoutTime;
}
} }
} }
@@ -144,9 +142,7 @@ namespace Modbus.Net
public override async Task<bool> ConnectAsync() public override async Task<bool> ConnectAsync()
{ {
if (_socketClient != null) if (_socketClient != null)
{
Disconnect(); Disconnect();
}
try try
{ {
_socketClient = new TcpClient _socketClient = new TcpClient
@@ -187,9 +183,7 @@ namespace Modbus.Net
public override bool Disconnect() public override bool Disconnect()
{ {
if (_socketClient == null) if (_socketClient == null)
{
return true; return true;
}
try try
{ {
@@ -239,9 +233,7 @@ namespace Modbus.Net
try try
{ {
if (!IsConnected) if (!IsConnected)
{
await ConnectAsync(); await ConnectAsync();
}
var stream = _socketClient.GetStream(); var stream = _socketClient.GetStream();
await stream.WriteAsync(datagram, 0, datagram.Length); await stream.WriteAsync(datagram, 0, datagram.Length);
@@ -280,9 +272,7 @@ namespace Modbus.Net
try try
{ {
if (!IsConnected) if (!IsConnected)
{
await ConnectAsync(); await ConnectAsync();
}
var stream = _socketClient.GetStream(); var stream = _socketClient.GetStream();
await stream.WriteAsync(datagram, 0, datagram.Length); await stream.WriteAsync(datagram, 0, datagram.Length);
@@ -313,9 +303,7 @@ namespace Modbus.Net
stream.Flush(); stream.Flush();
// 异步接收回答 // 异步接收回答
if (len > 0) if (len > 0)
{
return CheckReplyDatagram(len); return CheckReplyDatagram(len);
}
return null; return null;
} }
catch (Exception err) catch (Exception err)
@@ -339,9 +327,7 @@ namespace Modbus.Net
RefreshReceiveCount(); RefreshReceiveCount();
if (len <= 0) if (len <= 0)
{
RefreshErrorCount(); RefreshErrorCount();
}
return replyMessage; return replyMessage;
} }

View File

@@ -1,4 +1,5 @@
#if NET40||NET45||NET451||NET452||NET46||NET461||NET462||NET47
#if NET40||NET45||NET451||NET452||NET46||NET461||NET462||NET47
using System.Configuration; using System.Configuration;
#endif #endif

View File

@@ -1,10 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net namespace Modbus.Net
{ {
@@ -16,21 +13,21 @@ namespace Modbus.Net
#region Public Methods #region Public Methods
/// <summary> /// <summary>
/// Looks for the method in the type matching the name and arguments. /// Looks for the method in the type matching the name and arguments.
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="methodName"> /// <param name="methodName">
/// The name of the method to find. /// The name of the method to find.
/// </param> /// </param>
/// <param name="args"> /// <param name="args">
/// The types of the method's arguments to match. /// The types of the method's arguments to match.
/// </param> /// </param>
/// <param name="isGenericMethod"> /// <param name="isGenericMethod">
/// Is method Generic Method. /// Is method Generic Method.
/// </param> /// </param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="ArgumentNullException"> /// <exception cref="ArgumentNullException">
/// Thrown if: /// Thrown if:
/// - The name of the method is not specified. /// - The name of the method is not specified.
/// </exception> /// </exception>
public static MethodInfo GetRuntimeMethod(this Type type, string methodName, Type[] args, bool isGenericMethod) public static MethodInfo GetRuntimeMethod(this Type type, string methodName, Type[] args, bool isGenericMethod)
@@ -42,26 +39,23 @@ namespace Modbus.Net
throw new ArgumentNullException("methodName", "The name of the method has not been specified."); throw new ArgumentNullException("methodName", "The name of the method has not been specified.");
var methods = type.GetRuntimeMethods().Where(methodInfo => string.Equals(methodInfo.Name, methodName, StringComparison.OrdinalIgnoreCase)).ToList(); var methods =
type.GetRuntimeMethods()
.Where(methodInfo => string.Equals(methodInfo.Name, methodName, StringComparison.OrdinalIgnoreCase))
.ToList();
if (!methods.Any()) if (!methods.Any())
return null; // No methods have the specified name. return null; // No methods have the specified name.
if (isGenericMethod) if (isGenericMethod)
{
methods = methods.Where(method => method.IsGenericMethod).ToList(); methods = methods.Where(method => method.IsGenericMethod).ToList();
}
else else
{
methods = methods.Where(method => !method.IsGenericMethod).ToList(); methods = methods.Where(method => !method.IsGenericMethod).ToList();
}
var ans = methods.Where(method => IsSignatureMatch(method, args)); var ans = methods.Where(method => IsSignatureMatch(method, args));
if (ans.Count() <= 1) if (ans.Count() <= 1)
{ return ans.Count() == 1 ? ans.Single() : null;
return ans.Count() == 1 ? ans.Single() : null;
}
// Oh noes, don't make me go there. // Oh noes, don't make me go there.
throw new NotImplementedException("Resolving overloaded methods is not implemented as of now."); throw new NotImplementedException("Resolving overloaded methods is not implemented as of now.");
@@ -72,7 +66,7 @@ namespace Modbus.Net
#region Private Methods #region Private Methods
/// <summary> /// <summary>
/// Finds out if the provided arguments matches the specified method's signature. /// Finds out if the provided arguments matches the specified method's signature.
/// </summary> /// </summary>
/// <param name="methodInfo"></param> /// <param name="methodInfo"></param>
/// <param name="args"></param> /// <param name="args"></param>
@@ -83,11 +77,11 @@ namespace Modbus.Net
// Gets the parameters of the method to analyze. // Gets the parameters of the method to analyze.
ParameterInfo[] parameters = methodInfo.GetParameters(); var parameters = methodInfo.GetParameters();
int currentArgId = 0; var currentArgId = 0;
foreach (ParameterInfo parameterInfo in parameters) foreach (var parameterInfo in parameters)
{ {
if (!ReferenceEquals(args, null) && currentArgId < args.Length) if (!ReferenceEquals(args, null) && currentArgId < args.Length)
{ {
@@ -102,7 +96,7 @@ namespace Modbus.Net
if (parameterInfo.ParameterType.IsGenericParameter) if (parameterInfo.ParameterType.IsGenericParameter)
{ {
// Gets the base type of the generic parameter. // Gets the base type of the generic parameter.
Type baseType = parameterInfo.ParameterType.GetTypeInfo().BaseType; var baseType = parameterInfo.ParameterType.GetTypeInfo().BaseType;
// TODO: This is not good v and works with the most simple situation. // TODO: This is not good v and works with the most simple situation.
@@ -129,4 +123,4 @@ namespace Modbus.Net
#endregion #endregion
} }
} }

View File

@@ -410,7 +410,7 @@ namespace Modbus.Net
var temp = data[pos]; var temp = data[pos];
for (var i = 0; i < 8; i++) for (var i = 0; i < 8; i++)
{ {
t[i] = temp%2 > 0; t[i] = temp % 2 > 0;
temp /= 2; temp /= 2;
} }
pos += 1; pos += 1;
@@ -427,11 +427,11 @@ namespace Modbus.Net
public bool GetBit(byte number, ref int pos, ref int subPos) public bool GetBit(byte number, ref int pos, ref int subPos)
{ {
if (subPos < 0 && subPos >= 8) throw new IndexOutOfRangeException(); if (subPos < 0 && subPos >= 8) throw new IndexOutOfRangeException();
var ans = number%2; var ans = number % 2;
var i = 0; var i = 0;
while (i <= subPos) while (i <= subPos)
{ {
ans = number%2; ans = number % 2;
number /= 2; number /= 2;
i++; i++;
} }
@@ -491,7 +491,7 @@ namespace Modbus.Net
b = true; b = true;
//自动将目标数组中内含的子数组展开,是所有包含在子数组拼接为一个数组 //自动将目标数组中内含的子数组展开,是所有包含在子数组拼接为一个数组
var contentArray = var contentArray =
ArrayList.Adapter((Array) content).ToArray(typeof (object)).OfType<object>(); ArrayList.Adapter((Array) content).ToArray(typeof(object)).OfType<object>();
newContentsList.AddRange(contentArray); newContentsList.AddRange(contentArray);
} }
else else
@@ -520,13 +520,9 @@ namespace Modbus.Net
} }
lastIsBool = true; lastIsBool = true;
if (!LittleEndianBit) if (!LittleEndianBit)
{ boolToByteTemp = (byte) (boolToByteTemp * 2 + ((bool) content ? 1 : 0));
boolToByteTemp = (byte) (boolToByteTemp*2 + ((bool) content ? 1 : 0));
}
else else
{
boolToByteTemp += (byte) ((bool) content ? Math.Pow(2, boolToByteCount) : 0); boolToByteTemp += (byte) ((bool) content ? Math.Pow(2, boolToByteCount) : 0);
}
boolToByteCount++; boolToByteCount++;
} }
else else
@@ -594,9 +590,7 @@ namespace Modbus.Net
} }
//最后是bool拼装时表示数字还没有添加把数字添加进返回数组中。 //最后是bool拼装时表示数字还没有添加把数字添加进返回数组中。
if (lastIsBool) if (lastIsBool)
{
translateTarget.Add(boolToByteTemp); translateTarget.Add(boolToByteTemp);
}
//最后把队列转换为数组 //最后把队列转换为数组
return translateTarget.ToArray(); return translateTarget.ToArray();
} }
@@ -622,7 +616,7 @@ namespace Modbus.Net
public virtual T[] ByteArrayToDestinationArray<T>(byte[] contents, int getCount) public virtual T[] ByteArrayToDestinationArray<T>(byte[] contents, int getCount)
{ {
var objectArray = _Instance.ByteArrayToObjectArray(contents, var objectArray = _Instance.ByteArrayToObjectArray(contents,
new KeyValuePair<Type, int>(typeof (T), getCount)); new KeyValuePair<Type, int>(typeof(T), getCount));
return _Instance.ObjectArrayToDestinationArray<T>(objectArray); return _Instance.ObjectArrayToDestinationArray<T>(objectArray);
} }
@@ -641,7 +635,6 @@ namespace Modbus.Net
var translation = new List<object>(); var translation = new List<object>();
var count = 0; var count = 0;
foreach (var translateUnit in translateTypeAndCount) foreach (var translateUnit in translateTypeAndCount)
{
for (var i = 0; i < translateUnit.Value; i++) for (var i = 0; i < translateUnit.Value; i++)
{ {
if (count >= contents.Length) break; if (count >= contents.Length) break;
@@ -708,9 +701,7 @@ namespace Modbus.Net
var value = _Instance.GetBits(contents, ref count); var value = _Instance.GetBits(contents, ref count);
var k = translateUnit.Value - i < 8 ? translateUnit.Value - i : 8; var k = translateUnit.Value - i < 8 ? translateUnit.Value - i : 8;
for (var j = 0; j < k; j++) for (var j = 0; j < k; j++)
{
translation.Add(value[j]); translation.Add(value[j]);
}
i += 7; i += 7;
break; break;
} }
@@ -725,7 +716,6 @@ namespace Modbus.Net
count = contents.Length; count = contents.Length;
} }
} }
}
return translation.ToArray(); return translation.ToArray();
} }
@@ -906,21 +896,21 @@ namespace Modbus.Net
switch (endian) switch (endian)
{ {
case Endian.LittleEndianLsb: case Endian.LittleEndianLsb:
{ {
return ValueHelper.Instance; return Instance;
} }
case Endian.BigEndianLsb: case Endian.BigEndianLsb:
{ {
return BigEndianValueHelper.Instance; return BigEndianValueHelper.Instance;
} }
case Endian.BigEndianMsb: case Endian.BigEndianMsb:
{ {
return BigEndianMsbValueHelper.Instance; return BigEndianMsbValueHelper.Instance;
} }
default: default:
{ {
return ValueHelper.Instance; return Instance;
} }
} }
} }

View File

@@ -25,6 +25,7 @@
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<WebGreaseLibPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib</WebGreaseLibPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -44,11 +45,19 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Antlr3.Runtime, Version=3.4.1.9004, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath> <HintPath>..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
@@ -58,6 +67,27 @@
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
@@ -67,54 +97,13 @@
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" /> <Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" /> <Reference Include="System.EnterpriseServices" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http"> <Reference Include="System.Net.Http">
</Reference> </Reference>
<Reference Include="System.Net.Http.WebRequest"> <Reference Include="System.Net.Http.WebRequest">
</Reference> </Reference>
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="WebGrease, Version=1.5.2.14234, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> <HintPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
</Reference> </Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\Modbus.Net\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
@@ -128,6 +117,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\bootstrap-theme.css" />
<Content Include="Content\bootstrap-theme.min.css" />
<Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" /> <Content Include="Content\bootstrap.min.css" />
<Content Include="favicon.ico" /> <Content Include="favicon.ico" />
@@ -136,6 +127,10 @@
<Content Include="Content\Site.css" /> <Content Include="Content\Site.css" />
<Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" /> <Content Include="Scripts\bootstrap.min.js" />
<Content Include="packages.config" />
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" />
<None Include="Scripts\jquery-1.10.2.intellisense.js" /> <None Include="Scripts\jquery-1.10.2.intellisense.js" />
<Content Include="Scripts\jquery-1.10.2.js" /> <Content Include="Scripts\jquery-1.10.2.js" />
<Content Include="Scripts\jquery-1.10.2.min.js" /> <Content Include="Scripts\jquery-1.10.2.min.js" />
@@ -161,17 +156,11 @@
<Content Include="Views\Shared\Error.cshtml" /> <Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Home\Index.cshtml" /> <Content Include="Views\Home\Index.cshtml" />
<Content Include="Scripts\jquery-1.10.2.min.map" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" />
<Content Include="packages.config" />
<Content Include="Scripts\jquery-1.10.2.min.map" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj"> <ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj">
<Project>{fdca72ba-6d06-4de0-b873-c11c4ac853ad}</Project> <Project>{fdca72ba-6d06-4de0-b873-c11c4ac853ad}</Project>
@@ -212,7 +201,7 @@
</ProjectExtensions> </ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用NuGet 程序包还原可下载这些程序包。有关更多信息,请参 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText> <ErrorText>此项目引用这台计算机上缺少的 NuGet 程序包。使用 NuGet 程序包还原可下载这些程序包。有关详细信息,请参 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" /> <Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> <Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

View File

@@ -0,0 +1,384 @@
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #e6e6e6, 100%);
background-image: -moz-linear-gradient(top, #ffffff 0%, #e6e6e6 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #e6e6e6 100%);
background-repeat: repeat-x;
border-color: #e0e0e0;
border-color: #ccc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
}
.btn-default:active,
.btn-default.active {
background-color: #e6e6e6;
border-color: #e0e0e0;
}
.btn-primary {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
border-color: #2d6ca2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.btn-primary:active,
.btn-primary.active {
background-color: #3071a9;
border-color: #2d6ca2;
}
.btn-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%);
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
border-color: #419641;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.btn-success:active,
.btn-success.active {
background-color: #449d44;
border-color: #419641;
}
.btn-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%);
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
border-color: #eb9316;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.btn-warning:active,
.btn-warning.active {
background-color: #ec971f;
border-color: #eb9316;
}
.btn-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%);
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
border-color: #c12e2a;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.btn-danger:active,
.btn-danger.active {
background-color: #c9302c;
border-color: #c12e2a;
}
.btn-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%);
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
border-color: #2aabd2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.btn-info:active,
.btn-info.active {
background-color: #31b0d5;
border-color: #2aabd2;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #357ebd;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.navbar {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8));
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #f8f8f8, 100%);
background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%);
background-repeat: repeat-x;
border-radius: 4px;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
}
.navbar .navbar-nav > .active > a {
background-color: #f8f8f8;
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.navbar-inverse {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222));
background-image: -webkit-linear-gradient(top, #3c3c3c, 0%, #222222, 100%);
background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%);
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
}
.navbar-inverse .navbar-nav > .active > a {
background-color: #222222;
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.alert-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc));
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #c8e5bc, 100%);
background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
background-repeat: repeat-x;
border-color: #b2dba1;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
}
.alert-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0));
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #b9def0, 100%);
background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
background-repeat: repeat-x;
border-color: #9acfea;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
}
.alert-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0));
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #f8efc0, 100%);
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
background-repeat: repeat-x;
border-color: #f5e79e;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
}
.alert-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3));
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #e7c3c3, 100%);
background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
background-repeat: repeat-x;
border-color: #dca7a7;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
}
.progress {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5));
background-image: -webkit-linear-gradient(top, #ebebeb, 0%, #f5f5f5, 100%);
background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
}
.progress-bar {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.progress-bar-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%);
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.progress-bar-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%);
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.progress-bar-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%);
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.progress-bar-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%);
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #3071a9;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3278b3, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);
background-repeat: repeat-x;
border-color: #3278b3;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8));
background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%);
background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
}
.panel-primary > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.panel-success > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6));
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #d0e9c6, 100%);
background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
}
.panel-info > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3));
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #c4e3f3, 100%);
background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
}
.panel-warning > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc));
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #faf2cc, 100%);
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
}
.panel-danger > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc));
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #ebcccc, 100%);
background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
}
.well {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5));
background-image: -webkit-linear-gradient(top, #e8e8e8, 0%, #f5f5f5, 100%);
background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
background-repeat: repeat-x;
border-color: #dcdcdc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* Bootstrap v3.0.0 * Bootstrap v3.0.0
* *

View File

@@ -1,14 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* Bootstrap v3.0.0 * Bootstrap v3.0.0
* *

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* jQuery JavaScript Library v1.10.2 * jQuery JavaScript Library v1.10.2
* http://jquery.com/ * http://jquery.com/

View File

@@ -1,20 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* JQUERY CORE 1.10.2; Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; http://jquery.org/license
* Includes Sizzle.js; Copyright 2013 jQuery Foundation, Inc. and other contributors; http://opensource.org/licenses/MIT
*
* NUGET: END LICENSE TEXT */
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map //@ sourceMappingURL=jquery-1.10.2.min.map
*/ */

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/* /*
* This file has been commented to support Visual Studio Intellisense. * This file has been commented to support Visual Studio Intellisense.
* You should not use this file at runtime inside the browser--it is only * You should not use this file at runtime inside the browser--it is only

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* jQuery Validation Plugin 1.11.1 * jQuery Validation Plugin 1.11.1
* *

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia = window.matchMedia || (function(doc, undefined){ window.matchMedia = window.matchMedia || (function(doc, undefined){

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);

View File

@@ -0,0 +1,384 @@
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #e6e6e6, 100%);
background-image: -moz-linear-gradient(top, #ffffff 0%, #e6e6e6 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #e6e6e6 100%);
background-repeat: repeat-x;
border-color: #e0e0e0;
border-color: #ccc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
}
.btn-default:active,
.btn-default.active {
background-color: #e6e6e6;
border-color: #e0e0e0;
}
.btn-primary {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
border-color: #2d6ca2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.btn-primary:active,
.btn-primary.active {
background-color: #3071a9;
border-color: #2d6ca2;
}
.btn-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%);
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
border-color: #419641;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.btn-success:active,
.btn-success.active {
background-color: #449d44;
border-color: #419641;
}
.btn-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%);
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
border-color: #eb9316;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.btn-warning:active,
.btn-warning.active {
background-color: #ec971f;
border-color: #eb9316;
}
.btn-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%);
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
border-color: #c12e2a;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.btn-danger:active,
.btn-danger.active {
background-color: #c9302c;
border-color: #c12e2a;
}
.btn-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%);
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
border-color: #2aabd2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.btn-info:active,
.btn-info.active {
background-color: #31b0d5;
border-color: #2aabd2;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #357ebd;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.navbar {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8));
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #f8f8f8, 100%);
background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%);
background-repeat: repeat-x;
border-radius: 4px;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
}
.navbar .navbar-nav > .active > a {
background-color: #f8f8f8;
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.navbar-inverse {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222));
background-image: -webkit-linear-gradient(top, #3c3c3c, 0%, #222222, 100%);
background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%);
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
}
.navbar-inverse .navbar-nav > .active > a {
background-color: #222222;
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.alert-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc));
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #c8e5bc, 100%);
background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
background-repeat: repeat-x;
border-color: #b2dba1;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
}
.alert-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0));
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #b9def0, 100%);
background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
background-repeat: repeat-x;
border-color: #9acfea;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
}
.alert-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0));
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #f8efc0, 100%);
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
background-repeat: repeat-x;
border-color: #f5e79e;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
}
.alert-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3));
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #e7c3c3, 100%);
background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
background-repeat: repeat-x;
border-color: #dca7a7;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
}
.progress {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5));
background-image: -webkit-linear-gradient(top, #ebebeb, 0%, #f5f5f5, 100%);
background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
}
.progress-bar {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.progress-bar-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%);
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.progress-bar-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%);
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.progress-bar-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%);
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.progress-bar-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%);
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #3071a9;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3278b3, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);
background-repeat: repeat-x;
border-color: #3278b3;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8));
background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%);
background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
}
.panel-primary > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.panel-success > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6));
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #d0e9c6, 100%);
background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
}
.panel-info > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3));
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #c4e3f3, 100%);
background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
}
.panel-warning > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc));
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #faf2cc, 100%);
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
}
.panel-danger > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc));
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #ebcccc, 100%);
background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
}
.well {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5));
background-image: -webkit-linear-gradient(top, #e8e8e8, 0%, #f5f5f5, 100%);
background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
background-repeat: repeat-x;
border-color: #dcdcdc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* Bootstrap v3.0.0 * Bootstrap v3.0.0
* *

View File

@@ -1,14 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* Bootstrap v3.0.0 * Bootstrap v3.0.0
* *

View File

@@ -25,6 +25,7 @@
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<WebGreaseLibPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib</WebGreaseLibPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -44,11 +45,19 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Antlr3.Runtime, Version=3.4.1.9004, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath> <HintPath>..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
@@ -58,6 +67,27 @@
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
@@ -67,54 +97,13 @@
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" /> <Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" /> <Reference Include="System.EnterpriseServices" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http"> <Reference Include="System.Net.Http">
</Reference> </Reference>
<Reference Include="System.Net.Http.WebRequest"> <Reference Include="System.Net.Http.WebRequest">
</Reference> </Reference>
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="WebGrease, Version=1.5.2.14234, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> <HintPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
</Reference> </Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\Modbus.Net\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
@@ -128,6 +117,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\bootstrap-theme.css" />
<Content Include="Content\bootstrap-theme.min.css" />
<Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" /> <Content Include="Content\bootstrap.min.css" />
<Content Include="favicon.ico" /> <Content Include="favicon.ico" />
@@ -136,6 +127,10 @@
<Content Include="Content\Site.css" /> <Content Include="Content\Site.css" />
<Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" /> <Content Include="Scripts\bootstrap.min.js" />
<Content Include="packages.config" />
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" />
<None Include="Scripts\jquery-1.10.2.intellisense.js" /> <None Include="Scripts\jquery-1.10.2.intellisense.js" />
<Content Include="Scripts\jquery-1.10.2.js" /> <Content Include="Scripts\jquery-1.10.2.js" />
<Content Include="Scripts\jquery-1.10.2.min.js" /> <Content Include="Scripts\jquery-1.10.2.min.js" />
@@ -161,17 +156,11 @@
<Content Include="Views\Shared\Error.cshtml" /> <Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Home\Index.cshtml" /> <Content Include="Views\Home\Index.cshtml" />
<Content Include="Scripts\jquery-1.10.2.min.map" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" />
<Content Include="packages.config" />
<Content Include="Scripts\jquery-1.10.2.min.map" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj"> <ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj">
<Project>{fdca72ba-6d06-4de0-b873-c11c4ac853ad}</Project> <Project>{fdca72ba-6d06-4de0-b873-c11c4ac853ad}</Project>
@@ -212,7 +201,7 @@
</ProjectExtensions> </ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用NuGet 程序包还原可下载这些程序包。有关更多信息,请参 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText> <ErrorText>此项目引用这台计算机上缺少的 NuGet 程序包。使用 NuGet 程序包还原可下载这些程序包。有关详细信息,请参 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" /> <Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> <Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* jQuery JavaScript Library v1.10.2 * jQuery JavaScript Library v1.10.2
* http://jquery.com/ * http://jquery.com/

View File

@@ -1,20 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* JQUERY CORE 1.10.2; Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; http://jquery.org/license
* Includes Sizzle.js; Copyright 2013 jQuery Foundation, Inc. and other contributors; http://opensource.org/licenses/MIT
*
* NUGET: END LICENSE TEXT */
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map //@ sourceMappingURL=jquery-1.10.2.min.map
*/ */

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/* /*
* This file has been commented to support Visual Studio Intellisense. * This file has been commented to support Visual Studio Intellisense.
* You should not use this file at runtime inside the browser--it is only * You should not use this file at runtime inside the browser--it is only

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* jQuery Validation Plugin 1.11.1 * jQuery Validation Plugin 1.11.1
* *

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia = window.matchMedia || (function(doc, undefined){ window.matchMedia = window.matchMedia || (function(doc, undefined){

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);

View File

@@ -0,0 +1,384 @@
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #e6e6e6, 100%);
background-image: -moz-linear-gradient(top, #ffffff 0%, #e6e6e6 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #e6e6e6 100%);
background-repeat: repeat-x;
border-color: #e0e0e0;
border-color: #ccc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
}
.btn-default:active,
.btn-default.active {
background-color: #e6e6e6;
border-color: #e0e0e0;
}
.btn-primary {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
border-color: #2d6ca2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.btn-primary:active,
.btn-primary.active {
background-color: #3071a9;
border-color: #2d6ca2;
}
.btn-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%);
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
border-color: #419641;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.btn-success:active,
.btn-success.active {
background-color: #449d44;
border-color: #419641;
}
.btn-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%);
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
border-color: #eb9316;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.btn-warning:active,
.btn-warning.active {
background-color: #ec971f;
border-color: #eb9316;
}
.btn-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%);
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
border-color: #c12e2a;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.btn-danger:active,
.btn-danger.active {
background-color: #c9302c;
border-color: #c12e2a;
}
.btn-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%);
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
border-color: #2aabd2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.btn-info:active,
.btn-info.active {
background-color: #31b0d5;
border-color: #2aabd2;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #357ebd;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.navbar {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8));
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #f8f8f8, 100%);
background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%);
background-repeat: repeat-x;
border-radius: 4px;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
}
.navbar .navbar-nav > .active > a {
background-color: #f8f8f8;
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.navbar-inverse {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222));
background-image: -webkit-linear-gradient(top, #3c3c3c, 0%, #222222, 100%);
background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%);
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
}
.navbar-inverse .navbar-nav > .active > a {
background-color: #222222;
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.alert-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc));
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #c8e5bc, 100%);
background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
background-repeat: repeat-x;
border-color: #b2dba1;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
}
.alert-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0));
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #b9def0, 100%);
background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
background-repeat: repeat-x;
border-color: #9acfea;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
}
.alert-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0));
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #f8efc0, 100%);
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
background-repeat: repeat-x;
border-color: #f5e79e;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
}
.alert-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3));
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #e7c3c3, 100%);
background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
background-repeat: repeat-x;
border-color: #dca7a7;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
}
.progress {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5));
background-image: -webkit-linear-gradient(top, #ebebeb, 0%, #f5f5f5, 100%);
background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
}
.progress-bar {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.progress-bar-success {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%);
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.progress-bar-info {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%);
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.progress-bar-warning {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%);
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.progress-bar-danger {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%);
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #3071a9;
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3278b3, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);
background-repeat: repeat-x;
border-color: #3278b3;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8));
background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%);
background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
}
.panel-primary > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%);
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.panel-success > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6));
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #d0e9c6, 100%);
background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
}
.panel-info > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3));
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #c4e3f3, 100%);
background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
}
.panel-warning > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc));
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #faf2cc, 100%);
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
}
.panel-danger > .panel-heading {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc));
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #ebcccc, 100%);
background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
}
.well {
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5));
background-image: -webkit-linear-gradient(top, #e8e8e8, 0%, #f5f5f5, 100%);
background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
background-repeat: repeat-x;
border-color: #dcdcdc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* Bootstrap v3.0.0 * Bootstrap v3.0.0
* *

View File

@@ -1,14 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* Bootstrap v3.0.0 * Bootstrap v3.0.0
* *

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* jQuery JavaScript Library v1.10.2 * jQuery JavaScript Library v1.10.2
* http://jquery.com/ * http://jquery.com/

View File

@@ -1,20 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* JQUERY CORE 1.10.2; Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; http://jquery.org/license
* Includes Sizzle.js; Copyright 2013 jQuery Foundation, Inc. and other contributors; http://opensource.org/licenses/MIT
*
* NUGET: END LICENSE TEXT */
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map //@ sourceMappingURL=jquery-1.10.2.min.map
*/ */

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/* /*
* This file has been commented to support Visual Studio Intellisense. * This file has been commented to support Visual Studio Intellisense.
* You should not use this file at runtime inside the browser--it is only * You should not use this file at runtime inside the browser--it is only

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! /*!
* jQuery Validation Plugin 1.11.1 * jQuery Validation Plugin 1.11.1
* *

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia = window.matchMedia || (function(doc, undefined){ window.matchMedia = window.matchMedia || (function(doc, undefined){

View File

@@ -1,17 +1,3 @@
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);

View File

@@ -25,6 +25,7 @@
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<WebGreaseLibPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib</WebGreaseLibPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -44,11 +45,19 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Antlr3.Runtime, Version=3.4.1.9004, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath> <HintPath>..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
@@ -58,6 +67,27 @@
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
@@ -67,54 +97,13 @@
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" /> <Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" /> <Reference Include="System.EnterpriseServices" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http"> <Reference Include="System.Net.Http">
</Reference> </Reference>
<Reference Include="System.Net.Http.WebRequest"> <Reference Include="System.Net.Http.WebRequest">
</Reference> </Reference>
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="WebGrease, Version=1.5.2.14234, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> <HintPath>..\..\Modbus.Net\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
</Reference> </Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\..\Modbus.Net\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\Modbus.Net\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
@@ -128,6 +117,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\bootstrap-theme.css" />
<Content Include="Content\bootstrap-theme.min.css" />
<Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" /> <Content Include="Content\bootstrap.min.css" />
<Content Include="favicon.ico" /> <Content Include="favicon.ico" />
@@ -136,6 +127,10 @@
<Content Include="Content\Site.css" /> <Content Include="Content\Site.css" />
<Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" /> <Content Include="Scripts\bootstrap.min.js" />
<Content Include="packages.config" />
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" />
<None Include="Scripts\jquery-1.10.2.intellisense.js" /> <None Include="Scripts\jquery-1.10.2.intellisense.js" />
<Content Include="Scripts\jquery-1.10.2.js" /> <Content Include="Scripts\jquery-1.10.2.js" />
<Content Include="Scripts\jquery-1.10.2.min.js" /> <Content Include="Scripts\jquery-1.10.2.min.js" />
@@ -161,17 +156,11 @@
<Content Include="Views\Shared\Error.cshtml" /> <Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Home\Index.cshtml" /> <Content Include="Views\Home\Index.cshtml" />
<Content Include="Scripts\jquery-1.10.2.min.map" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" />
<Content Include="packages.config" />
<Content Include="Scripts\jquery-1.10.2.min.map" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj"> <ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj">
<Project>{fdca72ba-6d06-4de0-b873-c11c4ac853ad}</Project> <Project>{fdca72ba-6d06-4de0-b873-c11c4ac853ad}</Project>
@@ -212,7 +201,7 @@
</ProjectExtensions> </ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用NuGet 程序包还原可下载这些程序包。有关更多信息,请参 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText> <ErrorText>此项目引用这台计算机上缺少的 NuGet 程序包。使用 NuGet 程序包还原可下载这些程序包。有关详细信息,请参 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" /> <Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> <Error Condition="!Exists('..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Modbus.Net\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

Some files were not shown because too many files have changed in this diff Show More