You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

173 lines
4.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Monitor.FrameWork
{
public class UserConfiguration
{
static UserConfiguration()
{
try
{
ConnectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0];
}
catch
{
ConnectionString = "";
}
try
{
ReadByteCount = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("ReadByteCount")[0]);
}
catch
{
ReadByteCount = 450;
}
try
{
EveryEventCount = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("EveryEventCount")[0]);
}
catch
{
EveryEventCount = 1;
}
try
{
TagEventSleepTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("TagEventSleepTime")[0]);
}
catch
{
TagEventSleepTime = 100;
}
try
{
ServerReworkTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("ServerReworkTime")[0]);
}
catch
{
ServerReworkTime = 60000;
}
try
{
Version = System.Configuration.ConfigurationManager.AppSettings.GetValues("Version")[0];
}
catch
{
Version = "1.0.1";
}
try
{
MqServerIp = System.Configuration.ConfigurationManager.AppSettings.GetValues("MqServerIp")[0];
}
catch
{
MqServerIp = "127.0.0.1";
}
try
{
UdpReceivePort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("UdpReceivePort")[0]);
}
catch
{
UdpReceivePort = 59601;
}
try
{
MqPubPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("MqPubPort")[0]);
}
catch
{
MqPubPort = 59602;
}
try
{
ResponsePort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.GetValues("ResponsePort")[0]);
}
catch
{
ResponsePort = 59603;
}
}
/// <summary>
/// SqlServer连接
/// </summary>
public static string ConnectionString { get; set; }
/// <summary>
/// 事件单次读取数据字节最大值
/// </summary>
public static int ReadByteCount { get; set; }
/// <summary>
/// 单个线程最大事件组数量
/// </summary>
public static int EveryEventCount { get; set; }
/// <summary>
/// 每次循环Sleep时间
/// </summary>
public static int TagEventSleepTime { get; set; }
/// <summary>
/// 事件服务断开重连事件
/// </summary>
public static int ServerReworkTime { get; set; }
/// <summary>
/// 版本号
/// </summary>
public static string Version { get; set; }
/// <summary>
/// netMq服务端IP地址
/// </summary>
public static string MqServerIp { get; set; }
/// <summary>
/// UDP 接收数据端口
/// </summary>
public static int UdpReceivePort { get; set; }
/// <summary>
/// MQ发布消息端口
/// </summary>
public static int MqPubPort { get; set; }
/// <summary>
///
/// </summary>
public static int ResponsePort { get; set; }
}
}