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

52 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mesnac.Equip.FictitiousPlc
{
public class BinaryFileHelper
{
#region 单例实现
private string filePath = "PlcData.dat"; //二进制PLC设备文件完整路径
private static BinaryFileHelper _instance = null;
private BinaryFileHelper()
{
try
{
string path = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
path = new System.IO.FileInfo(path).Directory.FullName;
this.filePath = System.IO.Path.Combine(path, filePath);
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Error(ex.Message);
}
}
public static BinaryFileHelper Instance
{
get
{
if (_instance == null)
{
_instance = new BinaryFileHelper();
}
return _instance;
}
}
#endregion
/// <summary>
/// 二进制PLC设备文件完整路径
/// </summary>
public string FilePath
{
get { return this.filePath; }
}
}
}