Renamed cs file, added ffmpeg binary in repo.

This commit is contained in:
Mercury 2024-09-05 18:34:49 +02:00
parent 604207c958
commit b313baa4c1
17 changed files with 115 additions and 46 deletions

Binary file not shown.

View file

@ -0,0 +1 @@
path: E:\autorecording

View file

@ -24,7 +24,7 @@ class Program
if (spiceProcesses.Length > 0) if (spiceProcesses.Length > 0)
{ {
Console.WriteLine("Found spice64, Attempting connection to TickerHookWS..."); Console.WriteLine("Found spice64, Attempting connection to TickerHookWS...");
await ConnectWebSocket(); await TryConnectWebSocket();
} }
else else
{ {
@ -32,6 +32,7 @@ class Program
} }
} }
private static string GetFolderPath() private static string GetFolderPath()
{ {
const string filePath = "prop.txt"; const string filePath = "prop.txt";
@ -67,7 +68,38 @@ class Program
return defaultPath; return defaultPath;
} }
private static async Task ConnectWebSocket() private static async Task TryConnectWebSocket()
{
const int maxRetries = 5;
int attempt = 0;
while (attempt < maxRetries)
{
Console.WriteLine($"Attempt {attempt + 1} of {maxRetries} to connect...");
bool success = await ConnectWebSocket();
if (success)
{
break; // Exit the loop if connection was successful
}
attempt++;
if (attempt < maxRetries)
{
Console.WriteLine($"Retrying in 10 seconds... {maxRetries - attempt} attempts remaining.");
await Task.Delay(10000); // Wait for 10 seconds before retrying
}
}
if (attempt == maxRetries)
{
Console.WriteLine("Failed to connect after 5 attempts.");
}
}
private static async Task<bool> ConnectWebSocket()
{ {
var tickerUri = new Uri($"ws://{WebsocketAddress}:{WebsocketPort}"); var tickerUri = new Uri($"ws://{WebsocketAddress}:{WebsocketPort}");
var reconnecting = false; var reconnecting = false;
@ -77,7 +109,6 @@ private static async Task ConnectWebSocket()
var isRecording = false; var isRecording = false;
var currentSongName = string.Empty; var currentSongName = string.Empty;
// Flag to track if we need to check for "MUSIC SELECT!!"
var shouldCheckForMusicSelect = false; var shouldCheckForMusicSelect = false;
using var clientWebSocket = new ClientWebSocket(); using var clientWebSocket = new ClientWebSocket();
@ -89,7 +120,7 @@ private static async Task ConnectWebSocket()
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"Error connecting to TickerHook WebSocket: {ex.Message}"); Console.WriteLine($"Error connecting to TickerHook WebSocket: {ex.Message}");
return; return false; // Indicate connection failure
} }
var buffer = new byte[1024]; var buffer = new byte[1024];
@ -145,13 +176,8 @@ private static async Task ConnectWebSocket()
} }
} }
if (reconnecting) return !reconnecting;
{
await Task.Delay(10000);
await ConnectWebSocket();
} }
}
private static void StartRecording(string songName) private static void StartRecording(string songName)
{ {

View file

@ -1,32 +1,25 @@
{ {
"format": 1, "format": 1,
"restore": { "restore": {
"E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj": {} "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj": {}
}, },
"projects": { "projects": {
"E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj": { "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj": {
"version": "1.0.0", "version": "1.0.0",
"restore": { "restore": {
"projectUniqueName": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj", "projectUniqueName": "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj",
"projectName": "2dxAutoClip", "projectName": "2dxAutoClip",
"projectPath": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj", "projectPath": "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj",
"packagesPath": "C:\\Users\\Mercury\\.nuget\\packages\\", "packagesPath": "C:\\Users\\Mercury\\.nuget\\packages\\",
"outputPath": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\obj\\", "outputPath": "D:\\2dxAutoClip\\2dxAutoClip\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Mercury\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Mercury\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@ -39,6 +32,11 @@
"warnAsError": [ "warnAsError": [
"NU1605" "NU1605"
] ]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
} }
}, },
"frameworks": { "frameworks": {
@ -78,7 +76,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.300/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Mercury\\.dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
} }
} }
} }

View file

@ -5,12 +5,11 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot> <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mercury\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders> <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mercury\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</NuGetToolVersion> <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.1</NuGetToolVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mercury\.nuget\packages\" /> <SourceRoot Include="C:\Users\Mercury\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View file

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("2dxAutoClip")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+604207c95826ef500eb0db475ad52a6eb1409e4e")]
[assembly: System.Reflection.AssemblyProductAttribute("2dxAutoClip")]
[assembly: System.Reflection.AssemblyTitleAttribute("2dxAutoClip")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View file

@ -0,0 +1 @@
f60dc6835ae387846e8c0d781c1dc6acd6ee09c156933e3c91a54f6d7a977f7a

View file

@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = _2dxAutoClip
build_property.ProjectDir = D:\2dxAutoClip\2dxAutoClip\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =

View file

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View file

@ -476,32 +476,24 @@
] ]
}, },
"packageFolders": { "packageFolders": {
"C:\\Users\\Mercury\\.nuget\\packages\\": {}, "C:\\Users\\Mercury\\.nuget\\packages\\": {}
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
}, },
"project": { "project": {
"version": "1.0.0", "version": "1.0.0",
"restore": { "restore": {
"projectUniqueName": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj", "projectUniqueName": "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj",
"projectName": "2dxAutoClip", "projectName": "2dxAutoClip",
"projectPath": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj", "projectPath": "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj",
"packagesPath": "C:\\Users\\Mercury\\.nuget\\packages\\", "packagesPath": "C:\\Users\\Mercury\\.nuget\\packages\\",
"outputPath": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\obj\\", "outputPath": "D:\\2dxAutoClip\\2dxAutoClip\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Mercury\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Mercury\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@ -514,6 +506,11 @@
"warnAsError": [ "warnAsError": [
"NU1605" "NU1605"
] ]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
} }
}, },
"frameworks": { "frameworks": {
@ -553,7 +550,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.300/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Mercury\\.dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
} }
} }
}, },

