Skip to content

Commit

Permalink
Refactor input/output classes to avoid naming conflicts in the genera…
Browse files Browse the repository at this point in the history
…ted types
  • Loading branch information
BOLL7708 committed May 25, 2024
1 parent 577f4de commit 38bcbcc
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 176 deletions.
2 changes: 1 addition & 1 deletion OpenVR2WS/Input/DataRemoteSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ internal class DataRemoteSetting
public string Section = "";
public string Setting = "";
public string Value = "";
public TypeEnum Type = TypeEnum.None;
public InputMessageTypeEnum Type = InputMessageTypeEnum.None;
}
2 changes: 1 addition & 1 deletion OpenVR2WS/Input/DataSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ internal class DataSetting
{
public string Section = "";
public string Setting = "";
public Output.TypeEnum Type = Output.TypeEnum.None;
public Output.OuputTypeEnum Type = Output.OuputTypeEnum.None;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
namespace OpenVR2WS.Input;

[ExportTsClass]
internal class Request
internal class InputMessage
{
public RequestKeyEnum Key = RequestKeyEnum.None;
public InputMessageKeyEnum Key = InputMessageKeyEnum.None;
public dynamic? Data;
public string? Password = null;
public string? Nonce = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace OpenVR2WS.Input;

internal enum RequestKeyEnum
internal enum InputMessageKeyEnum
{
None,
CumulativeStats,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace OpenVR2WS.Input;

internal enum TypeEnum
internal enum InputMessageTypeEnum
{
None,
String,
Expand Down
199 changes: 99 additions & 100 deletions OpenVR2WS/MainController.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace OpenVR2WS.Output;

internal enum TypeEnum
internal enum OuputTypeEnum
{
None,
String,
Expand Down
65 changes: 65 additions & 0 deletions OpenVR2WS/Output/OutputMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using OpenVR2WS.Input;
using TypeGen.Core.TypeAnnotations;

namespace OpenVR2WS.Output;

[ExportTsInterface]
internal class OutputMessage
{
public OutputMessageTypeEnum Type = OutputMessageTypeEnum.Undefined;
public InputMessageKeyEnum Key = InputMessageKeyEnum.None;
public string Message = "";
public dynamic? Data = null;
public string? Nonce = null;

public static OutputMessage CreateError(string message, dynamic? shape = null, string? nonce = null)
{
return new OutputMessage
{
Type = OutputMessageTypeEnum.Error,
Message = message,
Data = shape,
Nonce = nonce
};
}

public static OutputMessage CreateMessage(string message, string? nonce = null)
{
return new OutputMessage
{
Type = OutputMessageTypeEnum.Message,
Message = message,
Nonce = nonce
};
}

public static OutputMessage CreateCommand(InputMessageKeyEnum inputMessageKey, dynamic data, string? nonce = null)
{
return new OutputMessage
{
Type = OutputMessageTypeEnum.Result,
Key = inputMessageKey,
Data = data,
Nonce = nonce
};
}

public static OutputMessage CreateVREvent(dynamic data)
{
return new OutputMessage
{
Type = OutputMessageTypeEnum.VREvent,
Data = data
};
}

public static OutputMessage Create(OutputMessageTypeEnum type, dynamic data, string? nonce = null)
{
return new OutputMessage
{
Type = type,
Data = data,
Nonce = nonce
};
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace OpenVR2WS.Output;

public enum ResponseTypeEnum
public enum OutputMessageTypeEnum
{
Undefined,
Error,
Expand Down
File renamed without changes.
65 changes: 0 additions & 65 deletions OpenVR2WS/Output/Response.cs

This file was deleted.

2 changes: 1 addition & 1 deletion OpenVR2WS/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@
<value>..\resources\Logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Version" xml:space="preserve">
<value>v2.4.2</value>
<value>v2.4.3</value>
</data>
</root>
3 changes: 2 additions & 1 deletion OpenVR2WS/tgconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"generateFromAssemblies": true,
"clearOutputDirectory": true,
"csNullableTranslation": "null",
"singleQuotes": true
"singleQuotes": true,
"explicitPublicAccessor": true
}
2 changes: 1 addition & 1 deletion Types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openvr2ws-types",
"version": "2.4.2",
"version": "2.4.3",
"description": "TypeScript type definitions for the input and output of OpenVR2WS.",
"types": "types/index.d.ts",
"repository": {
Expand Down

0 comments on commit 38bcbcc

Please sign in to comment.