Skip to content

Commit

Permalink
Adds CNV option for AH64
Browse files Browse the repository at this point in the history
Upgrade coordinate sharp 2.19 -> 2.22
Upgrade WIX installer builder 4.0.2->5.0.0
Version to 0.6.13
  • Loading branch information
FalcoGer committed May 16, 2024
1 parent 8366aef commit 2a0f815
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 41 deletions.
4 changes: 2 additions & 2 deletions CoordinateConverter/CoordinateConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="CoordinateSharp, Version=2.19.1.1, Culture=neutral, PublicKeyToken=f45e02df057b7725, processorArchitecture=MSIL">
<HintPath>..\packages\CoordinateSharp.2.19.1.1\lib\net40\CoordinateSharp.dll</HintPath>
<Reference Include="CoordinateSharp, Version=2.22.1.1, Culture=neutral, PublicKeyToken=f45e02df057b7725, processorArchitecture=MSIL">
<HintPath>..\packages\CoordinateSharp.2.22.1.1\lib\net40\CoordinateSharp.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
11 changes: 8 additions & 3 deletions CoordinateConverter/DCS/Aircraft/AH64/AH64RadioCNVSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,28 @@ public class AH64RadioCNVSetting
/// Initializes a new instance of the <see cref="AH64RadioCNVSetting"/> class.
/// </summary>
/// <param name="val">The value.</param>
public AH64RadioCNVSetting(int val)
public AH64RadioCNVSetting(int? val)
{
this.val = val;
}
private int val = 1;
private int? val = 1;
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>
/// The value.
/// </value>
/// <exception cref="System.ArgumentOutOfRangeException">value needs to be 1..6</exception>
public int Value
public int? Value
{
get { return val; }
set
{
if (value == null)
{
this.val = null;
return;
}
if (value < 1 || value > 6)
{
throw new ArgumentOutOfRangeException("value needs to be 1..6");
Expand Down
38 changes: 31 additions & 7 deletions CoordinateConverter/DCS/Aircraft/AH64/AH64RadioPresetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,15 @@ public List<DCSCommand> GenerateCommands(AH64DTCData.EPreset preset, bool IsPilo
{
commands.Add(new DCSCommand(mfd, (int)AH64.EKeyCode.MFD_R4));
commands.AddRange(AH64.GetCommandsForKUText(UHFFrequency.ToString() + '\n', true, IsPilot));
// TODO: CNV, HQ
// CNV
if (UHFCNV.Value != null)
{
commands.Add(new DCSCommand(mfd, (int)AH64.EKeyCode.MFD_R2));
// CNV is menu R1 - R6, luckily R1 - 1 + CNV is the correct button
int button = (int)AH64.EKeyCode.MFD_R1 - 1 + UHFCNV.Value.Value;
commands.Add(new DCSCommand(mfd, button));
}
// TODO: HQ
}
}

Expand All @@ -198,13 +206,29 @@ public List<DCSCommand> GenerateCommands(AH64DTCData.EPreset preset, bool IsPilo
{
commands.Add(new DCSCommand(mfd, (int)AH64.EKeyCode.MFD_L4));
commands.AddRange(AH64.GetCommandsForKUText(FM1Frequency.ToString() + '\n', true, IsPilot));
// TODO: CNV, HOPSET
// CNV
if (FM1CNV.Value != null)
{
commands.Add(new DCSCommand(mfd, (int)AH64.EKeyCode.MFD_L2));
// CNV is menu L1 - L6, unfortunately the button order is reversed.
int button = (int)AH64.EKeyCode.MFD_L1 - FM1CNV.Value.Value + 1;
commands.Add(new DCSCommand(mfd, button));
}
// TODO: HOPSET
}
if (ContainsFM2Data)
{
commands.Add(new DCSCommand(mfd, (int)AH64.EKeyCode.MFD_R4));
commands.AddRange(AH64.GetCommandsForKUText(FM2Frequency.ToString() + '\n', true, IsPilot));
// TODO: CNV, HOPSET
// CNV
if (FM2CNV.Value != null)
{
commands.Add(new DCSCommand(mfd, (int)AH64.EKeyCode.MFD_R2));
// CNV is menu R1 - R6, luckily R1 - 1 + CNV is the correct button
int button = (int)AH64.EKeyCode.MFD_R1 - 1 + FM2CNV.Value.Value;
commands.Add(new DCSCommand(mfd, button));
}
// TODO: HOPSET
}
}

Expand Down Expand Up @@ -523,7 +547,7 @@ public bool VHFFrequencyIsReceiveOnly
/// <value>
/// The uhf cnv.
/// </value>
public AH64RadioCNVSetting UHFCNV { get; set; } = new AH64RadioCNVSetting(1);
public AH64RadioCNVSetting UHFCNV { get; set; } = new AH64RadioCNVSetting(null);

[JsonIgnore]
private RadioFrequency uhfHaveQuickNet = new RadioFrequency(0.0m, 0.0m, 99.975m, 0.005m);
Expand Down Expand Up @@ -626,7 +650,7 @@ public decimal UHFFrequency {
/// <value>
/// The FM1 CNV.
/// </value>
public AH64RadioCNVSetting FM1CNV { get; set; } = new AH64RadioCNVSetting(1);
public AH64RadioCNVSetting FM1CNV { get; set; } = new AH64RadioCNVSetting(null);

[JsonIgnore]
private int fm1Hopset = 1;
Expand Down Expand Up @@ -708,7 +732,7 @@ public decimal FM1Frequency
/// <value>
/// The FM2 CNV.
/// </value>
public AH64RadioCNVSetting FM2CNV { get; set; } = new AH64RadioCNVSetting(1);
public AH64RadioCNVSetting FM2CNV { get; set; } = new AH64RadioCNVSetting(null);

[JsonIgnore]
private int fm2Hopset = 1;
Expand Down Expand Up @@ -790,7 +814,7 @@ public decimal FM2Frequency
/// <value>
/// The HF CNV.
/// </value>
public AH64RadioCNVSetting HFCNV { get; set; } = new AH64RadioCNVSetting(1);
public AH64RadioCNVSetting HFCNV { get; set; } = new AH64RadioCNVSetting(null);

[JsonIgnore]
private int hfPresetChannel = 1;
Expand Down
23 changes: 8 additions & 15 deletions CoordinateConverter/DCS/Tools/FormAH64DTC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,15 @@ public FormAH64DTC(bool isPilot)
ddlFM2CNV.DisplayMember = "Text";
ddlHFCNV.ValueMember = "Value";
ddlHFCNV.DisplayMember = "Text";
for (int cnvValue = 1; cnvValue <= 6; cnvValue++)
for (int cnvValue = 0; cnvValue <= 6; cnvValue++)
{
AH64RadioCNVSetting cnv = new AH64RadioCNVSetting(cnvValue);
ddlUHFCNV.Items.Add(new ComboItem<AH64RadioCNVSetting>("CNV " + cnvValue.ToString(), cnv));
ddlFM1CNV.Items.Add(new ComboItem<AH64RadioCNVSetting>("CNV " + cnvValue.ToString(), cnv));
ddlFM2CNV.Items.Add(new ComboItem<AH64RadioCNVSetting>("CNV " + cnvValue.ToString(), cnv));
ddlHFCNV.Items.Add(new ComboItem<AH64RadioCNVSetting>("CNV " + cnvValue.ToString(), cnv));
AH64RadioCNVSetting cnv = (cnvValue != 0) ? new AH64RadioCNVSetting(cnvValue) : new AH64RadioCNVSetting(null);
string name = (cnvValue != 0) ? "CNV " + cnvValue.ToString() : "No Change";

ddlUHFCNV.Items.Add(new ComboItem<AH64RadioCNVSetting>(name, cnv));
ddlFM1CNV.Items.Add(new ComboItem<AH64RadioCNVSetting>(name, cnv));
ddlFM2CNV.Items.Add(new ComboItem<AH64RadioCNVSetting>(name, cnv));
ddlHFCNV.Items.Add(new ComboItem<AH64RadioCNVSetting>(name, cnv));
}

ddlRadioPresetModemProtocol.ValueMember = "Value";
Expand Down Expand Up @@ -626,9 +628,6 @@ private void cbPresetUHF_Enable_CheckedChanged(object sender, EventArgs e)
ddlUHFCNV.Enabled = status;
nudUHFFreq.Enabled = status;
nudUHFHQ.Enabled = status;
// Disable N/I controls
ddlUHFCNV.Enabled = false;
nudUHFHQ.Enabled = false;

UpdateTuneDDLText(GetSelectedPresetIdent());
}
Expand Down Expand Up @@ -680,9 +679,6 @@ private void cbPresetFM1_Enable_CheckedChanged(object sender, EventArgs e)
nudFM1Freq.Enabled = status;
ddlFM1CNV.Enabled = status;
nudFM1Hopset.Enabled = status;
// Disable N/I fields
ddlFM1CNV.Enabled = false;
nudFM1Hopset.Enabled = false;

UpdateTuneDDLText(GetSelectedPresetIdent());
}
Expand Down Expand Up @@ -735,9 +731,6 @@ private void cbPresetFM2_Enable_CheckedChanged(object sender, EventArgs e)
nudFM2Freq.Enabled = status;
ddlFM2CNV.Enabled = status;
nudFM2Hopset.Enabled = status;
// Disable N/I fields
ddlFM2CNV.Enabled = false;
nudFM2Hopset.Enabled = false;

UpdateTuneDDLText(GetSelectedPresetIdent());
}
Expand Down
2 changes: 1 addition & 1 deletion CoordinateConverter/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace CoordinateConverter
/// <seealso cref="Form" />
public partial class MainForm : Form
{
private readonly GitHub.Version VERSION = new GitHub.Version(0, 6, 12);
private readonly GitHub.Version VERSION = new GitHub.Version(0, 6, 13);

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public static readonly Color ERROR_COLOR = Color.Pink;
Expand Down
2 changes: 1 addition & 1 deletion CoordinateConverter/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CoordinateSharp" version="2.19.1.1" targetFramework="net472" />
<package id="CoordinateSharp" version="2.22.1.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
</packages>
4 changes: 2 additions & 2 deletions CustomActions/CustomActions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="4.0.0" />
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.0" />
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="5.0.0" />
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="5.0.0" />
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions Installer/Installer.wixproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="WixToolset.Sdk/4.0.2">
<Project Sdk="WixToolset.Sdk/5.0.0">
<PropertyGroup>
<DefineConstants>Version=0.6.12</DefineConstants>
<DefineConstants>Version=0.6.13</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>Version=0.6.12</DefineConstants>
<DefineConstants>Version=0.6.13</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Netfx.wixext" Version="4.0.2" />
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.2" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.2" />
<PackageReference Include="WixToolset.Netfx.wixext" Version="5.0.0" />
<PackageReference Include="WixToolset.UI.wixext" Version="5.0.0" />
<PackageReference Include="WixToolset.Util.wixext" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CoordinateConverter\CoordinateConverter.csproj" />
Expand Down
5 changes: 1 addition & 4 deletions Installer/Package.wxs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="Coordinate Converter" Manufacturer="FalcoGer" Version="$(Version)" UpgradeCode="342894a7-1466-436c-a2ff-0ee29c3a13fd" Compressed="true" InstallerVersion="200" Scope="perMachine">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<ui:WixUI
Id="WixUI_FeatureTree"
InstallDirectory="DCSFOLDER"
/>
<ui:WixUI Id="WixUI_FeatureTree" InstallDirectory="DCSFOLDER" />
<WixVariable Id="WixUILicenseRtf" Value="eula.rtf" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" />

Expand Down

0 comments on commit 2a0f815

Please sign in to comment.