using DevExpress.CodeParser; using Ips.Library.DxpLib; using Ips.Library.Entity; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ips.Service.CapServer { public static class AppConst { static AppConst() { #region 设置采集数据存储目录,选择配置文件中容量最大的那个路径 var dirStr = ToolConfig.GetAppSetting("DataDir"); var dirs = dirStr.Replace(";", ";").Split(';', StringSplitOptions.RemoveEmptyEntries); if (dirs.Length == 1) { DataDir = dirs[0]; } else { //配置了多个存储目录,选容量最大的那个目录 var dir = dirs.Where(p => { var root = Path.GetPathRoot(p); DriveInfo drive = new DriveInfo(root); return drive.IsReady && drive.TotalSize > 0; }).OrderByDescending(p => { var root = Path.GetPathRoot(p); DriveInfo drive = new DriveInfo(root); return drive.TotalSize; }).FirstOrDefault(); DataDir = dir; } #endregion } /// /// 数据采集落盘的根目录 /// public static readonly string DataDir; /// /// 文件上传保存的目录 /// public static readonly string UploadDir = "Upload"; /// /// 采集服务使用的Http通信IP /// public static string LocalIp { get; set; } /// /// 采集服务使用的Http通信端口 /// public static int LocalPort { get; set; } /// /// 服务编号 /// public static string SvrNo { get; set; } /// /// 注册的容器http地址 /// public static string RegistryUri { get; set; } /// /// 采集卡类型 /// public static EnumCapDevType CardType { get; set; } } }