Skip to content

Commit

Permalink
Merge branch 'release/4.1.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
charliefoxtwo committed Oct 12, 2023
2 parents 7d4190a + cf5ec3e commit 1ae0126
Show file tree
Hide file tree
Showing 8 changed files with 459 additions and 370 deletions.
36 changes: 18 additions & 18 deletions DcsBiosCommunicator/Configuration/BiosInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
using DcsBios.Communicator.Configuration.JsonConverters;
using Newtonsoft.Json;

namespace DcsBios.Communicator.Configuration
namespace DcsBios.Communicator.Configuration;

[JsonConverter(typeof(InputConverter))]
public abstract record BiosInput
{
[JsonConverter(typeof(InputConverter))]
public abstract record BiosInput
{
// TODO: enumify
public string Interface { get; set; } = null!;
// TODO: enumify
public string Interface { get; set; } = null!;

private static readonly Dictionary<string, Type> Types = new()
{
[InputFixedStep.InterfaceType] = typeof(InputFixedStep),
[InputSetState.InterfaceType] = typeof(InputSetState),
[InputAction.InterfaceType] = typeof(InputAction),
[InputVariableStep.InterfaceType] = typeof(InputVariableStep),
};
private static readonly Dictionary<string, Type> Types = new()
{
[InputFixedStep.InterfaceType] = typeof(InputFixedStep),
[InputSetState.InterfaceType] = typeof(InputSetState),
[InputAction.InterfaceType] = typeof(InputAction),
[InputVariableStep.InterfaceType] = typeof(InputVariableStep),
[InputSetString.InterfaceType] = typeof(InputSetString),
};

public static Type GetTypeForType(in string type)
{
return Types[type];
}
public static Type GetTypeForType(in string type)
{
return Types.TryGetValue(type, out var result) ? result : typeof(InputUnknown);
}
}
}
34 changes: 16 additions & 18 deletions DcsBiosCommunicator/Configuration/BiosOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,25 @@

// ReSharper disable UnusedMember.Global

namespace DcsBios.Communicator.Configuration
namespace DcsBios.Communicator.Configuration;

[JsonConverter(typeof(OutputConverter))]
public abstract record BiosOutput
{
[JsonConverter(typeof(OutputConverter))]
public abstract record BiosOutput
{
public int Address { get; set; }
public int Address { get; set; }

// TODO: wtf is this?
public string Suffix { get; set; } = null!;
public string Suffix { get; set; } = null!;

public string Type { get; set; } = null!;
public string Type { get; set; } = null!;

private static readonly Dictionary<string, Type> Types = new()
{
[OutputInteger.OutputType] = typeof(OutputInteger),
[OutputString.OutputType] = typeof(OutputString),
};
private static readonly Dictionary<string, Type> Types = new()
{
[OutputInteger.OutputType] = typeof(OutputInteger),
[OutputString.OutputType] = typeof(OutputString),
};

public static Type GetTypeForType(in string type)
{
return Types[type];
}
public static Type GetTypeForType(in string type)
{
return Types.TryGetValue(type, out var result) ? result : typeof(OutputUnknown);
}
}
}
7 changes: 7 additions & 0 deletions DcsBiosCommunicator/Configuration/InputSetString.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ReSharper disable UnusedMember.Global
namespace DcsBios.Communicator.Configuration;

public record InputSetString : BiosInput
{
public const string InterfaceType = "set_string";
}
7 changes: 7 additions & 0 deletions DcsBiosCommunicator/Configuration/InputUnknown.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ReSharper disable UnusedMember.Global
namespace DcsBios.Communicator.Configuration;

public record InputUnknown : BiosInput
{
public const string InterfaceType = "unknown";
}
6 changes: 6 additions & 0 deletions DcsBiosCommunicator/Configuration/OutputUnknown.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace DcsBios.Communicator.Configuration;

public record OutputUnknown : BiosOutput
{
public static string OutputType => "unknown";
}
10 changes: 5 additions & 5 deletions DcsBiosCommunicator/DcsBiosCommunicator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
<Title>DCS-BIOS Communicator</Title>
<Authors>charliefoxtwo</Authors>
<Description>Provides methods and classes for subscribing to DCS-BIOS events.</Description>
<PackageVersion>4.0.0</PackageVersion>
<PackageVersion>4.1.0</PackageVersion>
<PackageProjectUrl>https://github.com/charliefoxtwo/DCS-BIOS-Communicator</PackageProjectUrl>
<PackageLicenseUrl>https://www.gnu.org/licenses/gpl-3.0.en.html</PackageLicenseUrl>
<RepositoryUrl>https://github.com/charliefoxtwo/DCS-BIOS-Communicator</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>dcs</PackageTags>
<PackageIcon>airplane.png</PackageIcon>
<PackageIconUrl>https://raw.githubusercontent.com/charliefoxtwo/DCS-BIOS-Communicator/main/DcsBiosCommunicator/resources/airplane.png</PackageIconUrl>
<PackageReleaseNotes> - fix exception thrown when module string addresses overlap
- update to .NET 6; .NET 5 EOL</PackageReleaseNotes>
<AssemblyVersion>4.0.0</AssemblyVersion>
<FileVersion>4.0.0</FileVersion>
<PackageReleaseNotes> - fix exception thrown on unrecognized input/output types
- add support for string inputs</PackageReleaseNotes>
<AssemblyVersion>4.1.0</AssemblyVersion>
<FileVersion>4.1.0</FileVersion>
<LangVersion>default</LangVersion>
</PropertyGroup>

Expand Down
Loading

0 comments on commit 1ae0126

Please sign in to comment.