View file

@ -1,8 +1,8 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "UadaV9K6lUXiqIl2z8bjhbAR5j54RKlO6cUS03Ve0bAmjWv2eBUy7+V9Ozrfloe+w1UWeZZZwMHRYEfHq2vunA==", "dgSpecHash": "6Qjxx2HkXOE=",
"success": true, "success": true,
"projectFilePath": "E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj", "projectFilePath": "D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
"C:\\Users\\Mercury\\.nuget\\packages\\microsoft.netcore.platforms\\3.1.0\\microsoft.netcore.platforms.3.1.0.nupkg.sha512", "C:\\Users\\Mercury\\.nuget\\packages\\microsoft.netcore.platforms\\3.1.0\\microsoft.netcore.platforms.3.1.0.nupkg.sha512",
"C:\\Users\\Mercury\\.nuget\\packages\\microsoft.win32.registry\\4.7.0\\microsoft.win32.registry.4.7.0.nupkg.sha512", "C:\\Users\\Mercury\\.nuget\\packages\\microsoft.win32.registry\\4.7.0\\microsoft.win32.registry.4.7.0.nupkg.sha512",

View file

@ -1 +1 @@
"restore":{"projectUniqueName":"E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj","projectName":"2dxAutoClip","projectPath":"E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj","outputPath":"E:\\csharpcazzo\\2dxAutoClip\\2dxAutoClip\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"NAudio":{"target":"Package","version":"[2.2.1, )"},"NAudio.Wasapi":{"target":"Package","version":"[2.2.1, )"},"NAudio.WinMM":{"target":"Package","version":"[2.2.1, )"},"WebSocketSharp":{"target":"Package","version":"[1.0.3-rc11, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.300/PortableRuntimeIdentifierGraph.json"}} "restore":{"projectUniqueName":"D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj","projectName":"2dxAutoClip","projectPath":"D:\\2dxAutoClip\\2dxAutoClip\\2dxAutoClip.csproj","outputPath":"D:\\2dxAutoClip\\2dxAutoClip\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"NAudio":{"target":"Package","version":"[2.2.1, )"},"NAudio.Wasapi":{"target":"Package","version":"[2.2.1, )"},"NAudio.WinMM":{"target":"Package","version":"[2.2.1, )"},"WebSocketSharp":{"target":"Package","version":"[1.0.3-rc11, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Users\\Mercury\\.dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"}}

View file

@ -1 +1 @@
17255280968129270 17255540687156279

View file

@ -1 +1 @@
17255280968129270 17255540734858045