Skip to content

Commit

Permalink
Updated NuGet, manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Nov 16, 2024
1 parent d55abaa commit 78893f2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
4 changes: 2 additions & 2 deletions external/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "1.0.0.0",
"version": "1.0.0.1",
"display_name": "OSC",
"download": "plugin_OSC.zip",
"download_": "plugin_OSC.zip",
"changelog": "Partial code cleanup, implicit using-s, tweaked trimmer.",
"guid": "K2VRTEAM-AME2-APII-SNDP-SENDPTVRCOSC"
}
58 changes: 31 additions & 27 deletions plugin_OSC/OSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Net;
using System.Net.Sockets;
using System.Numerics;
using System.Text.RegularExpressions;
using Amethyst.Plugins.Contract;
using BuildSoft.OscCore;
using Microsoft.UI;
Expand All @@ -18,7 +17,6 @@
using Microsoft.UI.Xaml.Media.Animation;
using VRC.OSCQuery;
using static VRC.OSCQuery.Extensions;
using TextBoxExtensions = CommunityToolkit.WinUI.UI.TextBoxExtensions;

namespace plugin_OSC;

Expand Down Expand Up @@ -81,20 +79,28 @@ public class Osc : IServiceEndpoint

private OscLogger Logger => AmethystLogger ??= new OscLogger(Host);
private OscLogger AmethystLogger { get; set; }
private OscStatusEnum ServiceStatusInternal { get; set; } = OscStatusEnum.Unknown;

private bool PluginLoaded { get; set; }

public Task ProcessKeyInput(IKeyInputAction action, object data, TrackerType? receiver, CancellationToken? token = null)
{
return Task.CompletedTask;
}

public bool IsSettingsDaemonSupported => true;
public object SettingsInterfaceRoot => MInterfaceRoot;
public int ServiceStatus => Math.Clamp((int)ServiceStatusInternal, -2, 0);
private OscStatusEnum ServiceStatusInternal { get; set; } = OscStatusEnum.Unknown;

public string ServiceStatusString => Host
?.RequestLocalizedString($"/Statuses/{ServiceStatusInternal}")
.Replace("{0}", _lastInitException?.Message ?? "[Not available]") ?? "Status doko?";

public Uri ErrorDocsUri => new($"https://docs.k2vr.tech/{Host?.DocsLanguageCode ?? "en"}/osc/");
public Dictionary<TrackerType, SortedSet<IKeyInputAction>> SupportedInputActions => [];

public SortedSet<TrackerType> AdditionalSupportedTrackerTypes => new()
{
public SortedSet<TrackerType> AdditionalSupportedTrackerTypes =>
[
TrackerType.TrackerLeftFoot, // Already OK
TrackerType.TrackerRightFoot, // Already OK
TrackerType.TrackerLeftElbow,
Expand All @@ -103,7 +109,7 @@ public class Osc : IServiceEndpoint
TrackerType.TrackerRightKnee,
TrackerType.TrackerWaist, // Already OK
TrackerType.TrackerChest
};
];

public bool AutoStartAmethyst
{
Expand Down Expand Up @@ -132,8 +138,6 @@ public InputActions ControllerInputActions

public (Vector3 Position, Quaternion Orientation)? HeadsetPose => null;

private bool PluginLoaded { get; set; }

public void DisplayToast((string Title, string Text) message)
{
// Hope VRChat lets us do this someday...
Expand Down Expand Up @@ -749,6 +753,25 @@ private void SendTrackerDataToReceiver(string trackerName, OscPosition target, O
new BuildSoft.OscCore.UnityObjects.Vector3(eulerAngles.X, eulerAngles.Y, eulerAngles.Z));
}


public static IPAddress GetLocalIPAddress()
{
// Windows can only serve TCP on the loopback address, but can serve UDP on the non-loopback address
return IPAddress.Loopback;
}

public static IPAddress GetLocalIPAddressNonLoopback()
{
// Get the host name of the local machine
var hostName = Dns.GetHostName();

// Get the IP address of the first IPv4 network interface found on the local machine
foreach (var ip in Dns.GetHostEntry(hostName).AddressList)
if (ip.AddressFamily == AddressFamily.InterNetwork)
return ip;
return null;
}

private enum OscStatusEnum
{
Unknown = -2,
Expand All @@ -768,25 +791,6 @@ private enum OscStatusEnum
private TextBlock PortInvalidLabel { get; set; }

#endregion


public static IPAddress GetLocalIPAddress()
{
// Windows can only serve TCP on the loopback address, but can serve UDP on the non-loopback address
return IPAddress.Loopback;
}

public static IPAddress GetLocalIPAddressNonLoopback()
{
// Get the host name of the local machine
var hostName = Dns.GetHostName();

// Get the IP address of the first IPv4 network interface found on the local machine
foreach (var ip in Dns.GetHostEntry(hostName).AddressList)
if (ip.AddressFamily == AddressFamily.InterNetwork)
return ip;
return null;
}
}

internal class SetupData : ICoreSetupData
Expand Down
8 changes: 4 additions & 4 deletions plugin_OSC/plugin_OSC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amethyst.Plugins.Contract" Version="0.2.25" />
<PackageReference Include="Amethyst.Plugins.Contract" Version="0.3.33" />
<PackageReference Include="BuildSoft.OscCore" Version="1.2.1.1" />
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="MeaMod.DNS" Version="1.0.71" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Composition" Version="8.0.0" />
<PackageReference Include="System.ComponentModel.Composition.Registration" Version="8.0.0" />
<PackageReference Include="System.ComponentModel.Composition" Version="9.0.0" />
<PackageReference Include="System.ComponentModel.Composition.Registration" Version="9.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Expand Down

0 comments on commit 78893f2

Please # to comment.