|
|
@@ -5845,27 +5845,24 @@ namespace TeamAAS_VP.Core
|
|
|
public class SharedSpeedFileHelper
|
|
|
{
|
|
|
private static readonly object _lockObj = new object();
|
|
|
- private readonly string _filePath;
|
|
|
-
|
|
|
-
|
|
|
- public SharedSpeedFileHelper()
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- string directoryPath = @"Z:\\1111\\2222\\3333";
|
|
|
+ string directoryPath = @"Z:\\XTM\\Speed";
|
|
|
+ //public SharedSpeedFileHelper()
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // string directoryPath = @"Z:\\1111\\2222\\3333";
|
|
|
|
|
|
- // 确保目录存在
|
|
|
- if (!Directory.Exists(directoryPath))
|
|
|
- Directory.CreateDirectory(directoryPath);
|
|
|
+ // // 确保目录存在
|
|
|
+ // if (!Directory.Exists(directoryPath))
|
|
|
+ // Directory.CreateDirectory(directoryPath);
|
|
|
|
|
|
- _filePath = Path.Combine(directoryPath, "SharedSpeedData.json");
|
|
|
- }
|
|
|
- catch
|
|
|
- {
|
|
|
- LogHelper.WriteLogInfo("Z盘路径不存在");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ // _filePath = Path.Combine(directoryPath, "SharedSpeedData.json");
|
|
|
+ // }
|
|
|
+ // catch
|
|
|
+ // {
|
|
|
+ // LogHelper.WriteLogInfo("Z盘路径不存在");
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
// 写入速度数据
|
|
|
public void WriteSpeedData(string speed, int state)
|
|
|
@@ -5885,6 +5882,12 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
WriteIndented = true
|
|
|
});
|
|
|
+
|
|
|
+ // 确保目录存在
|
|
|
+ if (!Directory.Exists(directoryPath))
|
|
|
+ Directory.CreateDirectory(directoryPath);
|
|
|
+
|
|
|
+ string _filePath = Path.Combine(directoryPath, "SharedSpeedData.json");
|
|
|
|
|
|
File.WriteAllText(_filePath, json, Encoding.UTF8);
|
|
|
}
|
|
|
@@ -5902,8 +5905,12 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (!File.Exists(_filePath))
|
|
|
+ // 确保目录存在
|
|
|
+ if (!Directory.Exists(directoryPath))
|
|
|
+ {
|
|
|
return null;
|
|
|
+ }
|
|
|
+ string _filePath = Path.Combine(directoryPath, "SharedSpeedData.json");
|
|
|
|
|
|
string json = File.ReadAllText(_filePath, Encoding.UTF8);
|
|
|
return JsonSerializer.Deserialize<SpeedData>(json);
|