BaoKai_202508_WebApi_Jingwa.../API/RfConfig.cs

88 lines
2.2 KiB
C#
Raw Permalink Normal View History

2025-08-24 22:23:34 +08:00
using System;
using System.Data;
using System.IO;
using System.Reflection;
using System.Collections.Generic;
namespace WCS
{
/// <summary>
/// Rf<52><66>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public class RfConfig
{
private const string CONFIG_XML_FILE = "config.xml";
private const string SYSTEM_SET_NODE = "SystemSet";
private static RfConfig _RfConfig;
private static string _ServerAddress;
private static string _ServiceName;
protected RfConfig()
{
GetConfigInfo();
GetWmsInfo();
}
public static RfConfig Create()
{
if (_RfConfig == null)
{
_RfConfig = new RfConfig();
}
return _RfConfig;
}
private static string _ScanIp1;
private static string _ScanProt1;
public string ScanIp1
{
get { return _ScanIp1; }
}
public string ScanProt1
{
get { return _ScanProt1; }
}
private static string _ScanIp2 = "0";
public string ScanIp2
{
get { return _ScanIp2; }
}
private static string _ScanProt2 = "0";
public string ScanProt2
{
get { return _ScanProt2; }
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
/// </summary>
private void GetConfigInfo()
{
DataSet ds = new DataSet();
string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
ds.ReadXml(appPath + "\\" + CONFIG_XML_FILE);
_ScanIp1 = ds.Tables[SYSTEM_SET_NODE].Rows[0]["scanip1"].ToString();
_ScanProt1 = ds.Tables[SYSTEM_SET_NODE].Rows[0]["prot1"].ToString();
_ScanIp2 = ds.Tables[SYSTEM_SET_NODE].Rows[0]["scanip2"].ToString();
_ScanProt2 = ds.Tables[SYSTEM_SET_NODE].Rows[0]["prot2"].ToString();
}
public DataSet plcds = new DataSet();
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
/// </summary>
private void GetWmsInfo()
{
string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
plcds.ReadXml(appPath + "\\" + "PLCData.xml");
}
}
}