wenxiangchao
2026-11-02 fe2aa4880d5c9fd88088ad0ed81ebaca05629f5f
HMI.Core/Util/PathHelper.cs
@@ -5,11 +5,69 @@
{
    public class PathHelper
    {
        /// <summary>
        /// 程序目录
        /// </summary>
        public static string AppFolder { get; private set; } = RootPath();
        /// <summary>
        /// 图标目录
        /// </summary>
        public static string IconFolder { get; private set; }
        /// <summary>
        /// Config目录
        /// </summary>
        public static string ConfigFolder { get; private set; }
        /// <summary>
        /// Sqlite数据库目录
        /// </summary>
        public static string DatabaseFolder { get; private set; }
        /// <summary>
        /// Sqlite数据库Path
        /// </summary>
        public static string DatabasePath { get; private set; }
        /// <summary>
        /// 多语言目录
        /// </summary>
        public static string LangFolder { get; private set; }
        /// <summary>
        /// 系统设置目录
        /// </summary>
        public static string SettingFolder { get; private set; }
        /// <summary>
        /// 参数目录
        /// </summary>
        public static string ParameterFolder { get; private set; }
        /// <summary>
        /// 参数数据源文件
        /// </summary>
        public static string ParameterDataPath { get; private set; }
        /// <summary>
        /// 测试项数据目录
        /// </summary>
        public static string TestItemDataFolder { get; private set; }
        /// <summary>
        /// 测试项数据源文件
        /// </summary>
        public static string TestItemDataFile { get; private set; }
        /// <summary>
        /// sqlite日志数据库文件夹
        /// </summary>
        public static string LogViewerDir { get; private set; }
        /// <summary>
        /// 应用程序的根目录
@@ -17,19 +75,26 @@
        /// <returns></returns>
        private static string RootPath()
        {
            string DllPath = DllHelper.GetAssemblyPath();
            string DllPath = AppDomain.CurrentDomain.BaseDirectory;
            string path = Path.GetFullPath(".");
            IconFolder = InitFolder(path + "\\Icon");
            ConfigFolder = InitFolder(path + "\\Config");
            DatabaseFolder = InitFolder(ConfigFolder + "\\Database");
            DatabasePath = DatabaseFolder + "\\database.db";
            return path;
        }
            LangFolder = InitFolder(path + "\\Lang");
            SettingFolder = InitFolder(ConfigFolder + "\\SystemSetting");
            ParameterFolder = InitFolder(ConfigFolder + "\\Parameter");
            ParameterDataPath = ParameterFolder + "\\CommonParameter.data";
        public static string SettingFolder()
        {
            string Path = RootPath() + "\\Config\\Setting";
            return Path;
            //ProductDataFolder = InitFolder(ConfigFolder + "\\Product");
            //ProductParameterFolder = InitFolder(ProductDataFolder + "\\Parameter");
            //ProductDataFile = ProductDataFolder + "\\Product.data";
            // TestItemDataFolder = InitFolder(ProductDataFolder + "\\TestItem");
            TestItemDataFile = TestItemDataFolder + "\\TestItem.data";
            LogViewerDir = InitFolder(ConfigFolder + "\\LogViewer");
            return path;
        }
        /// <summary>
@@ -82,13 +147,15 @@
            return Path;
        }
        /// <summary>
        /// 设置参数文件夹
        /// </summary>
        /// <returns>设置参数文件夹</returns>
        public static string ParameterFolder()
        public static string BlockAlarmSettingPath()
        {
            string Path = ProductionFolder() + "\\Parameter";
            string Path = RootPath() + "\\Config\\AlarmInfo\\BlockSetting.xml";
            return Path;
        }
        public static string MarkAlarmSettingPath()
        {
            string Path = RootPath() + "\\Config\\AlarmInfo\\MarkSetting.xml";
            return Path;
        }
@@ -102,7 +169,7 @@
            return Path;
        }
        private static string InitFolder(string path)
        public static string InitFolder(string path)
        {
            try
            {
@@ -111,7 +178,7 @@
                    Directory.CreateDirectory(path);
                }
            }
            catch (Exception ex)
            catch
            {
            }