Skip to content

Commit

Permalink
Fix the exception for FSUIPC and interpolation (#1618)
Browse files Browse the repository at this point in the history
* Fix the exception for FSUIPC and interpolation
* Fixed issue with input config
* Fixed Modifier match
* i18n
  • Loading branch information
DocMoebiuz authored Jan 25, 2024
1 parent 71aa4e4 commit 9dd0e9c
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 142 deletions.
21 changes: 12 additions & 9 deletions MobiFlight/Modifier/Interpolation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,25 @@ protected double interpolate(double value, double x1, double y1, double x2, doub

public override bool Equals(object obj)
{
bool entriesAreSame = (Values.Count == (obj as Interpolation).Count);
if (entriesAreSame)
var interpolation = (obj as Interpolation);
if (interpolation == null) return false;

bool valuesAreSame = (Values.Count == interpolation.Count);

if (valuesAreSame)
{
foreach (double x in Values.Keys)
{
entriesAreSame = entriesAreSame && ((obj as Interpolation).Values.ContainsKey(x) && Values[x] == (obj as Interpolation).Values[x]);
valuesAreSame = valuesAreSame && (interpolation.Values.ContainsKey(x) && Values[x] == interpolation.Values[x]);
}
}

return
obj != null && obj is Interpolation &&
Max == (obj as Interpolation).Max &&
Min == (obj as Interpolation).Min &&
Count == (obj as Interpolation).Count &&
Active == (obj as Interpolation).Active &&
entriesAreSame;
Max == interpolation.Max &&
Min == interpolation.Min &&
Count == interpolation.Count &&
Active == interpolation.Active &&
valuesAreSame;
}
public override string ToSummaryLabel()
{
Expand Down
1 change: 1 addition & 0 deletions MobiFlightConnector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@
</EmbeddedResource>
<EmbeddedResource Include="UI\Panels\Config\FsuipcConfigPanel.de.resx">
<DependentUpon>FsuipcConfigPanel.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Panels\Config\InterpolationPanel.de.resx">
<DependentUpon>InterpolationPanel.cs</DependentUpon>
Expand Down
6 changes: 3 additions & 3 deletions UI/Panels/Config/FsuipcConfigPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ private void fsuipcPresetUseButton_Click(object sender, EventArgs e)
{
var config = rows[0]["settings"] as IFsuipcConfigItem;
syncFromConfig(config);
panelModifierHint.Visible = (config?.Modifiers.Items.Count > 0);
PresetChanged(this, config);
panelModifierHint.Visible = (config?.Modifiers.Items.Count > 0) && OutputPanelMode;
PresetChanged?.Invoke(this, config);
}
}
}
Expand Down Expand Up @@ -258,7 +258,7 @@ public void syncFromConfig(object config)

if (preset.FSUIPC.Equals(conf.FSUIPC))
{
if (!preset.Modifiers.Items.TrueForAll(m => m.Active && conf.Modifiers.ContainsModifier(m))) continue;
if (!preset.Modifiers.Items.FindAll(m=>m.Active).TrueForAll(m => conf.Modifiers.ContainsModifier(m))) continue;
// we found the preset
fsuipcPresetComboBox.Text = row["description"].ToString();
panelModifierHint.Visible = (row["settings"] as IFsuipcConfigItem).Modifiers.Items.Count > 0;
Expand Down
35 changes: 15 additions & 20 deletions UI/Panels/Config/FsuipcConfigPanel.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,35 +118,23 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 5</value>
</data>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>106, 13</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Setze Wert</value>
</data>
<data name="SubStringToLabel.Text" xml:space="preserve">
<value>bis</value>
</data>
<data name="fsuipcMoreOptionsGroupBox.Text" xml:space="preserve">
<value>Weitere Optionen</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>101, 13</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Maskiere Wert mit</value>
</data>
<data name="fsuipcBaseSettingsGroupBox.Text" xml:space="preserve">
<value>Basis-Einstellungen</value>
</data>
<data name="fsuipcTypeLabel.Text" xml:space="preserve">
<value>Wert Typ</value>
</data>
<data name="label2.Text" xml:space="preserve">
<data name="fsuipcSizeLabel.Text" xml:space="preserve">
<value>Größe in Bytes</value>
</data>
<data name="fsuipcBaseSettingsGroupBox.Text" xml:space="preserve">
<value>Basis-Einstellungen</value>
<data name="fsuipcLoadPresetGroupBox.Text" xml:space="preserve">
<value>Preset laden</value>
</data>
<data name="labelFsuipcPreset.Location" type="System.Drawing.Point, System.Drawing">
<value>24, 25</value>
Expand All @@ -157,7 +145,14 @@
<data name="labelFsuipcPreset.Text" xml:space="preserve">
<value>Verwende Preset</value>
</data>
<data name="fsuipcLoadPresetGroupBox.Text" xml:space="preserve">
<value>Preset laden</value>
<data name="buttonModifyTab.Location" type="System.Drawing.Point, System.Drawing">
<value>300, 3</value>
</data>
<data name="labelModifierHint.Size" type="System.Drawing.Size, System.Drawing">
<value>300, 18</value>
</data>
<data name="labelModifierHint.Text" xml:space="preserve">
<value>Preset enthält Modifikatoren. Du kannst sie anpassen auf dem
</value>
</data>
</root>
6 changes: 0 additions & 6 deletions UI/Panels/Config/TransformOptionsGroup.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@
<data name="label5.Text" xml:space="preserve">
<value>Setze Wert</value>
</data>
<data name="SubstringTransformationCheckBox.Text" xml:space="preserve">
<value>Substring von</value>
</data>
<data name="SubStringToLabel.Text" xml:space="preserve">
<value>bis</value>
</data>
<data name="fsuipcMoreOptionsGroupBox.Text" xml:space="preserve">
<value>Weitere Optionen</value>
</data>
Expand Down
Loading

0 comments on commit 9dd0e9c

Please sign in to comment.