From f729263ed15fbf6bbc86ce5847b942ce3a3950e1 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Sat, 12 Nov 2022 21:57:56 +0900 Subject: [PATCH 1/7] Fixed the test. --- src/vrcosclib.Test/TestUtility.cs | 49 +++++++++--------------- src/vrcosclib.Test/vrcosclib.Test.csproj | 11 ++---- 2 files changed, 23 insertions(+), 37 deletions(-) diff --git a/src/vrcosclib.Test/TestUtility.cs b/src/vrcosclib.Test/TestUtility.cs index 1386af6..7f2152a 100644 --- a/src/vrcosclib.Test/TestUtility.cs +++ b/src/vrcosclib.Test/TestUtility.cs @@ -95,50 +95,39 @@ public static void RestoreOscDirectory() } } -#if NETFRAMEWORK +#if !NET6_0_OR_GREATER public static async Task WaitAsync(this Task task, TimeSpan timeout) { - // if not running, start task - try - { - task.Start(); - } - catch (InvalidOperationException) - { - } + var source = CreateCancellationTokenSourceWithDelay(timeout); - bool isSuccessed = Task.Run(() => { while (task.Status == TaskStatus.Running || task.Status == TaskStatus.WaitingForActivation) ; }).Wait(timeout); - if (!isSuccessed) + await Task.Run(() => { - throw new TimeoutException(); - } + while (true) + { + if (source.IsCancellationRequested) { throw new TimeoutException(); } + if (task.IsCompleted) { break; } + } + }); if (task.IsFaulted) { - throw task.Exception.InnerException; + throw task.Exception!.InnerException!; } } public static async Task WaitAsync(this Task task, TimeSpan timeout) { - // if not running, start task - try - { - task.Start(); - } - catch (InvalidOperationException) - { - } + await WaitAsync((Task)task, timeout); + return task.Result; + } - bool isSuccessed = Task.Run(() => { while (task.Status == TaskStatus.Running || task.Status == TaskStatus.WaitingForActivation) ; }).Wait(timeout); - if (!isSuccessed) - { - throw new TimeoutException(); - } - if (task.IsFaulted) + private static CancellationTokenSource CreateCancellationTokenSourceWithDelay(TimeSpan delay) + { + CancellationTokenSource source = new(delay); + if (delay <= TimeSpan.Zero) { - throw task.Exception.InnerException; + source.Cancel(); } - return task.Result; + return source; } #endif } diff --git a/src/vrcosclib.Test/vrcosclib.Test.csproj b/src/vrcosclib.Test/vrcosclib.Test.csproj index 0e3a609..c62a209 100644 --- a/src/vrcosclib.Test/vrcosclib.Test.csproj +++ b/src/vrcosclib.Test/vrcosclib.Test.csproj @@ -7,17 +7,14 @@ BuildSoft.VRChat.Osc.Test 10.0 enable - false + false - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + From 891150e504a5e6f5d233f4ea0c00cdc0f2898a80 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Sun, 13 Nov 2022 02:16:28 +0900 Subject: [PATCH 2/7] Reference only required packages. --- src/vrcosclib/vrcosclib.csproj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vrcosclib/vrcosclib.csproj b/src/vrcosclib/vrcosclib.csproj index 57c3559..323c7ab 100644 --- a/src/vrcosclib/vrcosclib.csproj +++ b/src/vrcosclib/vrcosclib.csproj @@ -3,7 +3,7 @@ netstandard2.0;netstandard2.1 enable - BuildSoft.VRChat.Osc + BuildSoft.VRChat.Osc 10.0 enable @@ -21,7 +21,14 @@ + + + + + + + From 401870e3d2cff816a04edb27bd0810ebbb39f276 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Sun, 13 Nov 2022 02:19:02 +0900 Subject: [PATCH 3/7] Match directory name to namespace. --- src/vrcosclib/{Inputs => Input}/OscAxisInput.cs | 0 src/vrcosclib/{Inputs => Input}/OscButtonInput.cs | 0 src/vrcosclib/{Inputs => Input}/OscInput.cs | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/vrcosclib/{Inputs => Input}/OscAxisInput.cs (100%) rename src/vrcosclib/{Inputs => Input}/OscButtonInput.cs (100%) rename src/vrcosclib/{Inputs => Input}/OscInput.cs (100%) diff --git a/src/vrcosclib/Inputs/OscAxisInput.cs b/src/vrcosclib/Input/OscAxisInput.cs similarity index 100% rename from src/vrcosclib/Inputs/OscAxisInput.cs rename to src/vrcosclib/Input/OscAxisInput.cs diff --git a/src/vrcosclib/Inputs/OscButtonInput.cs b/src/vrcosclib/Input/OscButtonInput.cs similarity index 100% rename from src/vrcosclib/Inputs/OscButtonInput.cs rename to src/vrcosclib/Input/OscButtonInput.cs diff --git a/src/vrcosclib/Inputs/OscInput.cs b/src/vrcosclib/Input/OscInput.cs similarity index 100% rename from src/vrcosclib/Inputs/OscInput.cs rename to src/vrcosclib/Input/OscInput.cs From 21e1dd72c7fa5dcb922a6d7fe1d4aca1c4368bc9 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Mon, 14 Nov 2022 20:39:55 +0900 Subject: [PATCH 4/7] Update README.md --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 2647998..7b21c89 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ I can also download from [NuGet Package Manager](https://docs.microsoft.com/nuge ## Usage in code +Please check the `Sample` for the combination with the actual application. ### About avatar parameters If you want to control avatar parameters, use classes in `BuildSoft.VRChat.Osc.Avatar`. @@ -104,6 +105,36 @@ await Task.Delay(1000); OscButtonInput.Jump.Release(); ``` +### About Chatbox +If you want to use button input with OSC, use classes in `BuildSoft.VRChat.Osc.Chatbox`. + +#### e.g.) Send a string to Chatbox +```cs +using BuildSoft.VRChat.Osc.Chatbox; + +OscChatbox.SendMessage("some message", direct: true); +``` + +#### e.g.) Send a string to Chatbox UI +```cs +using BuildSoft.VRChat.Osc.Chatbox; + +OscChatbox.SendMessage("some message", direct: false); +``` + +#### e.g.) Act like typing +```cs +using BuildSoft.VRChat.Osc.Chatbox; +using System.Threading.Tasks; + +// typing during 3 second. +OscChatbox.SetIsTyping(true); +await Task.Delay(3000); + +OscChatbox.SendMessage("some message", direct: true); +``` + + From d4f6250c0b2e0cc59e48a77bb736b6843446ab58 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Mon, 14 Nov 2022 21:09:43 +0900 Subject: [PATCH 5/7] Suppress warnings. --- src/vrcosclib.Test/vrcosclib.Test.csproj | 1 + src/vrcosclib/Avatar/OscAvatarParametorContainer.cs | 2 +- src/vrcosclib/vrcosclib.csproj | 4 ---- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vrcosclib.Test/vrcosclib.Test.csproj b/src/vrcosclib.Test/vrcosclib.Test.csproj index c62a209..217f59f 100644 --- a/src/vrcosclib.Test/vrcosclib.Test.csproj +++ b/src/vrcosclib.Test/vrcosclib.Test.csproj @@ -8,6 +8,7 @@ 10.0 enable false + true diff --git a/src/vrcosclib/Avatar/OscAvatarParametorContainer.cs b/src/vrcosclib/Avatar/OscAvatarParametorContainer.cs index 5062e57..9d33ebe 100644 --- a/src/vrcosclib/Avatar/OscAvatarParametorContainer.cs +++ b/src/vrcosclib/Avatar/OscAvatarParametorContainer.cs @@ -35,7 +35,7 @@ public OscAvatarParametorContainer(ImmutableArray parameters for (int i = 0; i < parameters.Length; i++) { var param = parameters[i]; - var outputInterface = param.Output; + var outputInterface = param.Output!; Debug.Assert(outputInterface != null); allParams.AddValueChangedEventByAddress(outputInterface.Address, GetValueCallback); } diff --git a/src/vrcosclib/vrcosclib.csproj b/src/vrcosclib/vrcosclib.csproj index 323c7ab..af6ec4c 100644 --- a/src/vrcosclib/vrcosclib.csproj +++ b/src/vrcosclib/vrcosclib.csproj @@ -21,14 +21,10 @@ - - - - From b83b6f59b7184bda2d801747c5d467715a56b4ad Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Mon, 14 Nov 2022 21:33:29 +0900 Subject: [PATCH 6/7] Release v1.3.2 --- src/vrcosclib/vrcosclib.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vrcosclib/vrcosclib.csproj b/src/vrcosclib/vrcosclib.csproj index af6ec4c..ec14c1f 100644 --- a/src/vrcosclib/vrcosclib.csproj +++ b/src/vrcosclib/vrcosclib.csproj @@ -10,7 +10,7 @@ ..\..\bin VRCOscLib - 1.3.1 + 1.3.2 ChanyaKushima MIT A OSC library for VRChat From c1cb0935e75a8ba2a803ef55bfbab88ca93feaa2 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Mon, 14 Nov 2022 21:44:03 +0900 Subject: [PATCH 7/7] Update test workflow. --- .github/workflows/dotnet.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 42ccf95..af0ebc9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -10,9 +10,9 @@ jobs: ubuntu-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x - name: Restore dependencies @@ -25,9 +25,9 @@ jobs: windows-build: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x - name: Restore dependencies