alielie
2025-05-20 99df058a665ea04065a23e729ec79a2f23f79881
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
using System;
using System.IO;
 
namespace HMI.Core.Util
{
    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 ProductDataFolder { get; private set; }
        public static string ProductParameterFolder { get; private set; }
 
        /// <summary>
        /// 产品数据源文件
        /// </summary>
        public static string ProductDataFile { 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>
        /// 应用程序的根目录
        /// </summary>
        /// <returns></returns>
        private static string RootPath()
        {
            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";
            LangFolder = InitFolder(path + "\\Lang");
            SettingFolder = InitFolder(ConfigFolder + "\\SystemSetting");
            ParameterFolder = InitFolder(ConfigFolder + "\\Parameter");
            ParameterDataPath = ParameterFolder + "\\CommonParameter.data";
 
            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>
        /// 系统配置信息存储文件夹路径
        /// </summary>
        /// <returns>系统配置信息文件夹</returns>
        public static string SystemSettingFolder()
        {
            string Path = RootPath() + "\\Config\\SystemSetting";
            return Path;
        }
 
        /// <summary>
        /// 系统配置文件
        /// </summary>
        /// <returns>系统配置文件路径</returns>
        public static string SystemSettingFile()
        {
            string Path = RootPath() + "\\Config\\SystemSetting\\system.setting";
            return Path;
        }
 
        // <summary>
        /// 菜单配置文件
        /// </summary>
        /// <returns>菜单配置文件</returns>
        public static string MenuFile()
        {
            string Path = RootPath() + "\\Config\\SystemSetting\\menu.setting";
            return Path;
        }
 
        /// <summary>
        /// 生产配置文件夹
        /// </summary>
        /// <returns>生产配置文件夹</returns>
        public static string ProductionFolder()
        {
            string Path = RootPath() + "\\Config\\ProductionSetting";
            return Path;
        }
 
        /// <summary>
        /// 测试项信息存储文件夹
        /// </summary>
        /// <returns>测试项存储文件夹</returns>
        public static string TestItemFolder()
        {
            string Path = ProductionFolder() + "\\TestItem";
            return Path;
        }
 
        /// <summary>
        /// 插件存储目录
        /// </summary>
        /// <returns>插件存储目录</returns>
        public static string PluginFolder()
        {
            string Path = RootPath() + "\\Plugin";
            return Path;
        }
 
        public static string InitFolder(string path)
        {
            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
            }
            catch
            {
 
            }
            return path;
        }
    }
}