Skip to content

Commit 99a8c59

Browse files
committed
修复风扇转速表错误校验的问题。
1 parent c4098fe commit 99a8c59

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

FanCurveForm.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,8 @@ private void ValidateProfileForMachine(FanCurveProfile profile) {
494494
}
495495

496496
private void ValidatePointsForMachine(IList<FanCurvePoint> points, int temperatureMaximum) {
497-
if (points.Count < 2 ||
498-
points.Any(point =>
499-
point.Temperature < 0 ||
500-
point.Temperature > temperatureMaximum ||
501-
point.FanSpeed < 0 ||
502-
point.FanSpeed > fanSpeedMaximum) ||
497+
if (points.Count < 1 ||
498+
points.Any(point => point.FanSpeed < 0) ||
503499
points.GroupBy(point => point.Temperature).Any(group => group.Count() > 1)) {
504500
throw new InvalidDataException(Strings.FanCurveOutOfRange);
505501
}

Program.Menu.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,9 +2022,9 @@ static bool ApplyCustomFanConfig() {
20222022
SaveConfig("FanTable");
20232023
return true;
20242024
} catch (Exception ex) when (
2025-
ex is System.IO.IOException ||
2025+
ex is IOException ||
20262026
ex is UnauthorizedAccessException ||
2027-
ex is System.IO.InvalidDataException) {
2027+
ex is InvalidDataException) {
20282028
MessageBox.Show(
20292029
Application.OpenForms.OfType<HelpForm>().FirstOrDefault(),
20302030
Strings.FanCurveLoadFailed + Environment.NewLine + ex.Message,

Strings.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ public static class Strings {
143143
"風扇設定檔格式無效。",
144144
"The fan profile format is invalid.");
145145
public static string FanCurveOutOfRange => T(
146-
"曲线必须至少包含两个节点,温度和转速不能超过当前机型上限,且温度不能重复。",
147-
"曲線必須至少包含兩個節點,溫度和轉速不能超過目前機型上限,且溫度不能重複。",
148-
"Each curve needs at least two points. Values must stay within this model's limits and temperatures must be unique.");
146+
"曲线必须至少包含一个节点,转速不能低于0,且温度不能重复。",
147+
"曲線必須至少包含一個節點,轉速不能低於0,溫度無法重複。",
148+
"The curve must contain at least one node, the rotational speed cannot be lower than zero, and the temperatures must not be repeated.");
149149
public static string FanCurveLoadFailed => T("加载风扇配置失败。", "載入風扇設定失敗。", "Failed to load the fan profile.");
150150
public static string FanCurveSaveFailed => T("保存风扇配置失败。", "儲存風扇設定失敗。", "Failed to save the fan profile.");
151151
public static string FanResponseSpeed => T("风扇响应速度", "風扇響應速度", "Fan Response Speed");

0 commit comments

Comments
 (0)