|
@@ -41,40 +41,42 @@ namespace Vinno.FIS.Sonopost.Settings
|
|
|
|
|
|
static SonopostSystemSettings()
|
|
|
{
|
|
|
- if (!LoadConfig())
|
|
|
+ try
|
|
|
{
|
|
|
- Instance = new SonopostSystemSettings
|
|
|
+ if (!LoadConfig())
|
|
|
{
|
|
|
- RainbowImageDetectSetting = new FISRainbowImageDetectConfig
|
|
|
+ Instance = new SonopostSystemSettings
|
|
|
{
|
|
|
- BeforeDisableIntervalTime = 3000,
|
|
|
- BeforeEnableIntervalTime = 5000,
|
|
|
- AfterEnableIntervalTime = 2000,
|
|
|
- ScanIntervalTime = 7500,
|
|
|
- IsDetectRainbowImage = false,
|
|
|
- CaptureCardList = new List<string>
|
|
|
+ RainbowImageDetectSetting = new FISRainbowImageDetectConfig
|
|
|
+ {
|
|
|
+ BeforeDisableIntervalTime = 3000,
|
|
|
+ BeforeEnableIntervalTime = 5000,
|
|
|
+ AfterEnableIntervalTime = 2000,
|
|
|
+ ScanIntervalTime = 7500,
|
|
|
+ IsDetectRainbowImage = false,
|
|
|
+ CaptureCardList = new List<string>
|
|
|
{
|
|
|
"LT8501-DVI Card",
|
|
|
"HWSPro Capture Card"
|
|
|
},
|
|
|
- },
|
|
|
- UpdateSetting = new UpdateSetting
|
|
|
- {
|
|
|
- NeedAutoUpdate = true,
|
|
|
- AutoUpdateTime = 3,
|
|
|
- },
|
|
|
- WebSetting = new WebSetting
|
|
|
- {
|
|
|
- WebPort = 80,
|
|
|
- WebPortStandby = 8080,
|
|
|
- WebSocketPort = 54321,
|
|
|
- },
|
|
|
- InputDeviceNames = new List<string>
|
|
|
+ },
|
|
|
+ UpdateSetting = new UpdateSetting
|
|
|
+ {
|
|
|
+ NeedAutoUpdate = true,
|
|
|
+ AutoUpdateTime = 3,
|
|
|
+ },
|
|
|
+ WebSetting = new WebSetting
|
|
|
+ {
|
|
|
+ WebPort = 80,
|
|
|
+ WebPortStandby = 8080,
|
|
|
+ WebSocketPort = 54321,
|
|
|
+ },
|
|
|
+ InputDeviceNames = new List<string>
|
|
|
{
|
|
|
"HD Video 1 (LT8501-DVI Card)",
|
|
|
"HDPro 1"
|
|
|
},
|
|
|
- SkippedMicDeviceNames = new List<string>
|
|
|
+ SkippedMicDeviceNames = new List<string>
|
|
|
{
|
|
|
"HD Audio 1 (LT8501-DVI Card) (LT8501-DVI Card)",
|
|
|
"HD Audio 1 (LT8501-DVI Card) (2- LT8501-DVI Card)",
|
|
@@ -87,18 +89,23 @@ namespace Vinno.FIS.Sonopost.Settings
|
|
|
"麦克风 (High Definition Audio 设备)",
|
|
|
"麦克风 (2- High Definition Audio 设备)"
|
|
|
},
|
|
|
- SkippedSpeakerDeviceNames = new List<string>
|
|
|
+ SkippedSpeakerDeviceNames = new List<string>
|
|
|
{
|
|
|
"耳机 (High Definition Audio 设备)",
|
|
|
"耳机 (2- High Definition Audio 设备)",
|
|
|
"Headphones (High Definition Audio Device)",
|
|
|
"Headphones (2- High Definition Audio Device)"
|
|
|
},
|
|
|
- ModelType = "SP-0002",
|
|
|
- CodecName = "h264_qsv",
|
|
|
- OledCommName = null,
|
|
|
- };
|
|
|
- Instance.Save();
|
|
|
+ ModelType = "SP-0002",
|
|
|
+ CodecName = "h264_qsv",
|
|
|
+ OledCommName = null,
|
|
|
+ };
|
|
|
+ Instance.Save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"SonopostSystemSettings Static Cstr Error:{ex}");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -119,42 +126,60 @@ namespace Vinno.FIS.Sonopost.Settings
|
|
|
{
|
|
|
if (File.Exists(_systemSettingFilePath))
|
|
|
{
|
|
|
- try
|
|
|
+ if (LoadConfigFile())
|
|
|
{
|
|
|
- var jsonString = File.ReadAllText(_systemSettingFilePath);
|
|
|
- Instance = JsonHelper.JsonToObj<SonopostSystemSettings>(jsonString);
|
|
|
- if (Instance == null)
|
|
|
- {
|
|
|
- Logger.WriteLineError($"SonopostSystemSettingInfo Load Config Fail,Instance is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
return true;
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ else if (File.Exists(_systemSettingTempFilePath))
|
|
|
{
|
|
|
- Logger.WriteLineError($"SonopostSystemSettingInfo Load Config Fail,ex:{ex}");
|
|
|
+ return LoadTempConfigFile();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- var jsonString = File.ReadAllText(_systemSettingTempFilePath);
|
|
|
- Instance = JsonHelper.JsonToObj<SonopostSystemSettings>(jsonString);
|
|
|
- if (Instance == null)
|
|
|
- {
|
|
|
- Logger.WriteLineError($"SonopostSystemSettingInfo Load temp Config Fail,Instance is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- Logger.WriteLineError($"SonopostSystemSettingInfo Load temp Config Fail,ex:{ex}");
|
|
|
- }
|
|
|
+ return LoadTempConfigFile();
|
|
|
}
|
|
|
}
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
+ private static bool LoadTempConfigFile()
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var jsonString = File.ReadAllText(_systemSettingTempFilePath);
|
|
|
+ Instance = JsonHelper.JsonToObj<SonopostSystemSettings>(jsonString);
|
|
|
+ if (Instance == null)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"SonopostSystemSettingInfo Load temp Config Fail,Instance is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"SonopostSystemSettingInfo Load temp Config Fail,ex:{ex}");
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static bool LoadConfigFile()
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var jsonString = File.ReadAllText(_systemSettingFilePath);
|
|
|
+ Instance = JsonHelper.JsonToObj<SonopostSystemSettings>(jsonString);
|
|
|
+ if (Instance == null)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"SonopostSystemSettingInfo Load Config Fail,Instance is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"SonopostSystemSettingInfo Load Config Fail,ex:{ex}");
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -171,7 +196,7 @@ namespace Vinno.FIS.Sonopost.Settings
|
|
|
WriteIndented = true
|
|
|
});
|
|
|
File.WriteAllText(_systemSettingTempFilePath, jsonString);
|
|
|
- FileHelper.MoveFile(_systemSettingTempFilePath, _systemSettingFilePath, true);
|
|
|
+ FileHelper.CopyFile(_systemSettingTempFilePath, _systemSettingFilePath, true);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|