diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..dd2b550 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# Default severity for analyzer diagnostics with category 'Style' +dotnet_analyzer_diagnostic.category-Style.severity = none diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..255f632 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,62 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain +*.dll filter=lfs diff=lfs merge=lfs -text +*.exe filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20898f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,361 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- Backup*.rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +/Language/Assets/Client.json +/Test/qpdgo + +!/Qwilight/Assets/ARM64 +/Qwilight/Assets/ARM64/Flint.exe +/Qwilight/Assets/ARM64/NVIDIA.dll +/Qwilight/Assets/ARM64/Xwindow.exe + +!/Qwilight/Assets/x64 +/Qwilight/Assets/x64/Flint.exe +/Qwilight/Assets/x64/Igniter.exe +/Qwilight/Assets/x64/NVIDIA.dll +/Qwilight/Assets/x64/Xwindow.exe + +!/Qwilight/sdk/tools/ContentBuilder/builder/steamcmd +!/Qwilight/sdk/tools/ContentBuilder/scripts/simple_app_build.vdf +/Qwilight/sdk/tools/ContentBuilder/builder +/Qwilight/sdk/tools/ContentBuilder/output + +/Qwilight.zip \ No newline at end of file diff --git a/CI.cmd b/CI.cmd new file mode 100644 index 0000000..f115cbd --- /dev/null +++ b/CI.cmd @@ -0,0 +1,23 @@ +@ECHO OFF + +SET VS2022=%PROGRAMFILES%\Microsoft Visual Studio\2022\Community +SET MSBUILD=%VS2022%\Msbuild\Current\Bin\MSBuild.exe + +"%MSBUILD%" -t:Build -p:Configuration=Release,Platform=x64 Flint\Flint.vcxproj +Robocopy Flint\x64\Release Qwilight\Assets\x64 Flint.exe +"%MSBUILD%" -t:Build -p:Configuration=Release,Platform=ARM64 Flint\Flint.vcxproj +Robocopy Flint\ARM64\Release Qwilight\Assets\ARM64 Flint.exe + +"%MSBUILD%" -t:Build -p:Configuration=Release,Platform=x64 Igniter\Igniter.csproj +Robocopy Igniter\bin\x64\Release Qwilight\Assets\x64 Igniter.exe + +"%MSBUILD%" -t:Build -p:Configuration=Release,Platform=x64 NVIDIA\NVIDIA.vcxproj +Robocopy NVIDIA\x64\Release Qwilight\Assets\x64 NVIDIA.dll + +"%MSBUILD%" -t:Build -p:Configuration=Release,Platform=x64 Xwindow\Xwindow.vcxproj +Robocopy Xwindow\x64\Release Qwilight\Assets\x64 Xwindow.exe +"%MSBUILD%" -t:Build -p:Configuration=Release,Platform=ARM64 Xwindow\Xwindow.vcxproj +Robocopy Xwindow\ARM64\Release Qwilight\Assets\ARM64 Xwindow.exe + +dotnet build Language\Language.csproj -c Release -p:Platform=x64 +Language\bin\x64\Release\net7.0\Language.exe Qwilight\Assets\Language.json ..\..\..\IdeaProjects\Twilight\src\main\resources\Language.json ..\taehui\qwilight-fe\src\Language.json ..\taehui\taehui-fe\src\Language.json Qwilight\Qwilight\System\LanguageSystem\LanguageSystem.g.cs diff --git a/Compatible/Compatible.cs b/Compatible/Compatible.cs new file mode 100644 index 0000000..1da5393 --- /dev/null +++ b/Compatible/Compatible.cs @@ -0,0 +1,1089 @@ +/** 쓰레기 코드임 */ + +using Ionic.Zip; +using System.Data; +using System.Data.SQLite; +using System.Globalization; +using System.Text; +using System.Text.RegularExpressions; +using YamlDotNet.RepresentationModel; + +namespace Compatible +{ + public static partial class Compatible + { + [GeneratedRegex("(\\$[a-zA-Z\\d]+)( @*[\\d.+\\-]+)*")] + private static partial Regex GetFuncComputer(); + + [GeneratedRegex("Out\\(\\d+.*\\)")] + private static partial Regex GetWallFunc(); + + [GeneratedRegex("In\\(\\d+.*\\)")] + private static partial Regex GetContentsFunc(); + + static int HighestNoteID = 64; + static int Mode0 = 0; + static int Mode484 = 16; + + public static void Qwilight(string qwilightEntry) + { + MoveFile(Path.Combine(qwilightEntry, "Qwilight.json"), Path.Combine(qwilightEntry, "Configure.json")); + MoveFile(Path.Combine(qwilightEntry, "Qwilight.db"), Path.Combine(qwilightEntry, "DB.db")); + + var CommentEntry = Path.Combine(qwilightEntry, "Comment"); + + foreach (var commentFilePath in GetFiles(CommentEntry, "*.pb")) + { + MoveFile(commentFilePath, Path.ChangeExtension(commentFilePath, null)); + } + } + + public static void DB(SQLiteConnection fastDB) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"UPDATE comment + SET Comment = REPLACE(Comment, '.pb', '')", fastDB)) + { + dbStatement.ExecuteNonQuery(); + } + } + if (HasTable("component")) + { + try + { + var date = string.Empty; + using (var dbStatement = new SQLiteCommand(@"SELECT Date + FROM component", fastDB)) + { + using var rows = dbStatement.ExecuteReader(); + if (rows.Read()) + { + date = rows["Date"] as string; + } + } + using (var db = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS db_file ( + ID TEXT, + Value TEXT, + PRIMARY KEY (ID) + )", fastDB)) + { + db.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(""" + REPLACE INTO db_file + VALUES("date", @value) + """, fastDB)) + { + dbStatement.Parameters.AddWithValue("value", date); + dbStatement.ExecuteNonQuery(); + } + using (var db = new SQLiteCommand(@"DROP TABLE component", fastDB)) + { + db.ExecuteNonQuery(); + } + } + catch + { + } + } + + if (HasTable("composition")) + { + try + { + using (var db = new SQLiteCommand(@"DROP TABLE composition", fastDB)) + { + db.ExecuteNonQuery(); + } + } + catch + { + } + } + + if (HasTable("event_note_data")) + { + try + { + using var dbModifyCommand = new SQLiteCommand(@"ALTER TABLE event_note_data + RENAME COLUMN Composer TO Artist", fastDB); + dbModifyCommand.ExecuteNonQuery(); + } + catch + { + } + try + { + using var dbModifyCommand = new SQLiteCommand(@"ALTER TABLE event_note_data + RENAME COLUMN Level_Contents TO Level_Text", fastDB); + dbModifyCommand.ExecuteNonQuery(); + } + catch + { + } + } + + bool HasTable(string tableName) + { + using var db = new SQLiteCommand(@"SELECT name + FROM sqlite_master + WHERE type = 'table' AND name = @tableName", fastDB); + db.Parameters.AddWithValue("tableName", tableName); + using var dbr = db.ExecuteReader(); + return dbr.Read(); + } + } + + public static void UI(string UIEntry, string yamlFilePath, string yamlName, string uiEntry) + { + var ys = new YamlStream(); + try + { + var yamlContents0 = string.Empty; + var yamlContents1 = string.Empty; + using (var sr = File.OpenText(yamlFilePath)) + { + yamlContents0 = sr.ReadToEnd(); + yamlContents1 = yamlContents0 + .Replace("function:", "func:") + .Replace("default-length:", "defaultLength:") + .Replace("default-height:", "defaultHeight:") + .Replace("longNoteHigherEdgeHeight:", "longNoteTailEdgeHeight:") + .Replace("longNoteLowerEdgeHeight:", "longNoteFrontEdgeHeight:") + .Replace("longNoteHigherEdgePosition:", "longNoteTailEdgePosition:") + .Replace("longNoteLowerEdgePosition:", "longNoteFrontEdgePosition:") + .Replace("longNoteHigherContentsHeight:", "longNoteTailContentsHeight:") + .Replace("longNoteLowerContentsHeight:", "longNoteFrontContentsHeight:") + .Replace("maintain-long-note-lower-edge:", "maintainLongNoteFrontEdge:") + .Replace("maintainLongNoteLowerEdge:", "maintainLongNoteFrontEdge:") + .Replace("set-judgment-main-position:", "setJudgmentMainPosition:") + .Replace("set-main-position:", "setMainPosition:") + .Replace("set-note-length:", "setNoteLength:") + .Replace("set-band-position:", "setBandPosition:") + .Replace("long-note-hit-update-frame:", "long-note-hit-loop-frame:") + .Replace("compound-frame:", "band-frame:") + .Replace("compound-framerate:", "band-framerate:") + .Replace("dual-hit-points:", "alt-hit-points:") + .Replace("migrate-hit-points:", "alt-hit-points:") + .Replace("dual-status:", "alt-status:") + .Replace("migrate-status:", "alt-status:") + .Replace("dual-band:", "alt-band:") + .Replace("migrate-band:", "alt-band:") + .Replace("dual-bpm:", "alt-bpm:") + .Replace("migrate-bpm:", "alt-bpm:") + .Replace("dual-multiplier:", "alt-multiplier:") + .Replace("migrate-multiplier:", "alt-multiplier:") + .Replace("dual-stand:", "alt-stand:") + .Replace("migrate-stand:", "alt-stand:") + .Replace("dual-point:", "alt-point:") + .Replace("migrate-point:", "alt-point:") + .Replace("dual-enjoy:", "alt-net:") + .Replace("migrate-enjoy:", "alt-net:") + .Replace("dual-mmo:", "alt-net:") + .Replace("migrate-mmo:", "alt-net:") + .Replace("dual-net:", "alt-net:") + .Replace("migrate-net:", "alt-net:") + .Replace("dual-pause:", "alt-pause:") + .Replace("migrate-pause:", "alt-pause:") + .Replace("dual-sw:", "alt-hms:") + .Replace("migrate-sw:", "alt-hms:") + .Replace("dual-now:", "alt-hms:") + .Replace("migrate-now:", "alt-hms:") + .Replace("alt-sec:", "alt-hms:") + .Replace("dual-judgment-meter:", "alt-judgment-meter:") + .Replace("migrate-judgment-meter:", "alt-judgment-meter:") + .Replace("dual-judgment-points:", "alt-judgment-points:") + .Replace("migrate-judgment-points:", "alt-judgment-points:") + .Replace("dual-last:", "alt-last:") + .Replace("migrate-last:", "alt-last:") + .Replace("dual-band!:", "alt-band!:") + .Replace("migrate-band!:", "alt-band!:") + .Replace("dual-wall-0:", "alt-wall-0:") + .Replace("migrate-wall-0:", "alt-wall-0:") + .Replace("dual-wall-1:", "alt-wall-1:") + .Replace("migrate-wall-1:", "alt-wall-1:") + .Replace("dual-audio-multiplier:", "alt-audio-multiplier:") + .Replace("migrate-audio-multiplier:", "alt-audio-multiplier:") + .Replace("migrate-hit-points-sign:", "alt-hit-points-visualizer:") + .Replace("migrate-hit-points-sgmt:", "alt-hit-points-visualizer:") + .Replace("migrate-highest-judgment-value:", "alt-highest-judgment-value:") + .Replace("migrate-higher-judgment-value:", "alt-higher-judgment-value:") + .Replace("migrate-high-judgment-value:", "alt-high-judgment-value:") + .Replace("migrate-low-judgment-value:", "alt-low-judgment-value:") + .Replace("migrate-lower-judgment-value:", "alt-lower-judgment-value:") + .Replace("migrate-lowest-judgment-value:", "alt-lowest-judgment-value:") + .Replace("judgmentCount:", "judgmentMainPosition:") + .Replace("mainWall0:", "mainWall0Length:") + .Replace("mainWall1:", "mainWall1Length:") + .Replace("numLength:", "binLength:") + .Replace("numHeight:", "binHeight:") + .Replace("standAlignment:", "standSystem:") + .Replace("standWave:", "standSystem:") + .Replace("pointAlignment:", "pointSystem:") + .Replace("pointWave:", "pointSystem:") + .Replace("unionAlignment:", "bandSystem:") + .Replace("comboAlignment:", "bandSystem:") + .Replace("compoundAlignment:", "bandSystem:") + .Replace("bandAlignment:", "bandSystem:") + .Replace("bandWave:", "bandSystem:") + .Replace("comboPosition0:", "bandPosition0:") + .Replace("unionPosition0:", "bandPosition0:") + .Replace("compoundPosition0:", "bandPosition0:") + .Replace("comboPosition1:", "bandPosition1:") + .Replace("unionPosition1:", "bandPosition1:") + .Replace("compoundPosition1:", "bandPosition1:") + .Replace("judgmentAlignment:", "judgmentSystem:") + .Replace("judgmentWave:", "judgmentSystem:") + .Replace("bpmAlignment:", "bpmSystem:") + .Replace("bpmWave:", "bpmSystem:") + .Replace("judgmentMeterAlignment:", "judgmentMeterSystem:") + .Replace("judgmentMeterWave:", "judgmentMeterSystem:") + .Replace("hitPointsAlignment:", "hitPointsSystem:") + .Replace("hitPointsWave:", "hitPointsSystem:") + .Replace("multiplierAlignment:", "multiplierSystem:") + .Replace("multiplierWave:", "multiplierSystem:") + .Replace("enjoyPosition0:", "netPosition0:") + .Replace("enjoyPosition1:", "netPosition1:") + .Replace("enjoyLength:", "netLength:") + .Replace("enjoyHeight0:", "netHeight0:") + .Replace("enjoyHeight1:", "netHeight1:") + .Replace("mmoPosition0:", "netPosition0:") + .Replace("mmoPosition1:", "netPosition1:") + .Replace("mmoLength:", "netLength:") + .Replace("mmoHeight0:", "netHeight0:") + .Replace("mmoHeight1:", "netHeight1:") + .Replace("pauseAlignment:", "pauseSystem:") + .Replace("pauseWave:", "pauseSystem:") + .Replace("statusAlignment:", "statusSystem:") + .Replace("statusWave:", "statusSystem:") + .Replace("numComboLength:", "binBandLength:") + .Replace("binCompoundLength:", "binBandLength:") + .Replace("numComboHeight:", "binBandHeight:") + .Replace("binCompoundHeight:", "binBandHeight:") + .Replace("newCompound:", "enlargeBand:") + .Replace("enjoy-font", "net-font") + .Replace("mmo-font", "net-font") + .Replace("lastAlignment:", "lastSystem:") + .Replace("lastWave:", "lastSystem:") + .Replace("ac-frame:", "band!-frame:") + .Replace("ac-framerate:", "band!-framerate:") + .Replace("acAlignment:", "band!System:") + .Replace("band!Alignment:", "band!System:") + .Replace("band!Wave:", "band!System:") + .Replace("acPosition0:", "band!Position0:") + .Replace("acPosition1:", "band!Position1:") + .Replace("acLength:", "band!Length:") + .Replace("acHeight:", "band!Height:") + .Replace("swAlignment:", "hmsSystem:") + .Replace("swAlignment:", "hmsSystem:") + .Replace("nowAlignment:", "hmsSystem:") + .Replace("nowWave:", "hmsSystem:") + .Replace("nowSystem:", "hmsSystem:") + .Replace("secSystem:", "hmsSystem:") + .Replace("swPosition0:", "hmsPosition0:") + .Replace("nowPosition0:", "hmsPosition0:") + .Replace("secPosition0:", "hmsPosition0:") + .Replace("swPosition1:", "hmsPosition1:") + .Replace("nowPosition1:", "hmsPosition1:") + .Replace("secPosition1:", "hmsPosition1:") + .Replace("binNowLength:", "binHmsLength:") + .Replace("binSecLength:", "binHmsLength:") + .Replace("binNowHeight:", "binHmsHeight:") + .Replace("binSecHeight:", "binHmsHeight:") + .Replace("autoPosition1:", "autoInputPosition1:") + .Replace("autoHeight:", "autoInputHeight:") + .Replace("judgmentPointsAlignment:", "judgmentPointsSystem:") + .Replace("judgmentPointsWave:", "judgmentPointsSystem:") + .Replace("commaImageLength:", "standCommaDrawingLength:") + .Replace("commaDrawingLength:", "standCommaDrawingLength:") + .Replace("standDelimiterDrawingLength:", "standCommaDrawingLength:") + .Replace("standCommaDrawingLength:", "standCommaDrawingLength:") + .Replace("pointDotImageLength:", "pointStopPointDrawingLength:") + .Replace("pointDotDrawingLength:", "pointStopPointDrawingLength:") + .Replace("pointStDrawingLength:", "pointStopPointDrawingLength:") + .Replace("multiplierStDrawingLength:", "multiplierStopPointDrawingLength:") + .Replace("audioMultiplierStDrawingLength:", "audioMultiplierStopPointDrawingLength:") + .Replace("pointImageLength:", "pointUnitDrawingLength:") + .Replace("pointDrawingLength:", "pointUnitDrawingLength:") + .Replace("bpmImageLength:", "bpmUnitDrawingLength:") + .Replace("bpmDrawingLength:", "bpmUnitDrawingLength:") + .Replace("msImageLength:", "judgmentMeterUnitDrawingLength:") + .Replace("msDrawingLength:", "judgmentMeterUnitDrawingLength:") + .Replace("dotImageLength:", "stopPointDrawingLength:") + .Replace("dotDrawingLength:", "stopPointDrawingLength:") + .Replace("stDrawingLength:", "stopPointDrawingLength:") + .Replace("dotDotImageLength:", "hmsColonDrawingLength:") + .Replace("dotDotDrawingLength:", "hmsColonDrawingLength:") + .Replace("nowDelimiterDrawingLength:", "hmsColonDrawingLength:") + .Replace("secColonDrawingLength:", "hmsColonDrawingLength:") + .Replace("slashImageLength:", "hmsSlashDrawingLength:") + .Replace("slashDrawingLength:", "hmsSlashDrawingLength:") + .Replace("secSlashDrawingLength:", "hmsSlashDrawingLength:") + .Replace("drawing-pipeline:", "drawingPipeline:") + .Replace("ui-input-mode-system:", "drawingInputModeSystem:") + .Replace("hitPointsSignSystem:", "hitPointsVisualizerSystem:") + .Replace("hitPointsSignPosition0:", "hitPointsVisualizerPosition0:") + .Replace("hitPointsSignPosition1:", "hitPointsVisualizerPosition1:") + .Replace("binHitPointsSignLength:", "binHitPointsVisualizerLength:") + .Replace("binHitPointsSignHeight:", "binHitPointsVisualizerHeight:") + .Replace("hitPointsSignDrawingLength:", "hitPointsVisualizerUnitDrawingLength:") + .Replace("hitPointsSignUnitDrawingLength:", "hitPointsVisualizerUnitDrawingLength:") + .Replace("hitPointsSgmtSystem:", "hitPointsVisualizerSystem:") + .Replace("hitPointsSgmtPosition0:", "hitPointsVisualizerPosition0:") + .Replace("hitPointsSgmtPosition1:", "hitPointsVisualizerPosition1:") + .Replace("binHitPointsSgmtLength:", "binHitPointsVisualizerLength:") + .Replace("binHitPointsSgmtHeight:", "binHitPointsVisualizerHeight:") + .Replace("hitPointsSgmtDrawingLength:", "hitPointsVisualizerUnitDrawingLength:") + .Replace("hitPointsSgmtUnitDrawingLength:", "hitPointsVisualizerUnitDrawingLength:") + .Replace("highestJudgmentValueLength:", "binHighestJudgmentValueLength:") + .Replace("highestJudgmentValueHeight:", "binHighestJudgmentValueHeight:") + .Replace("higherJudgmentValueLength:", "binHigherJudgmentValueLength:") + .Replace("higherJudgmentValueHeight:", "binHigherJudgmentValueHeight:") + .Replace("highJudgmentValueLength:", "binHighJudgmentValueLength:") + .Replace("highJudgmentValueHeight:", "binHighJudgmentValueHeight:") + .Replace("lowJudgmentValueLength:", "binLowJudgmentValueLength:") + .Replace("lowJudgmentValueHeight:", "binLowJudgmentValueHeight:") + .Replace("lowerJudgmentValueLength:", "binLowerJudgmentValueLength:") + .Replace("lowerJudgmentValueHeight:", "binLowerJudgmentValueHeight:") + .Replace("lowestJudgmentValueLength:", "binLowestJudgmentValueLength:") + .Replace("lowestJudgmentValueHeight:", "binLowestJudgmentValueHeight:") + .Replace("inputSgmtSystem:", "inputVisualizerSystem:") + .Replace("inputSgmtPosition0:", "inputVisualizerPosition0:") + .Replace("inputSgmtPosition1:", "inputVisualizerPosition1:") + .Replace("binInputSgmtLength:", "binInputVisualizerLength:") + .Replace("binInputSgmtHeight:", "binInputVisualizerHeight:") + .Replace("alt-input-sgmt:", "alt-input-visualizer:") + .Replace("judgmentSgmtSystem:", "judgmentVisualizerSystem:") + .Replace("judgmentSgmtPosition0:", "judgmentVisualizerPosition0:") + .Replace("judgmentSgmtPosition1:", "judgmentVisualizerPosition1:") + .Replace("judgmentSgmtLength:", "judgmentVisualizerLength:") + .Replace("judgmentSgmtHeight:", "judgmentVisualizerHeight:") + .Replace("judgmentSgmtContentLength:", "judgmentVisualizerContentLength:") + .Replace("judgmentSgmtContentHeight:", "judgmentVisualizerContentHeight:") + .Replace("alt-judgment-sgmt:", "alt-judgment-visualizer:") + .Replace("audio-data:", "audio-visualizer:") + .Replace("audio-main-data:", "audio-main-visualizer:") + .Replace("audio-input-data:", "audio-input-visualizer:") + .Replace("alt-hunter:", "alt-hunter:") + .Replace("huntSystem:", "hunterSystem:") + .Replace("huntPosition0:", "hunterPosition0:") + .Replace("huntPosition1:", "hunterPosition1:") + .Replace("binHuntLength:", "binHunterLength:") + .Replace("binHuntHeight:", "binHunterHeight:") + .Replace("huntFrontDrawingLength:", "hunterFrontDrawingLength:") + .Replace("titleSystem:", "titleSystem0:") + .Replace("composerSystem:", "artistSystem0:") + .Replace("composerSystem0:", "artistSystem0:") + .Replace("composerPosition0:", "artistPosition0:") + .Replace("composerPosition1:", "artistPosition1:") + .Replace("composerLength:", "artistLength:") + .Replace("composerHeight:", "artistHeight:") + .Replace("slideNotePosition0:", "slashNotePosition0:") + .Replace("judgmentVisualizerContentLength:", "judgmentVisualizerContentsLength:") + .Replace("judgmentVisualizerContentHeight:", "judgmentVisualizerContentsHeight:") + .Replace("longNoteHigherContentHeight:", "longNoteHigherContentsHeight:") + .Replace("longNoteLowerContentHeight:", "longNoteLowerContentsHeight:") + .Replace("levelContentsPosition0:", "levelTextPosition0:") + .Replace("levelContentsPosition1:", "levelTextPosition1:") + .Replace("levelContentsLength:", "levelTextLength:") + .Replace("levelContenteHeight:", "levelTextHeight:") + .Replace("levelContentsSystem0:", "levelTextSystem0:") + .Replace("levelContentsSystem1:", "levelTextSystem1:") + .Replace("title-level:", "titleLevel:") + .Replace("composer-level:", "artistLevel:") + .Replace("composerLevel:", "artistLevel:") + .Replace("levelContentsLevel:", "levelTextLevel:") + .Replace("$In", "$Contents") + .Replace("$Out", "$Wall"); + for (var i = HighestNoteID; i > 0; --i) + { + yamlContents1 = yamlContents1 + .Replace($"ui-image-{i}", $"drawing{i}") + .Replace($"ui-drawing-{i}", $"drawing{i}"); + } + for (var i = Mode484; i > Mode0; --i) + { + yamlContents1 = yamlContents1 + .Replace($"ui-input-mode-{i}", $"drawingInputMode{i}"); + } + } + using (var sr = new StringReader(yamlContents1)) + { + var targetUIBuilder = new StringBuilder(); + string line; + while ((line = sr.ReadLine()) != null) + { + var delimitedCommaData = line.Split(","); + for (var i = delimitedCommaData.Length - 1; i >= 0; --i) + { + if (i > 0) + { + delimitedCommaData[i] = delimitedCommaData[i].Trim(); + } + foreach (Match m in GetFuncComputer().Matches(delimitedCommaData[i])) + { + var values = m.Value.Split(" "); + var length = values.Length; + var builder = new StringBuilder(values[0][1..]); + builder.Append('('); + builder.Append(string.Join(", ", values.Select(value => value[(value.IndexOf("@") + 1)..]).ToArray(), 1, length - 1)); + builder.Append(')'); + delimitedCommaData[i] = delimitedCommaData[i].Replace(m.Value, builder.ToString()); + } + line = string.Join(", ", delimitedCommaData); + } + targetUIBuilder.AppendLine(line); + } + yamlContents1 = targetUIBuilder.ToString(); + } + if (yamlContents0 != yamlContents1) + { + using var sw = new StreamWriter(yamlFilePath); + sw.Write(yamlContents1); + } + + string zipName; + string luaName; + using (var sr = File.OpenText(yamlFilePath)) + { + ys.Load(sr); + var mNode = ys.Documents[0].RootNode; + var formatNode = mNode[new YamlScalarNode("format")]; + zipName = GetText(formatNode, "zip", yamlName); + luaName = GetText(formatNode, "lua", yamlName); + } + var zipFilePath = Path.Combine(UIEntry, uiEntry, Path.ChangeExtension(zipName, "zip")); + if (File.Exists(zipFilePath)) + { + var wasModified = false; + using var zipFile = new ZipFile(zipFilePath); + foreach (var zipEntry in zipFile.ToArray()) + { + if (zipEntry.IsDirectory) + { + switch (zipEntry.FileName) + { + case "Num/": + zipEntry.FileName = "Bin/"; + wasModified = true; + break; + case "Image/": + zipEntry.FileName = "Drawing/"; + wasModified = true; + break; + } + } + else + { + for (var i = 9; i >= 0; --i) + { + if (zipEntry.FileName.StartsWith($"Bin/H {i}.")) + { + zipEntry.FileName = $"Bin/HP {i}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + for (var i = 1; i >= 0; --i) + { + if (zipEntry.FileName.StartsWith($"Main/S {i}.")) + { + zipEntry.FileName = $"Main/W {i}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + for (var i = 3; i > 0; --i) + { + if (zipEntry.FileName.StartsWith($"Pause/{i}.")) + { + zipEntry.FileName = $"Drawing/PS {i - 1} 0{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + switch (Path.GetDirectoryName(zipEntry.FileName)) + { + case "Num": + zipEntry.FileName = $"Bin/{Path.GetFileName(zipEntry.FileName)}"; + wasModified = true; + break; + case "Image": + zipEntry.FileName = $"Drawing/{Path.GetFileName(zipEntry.FileName)}"; + wasModified = true; + break; + } + if (zipEntry.FileName.StartsWith("_Default.")) + { + zipEntry.FileName = $"_{yamlName}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + if (zipEntry.FileName.StartsWith("Drawing/Hit Points.")) + { + zipEntry.FileName = $"Drawing/HP 1{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + } + if (wasModified) + { + zipFile.Save(); + } + } + + var luaFilePath = luaName == "Default" ? Path.Combine(UIEntry, "Default.lua") : Path.Combine(UIEntry, uiEntry, Path.ChangeExtension(luaName, "lua")); + if (File.Exists(luaFilePath)) + { + var luaContents0 = string.Empty; + var luaContents1 = string.Empty; + using (var sr = File.OpenText(luaFilePath)) + { + luaContents0 = sr.ReadToEnd(); + luaContents1 = luaContents0 + .Replace("inputSemiCount", "autoableInputCount") + .Replace("etudeInputCount", "autoableInputCount") + .Replace("inputDefaultCount", "defaultInputCount") + .Replace("_GetAuto(", "_GetAutoInput("); + foreach (Match m in GetWallFunc().Matches(luaContents1)) + { + luaContents1 = luaContents1.Replace(m.Value, "Wall(" + m.Value[4..]); + } + foreach (Match m in GetContentsFunc().Matches(luaContents1)) + { + luaContents1 = luaContents1.Replace(m.Value, "Contents(" + m.Value[3..]); + } + } + if (luaContents0 != luaContents1) + { + using var sw = new StreamWriter(luaFilePath); + sw.Write(luaContents1); + } + } + } + catch + { + } + } + + public static void BaseUI(string UIEntry, string yamlFilePath, string yamlName, string uiEntry) + { + var ys = new YamlStream(); + try + { + var yamlContents0 = string.Empty; + var yamlContents1 = string.Empty; + using (var sr = File.OpenText(yamlFilePath)) + { + yamlContents0 = sr.ReadToEnd(); + yamlContents1 = yamlContents0 + .Replace("uniteModeContents:", "fittedContents:") + .Replace("uniteModeContentsLevel:", "fittedContentsLevel:") + .Replace("siteViewer:", "siteHref:") + .Replace("entryViewerTitleMargin:", "entryViewTitleMargin:") + .Replace("commentViewer:", "commentView:") + .Replace("entryViewer:", "entryView:") + .Replace("inputCountViewer:", "inputNoteCountView:") + .Replace("inputCountView:", "inputNoteCountView:") + .Replace("assistViewer:", "assistView:") + .Replace("composer:", "artist:") + .Replace("composerQuit:", "artistQuit:") + .Replace("composerLevel:", "artistLevel:") + .Replace("entireNotes:", "totalNotes:") + .Replace("entireNotesContents:", "totalNotesContents:") + .Replace("entireNotesQuit:", "totalNotesJudgmentQuit:") + .Replace("entireNotesContentsQuit:", "totalNotesJudgmentContentsQuit:") + .Replace("totalNotesQuit:", "totalNotesJudgmentQuit:") + .Replace("totalNotesContentsQuit:", "totalNotesJudgmentContentsQuit:") + .Replace("statusEntryOpening:", "statusDefaultEntry:") + .Replace("statusDefaultEntryOpening:", "statusDefaultEntry:") + .Replace("eventerDrawing:", "avatarDrawing:") + .Replace("showCommentInput:", "viewComment:") + .Replace("commentInput:", "viewComment:") + .Replace("undoInput:", "handleUndo:") + .Replace("quitView:", "statusView:") + .Replace("commentNameLevel:", "commentAvatarNameLevel:") + .Replace("quitDrawingQuit:", "quitDrawingV2:") + .Replace("highestJudgment:", "highestJudgmentQuit:") + .Replace("higherJudgment:", "higherJudgmentQuit:") + .Replace("highJudgment:", "highJudgmentQuit:") + .Replace("lowJudgment:", "lowJudgmentQuit:") + .Replace("lowerJudgment:", "lowerJudgmentQuit:") + .Replace("lowestJudgment:", "lowestJudgmentQuit:") + .Replace("highestJudgmentView:", "highestJudgmentV2:") + .Replace("higherJudgmentView:", "higherJudgmentV2:") + .Replace("highJudgmentView:", "highJudgmentV2:") + .Replace("lowJudgmentView:", "lowJudgmentV2:") + .Replace("lowerJudgmentView:", "lowerJudgmentV2:") + .Replace("lowestJudgmentView:", "lowestJudgmentV2:") + .Replace("entryPositionLevel:", "entryItemPositionLevel:"); + } + if (yamlContents0 != yamlContents1) + { + using var sw = new StreamWriter(yamlFilePath); + sw.Write(yamlContents1); + } + + string zipName; + using (var sr = File.OpenText(yamlFilePath)) + { + ys.Load(sr); + var mNode = ys.Documents[0].RootNode; + var formatNode = mNode[new YamlScalarNode("format")]; + zipName = $"@{GetText(formatNode, "zip")}"; + } + var zipFilePath = Path.Combine(UIEntry, uiEntry, Path.ChangeExtension(zipName, "zip")); + if (File.Exists(zipFilePath)) + { + var wasModified = false; + var tmpEntryPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); + using var zipFile = new ZipFile(zipFilePath); + foreach (var zipEntry in zipFile.ToArray()) + { + if (!zipEntry.IsDirectory) + { + foreach (var fileName in new[] { "Stand", "Highest Band", "Point", "New Stand", "View Comment" }) + { + if (zipEntry.FileName.StartsWith(fileName)) + { + try + { + zipEntry.FileName = $"Quit Mode/{fileName}{Path.GetExtension(zipEntry.FileName)}"; + } + catch + { + } + wasModified = true; + } + } + if (zipEntry.FileName.StartsWith("Undo")) + { + try + { + zipEntry.FileName = $"Quit Mode/Handle Undo{Path.GetExtension(zipEntry.FileName)}"; + } + catch + { + } + wasModified = true; + } + foreach (var fileName in new[] { "Title", "Artist", "Modified Date", "Level Contents", "Entry", "Latest Date", "Handled Count", "Twilight Comment Count" }) + { + if (zipEntry.FileName.StartsWith(fileName)) + { + try + { + zipEntry.FileName = $"FallIn/{fileName}{Path.GetExtension(zipEntry.FileName)}"; + } + catch + { + } + wasModified = true; + } + } + foreach (var fileName in new[] { "Highest Input Count", "Length", "BPM" }) + { + var target = $"{fileName}{Path.GetExtension(zipEntry.FileName)}"; + if (zipEntry.FileName.StartsWith(fileName) && !zipEntry.FileName.StartsWith("BPM!") && (!zipFile.Any(zipEntry => zipEntry.FileName == $"Quit Mode/{target}") || !zipFile.Any(zipEntry => zipEntry.FileName == $"Net Site/{target}") || !zipFile.Any(zipEntry => zipEntry.FileName == $"FallIn/{target}"))) + { + Directory.CreateDirectory(tmpEntryPath); + var tmpFileName = Path.GetTempFileName(); + File.Move(tmpFileName, tmpFileName = Path.Combine(tmpEntryPath, Path.GetFileName(tmpFileName))); + using (var ms = File.OpenWrite(tmpFileName)) + { + zipEntry.Extract(ms); + } + try + { + var targetFileName = Path.Combine(Path.GetDirectoryName(tmpFileName), target); + File.Move(tmpFileName, targetFileName); + try + { + zipFile.AddFile(targetFileName, "Quit Mode"); + } + catch + { + } + try + { + zipFile.AddFile(targetFileName, "Net Site"); + } + catch + { + } + try + { + zipFile.AddFile(targetFileName, "FallIn"); + } + catch + { + } + wasModified = true; + } + catch + { + } + } + } + foreach (var fileName in new[] { "Judgment Stage" }) + { + var target = $"{fileName}{Path.GetExtension(zipEntry.FileName)}"; + if (zipEntry.FileName.StartsWith(fileName) && (!zipFile.Any(zipEntry => zipEntry.FileName == $"Quit Mode/{target}") || !zipFile.Any(zipEntry => zipEntry.FileName == $"Net Site/{target}"))) + { + Directory.CreateDirectory(tmpEntryPath); + var tmpFileName = Path.GetTempFileName(); + File.Move(tmpFileName, tmpFileName = Path.Combine(tmpEntryPath, Path.GetFileName(tmpFileName))); + using (var ms = File.OpenWrite(tmpFileName)) + { + zipEntry.Extract(ms); + } + try + { + var targetFileName = Path.Combine(Path.GetDirectoryName(tmpFileName), target); + File.Move(tmpFileName, targetFileName); + try + { + zipFile.AddFile(targetFileName, "Quit Mode"); + } + catch + { + } + try + { + zipFile.AddFile(targetFileName, "Net Site"); + } + catch + { + } + wasModified = true; + } + catch + { + } + } + } + foreach (var fileName in new[] { "Input Mode" }) + { + var target = $"{fileName}{Path.GetExtension(zipEntry.FileName)}"; + if (zipEntry.FileName.StartsWith(fileName) && !zipEntry.FileName.StartsWith("BPM!") && !zipFile.Any(zipEntry => zipEntry.FileName == $"Quit Mode/{target}")) + { + Directory.CreateDirectory(tmpEntryPath); + var tmpFileName = Path.GetTempFileName(); + File.Move(tmpFileName, tmpFileName = Path.Combine(tmpEntryPath, Path.GetFileName(tmpFileName))); + using (var ms = File.OpenWrite(tmpFileName)) + { + zipEntry.Extract(ms); + } + try + { + var targetFileName = Path.Combine(Path.GetDirectoryName(tmpFileName), target); + File.Move(tmpFileName, targetFileName); + zipFile.AddFile(targetFileName, "Quit Mode"); + } + catch + { + } + wasModified = true; + } + } + foreach (var fileName in new[] { "Total Notes" }) + { + var target = $"{fileName}{Path.GetExtension(zipEntry.FileName)}"; + if (zipEntry.FileName.StartsWith(fileName) && (!zipFile.Any(zipEntry => zipEntry.FileName == $"FallIn/{target}") || !zipFile.Any(zipEntry => zipEntry.FileName == $"Net Site/{target}"))) + { + Directory.CreateDirectory(tmpEntryPath); + var tmpFileName = Path.GetTempFileName(); + File.Move(tmpFileName, tmpFileName = Path.Combine(tmpEntryPath, Path.GetFileName(tmpFileName))); + using (var ms = File.OpenWrite(tmpFileName)) + { + zipEntry.Extract(ms); + } + try + { + var targetFileName = Path.Combine(Path.GetDirectoryName(tmpFileName), target); + File.Move(tmpFileName, targetFileName); + try + { + zipFile.AddFile(targetFileName, "FallIn"); + } + catch + { + } + try + { + zipFile.AddFile(targetFileName, "Net Site"); + } + catch + { + } + wasModified = true; + } + catch + { + } + } + } + if (zipEntry.FileName.StartsWith($"Audio/Begin Note File.")) + { + zipEntry.FileName = $"Audio/Levy Note File{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + if (zipEntry.FileName.StartsWith($"Audio/Lower Entry.")) + { + zipEntry.FileName = $"Audio/Lower Entry Item{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + if (zipEntry.FileName.StartsWith($"Audio/Higher Entry.")) + { + zipEntry.FileName = $"Audio/Higher Entry Item{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + for (var i = 1; i >= 0; --i) + { + if (zipEntry.FileName.StartsWith($"Audio/Controller {i}.")) + { + zipEntry.FileName = $"Audio/Window {i}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + for (var i = 2; i >= 0; --i) + { + if (zipEntry.FileName.StartsWith($"Net Site/NS {i}.")) + { + zipEntry.FileName = $"Site Situation/SS {i}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + for (var i = 2; i >= 0; --i) + { + if (zipEntry.FileName.StartsWith($"Saving Bundle/SB {i}.")) + { + zipEntry.FileName = $"Notify/N {i + 4}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + foreach (var fileName in new[] { "Artist", "BPM", "Entry", "Handled Count", "Highest Input Count", "Latest Date", "Length", "Level Contents", "Modified Date", "Title", "Total Notes", "Twilight Comment Count" }) + { + if (zipEntry.FileName.StartsWith($"Unite/{fileName}.")) + { + zipEntry.FileName = $"Fit/{fileName}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + if (zipEntry.FileName.StartsWith("Fit/Level Contents.")) + { + zipEntry.FileName = $"Fit/Level Text Value{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit Mode/Undo.")) + { + zipEntry.FileName = $"Quit Mode/Handle Undo{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Audio/Sign out.")) + { + zipEntry.FileName = $"Audio/Not Sign in{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Judgment/J 6.")) + { + zipEntry.FileName = $"Judgment/Total Notes{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Judgment/Entire Notes.")) + { + zipEntry.FileName = $"Judgment/Total Notes{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Eventer Configure/EC 0.")) + { + zipEntry.FileName = $"Avatar Configure/AC 0{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Eventer Configure/EC 1.")) + { + zipEntry.FileName = $"Avatar Configure/AC 1{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Eventer Configure/EC 2.")) + { + zipEntry.FileName = $"Avatar Configure/AC 2{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Eventer Configure/EC 3.")) + { + zipEntry.FileName = $"Avatar Configure/AC 3{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Eventer Configure/EC 4.")) + { + zipEntry.FileName = $"Avatar Configure/AC 4{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Eventer Configure/EC 5.")) + { + zipEntry.FileName = $"Avatar Configure/AC 5{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("_Default.")) + { + zipEntry.FileName = $"_{yamlName.Substring(1)}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith($"_{yamlName}.")) + { + zipEntry.FileName = $"_{yamlName.Substring(1)}{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/X.")) + { + zipEntry.FileName = $"Quit v2/S+{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/U.")) + { + zipEntry.FileName = $"Quit v2/S{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/S.")) + { + zipEntry.FileName = $"Quit v2/A+{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/A.")) + { + zipEntry.FileName = $"Quit v2/A{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/B.")) + { + zipEntry.FileName = $"Quit v2/B{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/C.")) + { + zipEntry.FileName = $"Quit v2/C{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/D.")) + { + zipEntry.FileName = $"Quit v2/D{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/F.")) + { + zipEntry.FileName = $"Quit v2/F{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/U+.")) + { + zipEntry.FileName = $"Quit v2/S FC{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/S+.")) + { + zipEntry.FileName = $"Quit v2/A+ FC{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/A+.")) + { + zipEntry.FileName = $"Quit v2/A FC{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/B+.")) + { + zipEntry.FileName = $"Quit v2/B FC{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/C+.")) + { + zipEntry.FileName = $"Quit v2/C FC{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + else if (zipEntry.FileName.StartsWith("Quit/D+.")) + { + zipEntry.FileName = $"Quit v2/D FC{Path.GetExtension(zipEntry.FileName)}"; + wasModified = true; + } + } + } + if (wasModified) + { + zipFile.Save(); + } + } + } + catch + { + } + } + static void EraseFile(string filePath) + { + try + { + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + } + catch + { + } + } + + static void EraseEntry(string entryPath) + { + try + { + if (Directory.Exists(entryPath)) + { + Directory.Delete(entryPath, true); + } + } + catch + { + } + } + + static string[] GetFiles(string entryPath, string o = "") + { + try + { + return Directory.Exists(entryPath) ? Directory.GetFiles(entryPath, o) : Array.Empty(); + } + catch + { + return Array.Empty(); + } + } + + static void MoveFile(string src, string target) + { + try + { + if (File.Exists(src)) + { + EraseFile(target); + EraseEntry(target); + Directory.CreateDirectory(Path.GetDirectoryName(target)); + File.Move(src, target); + } + } + catch + { + } + } + + static int ModifyInt(object o) => Convert.ToInt32(o, CultureInfo.InvariantCulture); + + static string GetText(YamlNode yamlNode, string target, string defaultValue = null) + { + if ((yamlNode as YamlMappingNode)?.Children?.TryGetValue(new YamlScalarNode(target), out var value) == true) + { + var text = value.ToString().Trim(); + return string.IsNullOrEmpty(text) ? defaultValue : text; + } + else + { + return defaultValue; + } + } + } +} \ No newline at end of file diff --git a/Compatible/Compatible.csproj b/Compatible/Compatible.csproj new file mode 100644 index 0000000..246ffe5 --- /dev/null +++ b/Compatible/Compatible.csproj @@ -0,0 +1,14 @@ + + + net7.0 + x64;ARM64 + enable + embedded + + + + + + + + diff --git a/Flint/Flint.cpp b/Flint/Flint.cpp new file mode 100644 index 0000000..ff5c523 --- /dev/null +++ b/Flint/Flint.cpp @@ -0,0 +1,23 @@ +#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING + +#include +#include +#include + +#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") + +using namespace std; + +int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) +{ + SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + const auto handle = CreateFileW(L"//./pipe/Qwilight", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) { + MessageBoxW(NULL, L"Cannot find Qwilight", L"Qwilight", MB_ICONWARNING); + } + else { + const auto lpBuffer = wstring_convert>().to_bytes(wstring(lpCmdLine).c_str()); + WriteFile(handle, lpBuffer.c_str(), (DWORD)lpBuffer.length(), NULL, NULL); + CloseHandle(handle); + } +} \ No newline at end of file diff --git a/Flint/Flint.ico b/Flint/Flint.ico new file mode 100644 index 0000000..6761de8 --- /dev/null +++ b/Flint/Flint.ico Binary files differ diff --git a/Flint/Flint.rc b/Flint/Flint.rc new file mode 100644 index 0000000..b384219 --- /dev/null +++ b/Flint/Flint.rc Binary files differ diff --git a/Flint/Flint.vcxproj b/Flint/Flint.vcxproj new file mode 100644 index 0000000..e004bc0 --- /dev/null +++ b/Flint/Flint.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + ARM64 + + + Debug + x64 + + + Release + ARM64 + + + Release + x64 + + + + 16.0 + Win32Proj + {b884fba6-70f9-49a1-9a87-1bc08a7b769c} + Flint + 10.0 + + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + false + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + + + true + $(Platform)\$(Configuration)\ + + + true + $(Platform)\$(Configuration)\ + + + false + $(Platform)\$(Configuration)\ + + + false + $(Platform)\$(Configuration)\ + + + + Level3 + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + + + + + Level3 + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + MachineARM64 + + + + + Level3 + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + true + true + + + + + Level3 + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + true + true + MachineARM64 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Flint/resource.h b/Flint/resource.h new file mode 100644 index 0000000..2bf4d0e --- /dev/null +++ b/Flint/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++���� ������ ���� �����Դϴ�. +// Flint.rc���� ���ǰ� �ֽ��ϴ�. +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Igniter/App.config b/Igniter/App.config new file mode 100644 index 0000000..34f296c --- /dev/null +++ b/Igniter/App.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Igniter/FodyWeavers.xml b/Igniter/FodyWeavers.xml new file mode 100644 index 0000000..5029e70 --- /dev/null +++ b/Igniter/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Igniter/FodyWeavers.xsd b/Igniter/FodyWeavers.xsd new file mode 100644 index 0000000..05e92c1 --- /dev/null +++ b/Igniter/FodyWeavers.xsd @@ -0,0 +1,141 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/Igniter/Igniter.csproj b/Igniter/Igniter.csproj new file mode 100644 index 0000000..afcf51b --- /dev/null +++ b/Igniter/Igniter.csproj @@ -0,0 +1,172 @@ + + + + + Debug + AnyCPU + {9E9B7E8A-2617-4CCE-8431-34B97550E75B} + WinExe + Igniter + Igniter + v4.8 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + 7.3 + prompt + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + 7.3 + prompt + true + + + true + bin\ARM64\Debug\ + DEBUG;TRACE + full + ARM64 + 7.3 + prompt + true + + + bin\ARM64\Release\ + TRACE + true + pdbonly + ARM64 + 7.3 + prompt + true + + + Igniter.ico + + + app.manifest + + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + + + + + + + + + + + IgniterClass.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + 8.2.2 + + + 5.7.0 + all + + + 1.16.0 + + + 7.0.3 + + + + + + + \ No newline at end of file diff --git a/Igniter/Igniter.ico b/Igniter/Igniter.ico new file mode 100644 index 0000000..6761de8 --- /dev/null +++ b/Igniter/Igniter.ico Binary files differ diff --git a/Igniter/Igniter/ICC.cs b/Igniter/Igniter/ICC.cs new file mode 100644 index 0000000..6138e6a --- /dev/null +++ b/Igniter/Igniter/ICC.cs @@ -0,0 +1,14 @@ +namespace Igniter +{ + public sealed class ICC + { + public enum ID + { + ViewAllowWindow + } + + public ID IDValue { get; set; } + + public object Contents { get; set; } + } +} \ No newline at end of file diff --git a/Igniter/Igniter/IgniterComponent.cs b/Igniter/Igniter/IgniterComponent.cs new file mode 100644 index 0000000..85ecb1e --- /dev/null +++ b/Igniter/Igniter/IgniterComponent.cs @@ -0,0 +1,23 @@ +using System; +using System.IO; + +namespace Igniter +{ + public static partial class IgniterComponent + { + public static readonly string QwilightFilePath; + + public static Func OnGetBuiltInData { get; set; } + + public static T GetBuiltInData(string data) + { + var value = OnGetBuiltInData(data); + return value != null ? (T)value : default; + } + + static IgniterComponent() + { + QwilightFilePath = Path.Combine(AppContext.BaseDirectory, "..", "..", "Qwilight.exe"); + } + } +} \ No newline at end of file diff --git a/Igniter/Igniter/Modifier/VisibilityModifier.cs b/Igniter/Igniter/Modifier/VisibilityModifier.cs new file mode 100644 index 0000000..416dedd --- /dev/null +++ b/Igniter/Igniter/Modifier/VisibilityModifier.cs @@ -0,0 +1,23 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Igniter.Modifier +{ + public sealed class VisibilityModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + switch (value) + { + case bool valueBool when valueBool: + case string text when !string.IsNullOrEmpty(text): + return Visibility.Visible; + } + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Igniter/Igniter/System/LanguageSystem/LanguageSystem.cs b/Igniter/Igniter/System/LanguageSystem/LanguageSystem.cs new file mode 100644 index 0000000..1263cd9 --- /dev/null +++ b/Igniter/Igniter/System/LanguageSystem/LanguageSystem.cs @@ -0,0 +1,78 @@ +using Igniter.Properties; +using Igniter.Utilities; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Text.Json; + +namespace Igniter +{ + public sealed partial class LanguageSystem + { + public static readonly LanguageSystem Instance = new LanguageSystem(); + + public LanguageSystem() + { + var language = Utility.GetLanguage(CultureInfo.CurrentUICulture.LCID); + var languageSystem = typeof(LanguageSystem); + foreach (var property in languageSystem.GetProperties().Where(property => property.PropertyType == typeof(string))) + { + property.SetValue(this, default); + } + var textHeight = 0; + var lastLanguage = string.Empty; + PropertyInfo lastPropertyInfo = null; + var defaultValue = string.Empty; + var r = new Utf8JsonReader(Resources.Language); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.StartObject) + { + if (++textHeight == 2) + { + defaultValue = string.Empty; + } + continue; + } + + if (r.TokenType == JsonTokenType.EndObject) + { + if (--textHeight == 1 && lastPropertyInfo != null && string.IsNullOrEmpty(lastPropertyInfo.GetValue(this) as string)) + { + lastPropertyInfo?.SetValue(this, defaultValue); + } + continue; + } + + if (textHeight == 1) + { + if (r.TokenType == JsonTokenType.PropertyName) + { + lastPropertyInfo = languageSystem.GetProperty(r.GetString()); + continue; + } + } + + if (textHeight == 2) + { + switch (r.TokenType) + { + case JsonTokenType.PropertyName: + lastLanguage = r.GetString(); + break; + case JsonTokenType.String: + if (lastLanguage == "en-US") + { + defaultValue = r.GetString(); + } + if (lastLanguage == language) + { + lastPropertyInfo?.SetValue(this, r.GetString()); + } + break; + } + } + } + } + } +} diff --git a/Igniter/Igniter/System/LanguageSystem/LanguageSystem.g.cs b/Igniter/Igniter/System/LanguageSystem/LanguageSystem.g.cs new file mode 100644 index 0000000..7edc7d6 --- /dev/null +++ b/Igniter/Igniter/System/LanguageSystem/LanguageSystem.g.cs @@ -0,0 +1,11 @@ +namespace Igniter +{ + public sealed partial class LanguageSystem + { + public string ExeQwilight { get; set; } + public string Ignited { get; set; } + public string IgnitingFault { get; set; } + public string Levy { get; set; } + public string LevyFault { get; set; } + } +} diff --git a/Igniter/Igniter/Utilities/IOUtility.cs b/Igniter/Igniter/Utilities/IOUtility.cs new file mode 100644 index 0000000..59a5bc8 --- /dev/null +++ b/Igniter/Igniter/Utilities/IOUtility.cs @@ -0,0 +1,23 @@ +using System.IO; + +namespace Igniter.Utilities +{ + public static partial class Utility + { + public static bool EraseFile(string filePath) + { + try + { + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + return true; + } + catch + { + return false; + } + } + } +} \ No newline at end of file diff --git a/Igniter/Igniter/Utilities/LanguageUtility.cs b/Igniter/Igniter/Utilities/LanguageUtility.cs new file mode 100644 index 0000000..f35d2d6 --- /dev/null +++ b/Igniter/Igniter/Utilities/LanguageUtility.cs @@ -0,0 +1,16 @@ +namespace Igniter.Utilities +{ + public static partial class Utility + { + public static string GetLanguage(int language) + { + switch (language) + { + case 1042: + return "ko-KR"; + default: + return "en-US"; + } + } + } +} diff --git a/Igniter/Igniter/Utilities/ToUtility.cs b/Igniter/Igniter/Utilities/ToUtility.cs new file mode 100644 index 0000000..2e81d73 --- /dev/null +++ b/Igniter/Igniter/Utilities/ToUtility.cs @@ -0,0 +1,10 @@ +using System; +using System.Globalization; + +namespace Igniter.Utilities +{ + public static partial class Utility + { + public static int ToInt32(object o) => Convert.ToInt32(o, CultureInfo.InvariantCulture); + } +} diff --git a/Igniter/Igniter/View/Assets/Assets.xaml b/Igniter/Igniter/View/Assets/Assets.xaml new file mode 100644 index 0000000..35bc879 --- /dev/null +++ b/Igniter/Igniter/View/Assets/Assets.xaml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/Igniter/Igniter/View/Assets/ModifierAssets.xaml b/Igniter/Igniter/View/Assets/ModifierAssets.xaml new file mode 100644 index 0000000..a1d7b3a --- /dev/null +++ b/Igniter/Igniter/View/Assets/ModifierAssets.xaml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Igniter/Igniter/View/Assets/UIAssets.xaml b/Igniter/Igniter/View/Assets/UIAssets.xaml new file mode 100644 index 0000000..5a49e02 --- /dev/null +++ b/Igniter/Igniter/View/Assets/UIAssets.xaml @@ -0,0 +1,28 @@ + + Century Gothic + + 5.0 + + 13.0 + + + + + + + \ No newline at end of file diff --git a/Igniter/Igniter/View/IgniterClass.xaml b/Igniter/Igniter/View/IgniterClass.xaml new file mode 100644 index 0000000..3775988 --- /dev/null +++ b/Igniter/Igniter/View/IgniterClass.xaml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/Igniter/Igniter/View/IgniterClass.xaml.cs b/Igniter/Igniter/View/IgniterClass.xaml.cs new file mode 100644 index 0000000..a2871d0 --- /dev/null +++ b/Igniter/Igniter/View/IgniterClass.xaml.cs @@ -0,0 +1,19 @@ +using System; +using System.Windows; + +namespace Igniter.View +{ + public partial class IgniterClass + { + protected override void OnStartup(StartupEventArgs e) + { + IgniterComponent.OnGetBuiltInData = data => TryFindResource(data); + + if (e.Args.Length == 0) + { + MessageBox.Show(LanguageSystem.Instance.LevyFault, "Qwilight", MessageBoxButton.OK, MessageBoxImage.Warning); + Environment.Exit(1); + } + } + } +} diff --git a/Igniter/Igniter/View/MainWindow.xaml b/Igniter/Igniter/View/MainWindow.xaml new file mode 100644 index 0000000..76a315b --- /dev/null +++ b/Igniter/Igniter/View/MainWindow.xaml @@ -0,0 +1,23 @@ + + + + + + diff --git a/Igniter/Igniter/View/MainWindow.xaml.cs b/Igniter/Igniter/View/MainWindow.xaml.cs new file mode 100644 index 0000000..2b5a84f --- /dev/null +++ b/Igniter/Igniter/View/MainWindow.xaml.cs @@ -0,0 +1,32 @@ +using CommunityToolkit.Mvvm.Messaging; +using Igniter.ViewModel; +using System; +using System.Linq; +using System.Windows; + +namespace Igniter.View +{ + public partial class MainWindow : IRecipient + { + public MainWindow() + { + InitializeComponent(); + + WeakReferenceMessenger.Default.Register(this); + } + + void OnLoaded(object sender, RoutedEventArgs e) => (DataContext as MainViewModel).OnLoaded(); + + public void Receive(ICC message) + { + switch (message.IDValue) + { + case ICC.ID.ViewAllowWindow: + var data = message.Contents as object[]; + var r = MessageBox.Show(this, data[0] as string, "Qwilight", (MessageBoxButton)data[1], (MessageBoxImage)data[2]); + (data.ElementAtOrDefault(3) as Action)?.Invoke(r); + break; + } + } + } +} diff --git a/Igniter/Igniter/ViewModels/MainViewModel.cs b/Igniter/Igniter/ViewModels/MainViewModel.cs new file mode 100644 index 0000000..60e512f --- /dev/null +++ b/Igniter/Igniter/ViewModels/MainViewModel.cs @@ -0,0 +1,168 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Messaging; +using Ionic.Zip; +using System; +using System.Diagnostics; +using System.IO; +using System.Threading.Tasks; +using System.Windows; + +namespace Igniter.ViewModel +{ + public sealed partial class MainViewModel : ObservableObject + { + double _value; + string _text; + bool _isVisible = true; + + public double Value + { + get => _value; + + set => SetProperty(ref _value, value, nameof(Value)); + } + + public string Text + { + get => _text; + + set => SetProperty(ref _text, value, nameof(Text)); + } + + public bool IsVisible + { + get => _isVisible; + + set => SetProperty(ref _isVisible, value, nameof(IsVisible)); + } + + public void OnLoaded() + { + WeakReferenceMessenger.Default.Send(new ICC + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.Levy, + MessageBoxButton.OKCancel, + MessageBoxImage.Information, + new Action(async r => + { + switch (r) + { + case MessageBoxResult.OK: + while (true) + { + try + { + using (var zipFile = ZipFile.Read(Environment.GetCommandLineArgs()[1])) + { + zipFile.ExtractProgress += (sender, e) => + { + if (e.EntriesTotal > 0) + { + Value = 100.0 * e.EntriesExtracted / e.EntriesTotal; + } + var fileName = e.CurrentEntry?.FileName; + if (!string.IsNullOrEmpty(fileName)) + { + Text = fileName; + } + }; + await Task.Run(() => zipFile.ExtractAll(Path.GetDirectoryName(IgniterComponent.QwilightFilePath), ExtractExistingFileAction.OverwriteSilently)); + } + + OnIgnited(); + } + catch (Exception e) + { + OnIgnitingFault(e); + if (IsVisible) + { + continue; + } + } + } + case MessageBoxResult.Cancel: + Environment.Exit(1); + break; + } + }) + } + }); + + void OnIgnited() + { + IsVisible = false; + WeakReferenceMessenger.Default.Send(new ICC + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.Ignited, + MessageBoxButton.OK, + MessageBoxImage.Information + } + }); + WeakReferenceMessenger.Default.Send(new ICC + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.ExeQwilight, + MessageBoxButton.YesNo, + MessageBoxImage.Question, + new Action(r => + { + switch (r) + { + case MessageBoxResult.Yes: + Process.Start(IgniterComponent.QwilightFilePath); + break; + } + + Environment.Exit(0); + }) + } + }); + } + + void OnIgnitingFault(Exception e) + { + IsVisible = false; + WeakReferenceMessenger.Default.Send(new ICC + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + e.Message, + MessageBoxButton.OK, + MessageBoxImage.Error + } + }); + WeakReferenceMessenger.Default.Send(new ICC + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.IgnitingFault, + MessageBoxButton.YesNo, + MessageBoxImage.Warning, + new Action(r => + { + switch (r) + { + case MessageBoxResult.Yes: + IsVisible = true; + break; + case MessageBoxResult.No: + Environment.Exit(1); + break; + } + }) + } + }); + } + } + } +} \ No newline at end of file diff --git a/Igniter/Igniter/ViewModels/ViewModels.cs b/Igniter/Igniter/ViewModels/ViewModels.cs new file mode 100644 index 0000000..f3ddb20 --- /dev/null +++ b/Igniter/Igniter/ViewModels/ViewModels.cs @@ -0,0 +1,9 @@ +namespace Igniter.ViewModel +{ + public sealed class ViewModels + { + public static readonly ViewModels Instance = IgniterComponent.GetBuiltInData(nameof(ViewModels)); + + public MainViewModel MainValue { get; } = new MainViewModel(); + } +} \ No newline at end of file diff --git a/Igniter/Properties/AssemblyInfo.cs b/Igniter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e930068 --- /dev/null +++ b/Igniter/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("Igniter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("불로그")] +[assembly: AssemblyProduct("Igniter")] +[assembly: AssemblyCopyright("Copyright © 불로그 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +//지역화 가능 애플리케이션 빌드를 시작하려면 다음을 설정하세요. +//.csproj 파일의 CultureYouAreCodingWith +// 내부. 예를 들어 미국 영어를 사용하는 경우 +//사용하는 경우 를 en-US로 설정합니다. 그런 다음 아래 +//NeutralResourceLanguage 특성의 주석 처리를 제거합니다. 아래 줄의 "en-US"를 업데이트하여 +//프로젝트 파일의 UICulture 설정과 일치시킵니다. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //테마별 리소스 사전의 위치 + //(페이지 또는 응용 프로그램 리소스 사진에 + // 리소스가 없는 경우에 사용됨) + ResourceDictionaryLocation.SourceAssembly //제네릭 리소스 사전의 위치 + //(페이지 또는 응용 프로그램 리소스 사진에 + // 리소스가 없는 경우에 사용됨) +)] + + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 +// 기본값으로 할 수 있습니다. +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Igniter/Properties/Resources.Designer.cs b/Igniter/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3a206a4 --- /dev/null +++ b/Igniter/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace Igniter.Properties { + using System; + + + /// + /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. + /// + // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder + // 클래스에서 자동으로 생성되었습니다. + // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을 + // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Igniter.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을 + /// 재정의합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// System.Byte[] 형식의 지역화된 리소스를 찾습니다. + /// + internal static byte[] Language { + get { + object obj = ResourceManager.GetObject("Language", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/Igniter/Properties/Resources.resx b/Igniter/Properties/Resources.resx new file mode 100644 index 0000000..d294f57 --- /dev/null +++ b/Igniter/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\Language.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Igniter/Properties/Settings.Designer.cs b/Igniter/Properties/Settings.Designer.cs new file mode 100644 index 0000000..b674c6e --- /dev/null +++ b/Igniter/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace Igniter.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Igniter/Properties/Settings.settings b/Igniter/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Igniter/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Igniter/Resources/Language.json b/Igniter/Resources/Language.json new file mode 100644 index 0000000..4ab47d2 --- /dev/null +++ b/Igniter/Resources/Language.json @@ -0,0 +1,22 @@ +{ + "ExeQwilight": { + "ko-KR": "Qwilight를 실행할까요?", + "en-US": "Do you want to run Qwilight?" + }, + "Ignited": { + "ko-KR": "Qwilight 업데이트 성공", + "en-US": "Qwillight update successful" + }, + "IgnitingFault": { + "ko-KR": "Qwilight 업데이트 중 오류가 발생한 것 같습니다. 다시 시도할까요?", + "en-US": "There seems to be an error during Qwillight update. Shall we try again?" + }, + "Levy": { + "ko-KR": "Qwilight 업데이트를 시작합니다.", + "en-US": "Start the Qwillight update." + }, + "LevyFault": { + "ko-KR": "이건 Qwilight의 일부입니다.", + "en-US": "This is part of Qwilight." + } +} \ No newline at end of file diff --git a/Igniter/app.manifest b/Igniter/app.manifest new file mode 100644 index 0000000..13b30e7 --- /dev/null +++ b/Igniter/app.manifest @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + true + permonitorv2 + true + + + + + + + + diff --git a/Language/Language.csproj b/Language/Language.csproj new file mode 100644 index 0000000..8f319a8 --- /dev/null +++ b/Language/Language.csproj @@ -0,0 +1,15 @@ + + + Exe + net7.0 + x64;ARM64 + enable + enable + + + + + Always + + + diff --git a/Language/Language/JSON.cs b/Language/Language/JSON.cs new file mode 100644 index 0000000..a68a10e --- /dev/null +++ b/Language/Language/JSON.cs @@ -0,0 +1,42 @@ +namespace Language +{ + public static class JSON + { + public struct Client + { + public string nhnID = string.Empty; + public string nhnPw = string.Empty; + + public Client() + { + } + } + + public struct N2MT + { + public Message message = new Message(); + + public N2MT() + { + } + + public struct Message + { + public Result result = new Result(); + + public Message() + { + } + + public struct Result + { + public string translatedText = string.Empty; + + public Result() + { + } + } + } + } + } +} \ No newline at end of file diff --git a/Language/Language/Language.cs b/Language/Language/Language.cs new file mode 100644 index 0000000..df8bba8 --- /dev/null +++ b/Language/Language/Language.cs @@ -0,0 +1,293 @@ +using Language; +using System.Net; +using System.Text; +using System.Text.Encodings.Web; +using System.Text.Json; + +var wwwClient = new HttpClient(); + +var assetsClientJSON = JsonSerializer.Deserialize(File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Assets", "Client.json")), new JsonSerializerOptions +{ + IncludeFields = true +}); +wwwClient.DefaultRequestHeaders.Add("X-Naver-Client-Id", assetsClientJSON.nhnID); +wwwClient.DefaultRequestHeaders.Add("X-Naver-Client-Secret", assetsClientJSON.nhnPw); + +var qwilightEntryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "source", "repos", "Qwilight"); +var twilightEntryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "IdeaProjects", "Twilight"); +var taehuiEntryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "source", "repos", "taehui"); +SetCSJavaLanguage(Path.Combine(qwilightEntryPath, "Qwilight", "Assets", "Language.json")); +SetCSLanguageSystem(Path.Combine(qwilightEntryPath, "Qwilight", "Assets", "Language.json"), Path.Combine(qwilightEntryPath, "Qwilight", "Qwilight", "System", "LanguageSystem", "LanguageSystem.g.cs"), "Qwilight"); +SetCSJavaLanguage(Path.Combine(qwilightEntryPath, "Igniter", "Resources", "Language.json")); +SetCSLanguageSystem(Path.Combine(qwilightEntryPath, "Igniter", "Resources", "Language.json"), Path.Combine(qwilightEntryPath, "Igniter", "Igniter", "System", "LanguageSystem", "LanguageSystem.g.cs"), "Igniter"); +SetCSJavaLanguage(Path.Combine(twilightEntryPath, "src", "main", "resources", "Language.json")); +SetTSLanguage(Path.Combine(taehuiEntryPath, "qwilight-fe", "src", "Language.json")); +SetTSLanguage(Path.Combine(taehuiEntryPath, "taehui-fe", "src", "Language.json")); + +void SetCSJavaLanguage(string languageFilePath) +{ + var textHeight = 0; + var textStore = new SortedDictionary>(); + var lastLanguage = string.Empty; + var lastPropertyName = string.Empty; + var r = new Utf8JsonReader(File.ReadAllBytes(languageFilePath)); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.StartObject) + { + ++textHeight; + continue; + } + + if (r.TokenType == JsonTokenType.EndObject) + { + --textHeight; + continue; + } + + if (textHeight == 1) + { + if (r.TokenType == JsonTokenType.PropertyName) + { + lastPropertyName = r.GetString() ?? string.Empty; + textStore[lastPropertyName] = new SortedDictionary(); + continue; + } + } + + if (textHeight == 2) + { + switch (r.TokenType) + { + case JsonTokenType.PropertyName: + lastLanguage = r.GetString() ?? string.Empty; + break; + case JsonTokenType.String: + textStore[lastPropertyName][lastLanguage] = r.GetString() ?? string.Empty; + break; + } + } + } + + using (var fs = File.OpenWrite(languageFilePath)) + using (var w = new Utf8JsonWriter(fs, new JsonWriterOptions + { + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + Indented = true + })) + { + w.WriteStartObject(); + + foreach (var language in textStore) + { + w.WritePropertyName(language.Key); + w.WriteStartObject(); + foreach (var (targetLanguage, targetLanguageName) in new[] { ("ko", "ko-KR"), ("en", "en-US") }) + { + var t = GetLanguage(targetLanguage, targetLanguageName, language.Key); + t.Wait(); + if (!string.IsNullOrEmpty(t.Result)) + { + w.WritePropertyName(targetLanguageName); + w.WriteStringValue(t.Result); + } + } + w.WriteEndObject(); + } + + w.WriteEndObject(); + } + + async Task GetLanguage(string targetLanguage, string targetLanguageName, string targetPropertyName) + { + var defaultLanguageValue = textStore[targetPropertyName]["ko-KR"]; + if (targetLanguage == "ko") + { + return defaultLanguageValue; + } + + if (textStore[targetPropertyName].TryGetValue(targetLanguageName, out var targetLanguageValue)) + { + return targetLanguageValue; + } + else + { + Console.WriteLine($"+{targetPropertyName}"); + return await N2Mt(targetLanguage, defaultLanguageValue); + } + } +} + +void SetTSLanguage(string languageFilePath) +{ + var textHeight = 0; + var languageStore = new SortedDictionary>(); + var lastLanguage = string.Empty; + var lastPropertyName = string.Empty; + var r = new Utf8JsonReader(File.ReadAllBytes(languageFilePath)); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.StartObject) + { + ++textHeight; + continue; + } + + if (r.TokenType == JsonTokenType.EndObject) + { + --textHeight; + continue; + } + + if (textHeight == 1) + { + if (r.TokenType == JsonTokenType.PropertyName) + { + lastLanguage = r.GetString() ?? string.Empty; + languageStore[lastLanguage] = new SortedDictionary(); + continue; + } + } + + if (textHeight == 3) + { + switch (r.TokenType) + { + case JsonTokenType.PropertyName: + lastPropertyName = r.GetString() ?? string.Empty; + break; + case JsonTokenType.String: + languageStore[lastLanguage][lastPropertyName] = r.GetString() ?? string.Empty; + break; + } + } + } + + using (var fs = File.OpenWrite(languageFilePath)) + using (var w = new Utf8JsonWriter(fs, new JsonWriterOptions + { + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + Indented = true + })) + { + w.WriteStartObject(); + + foreach (var (targetLanguage, targetPropertyName) in new[] { ("ko", "ko-KR"), ("en", "en-US") }) + { + w.WritePropertyName(targetPropertyName); + w.WriteStartObject(); + w.WritePropertyName("translation"); + w.WriteStartObject(); + var t = GetLanguageStore(targetLanguage, targetPropertyName); + t.Wait(); + foreach (var defaultLanguage in t.Result) + { + if (!string.IsNullOrEmpty(defaultLanguage.Value)) + { + w.WritePropertyName(defaultLanguage.Key); + w.WriteStringValue(defaultLanguage.Value); + } + } + w.WriteEndObject(); + w.WriteEndObject(); + } + + w.WriteEndObject(); + } + + async Task> GetLanguageStore(string targetLanguage, string targetPropertyName) + { + if (targetLanguage == "ko") + { + return languageStore["ko-KR"]; + } + + var targetLanguageStore = new SortedDictionary(); + foreach (var defaultLanguage in languageStore["ko-KR"]) + { + if (languageStore[targetPropertyName].TryGetValue(defaultLanguage.Key, out var targetLanguageValue)) + { + targetLanguageStore[defaultLanguage.Key] = targetLanguageValue; + } + else + { + Console.WriteLine($"+{defaultLanguage.Key}"); + targetLanguageStore[defaultLanguage.Key] = await N2Mt(targetLanguage, defaultLanguage.Value); + } + } + + return targetLanguageStore; + } +} + +void SetCSLanguageSystem(string languageFilePath, string languageSystemFilePath, string languageSystemName) +{ + var textHeight = 0; + var textStore = new List(); + var r = new Utf8JsonReader(File.ReadAllBytes(languageFilePath)); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.StartObject) + { + ++textHeight; + continue; + } + + if (r.TokenType == JsonTokenType.EndObject) + { + --textHeight; + continue; + } + + if (textHeight == 1) + { + if (r.TokenType == JsonTokenType.PropertyName) + { + textStore.Add(r.GetString() ?? string.Empty); + continue; + } + } + } + + var builder = new StringBuilder($$""" +namespace {{languageSystemName}} +{ + public sealed partial class LanguageSystem + { + +"""); + + foreach (var text in textStore) + { + builder.AppendLine($$""" public string {{text}} { get; set; }"""); + } + + builder.AppendLine(""" + } +} +"""); + + File.WriteAllText(languageSystemFilePath, builder.ToString()); +} + +async Task N2Mt(string targetLanguage, string src) +{ + var t = await wwwClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, "https://openapi.naver.com/v1/papago/n2mt") + { + Content = new FormUrlEncodedContent(new[] { KeyValuePair.Create("source", "ko"), KeyValuePair.Create("target", targetLanguage), KeyValuePair.Create("text", src) }), + Version = HttpVersion.Version20 + }); + var text = await t.Content.ReadAsStringAsync(); + if (t.IsSuccessStatusCode) + { + return JsonSerializer.Deserialize(text, new JsonSerializerOptions + { + IncludeFields = true + }).message.result.translatedText; + } + else + { + await Console.Error.WriteLineAsync(t.StatusCode.ToString()); + return string.Empty; + } +} \ No newline at end of file diff --git a/Language/Properties/launchSettings.json b/Language/Properties/launchSettings.json new file mode 100644 index 0000000..bc507f0 --- /dev/null +++ b/Language/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Language": { + "commandName": "Project", + "commandLineArgs": "\"..\\..\\..\\..\\..\\Qwilight\" \"..\\..\\..\\..\\..\\..\\..\\..\\IdeaProjects\\Twilight\" \"..\\..\\..\\..\\..\\..\\taehui\"" + } + } +} \ No newline at end of file diff --git a/NVIDIA/NVIDIA.cpp b/NVIDIA/NVIDIA.cpp new file mode 100644 index 0000000..c9d411b --- /dev/null +++ b/NVIDIA/NVIDIA.cpp @@ -0,0 +1,86 @@ +#include "pch.h" + +using namespace sl; + +extern "C" +{ + __declspec(dllexport) void InitNVLL(void*); + __declspec(dllexport) void SetNVLLConfigure(ReflexMode, uint32_t); + __declspec(dllexport) void GetNVLLFrame(); + __declspec(dllexport) void WaitNVLL(); + __declspec(dllexport) void SetNVLLFlag(ReflexMarker); + __declspec(dllexport) void NotifyNVLL(uint32_t); + __declspec(dllexport) bool IsNVLLAvailable(); +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + return TRUE; +} + +FrameToken* frame = {}; +ReflexState state = {}; + +void InitNVLL(void* d3dDevice) +{ + Preferences pref = {}; + pref.featuresToLoad = new Feature[1]{ kFeatureReflex }; + pref.numFeaturesToLoad = sizeof(*pref.featuresToLoad) / sizeof(Feature); + pref.engineVersion = "1.1.0"; + pref.renderAPI = RenderAPI::eD3D11; + if (SL_FAILED(r, slInit(pref))) + { + return; + } + if (SL_FAILED(r, slSetD3DDevice(d3dDevice))) + { + return; + } + if (SL_FAILED(r, slReflexGetState(state))) + { + return; + } + slGetNewFrameToken(frame); +} + +void SetNVLLConfigure(ReflexMode mode, uint32_t frameLimitUs) +{ + ReflexOptions options = {}; + options.mode = mode; + options.frameLimitUs = frameLimitUs; + options.useMarkersToOptimize = mode == ReflexMode::eLowLatencyWithBoost; + if (SL_FAILED(r, slReflexSetOptions(options))) + { + return; + } + slReflexGetState(state); +} + +void GetNVLLFrame() +{ + auto frameIndex = *frame + 1; + slGetNewFrameToken(frame, &frameIndex); +} + +void SetNVLLFlag(ReflexMarker marker) +{ + slReflexSetMarker(marker, *frame); +} + +void NotifyNVLL(uint32_t statsWindowMessage) +{ + if (state.statsWindowMessage == statsWindowMessage) + { + slReflexSetMarker(ReflexMarker::ePCLatencyPing, *frame); + } +} + +void WaitNVLL() +{ + slReflexSleep(*frame); +} + +bool IsNVLLAvailable() +{ + return state.lowLatencyAvailable; +} \ No newline at end of file diff --git a/NVIDIA/NVIDIA.vcxproj b/NVIDIA/NVIDIA.vcxproj new file mode 100644 index 0000000..9f71a09 --- /dev/null +++ b/NVIDIA/NVIDIA.vcxproj @@ -0,0 +1,177 @@ + + + + + Debug + ARM64 + + + Debug + x64 + + + Release + ARM64 + + + Release + x64 + + + + 16.0 + Win32Proj + {f4391bfa-ac83-4bdc-a552-f6ce1aaf5014} + NVIDIA + 10.0 + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(Platform)\$(Configuration)\ + + + $(Platform)\$(Configuration)\ + + + $(Platform)\$(Configuration)\ + + + $(Platform)\$(Configuration)\ + + + + true + _DEBUG;NVIDIA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp17 + + + Windows + true + false + + + + + true + _DEBUG;NVIDIA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + + + + + true + true + true + NDEBUG;NVIDIA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp17 + + + Windows + true + true + true + false + + + + + true + true + true + NDEBUG;NVIDIA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + true + true + false + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/NVIDIA/NVIDIA.vcxproj.filters b/NVIDIA/NVIDIA.vcxproj.filters new file mode 100644 index 0000000..4033769 --- /dev/null +++ b/NVIDIA/NVIDIA.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + + + 소스 파일 + + + 소스 파일 + + + \ No newline at end of file diff --git a/NVIDIA/framework.h b/NVIDIA/framework.h new file mode 100644 index 0000000..3c8f5ed --- /dev/null +++ b/NVIDIA/framework.h @@ -0,0 +1,11 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // 거의 사용되지 않는 내용을 Windows 헤더에서 제외합니다. +// Windows 헤더 파일 +#include +#include + +#include "sl.h" +#include "sl_reflex.h" + +#pragma comment(lib, "sl.interposer.lib") diff --git a/NVIDIA/pch.cpp b/NVIDIA/pch.cpp new file mode 100644 index 0000000..bd23a58 --- /dev/null +++ b/NVIDIA/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: 미리 컴파일된 헤더에 해당하는 소스 파일 + +#include "pch.h" + +// 미리 컴파일된 헤더를 사용하는 경우 컴파일이 성공하려면 이 소스 파일이 필요합니다. diff --git a/NVIDIA/pch.h b/NVIDIA/pch.h new file mode 100644 index 0000000..d99e280 --- /dev/null +++ b/NVIDIA/pch.h @@ -0,0 +1,13 @@ +// pch.h: 미리 컴파일된 헤더 파일입니다. +// 아래 나열된 파일은 한 번만 컴파일되었으며, 향후 빌드에 대한 빌드 성능을 향상합니다. +// 코드 컴파일 및 여러 코드 검색 기능을 포함하여 IntelliSense 성능에도 영향을 미칩니다. +// 그러나 여기에 나열된 파일은 빌드 간 업데이트되는 경우 모두 다시 컴파일됩니다. +// 여기에 자주 업데이트할 파일을 추가하지 마세요. 그러면 성능이 저하됩니다. + +#ifndef PCH_H +#define PCH_H + +// 여기에 미리 컴파일하려는 헤더 추가 +#include "framework.h" + +#endif //PCH_H diff --git a/NVIDIA/sl.h b/NVIDIA/sl.h new file mode 100644 index 0000000..ca5aa71 --- /dev/null +++ b/NVIDIA/sl.h @@ -0,0 +1,890 @@ +/* +* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#pragma once + +#include + +#include "sl_struct.h" +#include "sl_consts.h" +#include "sl_version.h" +#include "sl_result.h" + +#define SL_API extern "C" +#define SL_CHECK(f) {auto _r = f; if(_r != sl::Result::eOk) return _r;} +#define SL_FAILED(r, f) sl::Result r = f; r != sl::Result::eOk +#define SL_SUCCEEDED(r, f) sl::Result r = f; r == sl::Result::eOk +#define SL_FUN_DECL(name) PFun_##name* name{} +//! IMPORTANT: Macros which use `slGetFeatureFunction` can only be used AFTER device is set by calling either slSetD3DDevice or slSetVulkanInfo. +#define SL_FEATURE_FUN_IMPORT(feature, func) slGetFeatureFunction(feature, #func, (void*&) ##func) +#define SL_FEATURE_FUN_IMPORT_STATIC(feature, func) \ +static PFun_##func* s_ ##func{}; \ +if(!s_ ##func) { \ + sl::Result res = slGetFeatureFunction(feature, #func, (void*&) s_ ##func); \ + if(res != sl::Result::eOk) return res; \ +} \ + +typedef struct ID3D11Resource ID3D11Resource; +typedef struct ID3D11Buffer ID3D11Buffer; +typedef struct ID3D11Texture2D ID3D11Texture2D; +typedef struct ID3D12Resource ID3D12Resource; + +namespace sl { + +using CommandBuffer = void; +using Device = void; + +//! Buffer types used for tagging +//! +//! IMPORTANT: Each tag must use the unique id +//! +using BufferType = uint32_t; + +//! Depth buffer - IMPORTANT - Must be suitable to use with clipToPrevClip transformation (see Constants below) +constexpr BufferType kBufferTypeDepth = 0; +//! Object and optional camera motion vectors (see Constants below) +constexpr BufferType kBufferTypeMotionVectors = 1; +//! Color buffer with all post-processing effects applied but without any UI/HUD elements +constexpr BufferType kBufferTypeHUDLessColor = 2; +//! Color buffer containing jittered input data for the image scaling pass +constexpr BufferType kBufferTypeScalingInputColor = 3; +//! Color buffer containing results from the image scaling pass +constexpr BufferType kBufferTypeScalingOutputColor = 4; +//! Normals +constexpr BufferType kBufferTypeNormals = 5; +//! Roughness +constexpr BufferType kBufferTypeRoughness = 6; +//! Albedo +constexpr BufferType kBufferTypeAlbedo = 7; +//! Specular Albedo +constexpr BufferType kBufferTypeSpecularAlbedo = 8; +//! Indirect Albedo +constexpr BufferType kBufferTypeIndirectAlbedo = 9; +//! Specular Motion Vectors +constexpr BufferType kBufferTypeSpecularMotionVectors = 10; +//! Disocclusion Mask +constexpr BufferType kBufferTypeDisocclusionMask = 11; +//! Emissive +constexpr BufferType kBufferTypeEmissive = 12; +//! Exposure +constexpr BufferType kBufferTypeExposure = 13; +//! Buffer with normal and roughness in alpha channel +constexpr BufferType kBufferTypeNormalRoughness = 14; +//! Diffuse and camera ray length +constexpr BufferType kBufferTypeDiffuseHitNoisy = 15; +//! Diffuse denoised +constexpr BufferType kBufferTypeDiffuseHitDenoised = 16; +//! Specular and reflected ray length +constexpr BufferType kBufferTypeSpecularHitNoisy = 17; +//! Specular denoised +constexpr BufferType kBufferTypeSpecularHitDenoised = 18; +//! Shadow noisy +constexpr BufferType kBufferTypeShadowNoisy = 19; +//! Shadow denoised +constexpr BufferType kBufferTypeShadowDenoised = 20; +//! AO noisy +constexpr BufferType kBufferTypeAmbientOcclusionNoisy = 21; +//! AO denoised +constexpr BufferType kBufferTypeAmbientOcclusionDenoised = 22; +//! Optional - UI/HUD color and alpha +//! IMPORTANT: Please make sure that alpha channel has enough precision (for example do NOT use formats like R10G10B10A2) +constexpr BufferType kBufferTypeUIColorAndAlpha = 23; +//! Optional - Shadow pixels hint (set to 1 if a pixel belongs to the shadow area, 0 otherwise) +constexpr BufferType kBufferTypeShadowHint = 24; +//! Optional - Reflection pixels hint (set to 1 if a pixel belongs to the reflection area, 0 otherwise) +constexpr BufferType kBufferTypeReflectionHint = 25; +//! Optional - Particle pixels hint (set to 1 if a pixel represents a particle, 0 otherwise) +constexpr BufferType kBufferTypeParticleHint = 26; +//! Optional - Transparency pixels hint (set to 1 if a pixel belongs to the transparent area, 0 otherwise) +constexpr BufferType kBufferTypeTransparencyHint = 27; +//! Optional - Animated texture pixels hint (set to 1 if a pixel belongs to the animated texture area, 0 otherwise) +constexpr BufferType kBufferTypeAnimatedTextureHint = 28; +//! Optional - Bias for current color vs history hint - lerp(history, current, bias) (set to 1 to completely reject history) +constexpr BufferType kBufferTypeBiasCurrentColorHint = 29; +//! Optional - Ray-tracing distance (camera ray length) +constexpr BufferType kBufferTypeRaytracingDistance = 30; +//! Optional - Motion vectors for reflections +constexpr BufferType kBufferTypeReflectionMotionVectors = 31; +//! Optional - Position, in same space as eNormals +constexpr BufferType kBufferTypePosition = 32; +//! Optional - Indicates (via non-zero value) which pixels have motion/depth values that do not match the final color content at that pixel (e.g. overlaid, opaque Picture-in-Picture) +constexpr BufferType kBufferTypeInvalidDepthMotionHint = 33; +//! Alpha +constexpr BufferType kBufferTypeAlpha = 34; +//! Color buffer containing only opaque geometry +constexpr BufferType kBufferTypeOpaqueColor = 35; +//! Optional - Reduce reliance on history instead using current frame hint (0 if a pixel is not at all reactive and default composition should be used, 1 if fully reactive) +constexpr BufferType kBufferTypeReactiveMaskHint = 36; +//! Optional - Pixel lock adjustment hint (set to 1 if pixel lock should be completely removed, 0 otherwise) +constexpr BufferType kBufferTypeTransparencyAndCompositionMaskHint = 37; +//! Optional - Albedo of the reflection ray hit point. For multibounce reflections, this should be the albedo of the first non-specular bounce. +constexpr BufferType kBufferTypeReflectedAlbedo = 38; +//! Optional - Color buffer before particles are drawn. +constexpr BufferType kBufferTypeColorBeforeParticles = 39; +//! Optional - Color buffer before transparent objects are drawn. +constexpr BufferType kBufferTypeColorBeforeTransparency = 40; +//! Optional - Color buffer before fog is drawn. +constexpr BufferType kBufferTypeColorBeforeFog = 41; +//! Optional - Buffer containing the hit distance of a specular ray. +constexpr BufferType kBufferTypeSpecularHitDistance = 42; +//! Optional - Buffer that contains 3 components of a specular ray direction, and 1 component of specular hit distance. +constexpr BufferType kBufferTypeSpecularRayDirectionHitDistance = 43; +//! Optional - Buffer containing normalized direction of a specular ray. +constexpr BufferType kBufferTypeSpecularRayDirection = 44; +// !Optional - Buffer containing the hit distance of a diffuse ray. +constexpr BufferType kBufferTypeDiffuseHitDistance = 45; +//! Optional - Buffer that contains 3 components of a diffuse ray direction, and 1 component of diffuse hit distance. +constexpr BufferType kBufferTypeDiffuseRayDirectionHitDistance = 46; +//! Optional - Buffer containing normalized direction of a diffuse ray. +constexpr BufferType kBufferTypeDiffuseRayDirection = 47; +//! Optional - Buffer containing display resolution depth. +constexpr BufferType kBufferTypeHiResDepth = 48; +//! Required either this or kBufferTypeDepth - Buffer containing linear depth. +constexpr BufferType kBufferTypeLinearDepth = 49; +//! Optional - Bidirectional distortion field. 4 channels in normalized [0,1] pixel space. RG = distorted pixel to undistorted pixel displacement. BA = undistorted pixel to distorted pixel displacement. +constexpr BufferType kBufferTypeBidirectionalDistortionField = 50; +//!Optional - Buffer containing particles or other similar transparent effects rendered into it instead of passing it as part of the input color +constexpr BufferType kBufferTypeTransparencyLayer = 51; +//!Optional - Butffer to be used in addition to TransparencyLayer which allows 3-channels of Opacity versus 1-channel. +// In this case, TransparencyLayer represents Color (RcGcBc), TransparencyLayerOpacity represents alpha (RaGaBa)' +constexpr BufferType kBufferTypeTransparencyLayerOpacity = 52; + +//! Features supported with this SDK +//! +//! IMPORTANT: Each feature must use a unique id +//! +using Feature = uint32_t; + +//! Deep Learning Super Sampling +constexpr Feature kFeatureDLSS = 0; + +//! Real-Time Denoiser +constexpr Feature kFeatureNRD = 1; + +//! NVIDIA Image Scaling +constexpr Feature kFeatureNIS = 2; + +//! Low-Latency +constexpr Feature kFeatureReflex = 3; + +//! DLSS Frame Generation +constexpr Feature kFeatureDLSS_G = 1000; + +//! DLSS Ray Reconstruction +constexpr Feature kFeatureDLSS_RR = 1001; + +// ImGUI +constexpr Feature kFeatureImGUI = 9999; + +//! Common feature, NOT intended to be used directly +constexpr Feature kFeatureCommon = UINT_MAX; + +//! Different levels for logging +enum class LogLevel : uint32_t +{ + //! No logging + eOff, + //! Default logging + eDefault, + //! Verbose logging + eVerbose, + //! Total count + eCount +}; + +//! Resource types +enum class ResourceType : char +{ + eTex2d, + eBuffer, + eCommandQueue, + eCommandBuffer, + eCommandPool, + eFence, + eSwapchain, + eCount +}; + +//! Resource allocate information +//! +SL_STRUCT(ResourceAllocationDesc, StructType({ 0xbb57e5, 0x49a2, 0x4c23, { 0xa5, 0x19, 0xab, 0x92, 0x86, 0xe7, 0x40, 0x14 } }), kStructVersion1) + ResourceAllocationDesc(ResourceType _type, void* _desc, uint32_t _state, void* _heap) : BaseStructure(ResourceAllocationDesc::s_structType, kStructVersion1), type(_type),desc(_desc),state(_state),heap(_heap){}; + //! Indicates the type of resource + ResourceType type = ResourceType::eTex2d; + //! D3D12_RESOURCE_DESC/VkImageCreateInfo/VkBufferCreateInfo + void* desc{}; + //! Initial state as D3D12_RESOURCE_STATES or VkMemoryPropertyFlags + uint32_t state = 0; + //! CD3DX12_HEAP_PROPERTIES or nullptr + void* heap{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + + +//! Subresource range information, for Vulkan resources +//! +//! {8D4C316C-D402-4524-89A7-14E79E638E3A} +SL_STRUCT(SubresourceRange, StructType({ 0x8d4c316c, 0xd402, 0x4524, { 0x89, 0xa7, 0x14, 0xe7, 0x9e, 0x63, 0x8e, 0x3a } }), kStructVersion1) + //! Vulkan subresource aspectMask + uint32_t aspectMask; + //! Vulkan subresource baseMipLevel + uint32_t baseMipLevel; + //! Vulkan subresource levelCount + uint32_t levelCount; + //! Vulkan subresource baseArrayLayer + uint32_t baseArrayLayer; + //! Vulkan subresource layerCount + uint32_t layerCount; +}; + +//! Native resource +//! +//! {3A9D70CF-2418-4B72-8391-13F8721C7261} +SL_STRUCT(Resource, StructType({ 0x3a9d70cf, 0x2418, 0x4b72, { 0x83, 0x91, 0x13, 0xf8, 0x72, 0x1c, 0x72, 0x61 } }), kStructVersion1) + //! Constructors + //! + //! Resource type, native pointer are MANDATORY always + //! Resource state is MANDATORY unless using D3D11 + //! Resource view, description etc. are MANDATORY only when using Vulkan + //! + Resource(ResourceType _type, void* _native, void* _mem, void* _view, uint32_t _state = UINT_MAX) : BaseStructure(Resource::s_structType, kStructVersion1), type(_type), native(_native), memory(_mem), view(_view), state(_state){}; + Resource(ResourceType _type, void* _native, uint32_t _state = UINT_MAX) : BaseStructure(Resource::s_structType, kStructVersion1), type(_type), native(_native), state(_state) {}; + + //! Conversion helpers for D3D + inline operator ID3D12Resource* () { return reinterpret_cast(native); } + inline operator ID3D11Resource* () { return reinterpret_cast(native); } + inline operator ID3D11Buffer* () { return reinterpret_cast(native); } + inline operator ID3D11Texture2D* () { return reinterpret_cast(native); } + + //! Indicates the type of resource + ResourceType type = ResourceType::eTex2d; + //! ID3D11Resource/ID3D12Resource/VkBuffer/VkImage + void* native{}; + //! vkDeviceMemory or nullptr + void* memory{}; + //! VkImageView/VkBufferView or nullptr + void* view{}; + //! State as D3D12_RESOURCE_STATES or VkImageLayout + //! + //! IMPORTANT: State is MANDATORY and needs to be correct when tagged resources are actually used. + //! + uint32_t state = UINT_MAX; + //! Width in pixels + uint32_t width{}; + //! Height in pixels + uint32_t height{}; + //! Native format + uint32_t nativeFormat{}; + //! Number of mip-map levels + uint32_t mipLevels{}; + //! Number of arrays + uint32_t arrayLayers{}; + //! Virtual address on GPU (if applicable) + uint64_t gpuVirtualAddress{}; + //! VkImageCreateFlags + uint32_t flags; + //! VkImageUsageFlags + uint32_t usage{}; + //! Reserved for internal use + uint32_t reserved{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +//! Specifies life-cycle for the tagged resource +//! +//! IMPORTANT: Use 'eOnlyValidNow' and 'eValidUntilEvaluate' ONLY when really needed since it can result in wasting VRAM if SL ends up making unnecessary copies. +//! +//! If integrating features, like for example DLSS-G, which require tags to be 'eValidUntilPresent' please try to tag everything as 'eValidUntilPresent' first +//! and only make modifications if upon visual inspection you notice that tags are corrupted when used during the Present frame call. +enum ResourceLifecycle +{ + //! Resource can change, get destroyed or reused for other purposes after it is provided to SL + eOnlyValidNow, + //! Resource does NOT change, gets destroyed or reused for other purposes from the moment it is provided to SL until the frame is presented + eValidUntilPresent, + //! Resource does NOT change, gets destroyed or reused for other purposes from the moment it is provided to SL until after the slEvaluateFeature call has returned. + eValidUntilEvaluate +}; + +//! Tagged resource +//! +//! {4C6A5AAD-B445-496C-87FF-1AF3845BE653} +//! Extensions as part of the `next` ptr: +//! PrecisionInfo +SL_STRUCT(ResourceTag, StructType({ 0x4c6a5aad, 0xb445, 0x496c, { 0x87, 0xff, 0x1a, 0xf3, 0x84, 0x5b, 0xe6, 0x53 } }), kStructVersion1) + ResourceTag(Resource* r, BufferType t, ResourceLifecycle l, const Extent* e = nullptr) + : BaseStructure(ResourceTag::s_structType, kStructVersion1), resource(r), type(t), lifecycle(l) + { + if (e) extent = *e; + }; + + //! Resource description + Resource* resource{}; + //! Type of the tagged buffer + BufferType type{}; + //! The life-cycle for the tag, if resource is volatile a valid command buffer must be specified + ResourceLifecycle lifecycle{}; + //! The area of the tagged resource to use (if using the entire resource leave as null) + Extent extent{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +// +//! Precision info, optional extension for ResourceTag. +//! +//! {98F6E9BA-8D16-4831-A802-4D3B52FF26BF} +//! Extensions as part of the `next` ptr: +//! ResourceTag +SL_STRUCT(PrecisionInfo, StructType({ 0x98f6e9ba, 0x8d16, 0x4831, { 0xa8, 0x2, 0x4d, 0x3b, 0x52, 0xff, 0x26, 0xbf } }), kStructVersion1) + // Formula used to convert the low-precision data to high-precision + enum PrecisionFormula : uint32_t + { + eNoTransform = 0, // hi = lo, essentially no conversion is done + eLinearTransform, // hi = lo * scale + bias + }; + + PrecisionInfo(PrecisionInfo::PrecisionFormula formula, float bias, float scale) + : BaseStructure(PrecisionInfo::structType, kStructVersion1), conversionFormula(formula), bias(bias), scale(scale) {}; + + static std::string getPrecisionFormulaAsStr(PrecisionFormula formula) + { + switch (formula) + { + case eNoTransform: + return "eNoTransform"; + case eLinearTransform: + return "eLinearTransform"; + default: + assert("Invalid PrecisionFormula" && false); + return "Unknown"; + } + }; + + PrecisionFormula conversionFormula{ eNoTransform }; + float bias{ 0.0f }; + float scale{ 1.0f }; + + inline operator bool() const { return conversionFormula != eNoTransform; } + inline bool operator==(const PrecisionInfo& rhs) const + { + return conversionFormula == rhs.conversionFormula && bias == rhs.bias && scale == rhs.scale; + } + inline bool operator!=(const PrecisionInfo& rhs) const + { + return !operator==(rhs); + } +}; + +//! Resource allocation/deallocation callbacks +//! +//! Use these callbacks to gain full control over +//! resource life cycle and memory allocation tracking. +//! +//! @param device - Device to be used (vkDevice or ID3D11Device or ID3D12Device) +//! +//! IMPORTANT: Textures must have the pixel shader resource +//! and the unordered access view flags set +using PFun_ResourceAllocateCallback = Resource(const ResourceAllocationDesc* desc, void* device); +using PFun_ResourceReleaseCallback = void(Resource* resource, void* device); + +//! Log type +enum class LogType : uint32_t +{ + //! Controlled by LogLevel, SL can show more information in eLogLevelVerbose mode + eInfo, + //! Always shown regardless of LogLevel + eWarn, + eError, + //! Total count + eCount +}; + +//! Logging callback +//! +//! Use these callbacks to track messages posted in the log. +//! If any of the SL methods returns false use eLogTypeError +//! type to track down what went wrong and why. +using PFun_LogMessageCallback = void(LogType type, const char* msg); + +//! Optional flags +enum class PreferenceFlags : uint64_t +{ + //! Set by default - Disables command list state tracking - Host application is responsible for restoring CL state correctly after each 'slEvaluateFeature' call + eDisableCLStateTracking = 1 << 0, + //! Optional - Disables debug text on screen in development builds + eDisableDebugText = 1 << 1, + //! Optional - IMPORTANT: Only to be used in the advanced integration mode, see the 'manual hooking' programming guide for more details + eUseManualHooking = 1 << 2, + //! Optional - Enables downloading of Over The Air (OTA) updates for SL and NGX + //! This will invoke the OTA updater to look for new updates. A separate + //! flag below is used to control whether or not OTA-downloaded SL Plugins are + //! loaded. + eAllowOTA = 1 << 3, + //! Do not check OS version when deciding if feature is supported or not + //! + //! IMPORTANT: ONLY SET THIS FLAG IF YOU KNOW WHAT YOU ARE DOING. + //! + //! VARIOUS WIN APIs INCLUDING BUT NOT LIMITED TO `IsWindowsXXX`, `GetVersionX`, `rtlGetVersion` ARE KNOWN FOR RETURNING INCORRECT RESULTS. + eBypassOSVersionCheck = 1 << 4, + //! Optional - If specified SL will create DXGI factory proxy rather than modifying the v-table for the base interface. + //! + //! This can help with 3rd party overlays which are NOT integrated with the host application but rather operate via injection. + eUseDXGIFactoryProxy = 1 << 5, + //! Optional - Enables loading of plugins downloaded Over The Air (OTA), to + //! be used in conjunction with the eAllowOTA flag. + eLoadDownloadedPlugins = 1 << 6, +}; + +SL_ENUM_OPERATORS_64(PreferenceFlags) + +//! Engine types +//! +enum class EngineType : uint32_t +{ + eCustom, + eUnreal, + eUnity, + eCount +}; + +//! Rendering API +//! +enum class RenderAPI : uint32_t +{ + eD3D11, + eD3D12, + eVulkan, + eCount +}; + +//! Application preferences +//! +//! {1CA10965-BF8E-432B-8DA1-6716D879FB14} +SL_STRUCT(Preferences, StructType({ 0x1ca10965, 0xbf8e, 0x432b, { 0x8d, 0xa1, 0x67, 0x16, 0xd8, 0x79, 0xfb, 0x14 } }), kStructVersion1) + //! Optional - In non-production builds it is useful to enable debugging console window + bool showConsole = false; + //! Optional - Various logging levels + LogLevel logLevel = LogLevel::eDefault; + //! Optional - Absolute paths to locations where to look for plugins, first path in the list has the highest priority + const wchar_t** pathsToPlugins{}; + //! Optional - Number of paths to search + uint32_t numPathsToPlugins = 0; + //! Optional - Absolute path to location where logs and other data should be stored + //! + //! NOTE: Set this to nullptr in order to disable logging to a file + const wchar_t* pathToLogsAndData{}; + //! Optional - Allows resource allocation tracking on the host side + PFun_ResourceAllocateCallback* allocateCallback{}; + //! Optional - Allows resource deallocation tracking on the host side + PFun_ResourceReleaseCallback* releaseCallback{}; + //! Optional - Allows log message tracking including critical errors if they occur + PFun_LogMessageCallback* logMessageCallback{}; + //! Optional - Flags used to enable or disable advanced options + PreferenceFlags flags = PreferenceFlags::eDisableCLStateTracking | PreferenceFlags::eAllowOTA | PreferenceFlags::eLoadDownloadedPlugins; + //! Required - Features to load (assuming appropriate plugins are found), if not specified NO features will be loaded by default + const Feature* featuresToLoad{}; + //! Required - Number of features to load, only used when list is not a null pointer + uint32_t numFeaturesToLoad{}; + //! Optional - Id provided by NVIDIA, if not specified then engine type and version are required + uint32_t applicationId{}; + //! Optional - Type of the rendering engine used, if not specified then applicationId is required + EngineType engine = EngineType::eCustom; + //! Optional - Version of the rendering engine used + const char* engineVersion{}; + //! Optional - GUID (like for example 'a0f57b54-1daf-4934-90ae-c4035c19df04') + const char* projectId{}; + //! Optional - Which rendering API host is planning to use + //! + //! NOTE: To ensure correct `slGetFeatureRequirements` behavior please specify if planning to use Vulkan. + RenderAPI renderAPI = RenderAPI::eD3D12; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +//! Frame tracking handle +//! +//! IMPORTANT: Use slGetNewFrameToken to obtain unique instance +//! +//! {830A0F35-DB84-4171-A804-59B206499B18} +SL_STRUCT_PROTECTED(FrameToken, StructType({ 0x830a0f35, 0xdb84, 0x4171, { 0xa8, 0x4, 0x59, 0xb2, 0x6, 0x49, 0x9b, 0x18 } }), kStructVersion1) + //! Helper operator to obtain current frame index + virtual operator uint32_t() const = 0; +}; + +//! Handle for the unique viewport +//! +//! {171B6435-9B3C-4FC8-9994-FBE52569AAA4} +SL_STRUCT(ViewportHandle, StructType({ 0x171b6435, 0x9b3c, 0x4fc8, { 0x99, 0x94, 0xfb, 0xe5, 0x25, 0x69, 0xaa, 0xa4 } }), kStructVersion1) + ViewportHandle(uint32_t v) : BaseStructure(ViewportHandle::s_structType, kStructVersion1), value(v) {} + ViewportHandle(int32_t v) : BaseStructure(ViewportHandle::s_structType, kStructVersion1), value(v) {} + operator uint32_t() const { return value; } +private: + uint32_t value = UINT_MAX; +}; + +//! Specifies feature requirement flags +//! +enum class FeatureRequirementFlags : uint32_t +{ + //! Rendering APIs + eD3D11Supported = 1 << 0, + eD3D12Supported = 1 << 1, + eVulkanSupported = 1 << 2, + //! If set V-Sync must be disabled when feature is active + eVSyncOffRequired = 1 << 3, + //! If set GPU hardware scheduling OS feature must be turned on + eHardwareSchedulingRequired = 1 << 4 +}; + +SL_ENUM_OPERATORS_32(FeatureRequirementFlags); + +//! Specifies feature requirements +//! +//! {66714097-AC6D-4BC6-8915-1E0F55A6B61F} +SL_STRUCT(FeatureRequirements, StructType({ 0x66714097, 0xac6d, 0x4bc6, { 0x89, 0x15, 0x1e, 0xf, 0x55, 0xa6, 0xb6, 0x1f } }), kStructVersion2) + //! Various Flags + FeatureRequirementFlags flags {}; + + //! Feature will create this many CPU threads + uint32_t maxNumCPUThreads{}; + + //! Feature supports only this many viewports + uint32_t maxNumViewports{}; + + //! Required buffer tags + uint32_t numRequiredTags{}; + const BufferType* requiredTags{}; + + //! OS and Driver versions + Version osVersionDetected{}; + Version osVersionRequired{}; + Version driverVersionDetected{}; + Version driverVersionRequired{}; + + //! Vulkan specific bits + + //! Command queues + uint32_t vkNumComputeQueuesRequired{}; + uint32_t vkNumGraphicsQueuesRequired{}; + + //! Device extensions + uint32_t vkNumDeviceExtensions{}; + const char** vkDeviceExtensions{}; + //! Instance extensions + uint32_t vkNumInstanceExtensions{}; + const char** vkInstanceExtensions{}; + //! 1.2 features + //! + //! NOTE: Use getVkPhysicalDeviceVulkan12Features from sl_helpers_vk.h + uint32_t vkNumFeatures12{}; + const char** vkFeatures12{}; + //! 1.3 features + //! + //! NOTE: Use getVkPhysicalDeviceVulkan13Features from sl_helpers_vk.h + uint32_t vkNumFeatures13{}; + const char** vkFeatures13{}; + + //! Vulkan optical flow feature + uint32_t vkNumOpticalFlowQueuesRequired{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +//! Specifies feature's version +//! +//! {6D5B51F0-076B-486D-9995-5A561043F5C1} +SL_STRUCT(FeatureVersion, StructType({ 0x6d5b51f0, 0x76b, 0x486d, { 0x99, 0x95, 0x5a, 0x56, 0x10, 0x43, 0xf5, 0xc1 } }), kStructVersion1) + //! SL version + Version versionSL{}; + //! NGX version (if feature is using NGX, null otherwise) + Version versionNGX{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +//! Specifies either DXGI adapter or VK physical device +//! +//! {0677315F-A746-4492-9F42-CB6142C9C3D4} +SL_STRUCT(AdapterInfo, StructType({ 0x677315f, 0xa746, 0x4492, { 0x9f, 0x42, 0xcb, 0x61, 0x42, 0xc9, 0xc3, 0xd4 } }), kStructVersion1) + //! Locally unique identifier + uint8_t* deviceLUID {}; + //! Size in bytes + uint32_t deviceLUIDSizeInBytes{}; + //! Vulkan Specific, if specified LUID will be ignored + void* vkPhysicalDevice{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +} + +//! Streamline core API functions (check feature specific headers for additional APIs) +//! +using PFun_slInit = sl::Result(const sl::Preferences& pref, uint64_t sdkVersion); +using PFun_slShutdown = sl::Result(); +using PFun_slIsFeatureSupported = sl::Result(sl::Feature feature, const sl::AdapterInfo& adapterInfo); +using PFun_slIsFeatureLoaded = sl::Result(sl::Feature feature, bool& loaded); +using PFun_slSetFeatureLoaded = sl::Result(sl::Feature feature, bool loaded); +using PFun_slEvaluateFeature = sl::Result(sl::Feature feature, const sl::FrameToken& frame, const sl::BaseStructure** inputs, uint32_t numInputs, sl::CommandBuffer* cmdBuffer); +using PFun_slAllocateResources = sl::Result(sl::CommandBuffer* cmdBuffer, sl::Feature feature, const sl::ViewportHandle& viewport); +using PFun_slFreeResources = sl::Result(sl::Feature feature, const sl::ViewportHandle& viewport); +using PFun_slSetTag = sl::Result(const sl::ViewportHandle& viewport, const sl::ResourceTag* tags, uint32_t numTags, sl::CommandBuffer* cmdBuffer); +using PFun_slGetFeatureRequirements = sl::Result(sl::Feature feature, sl::FeatureRequirements& requirements); +using PFun_slGetFeatureVersion = sl::Result(sl::Feature feature, sl::FeatureVersion& version); +using PFun_slUpgradeInterface = sl::Result(void** baseInterface); +using PFun_slSetConstants = sl::Result(const sl::Constants& values, const sl::FrameToken& frame, const sl::ViewportHandle& viewport); +using PFun_slGetNativeInterface = sl::Result(void* proxyInterface, void** baseInterface); +using PFun_slGetFeatureFunction = sl::Result(sl::Feature feature, const char* functionName, void*& function); +using PFun_slGetNewFrameToken = sl::Result(sl::FrameToken*& token, uint32_t* frameIndex); +using PFun_slSetD3DDevice = sl::Result(void* d3dDevice); + +//! Initializes the SL module +//! +//! Call this method when the game is initializing. +//! +//! @param pref Specifies preferred behavior for the SL library (SL will keep a copy) +//! @param sdkVersion Current SDK version +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +SL_API sl::Result slInit(const sl::Preferences &pref, uint64_t sdkVersion = sl::kSDKVersion); + +//! Shuts down the SL module +//! +//! Call this method when the game is shutting down. +//! +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +SL_API sl::Result slShutdown(); + +//! Checks if a specific feature is supported or not. +//! +//! Call this method to check if a certain e* (see above) is available. +//! +//! @param feature Specifies which feature to use +//! @param adapterInfo Adapter to check (optional) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! NOTE: If adapter info is null SL will return general feature compatibility with the OS, +//! installed drivers or any other requirements not directly related to the adapter. +//! +//! This method is NOT thread safe. +SL_API sl::Result slIsFeatureSupported(sl::Feature feature, const sl::AdapterInfo& adapterInfo); + +//! Checks if specified feature is loaded or not. +//! +//! Call this method to check if feature is loaded. +//! All requested features are loaded by default and have to be unloaded explicitly if needed. +//! +//! @param feature Specifies which feature to check +//! @param loaded Value specifying if feature is loaded or unloaded. +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slIsFeatureLoaded(sl::Feature feature, bool& loaded); + +//! Sets the specified feature to either loaded or unloaded state. +//! +//! Call this method to load or unload certain e*. +//! +//! NOTE: All requested features are loaded by default and have to be unloaded explicitly if needed. +//! +//! @param feature Specifies which feature to check +//! @param loaded Value specifying if feature should be loaded or unloaded. +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! NOTE: When this method is called no other DXGI/D3D/Vulkan APIs should be invoked in parallel so +//! make sure to flush your pipeline before calling this method. +//! +//! This method is NOT thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slSetFeatureLoaded(sl::Feature feature, bool loaded); + +//! Tags resource globally +//! +//! Call this method to tag the appropriate buffers in global scope. +//! +//! @param viewport Specifies viewport this tag applies to +//! @param tags Pointer to resources tags, set to null to remove the specified tag +//! @param numTags Number of resource tags in the provided list +//! @param cmdBuffer Command buffer to use (optional and can be null if ALL tags are null or have eValidUntilPresent life-cycle) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! IMPORTANT: GPU payload that generates content for the provided tag(s) MUST be either already submitted to the provided command buffer +//! or some other command buffer which is guaranteed, by the host application, to be executed BEFORE the provided command buffer. +//! +//! This method is thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slSetTag(const sl::ViewportHandle& viewport, const sl::ResourceTag* tags, uint32_t numTags, sl::CommandBuffer* cmdBuffer); + +//! Sets common constants. +//! +//! Call this method to provide the required data (SL will keep a copy). +//! +//! @param values Common constants required by SL plugins (SL will keep a copy) +//! @param frame Index of the current frame +//! @param viewport Unique id (can be viewport id | instance id etc.) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slSetConstants(const sl::Constants& values, const sl::FrameToken& frame, const sl::ViewportHandle& viewport); + +//! Returns feature's requirements +//! +//! Call this method to check what is required to run certain eFeature* (see above). +//! This method must be called after init otherwise it will always return an error. +//! +//! @param feature Specifies which feature to check +//! @param requirements Data structure with feature's requirements +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +SL_API sl::Result slGetFeatureRequirements(sl::Feature feature, sl::FeatureRequirements& requirements); + +//! Returns feature's version +//! +//! Call this method to check version for a certain eFeature* (see above). +//! This method must be called after init otherwise it will always return an error. +//! +//! @param feature Specifies which feature to check +//! @param version Data structure with feature's version +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is thread safe. +SL_API sl::Result slGetFeatureVersion(sl::Feature feature, sl::FeatureVersion& version); + +//! Allocates resources for the specified feature. +//! +//! Call this method to explicitly allocate resources +//! for an instance of the specified feature. +//! +//! @param cmdBuffer Command buffer to use (must be created on device where feature is supported but can be null if not needed) +//! @param feature Feature we are working with +//! @param viewport Unique id (viewport handle) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slAllocateResources(sl::CommandBuffer* cmdBuffer, sl::Feature feature, const sl::ViewportHandle& viewport); + +//! Frees resources for the specified feature. +//! +//! Call this method to explicitly free resources +//! for an instance of the specified feature. +//! +//! @param feature Feature we are working with +//! @param viewport Unique id (viewport handle) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! IMPORTANT: If slEvaluateFeature is pending on a command list, that command list must be flushed +//! before calling this method to prevent invalid resource access on the GPU. +//! +//! IMPORTANT: If slEvaluateFeature is pending on a command list, that command list must be flushed +//! before calling this method to prevent invalid resource access on the GPU. +//! +//! This method is NOT thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slFreeResources(sl::Feature feature, const sl::ViewportHandle& viewport); + +//! Evaluates feature +//! +//! Use this method to mark the section in your rendering pipeline +//! where specific feature should be injected. +//! +//! @param feature Feature we are working with +//! @param frame Current frame handle obtained from SL +//! @param inputs The chained structures providing the input data (viewport, tags, constants etc) +//! @param numInputs Number of inputs +//! @param cmdBuffer Command buffer to use (must be created on device where feature is supported) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! IMPORTANT: Frame and viewport must match whatever is used to set common and or feature options and constants (if any) +//! +//! NOTE: It is allowed to pass in buffer tags as inputs, they are considered to be a "local" tags and do NOT interact with +//! same tags sent in the global scope using slSetTag API. +//! +//! This method is NOT thread safe and requires DX/VK device to be created before calling it. +SL_API sl::Result slEvaluateFeature(sl::Feature feature, const sl::FrameToken& frame, const sl::BaseStructure** inputs, uint32_t numInputs, sl::CommandBuffer* cmdBuffer); + +//! Upgrade interface +//! +//! Use this method to upgrade basic D3D or DXGI interface to an SL proxy. +//! +//! @param baseInterface Pointer to a pointer to the base interface (for example ID3D12Device etc.) to be replaced in place. +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! IMPORTANT: This method should ONLY be used to support 3rd party SDKs like AMD AGS +//! which bypass SL or when using manual hooking. +//! +//! This method is NOT thread safe and should be called IMMEDIATELY after base interface is created. +SL_API sl::Result slUpgradeInterface(void** baseInterface); + +//! Obtain native interface +//! +//! Use this method to obtain underlying D3D or DXGI interface from an SL proxy. +//! +//! IMPORTANT: When calling NVAPI or other 3rd party SDKs from your application +//! it is recommended to provide native interfaces instead of SL proxies. +//! +//! @param proxyInterface Pointer to the SL proxy (D3D device, swap-chain etc) +//! @param baseInterface Pointer to a pointer to the base interface be returned. +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe +SL_API sl::Result slGetNativeInterface(void* proxyInterface, void** baseInterface); + +//! Gets specific feature's function +//! +//! Call this method to obtain various functions for the specified feature. See sl_$feature.h for details. +//! +//! @param feature Feature we are working with +//! @param functionName The name of the API to obtain (declared in sl_[$feature].h +//! @param function Pointer to the function to return +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! IMPORTANT: Must be called AFTER device is set by calling either slSetD3DDevice or slSetVulkanInfo. +//! +//! This method is thread safe. +SL_API sl::Result slGetFeatureFunction(sl::Feature feature, const char* functionName, void*& function); + +//! Gets unique frame token +//! +//! Call this method to obtain token for the unique frame identification. +//! +//! @param handle Frame token to return +//! @param frameIndex Frame index (optional, if not provided SL internal frame counting is used) +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! NOTE: Normally SL would not expect more that 3 frames in flight due to added latency. +//! +//! This method is thread safe. +SL_API sl::Result slGetNewFrameToken(sl::FrameToken*& token, const uint32_t* frameIndex = nullptr); + +//! Set D3D device to use +//! +//! Use this method to specify which D3D device should be used. +//! +//! @param d3dDevice D3D device to use +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe and should be called IMMEDIATELY after main device is created. +SL_API sl::Result slSetD3DDevice(void* d3dDevice); diff --git a/NVIDIA/sl_consts.h b/NVIDIA/sl_consts.h new file mode 100644 index 0000000..e13d88f --- /dev/null +++ b/NVIDIA/sl_consts.h @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#pragma once + +#include +#include +#include + +#define SL_ENUM_OPERATORS_64(T) \ +inline bool operator&(T a, T b) \ +{ \ + return ((uint64_t)a & (uint64_t)b) != 0; \ +} \ + \ +inline T& operator&=(T& a, T b) \ +{ \ + a = (T)((uint64_t)a & (uint64_t)b); \ + return a; \ +} \ + \ +inline T operator|(T a, T b) \ +{ \ + return (T)((uint64_t)a | (uint64_t)b); \ +} \ + \ +inline T& operator |= (T& lhs, T rhs) \ +{ \ + lhs = (T)((uint64_t)lhs | (uint64_t)rhs); \ + return lhs; \ +} \ + \ +inline T operator~(T a) \ +{ \ + return (T)~((uint64_t)a); \ +} + +#define SL_ENUM_OPERATORS_32(T) \ +inline bool operator&(T a, T b) \ +{ \ + return ((uint32_t)a & (uint32_t)b) != 0; \ +} \ + \ +inline T& operator&=(T& a, T b) \ +{ \ + a = (T)((uint32_t)a & (uint32_t)b); \ + return a; \ +} \ + \ +inline T operator|(T a, T b) \ +{ \ + return (T)((uint32_t)a | (uint32_t)b); \ +} \ + \ +inline T& operator |= (T& lhs, T rhs) \ +{ \ + lhs = (T)((uint32_t)lhs | (uint32_t)rhs); \ + return lhs; \ +} \ + \ +inline T operator~(T a) \ +{ \ + return (T)~((uint32_t)a); \ +} + +namespace sl +{ + +//! For cases when value has to be provided and we don't have good default +constexpr float INVALID_FLOAT = 3.40282346638528859811704183484516925440e38f; +constexpr uint32_t INVALID_UINT = 0xffffffff; + +struct uint3 +{ + uint32_t x; + uint32_t y; + uint32_t z; +}; + +struct float2 +{ + float2() : x(INVALID_FLOAT), y(INVALID_FLOAT) {} + float2(float _x, float _y) : x(_x), y(_y) {} + float x, y; +}; + +struct float3 +{ + float3() : x(INVALID_FLOAT), y(INVALID_FLOAT), z(INVALID_FLOAT) {} + float3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} + float x, y, z; +}; + +struct float4 +{ + float4() : x(INVALID_FLOAT), y(INVALID_FLOAT), z(INVALID_FLOAT), w(INVALID_FLOAT) {} + float4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) {} + float x, y, z, w; +}; + +struct float4x4 +{ + //! All access points take row index as a parameter + inline float4& operator[](uint32_t i) { return row[i]; } + inline const float4& operator[](uint32_t i) const { return row[i]; } + inline void setRow(uint32_t i, const float4& v) { row[i] = v; } + inline const float4& getRow(uint32_t i) { return row[i]; } + + //! Row major matrix + float4 row[4]; +}; + +struct Extent +{ + uint32_t top{}; + uint32_t left{}; + uint32_t width{}; + uint32_t height{}; + + inline operator bool() const { return width != 0 && height != 0; } + inline bool operator==(const Extent& rhs) const + { + return top == rhs.top && left == rhs.left && + width == rhs.width && height == rhs.height; + } + inline bool operator!=(const Extent& rhs) const + { + return !operator==(rhs); + } +}; + +//! For cases when value has to be provided and we don't have good default +enum Boolean : char +{ + eFalse, + eTrue, + eInvalid +}; + +//! Common constants, all parameters must be provided unless they are marked as optional +//! +//! {DCD35AD7-4E4A-4BAD-A90C-E0C49EB23AFE} +SL_STRUCT(Constants, StructType({ 0xdcd35ad7, 0x4e4a, 0x4bad, { 0xa9, 0xc, 0xe0, 0xc4, 0x9e, 0xb2, 0x3a, 0xfe } }), kStructVersion2) + //! IMPORTANT: All matrices are row major (see float4x4 definition) and + //! must NOT contain temporal AA jitter offset (if any). Any jitter offset + //! should be provided as the additional parameter Constants::jitterOffset (see below) + + //! Specifies matrix transformation from the camera view to the clip space. + float4x4 cameraViewToClip; + //! Specifies matrix transformation from the clip space to the camera view space. + float4x4 clipToCameraView; + //! Optional - Specifies matrix transformation describing lens distortion in clip space. + float4x4 clipToLensClip; + //! Specifies matrix transformation from the current clip to the previous clip space. + //! clipToPrevClip = clipToView * viewToViewPrev * viewToClipPrev + //! Sample code can be found in sl_matrix_helpers.h + float4x4 clipToPrevClip; + //! Specifies matrix transformation from the previous clip to the current clip space. + //! prevClipToClip = clipToPrevClip.inverse() + float4x4 prevClipToClip; + + //! Specifies pixel space jitter offset + float2 jitterOffset; + //! Specifies scale factors used to normalize motion vectors (so the values are in [-1,1] range) + float2 mvecScale; + //! Optional - Specifies camera pinhole offset if used. + float2 cameraPinholeOffset; + //! Specifies camera position in world space. + float3 cameraPos; + //! Specifies camera up vector in world space. + float3 cameraUp; + //! Specifies camera right vector in world space. + float3 cameraRight; + //! Specifies camera forward vector in world space. + float3 cameraFwd; + + //! Specifies camera near view plane distance. + float cameraNear = INVALID_FLOAT; + //! Specifies camera far view plane distance. + float cameraFar = INVALID_FLOAT; + //! Specifies camera field of view in radians. + float cameraFOV = INVALID_FLOAT; + //! Specifies camera aspect ratio defined as view space width divided by height. + float cameraAspectRatio = INVALID_FLOAT; + //! Specifies which value represents an invalid (un-initialized) value in the motion vectors buffer + //! NOTE: This is only required if `cameraMotionIncluded` is set to false and SL needs to compute it. + float motionVectorsInvalidValue = INVALID_FLOAT; + + //! Specifies if depth values are inverted (value closer to the camera is higher) or not. + Boolean depthInverted = Boolean::eInvalid; + //! Specifies if camera motion is included in the MVec buffer. + Boolean cameraMotionIncluded = Boolean::eInvalid; + //! Specifies if motion vectors are 3D or not. + Boolean motionVectors3D = Boolean::eInvalid; + //! Specifies if previous frame has no connection to the current one (i.e. motion vectors are invalid) + Boolean reset = Boolean::eInvalid; + //! Specifies if orthographic projection is used or not. + Boolean orthographicProjection = Boolean::eFalse; + //! Specifies if motion vectors are already dilated or not. + Boolean motionVectorsDilated = Boolean::eFalse; + //! Specifies if motion vectors are jittered or not. + Boolean motionVectorsJittered = Boolean::eFalse; + + //! Version 2 members: + //! + //! Optional heuristic that specifies the minimum depth difference between two objects in screen-space. + //! The units of the value are in linear depth units. + //! Linear depth is computed as: + //! if depthInverted is false: `lin_depth = 1 / (1 - depth)` + //! if depthInverted is true: `lin_depth = 1 / depth` + //! + //! Although unlikely to need to be modified, smaller thresholds are useful when depth units are + //! unusually compressed into a small dynamic range near 1. + //! + //! If not specified, the default value is 40.0f. + float minRelativeLinearDepthObjectSeparation = 40.0f; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +} diff --git a/NVIDIA/sl_reflex.h b/NVIDIA/sl_reflex.h new file mode 100644 index 0000000..9612592 --- /dev/null +++ b/NVIDIA/sl_reflex.h @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#pragma once + +namespace sl +{ + +enum ReflexMode +{ + eOff, + eLowLatency, + eLowLatencyWithBoost, +}; + +// {F03AF81A-6D0B-4902-A651-C4965E215434} +SL_STRUCT(ReflexOptions, StructType({ 0xf03af81a, 0x6d0b, 0x4902, { 0xa6, 0x51, 0xc4, 0x96, 0x5e, 0x21, 0x54, 0x34 } }), kStructVersion1) + //! Specifies which mode should be used + ReflexMode mode = ReflexMode::eOff; + //! Specifies if frame limiting (FPS cap) is enabled (0 to disable, microseconds otherwise). + //! One benefit of using Reflex's FPS cap over other implementations is the driver would be aware and can provide better optimizations. + //! This setting is independent of ReflexOptions::mode; it can even be used with eReflexModeOff. + uint32_t frameLimitUs = 0; + //! Specifies if markers can be used for optimization or not. Set to true UNLESS (if any of the below apply, set to false): + //! - The game is single threaded (i.e. simulation for frame X+1 cannot start until render submission for frame X is done) + //! - The present call is not called right after render submission + //! - Simulation does not happen exactly once per render frame + bool useMarkersToOptimize = false; + //! Specifies the hot-key which should be used instead of custom message for PC latency marker + //! Possible values: VK_F13, VK_F14, VK_F15 + uint16_t virtualKey = 0; + //! ThreadID for reflex messages + uint32_t idThread = 0; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +// {0D569B37-A1C8-4453-BE4D-40F4DE57952B} +SL_STRUCT(ReflexReport, StructType({ 0xd569b37, 0xa1c8, 0x4453, { 0xbe, 0x4d, 0x40, 0xf4, 0xde, 0x57, 0x95, 0x2b } }), kStructVersion1) + //! Various latency related stats + uint64_t frameID{}; + uint64_t inputSampleTime{}; + uint64_t simStartTime{}; + uint64_t simEndTime{}; + uint64_t renderSubmitStartTime{}; + uint64_t renderSubmitEndTime{}; + uint64_t presentStartTime{}; + uint64_t presentEndTime{}; + uint64_t driverStartTime{}; + uint64_t driverEndTime{}; + uint64_t osRenderQueueStartTime{}; + uint64_t osRenderQueueEndTime{}; + uint64_t gpuRenderStartTime{}; + uint64_t gpuRenderEndTime{}; + uint32_t gpuActiveRenderTimeUs{}; + uint32_t gpuFrameTimeUs{}; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +// {F0BB5985-DAF9-4728-B2FD-AE80A2BD7989} +SL_STRUCT(ReflexState, StructType({ 0xf0bb5985, 0xdaf9, 0x4728, { 0xb2, 0xfd, 0xae, 0x80, 0xa2, 0xbd, 0x79, 0x89 } }), kStructVersion1) + //! Specifies if low-latency mode is available or not + bool lowLatencyAvailable = false; + //! Specifies if the frameReport below contains valid data or not + bool latencyReportAvailable = false; + //! Specifies low latency Windows message id (if ReflexOptions::virtualKey is 0) + uint32_t statsWindowMessage; + //! Reflex report per frame + ReflexReport frameReport[64]; + //! Specifies ownership of flash indicator toggle (true = driver, false = application) + bool flashIndicatorDriverControlled = false; + + //! IMPORTANT: New members go here or if optional can be chained in a new struct, see sl_struct.h for details +}; + +enum ReflexMarker +{ + eSimulationStart, + eSimulationEnd, + eRenderSubmitStart, + eRenderSubmitEnd, + ePresentStart, + ePresentEnd, + eInputSample, + eTriggerFlash, + ePCLatencyPing, + eOutOfBandRenderSubmitStart, + eOutOfBandRenderSubmitEnd, + eOutOfBandPresentStart, + eOutOfBandPresentEnd +}; + +// {E268B3DC-F963-4C37-9776-AF048E132621} +SL_STRUCT(ReflexHelper, StructType({ 0xe268b3dc, 0xf963, 0x4c37, { 0x97, 0x76, 0xaf, 0x4, 0x8e, 0x13, 0x26, 0x21 } }), kStructVersion1) + ReflexHelper(ReflexMarker m) : BaseStructure(ReflexHelper::s_structType, kStructVersion1), marker(m) {}; + operator ReflexMarker () const { return marker; }; +private: + ReflexMarker marker; +}; + + +} + +//! Provides Reflex settings +//! +//! Call this method to check if Reflex is on, get stats etc. +//! +//! @param state Reference to a structure where states are returned +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +using PFun_slReflexGetState = sl::Result(sl::ReflexState& state); + +//! Sets Reflex marker +//! +//! Call this method to set specific Reflex marker +//! +//! @param marker Specifies which marker to use +//! @param frame Specifies current frame +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is thread safe. +using PFun_slReflexSetMarker = sl::Result(sl::ReflexMarker marker, const sl::FrameToken& frame); + +//! Tells reflex to sleep the app +//! +//! Call this method to invoke Reflex sleep in your application. +//! +//! @param frame Specifies current frame +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is thread safe. +using PFun_slReflexSleep = sl::Result(const sl::FrameToken& frame); + +//! Sets Reflex options +//! +//! Call this method to turn Reflex on/off, change mode etc. +//! +//! @param options Specifies options to use +//! @return sl::ResultCode::eOk if successful, error code otherwise (see sl_result.h for details) +//! +//! This method is NOT thread safe. +using PFun_slReflexSetOptions = sl::Result(const sl::ReflexOptions& options); + +//! HELPERS +//! +inline sl::Result slReflexGetState(sl::ReflexState& state) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeatureReflex, slReflexGetState); + return s_slReflexGetState(state); +} + +inline sl::Result slReflexSetMarker(sl::ReflexMarker marker, const sl::FrameToken& frame) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeatureReflex, slReflexSetMarker); + return s_slReflexSetMarker(marker, frame); +} + +inline sl::Result slReflexSleep(const sl::FrameToken& frame) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeatureReflex, slReflexSleep); + return s_slReflexSleep(frame); +} + +inline sl::Result slReflexSetOptions(const sl::ReflexOptions& options) +{ + SL_FEATURE_FUN_IMPORT_STATIC(sl::kFeatureReflex, slReflexSetOptions); + return s_slReflexSetOptions(options); +} diff --git a/NVIDIA/sl_result.h b/NVIDIA/sl_result.h new file mode 100644 index 0000000..05a3c7e --- /dev/null +++ b/NVIDIA/sl_result.h @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#pragma once + +namespace sl +{ + +enum class Result +{ + eOk, + eErrorIO, + eErrorDriverOutOfDate, + eErrorOSOutOfDate, + eErrorOSDisabledHWS, + eErrorDeviceNotCreated, + eErrorNoSupportedAdapterFound, + eErrorAdapterNotSupported, + eErrorNoPlugins, + eErrorVulkanAPI, + eErrorDXGIAPI, + eErrorD3DAPI, + eErrorNRDAPI, + eErrorNVAPI, + eErrorReflexAPI, + eErrorNGXFailed, + eErrorJSONParsing, + eErrorMissingProxy, + eErrorMissingResourceState, + eErrorInvalidIntegration, + eErrorMissingInputParameter, + eErrorNotInitialized, + eErrorComputeFailed, + eErrorInitNotCalled, + eErrorExceptionHandler, + eErrorInvalidParameter, + eErrorMissingConstants, + eErrorDuplicatedConstants, + eErrorMissingOrInvalidAPI, + eErrorCommonConstantsMissing, + eErrorUnsupportedInterface, + eErrorFeatureMissing, + eErrorFeatureNotSupported, + eErrorFeatureMissingHooks, + eErrorFeatureFailedToLoad, + eErrorFeatureWrongPriority, + eErrorFeatureMissingDependency, + eErrorFeatureManagerInvalidState, + eErrorInvalidState, + eWarnOutOfVRAM +}; + +} diff --git a/NVIDIA/sl_struct.h b/NVIDIA/sl_struct.h new file mode 100644 index 0000000..7080985 --- /dev/null +++ b/NVIDIA/sl_struct.h @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#pragma once + +#include +#include + +namespace sl +{ + +//! GUID +struct StructType +{ + unsigned long data1; + unsigned short data2; + unsigned short data3; + unsigned char data4[8]; + + inline bool operator==(const StructType& rhs) const { return memcmp(this, &rhs, sizeof(*this)) == 0; } + inline bool operator!=(const StructType& rhs) const { return memcmp(this, &rhs, sizeof(*this)) != 0; } +}; + +//! SL is using typed and versioned structures which can be chained or not. +//! +//! --- OPTION 1 --- +//! +//! New members must be added at the end and version needs to be increased: +//! +//! SL_STRUCT(S1, GUID1, kStructVersion1) +//! { +//! A +//! B +//! C +//! } +//! +//! SL_STRUCT(S1, GUID1, kStructVersion2) // Note that version is bumped +//! { +//! // V1 +//! A +//! B +//! C +//! +//! //! V2 - new members always go at the end! +//! D +//! E +//! } +//! +//! Here is one example on how to check for version and handle backwards compatibility: +//! +//! void func(const S1* input) +//! { +//! // Access A, B, C as needed +//! ... +//! if (input->structVersion >= kStructVersion2) +//! { +//! // Safe to access D, E +//! } +//! } + + +//! --- OPTION 2 --- +//! +//! New members are optional and added to a new struct which is then chained as needed: +//! +//! SL_STRUCT(S1, GUID1, kStructVersion1) +//! { +//! A +//! B +//! C +//! } +//! +//! SL_STRUCT(S2, GUID2, kStructVersion1) // Note that this is a different struct with new GUID +//! { +//! D +//! E +//! } +//! +//! S1 s1; +//! S2 s2 +//! s1.next = &s2; // optional parameters in S2 + +//! IMPORTANT: New members in the structure always go at the end! +//! +constexpr uint32_t kStructVersion1 = 1; +constexpr uint32_t kStructVersion2 = 2; +constexpr uint32_t kStructVersion3 = 3; + +struct BaseStructure +{ + BaseStructure() = delete; + BaseStructure(StructType t, uint32_t v) : structType(t), structVersion(v) {}; + BaseStructure* next{}; + StructType structType{}; + size_t structVersion; +}; + +#define SL_STRUCT(name, guid, version) \ +struct name : public BaseStructure \ +{ \ + name() : BaseStructure(guid, version){} \ + constexpr static StructType s_structType = guid; \ + +#define SL_STRUCT_PROTECTED(name, guid, version) \ +struct name : public BaseStructure \ +{ \ +protected: \ + name() : BaseStructure(guid, version){} \ +public: \ + constexpr static StructType s_structType = guid; \ + +} // namespace sl diff --git a/NVIDIA/sl_version.h b/NVIDIA/sl_version.h new file mode 100644 index 0000000..a24e159 --- /dev/null +++ b/NVIDIA/sl_version.h @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +#pragma once + +#define SL_VERSION_MAJOR 2 +#define SL_VERSION_MINOR 2 +#define SL_VERSION_PATCH 1 + +#include + +namespace sl +{ +constexpr uint64_t kSDKVersionMagic = 0xfedc; +constexpr uint64_t kSDKVersion = (uint64_t(SL_VERSION_MAJOR) << 48) | (uint64_t(SL_VERSION_MINOR) << 32) | (uint64_t(SL_VERSION_PATCH) << 16) | kSDKVersionMagic; + +struct Version +{ + Version() : major(0), minor(0), build(0) {}; + Version(uint32_t v1, uint32_t v2, uint32_t v3) : major(v1), minor(v2), build(v3) {}; + + inline operator bool() const { return major != 0 || minor != 0 || build != 0; } + + inline std::string toStr() const + { + return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(build); + } + inline std::wstring toWStr() const + { + return std::to_wstring(major) + L"." + std::to_wstring(minor) + L"." + std::to_wstring(build); + } + inline std::wstring toWStrOTAId() const + { + return std::to_wstring((major << 16) | (minor << 8) | build); + } + inline bool operator==(const Version& rhs) const + { + return major == rhs.major && minor == rhs.minor && build == rhs.build; + } + inline bool operator>(const Version& rhs) const + { + if (major < rhs.major) return false; + else if (major > rhs.major) return true; + // major version the same + if (minor < rhs.minor) return false; + else if (minor > rhs.minor) return true; + // minor version the same + if (build < rhs.build) return false; + else if (build > rhs.build) return true; + // build version the same + return false; + }; + inline bool operator>=(const Version& rhs) const + { + return operator>(rhs) || operator==(rhs); + }; + inline bool operator<(const Version& rhs) const + { + if (major > rhs.major) return false; + else if (major < rhs.major) return true; + // major version the same + if (minor > rhs.minor) return false; + else if (minor < rhs.minor) return true; + // minor version the same + if (build > rhs.build) return false; + else if (build < rhs.build) return true; + // build version the same + return false; + }; + inline bool operator<=(const Version& rhs) const + { + return operator<(rhs) || operator==(rhs); + }; + + uint32_t major; + uint32_t minor; + uint32_t build; +}; + +} diff --git a/Qwilight.cmd b/Qwilight.cmd new file mode 100644 index 0000000..5a18bd1 --- /dev/null +++ b/Qwilight.cmd @@ -0,0 +1,94 @@ +@ECHO OFF + +SET /P DATE=v + +SET VS2022=%PROGRAMFILES%\Microsoft Visual Studio\2022\Community +SET MSBUILD=%VS2022%\Msbuild\Current\Bin\MSBuild.exe +SET BANDIZIP=%PROGRAMFILES%\Bandizip\bz.exe +SET WIN10X64=bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64 +SET PUBLISH=Qwilight\%WIN10X64%\publish + +DEL Qwilight.zip + +CALL CI + +CHOICE /M TEST +SET TEST=%ERRORLEVEL% +IF %TEST% == 1 ( + RMDIR /S /Q Test\%WIN10X64% + Robocopy Test\qpdgo\Bundle Test\%WIN10X64%\qpdgo\Bundle /MIR + MKDIR Test\%WIN10X64%\qpdgo\UI + "%BANDIZIP%" x -target:auto Test\qpdgo\UI\*.zip Test\%WIN10X64%\qpdgo\UI +) +IF %TEST% == 1 ( + dotnet test Test\Test.csproj -c Release -p:Platform=x64 +) +IF %TEST% == 1 ( + IF NOT %ERRORLEVEL% == 0 ( + PAUSE + ) +) +IF %TEST% == 1 ( + RMDIR /S /Q %PUBLISH% + dotnet publish Qwilight\Qwilight.csproj -c Release -p:Platform=x64 + %PUBLISH%\Qwilight.exe --language 1033 --test +) +IF %TEST% == 1 ( + IF NOT %ERRORLEVEL% == 0 ( + ECHO %ERRORLEVEL% + PAUSE + ) +) +IF %TEST% == 1 ( + RMDIR /S /Q %PUBLISH% + dotnet publish Qwilight\Qwilight.csproj -c Release -p:Platform=x64 + %PUBLISH%\Qwilight.exe --language 1042 --test +) +IF %TEST% == 1 ( + IF NOT %ERRORLEVEL% == 0 ( + ECHO %ERRORLEVEL% + PAUSE + ) +) + +RMDIR /S /Q %PUBLISH% +dotnet publish Qwilight\Qwilight.csproj -c Release -p:Platform=x64 +"%BANDIZIP%" c -storeroot:no Qwilight.zip %PUBLISH% + +powershell $(CertUtil -hashfile %PUBLISH%\Qwilight.dll SHA512)[1] > Qwilight.dll.sha512sum +SET /P BUILD= < Qwilight.dll.sha512sum +DEL Qwilight.dll.sha512sum + +CHOICE /M PATCH +IF %ERRORLEVEL% == 1 ( + Robocopy . \\taehui\taehui Qwilight.zip + wsl ssh taehui@taehui sudo chown root:root Qwilight.zip + wsl ssh taehui@taehui sudo mv Qwilight.zip /var/www/html/qwilight/Qwilight.zip + curl -X PATCH taehui:8300/date -d "%DATE% %BUILD%" +) + +CHOICE /M VALVE +SET VALVE=%ERRORLEVEL% +IF %VALVE% == 1 ( + SET /P ID=ID: + SET /P PW=PW: +) +IF %VALVE% == 1 ( + Qwilight\sdk\tools\ContentBuilder\builder\steamcmd +login %ID% %PW% +run_app_build ..\scripts\simple_app_build.vdf +quit +) +IF %VALVE% == 1 ( + IF %ERRORLEVEL% == 0 ( + start https://partner.steamgames.com/apps/builds/1910130 + ) +) + +CHOICE /M VCS +IF %ERRORLEVEL% == 1 ( + git add * + git commit -m "v%DATE% (%BUILD%)" + git checkout master + git merge develop + git push + git checkout develop + git push +) \ No newline at end of file diff --git a/Qwilight.sln b/Qwilight.sln new file mode 100644 index 0000000..7db7fdd --- /dev/null +++ b/Qwilight.sln @@ -0,0 +1,106 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qwilight", "Qwilight\Qwilight.csproj", "{DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Flint", "Flint\Flint.vcxproj", "{B884FBA6-70F9-49A1-9A87-1BC08A7B769C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4B3D349E-EBBF-407E-B292-F46D0627DAD8}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Xwindow", "Xwindow\Xwindow.vcxproj", "{40DF1CA3-B540-43F4-9302-F4663F21C466}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Language", "Language\Language.csproj", "{95328446-0A79-406C-95E0-41174F10FB2C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NVIDIA", "NVIDIA\NVIDIA.vcxproj", "{F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compatible", "Compatible\Compatible.csproj", "{448E8FC9-B6AC-4309-A315-D6CB9B464843}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Igniter", "Igniter\Igniter.csproj", "{9E9B7E8A-2617-4CCE-8431-34B97550E75B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Debug|ARM64.Build.0 = Debug|ARM64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Debug|x64.ActiveCfg = Debug|x64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Debug|x64.Build.0 = Debug|x64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Release|ARM64.ActiveCfg = Release|ARM64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Release|ARM64.Build.0 = Release|ARM64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Release|x64.ActiveCfg = Release|x64 + {DC2524E7-943B-4AA6-8BB2-AE2930A9D75D}.Release|x64.Build.0 = Release|x64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Debug|ARM64.Build.0 = Debug|ARM64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Debug|x64.ActiveCfg = Debug|x64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Debug|x64.Build.0 = Debug|x64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Release|ARM64.ActiveCfg = Release|ARM64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Release|ARM64.Build.0 = Release|ARM64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Release|x64.ActiveCfg = Release|x64 + {B884FBA6-70F9-49A1-9A87-1BC08A7B769C}.Release|x64.Build.0 = Release|x64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Debug|ARM64.Build.0 = Debug|ARM64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Debug|x64.ActiveCfg = Debug|x64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Debug|x64.Build.0 = Debug|x64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Release|ARM64.ActiveCfg = Release|ARM64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Release|ARM64.Build.0 = Release|ARM64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Release|x64.ActiveCfg = Release|x64 + {40DF1CA3-B540-43F4-9302-F4663F21C466}.Release|x64.Build.0 = Release|x64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Debug|ARM64.Build.0 = Debug|ARM64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Debug|x64.ActiveCfg = Debug|x64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Debug|x64.Build.0 = Debug|x64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Release|ARM64.ActiveCfg = Release|ARM64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Release|ARM64.Build.0 = Release|ARM64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Release|x64.ActiveCfg = Release|x64 + {95328446-0A79-406C-95E0-41174F10FB2C}.Release|x64.Build.0 = Release|x64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Debug|ARM64.Build.0 = Debug|ARM64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Debug|x64.ActiveCfg = Debug|x64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Debug|x64.Build.0 = Debug|x64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Release|ARM64.ActiveCfg = Release|ARM64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Release|ARM64.Build.0 = Release|ARM64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Release|x64.ActiveCfg = Release|x64 + {F2BA185C-449D-4CC6-81AB-6F6D54F90FD7}.Release|x64.Build.0 = Release|x64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Debug|ARM64.Build.0 = Debug|ARM64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Debug|x64.ActiveCfg = Debug|x64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Debug|x64.Build.0 = Debug|x64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Release|ARM64.ActiveCfg = Release|ARM64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Release|ARM64.Build.0 = Release|ARM64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Release|x64.ActiveCfg = Release|x64 + {F4391BFA-AC83-4BDC-A552-F6CE1AAF5014}.Release|x64.Build.0 = Release|x64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Debug|ARM64.Build.0 = Debug|ARM64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Debug|x64.ActiveCfg = Debug|x64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Debug|x64.Build.0 = Debug|x64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Release|ARM64.ActiveCfg = Release|ARM64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Release|ARM64.Build.0 = Release|ARM64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Release|x64.ActiveCfg = Release|x64 + {448E8FC9-B6AC-4309-A315-D6CB9B464843}.Release|x64.Build.0 = Release|x64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Debug|ARM64.Build.0 = Debug|ARM64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Debug|x64.ActiveCfg = Debug|x64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Debug|x64.Build.0 = Debug|x64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Release|ARM64.ActiveCfg = Release|ARM64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Release|ARM64.Build.0 = Release|ARM64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Release|x64.ActiveCfg = Release|x64 + {9E9B7E8A-2617-4CCE-8431-34B97550E75B}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {05A05012-6698-49F3-86B5-FE227ACA994A} + EndGlobalSection +EndGlobal diff --git a/Qwilight/AssemblyInfo.cs b/Qwilight/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/Qwilight/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Qwilight/Assets/ARM64/concrt140_app.dll b/Qwilight/Assets/ARM64/concrt140_app.dll new file mode 100644 index 0000000..43fffda --- /dev/null +++ b/Qwilight/Assets/ARM64/concrt140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4db7af9b413a1701dd1dcb160fcf278e17fe853df00ab7e464a5ae0cdac7f210 +size 57736 diff --git a/Qwilight/Assets/ARM64/msvcp140_1_app.dll b/Qwilight/Assets/ARM64/msvcp140_1_app.dll new file mode 100644 index 0000000..72511a4 --- /dev/null +++ b/Qwilight/Assets/ARM64/msvcp140_1_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf85b18bfed5c2fe272191710f4a94bf89b073444559485d3c207428e1e14d0f +size 18824 diff --git a/Qwilight/Assets/ARM64/msvcp140_2_app.dll b/Qwilight/Assets/ARM64/msvcp140_2_app.dll new file mode 100644 index 0000000..d847e17 --- /dev/null +++ b/Qwilight/Assets/ARM64/msvcp140_2_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7801f087c4bd562078c7add3703f0f17e960d559347c6ae661b087d7d53e6676 +size 21384 diff --git a/Qwilight/Assets/ARM64/msvcp140_app.dll b/Qwilight/Assets/ARM64/msvcp140_app.dll new file mode 100644 index 0000000..87d2645 --- /dev/null +++ b/Qwilight/Assets/ARM64/msvcp140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63b81d6b4ee93c8009c13fd25a66a5ebd1bdd98ba4c760877a460f93b05db81f +size 257928 diff --git a/Qwilight/Assets/ARM64/vcamp140_app.dll b/Qwilight/Assets/ARM64/vcamp140_app.dll new file mode 100644 index 0000000..815c3ab --- /dev/null +++ b/Qwilight/Assets/ARM64/vcamp140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cf01007508805206da47e5da1d9f3fdcd1fe173db35517acf4dcbca837908f8 +size 46984 diff --git a/Qwilight/Assets/ARM64/vccorlib140_app.dll b/Qwilight/Assets/ARM64/vccorlib140_app.dll new file mode 100644 index 0000000..fbc611c --- /dev/null +++ b/Qwilight/Assets/ARM64/vccorlib140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55c69e9d09a29a84a423a38be7b8604e892b909b6e07ecace6278fc0c7977645 +size 50568 diff --git a/Qwilight/Assets/ARM64/vcomp140_app.dll b/Qwilight/Assets/ARM64/vcomp140_app.dll new file mode 100644 index 0000000..85b7607 --- /dev/null +++ b/Qwilight/Assets/ARM64/vcomp140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c06e8cf98d5777ec057ab14e14a63a91e3ff64ccc5513099f0af5931c010f760 +size 24960 diff --git a/Qwilight/Assets/ARM64/vcruntime140_app.dll b/Qwilight/Assets/ARM64/vcruntime140_app.dll new file mode 100644 index 0000000..7192c1d --- /dev/null +++ b/Qwilight/Assets/ARM64/vcruntime140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b874df3ab7d4d3e0eba5e2c54ed7c5affcc3674600c806fa42f8e8725bdb0466 +size 22408 diff --git a/Qwilight/Assets/ARM64/windowsappruntimeinstall-arm64.exe b/Qwilight/Assets/ARM64/windowsappruntimeinstall-arm64.exe new file mode 100644 index 0000000..8f23cb4 --- /dev/null +++ b/Qwilight/Assets/ARM64/windowsappruntimeinstall-arm64.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f34fb90e1f95191c222ca5543f08e3b30fb9b15b96db689cbf887dd0ea5fafc1 +size 64191520 diff --git a/Qwilight/Assets/Audio/Postable Item/HigherAudioMultiplier.wav b/Qwilight/Assets/Audio/Postable Item/HigherAudioMultiplier.wav new file mode 100644 index 0000000..f16a1d6 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/HigherAudioMultiplier.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/LowerAudioMultiplier.wav b/Qwilight/Assets/Audio/Postable Item/LowerAudioMultiplier.wav new file mode 100644 index 0000000..410e529 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/LowerAudioMultiplier.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/Negative4D.wav b/Qwilight/Assets/Audio/Postable Item/Negative4D.wav new file mode 100644 index 0000000..61e547d --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/Negative4D.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/NegativeFading.wav b/Qwilight/Assets/Audio/Postable Item/NegativeFading.wav new file mode 100644 index 0000000..6e6839c --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/NegativeFading.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/NegativeFaint.wav b/Qwilight/Assets/Audio/Postable Item/NegativeFaint.wav new file mode 100644 index 0000000..dee1e0e --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/NegativeFaint.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/NegativeHitPoints.wav b/Qwilight/Assets/Audio/Postable Item/NegativeHitPoints.wav new file mode 100644 index 0000000..e4a8e42 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/NegativeHitPoints.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/NegativeJudgment.wav b/Qwilight/Assets/Audio/Postable Item/NegativeJudgment.wav new file mode 100644 index 0000000..f324b3f --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/NegativeJudgment.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/NegativeTrapNotes.wav b/Qwilight/Assets/Audio/Postable Item/NegativeTrapNotes.wav new file mode 100644 index 0000000..13e2855 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/NegativeTrapNotes.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/NegativeZip.wav b/Qwilight/Assets/Audio/Postable Item/NegativeZip.wav new file mode 100644 index 0000000..3a1e582 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/NegativeZip.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/Pause.wav b/Qwilight/Assets/Audio/Postable Item/Pause.wav new file mode 100644 index 0000000..aca5a5f --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/Pause.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/PositiveAegis.wav b/Qwilight/Assets/Audio/Postable Item/PositiveAegis.wav new file mode 100644 index 0000000..7963436 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/PositiveAegis.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/PositiveHitPoints.wav b/Qwilight/Assets/Audio/Postable Item/PositiveHitPoints.wav new file mode 100644 index 0000000..7653046 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/PositiveHitPoints.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/PositiveJudgment.wav b/Qwilight/Assets/Audio/Postable Item/PositiveJudgment.wav new file mode 100644 index 0000000..268c2a0 --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/PositiveJudgment.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/Postable.wav b/Qwilight/Assets/Audio/Postable Item/Postable.wav new file mode 100644 index 0000000..efb926f --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/Postable.wav Binary files differ diff --git a/Qwilight/Assets/Audio/Postable Item/Posted.wav b/Qwilight/Assets/Audio/Postable Item/Posted.wav new file mode 100644 index 0000000..730d0ca --- /dev/null +++ b/Qwilight/Assets/Audio/Postable Item/Posted.wav Binary files differ diff --git a/Qwilight/Assets/Client.json b/Qwilight/Assets/Client.json new file mode 100644 index 0000000..fb495b9 --- /dev/null +++ b/Qwilight/Assets/Client.json @@ -0,0 +1,4 @@ +{ + "valve": 1910130, + "platform": "943111512887795752" +} diff --git a/Qwilight/Assets/Drawing/Assist/Group Entry 0.png b/Qwilight/Assets/Drawing/Assist/Group Entry 0.png new file mode 100644 index 0000000..ea04ee4 --- /dev/null +++ b/Qwilight/Assets/Drawing/Assist/Group Entry 0.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Assist/Group Entry 1.png b/Qwilight/Assets/Drawing/Assist/Group Entry 1.png new file mode 100644 index 0000000..f7ee821 --- /dev/null +++ b/Qwilight/Assets/Drawing/Assist/Group Entry 1.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Assist/Input Mapping 0.png b/Qwilight/Assets/Drawing/Assist/Input Mapping 0.png new file mode 100644 index 0000000..40ee3d2 --- /dev/null +++ b/Qwilight/Assets/Drawing/Assist/Input Mapping 0.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Assist/Input Mapping 1.png b/Qwilight/Assets/Drawing/Assist/Input Mapping 1.png new file mode 100644 index 0000000..5e64e73 --- /dev/null +++ b/Qwilight/Assets/Drawing/Assist/Input Mapping 1.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Assist/Input Mapping 2.png b/Qwilight/Assets/Drawing/Assist/Input Mapping 2.png new file mode 100644 index 0000000..5a8eb8b --- /dev/null +++ b/Qwilight/Assets/Drawing/Assist/Input Mapping 2.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Assist/Input Mapping 3.png b/Qwilight/Assets/Drawing/Assist/Input Mapping 3.png new file mode 100644 index 0000000..41defec --- /dev/null +++ b/Qwilight/Assets/Drawing/Assist/Input Mapping 3.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Loading.png b/Qwilight/Assets/Drawing/Loading.png new file mode 100644 index 0000000..d74c06e --- /dev/null +++ b/Qwilight/Assets/Drawing/Loading.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Platform.png b/Qwilight/Assets/Drawing/Platform.png new file mode 100644 index 0000000..686489c --- /dev/null +++ b/Qwilight/Assets/Drawing/Platform.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Qwilight.png b/Qwilight/Assets/Drawing/Qwilight.png new file mode 100644 index 0000000..d74c06e --- /dev/null +++ b/Qwilight/Assets/Drawing/Qwilight.png Binary files differ diff --git a/Qwilight/Assets/Drawing/TV.png b/Qwilight/Assets/Drawing/TV.png new file mode 100644 index 0000000..4b304ae --- /dev/null +++ b/Qwilight/Assets/Drawing/TV.png Binary files differ diff --git a/Qwilight/Assets/Drawing/Valve.png b/Qwilight/Assets/Drawing/Valve.png new file mode 100644 index 0000000..5217871 --- /dev/null +++ b/Qwilight/Assets/Drawing/Valve.png Binary files differ diff --git a/Qwilight/Assets/Language.json b/Qwilight/Assets/Language.json new file mode 100644 index 0000000..77bc775 --- /dev/null +++ b/Qwilight/Assets/Language.json @@ -0,0 +1,3566 @@ +{ + "_4DModeContents": { + "ko-KR": "모든 노트가 고유의 스크롤 속도를 가집니다.", + "en-US": "Different scroll speed for every note" + }, + "AbilityStandContents": { + "ko-KR": "{0} 점 (+ {1} Point)", + "en-US": "{0} Points (+ {1} Points)" + }, + "AegisPostedItemText": { + "ko-KR": "{0}의 {1}를 방어함", + "en-US": "Defends {1} of {0}" + }, + "AllowEssentialInputs": { + "ko-KR": "◀, ▶ 키 등을 키 설정에 허용", + "en-US": "Allow key settings such as ◀, ▶ keys, etc" + }, + "AllowTotalLevyingText": { + "ko-KR": "모두 준비", + "en-US": "All ready" + }, + "AllowTwilightCommentAssist": { + "ko-KR": "온라인 랭킹 등록을 허용합니다.", + "en-US": "Allow online ranking registration." + }, + "AlreadyAvatarID": { + "ko-KR": "이미 가입된 아이디입니다.", + "en-US": "This ID is already registered." + }, + "AlreadyLatestDate": { + "ko-KR": "새 버전이 존재하지 않습니다. 강제로 업데이트 할까요?", + "en-US": "Already up to date. Do you want to force an update?" + }, + "AlreadyLoadingBundle": { + "ko-KR": "이미 꾸러미 전송이 진행중입니다.", + "en-US": "Package transfer is already in progress." + }, + "AlwaysNotP2PositionContents": { + "ko-KR": "DP 에서 1P와 2P를 붙힙니다.", + "en-US": "Attach 1P and 2P on the DP." + }, + "AlwaysNotP2PositionText": { + "ko-KR": "1P와 2P 붙이기", + "en-US": "Attach 1P to 2P" + }, + "AlwaysP2PositionContents": { + "ko-KR": "DP 에서 1P와 2P를 분리합니다.", + "en-US": "Separate 1P and 2P from DP." + }, + "AlwaysP2PositionText": { + "ko-KR": "1P와 2P 분리하기", + "en-US": "Separate 1P and 2P" + }, + "AlwaysText": { + "ko-KR": "항상", + "en-US": "Always" + }, + "AlwaysViewContents": { + "ko-KR": "항상 출력", + "en-US": "Always output" + }, + "Assist0": { + "ko-KR": "SPACE: 게임 설정", + "en-US": "SPACE: Game Settings" + }, + "Assist1": { + "ko-KR": "◀, ▶: 난이도 선택", + "en-US": "◀, ▶: Select Difficulty Level" + }, + "Assist2": { + "ko-KR": "F1: 도움말", + "en-US": "F1: Help" + }, + "Assist3": { + "ko-KR": "F5, F6: 새로고침", + "en-US": "F5, F6: Refresh" + }, + "Assist4": { + "ko-KR": "F7: 다운로더", + "en-US": "F7: Downloader" + }, + "Assist5": { + "ko-KR": "F8: 멀티 플레이", + "en-US": "F8: Multiplay" + }, + "Assist6": { + "ko-KR": "F9: 컬렉션", + "en-US": "F9: Collection" + }, + "Assist7": { + "ko-KR": "F10: 도전 과제", + "en-US": "F10: Challenges" + }, + "Assist8": { + "ko-KR": "F11: 알림", + "en-US": "F11: Notifications" + }, + "Assister": { + "ko-KR": "만든이들", + "en-US": "Makers" + }, + "AssistText": { + "ko-KR": "도움말", + "en-US": "Help" + }, + "AudioAssister": { + "ko-KR": "사운드 제공", + "en-US": "Sound provided" + }, + "AudioComponentConfigure": { + "ko-KR": "오디오 모듈 정보", + "en-US": "Audio Module Information" + }, + "AudioConfigureText": { + "ko-KR": "사운드 설정", + "en-US": "Sound settings" + }, + "AudioDataContents": { + "ko-KR": "오디오 버퍼 크기를 설정합니다.", + "en-US": "Set the audio buffer size" + }, + "AudioDateHTMLText": { + "ko-KR": "업데이트 내역 보기", + "en-US": "View update history" + }, + "AudioDateText": { + "ko-KR": "오디오 모듈 버전입니다.", + "en-US": "Audio module version" + }, + "AudioHandlerItemCountText": { + "ko-KR": "메모리에 올라온 오디오 인스턴스의 개수입니다.", + "en-US": "Number of audio instances loaded to memory" + }, + "AudioInputConfigure": { + "ko-KR": "음성 대화 설정", + "en-US": "Voice chat settings" + }, + "AudioInputValueContents": { + "ko-KR": "음성 대화 감도를 설정합니다.", + "en-US": "Set the sensitivity of voice chat." + }, + "AudioItemCountText": { + "ko-KR": "메모리에 올라온 오디오 파일의 개수입니다.", + "en-US": "Number of audio files loaded to memory" + }, + "AudioModeContents": { + "ko-KR": "오디오 출력 모드를 설정합니다.", + "en-US": "Set the audio output mode" + }, + "AudioMultiplierAtoneText": { + "ko-KR": "피치 보정", + "en-US": "Pitch calibration" + }, + "AudioMultiplierContents": { + "ko-KR": "음악 속도", + "en-US": "Music speed" + }, + "AudioMultiplierWarning": { + "ko-KR": "음악 속도가 {0} 입니다. 의도한게 맞나요?", + "en-US": "The music speed is {0}. Is that what you meant?" + }, + "AudioUnitUsageText": { + "ko-KR": "오디오 모듈에 걸린 부하입니다.", + "en-US": "Audio module load" + }, + "AudioValueContents": { + "ko-KR": "오디오 출력 장비를 설정합니다.", + "en-US": "Set the audio output device" + }, + "AudioVarietyASIOAssist": { + "ko-KR": "낮은 레이턴시를 가지는 Steinberg사의 API 입니다.", + "en-US": "Steinberg's API for low latency audio" + }, + "AudioVarietyText": { + "ko-KR": "오디오 출력 API를 설정합니다.", + "en-US": "Set up the audio output API." + }, + "AudioVarietyWASAPIAssist": { + "ko-KR": "윈도우 비스타부터 도입된 기본 사운드 API 입니다.", + "en-US": "Default sound API introduced by Windows Vista" + }, + "AudioVisualizerConfigure": { + "ko-KR": "오디오 비주얼라이저 설정", + "en-US": "Audio visualizer settings" + }, + "AudioVisualizerCountText": { + "ko-KR": "오디오 비주얼라이저의 막대기 개수입니다.", + "en-US": "Number of bars in the audio visualizer." + }, + "AudioVisualizerFaintContents": { + "ko-KR": "오디오 비주얼라이저 불투명도", + "en-US": "Audio visualizer opacity" + }, + "AudioVisualizerInputColor": { + "ko-KR": "\uD83C\uDFA8 키음 비주얼라이저", + "en-US": "\uD83C\uDFA8 Keysound audio visualizer" + }, + "AudioVisualizerMainColor": { + "ko-KR": "\uD83C\uDFA8 BGM 비주얼라이저", + "en-US": "\uD83C\uDFA8 BGM Visualizer" + }, + "AudioVisualizerMode0Contents": { + "ko-KR": "위에서 아래로", + "en-US": "From top to bottom" + }, + "AudioVisualizerMode1Contents": { + "ko-KR": "중앙", + "en-US": "Center" + }, + "AudioVisualizerMode2Contents": { + "ko-KR": "아래에서 위로", + "en-US": "From bottom to top" + }, + "AudioVisualizerModeText": { + "ko-KR": "오디오 비주얼라이저를 어떤 방향으로 그릴지 설정합니다.", + "en-US": "Sets the direction in which the audio visualizer is drawn." + }, + "AudioWaitContents": { + "ko-KR": "오디오 레이턴시를 설정합니다.", + "en-US": "Audio latency" + }, + "AuraContents": { + "ko-KR": "ASUS® Aura™를 사용합니다.", + "en-US": "Use ASUS® Aura™" + }, + "AuraText": { + "ko-KR": "ASUS® Aura™ 활성화", + "en-US": "Enable ASUS® Aura™" + }, + "AutoableInputNoteCountViewColor": { + "ko-KR": "\uD83C\uDFA8 턴 테이블 NPS 비주얼라이저", + "en-US": "\uD83C\uDFA8 Turntable NPS graph" + }, + "AutoableLimiterVariety": { + "ko-KR": "턴 테이블", + "en-US": "Turntable" + }, + "AutoableModeContents": { + "ko-KR": "턴 테이블만 자동으로 처리합니다.", + "en-US": "Auto turntable mode" + }, + "AutoComputeContents": { + "ko-KR": "미리듣기를 사용합니다.", + "en-US": "Enable preview." + }, + "AutoComputeText": { + "ko-KR": "미리듣기 활성화", + "en-US": "Enable preview" + }, + "AutoComputingSituationContents": { + "ko-KR": "노트 파일 감상 중… ({0})", + "en-US": "Listening to charts… ({0})" + }, + "AutoEdgeText": { + "ko-KR": "가능한 경우 다운로드만 받으면 Qwilight가 알아서 불러옵니다.", + "en-US": "If available, just download it and Qwilight will load it for you." + }, + "AutoEnterContents": { + "ko-KR": "자동으로 대화방에 입장합니다.", + "en-US": "Enter the chat room automatically." + }, + "AutoEnterDefaultSiteContents": { + "ko-KR": "일반 대화방에 자동으로 입장할지 설정합니다.", + "en-US": "Set automatic entry to General chat room" + }, + "AutoEnterNotifySiteContents": { + "ko-KR": "알림방에 자동으로 입장할지 설정합니다.", + "en-US": "Set automatic entry to Notification room" + }, + "AutoEnterPlatformSiteContents": { + "ko-KR": "디스코드 대화방에 자동으로 입장할지 설정합니다.", + "en-US": "Set automatic entry to Discord chat room" + }, + "AutoEnterSignedInContents": { + "ko-KR": "로그인 후 자동으로 대화방에 입장합니다.", + "en-US": "After logging in, you automatically enter the chat room." + }, + "AutoHighlightContents": { + "ko-KR": "미리듣기를 하이라이트부터 시작합니다.", + "en-US": "Start with the highlight of the preview." + }, + "AutoHighlightText": { + "ko-KR": "하이라이트부터 시작", + "en-US": "Start with highlights" + }, + "AutoLevyingContents": { + "ko-KR": "미리듣기를 처음부터 시작합니다.", + "en-US": "Start the preview from the beginning." + }, + "AutoLevyingText": { + "ko-KR": "처음부터 시작", + "en-US": "Start from beginning" + }, + "AutoLongNoteMode": { + "ko-KR": "롱 노트를 계속 눌러도 됩니다.", + "en-US": "Free long note release judgment mode" + }, + "AutoModeAssist": { + "ko-KR": "플레이 방식을 설정합니다.", + "en-US": "Set playstyle" + }, + "AutoModeContents": { + "ko-KR": "자동으로 플레이합니다.", + "en-US": "Play automatically." + }, + "AutoNetLevyingText": { + "ko-KR": "자동 준비", + "en-US": "Auto ready" + }, + "AutoSaltAssist": { + "ko-KR": "미리듣기 순서를 임의로 설정합니다.", + "en-US": "Random preview order" + }, + "AutoSignIn": { + "ko-KR": "자동 로그인", + "en-US": "Autologin" + }, + "AutoSiteHandText": { + "ko-KR": "호스트 돌아가면서 하기", + "en-US": "Take turns with the host" + }, + "AutoText": { + "ko-KR": "자동", + "en-US": "Automatic" + }, + "AvatarCipher": { + "ko-KR": "비밀번호", + "en-US": "Password" + }, + "AvatarCipherTest": { + "ko-KR": "비밀번호 확인", + "en-US": "Confirm password" + }, + "AvatarCountContents": { + "ko-KR": "#,##0 명", + "en-US": "#,##0 people" + }, + "AvatarEdgeText": { + "ko-KR": "프레임 선택", + "en-US": "Select Frame" + }, + "AvatarID": { + "ko-KR": "아이디", + "en-US": "ID" + }, + "AvatarName": { + "ko-KR": "닉네임", + "en-US": "Nickname" + }, + "AvatarText": { + "ko-KR": "프로필", + "en-US": "Profile" + }, + "AvatarTitleText": { + "ko-KR": "호칭 선택", + "en-US": "Select a title" + }, + "AvatarViewAbilityContents": { + "ko-KR": "성과 TOP 50", + "en-US": "Rating Top 50" + }, + "AvatarViewDateContents": { + "ko-KR": "활동 추세", + "en-US": "Activity Trends" + }, + "AvatarViewDateText": { + "ko-KR": "마지막 접속일: {0}", + "en-US": "Last access date: {0}" + }, + "AvatarViewFavoritesContents": { + "ko-KR": "가장 많이 플레이 TOP 10", + "en-US": "Top 10 most played" + }, + "AvatarViewHighestCountText": { + "ko-KR": "기록 개수: {0} 회", + "en-US": "Record count: {0}" + }, + "AvatarViewIntro": { + "ko-KR": "자기소개", + "en-US": "Introduce yourself" + }, + "AvatarViewLastsContents": { + "ko-KR": "마지막 플레이 TOP 10", + "en-US": "Recently played 10" + }, + "AvatarViewQuitContents": { + "ko-KR": "랭크", + "en-US": "Rank" + }, + "AvatarViewText": { + "ko-KR": "닉네임: {0} ({1})", + "en-US": "Nickname: {0} ({1})" + }, + "AvatarViewTotalCountText": { + "ko-KR": "플레이 횟수: {0} 회", + "en-US": "Number of plays: {0}" + }, + "AvatarViewTotalLengthText": { + "ko-KR": "플레이 시간: {0} 시간 {1} 분 {2} 초", + "en-US": "Playtime: {0} hours {1} minutes {2} seconds" + }, + "AvatarViewWwwLevelContents": { + "ko-KR": "달성한 도전 과제 ({0} 개)", + "en-US": "Achieved challenges ({0})" + }, + "AveragerContents": { + "ko-KR": "모든 곡의 음량을 적절히 설정합니다.", + "en-US": "Set the volume for all songs appropriately." + }, + "AveragerText": { + "ko-KR": "노멀라이즈 활성화", + "en-US": "Normalize enabled" + }, + "BanalAudioContents": { + "ko-KR": "모든 노트에 범용 키음을 추가로 할당합니다.", + "en-US": "Assign an additional universal key tone to all notes." + }, + "BanalAudioText": { + "ko-KR": "범용 키음 활성화", + "en-US": "Enable universal keysound" + }, + "BanalFailedMediaContents": { + "ko-KR": "범용 미스 레이어를 사용합니다.", + "en-US": "Universal miss layer setting" + }, + "BanalFailedMediaText": { + "ko-KR": "범용 미스 레이어 활성화", + "en-US": "Enable universal miss layer" + }, + "BanalMediaContents": { + "ko-KR": "범용 BGA를 사용합니다.", + "en-US": "Use the universal BGA." + }, + "BanalMediaText": { + "ko-KR": "범용 BGA 활성화", + "en-US": "Enable Universal BGA" + }, + "Band": { + "ko-KR": "콤보", + "en-US": "Combo" + }, + "BandContents": { + "ko-KR": "0 콤보", + "en-US": "0 combo." + }, + "BandLegend": { + "ko-KR": "■ 콤보", + "en-US": "■ Combo" + }, + "BandPositionContents": { + "ko-KR": "콤보 높이", + "en-US": "Combo Height" + }, + "BandValidHunterModeText": { + "ko-KR": "콤보 우선", + "en-US": "Combo first" + }, + "BannedNoteFileContents": { + "ko-KR": "이 노트 파일은 온라인 랭킹에 등록되지 않습니다.", + "en-US": "This chart is not registered in the online ranking." + }, + "BeforeEventNoteContents": { + "ko-KR": "같은 설정을 가진 코스가 이미 존재합니다.", + "en-US": "A course with the same settings already exists." + }, + "BPMModeAssist": { + "ko-KR": "BPM을 설정합니다.", + "en-US": "Sets the BPM." + }, + "BPMVarietyAudioMultiplierText": { + "ko-KR": "BPM×음악 속도", + "en-US": "BPM x Music speed" + }, + "BPMVarietyContents": { + "ko-KR": "게임 플레이 중 나오는 BPM을 설정합니다.", + "en-US": "Set the BPM that comes out during game play." + }, + "BPMVarietyMultiplierText": { + "ko-KR": "BPM×음악 속도×스크롤 속도", + "en-US": "BPM x Music speed x Scroll speed" + }, + "BundleAvatarContents": { + "ko-KR": "회원만 공개", + "en-US": "Only the members will be revealed." + }, + "BundleCallableContents": { + "ko-KR": "모두에게 공개", + "en-US": "Reveal it to everyone." + }, + "BundleEntryContents": { + "ko-KR": "꾸러미", + "en-US": "Packages" + }, + "BundleText": { + "ko-KR": "꾸러미 목록", + "en-US": "Package List" + }, + "BundleUbuntuContents": { + "ko-KR": "친구만 공개", + "en-US": "Reveal only friends" + }, + "BundleVoidContents": { + "ko-KR": "비공개", + "en-US": "Private" + }, + "BWContents": { + "ko-KR": "RAZER® Chroma™를 사용합니다.", + "en-US": "Use RAZER® Chroma™" + }, + "BWText": { + "ko-KR": "RAZER® Chroma™ 활성화", + "en-US": "Enable RAZER® Chroma™" + }, + "CallingIOContents": { + "ko-KR": "호스트를 기다리는 중…", + "en-US": "Waiting for host…" + }, + "CallIO": { + "ko-KR": "관전 요청", + "en-US": "Spectator request" + }, + "CallSiteAssist": { + "ko-KR": "방 목록 열기", + "en-US": "Open room list" + }, + "CanBeTwilightCommentContents": { + "ko-KR": "온라인 랭킹에 등록됩니다.", + "en-US": "You will be registered in the online ranking." + }, + "CannotBeTwilightCommentContents": { + "ko-KR": "온라인 랭킹에 등록되지 않습니다.", + "en-US": "You will not be registered in the online ranking." + }, + "CannotIOContents": { + "ko-KR": "해당 플레이어는 관전이 불가능합니다.", + "en-US": "The player is not allowed to watch." + }, + "CenterLimiterVariety": { + "ko-KR": "중앙", + "en-US": "Center" + }, + "ColorText": { + "ko-KR": "색상 선택", + "en-US": "Select Color" + }, + "CommentAssist": { + "ko-KR": "랭킹 열기", + "en-US": "Open Ranking" + }, + "CommentComputingSituationContents": { + "ko-KR": "리플레이 보는 중… ({0})", + "en-US": "Watching Replay… ({0})" + }, + "CommentSiteName": { + "ko-KR": "성과 알림방", + "en-US": "Performance notification room" + }, + "CommentText": { + "ko-KR": "랭킹", + "en-US": "Ranking" + }, + "CompileFaultText": { + "ko-KR": "올바르지 않은 노트 파일입니다. ({0})", + "en-US": "Invalid chart. ({0})" + }, + "CompilingBinText": { + "ko-KR": "노트 파일을 읽을 때 사용할 스레드 개수입니다.", + "en-US": "Number of threads to use when reading charts." + }, + "ComponentConfigure": { + "ko-KR": "성능 설정", + "en-US": "Performance Settings" + }, + "ComputingConfigureText": { + "ko-KR": "플레이 설정", + "en-US": "Play Settings" + }, + "ComputingGUIConfigure": { + "ko-KR": "비주얼 설정", + "en-US": "Visual Settings" + }, + "ComputingModeComponentConfigure": { + "ko-KR": "게임 모드", + "en-US": "Game mode" + }, + "ComputingUIConfigure": { + "ko-KR": "스킨 설정", + "en-US": "Skin Settings" + }, + "ConfigureAssist": { + "ko-KR": "게임 설정 열기", + "en-US": "Open game settings" + }, + "ConfigureBaseUIContents": { + "ko-KR": "테마 스킨", + "en-US": "Theme Skin" + }, + "ConfigureEtcUIContents": { + "ko-KR": "스킨 세부 설정", + "en-US": "Detailed skin settings" + }, + "ConfigureFontFamilyContents": { + "ko-KR": "순서대로 글꼴 모양을 설정합니다.", + "en-US": "Sets the font appearance in order." + }, + "ConfigureLevelContents": { + "ko-KR": "사용할 난이도 테이블을 설정합니다.", + "en-US": "Set the difficulty table to use" + }, + "ConfigurePutNoteSetContents": { + "ko-KR": "대상 비율", + "en-US": "Target Ratio" + }, + "ConfigurePutNoteSetMillisContents": { + "ko-KR": "대상 간격", + "en-US": "Target Interval" + }, + "ConfigureText": { + "ko-KR": "게임 설정", + "en-US": "Game Settings" + }, + "ConfigureUIContents": { + "ko-KR": "인게임 스킨", + "en-US": "In-game skin" + }, + "ControllerConfigure": { + "ko-KR": "컨트롤러 설정", + "en-US": "Controller Settings" + }, + "ControllerCountContents": { + "ko-KR": "{0} 개의 컨트롤러가 인식됨", + "en-US": "{0} controllers recognized" + }, + "ControllerViewerContents": { + "ko-KR": "실시간으로 받은 컨트롤러 입력 신호입니다.", + "en-US": "Controller input signal received in real time" + }, + "CopyPutCopyNotesText": { + "ko-KR": "노트 복사하기", + "en-US": "Copying notes" + }, + "CountContents": { + "ko-KR": "#,##0 개", + "en-US": "#,##0" + }, + "CounterWaveModeContents": { + "ko-KR": "거꾸로 플레이합니다.", + "en-US": "Play backwards" + }, + "DataCount3Contents": { + "ko-KR": "삼중 버퍼링을 사용합니다.", + "en-US": "Set triple buffering" + }, + "DataCount3Text": { + "ko-KR": "삼중 버퍼링 활성화", + "en-US": "Enable triple buffering" + }, + "DateAssistText": { + "ko-KR": "업데이트 내역", + "en-US": "Update History" + }, + "DBConfigure": { + "ko-KR": "데이터베이스 설정", + "en-US": "Database Settings" + }, + "DefaultAudioVarietyContents": { + "ko-KR": "노트 파일 목록에서 들리는 BGM 입니다.", + "en-US": "This is the BGM heard in the note file list." + }, + "DefaultBPMModeContents": { + "ko-KR": "BPM을 그대로 둡니다.", + "en-US": "Don't change BPM" + }, + "DefaultBundleCompetenceContents": { + "ko-KR": "꾸러미로 업로드 기본 권한을 설정합니다.", + "en-US": "Set the default permissions for uploading as a package." + }, + "DefaultComment": { + "ko-KR": "오프라인", + "en-US": "Offline" + }, + "DefaultComputeInNetSiteFault": { + "ko-KR": "일반 플레이를 하시려면 먼저 멀티방에서 나가주세요", + "en-US": "If you want to play normally, please leave the multi-room first" + }, + "DefaultComputingSituationContents": { + "ko-KR": "게임 플레이 중… ({0})", + "en-US": "Playing games… ({0})" + }, + "DefaultConfigureText": { + "ko-KR": "일반 설정", + "en-US": "General settings" + }, + "DefaultControllerDefaultInputContents": { + "ko-KR": "성능이 좋습니다.", + "en-US": "Good performance." + }, + "DefaultControllerDefaultInputText": { + "ko-KR": "RawInput™ 모드", + "en-US": "RawInput™ Mode" + }, + "DefaultControllerDInputContents": { + "ko-KR": "호환성이 좋습니다.", + "en-US": "Good compatibility." + }, + "DefaultControllerDInputText": { + "ko-KR": "DirectInput™ 모드", + "en-US": "DirectInput™ Mode" + }, + "DefaultControllerViewerContents": { + "ko-KR": "실시간으로 받은 키보드 입력 신호입니다.", + "en-US": "Keyboard input signal received in real time" + }, + "DefaultDrawingContents": { + "ko-KR": "범용 이미지입니다.", + "en-US": "This is a universal image." + }, + "DefaultFaintNoteModeContents": { + "ko-KR": "노트 밝기를 그대로 둡니다.", + "en-US": "Leave the note brightness unchanged" + }, + "DefaultGPUMode": { + "ko-KR": "기본 그래픽", + "en-US": "Basic graphics" + }, + "DefaultHitPointsModeContents": { + "ko-KR": "기본 라이프 게이지 입니다.", + "en-US": "Normal gauge mode" + }, + "DefaultInputAudioVariety": { + "ko-KR": "DJMAX 방식", + "en-US": "DJMAX method" + }, + "DefaultInputAudioVarietyAssist": { + "ko-KR": "다음 노트의 키음을 출력합니다.", + "en-US": "Output the next key sound" + }, + "DefaultJudgmentModeContents": { + "ko-KR": "기본 판정 난이도입니다.", + "en-US": "Default judgment" + }, + "DefaultLongNoteMode": { + "ko-KR": "롱 노트의 떼는 판정을 노트 파일에 따라 결정합니다.", + "en-US": "Default long note release judgment" + }, + "DefaultLowestJudgmentConditionModeContents": { + "ko-KR": "간접 미스를 추가하지 않습니다.", + "en-US": "Disable indirect miss" + }, + "DefaultMobilityMode": { + "ko-KR": "노트가 정상적으로 내려옵니다.", + "en-US": "Normal note scrolling" + }, + "DefaultModeContents": { + "ko-KR": "턴 테이블을 수동으로 처리합니다.", + "en-US": "Handles the turntable." + }, + "DefaultNoteAssister": { + "ko-KR": "기본곡 제공", + "en-US": "Basic song provided" + }, + "DefaultNoteModifyContents": { + "ko-KR": "롱 노트 모드를 적용하지 않습니다.", + "en-US": "Does not apply long note mode." + }, + "DefaultPutCopyNotesText": { + "ko-KR": "노트 복사하지 않기", + "en-US": "Don't copy notes" + }, + "DefaultSaltModeContents": { + "ko-KR": "노트에 미러나 랜덤을 적용하지 않습니다.", + "en-US": "Do not apply mirrors or random to notes." + }, + "DefaultSetNoteModeContents": { + "ko-KR": "추가 노트를 배치하지 않습니다.", + "en-US": "Do not place additional notes." + }, + "DefaultSiteName": { + "ko-KR": "일반 대화방", + "en-US": "General chat room" + }, + "DefaultUIAssister": { + "ko-KR": "추가 스킨 제공", + "en-US": "Additional skin provided" + }, + "DefaultWaveModeContents": { + "ko-KR": "앞으로 플레이합니다.", + "en-US": "Play forwards" + }, + "DetailedConfigure": { + "ko-KR": "고급 설정 모드", + "en-US": "Advanced settings mode" + }, + "DetailedConfigureText": { + "ko-KR": "고급 설정", + "en-US": "Advanced settings" + }, + "DInputContents": { + "ko-KR": "대부분의 비트콘이 사용하는 DirectInput™을 사용합니다.", + "en-US": "Use DirectInput™, which most Beatcons use." + }, + "DInputControllerVarietyText": { + "ko-KR": "DirectInput™ 컨트롤러 종류를 설정합니다.", + "en-US": "Set the DirectInput™ controller type." + }, + "DInputIIDXSensitivityText": { + "ko-KR": "IIDX 컨트롤러 턴 테이블 정지 속도를 설정합니다.", + "en-US": "Sets the IIDX controller turntable stop rate." + }, + "DInputText": { + "ko-KR": "DirectInput™ 모드", + "en-US": "DirectInput™ mode" + }, + "DInputXyzSensitivityText": { + "ko-KR": "컨트롤러 턴 테이블 민감도를 설정합니다.", + "en-US": "Sets the controller turntable sensitivity." + }, + "DrawingComponentConfigure": { + "ko-KR": "이미지 모듈 정보", + "en-US": "Image Module Information" + }, + "DrawingItemCountText": { + "ko-KR": "메모리에 올라온 이미지 파일의 개수입니다.", + "en-US": "Number of image files loaded to memory" + }, + "Easy4DModeContents": { + "ko-KR": "모든 라인이 고유의 스크롤 속도를 가집니다.", + "en-US": "Different scroll speed for every line" + }, + "EasyZipModeContents": { + "ko-KR": "노트가 압축되다가 다시 튀어오릅니다.", + "en-US": "The note bounces" + }, + "EditedNoteFileFault": { + "ko-KR": "노트 파일 수정이 감지되어 플레이를 중단합니다. F5 키로 노트 파일을 다시 불러오세요", + "en-US": "A chart modification was detected and play is stopped. Reload the chart with F5" + }, + "EditorConfigureFault": { + "ko-KR": "먼저 에디터를 수동으로 실행하여 에디터 설정 파일을 만드세요", + "en-US": "First, run the editor manually to create the editor settings file" + }, + "EditorContents": { + "ko-KR": "에디터 실행", + "en-US": "Run Editor" + }, + "EditorSoftwareFault": { + "ko-KR": "에디터 실행이 불가능합니다. ({0})", + "en-US": "Editor cannot run ({0})" + }, + "EnterAutoComputeConfigure": { + "ko-KR": "라이브 컨트롤", + "en-US": "Live control" + }, + "EnterAutoComputeMediaInputConfigure": { + "ko-KR": "웹캠을 렌더링할 사각 영역을 드래그하세요", + "en-US": "Drag the square area to render the webcam" + }, + "EnterAutoComputeUIConfigure": { + "ko-KR": "슬라이더를 사용하여 실시간으로 설정하세요", + "en-US": "Use the slider to set it in real time" + }, + "EnterSiteCipherContents": { + "ko-KR": "이 방에 입장하기 위하여 비밀번호를 입력하세요", + "en-US": "Please enter your password to enter this room." + }, + "EnterSiteInputContents": { + "ko-KR": "참가하기", + "en-US": "To participate" + }, + "EqualizerContents": { + "ko-KR": "5 밴드 이퀄라이저를 설정합니다.", + "en-US": "Set the 5-band equalizer." + }, + "EqualizerText": { + "ko-KR": "이퀄라이저 설정", + "en-US": "Equalizer Settings" + }, + "EventNote": { + "ko-KR": "코스", + "en-US": "Course" + }, + "EventNoteBundleText": { + "ko-KR": "BMS 코스", + "en-US": "BMS course" + }, + "EventNoteEntryContents": { + "ko-KR": "코스", + "en-US": "Course" + }, + "EventNoteNameAssist": { + "ko-KR": "코스 이름을 입력하세요", + "en-US": "Enter the course name" + }, + "ExileAvatar": { + "ko-KR": "추방", + "en-US": "Kick" + }, + "F5Notify0": { + "ko-KR": "{0} 폴더의 노트 파일들을 다시 불러올까요?", + "en-US": "Reload charts in folder {0}?" + }, + "F5Notify1": { + "ko-KR": "{0} 폴더의 노트 파일들을 다시 불러올까요? 아니면 {1} 폴더만 불러옵니다.", + "en-US": "Reload charts in folder {0}? Otherwise, only the {1} folder is loaded." + }, + "FadingNoteModeContents": { + "ko-KR": "노트가 깜빡입니다.", + "en-US": "The notes blink" + }, + "FailedDrawingMillisText": { + "ko-KR": "미스 레이어가 얼마나 지속될지 설정합니다.", + "en-US": "Set how long the miss layer will last." + }, + "FailedHitPointsModeContents": { + "ko-KR": "틀리면 바로 게임 오버됩니다.", + "en-US": "If you miss, it's game over." + }, + "FailedValidation": { + "ko-KR": "입력이 올바르지 않습니다.", + "en-US": "The input is not valid." + }, + "FailedVibrationModeText": { + "ko-KR": "노트를 놓칠 때", + "en-US": "When you miss a note" + }, + "FaintNoteAssist": { + "ko-KR": "노트의 밝기를 설정합니다.", + "en-US": "Set note brightness" + }, + "FaintNoteModeContents": { + "ko-KR": "노트가 점점 어두워집니다.", + "en-US": "The notes fade in" + }, + "FastInputMillisContents": { + "ko-KR": "채터링 방지를 위하여 빠른 키 입력을 무시합니다.", + "en-US": "Ignore quick keystrokes to prevent chattering." + }, + "FaultCommentContents": { + "ko-KR": "손상된 리플레이 파일입니다. ({0})", + "en-US": "Corrupt replay file. ({0})" + }, + "FaultStillDrawing": { + "ko-KR": "화면 캡처가 불가능합니다. ({0})", + "en-US": "Screen capture not possible. ({0})" + }, + "FavorAudioMultiplierText": { + "ko-KR": "사용자 지정 음악 속도", + "en-US": "Custom Music Rate" + }, + "FavorDefaultAudioVarietyText": { + "ko-KR": "커스텀 BGM 활성화", + "en-US": "Enabling Custom BGM" + }, + "FavorHitPoints0Unit": { + "ko-KR": "토탈 비례 수치", + "en-US": "Total proportional figure" + }, + "FavorHitPoints1Unit": { + "ko-KR": "절대 수치", + "en-US": "Absolute number" + }, + "FavorHitPointsModeContents": { + "ko-KR": "사용자 지정 라이프 게이지를 사용합니다.", + "en-US": "Custom life gauge mode" + }, + "FavorHitPointsNameAssist": { + "ko-KR": "프리셋 이름을 입력하세요", + "en-US": "Please enter a preset name" + }, + "FavoriteEntryText": { + "ko-KR": "컬렉션 목록", + "en-US": "Collection List" + }, + "FavorJudgmentModeContents": { + "ko-KR": "사용자 지정 판정 난이도를 사용합니다.", + "en-US": "Use custom judgment mode" + }, + "FavorJudgmentNameAssist": { + "ko-KR": "프리셋 이름을 입력하세요", + "en-US": "Please enter a preset name" + }, + "FavorMediaInputContents": { + "ko-KR": "사용자 지정 영역에 웹캠을 렌더링합니다.", + "en-US": "Renders the webcam to a custom area." + }, + "FavorModeComponentText": { + "ko-KR": "사용자 지정 게임 모드", + "en-US": "Custom game mode" + }, + "FavorMultiplierText": { + "ko-KR": "사용자 지정 스크롤 속도", + "en-US": "Custom scroll speed" + }, + "FavorNoteFileText": { + "ko-KR": "사용자 지정 난이도", + "en-US": "Custom difficulty level" + }, + "Fax": { + "ko-KR": "이메일", + "en-US": "E-mail" + }, + "FitAssist": { + "ko-KR": "정렬 방식을 설정합니다.", + "en-US": "Sets the sorting method." + }, + "FitDefaultEntry": { + "ko-KR": "이름순 정렬", + "en-US": "Sort by Name" + }, + "FlangeContents": { + "ko-KR": "플랜지 이펙트를 사용합니다.", + "en-US": "Use flanger effect" + }, + "FlangeText": { + "ko-KR": "플랜지 활성화", + "en-US": "Enable Flanger" + }, + "FlowNetItemContents": { + "ko-KR": "실시간 랭킹이 부드럽게 이동합니다.", + "en-US": "Real-time ranking moves smoothly." + }, + "FlowNetItemText": { + "ko-KR": "실시간 랭킹 애니메이션 활성화", + "en-US": "Enable real-time ranking animation" + }, + "FontFamilyAssist": { + "ko-KR": "텍스트를 입력하여 글꼴 미리보기", + "en-US": "Type text to preview fonts" + }, + "FontFamilyText": { + "ko-KR": "글꼴 목록", + "en-US": "Font List" + }, + "FrontEntryText": { + "ko-KR": "의존 폴더 목록", + "en-US": "List of dependent folders" + }, + "GASWarning": { + "ko-KR": "라이프가 0이 되면 죽지 않고 다음 게이지로 자동으로 내려가므로 그냥 매우 빡빡한 게이지로 플레이하는 걸 권장합니다.", + "en-US": "When life goes to zero, it doesn't die and automatically goes down to the next gauge, so I recommend just playing with a very hard gauge." + }, + "GetMediaInputContents": { + "ko-KR": "웹캠 장비를 설정합니다.", + "en-US": "Set up the webcam." + }, + "GetMediaInputText": { + "ko-KR": "웹캠 장비 업데이트", + "en-US": "Update webcam" + }, + "GetMIDIText": { + "ko-KR": "MIDI 장비 업데이트", + "en-US": "Update MIDI Equipment" + }, + "GetQwilightFault": { + "ko-KR": "업데이트가 불가능합니다. ({0})", + "en-US": "Update is not possible. ({0})" + }, + "GetQwilightText": { + "ko-KR": "업데이트", + "en-US": "Update" + }, + "GetWaveInValuesText": { + "ko-KR": "입력 장비 업데이트", + "en-US": "Update input device" + }, + "GetWaveValuesText": { + "ko-KR": "출력 장비 업데이트", + "en-US": "Update output device" + }, + "GetWwwLevel": { + "ko-KR": "코스 다운로드", + "en-US": "Download course" + }, + "GPUModeModified": { + "ko-KR": "게임을 다시 시작한 후 그래픽 출력 API가 적용됩니다.", + "en-US": "After restarting the game, the graphics output API will be applied." + }, + "GPUModeText": { + "ko-KR": "그래픽 출력 API를 설정합니다.", + "en-US": "Set up the graphics output API." + }, + "GUIConfigureText": { + "ko-KR": "그래픽 설정", + "en-US": "Graphic Settings" + }, + "HalfInputSaltModeContents": { + "ko-KR": "노트 라인을 반으로 나눠서 임의 배치합니다. (하프 라인 랜덤)", + "en-US": "Half Line Random mode" + }, + "HandledBand1": { + "ko-KR": "풀콤보", + "en-US": "Full combo." + }, + "HandledClear": { + "ko-KR": "NM 클리어", + "en-US": "NM Clear" + }, + "HandledContents": { + "ko-KR": "#,##0 회", + "en-US": "#,##0 times" + }, + "HandledF": { + "ko-KR": "F 랭크", + "en-US": "F rank" + }, + "HandledHigherClear": { + "ko-KR": "HD 클리어", + "en-US": "HD Clear" + }, + "HandledHighestClear": { + "ko-KR": "VHD 클리어", + "en-US": "VHD Clear" + }, + "HandledNot": { + "ko-KR": "아직 안 함", + "en-US": "Not yet." + }, + "HandleFailedAudioCountText": { + "ko-KR": "노트를 놓칠 때 반응할 콤보를 설정합니다.", + "en-US": "Set a combo to respond to when you miss your note." + }, + "HandleFailedAudioText": { + "ko-KR": "노트를 놓칠 때 사운드를 출력할지 설정합니다.", + "en-US": "Set whether to output sound when you miss a note." + }, + "HandleInputAudioContents": { + "ko-KR": "키음을 사용합니다.", + "en-US": "Use the key sound." + }, + "HandleInputAudioText": { + "ko-KR": "키음 활성화", + "en-US": "Enable Keysounds" + }, + "HandleMeterContents": { + "ko-KR": "박자에 따라 스킨을 반응시킵니다.", + "en-US": "React the skin according to the beat." + }, + "HandleMeterText": { + "ko-KR": "박자 반응 활성화", + "en-US": "Enable beat response" + }, + "HandleUndoContents": { + "ko-KR": "다시 시도 ({0})", + "en-US": "Retry ({0})" + }, + "HandlingAudioCountText": { + "ko-KR": "출력중인 오디오 개수입니다.", + "en-US": "Number of audio being output" + }, + "HandlingCountContents": { + "ko-KR": "#,##0 개 출력", + "en-US": "#,##0 output" + }, + "HasNotEventNoteNoteFile": { + "ko-KR": "노트 파일을 먼저 불러오세요", + "en-US": "Load the chart file first." + }, + "HasNotIONoteFile": { + "ko-KR": "해당 플레이어의 노트 파일을 가지지 않아서 관전이 불가능합니다.", + "en-US": "You can't watch because you don't have the same chart as that player." + }, + "HasNotNetNoteFile": { + "ko-KR": "해당 멀티방의 노트 파일을 가지지 않아서 시작이 불가능합니다.", + "en-US": "It is impossible to start because it does not have the note file of the multi-room." + }, + "HellBPMContents": { + "ko-KR": "기믹 노트 파일만 보여줄지 설정합니다.", + "en-US": "Set whether to show only the gimmick note file." + }, + "HellBPMText": { + "ko-KR": "기믹 노트 파일만 보여줍니다.", + "en-US": "Show only the gimmick chart" + }, + "HigherAudioMultiplierContents": { + "ko-KR": "음악 속도 증가 ({0})", + "en-US": "Increase music speed ({0})" + }, + "HigherEntryContents": { + "ko-KR": "다음 폴더 ({0})", + "en-US": "Next folder ({0})" + }, + "HigherHitPointsModeContents": { + "ko-KR": "라이프 게이지가 빡빡해집니다. (GAS 적용)", + "en-US": "Hard gauge mode (with GAS)" + }, + "HigherJudgmentModeContents": { + "ko-KR": "판정 난이도가 어려워집니다.", + "en-US": "The judgment becomes strict" + }, + "HigherLongNoteMode": { + "ko-KR": "롱 노트가 끝날 때 손가락을 떼야합니다.", + "en-US": "Strict long note release judgment mode" + }, + "HigherMultiplierContents": { + "ko-KR": "스크롤 속도 증가 ({0})", + "en-US": "Increase scroll speed ({0})" + }, + "HigherNoteFileContents": { + "ko-KR": "다음 노트 파일 ({0})", + "en-US": "Next chart ({0})" + }, + "HighestHitPointsModeContents": { + "ko-KR": "라이프 게이지가 매우 빡빡해집니다. (GAS 적용)", + "en-US": "Very Hard gauge mode (with GAS)" + }, + "HighestJudgmentModeContents": { + "ko-KR": "판정 난이도가 매우 어려워집니다.", + "en-US": "Very hard judgment mode" + }, + "HighestLongNoteModify": { + "ko-KR": "가장 긴 노트 간격", + "en-US": "Longest note spacing" + }, + "HighestWantBPMContents": { + "ko-KR": "0 BPM 까지", + "en-US": "Up to 0 BPM" + }, + "HighestWantInputCountContents": { + "ko-KR": "0/s 까지", + "en-US": "Up to 0/s" + }, + "HighestWantLevelTextValue": { + "ko-KR": "0 난이도 까지", + "en-US": "Up to level 0" + }, + "HitPoints": { + "ko-KR": "라이프", + "en-US": "Life" + }, + "HitPointsLegend": { + "ko-KR": "■ 라이프 게이지", + "en-US": "■ Life Gauge" + }, + "HitPointsModeAssist": { + "ko-KR": "라이프 게이지를 설정합니다.", + "en-US": "Set the life gauge" + }, + "HunterVariety1stText": { + "ko-KR": "1등 기록", + "en-US": "First place record" + }, + "HunterVarietyContents": { + "ko-KR": "점수 격차의 기준을 설정합니다.", + "en-US": "Set the criteria for the score gap" + }, + "HunterVarietyFavorText": { + "ko-KR": "사용자 지정 점수", + "en-US": "Custom score" + }, + "HunterVarietyHigherText": { + "ko-KR": "선두 기록", + "en-US": "Lead record" + }, + "HunterVarietyLowerText": { + "ko-KR": "후미 기록", + "en-US": "Rear record" + }, + "HunterVarietyMeText": { + "ko-KR": "내 기록", + "en-US": "My record" + }, + "HwModeContents": { + "ko-KR": "디스플레이 해상도를 설정합니다.", + "en-US": "Sets the display resolution." + }, + "IIDXInputAudioVariety": { + "ko-KR": "IIDX 방식", + "en-US": "IIDX method" + }, + "IIDXInputAudioVarietyAssist": { + "ko-KR": "마지막으로 출력한 키음을 출력합니다.", + "en-US": "Output the previous key sound" + }, + "InitCommentContents": { + "ko-KR": "모든 오프라인 플레이 기록을 삭제합니다.", + "en-US": "Delete all offline play history." + }, + "InitCommentNotify": { + "ko-KR": "모든 오프라인 플레이 기록을 삭제할까요?", + "en-US": "Do you want to delete all play records?\nThe replay files will also be deleted." + }, + "InitCommentOK": { + "ko-KR": "모든 오프라인 플레이 기록이 성공적으로 삭제됨", + "en-US": "All play histories deleted successfully" + }, + "InitCommentText": { + "ko-KR": "모든 오프라인 플레이 기록 삭제", + "en-US": "Delete all offline play history" + }, + "InitCompiledContents": { + "ko-KR": "폴더를 빠르게 불러오는데 사용되는 모든 캐시를 삭제합니다.", + "en-US": "Deletes all cache used to quickly load folders." + }, + "InitCompiledNotify": { + "ko-KR": "모든 캐시를 삭제할까요?", + "en-US": "Delete all cache?" + }, + "InitCompiledOK": { + "ko-KR": "모든 캐시가 성공적으로 삭제됨", + "en-US": "All caches deleted successfully" + }, + "InitCompiledText": { + "ko-KR": "모든 캐시 삭제", + "en-US": "Delete All Caches" + }, + "InitFavoriteEntryContents": { + "ko-KR": "모든 컬렉션을 삭제합니다.", + "en-US": "Delete all collections." + }, + "InitFavoriteEntryNotify": { + "ko-KR": "모든 컬렉션을 삭제할까요?", + "en-US": "Delete all collections?" + }, + "InitFavoriteEntryOK": { + "ko-KR": "모든 컬렉션이 성공적으로 삭제됨", + "en-US": "All collections deleted successfully" + }, + "InitFavoriteEntryText": { + "ko-KR": "모든 컬렉션 삭제", + "en-US": "Delete all collections" + }, + "InitMediaContents": { + "ko-KR": "모든 노트 파일의 BGA 설정을 복원합니다.", + "en-US": "Restore the BGA settings for all note files." + }, + "InitMediaNotify": { + "ko-KR": "모든 노트 파일의 BGA 설정을 복원할까요?", + "en-US": "Restore BGA settings for all note files?" + }, + "InitMediaOK": { + "ko-KR": "모든 노트 파일의 BGA 설정이 성공적으로 복원됨", + "en-US": "BGA settings for all note files restored successfully" + }, + "InitMediaText": { + "ko-KR": "모든 BGA 설정 복원", + "en-US": "Restore all BGA settings" + }, + "InitModeComponent": { + "ko-KR": "게임 모드 복원", + "en-US": "Reset game mode" + }, + "InitTotalContents": { + "ko-KR": "게임 설정을 기본으로 복원합니다.", + "en-US": "Reset the game settings to their default settings." + }, + "InitTotalNotify": { + "ko-KR": "게임 설정을 기본으로 복원할까요?", + "en-US": "Do you want to restore the game settings to their default settings?" + }, + "InitTotalOK": { + "ko-KR": "게임 설정이 성공적으로 복원됨", + "en-US": "Game settings reset successfully" + }, + "InitTotalText": { + "ko-KR": "게임 설정 복원", + "en-US": "Reset game settings" + }, + "InitWaitContents": { + "ko-KR": "모든 노트 파일의 레이턴시를 0 ms로 복원합니다.", + "en-US": "Reset latency settings of all charts to 0 ms" + }, + "InitWaitNotify": { + "ko-KR": "모든 노트 파일의 레이턴시를 0 ms로 복원할까요?", + "en-US": "Reset the latency of all charts to 0 ms?" + }, + "InitWaitOK": { + "ko-KR": "모든 노트 파일의 레이턴시가 성공적으로 복원됨", + "en-US": "Latency of all charts reset successfully" + }, + "InitWaitText": { + "ko-KR": "모든 레이턴시 복원", + "en-US": "Reset all latency settings" + }, + "InputAudioVarietyText": { + "ko-KR": "키음 출력 방식을 설정합니다.", + "en-US": "Sets the key tone output method." + }, + "InputAudioVolume": { + "ko-KR": "키음", + "en-US": "Key sound" + }, + "InputConfigure": { + "ko-KR": "키보드 설정", + "en-US": "Keyboard Settings" + }, + "InputConfigureText": { + "ko-KR": "입력 설정", + "en-US": "Input Settings" + }, + "InputDefaultMode": { + "ko-KR": "노트 라인 개수를 수정하지 않습니다.", + "en-US": "Do not modify the number of note lines." + }, + "InputFavorMode10": { + "ko-KR": "10 키로 만듭니다.", + "en-US": "Force 10 keys" + }, + "InputFavorMode102": { + "ko-KR": "10 + 2 키로 만듭니다.", + "en-US": "Force 10 + 2 keys" + }, + "InputFavorMode142": { + "ko-KR": "14 + 2 키로 만듭니다.", + "en-US": "Force 14 + 2 keys" + }, + "InputFavorMode242": { + "ko-KR": "24 + 2 키로 만듭니다.", + "en-US": "Force 24 + 2 keys" + }, + "InputFavorMode4": { + "ko-KR": "4 키로 만듭니다.", + "en-US": "Force 4 keys." + }, + "InputFavorMode484": { + "ko-KR": "48 + 4 키로 만듭니다.", + "en-US": "Force 48 + 4 keys" + }, + "InputFavorMode5": { + "ko-KR": "5 키로 만듭니다.", + "en-US": "Force 5 keys" + }, + "InputFavorMode51": { + "ko-KR": "5 + 1 키로 만듭니다.", + "en-US": "Force 5 + 1 keys" + }, + "InputFavorMode6": { + "ko-KR": "6 키로 만듭니다.", + "en-US": "Force 6 keys" + }, + "InputFavorMode7": { + "ko-KR": "7 키로 만듭니다.", + "en-US": "Force 7 keys" + }, + "InputFavorMode71": { + "ko-KR": "7 + 1 키로 만듭니다.", + "en-US": "Force 7 + 1 keys" + }, + "InputFavorMode8": { + "ko-KR": "8 키로 만듭니다.", + "en-US": "Force 8 keys" + }, + "InputFavorMode9": { + "ko-KR": "9 키로 만듭니다.", + "en-US": "Force 9 keys" + }, + "InputFavorModeAssist": { + "ko-KR": "노트 라인 개수를 설정합니다.", + "en-US": "Sets the number of note lines." + }, + "InputMapText": { + "ko-KR": "1P와 2P의 턴 테이블 방향을 설정합니다.", + "en-US": "Set the turntable directions of 1P and 2P." + }, + "InputNoteCountViewColor": { + "ko-KR": "\uD83C\uDFA8 NPS 비주얼라이저", + "en-US": "\uD83C\uDFA8 NPS graph" + }, + "InputNoteSetContents": { + "ko-KR": "롱 노트를 단일 노트로 만듭니다.", + "en-US": "Turn long notes into single notes" + }, + "InputSaltCommentWarning": { + "ko-KR": "v1.14.26 이하 랜덤 게임 모드를 적용한 플레이는 리플레이가 호환되지 않습니다.", + "en-US": "Replay is not compatible for plays with random game modes below v1.14.26." + }, + "InputSaltModeContents": { + "ko-KR": "노트 라인을 임의 배치합니다. (라인 랜덤)", + "en-US": "Line Random mode" + }, + "InputVibrationModeText": { + "ko-KR": "버튼을 누를 때", + "en-US": "When you press the button" + }, + "InputWindowAssist0": { + "ko-KR": "◀: 이전 키", + "en-US": "◀: Previous Key" + }, + "InputWindowAssist1": { + "ko-KR": "▶: 다음 키", + "en-US": "▶: Next key." + }, + "InputWindowAssist2": { + "ko-KR": "←: 키 하나 지우기", + "en-US": "←: Clear one key" + }, + "InputWindowAssist3": { + "ko-KR": "DEL: 모든 키 지우기", + "en-US": "DEL: Clear all keys" + }, + "IOAvatarContents": { + "ko-KR": "회원의 관전 요청만 받음", + "en-US": "Only receive spectation requests from members" + }, + "IOCallableContents": { + "ko-KR": "모든 관전 요청 받음", + "en-US": "Receive all spectation requests" + }, + "IOCompetenceContents": { + "ko-KR": "관전 요청을 설정합니다.", + "en-US": "Set the spectation request" + }, + "IOComputingSituationContents": { + "ko-KR": "관전 중… ({0})", + "en-US": "Watching…({0})" + }, + "IOHigherContents": { + "ko-KR": "#,##0 명 관전 중…", + "en-US": "#,##0 people are spectating..." + }, + "IOLowerContents": { + "ko-KR": "{0} 관전 중…", + "en-US": "Spectating {0}…" + }, + "IOUbuntuContents": { + "ko-KR": "친구의 관전 요청만 받음", + "en-US": "Receive friends' spectation requests" + }, + "IOVoidContents": { + "ko-KR": "모든 관전 요청을 거절함", + "en-US": "Rejected all observation requests" + }, + "IsAudioInputContents": { + "ko-KR": "이 방의 음성 대화 참가", + "en-US": "Join voice chat in this room" + }, + "IsFailModeContents": { + "ko-KR": "라이프 게이지가 0이 되면 게임 오버됩니다.", + "en-US": "If the life gauge reaches zero, the game is over." + }, + "IsFailModeText": { + "ko-KR": "일반 모드", + "en-US": "Normal Mode" + }, + "IsGetNotifyContents": { + "ko-KR": "이 방의 알림 받기", + "en-US": "Get notifications for this room" + }, + "IsXwindowContents": { + "ko-KR": "실수를 방지하기 위하여 윈도우 키를 사용하지 않습니다.", + "en-US": "Disable the Windows key to prevent accidental presses" + }, + "JudgmentMainPosition1Contents": { + "ko-KR": "판정선 높이", + "en-US": "Judgment Line Height" + }, + "JudgmentMeterMillisText": { + "ko-KR": "판정 오차가 얼마 이상이면 보여줄지 설정합니다.", + "en-US": "Sets how much or more of a decision error is displayed." + }, + "JudgmentModeAssist": { + "ko-KR": "판정 난이도를 설정합니다.", + "en-US": "Set the judgment difficulty" + }, + "JudgmentStage": { + "ko-KR": "판정 난이도", + "en-US": "Judgment level" + }, + "JudgmentVisualizerMillisText": { + "ko-KR": "판정 비주얼라이저의 막대기가 얼마나 지속될지 설정합니다.", + "en-US": "Set how long the bar of the judgment visualizer will be visible." + }, + "K70Contents": { + "ko-KR": "CORSAIR® CUE™를 사용합니다.", + "en-US": "Use CORSAIR® CUE™" + }, + "K70Text": { + "ko-KR": "CORSAIR® CUE™ 활성화", + "en-US": "Enable CORSAIR® CUE™" + }, + "Level0Contents": { + "ko-KR": "미정", + "en-US": "Undetermined" + }, + "Level1Contents": { + "ko-KR": "초보자", + "en-US": "Beginner" + }, + "Level2Contents": { + "ko-KR": "일반", + "en-US": "Normal" + }, + "Level3Contents": { + "ko-KR": "어려움", + "en-US": "Hyper" + }, + "Level4Contents": { + "ko-KR": "더 어려움", + "en-US": "Another" + }, + "Level5Contents": { + "ko-KR": "아주 어려움", + "en-US": "Insane" + }, + "LevelInputContents": { + "ko-KR": "난이도 테이블의 주소를 입력하세요", + "en-US": "Please enter the address of the difficulty table." + }, + "LevelItem": { + "ko-KR": "난이도 테이블", + "en-US": "Difficulty table" + }, + "LevelSystemText": { + "ko-KR": "난이도 테이블 설정", + "en-US": "Setting the difficulty table" + }, + "LevelUpContents": { + "ko-KR": "레벨 업! 축하합니다.", + "en-US": "Level up! Congratulations!" + }, + "LevyNoteFileContents": { + "ko-KR": "게임 시작 ({0})", + "en-US": "Game Start ({0})" + }, + "LevyWwwLevel": { + "ko-KR": "도전 과제 플레이", + "en-US": "Challenge Play" + }, + "Library": { + "ko-KR": "오픈 소스 라이브러리", + "en-US": "Open Source Library" + }, + "Limiter57Variety": { + "ko-KR": "5/7 (24K2S, 48K4S 전용)", + "en-US": "5/7 (24K2S, 48K4S only)" + }, + "LimiterColor": { + "ko-KR": "\uD83C\uDFA8 라인 구분선", + "en-US": "\uD83C\uDFA8 Line divider" + }, + "LimiterVarietyContents": { + "ko-KR": "라인 구분선을 어느 라인에 놓을지 설정합니다.", + "en-US": "Set which lane to put the lane divider on." + }, + "LoadBanalAudio": { + "ko-KR": "범용 키음을 불러옵니다.", + "en-US": "Set universal keysound" + }, + "LoadBanalFailedMedia": { + "ko-KR": "범용 미스 레이어를 불러옵니다.", + "en-US": "Set universal miss layer" + }, + "LoadBanalMedia": { + "ko-KR": "범용 BGA를 불러옵니다.", + "en-US": "Set universal BGA" + }, + "LoadDefaultAudio": { + "ko-KR": "BGM을 불러옵니다.", + "en-US": "Load BGM." + }, + "LoadedModeComponent": { + "ko-KR": "【F{0}】{1} 불러옴", + "en-US": "【F{0}】{1} loaded" + }, + "LoadedMultiplier": { + "ko-KR": "【F{0}】{1} 불러옴 (속도만)", + "en-US": "【F{0}】{1} Loaded (speed only)" + }, + "LoadingBinText": { + "ko-KR": "노트 파일 목록을 불러올 때 사용할 스레드 개수입니다.", + "en-US": "Number of threads to use when recalling a list of charts." + }, + "LoadLevelFault": { + "ko-KR": "난이도 테이블이 올바르지 않습니다. ({0})", + "en-US": "The difficulty table is not correct. ({0})" + }, + "LongNoteModeAssist": { + "ko-KR": "롱 노트의 떼는 판정을 설정합니다.", + "en-US": "Set the decision to remove the long note" + }, + "LongNoteModifyContents": { + "ko-KR": "단일 노트를 롱 노트로 만듭니다.", + "en-US": "Turn single notes into long notes" + }, + "LongNoteModifyFaultText": { + "ko-KR": "노트 간격이 올바르지 않습니다.", + "en-US": "Note spacing is not valid." + }, + "LoopUnitText": { + "ko-KR": "폴링 레이트를 설정합니다.", + "en-US": "Sets the polling rate." + }, + "LoopWaveInContents": { + "ko-KR": "입력 장비의 음성을 출력 장비로 루프백합니다.", + "en-US": "Loop back the voice from the input equipment to the output equipment." + }, + "LoopWaveInText": { + "ko-KR": "입력 장비 시험 활성화", + "en-US": "Enable input device test" + }, + "LostPointAudioContents": { + "ko-KR": "창이 비활성화 되어도 게임 사운드를 출력합니다.", + "en-US": "Output audio even if the window is unfocused." + }, + "LostPointAudioText": { + "ko-KR": "백그라운드 오디오 활성화", + "en-US": "Enable background audio" + }, + "LowerAudioMultiplierContents": { + "ko-KR": "음악 속도 감소 ({0})", + "en-US": "Reduce music speed ({0})" + }, + "LowerEntryContents": { + "ko-KR": "이전 폴더 ({0})", + "en-US": "Previous folder ({0})" + }, + "LowerHitPointsModeContents": { + "ko-KR": "라이프 게이지가 관대해집니다.", + "en-US": "Easy gauge mode" + }, + "LowerJudgmentModeContents": { + "ko-KR": "판정 난이도가 관대해집니다.", + "en-US": "Easy judgment mode" + }, + "LowerMultiplierContents": { + "ko-KR": "스크롤 속도 감소 ({0})", + "en-US": "Reduce scroll speed ({0})" + }, + "LowerNoteFileContents": { + "ko-KR": "이전 노트 파일 ({0})", + "en-US": "Previous chart ({0})" + }, + "LowestHitPointsModeContents": { + "ko-KR": "라이프 게이지가 매우 관대해집니다.", + "en-US": "Very easy gauge mode" + }, + "LowestJudgmentConditionModeAssist": { + "ko-KR": "간접 미스를 설정합니다.", + "en-US": "Sets the indirect miss." + }, + "LowestJudgmentModeContents": { + "ko-KR": "판정 난이도가 매우 관대해집니다.", + "en-US": "Very easy judgment mode" + }, + "LowestLongNoteModify": { + "ko-KR": "가장 짧은 노트 간격", + "en-US": "Shortest note spacing" + }, + "LowestWantBPMContents": { + "ko-KR": "0 BPM 부터", + "en-US": "From 0 BPM" + }, + "LowestWantInputCountContents": { + "ko-KR": "0/s 부터", + "en-US": "From 0/s" + }, + "LowestWantLevelTextValue": { + "ko-KR": "0 난이도 부터", + "en-US": "From level 0" + }, + "LowHitPointsFaintUIContents": { + "ko-KR": "게임 오버가 되기 전에 화면이 붉게 물들여집니다.", + "en-US": "The screen turns red before game over." + }, + "LowHitPointsFaintUIText": { + "ko-KR": "블리딩 이펙트 활성화", + "en-US": "Enable bleeding effect" + }, + "LSCompileFault": { + "ko-KR": "루아 스크립트의 문법이 올바르지 않습니다. ({0})", + "en-US": "The Lua script has incorrect grammar. ({0})" + }, + "LSContents": { + "ko-KR": "Logitech® LIGHTSYNC™를 사용합니다.", + "en-US": "Use Logitech® LIGHTSYNC™" + }, + "LSText": { + "ko-KR": "Logitech® LIGHTSYNC™ 활성화", + "en-US": "Enable Logitech® LIGHTSYNC™" + }, + "MainAreaFaintContents": { + "ko-KR": "기어 영역 불투명도", + "en-US": "Gear area opacity" + }, + "MainControllerPowerText": { + "ko-KR": "컨트롤러에 내장된 배터리 정보입니다.", + "en-US": "Battery information embedded in the controller." + }, + "MainFaintContents": { + "ko-KR": "키빔 불투명도", + "en-US": "Key beam opacity" + }, + "MainPositionContents": { + "ko-KR": "기어 위치", + "en-US": "Gear Position" + }, + "MainSetContents": { + "ko-KR": "주 메모리 사용량입니다.", + "en-US": "Primary memory usage" + }, + "MediaComponentConfigure": { + "ko-KR": "동영상 모듈 정보", + "en-US": "Video Module Information" + }, + "MediaConfigure": { + "ko-KR": "BGA 설정", + "en-US": "BGA Settings" + }, + "MediaContents": { + "ko-KR": "선택한 노트 파일의 BGA를 보여줍니다.", + "en-US": "Show the BGA of the selected chart." + }, + "MediaFaintContents": { + "ko-KR": "BGA 불투명도", + "en-US": "BGA opacity" + }, + "MediaFillContents": { + "ko-KR": "BGA를 강제로 늘려서 출력합니다.", + "en-US": "Force the BGA to output." + }, + "MediaFillText": { + "ko-KR": "스트레치 BGA", + "en-US": "Stretch BGA" + }, + "MediaHandlerItemCountText": { + "ko-KR": "메모리에 올라온 동영상 인스턴스의 개수입니다.", + "en-US": "Number of movie instances loaded to memory" + }, + "MediaInputConfigure": { + "ko-KR": "웹캠 설정", + "en-US": "Webcam settings" + }, + "MediaInputFaintContents": { + "ko-KR": "웹캠 불투명도", + "en-US": "Webcam opacity" + }, + "MediaInputQualityContents": { + "ko-KR": "웹캠 해상도를 설정합니다.", + "en-US": "Set the webcam resolution" + }, + "MediaItemCountText": { + "ko-KR": "메모리에 올라온 동영상 파일의 개수입니다.", + "en-US": "Number of video files loaded to memory" + }, + "MediaModifierContents": { + "ko-KR": "BGA를 인코딩하는 중입니다.", + "en-US": "Encoding BGA." + }, + "MediaText": { + "ko-KR": "BGA 활성화", + "en-US": "Enable BGA" + }, + "MediaWaitContents": { + "ko-KR": "BGA 레이턴시를 설정합니다.", + "en-US": "Sets the BGA latency." + }, + "MeterNoteColor": { + "ko-KR": "\uD83C\uDFA8 마디선", + "en-US": "\uD83C\uDFA8 Bar line" + }, + "MeterSaltModeContents": { + "ko-KR": "노트 라인을 마디마다 임의 배치합니다. (마디 랜덤)", + "en-US": "Measure Random mode" + }, + "MIDIConfigure": { + "ko-KR": "MIDI 설정", + "en-US": "MIDI Settings" + }, + "MIDICountContents": { + "ko-KR": "{0} 개의 MIDI 장비가 인식됨", + "en-US": "{0} MIDI equipment detected" + }, + "MIDIPBCSensitivityText": { + "ko-KR": "MIDI 피치 설정 민감도를 설정합니다.", + "en-US": "Sets the MIDI pitch setting sensitivity." + }, + "MIDIViewerContents": { + "ko-KR": "실시간으로 받은 MIDI 입력 신호입니다.", + "en-US": "MIDI input signal received in real time" + }, + "MITMFaultText": { + "ko-KR": "TLS 인증서가 올바르지 않습니다. ({0})", + "en-US": "TLS certificate is invalid. ({0})" + }, + "ModifyAutoModeContents": { + "ko-KR": "연습 모드 ({0})", + "en-US": "AutoPlay ({0})" + }, + "ModifyDefaultEntryAssist0": { + "ko-KR": "간단히 폴더를 드래그 앤 드롭하면 추가됩니다.", + "en-US": "Simply drag and drop the folder to add it." + }, + "ModifyDefaultEntryText": { + "ko-KR": "폴더 설정", + "en-US": "Folder Settings" + }, + "ModifyEditorContents": { + "ko-KR": "다음에 에디터를 바꾸려면 Alt 키를 누르고 에디터 실행 버튼을 클릭하세요", + "en-US": "Next time you want to change the editor, press the Alt key and click the Run Editor button." + }, + "ModifyEventNoteName": { + "ko-KR": "코스 이름 수정", + "en-US": "Change the course name." + }, + "ModifyEventNoteNameContents": { + "ko-KR": "수정할 코스 이름을 입력하세요", + "en-US": "Enter the course name you want to modify." + }, + "ModifyFavoriteEntry": { + "ko-KR": "컬렉션 수정", + "en-US": "Modify Collection" + }, + "ModifyFavoriteEntryName": { + "ko-KR": "컬렉션 이름 수정", + "en-US": "Modify collection name" + }, + "ModifyFavoriteEntryNameContents": { + "ko-KR": "새 컬렉션 이름을 입력하세요", + "en-US": "Please enter a name for the new collection" + }, + "ModifyFrontEntry": { + "ko-KR": "의존 폴더 관리", + "en-US": "Managing dependent folders" + }, + "ModifyModeComponentText": { + "ko-KR": "게임 모드 설정", + "en-US": "Game Mode Settings" + }, + "ModifyPositionAssist": { + "ko-KR": "▲, ▼ 키와 DEL 키로 순서를 설정하거나 삭제하세요", + "en-US": "▲, Set or delete the order with the ▼ and DEL keys" + }, + "MultiplierContents": { + "ko-KR": "스크롤 속도", + "en-US": "Scroll Speed" + }, + "NegativePostedItemText": { + "ko-KR": "{0}이 {1}로 공격함", + "en-US": "{1} attacked with {1}" + }, + "NegativeStopFault": { + "ko-KR": "음수 정지 노트는 지원하지 않습니다.", + "en-US": "Negative stop notes are not supported." + }, + "NetCommentFollowContents": { + "ko-KR": "게임 중 실시간 랭킹을 업데이트합니다.", + "en-US": "Updates real-time ranking during the game." + }, + "NetCommentFollowText": { + "ko-KR": "실시간 랭킹 업데이트", + "en-US": "Update Real-time rankings" + }, + "NetCommentNotFollowContents": { + "ko-KR": "게임 중 실시간 랭킹을 결과 기록으로 고정시킵니다.", + "en-US": "Pin the real-time ranking in the game to the result record." + }, + "NetCommentNotFollowText": { + "ko-KR": "실시간 랭킹 고정", + "en-US": "Fixed Real-time Rankings" + }, + "NetComputingSituationContents": { + "ko-KR": "멀티 플레이 중… ({0})", + "en-US": "Multiplaying… ({0})" + }, + "NetItemCountText": { + "ko-KR": "실시간 랭킹에 넣을 기록 개수를 설정합니다.", + "en-US": "Number of records to display on Real-time ranking" + }, + "NetItemFaintContents": { + "ko-KR": "실시간 랭킹 불투명도", + "en-US": "Real-time ranking opacity" + }, + "NetSiteCommentsText": { + "ko-KR": "게임 결과", + "en-US": "Game Results" + }, + "NetText": { + "ko-KR": "멀티 플레이", + "en-US": "Multiplay" + }, + "NetUIContents": { + "ko-KR": "스킨 다운로드", + "en-US": "Download Skin" + }, + "NewDefaultEntry": { + "ko-KR": "폴더 추가", + "en-US": "Add folder" + }, + "NewEventNote": { + "ko-KR": "코스 만들기", + "en-US": "Create Course" + }, + "NewFavorHitPoints": { + "ko-KR": "프리셋 만들기", + "en-US": "Create Presets" + }, + "NewFavoriteEntry": { + "ko-KR": "컬렉션 추가", + "en-US": "Add Collection" + }, + "NewFavoriteEntryContents": { + "ko-KR": "새 컬렉션의 이름을 입력하세요", + "en-US": "Please enter a name for the new collection" + }, + "NewFavorJudgment": { + "ko-KR": "프리셋 만들기", + "en-US": "Create Presets" + }, + "NewFrontEntry": { + "ko-KR": "의존 폴더 추가", + "en-US": "Add dependent folder" + }, + "NewNetSiteContents": { + "ko-KR": "멀티방 이름과 비밀번호를 입력하세요", + "en-US": "Enter the name and password of the multi-room" + }, + "NewNetSiteText": { + "ko-KR": "멀티방 만들기", + "en-US": "Creating a multi-room" + }, + "NewSilentSite": { + "ko-KR": "1대1 대화", + "en-US": "Direct message" + }, + "NewSiteContents": { + "ko-KR": "대화방 이름과 비밀번호를 입력하세요", + "en-US": "Please enter your chat room name and password." + }, + "NewSiteText": { + "ko-KR": "대화방 만들기", + "en-US": "Create Chat Room" + }, + "NewTitleContents": { + "ko-KR": "호칭 {0} 얻음", + "en-US": "You got the title {0}." + }, + "NewUbuntu": { + "ko-KR": "친구 추가", + "en-US": "Add as a friend." + }, + "NotAllowPauseText": { + "ko-KR": "일시 정지 불가능", + "en-US": "Unable to pause" + }, + "NotAuraText": { + "ko-KR": "ASUS® Aura™ 비활성화", + "en-US": "Disable ASUS® Aura™" + }, + "NotAutoComputeConfigureFault": { + "ko-KR": "이 기능을 사용하려면 미리듣기를 사용하세요", + "en-US": "Use preview to use this feature" + }, + "NotAutoComputeContents": { + "ko-KR": "미리듣기를 사용하지 않습니다.", + "en-US": "Disable preview." + }, + "NotAutoComputeFault": { + "ko-KR": "먼저 노트 파일을 선택하여 미리듣기를 실행하세요", + "en-US": "First, select the note file and run the preview" + }, + "NotAutoComputeText": { + "ko-KR": "미리듣기 비활성화", + "en-US": "Disable preview" + }, + "NotAutoComputeViewContents": { + "ko-KR": "오토 플레이를 제외하고 출력", + "en-US": "Output excluding auto-play" + }, + "NotAvailableEventNoteFileFault": { + "ko-KR": "먼저 이 코스의 모든 노트 파일을 불러오세요", + "en-US": "First, load all the charts for this course." + }, + "NotAvailableLevelWww": { + "ko-KR": "난이도 테이블에 다운로드 주소가 존재하지 않습니다.", + "en-US": "The download address does not exist in the difficulty table." + }, + "NotAvatarBundleFault": { + "ko-KR": "비회원의 꾸러미는 제공되지 않습니다.", + "en-US": "Packs of non-members are not provided." + }, + "NotAvatarGroup": { + "ko-KR": "개인전", + "en-US": "Solo" + }, + "NotAvatarTitle": { + "ko-KR": "(호칭 사용 안함)", + "en-US": "(Don't use title)" + }, + "NotAvatarUbuntuFault": { + "ko-KR": "회원만 친구로 추가 가능합니다.", + "en-US": "Only members can be added as friends." + }, + "NotAvatarViewFault": { + "ko-KR": "비회원의 프로필은 제공되지 않습니다.", + "en-US": "Can't view profile of non-members." + }, + "NotAveragerText": { + "ko-KR": "노멀라이즈 비활성화", + "en-US": "Disable Normalization" + }, + "NotBanalAudioText": { + "ko-KR": "범용 키음 비활성화", + "en-US": "Disable universal keysound" + }, + "NotBanalFailedMediaText": { + "ko-KR": "범용 미스 레이어 비활성화", + "en-US": "Disable universal miss layer" + }, + "NotBanalMediaText": { + "ko-KR": "범용 BGA 비활성화", + "en-US": "Disable Universal BGA" + }, + "NotBPMModeContents": { + "ko-KR": "BPM을 고정합니다.", + "en-US": "Fixed BPM" + }, + "NotBWText": { + "ko-KR": "RAZER® Chroma™ 비활성화", + "en-US": "Disable RAZER® Chroma™" + }, + "NotDataCount3Text": { + "ko-KR": "삼중 버퍼링 비활성화", + "en-US": "Disable triple buffering" + }, + "NotDefaultAudioVarietyText": { + "ko-KR": "BGM 비활성화", + "en-US": "Disable BGM" + }, + "NoteDrawingCountText": { + "ko-KR": "메모리에 올라온 썸네일 이미지의 개수입니다.", + "en-US": "Number of thumbnails loaded in memory" + }, + "NoteFileBundleText": { + "ko-KR": "BMS 차분", + "en-US": "BMS sabun" + }, + "NoteFileLevelText": { + "ko-KR": "차분 사이트", + "en-US": "Sabun Site" + }, + "NoteFileModeSituationContents": { + "ko-KR": "노트 파일 목록 탐색 중… ({0})", + "en-US": "Navigating chart list… ({0})" + }, + "NoteFilesLevelText": { + "ko-KR": "동봉 사이트", + "en-US": "Enclosed Site" + }, + "NoteFormat": { + "ko-KR": "텍스트 인코딩", + "en-US": "Text encoding" + }, + "NoteFormatIDText65001": { + "ko-KR": "유니코드", + "en-US": "Unicode" + }, + "NoteFormatIDText932": { + "ko-KR": "일본어", + "en-US": "Japanese" + }, + "NoteFormatIDText936": { + "ko-KR": "대만어", + "en-US": "Taiwanese" + }, + "NoteFormatIDText949": { + "ko-KR": "한국어", + "en-US": "Korean" + }, + "NoteHeightContents": { + "ko-KR": "노트 두께", + "en-US": "Note Thickness" + }, + "NoteLengthContents": { + "ko-KR": "노트 너비", + "en-US": "Note Width" + }, + "NoteMobilityAssist": { + "ko-KR": "노트의 무질서도를 설정합니다.", + "en-US": "Sets the disorder plot for the note" + }, + "NoteModifyModeAssist": { + "ko-KR": "노트에 규칙을 설정합니다.", + "en-US": "Set note rules" + }, + "NoteSaltModeAssist": { + "ko-KR": "노트의 배치 방식을 설정합니다.", + "en-US": "Set note placement" + }, + "NoteWaitContents": { + "ko-KR": "노트 레이턴시", + "en-US": "Note Latency" + }, + "NotFavoritesF10": { + "ko-KR": "컬렉션이 존재하지 않습니다.", + "en-US": "Collection does not exist." + }, + "NotFlangeText": { + "ko-KR": "플랜지 비활성화", + "en-US": "Disable Flanger" + }, + "NotFlowNetItemText": { + "ko-KR": "실시간 랭킹 애니메이션 비활성화", + "en-US": "Disable real-time ranking animation" + }, + "NotHandleInputAudioText": { + "ko-KR": "키음 비활성화", + "en-US": "Disable Keysounds" + }, + "NotHandleMeterText": { + "ko-KR": "박자 반응 비활성화", + "en-US": "Disable beat response" + }, + "NotHaveLevelTarget": { + "ko-KR": "저장된 주소가 존재하지 않습니다. 난이도 테이블을 수동으로 다시 불러오세요", + "en-US": "The saved address does not exist. Bring back the difficulty table manually" + }, + "NotHaveNoteFileEntryText": { + "ko-KR": "차분에 대응되는 폴더가 존재하지 않습니다.", + "en-US": "The folder corresponding to the sabun does not exist." + }, + "NotHellBPMText": { + "ko-KR": "모든 노트 파일을 보여줍니다.", + "en-US": "Shows all charts" + }, + "NotifyInSite": { + "ko-KR": "개발자", + "en-US": "Developer" + }, + "NotifySaveBundleAvatarContents": { + "ko-KR": "회원의 꾸러미 다운로드 알림만 받음", + "en-US": "Only get notifications for downloading members' packages" + }, + "NotifySaveBundleCallableContents": { + "ko-KR": "모든 꾸러미 다운로드 알림을 받음", + "en-US": "Get notifications for all package downloads" + }, + "NotifySaveBundleCompetenceContents": { + "ko-KR": "누군가 꾸러미를 받을 때 알림을 받을지 설정합니다.", + "en-US": "Set whether to be notified when someone receives a package." + }, + "NotifySaveBundleUbuntuContents": { + "ko-KR": "친구의 꾸러미 다운로드 알림만 받음", + "en-US": "Only get notifications for downloading friends' packages" + }, + "NotifySaveBundleVoidContents": { + "ko-KR": "모든 꾸러미 다운로드 알림을 받지 받음", + "en-US": "Receive notifications for downloading all packages" + }, + "NotifySiteYellInvite": { + "ko-KR": "{0} 에서 멀티 플레이가 시작됩니다.", + "en-US": "Multiplay starts at {0}." + }, + "NotifySiteYellTV": { + "ko-KR": "Qwilight 방송 {0}이 시작됩니다.", + "en-US": "Qwilight broadcast {0} will start." + }, + "NotifyText": { + "ko-KR": "알림 메시지 목록", + "en-US": "Notification message list" + }, + "NotifyUbuntuCompetenceContents": { + "ko-KR": "친구 접속시 알림을 받을지 설정합니다.", + "en-US": "Set whether you want to receive notifications when a friend contacts you." + }, + "NotifyUbuntuContents": { + "ko-KR": "친구 접속시 알림을 받음", + "en-US": "Receive a notification when a friend connects" + }, + "NotIsFailModeContents": { + "ko-KR": "라이프 게이지가 0이 되어도 게임 오버되지 않습니다.", + "en-US": "If the life gauge reaches 0, the game does not go over." + }, + "NotIsFailModeText": { + "ko-KR": "무한 모드", + "en-US": "Infinite Mode" + }, + "NotK70Text": { + "ko-KR": "CORSAIR® CUE™ 비활성화", + "en-US": "Disable CORSAIR® CUE™" + }, + "NotLoopWaveInContents": { + "ko-KR": "입력 장비의 음성을 출력 장비로 루프백합니다.", + "en-US": "Loop back the voice from the input equipment to the output equipment." + }, + "NotLoopWaveInText": { + "ko-KR": "입력 장비 시험 비활성화", + "en-US": "Disable input device test" + }, + "NotLostPointAudioText": { + "ko-KR": "백그라운드 오디오 비활성화", + "en-US": "Disable background audio" + }, + "NotLowHitPointsFaintUIText": { + "ko-KR": "블리딩 이펙트 비활성화", + "en-US": "Disable Bleeding Effect" + }, + "NotLSText": { + "ko-KR": "Logitech® LIGHTSYNC™ 비활성화", + "en-US": "Disable Logitech® LIGHTSYNC™" + }, + "NotMediaFillContents": { + "ko-KR": "BGA의 비율에 맞춰서 출력합니다.", + "en-US": "Outputs according to the ratio of BGA." + }, + "NotMediaFillText": { + "ko-KR": "레터박스 BGA", + "en-US": "Letterbox BGA" + }, + "NotMediaText": { + "ko-KR": "BGA 비활성화", + "en-US": "Disable BGA" + }, + "NotNotifyUbuntuContents": { + "ko-KR": "친구 접속시 알림을 받지 않음", + "en-US": "Don't get notified when friends log in" + }, + "NotQwilightFillContents": { + "ko-KR": "창의 비율에 맞춰서 출력합니다.", + "en-US": "Output to a percentage of the window" + }, + "NotQwilightFillText": { + "ko-KR": "레터박스 화면", + "en-US": "Letterbox screen" + }, + "NotSFXText": { + "ko-KR": "리버브 비활성화", + "en-US": "Disable Reverb" + }, + "NotSignedInContents": { + "ko-KR": "{0}님 감사합니다.", + "en-US": "Thank you, {0}." + }, + "NotSignedInSituationContents": { + "ko-KR": "{0}에 마지막으로 접속함", + "en-US": "{0} last accessed" + }, + "NotSignInNotify": { + "ko-KR": "로그아웃 할까요?", + "en-US": "Do you want log out?" + }, + "NotSignInText": { + "ko-KR": "로그아웃", + "en-US": "Sign out" + }, + "NotStillDrawing": { + "ko-KR": "화면 캡처를 지원하지 않습니다.", + "en-US": "Screen capture is not supported." + }, + "NotStopLastEqualAudioText": { + "ko-KR": "중복 키음 방지 비활성화", + "en-US": "Disable duplicate key tone protection" + }, + "NotSupportedFileContents": { + "ko-KR": "지원하지 않는 파일입니다.", + "en-US": "This file is not supported." + }, + "NotTubeText": { + "ko-KR": "컴프레서 비활성화", + "en-US": "Disable compressor" + }, + "NotUbuntuSituationContents": { + "ko-KR": "아직 서로 친구가 아님", + "en-US": "We're not friends yet." + }, + "NotValidNetLevelContents": { + "ko-KR": "올바르지 않은 주소입니다. ({0})", + "en-US": "Invalid address. ({0})" + }, + "NotValidNoteFile": { + "ko-KR": "노트 파일을 먼저 선택하세요", + "en-US": "Please select a chart first" + }, + "NotVESAText": { + "ko-KR": "수직 동기화 비활성화", + "en-US": "Disable V-Sync" + }, + "NotVibrationModeText": { + "ko-KR": "진동 비활성화", + "en-US": "Disable vibration" + }, + "NotViewContents": { + "ko-KR": "출력하지 않음", + "en-US": "Do not output" + }, + "NotWantHandledContents": { + "ko-KR": "클리어 램프를 하나 이상 선택하세요", + "en-US": "Select at least one clear lamp" + }, + "NotWantLevelContents": { + "ko-KR": "난이도 색상을 하나 이상 선택하세요", + "en-US": "Please select at least one difficulty color" + }, + "NotWantLevelItemContents": { + "ko-KR": "난이도를 하나 이상 선택하세요", + "en-US": "Please select at least one difficulty level" + }, + "NotWantModeContents": { + "ko-KR": "라인을 하나 이상 선택하세요", + "en-US": "Please select at least one line" + }, + "NotWantNoteVarietyContents": { + "ko-KR": "노트 파일 형식을 하나 이상 선택하세요", + "en-US": "Select at least one note file format" + }, + "NotWindowedModeContents": { + "ko-KR": "전체 화면으로 게임을 플레이합니다.", + "en-US": "Play the game in fullscreen." + }, + "NotWindowedModeText": { + "ko-KR": "전체 화면 모드", + "en-US": "Fullscreen mode" + }, + "NotXwindowText": { + "ko-KR": "윈도우 키 활성화", + "en-US": "Enable windows key" + }, + "NVLLFramerateContents": { + "ko-KR": "프레임 제한을 설정합니다. 0은 제한하지 않습니다.", + "en-US": "Set the frame limit. 0 does not limit." + }, + "NVLLModeContents": { + "ko-KR": "저지연 기술을 사용합니다.", + "en-US": "Use low latency technology." + }, + "NVLLModeNotText": { + "ko-KR": "NVIDIA® Reflex™ 비활성화", + "en-US": "Disable NVIDIA® Reflex™" + }, + "NVLLModeOKText": { + "ko-KR": "NVIDIA® Reflex™ 활성화", + "en-US": "Enable NVIDIA® Reflex™" + }, + "NVLLModeUnlimitedText": { + "ko-KR": "NVIDIA® Reflex Boost™ 활성화", + "en-US": "Enable NVIDIA® Reflex Boost™" + }, + "OBSText0": { + "ko-KR": "❕ 방송 프로그램의 게임 캡처를 사용하면 Qwiight의 일부 화면이 캡처되지 않습니다.", + "en-US": "❕ Some screens on Qwiight are not captured when using game capture for broadcast programs." + }, + "OBSText1": { + "ko-KR": "✔️ 게임 캡처 대신 윈도우 10 (1903 이상)으로 설정된 윈도우 캡처를 사용하세요", + "en-US": "✔️ Use Windows Capture set to Windows 10 (1903 or higher) instead of Game Capture." + }, + "OpenedCountContents": { + "ko-KR": "#,##0 개 로드됨", + "en-US": "#,##0 loaded" + }, + "OpenedEventNotes": { + "ko-KR": "코스를 성공적으로 불러옴", + "en-US": "Successfully loaded course" + }, + "OpenedUIFileContents": { + "ko-KR": "스킨 파일 불러오기 성공", + "en-US": "Skin file import successful" + }, + "OpeningUIFileContents": { + "ko-KR": "스킨 파일을 불러옵니다.", + "en-US": "Loading a skin file." + }, + "P1SymmetricCopyNotesText": { + "ko-KR": "노트 복사 후 1P 미러", + "en-US": "1P Mirror After Copying Note" + }, + "P2SymmetricCopyNotesText": { + "ko-KR": "노트 복사 후 2P 미러", + "en-US": "2P Mirror After Copying Note" + }, + "PassContents": { + "ko-KR": "건너뛰기", + "en-US": "Skip it" + }, + "PauseAssist": { + "ko-KR": "미리듣기를 일시 정지합니다.", + "en-US": "Pause the preview" + }, + "PlatformAutoComputing": { + "ko-KR": "오토 플레이 중…", + "en-US": "AutoPlaying…" + }, + "PlatformCommentComputing": { + "ko-KR": "리플레이 보는 중…", + "en-US": "Watching replay…" + }, + "PlatformDefaultComputing": { + "ko-KR": "플레이 중…", + "en-US": "Playing…" + }, + "PlatformNoteFileMode": { + "ko-KR": "음악 듣는 중…", + "en-US": "Listening to music…" + }, + "PlatformQuitMode": { + "ko-KR": "결과 보는 중…", + "en-US": "Viewing results..." + }, + "PlatformSiteName": { + "ko-KR": "디스코드 대화방", + "en-US": "Discord Chat Room" + }, + "PlatformText0": { + "ko-KR": "❕ 디스코드의 기본 캡처 설정을 사용하면 Qwilight과 충돌이 발생합니다.", + "en-US": "❕ Using Discord's default capture settings will cause a conflict with Qwilight." + }, + "PlatformText1": { + "ko-KR": "✔️ 디스코드 앱 설정에서 고급 기술을 사용하여 화면 캡처 설정 을 제거하세요", + "en-US": "✔️ Remove the screen capture setting using advanced techniques in the Discord app settings" + }, + "Point": { + "ko-KR": "정확도", + "en-US": "Accuracy" + }, + "PointLegend": { + "ko-KR": "■ 정확도", + "en-US": "■ Accuracy" + }, + "PointLevelContents": { + "ko-KR": "0 픽셀", + "en-US": "0 pixel" + }, + "PointValidHunterModeText": { + "ko-KR": "정확도 우선", + "en-US": "Accuracy First" + }, + "PositivePostedItemText": { + "ko-KR": "{0}이 {1}를 제공함", + "en-US": "(0) supplied {1}" + }, + "PostableItemModeViewCommentFault": { + "ko-KR": "아이템 모드는 리플레이를 지원하지 않습니다.", + "en-US": "Item mode does not support replay." + }, + "PostableItemModeWarning": { + "ko-KR": "플레이어가 혼자이므로 모든 아이템이 본인에게도 적용됩니다.", + "en-US": "The player is alone, so all items apply to you." + }, + "PostableItemText": { + "ko-KR": "아이템 (Beta 0.9.4)", + "en-US": "Items (Beta 0.9.4)" + }, + "PostItem0Contents": { + "ko-KR": "첫번째 아이템 사용 ({0})", + "en-US": "Use first item ({0})" + }, + "PostItem1Contents": { + "ko-KR": "두번째 아이템 사용 ({0})", + "en-US": "Use second item ({0})" + }, + "PostItemContents": { + "ko-KR": "아이템 사용", + "en-US": "Use item" + }, + "Power00": { + "ko-KR": "알칼라인 ({0}%)", + "en-US": "Alkaline ({0}%)" + }, + "Power01": { + "ko-KR": "단선 ({0}%)", + "en-US": "Open circuit ({0}%)" + }, + "Power02": { + "ko-KR": "니켈 수소 ({0}%)", + "en-US": "Nickel Hydrogen ({0}%)" + }, + "Power03": { + "ko-KR": "인식 불가능 ({0}%)", + "en-US": "Unrecognized ({0}%)" + }, + "Power04": { + "ko-KR": "유선 ({0}%)", + "en-US": "Wired ({0}%)" + }, + "Power10": { + "ko-KR": "충전 중 ({0}%)", + "en-US": "Charging ({0}%)" + }, + "Power11": { + "ko-KR": "방전 중 ({0}%)", + "en-US": "During discharge ({0}%)" + }, + "Power12": { + "ko-KR": "유휴 ({0}%)", + "en-US": "Idle ({0}%)" + }, + "Power13": { + "ko-KR": "존재하지 않음 ({0}%)", + "en-US": "Does not exist ({0}%)" + }, + "PutCopyNotesContents": { + "ko-KR": "1P를 2P로 복사합니다. (5K1S, 7K1S만 적용)", + "en-US": "Copy 1P to 2P. (5K1S, 7K1S only)" + }, + "PutSetNoteModeContents": { + "ko-KR": "BGM을 추가 노트로 만듭니다.", + "en-US": "Make the BGM an additional note." + }, + "QuitComputingSituationContents": { + "ko-KR": "게임 결과 보는 중… ({0})", + "en-US": "Viewing game results… ({0})" + }, + "QuitContents": { + "ko-KR": "게임을 닫을까요?", + "en-US": "Do you want to close the game?" + }, + "QuitSiteAssist": { + "ko-KR": "방 나가기", + "en-US": "Leave the room" + }, + "QuitText": { + "ko-KR": "게임 닫기", + "en-US": "Close Game" + }, + "QwilightBundleText": { + "ko-KR": "Qwilight 백업", + "en-US": "Qwilight Backup" + }, + "QwilightFillContents": { + "ko-KR": "화면을 강제로 늘려서 출력합니다.", + "en-US": "Stretch screen" + }, + "QwilightFillText": { + "ko-KR": "스트레치 화면", + "en-US": "Stretch screen" + }, + "SaltContents": { + "ko-KR": "BMS 랜덤이나 게임 모드 등에 사용되는 시드입니다.", + "en-US": "Seed used for BMS random or game mode." + }, + "SaltModeContents": { + "ko-KR": "노트를 임의 배치합니다. (슈퍼 랜덤)", + "en-US": "Super Random mod" + }, + "SaveAsBundle": { + "ko-KR": "꾸러미로 업로드", + "en-US": "Upload as a package" + }, + "SaveAsBundleContents": { + "ko-KR": "꾸러미 압축 중…", + "en-US": "Compressing Packages…" + }, + "SaveAsBundleFault": { + "ko-KR": "꾸러미로 업로드가 불가능합니다. ({0})", + "en-US": "Unable to upload to package. ({0})" + }, + "SaveAsNetBundle": { + "ko-KR": "공유하기", + "en-US": "Share" + }, + "SaveBundle": { + "ko-KR": "꾸러미 다운로드", + "en-US": "Download Packages" + }, + "SaveBundleContents": { + "ko-KR": "꾸러미 다운로드 중…", + "en-US": "Downloading Packages…" + }, + "SaveBundleFault": { + "ko-KR": "꾸러미 다운로드가 불가능합니다. ({0})", + "en-US": "Package download is not possible. ({0})" + }, + "SaveCommentFailed": { + "ko-KR": "리플레이 파일 저장이 불가능합니다. ({0})", + "en-US": "Saving replay files is not possible. ({0})" + }, + "SavedAsBundleContents": { + "ko-KR": "꾸러미로 업로드 완료", + "en-US": "Upload to Packages Completed" + }, + "SavedBundleContents": { + "ko-KR": "꾸러미 다운로드 완료", + "en-US": "Package download complete" + }, + "SaveDefaultNoteContents": { + "ko-KR": "기본곡을 서버로부터 받습니다.", + "en-US": "Download default songs from the server." + }, + "SaveDefaultNoteNotify": { + "ko-KR": "{0}에 업데이트된 기본곡을 온라인으로 받을까요?", + "en-US": "Do you want to download the base songs, updated on {0}?" + }, + "SaveDefaultNoteText": { + "ko-KR": "기본곡 받기", + "en-US": "Download default songs" + }, + "SaveDefaultUIContents": { + "ko-KR": "추가 스킨을 서버로부터 받습니다.", + "en-US": "Downloading additional skins from the server." + }, + "SaveDefaultUINotify": { + "ko-KR": "{0}에 업데이트된 추가 스킨을 온라인으로 받을까요?", + "en-US": "Do you want to download additional skin updates, updated on {0}?" + }, + "SaveDefaultUIText": { + "ko-KR": "추가 스킨 받기", + "en-US": "Download additional skins" + }, + "SavedFileContents": { + "ko-KR": "파일 압축 풀기 완료", + "en-US": "File unzipping complete" + }, + "SavedLevelContents": { + "ko-KR": "난이도 테이블 다운로드 완료", + "en-US": "Difficulty table download complete" + }, + "SavedQwilightBundleContents": { + "ko-KR": "게임을 다시 시작한 후 복원이 진행됩니다.", + "en-US": "Restoration proceeds after restarting the game." + }, + "SavedQwilightContents": { + "ko-KR": "게임을 다시 시작한 후 업데이트가 진행됩니다.", + "en-US": "The update will proceed after restarting the game." + }, + "SavedStillDrawing": { + "ko-KR": "화면 캡처가 {0}에 저장됨", + "en-US": "Screen capture saved to {0}" + }, + "SavedUIContents": { + "ko-KR": "스킨 등록 완료", + "en-US": "Skin registration completed" + }, + "SaveFileFault": { + "ko-KR": "파일 압축 풀기가 불가능합니다. ({0})", + "en-US": "It is not possible to unzip the file. ({0})" + }, + "SaveModeComponent": { + "ko-KR": "여기에 저장", + "en-US": "Save here" + }, + "SaveModeComponentContents": { + "ko-KR": "프리셋 이름을 입력하세요", + "en-US": "Enter preset name" + }, + "SaveNetBundle": { + "ko-KR": "공유 받기", + "en-US": "Get a Share" + }, + "SaveUIFault": { + "ko-KR": "스킨 등록이 불가능합니다. ({0})", + "en-US": "Skin registration is not possible. ({0})" + }, + "SavingAsBundleContents": { + "ko-KR": "꾸러미로 업로드 중…", + "en-US": "Uploading as a package…" + }, + "SavingBundleContents": { + "ko-KR": "꾸러미 압축 푸는 중…", + "en-US": "Uncompressing Packages…" + }, + "SavingDefaultNoteContents": { + "ko-KR": "기본곡을 백그라운드에서 받습니다.", + "en-US": "Downloading default songs in the background." + }, + "SavingDefaultUIContents": { + "ko-KR": "추가 스킨을 백그라운드에서 받습니다.", + "en-US": "Downloading additional skins in the background." + }, + "SavingFileContents": { + "ko-KR": "파일 압축 푸는 중…", + "en-US": "Unzipping files..." + }, + "SavingLevelContents": { + "ko-KR": "난이도 테이블 다운로드 중…", + "en-US": "Downloading difficulty table…" + }, + "SavingQwilightContents": { + "ko-KR": "새 버전 다운로드 중…", + "en-US": "Downloading new version…" + }, + "SavingUIContents": { + "ko-KR": "스킨 등록 중…", + "en-US": "Registering skin…" + }, + "SetAutoNoteWait": { + "ko-KR": "노트 레이턴시가 {0} 픽셀로 설정됨", + "en-US": "Note latency set to (0) pixels" + }, + "SetEntryItem": { + "ko-KR": "일괄 적용", + "en-US": "Apply in batches" + }, + "SetFavoritesF10": { + "ko-KR": "컬렉션 {0}에 등록됨", + "en-US": "Registered in collection {0}" + }, + "SetNoteFile": { + "ko-KR": "하나만 적용", + "en-US": "Apply only one" + }, + "SetNoteModeAssist": { + "ko-KR": "추가 노트를 설정합니다.", + "en-US": "Set up additional charts." + }, + "SetNotTotalText": { + "ko-KR": "모두 선택 해제", + "en-US": "Deselect All" + }, + "SetSaltText": { + "ko-KR": "시드 고정", + "en-US": "Fixed seed" + }, + "SetSiteHand": { + "ko-KR": "호스트 위임", + "en-US": "Delegate Hosts" + }, + "SetSiteName": { + "ko-KR": "방 이름 수정", + "en-US": "Modify room name" + }, + "SetSiteNameContents": { + "ko-KR": "수정할 이름을 입력하세요", + "en-US": "Please enter a name to modify" + }, + "SetTotalText": { + "ko-KR": "모두 선택", + "en-US": "Select All" + }, + "SFXContents": { + "ko-KR": "리버브 이펙트를 사용합니다.", + "en-US": "Enable reverb effect" + }, + "SFXText": { + "ko-KR": "리버브 활성화", + "en-US": "Enable Reverb" + }, + "SignIn": { + "ko-KR": "로그인", + "en-US": "Login" + }, + "SignUp": { + "ko-KR": "회원 가입", + "en-US": "Join membership" + }, + "SilentSiteAvatarContents": { + "ko-KR": "회원의 1대1 대화만 받음", + "en-US": "Only receive direct messages from members" + }, + "SilentSiteCallableContents": { + "ko-KR": "모든 1대1 대화 받음", + "en-US": "Receive all direct messages" + }, + "SilentSiteCompetenceContents": { + "ko-KR": "1대1 대화 요청을 설정합니다.", + "en-US": "Set up a one-on-one chat request." + }, + "SilentSiteUbuntuContents": { + "ko-KR": "친구의 1대1 대화만 받음", + "en-US": "Only receive direct messages from friends" + }, + "SilentSiteVoidContents": { + "ko-KR": "모든 1대1 대화를 거절함", + "en-US": "Decline all direct message conversations" + }, + "SiteCipher": { + "ko-KR": "방 비밀번호", + "en-US": "Room Password" + }, + "SiteHandLevyingText": { + "ko-KR": "시작", + "en-US": "Start" + }, + "SiteInputAssist": { + "ko-KR": "메시지를 입력하세요", + "en-US": "Please enter a message" + }, + "SiteLevyingText": { + "ko-KR": "준비", + "en-US": "Ready" + }, + "SiteText": { + "ko-KR": "방 목록", + "en-US": "Room List" + }, + "SiteYellEnter": { + "ko-KR": "입장함", + "en-US": "Entered" + }, + "SiteYellInvite": { + "ko-KR": "저랑 같이 {0} 에서 멀티 플레이 하려면 클릭하세요", + "en-US": "Click to play multiplay with me on {0}" + }, + "SiteYellNewNetSite": { + "ko-KR": "새 멀티방을 만듦", + "en-US": "Create a new multi-room" + }, + "SiteYellNewSite": { + "ko-KR": "새 대화방을 만듦", + "en-US": "Create a new chat room" + }, + "SiteYellQuit": { + "ko-KR": "퇴장함", + "en-US": "Exited" + }, + "SiteYellTaehui": { + "ko-KR": "개발자", + "en-US": "Developer" + }, + "SiteYellTV": { + "ko-KR": "Qwilight 방송 {0}을 보려면 클릭하세요", + "en-US": "Click to watch Qwilight stream {0}" + }, + "SlowLoopingContents": { + "ko-KR": "게임이 느립니다. 게임 설정에서 폴링 레이트를 내려주세요", + "en-US": "The game is slow. Please lower the polling rate in the game settings" + }, + "SoftwareAssister": { + "ko-KR": "개발자", + "en-US": "Developer" + }, + "Stand": { + "ko-KR": "점수", + "en-US": "Score" + }, + "StandardControllerModeContents": { + "ko-KR": "게임을 컨트롤러로 플레이할 때 공통 키를 설정합니다.", + "en-US": "Set common keys for playing with a controller." + }, + "StandardControllerModeText": { + "ko-KR": "공통 컨트롤러 설정", + "en-US": "Common Controller Settings" + }, + "StandardDefaultControllerModeContents": { + "ko-KR": "게임 플레이중 사용할 공통 키를 설정합니다.", + "en-US": "Set common keys to use during gameplay." + }, + "StandardDefaultControllerModeText": { + "ko-KR": "공통 키 설정", + "en-US": "Common Key Settings" + }, + "StandardMIDIModeContents": { + "ko-KR": "게임을 MIDI로 플레이할 때 공통 키를 설정합니다.", + "en-US": "Set common keys for playing with a MIDI device." + }, + "StandardMIDIModeText": { + "ko-KR": "공통 MIDI 설정", + "en-US": "Common MIDI Settings" + }, + "StandardWaitUnitContents": { + "ko-KR": "#,##0.## ms 모든 노트 파일", + "en-US": "#,##0.## ms All charts." + }, + "StandContents": { + "ko-KR": "#,##0 점", + "en-US": "#,##0 points" + }, + "StandLegend": { + "ko-KR": "■ 점수", + "en-US": "■ Score" + }, + "StandValidHunterModeText": { + "ko-KR": "점수 우선", + "en-US": "Score First" + }, + "StopLastEqualAudioContents": { + "ko-KR": "딜레이 차분을 위하여 중복 키음을 하나만 플레이합니다.", + "en-US": "Play only one duplicate key note for delay sabun." + }, + "StopLastEqualAudioText": { + "ko-KR": "중복 키음 방지 활성화", + "en-US": "Enable duplicate key tone protection" + }, + "StopSavingAsBundleContents": { + "ko-KR": "꾸러미로 업로드 중단됨", + "en-US": "Uploaded to Packages Aborted" + }, + "StopSavingBundleContents": { + "ko-KR": "꾸러미 다운로드 중단됨", + "en-US": "Package download aborted" + }, + "StopSiteNetText": { + "ko-KR": "강제 중단", + "en-US": "Forced stop" + }, + "SuccessfullySignedInContents": { + "ko-KR": "{0}님 환영합니다.", + "en-US": "Welcome, {0}!" + }, + "SymmetricModeContents": { + "ko-KR": "노트를 반전시킵니다. (미러)", + "en-US": "Mirror mode" + }, + "TestHitPointsModeContents": { + "ko-KR": "단위인정용 라이프 게이지를 사용합니다.", + "en-US": "Use a life gauge for dan." + }, + "TestHitPointsModeWarning": { + "ko-KR": "단위인정용 라이프 게이지를 사용하면 온라인 랭킹에 등록되지 않습니다.", + "en-US": "Life Gauge for unit recognition does not register in the online ranking." + }, + "TotalAudioVolume": { + "ko-KR": "모든음", + "en-US": "All sounds" + }, + "TotalFadingNoteModeContents": { + "ko-KR": "모든게 깜빡입니다.", + "en-US": "Everything blinks" + }, + "TotalLimiterVariety": { + "ko-KR": "모든 라인", + "en-US": "All Lanes" + }, + "TotalVarietyContents": { + "ko-KR": "모두", + "en-US": "All" + }, + "TubeContents": { + "ko-KR": "컴프레서 이펙트를 사용합니다.", + "en-US": "Use compressor effects." + }, + "TubeText": { + "ko-KR": "컴프레서 활성화", + "en-US": "Enable compressor" + }, + "Tutorial0": { + "ko-KR": "Qwilight에 오신것을 환영합니다.", + "en-US": "Welcome to Qwilight." + }, + "Tutorial1": { + "ko-KR": "Qwilight은 자유로운 건반 리듬게임 형식인 BMS 구동기입니다.", + "en-US": "Qwilight is a BMS player, a free keyboard rhythm game format." + }, + "Tutorial20": { + "ko-KR": "➕ BMS 추가하기", + "en-US": "➕ Add BMS" + }, + "Tutorial200": { + "ko-KR": "BMS가 처음이신가요?", + "en-US": "Are you new to BMS?" + }, + "Tutorial201": { + "ko-KR": "이미 BMS를 가지고 계신가요?", + "en-US": "Do you already have a BMS?" + }, + "Tutorial21": { + "ko-KR": "\uD83C\uDFA8 스킨 설정하기", + "en-US": "\uD83C\uDFA8 Setting up skin" + }, + "Tutorial22": { + "ko-KR": "⌨️ 키 설정하기", + "en-US": "⌨️ To set the key" + }, + "Tutorial220": { + "ko-KR": "BMS 키 설정을 하려면 5K, 7K 대신 5K1S, 7K1S를 클릭하세요", + "en-US": "To set the BMS key, click 5K1S, 7K1S instead of 5K, 7K" + }, + "TutorialAssistText": { + "ko-KR": "매뉴얼", + "en-US": "Manual" + }, + "TutorialID0": { + "ko-KR": "◀, ▶ 키로 다른 사용자의 결과를 보세요", + "en-US": "View other users' results with ◀, ▶ keys" + }, + "TutorialID1": { + "ko-KR": "다음에 도움말을 다시 보려면 F1 키를 누르세요", + "en-US": "Press F1 for help again next time." + }, + "TutorialID2": { + "ko-KR": "연습하려면 F1 키를 누르세요", + "en-US": "Press F1 to practice" + }, + "TVAssistConfigure": { + "ko-KR": "방송 시작시 도움말 보여주기", + "en-US": "Show help when you start broadcasting" + }, + "TwilightCloseContents": { + "ko-KR": "서버가 닫힘", + "en-US": "Server closed" + }, + "TwilightComment": { + "ko-KR": "온라인", + "en-US": "Online" + }, + "TwilightCommentaryAssist": { + "ko-KR": "코멘트를 입력하세요", + "en-US": "Write a comment..." + }, + "TwilightCommentIOContents": { + "ko-KR": "다른 사용자의 실시간 멀티 플레이 화면을 클릭하면 바로 관전 가능합니다.", + "en-US": "You can watch it right away by clicking on someone else's real-time multiplay screen." + }, + "TwilightCommentWarning": { + "ko-KR": "온라인 랭킹에 등록하려면 온라인 랭킹 등록을 허용하세요", + "en-US": "Use online ranking registration to register for online ranking" + }, + "TwilightConfigure": { + "ko-KR": "계정 설정", + "en-US": "Account Settings" + }, + "TwilightConfigureAssist": { + "ko-KR": "계정 설정 열기", + "en-US": "Open Account Settings" + }, + "UbuntuAssist": { + "ko-KR": "친구 목록 열기", + "en-US": "Open Friend List" + }, + "UbuntuNetItemTargetAssist": { + "ko-KR": "온라인 랭킹에 친구만 보여줍니다.", + "en-US": "Show only friends in the online rankings." + }, + "UbuntuText": { + "ko-KR": "친구 목록", + "en-US": "List of friends" + }, + "UIBinText": { + "ko-KR": "스킨 파일을 불러올 때 사용할 스레드 개수입니다.", + "en-US": "Number of threads to use when loading skin files." + }, + "UIBundleText": { + "ko-KR": "Qwilight 스킨", + "en-US": "Qwilight Skin" + }, + "UICommentNote": { + "ko-KR": "리플레이 노트", + "en-US": "Replay Note" + }, + "UIDefaultAudioVarietyText": { + "ko-KR": "스킨 BGM 활성화", + "en-US": "Enable skin BGM" + }, + "UIFaultText": { + "ko-KR": "올바르지 않은 스킨 파일입니다. ({0})", + "en-US": "Invalid skin file. ({0})" + }, + "UIHitNotePaint": { + "ko-KR": "노트 폭발 이펙트", + "en-US": "Bomb effect" + }, + "UIHunter": { + "ko-KR": "점수 격차", + "en-US": "Score Gap" + }, + "UIJudgmentCount": { + "ko-KR": "판정 개수", + "en-US": "Number of judgments" + }, + "UIJudgmentInputVisualizer": { + "ko-KR": "실시간 NPS 그래프", + "en-US": "Real-time NPS Graphs" + }, + "UIJudgmentMain": { + "ko-KR": "판정선", + "en-US": "Judgment line" + }, + "UIJudgmentMeter": { + "ko-KR": "판정 오차", + "en-US": "Judgment checker" + }, + "UIJudgmentPaint": { + "ko-KR": "판정 이펙트", + "en-US": "Judgment effect" + }, + "UIJudgmentVisualizer": { + "ko-KR": "판정 비주얼라이저", + "en-US": "Judgment visualizer" + }, + "UILimiter": { + "ko-KR": "라인 구분선", + "en-US": "Line divider" + }, + "UIMainDrawingPaint": { + "ko-KR": "키빔", + "en-US": "Key beam" + }, + "UIMainJudgmentMeter": { + "ko-KR": "라인 판정 비주얼라이저", + "en-US": "Line judgment visualizer" + }, + "UINet": { + "ko-KR": "실시간 랭킹", + "en-US": "Real-time Ranking" + }, + "UndoColorContents": { + "ko-KR": "색상 설정을 기본으로 복원합니다.", + "en-US": "Reset color settings to their default values." + }, + "UndoColorNotify": { + "ko-KR": "색상 설정을 기본으로 복원할까요?", + "en-US": "Do you want to reset the color settings?" + }, + "UndoColorOK": { + "ko-KR": "색상 설정이 성공적으로 복원됨", + "en-US": "Color settings restored successfully" + }, + "UndoColorText": { + "ko-KR": "색상 설정 복원", + "en-US": "Reset color settings" + }, + "UndoContents": { + "ko-KR": "다시 시도", + "en-US": "Retry" + }, + "UndoEqualizerContents": { + "ko-KR": "이퀄라이저 복원", + "en-US": "Reset equalizer" + }, + "ValidNetMode0Text": { + "ko-KR": "아이템 비활성화", + "en-US": "Disable Item" + }, + "ValidNetMode1Text": { + "ko-KR": "아이템 활성화 (희귀함)", + "en-US": "Enable item (Rare)" + }, + "ValidNetMode2Text": { + "ko-KR": "아이템 활성화 (보통)", + "en-US": "Enable item (Normal)" + }, + "ValidNetMode3Text": { + "ko-KR": "아이템 활성화 (풍족함)", + "en-US": "Enable item (Enriched)" + }, + "ValidNetMode4Text": { + "ko-KR": "지금부터 서로 죽여라", + "en-US": "Kill each other from now on" + }, + "VeilDrawingHeightContents": { + "ko-KR": "레인 커버 높이", + "en-US": "Lane Cover Height" + }, + "VESAContents": { + "ko-KR": "수직 동기화를 사용합니다.", + "en-US": "V-Sync setting" + }, + "VESAText": { + "ko-KR": "수직 동기화 활성화", + "en-US": "Enable V-Sync" + }, + "Vibration0": { + "ko-KR": "왼쪽 모터", + "en-US": "Left motor" + }, + "Vibration1": { + "ko-KR": "오른쪽 모터", + "en-US": "Right motor" + }, + "Vibration2": { + "ko-KR": "왼쪽 트리거", + "en-US": "Left Trigger" + }, + "Vibration3": { + "ko-KR": "오른쪽 트리거", + "en-US": "Right Trigger" + }, + "VibrationModeContents": { + "ko-KR": "진동 모드를 설정합니다.", + "en-US": "Vibration setting" + }, + "ViewAvatarView": { + "ko-KR": "프로필 보기", + "en-US": "View Profiles" + }, + "ViewBundle": { + "ko-KR": "꾸러미 보기", + "en-US": "View Packages" + }, + "ViewFailedDrawingText": { + "ko-KR": "노트를 놓칠 때 미스 레이어를 출력할지 설정합니다.", + "en-US": "Set whether to show the miss layer when you miss a note." + }, + "ViewLowestJudgmentText": { + "ko-KR": "노트를 놓칠 때 판정 애니메이션을 출력할지 설정합니다.", + "en-US": "Set whether to show the judgment animation when you miss a note." + }, + "ViewQwilightEntry": { + "ko-KR": "사용자 폴더 열기", + "en-US": "Open a user folder" + }, + "ViewUIEntry": { + "ko-KR": "스킨 폴더 열기", + "en-US": "Open skin folder" + }, + "VisibleWindowValuesContents": { + "ko-KR": "창 크기를 설정합니다.", + "en-US": "Set the window size." + }, + "VoidPutSetNoteModeContents": { + "ko-KR": "빈 라인에 BGM을 추가 노트로 만듭니다.", + "en-US": "Make the BGM an additional note to the blank line." + }, + "VoteText": { + "ko-KR": "BMS 다운로드", + "en-US": "Download BMS" + }, + "WaitContents": { + "ko-KR": "뒤로 가기 ({0})", + "en-US": "Go Back ({0})" + }, + "WaitingIOContents": { + "ko-KR": "관전 동기화 중…", + "en-US": "Synchronizing observations…" + }, + "WaitingNetContents": { + "ko-KR": "다른 플레이어를 기다리는 중…", + "en-US": "Waiting for another player…" + }, + "WaitingNotifyContents": { + "ko-KR": "F11 키로 도착한 {0}개의 알림을 확인하세요", + "en-US": "Check {0} alerts that arrived with F11 keys." + }, + "WaitSiteContents": { + "ko-KR": "대화방에 자동으로 입장하지 않습니다.", + "en-US": "Don't enter the chat room automatically." + }, + "WaitUnitContents": { + "ko-KR": "#,##0.## ms 선택한 노트 파일", + "en-US": "#,##0.## ms. Selected chart." + }, + "WantAverageInputCountContents": { + "ko-KR": "NPS 범위를 설정합니다.", + "en-US": "Sets the NPS range." + }, + "WantBannedContents": { + "ko-KR": "온라인 랭킹에 등록 가능한 노트 파일만 보여줄지 설정합니다.", + "en-US": "Set whether to show only the note files that can be registered in the online ranking." + }, + "WantBPMContents": { + "ko-KR": "BPM 범위를 설정합니다.", + "en-US": "Set BPM range" + }, + "WantHighestInputCountContents": { + "ko-KR": "피크 NPS 범위를 설정합니다.", + "en-US": "Sets the peak NPS range." + }, + "WantInputAssist": { + "ko-KR": "검색할 단어를 입력하세요", + "en-US": "Please enter a word to search for" + }, + "WantLevelItemContents": { + "ko-KR": "지정된 난이도 테이블의 난이도를 설정합니다.", + "en-US": "Sets the difficulty level of the specified difficulty table." + }, + "WantLevelTextValueContents": { + "ko-KR": "난이도 범위를 설정합니다.", + "en-US": "Set difficulty range" + }, + "WantNotBannedText": { + "ko-KR": "온라인 랭킹에 등록 가능한 노트 파일만 보여줍니다.", + "en-US": "Show only charts eligible for online ranking" + }, + "WantText": { + "ko-KR": "분류 설정", + "en-US": "File filter setting" + }, + "WantTotalBannedText": { + "ko-KR": "모든 노트 파일을 보여줍니다.", + "en-US": "Shows all charts" + }, + "WaveContents": { + "ko-KR": "음성 대화 출력 장비를 설정합니다.", + "en-US": "Set the voice chat output device" + }, + "WaveFadeVolumeContents": { + "ko-KR": "음성 대화가 들릴 때 게임 사운드 음량을 설정합니다.", + "en-US": "Set the game sound volume when you hear voice chat." + }, + "WaveFault": { + "ko-KR": "음성 대화 출력 장비의 사용이 불가능합니다. ({0})", + "en-US": "Voice chat output device is not available. ({0})" + }, + "WaveInContents": { + "ko-KR": "음성 대화 입력 장비를 설정합니다.", + "en-US": "Set the voice chat input device" + }, + "WaveInFault": { + "ko-KR": "음성 대화 입력 장비의 사용이 불가능합니다. ({0})", + "en-US": "Voice chat input device is not available. ({0})" + }, + "WaveModeAssist": { + "ko-KR": "음악 진로를 설정합니다.", + "en-US": "Set the music path." + }, + "WGIContents": { + "ko-KR": "엑스박스 원 호환 Windows.Gaming.Input™을 사용합니다.", + "en-US": "Use Xbox One compatible Windows.Gaming.Input™." + }, + "WGIText": { + "ko-KR": "Windows.Gaming.Input™ 모드", + "en-US": "Windows.Gaming.Input™ mode" + }, + "WindowedModeContents": { + "ko-KR": "창 모드로 게임을 플레이합니다.", + "en-US": "Play the game in windowed mode." + }, + "WindowedModeText": { + "ko-KR": "창 모드", + "en-US": "Window mode" + }, + "WipeBundleNotify": { + "ko-KR": "이 꾸러미를 삭제할까요?", + "en-US": "Do you want to delete this package?" + }, + "WipeBundleText": { + "ko-KR": "꾸러미 삭제", + "en-US": "Delete Package" + }, + "WipeCommentNotify": { + "ko-KR": "이 기록을 삭제할까요?", + "en-US": "Do you want to delete this record?" + }, + "WipeDefaultEntryNotify": { + "ko-KR": "이 폴더를 목록에서 삭제할까요?", + "en-US": "Do you want to delete this folder from the list?" + }, + "WipedSiteYell": { + "ko-KR": "삭제된 메시지입니다.", + "en-US": "Deleted message." + }, + "WipeEntryItemNotify": { + "ko-KR": "이 폴더를 삭제할까요?", + "en-US": "Do you want to delete this folder?" + }, + "WipeEntryOK": { + "ko-KR": "폴더가 성공적으로 삭제됨", + "en-US": "Folder deleted successfully" + }, + "WipeEventNoteContents": { + "ko-KR": "이 코스를 삭제할까요?", + "en-US": "Delete this course?" + }, + "WipeFavoriteEntryNotify": { + "ko-KR": "이 컬렉션을 삭제할까요?", + "en-US": "Would you like to delete this collection?" + }, + "WipeFavoritesF10": { + "ko-KR": "컬렉션 {0} 에서 삭제됨", + "en-US": "Deleted from collection {0}" + }, + "WipeHandled": { + "ko-KR": "클리어 램프 삭제", + "en-US": "Delete Clear Lamp" + }, + "WipeLevelNotify": { + "ko-KR": "이 난이도 테이블을 삭제할까요?", + "en-US": "Do you want to delete this difficulty table?" + }, + "WipeNoteFileNotify": { + "ko-KR": "이 노트 파일을 삭제할까요?", + "en-US": "Do you want to delete this note file?" + }, + "WipeNoteFileOK": { + "ko-KR": "노트 파일이 성공적으로 삭제됨", + "en-US": "Chart deleted successfully" + }, + "WipeTotalNotify": { + "ko-KR": "모든 알림 삭제", + "en-US": "Delete all alerts" + }, + "WipeUbuntuNotify": { + "ko-KR": "이 친구를 삭제할까요?", + "en-US": "Do you want to delete this friend?" + }, + "WowAbilityContents": { + "ko-KR": "레이팅", + "en-US": "Rating" + }, + "WowCommentAtContents": { + "ko-KR": "이번 달", + "en-US": "Month" + }, + "WowCommentContents": { + "ko-KR": "전체", + "en-US": "All" + }, + "WowCommentText": { + "ko-KR": "명예의 전당", + "en-US": "Hall of Fame" + }, + "WowLevelContents": { + "ko-KR": "레벨", + "en-US": "Level" + }, + "WrongLowestJudgmentConditionModeContents": { + "ko-KR": "간접 미스를 추가합니다.", + "en-US": "Enable indirect miss" + }, + "WwwCommentBand": { + "ko-KR": "콤보", + "en-US": "Combo" + }, + "WwwCommentHighest": { + "ko-KR": "기록", + "en-US": "Record" + }, + "WwwCommentStand": { + "ko-KR": "점수", + "en-US": "Score" + }, + "WwwCommentTotal": { + "ko-KR": "플레이", + "en-US": "Play" + }, + "WwwLevelAudioMultiplierContents0": { + "ko-KR": "음악 속도 {0}배 이상", + "en-US": "{0}x Music speed or more" + }, + "WwwLevelAudioMultiplierContents1": { + "ko-KR": "음악 속도 {0}배 이하", + "en-US": "{0}x Music speed or less" + }, + "WwwLevelBandContents0": { + "ko-KR": "{0} 콤보 이상", + "en-US": "{0} Combo or more" + }, + "WwwLevelBandContents1": { + "ko-KR": "{0} 콤보 이하", + "en-US": "{0} Combo or less" + }, + "WwwLevelClearContents": { + "ko-KR": "도전 과제 {0} 클리어! 축하합니다.", + "en-US": "Challenge clear! Congratulations!" + }, + "WwwLevelClearItem": { + "ko-KR": "클리어 보상", + "en-US": "Clear Compensation" + }, + "WwwLevelClearItemEdge": { + "ko-KR": "프레임", + "en-US": "Frame" + }, + "WwwLevelClearItemTitle": { + "ko-KR": "호칭", + "en-US": "Title" + }, + "WwwLevelJudgmentContents0": { + "ko-KR": "{0} 개 이상", + "en-US": "{0} or more" + }, + "WwwLevelJudgmentContents1": { + "ko-KR": "{0} 개 이하", + "en-US": "{0} or less" + }, + "WwwLevelPointContents0": { + "ko-KR": "정확도 {0}% 이상", + "en-US": "{0}% Accuracy or more" + }, + "WwwLevelPointContents1": { + "ko-KR": "정확도 {0}% 이하", + "en-US": "{0}% Accuracy or less" + }, + "WwwLevelStandContents0": { + "ko-KR": "{0} 점 이상", + "en-US": "{0} Points or more" + }, + "WwwLevelStandContents1": { + "ko-KR": "{0} 점 이하", + "en-US": "{0} Points or less" + }, + "WwwLevelTest": { + "ko-KR": "단위인정", + "en-US": "Dan" + }, + "WwwLevelText": { + "ko-KR": "도전 과제", + "en-US": "Challenge" + }, + "XInputContents": { + "ko-KR": "엑스박스 360 호환 XInput™을 사용합니다.", + "en-US": "Use Xbox 360-compliant XInput™." + }, + "XInputText": { + "ko-KR": "XInput™ 모드", + "en-US": "XInput™ mode" + }, + "XwindowText": { + "ko-KR": "윈도우 키 비활성화", + "en-US": "Disable windows key" + }, + "YAMLCompileFault": { + "ko-KR": "YAML 파일의 문법이 올바르지 않습니다. ({0})", + "en-US": "Invalid grammar in YAML file. ({0})" + }, + "ZipModeContents": { + "ko-KR": "노트가 압축되다가 다시 튀어오릅니다. (고난이도)", + "en-US": "The note bounces (Hard difficulty)" + } +} \ No newline at end of file diff --git a/Qwilight/Assets/MicrosoftEdgeWebview2Setup.exe b/Qwilight/Assets/MicrosoftEdgeWebview2Setup.exe new file mode 100644 index 0000000..ab17576 --- /dev/null +++ b/Qwilight/Assets/MicrosoftEdgeWebview2Setup.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61ab4d9e17954ad9885736ccd19a9a7e809105074b59d12ab78f4eefbe5d9581 +size 1600864 diff --git a/Qwilight/Assets/Paused/Configure 0.png b/Qwilight/Assets/Paused/Configure 0.png new file mode 100644 index 0000000..7336424 --- /dev/null +++ b/Qwilight/Assets/Paused/Configure 0.png Binary files differ diff --git a/Qwilight/Assets/Paused/Configure 1.png b/Qwilight/Assets/Paused/Configure 1.png new file mode 100644 index 0000000..58a696a --- /dev/null +++ b/Qwilight/Assets/Paused/Configure 1.png Binary files differ diff --git a/Qwilight/Assets/Paused/Stop 0.png b/Qwilight/Assets/Paused/Stop 0.png new file mode 100644 index 0000000..010c057 --- /dev/null +++ b/Qwilight/Assets/Paused/Stop 0.png Binary files differ diff --git a/Qwilight/Assets/Paused/Stop 1.png b/Qwilight/Assets/Paused/Stop 1.png new file mode 100644 index 0000000..e473d31 --- /dev/null +++ b/Qwilight/Assets/Paused/Stop 1.png Binary files differ diff --git a/Qwilight/Assets/Paused/Undo 0.png b/Qwilight/Assets/Paused/Undo 0.png new file mode 100644 index 0000000..6b7f8a1 --- /dev/null +++ b/Qwilight/Assets/Paused/Undo 0.png Binary files differ diff --git a/Qwilight/Assets/Paused/Undo 1.png b/Qwilight/Assets/Paused/Undo 1.png new file mode 100644 index 0000000..b552778 --- /dev/null +++ b/Qwilight/Assets/Paused/Undo 1.png Binary files differ diff --git a/Qwilight/Assets/Paused/Unpause 0.png b/Qwilight/Assets/Paused/Unpause 0.png new file mode 100644 index 0000000..1156a7a --- /dev/null +++ b/Qwilight/Assets/Paused/Unpause 0.png Binary files differ diff --git a/Qwilight/Assets/Paused/Unpause 1.png b/Qwilight/Assets/Paused/Unpause 1.png new file mode 100644 index 0000000..7053f48 --- /dev/null +++ b/Qwilight/Assets/Paused/Unpause 1.png Binary files differ diff --git a/Qwilight/Assets/UI/@Default/@Default.lua b/Qwilight/Assets/UI/@Default/@Default.lua new file mode 100644 index 0000000..eb452db --- /dev/null +++ b/Qwilight/Assets/UI/@Default/@Default.lua @@ -0,0 +1,213 @@ +-- https://taehui.ddns.net/qwilight/@assistLS + +function IsNoteFileModeBGA() + return configures[2] == 2 +end + +function IsNoteFileModeUHD() + return configures[2] == 1 +end + +function IsQuitModeBGA() + return configures[3] == 2 +end + +function IsQuitModeUHD() + return configures[3] == 1 +end + +function DefaultLength() + if configures[1] == 2 then + return 720 * 21 / 9 + elseif configures[1] == 3 then + return 720 * 32 / 9 + else + return 1280 + end +end + +function DefaultHeight() + if configures[1] == 0 then + return 1280 * 9 / 16 + elseif configures[1] == 1 then + return 1280 * 10 / 16 + else + return 720 + end +end + +function CommentViewLength(e) + return 4 * (DefaultLength() - 12 - 12 - 12 - 34) / 13 + e +end + +function CommentViewHeight(e) + return DefaultHeight() - 360 + e +end + +function InputNoteCountViewPosition1(e) + return DefaultHeight() - 318 + e +end + +function EntryViewLength(e) + return 9 * (DefaultLength() - 12 - 12 - 12 - 34) / 13 + e +end + +function EntryViewHeight() + return DefaultHeight() - 12 - 12 - 10 - 24 +end + +function AssistViewPosition1() + return 12 + EntryViewHeight() + 10 +end + +function FilePosition1(e) + return DefaultHeight() - 240 + 34 * e +end + +function AutoModePosition0(e) + return DefaultLength() - 36 + e +end + +function AutoModePosition1(e) + return DefaultHeight() - 444 + 34 * e +end + +function PaintProperty22Position1() + return DefaultHeight() - 449 +end + +function TitleQuitLength(e) + return DefaultLength() / 2 - 10 + e +end + +function TotalNotesQuitLength() + return (DefaultLength() - 12 * 3) / 6 +end + +function JudgmentMeterViewPosition0() + return DefaultLength() - JudgmentMeterViewLength() - 12 +end + +function JudgmentMeterViewPosition1() + return (DefaultHeight() - 288 * 2 - 5 * 2) / 2 +end + +function JudgmentMeterViewLength() + return 1 * DefaultLength() / 3 +end + +function StatusViewPosition1() + return JudgmentMeterViewPosition1() + 288 + 5 * 2 +end + +function ViewCommentPosition0() + return DefaultLength() - 125 +end + +function ViewCommentPosition1() + return JudgmentMeterViewPosition1() - 50.3 +end + +function HandleUndoPosition0() + return DefaultLength() - 232.3 +end + +function QuitDrawingPosition0() + return (DefaultLength() / 2) - 72 +end + +function QuitDrawingPosition1() + return PaintProperty9Position1(0) - 5 * 2 - 144 +end + +function PaintProperty9Position0() + return DefaultLength() / 2 - 5 - 48 +end + +function PaintProperty9Position1(e) + return PaintProperty13Position1() - 5 * 2 - 48 + e +end + +function PaintProperty10Position0() + return DefaultLength() / 2 + 5 +end + +function StandQuitPosition0(e) + return DefaultLength() / 2 - 216 + e +end + +function StandQuitPosition1(e) + return PaintProperty13Position1() + 5 + 58 * e +end + +function PaintProperty13Position1() + return PaintProperty12Position1() + 406 - 58 * 3 +end + +function StandContentsQuitPosition0() + return DefaultLength() / 2 +end + +function AutoModeQuitPosition1(e) + return DefaultHeight() - 63 + e +end + +function JudgmentStageQuitPosition1(e) + return DefaultHeight() - 24 - 5 + e +end + +function TotalNotesQuitPosition1(e) + return 170 + (DefaultHeight() - 644) / 2 + 58 * e +end + +function PaintProperty12Position1() + return TotalNotesQuitPosition1(0) - 5 +end + +function PaintProperty0Variety() + if IsNoteFileModeBGA() then + return 2 + else + return 11 + end +end + +function PaintProperty1Variety() + if IsNoteFileModeBGA() then + return 1 + else + return 2 + end +end + +function PaintProperty0Etc() + if IsNoteFileModeUHD() then + return "0UHD.mp4" + else + return "0HD.mp4" + end +end + +function PaintProperty3Variety() + if IsQuitModeBGA() then + return 2 + else + return 11 + end +end + +function PaintProperty3Etc() + if IsQuitModeUHD() then + return "1UHD.mp4" + else + return "1HD.mp4" + end +end + +function PaintProperty6Variety() + if IsQuitModeBGA() then + return 1 + else + return 2 + end +end \ No newline at end of file diff --git a/Qwilight/Assets/UI/@Default/@Default.yaml b/Qwilight/Assets/UI/@Default/@Default.yaml new file mode 100644 index 0000000..7256a1c --- /dev/null +++ b/Qwilight/Assets/UI/@Default/@Default.yaml @@ -0,0 +1,317 @@ +# https://taehui.ddns.net/qwilight/assist@YAML + +format: + zip: Default + lua: Default + title: Qwilight basic skin. + title-1042: Qwilight 기본 스킨 + comment: It's a basic skin made by a developer. + comment-1041: 開発者が作った基本化粧水です。 + comment-1042: 개발자가 만든 기본 스킨입니다. + + defaultLength: DefaultLength() + defaultHeight: DefaultHeight() + +func: + configure-0: 16:9, 16:10, 21:9, 32:9 + configure-comment-0: Select the screen ratio. + configure-comment-0-1042: 화면 비율을 선택합니다. + + configure-1: Default (HD), Default (UHD), BGA + configure-comment-1: Choose an animation. (Selection) + configure-comment-1-1042: 애니메이션을 선택합니다. (선곡) + + configure-2: Default (HD), Default (UHD), BGA + configure-comment-2: Choose an animation. (Result) + configure-comment-2-1042: 애니메이션을 선택합니다. (리절트) + +paint: + siteDate: LightGray + siteEnter: DeepSkyBlue + siteQuit: HotPink + siteHref: LightBlue + siteTitle: White + siteArtist: DeepSkyBlue + siteGenre: LightGreen + siteStand: White + + eventNoteName: MediumSeaGreen + title: White + artist: DeepSkyBlue + genre: LightGreen + wantLevelID: DodgerBlue + fittedText: MediumSpringGreen + + file: LightGray + judgmentStage: MediumPurple + totalNotes: LightBlue + highestInputCount: LightGreen + length: LightYellow + bpm: LightPink + + commentDate: LightGray + commentPoint: White + commentName: White + commentStand: White + + level0: Gray + level1: MediumSpringGreen + level2: MediumTurquoise + level3: Yellow + level4: MediumVioletRed + level5: MediumPurple + + titleQuit: White + artistQuit: DeepSkyBlue + genreQuit: LightGreen + wantLevelIDQuit: DodgerBlue + + judgmentStageQuit: MediumPurple + highestInputCountQuit: LightGreen + lengthQuit: LightYellow + bpmQuit: LightPink + standQuit: DeepSkyBlue + pointQuit: LightGreen + bandQuit: Orange + + commentPlace: White + + lowestHitPoints: DarkGreen + lowerHitPoints: DarkTurquoise + defaultHitPoints: DarkGoldenrod + higherHitPoints: DarkRed + highestHitPoints: DarkViolet + failedHitPoints: DarkViolet + favorHitPoints: DarkGoldenrod + testHitPoints: DarkGoldenrod + + standStatusView: DeepSkyBlue + pointStatusView: LightGreen + bandStatusView: Orange + hitPointsStatusView: Red + + totalNotesJudgmentQuit: White + highestJudgmentQuit: Cyan + higherJudgmentQuit: DeepSkyBlue + highJudgmentQuit: LightGreen + lowJudgmentQuit: Yellow + lowerJudgmentQuit: Violet + lowestJudgmentQuit: Red + + highestJudgmentV2: Cyan + higherJudgmentV2: DeepSkyBlue + highJudgmentV2: LightGreen + lowJudgmentV2: Yellow + lowerJudgmentV2: Violet + lowestJudgmentV2: Red + + statusHandling: "#7F008000" + statusPaused: "#7FFFFF00" + statusLoadingNoteFile: "#7FFF0000" + statusLoadingDefaultEntry: "#7F0000FF" + + quit0: Gold + quit1: Gold + quit2: ForestGreen + quit3: ForestGreen + quit4: Blue + quit5: Magenta + quit6: Red + +point: + noteFileMargin: 31.5 + entryViewTitleMargin: 58, 0, 0, 0 + + signIn: AutoModePosition0(-5), 12, 34, 34, 1, 1, 0 + configure: AutoModePosition0(-5), 56, 34, 34, 1, 1, 0 + + stopAuto: CommentViewLength(-12), InputNoteCountViewPosition1(5), 24, 24, 1, 1, 0 + saltAuto: CommentViewLength(-12), InputNoteCountViewPosition1(39), 24, 24, 1, 1, 0 + + handledWallLength: 10 + entryItemHeight: 60 + commentItemHeight: 48 + + commentView: 13, 13, CommentViewLength(-2), CommentViewHeight(-2) + entryView: CommentViewLength(24), 12, EntryViewLength(0), EntryViewHeight() + inputNoteCountView: 13, InputNoteCountViewPosition1(1), CommentViewLength(-36), 66 + assistView: CommentViewLength(13), AssistViewPosition1(), EntryViewLength(0), 24, 1, 1, White, "#7F000000" + + autoMode: AutoModePosition0(0), AutoModePosition1(0), 24, 24, 1, 1, 0 + noteSaltMode: AutoModePosition0(0), AutoModePosition1(1), 24, 24, 1, 1, 0 + faintNoteMode: AutoModePosition0(0), AutoModePosition1(2), 24, 24, 1, 1, 0 + judgmentMode: AutoModePosition0(0), AutoModePosition1(3), 24, 24, 1, 1, 0 + hitPointsMode: AutoModePosition0(0), AutoModePosition1(4), 24, 24, 1, 1, 0 + noteMobilityMode: AutoModePosition0(0), AutoModePosition1(5), 24, 24, 1, 1, 0 + inputFavorMode: AutoModePosition0(0), AutoModePosition1(6), 24, 24, 1, 1, 0 + longNoteMode: AutoModePosition0(0), AutoModePosition1(7), 24, 24, 1, 1, 0 + noteModifyMode: AutoModePosition0(0), AutoModePosition1(8), 24, 24, 1, 1, 0 + bpmMode: AutoModePosition0(0), AutoModePosition1(9), 24, 24, 1, 1, 0 + waveMode: AutoModePosition0(0), AutoModePosition1(10), 24, 24, 1, 1, 0 + setNoteMode: AutoModePosition0(0), AutoModePosition1(11), 24, 24, 1, 1, 0 + lowestJudgmentConditionMode: AutoModePosition0(0), AutoModePosition1(12), 24, 24, 1, 1, 0 + + file: 12, FilePosition1(0), 72, 24, 0, 1, 0 + fileContents: 162, FilePosition1(0), CommentViewLength(-150), 24, 0, 1, 12.0 + fileViewer: 94, FilePosition1(0), 24, 24, 0, 1, 0 + assistFileViewer: 128, FilePosition1(0), 24, 24, 0, 1, 0 + judgmentStage: 12, FilePosition1(1), 72, 24, 0, 1, 0 + judgmentStageContents: 94, FilePosition1(1), CommentViewLength(-82), 24, 0, 1, 12.0 + totalNotes: 12, FilePosition1(2), 72, 24, 0, 1, 0 + totalNotesContents: 94, FilePosition1(2), CommentViewLength(-82), 24, 0, 1, 12.0 + highestInputCount: 12, FilePosition1(3), 72, 24, 0, 1, 0 + highestInputCountContents: 94, FilePosition1(3), CommentViewLength(-82), 24, 0, 1, 12.0 + length: 12, FilePosition1(4), 72, 24, 0, 1, 0 + lengthContents: 94, FilePosition1(4), CommentViewLength(-82), 24, 0, 1, 12.0 + bpm: 12, FilePosition1(5), 72, 24, 0, 1, 0 + bpmContents: 94, FilePosition1(5), CommentViewLength(-82), 24, 0, 1, 12.0 + inputMode: 12, FilePosition1(6), 72, 24, 0, 1, 0 + inputModeContents: 94, FilePosition1(6), CommentViewLength(-82), 24, 0, 1, 0 + + # 선곡의 전체 화면 백그라운드 애니메이션 + paintProperty0: 0, 0, DefaultLength(), DefaultHeight(), 1, 0, 0, PaintProperty0Variety(), PaintProperty0Etc(), 0 + + # 선곡의 기록 백그라운드 애니메이션 + paintProperty1: 12, 12, CommentViewLength(0), CommentViewHeight(0), 0, 0, 0, PaintProperty1Variety(), null, 0 + + # 선곡의 기록 백그라운드 애니메이션 테두리 + paintProperty2: 12, 12, CommentViewLength(0), CommentViewHeight(0), 1, 0, 0, 0, null, 0 + + # 리절트의 전체 화면 백그라운드 애니메이션 + paintProperty3: 0, 0, DefaultLength(), DefaultHeight(), 1, 0, 0, PaintProperty3Variety(), PaintProperty3Etc(), 1 + + # 선곡의 오디오 비주얼라이저 + paintProperty4: 12, 12, CommentViewLength(0), CommentViewHeight(0), 0, 0, 0, 10, null, 0 + + # 리절트의 BGA + paintProperty6: JudgmentMeterViewPosition0(), StatusViewPosition1(), JudgmentMeterViewLength(), 288, 0, 0, 0, PaintProperty6Variety(), null, 1 + + # 리절트의 오디오 비주얼라이저 + paintProperty7: JudgmentMeterViewPosition0(), StatusViewPosition1(), JudgmentMeterViewLength(), 288, 0, 0, 0, 10, null, 1 + + # 리절트의 프로필 이미지 + paintProperty9: PaintProperty9Position0(), PaintProperty9Position1(0), 48, 48, 0, 0, 0, 8, null, 1 + + # 리절트의 호칭 + paintProperty10: PaintProperty10Position0(), PaintProperty9Position1(0), 256, 0, 0, 12.0, 0, 12, null, 1 + + # 리절트의 닉네임 + paintProperty11: PaintProperty10Position0(), PaintProperty9Position1(23), 256, 0, 0, 20.0, 0, 7, White, 1 + + # 리절트의 노트 개수, 판정 개수 백그라운드 이미지 + paintProperty12: 12, PaintProperty12Position1(), 394, 406, 1, 0, 0, 0, null, 1 + + # 리절트의 점수, 정확도, 콤보 백그라운드 이미지 + paintProperty13: StandQuitPosition0(-5), PaintProperty13Position1(), 394, 174, 1, 0, 0, 0, null, 1 + + # 리절트의 판정 난이도, NPS, 시간, BPM, 라인 개수 백그라운드 이미지 + paintProperty14: 0, JudgmentStageQuitPosition1(-5), DefaultLength(), 34, 1, 0, 0, 0, null, 1 + + # 리절트의 게임 모드 백그라운드 이미지 + paintProperty15: 0, AutoModeQuitPosition1(-5), 442, 34, 1, 0, 0, 0, null, 1 + + # 리절트의 제목, 작곡가, 장르, 난이도, 난이도 테이블 백그라운드 이미지 + paintProperty16: 0, 0, TitleQuitLength(10), 170, 1, 0, 0, 0, null, 1 + + # 선곡의 오토 플레이 텍스트 + paintProperty17: 12, InputNoteCountViewPosition1(-20), 207.5, 20, 1, 0, 1, 0, null, 0 + + # 선곡의 NPS 비주얼라이저 테두리 + paintProperty21: 12, InputNoteCountViewPosition1(0), CommentViewLength(-34), 68, 1, 0, 0, 0, null, 0 + + # 선곡의 게임 모드 테두리 + paintProperty22: AutoModePosition0(-5), PaintProperty22Position1(), 34, 442, 1, 0, 0, 0, null, 0 + + fadingProperty00: 50, 60, 0.5 + fadingProperty01: 50, 60, 0.5 + fadingProperty02: 50, 60, 0.5 + fadingProperty03: 50, 60, 0.5 + + fadingProperty20: 28, 60, 0.5 + fadingProperty21: 28, 60, 0.5 + fadingProperty22: 28, 60, 0.5 + fadingProperty23: 28, 60, 0.5 + + fadingProperty30: 50, 60, 0.5 + fadingProperty31: 50, 60, 0.5 + + status: 13, InputNoteCountViewPosition1(1), CommentViewLength(-36), 66, 3 + statusDefaultEntry: 13, InputNoteCountViewPosition1(1), CommentViewLength(-36), 66, 3 + + titleQuit: 5, 5, TitleQuitLength(0), 30, 30.0, 1, 2 + artistQuit: 5, 45, TitleQuitLength(0), 20, 20.0, 1, 2 + genreQuit: 5, 75, TitleQuitLength(0), 20.0, 20.0, 1, 2 + levelQuit: 5, 105, TitleQuitLength(0), 20, 20.0, 1, 2 + wantLevelIDQuit: 5, 135, TitleQuitLength(0), 20, 20.0, 1, 2 + + totalNotesJudgmentQuit: 17, TotalNotesQuitPosition1(0), 168, 48 + totalNotesJudgmentContentsQuit: 185, TotalNotesQuitPosition1(0), 216, 48, 30.0, 0, 2 + highestJudgmentQuit: 17, TotalNotesQuitPosition1(1), 168, 48 + highestJudgmentContentsQuit: 185, TotalNotesQuitPosition1(1), 216, 48, 30.0, 0, 2 + higherJudgmentQuit: 17, TotalNotesQuitPosition1(2), 168, 48 + higherJudgmentContentsQuit: 185, TotalNotesQuitPosition1(2), 216, 48, 30.0, 0, 2 + highJudgmentQuit: 17, TotalNotesQuitPosition1(3), 168, 48 + highJudgmentContentsQuit: 185, TotalNotesQuitPosition1(3), 216, 48, 30.0, 0, 2 + lowJudgmentQuit: 17, TotalNotesQuitPosition1(4), 168, 48 + lowJudgmentContentsQuit: 185, TotalNotesQuitPosition1(4), 216, 48, 30.0, 0, 2 + lowerJudgmentQuit: 17, TotalNotesQuitPosition1(5), 168, 48 + lowerJudgmentContentsQuit: 185, TotalNotesQuitPosition1(5), 216, 48, 30.0, 0, 2 + lowestJudgmentQuit: 17, TotalNotesQuitPosition1(6), 168, 48 + lowestJudgmentContentsQuit: 185, TotalNotesQuitPosition1(6), 216, 48, 30.0, 0, 2 + + standQuit: StandQuitPosition0(0), StandQuitPosition1(0), 216, 48 + standContentsQuit: StandContentsQuitPosition0(), StandQuitPosition1(0), 168, 48, 30.0, 0, 2 + pointQuit: StandQuitPosition0(0), StandQuitPosition1(1), 216, 48 + pointContentsQuit: StandContentsQuitPosition0(), StandQuitPosition1(1), 168, 48, 30.0, 0, 2 + bandQuit: StandQuitPosition0(0), StandQuitPosition1(2), 216, 48 + bandContentsQuit: StandContentsQuitPosition0(), StandQuitPosition1(2), 168, 48, 30.0, 0, 2 + + commentPlace: StandQuitPosition0(0), PaintProperty9Position1(0), 158, 48, 30.0 + + judgmentStageQuit: 5, JudgmentStageQuitPosition1(0), 72, 24 + judgmentStageContentsQuit: 87, JudgmentStageQuitPosition1(0), 192, 24, 12.0, 1, 2 + highestInputCountQuit: 289, JudgmentStageQuitPosition1(0), 48, 24 + highestInputCountContentsQuit: 347, JudgmentStageQuitPosition1(0), 144, 24, 12.0, 1, 2 + lengthQuit: 501, JudgmentStageQuitPosition1(0), 72, 24 + lengthContentsQuit: 583, JudgmentStageQuitPosition1(0), 96, 24, 12.0, 1, 2 + bpmQuit: 760, JudgmentStageQuitPosition1(0), 48, 24 + bpmContentsQuit: 818, JudgmentStageQuitPosition1(0), 288, 24, 12.0, 1, 2 + inputModeQuit: 1116, JudgmentStageQuitPosition1(0), 72, 24 + inputModeContentsQuit: 1198, JudgmentStageQuitPosition1(0), 72, 24, 12.0, 1, 2 + + autoModeQuit: 5, AutoModeQuitPosition1(0), 24, 24 + noteSaltModeQuit: 39, AutoModeQuitPosition1(0), 24, 24 + faintNoteModeQuit: 73, AutoModeQuitPosition1(0), 24, 24 + judgmentModeQuit: 107, AutoModeQuitPosition1(0), 24, 24 + hitPointsModeQuit: 141, AutoModeQuitPosition1(0), 24, 24 + noteMobilityModeQuit: 175, AutoModeQuitPosition1(0), 24, 24 + inputFavorModeQuit: 209, AutoModeQuitPosition1(0), 24, 24 + longNoteModeQuit: 243, AutoModeQuitPosition1(0), 24, 24 + noteModifyModeQuit: 277, AutoModeQuitPosition1(0), 24, 24 + bpmModeQuit: 311, AutoModeQuitPosition1(0), 24, 24 + waveModeQuit: 345, AutoModeQuitPosition1(0), 24, 24 + setNoteModeQuit: 379, AutoModeQuitPosition1(0), 24, 24 + lowestJudgmentConditionModeQuit: 413, AutoModeQuitPosition1(0), 24, 24 + + quitDrawingV2: QuitDrawingPosition0(), QuitDrawingPosition1(), 144, 144 + + judgmentMeterView: JudgmentMeterViewPosition0(), JudgmentMeterViewPosition1(), JudgmentMeterViewLength(), 288 + statusView: JudgmentMeterViewPosition0(), StatusViewPosition1(), JudgmentMeterViewLength(), 288 + + viewComment: ViewCommentPosition0(), ViewCommentPosition1(), 113, 40.3 + handleUndo: HandleUndoPosition0(), ViewCommentPosition1(), 97.3, 40.3 + +font: + eventNoteNameLevel: 20.0 + titleLevel: 20.0 + artistLevel: 12.0 + genreLevel: 12.0 + levelLevel: 20.0 + wantLevelIDLevel: 20.0 + entryItemPositionLevel: 12.0 + fittedTextLevel: 12.0 + + commentDateLevel: 12.0 + commentPointLevel: 12.0 + commentAvatarNameLevel: 16.0 + commentStandLevel: 16.0 diff --git a/Qwilight/Assets/UI/@Default/@Default.zip b/Qwilight/Assets/UI/@Default/@Default.zip new file mode 100644 index 0000000..96ae292 --- /dev/null +++ b/Qwilight/Assets/UI/@Default/@Default.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ea56a726559036f566927818d98e33c31c6aca8475366f91b0dec238db6b847 +size 93151288 diff --git a/Qwilight/Assets/UI/Default.wav b/Qwilight/Assets/UI/Default.wav new file mode 100644 index 0000000..44c8dab --- /dev/null +++ b/Qwilight/Assets/UI/Default.wav Binary files differ diff --git a/Qwilight/Assets/UI/Default/Default.lua b/Qwilight/Assets/UI/Default/Default.lua new file mode 100644 index 0000000..33a31d6 --- /dev/null +++ b/Qwilight/Assets/UI/Default/Default.lua @@ -0,0 +1,573 @@ +-- https://taehui.ddns.net/qwilight/assistLS + +function IsO4U() + return configures[1] == 1 +end + +function IsClassic() + return configures[2] == 1 +end + +function IsFloating() + return configures[3] == 1 +end + +function IsYellow() + return configures[4] == 1 +end + +function Pipeline() + if IsClassic() then + return "1, 26, 3, 4, 7, 8, 57, 31, 102, 103, 100, 101, 2, 6, 9, 10, 11, 12, 13, 14, 30, 28, 15, 16, 27, 29, 33, 35, 36, 37, 38, 39, 40, 43, 44, 46, 47, 48, 51, 58, 104" + else + return "1, 26, 3, 4, 7, 8, 57, 31, 102, 103, 100, 101, 61, 2, 6, 9, 10, 11, 12, 13, 14, 30, 28, 15, 16, 27, 29, 33, 35, 36, 37, 38, 39, 40, 43, 44, 46, 47, 48, 51, 58, 104" + end +end + +function JudgmentMainHeight() + if IsFloating() then + return 0 + else + return 99 + end +end + +function MainJudgmentMeterHeight() + if IsFloating() then + return 0 + else + return 199 + end +end + +function AutoHeight1() + if IsFloating() then + return 0 + else + return 19 + end +end + +function NoteLength(e) + if inputCount < 50 then + return (51 + noteLength) * e + else + return (34 + noteLength) * e + end +end + +function NoteHeight1(e) + if IsO4U() then + return 2.0 * NoteHeight2(e) + else + return NoteHeight2(e) + end +end + +function NoteHeight2(e) + if inputCount < 50 then + return (51 + noteLength + noteHeight) * e + else + return (34 + noteLength + noteHeight) * e + end +end + +function FloatingNotePosition0() + if IsFloating() then + if has2P then + return NoteLength(defaultInputCount / 2) + 299.2 + else + return NoteLength(defaultInputCount / 2) + end + else + return 0 + end +end + +function FloatingNoteLength1() + if IsFloating() then + if autoableInputCount < 2 then + return NoteLength(defaultInputCount) + else + return NoteLength(defaultInputCount / 2) + end + else + return 0 + end +end + +function FloatingNoteLength6() + if IsFloating() then + return NoteLength(7 * defaultInputCount / 24) + else + return 0 + end +end + +function NoteHitFrame(e) + if IsO4U() then + return 20 * e + else + return 7 * e + end +end + +function MainPosition(e) + local position + if inputCount < 11 then + position = 540 - P1BuiltLength(1.0) + elseif inputCount < 16 then + position = 138.9 + else + position = 20.0 + end + return mainPosition + position + e +end + +function isNarrow() + if has2P then + return inputCount / 2 < 7 + else + return inputCount < 7 + end +end + +function isNarrower() + if has2P then + return inputCount / 2 < 5 + else + return inputCount < 5 + end +end + +function NetPosition1() + if IsClassic() then + return 30 + else + return 5 + end +end + +function BandPosition1() + return 120 + bandPosition +end + +function JudgmentMeterPosition1() + return 96 + bandPosition +end + +function AltClassic() + if IsClassic() then + return 0 + else + return 2 + end +end + +function MultiplierPosition0() + if IsClassic() then + return 1275 + else + return Wall(-5) + end +end + +function MultiplierPosition1() + if IsClassic() then + return 599 + else + return 649 + end +end + +function AudioMultiplierPosition0() + if IsClassic() then + return 1275 + else + return Wall(-5) + end +end + +function AudioMultiplierPosition1() + if IsClassic() then + return 624 + else + return 679 + end +end + +function InputVisualizerSystem() + if IsClassic() then + return 0 + else + return 2 + end +end + +function InputVisualizerPosition0() + if IsClassic() then + return Wall(25) + else + return Wall(-5) + end +end + +function InputVisualizerPosition1() + if IsClassic() then + return 554 + else + return 704 + end +end + +function HmsSystem() + if IsClassic() then + return 0 + else + if isNarrower() then + return 2 + elseif isNarrow() then + return 0 + else + return 1 + end + end +end + +function HmsPosition0() + if IsClassic() then + return Wall(25) + else + if isNarrower() then + return MainPosition(-25) + elseif isNarrow() then + return MainPosition(5) + else + return Contents(0.5) + end + end +end + +function HmsPosition1() + if IsClassic() then + return 5 + else + return 649 + end +end + +function StandSystem() + if IsClassic() then + return 2 + else + if isNarrower() then + return 2 + elseif isNarrow() then + return 0 + else + return 0 + end + end +end + +function StandPosition0() + if IsClassic() then + return 1275 + else + if isNarrower() then + return MainPosition(-25) + elseif isNarrow() then + return MainPosition(5) + else + return MainPosition(5) + end + end +end + +function StandPosition1() + if IsClassic() then + return 5 + else + return 679 + end +end + +function PointSystem() + if IsClassic() then + return 2 + else + return 1 + end +end + +function PointPosition0() + if IsClassic() then + return 1275 + else + return Contents(0.5) + end +end + +function PointPosition1() + if IsClassic() then + return 46 + else + return 175 + bandPosition + end +end + +function BPMSystem() + if IsClassic() then + return 2 + else + if isNarrow() then + return 2 + else + return 0 + end + end +end + +function BPMPosition0() + if IsClassic() then + return 1232.6 + else + if isNarrow() then + return MainPosition(-25 - 42.4) + else + return MainPosition(5) + end + end +end + +function BPMPosition1() + if IsClassic() then + return 649 + else + if isNarrower() then + return 619 + elseif isNarrow() then + return 649 + else + return 649 + end + end +end + +function MediaPosition0() + if inputCount < 11 then + return MainPosition(0) + P1BuiltLength(1.0) + 20 + else + return 0 + end +end + +function MediaLength() + if inputCount < 11 then + return 720 + else + return 1280 + end +end + +function JudgmentMainPosition(e) + local position = 504 + judgmentMainPositionV3 + e + if IsClassic() then + position = position + 76 + end + return position +end + +function HitNotePaintPosition01(e) + if IsO4U() then + return -NoteLength(e) + else + return -3 * NoteLength(e) + end +end + +function HitNotePaintPosition02(e) + if IsO4U() then + return -NoteLength(e) + else + return -3 * NoteLength(e) + end +end + +function HitNotePaintPosition11(e) + if IsO4U() then + return -NoteLength(e) + else + return -3.6 * NoteLength(e) + end +end + +function HitNotePaintPosition12(e) + if IsO4U() then + return -NoteLength(e) + else + return -3.6 * NoteLength(e) + end +end + +function LongNoteEdgePosition1() + if not IsFloating() and IsO4U() then + return -51 + else + return -6 + end +end + +function LongNoteEdgePosition2() + if IsO4U() then + return -26 + else + return -6 + end +end + +function LongNoteEdgeHeight1() + if not IsFloating() and IsO4U() then + return 102 + else + return 11 + end +end + +function LongNoteEdgeHeight2() + if IsO4U() then + return 51 + else + return 11 + end +end + +function HitPointsPosition1() + if IsClassic() then + return 705 + else + return 629 + end +end + +function PaintProperty3Position1() + if IsClassic() then + return 700 + else + return 624 + end +end + +function PaintProperty4Position0() + return Contents(0.5) - 4 +end + +function PaintProperty4Position1() + local position + if IsClassic() then + position = 190 + else + position = 214 + end + return position + bandPosition +end + +function PaintProperty2Frame() + if IsClassic() then + return 0 + else + return 10 + end +end + +function JudgmentVisualizerPosition1() + local position + if IsClassic() then + position = 175 + else + position = 199 + end + return position + bandPosition +end + +function HunterPosition1() + local position + if IsClassic() then + position = 199 + else + position = 223 + end + return position + bandPosition +end + +function DrawingInputMode(e) + if e == 5 then + if IsYellow() then + return "2, 3, 4, 3, 2" + else + return "2, 3, 2, 3, 2" + end + elseif e == 7 then + if IsYellow() then + return "2, 3, 2, 5, 2, 3, 2" + else + return "2, 3, 2, 3, 2, 3, 2" + end + elseif e == 9 then + if IsYellow() then + return "2, 3, 2, 3, 4, 3, 2, 3, 2" + else + return "2, 3, 2, 3, 2, 3, 2, 3, 2" + end + elseif e == 10 then + if IsYellow() then + return "1, 2, 3, 4, 3, 2" + else + return "1, 2, 3, 2, 3, 2" + end + elseif e == 11 then + if IsYellow() then + return "1, 2, 3, 2, 5, 2, 3, 2" + else + return "1, 2, 3, 2, 3, 2, 3, 2" + end + elseif e == 12 then + if IsYellow() then + return "1, 2, 3, 4, 3, 2, 2, 3, 4, 3, 2, 10" + else + return "1, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 10" + end + elseif e == 13 then + if IsYellow() then + return "1, 2, 3, 2, 5, 2, 3, 2, 2, 3, 2, 5, 2, 3, 2, 10" + else + return "1, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 10" + end + end +end + +function _GetNote(args) + if IsFloating() and args[1] == 1 and (args[3] == 0 or args[3] == 2 or args[3] == 4 or args[3] == 9 or args[3] == 14) then + return "N2" + elseif IsO4U() and args[1] != 0 and (not IsFloating() or args[1] != 1) then + return "N1" + else + return "N" + end +end + +function _GetNotePaint() + if IsO4U() then + return "N1" + else + return "N" + end +end + +function _GetMain(args) + if IsFloating() and args[1] == 1 then + return "M2" + else + return "M" + end +end \ No newline at end of file diff --git a/Qwilight/Assets/UI/Default/Default.yaml b/Qwilight/Assets/UI/Default/Default.yaml new file mode 100644 index 0000000..a136464 --- /dev/null +++ b/Qwilight/Assets/UI/Default/Default.yaml @@ -0,0 +1,445 @@ +# https://taehui.ddns.net/qwilight/assistYAML + +format: + zip: Default + lua: Default + title: Qwilight Basic Skin + title-1042: Qwilight 기본 스킨 + comment: | + It's a basic skin made by a developer. + It supports regular and circular notes. + If you select O4U in the skin detail setting, you can play with a circular note. + If Floating is selected in the Skin Details setting, the turn table is modified to a side track note. + comment-1042: | + 개발자가 만든 기본 스킨입니다. + 일반 노트와 원형 노트를 지원합니다. + 스킨 세부 설정에서 O4U를 선택하면 원형 노트로 플레이 가능합니다. + 스킨 세부 설정에서 Floating을 선택하면 턴 테이블이 사이드 트랙 노트로 수정됩니다. + +frame: + note-frame: 1 + note-framerate: 60 + + main-frame: 1 + main-framerate: 60 + + judgment-main-frame: 10 + judgment-main-framerate: 60 + + note-hit-frame: NoteHitFrame(1.0) + note-hit-framerate: 60 + + long-note-hit-frame: NoteHitFrame(1.0) + long-note-hit-framerate: 60 + long-note-hit-loop-frame: NoteHitFrame(0.75) + last-enlarged-band-loop-frame: NoteHitFrame(0.75) + + judgment-frame: 25 + band!-frame: 50 + last-frame: 50 + + judgment-framerate: 60 + band!-framerate: 60 + last-framerate: 60 + + input-frame: 1 + input-framerate: 60 + + band-frame: 8 + band-framerate: 60 + + main-judgment-meter-frame: 50 + main-judgment-meter-framerate: 60 + +func: + maintainLongNoteFrontEdge: false + setJudgmentMainPosition: true + setMainPosition: true + setNoteLength: true + setNoteHeight: true + setBandPosition: true + + configure-comment-0: Select the shape of the note. + configure-0: Default (Bar Note), O4U (Round note) + configure-comment-0-1042: 노트 모양을 선택합니다. + configure-0-1042: Default (바 노트), O4U (원형 노트) + + configure-comment-1: Choose a style. + configure-1: Default (New), Classic (Old) + configure-comment-1-1042: 스타일을 선택합니다. + configure-1-1042: Default (신형), Classic (구형) + + configure-comment-2: Select a turn table. + configure-2: Default (General), Floating (Side Track) + configure-comment-2-1042: 턴 테이블을 선택합니다. + configure-2-1042: Default (일반), Floating (사이드 트랙) + + configure-comment-3: Select a center note color. + configure-3: Default (Yellow), Classic (Blue) + configure-comment-3-1042: 중앙 노트 색상을 선택합니다. + configure-3-1042: Classic (파란색), Default (노란색) + + pipeline: Pipeline() + + drawingInputModeSystem: 2 + drawingInputMode4: 2, 3, 3, 2 + drawingInputMode5: DrawingInputMode(5) + drawingInputMode6: 2, 3, 2, 2, 3, 2 + drawingInputMode7: DrawingInputMode(7) + drawingInputMode8: 2, 3, 2, 3, 3, 2, 3, 2 + drawingInputMode9: DrawingInputMode(9) + drawingInputMode10: DrawingInputMode(10) + drawingInputMode11: DrawingInputMode(11) + drawingInputMode12: DrawingInputMode(12) + drawingInputMode13: DrawingInputMode(13) + drawingInputMode14: 2, 3, 2, 3, 2, 2, 3, 2, 3, 2 + drawingInputMode15: 6, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 11 + drawingInputMode16: 6, 6, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 11, 11 + + drawing1: 1, 6, 10, 11 + drawing2: 2, 7, 9 + drawing3: 3, 8 + drawing4: 4, 5 + drawing5: + drawing6: + drawing7: + drawing8: + drawing9: + drawing10: + + drawingPipeline: 0, 1, 10, 2, 3, 4, 5, 11, 6, 7, 9, 8 + + alt-hit-points: 2 + alt-status: 2 + alt-status-slider: 2 + alt-band: 2 + alt-bpm: AltClassic() + alt-multiplier: AltClassic() + alt-stand: 2 + alt-point: 2 + alt-net: 0 + alt-pause: 0 + alt-hms: 2 + alt-judgment-meter: 2 + alt-judgment-points: 2 + alt-last: 2 + alt-band!: 2 + alt-wall-0: 2 + alt-wall-1: 2 + alt-audio-multiplier: AltClassic() + alt-input-visualizer: AltClassic() + alt-judgment-visualizer: 2 + alt-hunter: 2 + alt-judgment-input-visualizer: 2 + +point: + noteLength: NoteLength(2.0), NoteLength(1.0), ~, ~, ~, NoteLength(2.0), NoteLength(1.0), ~, ~, NoteLength(2.0) + noteHeight: NoteHeight1(1.0), NoteHeight2(1.0), ~, ~, ~, NoteHeight1(1.0), NoteHeight2(1.0), ~, ~, NoteHeight1(1.0) + noteHeightJudgment: NoteHeight1(0.5), NoteHeight2(0.5), ~, ~, ~, NoteHeight1(0.5), NoteHeight2(0.5), ~, ~, NoteHeight1(0.5) + + floatingNotePosition0: 0, ~, ~, ~, ~, ~, ~, ~, ~, FloatingNotePosition0(), FloatingNoteLength6() + floatingNoteLength: FloatingNoteLength1(), 0, ~, ~, ~, FloatingNoteLength6(), 0, ~, ~, FloatingNoteLength1(), FloatingNoteLength6() + + slashNotePosition0: 0, ~, ~, ~, ~, ~, NoteLength(-0.5), ~, 0 + + judgmentMainPosition: JudgmentMainPosition(0) + judgmentMainPosition1: JudgmentMainPosition(-49) + judgmentMainHeight: JudgmentMainHeight(), 99, ~, ~, ~, JudgmentMainHeight(), 99, ~, ~, JudgmentMainHeight() + + mainPosition1: 0 + mainHeight: JudgmentMainPosition(0) + + inputPosition1: JudgmentMainPosition(0) + inputHeight: 120 + + autoInputPosition1: 5 + autoInputHeight: AutoHeight1(), 19, ~, ~, ~, AutoHeight1(), 19, ~, ~, AutoHeight1(), ~ + + longNoteTailEdgePosition: LongNoteEdgePosition1(), LongNoteEdgePosition2(), ~, ~, ~, LongNoteEdgePosition1(), LongNoteEdgePosition2(), ~, ~, LongNoteEdgePosition1() + longNoteTailEdgeHeight: LongNoteEdgeHeight1(), LongNoteEdgeHeight2(), ~, ~, ~, LongNoteEdgeHeight1(), LongNoteEdgeHeight2(), ~, ~, LongNoteEdgeHeight1() + longNoteTailContentsHeight: 0 + + longNoteFrontEdgePosition: LongNoteEdgePosition1(), LongNoteEdgePosition2(), ~, ~, ~, LongNoteEdgePosition1(), LongNoteEdgePosition2(), ~, ~, LongNoteEdgePosition1() + longNoteFrontEdgeHeight: LongNoteEdgeHeight1(), LongNoteEdgeHeight2(), ~, ~, ~, LongNoteEdgeHeight1(), LongNoteEdgeHeight2(), ~, ~, LongNoteEdgeHeight1() + longNoteFrontContentsHeight: 0 + + mainPosition: MainPosition(0) + p2Position: 299.2 + + mainWall0Position1: 0 + mainWall0Length: 20 + mainWall0Height: 720 + + mainWall1Position1: 0 + mainWall1Length: 20 + mainWall1Height: 720 + + binLength: 30.8 + binHeight: 40 + stopPointDrawingLength: 16.8 + + standSystem: StandSystem() + standPosition0: StandPosition0() + standPosition1: StandPosition1() + binStandLength: 19 + binStandHeight: 36 + standCommaDrawingLength: 11 + + pointSystem: PointSystem() + pointPosition0: PointPosition0() + pointPosition1: PointPosition1() + binPointLength: 19.6 + binPointHeight: 19 + pointStopPointDrawingLength: 7.79 + pointUnitDrawingLength: 15.58 + + bandSystem: 1 + bandPosition0: Contents(0.5) + bandPosition1: BandPosition1() + binBandLength: 38.5 + binBandHeight: 50 + enlargeBand: 12 + + judgmentSystem: 1 + judgmentPosition0: Contents(0.5) + judgmentPosition1: JudgmentMainPosition(-154) + judgmentLength: 300 + judgmentHeight: 100 + + hitNotePaintPosition0: HitNotePaintPosition01(2.0), HitNotePaintPosition02(1.0), ~, ~, ~, HitNotePaintPosition01(2.0), HitNotePaintPosition02(1.0), ~, ~, HitNotePaintPosition01(2.0) + hitNotePaintPosition1: HitNotePaintPosition11(2.0), HitNotePaintPosition12(1.0), ~, ~, ~, HitNotePaintPosition11(2.0), HitNotePaintPosition12(1.0), ~, ~, HitNotePaintPosition11(2.0) + hitNotePaintLength: HitNotePaintPosition01(-4.0), HitNotePaintPosition02(-2.0), ~, ~, ~, HitNotePaintPosition01(-4.0), HitNotePaintPosition02(-2.0), ~, ~, HitNotePaintPosition01(-4.0) + hitNotePaintHeight: HitNotePaintPosition11(-4.0), HitNotePaintPosition12(-2.0), ~, ~, ~, HitNotePaintPosition11(-4.0), HitNotePaintPosition12(-2.0), ~, ~, HitNotePaintPosition11(-4.0) + + hitLongNotePaintPosition0: HitNotePaintPosition01(2.0), HitNotePaintPosition02(1.0), ~, ~, ~, HitNotePaintPosition01(2.0), HitNotePaintPosition02(1.0), ~, ~, HitNotePaintPosition01(2.0) + hitLongNotePaintPosition1: HitNotePaintPosition11(2.0), HitNotePaintPosition12(1.0), ~, ~, ~, HitNotePaintPosition11(2.0), HitNotePaintPosition12(1.0), ~, ~, HitNotePaintPosition11(2.0) + hitLongNotePaintLength: HitNotePaintPosition01(-4.0), HitNotePaintPosition02(-2.0), ~, ~, ~, HitNotePaintPosition01(-4.0), HitNotePaintPosition02(-2.0), ~, ~, HitNotePaintPosition01(-4.0) + hitLongNotePaintHeight: HitNotePaintPosition11(-4.0), HitNotePaintPosition12(-2.0), ~, ~, ~, HitNotePaintPosition11(-4.0), HitNotePaintPosition12(-2.0), ~, ~, HitNotePaintPosition11(-4.0) + + bpmSystem: BPMSystem() + bpmPosition0: BPMPosition0() + bpmPosition1: BPMPosition1() + bpmUnitDrawingLength: 42.4 + binBPMLength: 15.4 + binBPMHeight: 20 + + judgmentMeterSystem: 0 + judgmentMeterPosition0: Contents(0.5) + judgmentMeterPosition1: JudgmentMeterPosition1() + binJudgmentMeterLength: 14.63 + binJudgmentMeterHeight: 19 + judgmentMeterFrontDrawingLength: 14.63 + judgmentMeterUnitDrawingLength: 27.17 + + hitPointsSystem: 3 + hitPointsPosition0: MainPosition(0) + hitPointsPosition1: HitPointsPosition1() + hitPointsLength: P1BuiltLength(1.0) + hitPointsHeight: 10 + + hitPointsVisualizerSystem: 2 + hitPointsVisualizerPosition0: MainPosition(0) + hitPointsVisualizerPosition1: 613 + hitPointsVisualizerLength: P1BuiltLength(1.0) + hitPointsVisualizerHeight: 10 + + # 박자에 맞추어 반짝거리는 왼쪽 막대기 + paintProperty0: MainPosition(-40), 0, 60, 720, 2, 10, 60, 1 + + # 박자에 맞추어 반짝거리는 오른쪽 막대기 + paintProperty1: Wall(-20), 0, 60, 720, 2, 10, 60, 1 + + # 박자에 맞추어 반짝거리는 아래 사각형 영역 + paintProperty2: MainPosition(0), 644, P1BuiltLength(1), 76, 2, PaintProperty2Frame(), 60, 1 + + # 라이프 게이지를 감싸는 막대기 + paintProperty3: MainPosition(0), PaintProperty3Position1(), P1BuiltLength(1), 20, 2, 1, 60, 0 + + # 판정 비주얼라이저 기준점 + paintProperty4: PaintProperty4Position0(), PaintProperty4Position1(), 7, 4, 2, 1, 60, 0, 43 + + multiplierSystem: 2 + multiplierPosition0: MultiplierPosition0() + multiplierPosition1: MultiplierPosition1() + binMultiplierLength: 15.4 + binMultiplierHeight: 20 + multiplierStopPointDrawingLength: 8.4 + multiplierUnitDrawingLength: 20 + + netPosition0: Wall(25) + netPosition1: NetPosition1() + + pauseSystem: 0 + pausePosition0: 5 + pausePosition1: 629 + pauseLength: 66 + pauseHeight: 86 + + mediaPosition0: MediaPosition0() + mediaPosition1: 0 + mediaLength: MediaLength() + mediaHeight: 720 + + statusSystem: 0 + statusPosition0: Wall(5) + statusPosition1: 0 + statusLength: 10 + statusHeight: 720 + + statusSliderSystem: 0 + statusSliderPosition0: Wall(0) + statusSliderPosition1: 0 + statusSliderContentsLength: 20 + statusSliderContentsHeight: 10 + statusSliderLength: 10 + statusSliderHeight: 720 + + hmsSystem: HmsSystem() + hmsPosition0: HmsPosition0() + hmsPosition1: HmsPosition1() + binHmsLength: 15.4 + binHmsHeight: 20 + hmsColonDrawingLength: 8.4 + hmsSlashDrawingLength: 12.1 + + lastSystem: 1 + lastPosition0: Contents(0.5) + lastPosition1: 250 + lastLength: 119 + lastHeight: 18.25 + + band!System: 1 + band!Position0: Contents(0.5) + band!Position1: 250 + band!Length: 230 + band!Height: 18.75 + + judgmentPointsSystem: 0 + judgmentPointsPosition0: MainPosition(-15) + judgmentPointsPosition1: 0 + judgmentPointsLength: 10 + judgmentPointsHeight: 720 + + audioMultiplierSystem: 2 + audioMultiplierPosition0: AudioMultiplierPosition0() + audioMultiplierPosition1: AudioMultiplierPosition1() + binAudioMultiplierLength: 15.4 + binAudioMultiplierHeight: 20 + audioMultiplierStopPointDrawingLength: 8.4 + audioMultiplierUnitDrawingLength: 20 + + highestJudgmentValueSystem: 0 + highestJudgmentValuePosition0: Wall(25) + highestJudgmentValuePosition1: 570 + binHighestJudgmentValueLength: 15.4 + binHighestJudgmentValueHeight: 20 + + higherJudgmentValueSystem: 0 + higherJudgmentValuePosition0: Wall(25) + higherJudgmentValuePosition1: 595 + binHigherJudgmentValueLength: 15.4 + binHigherJudgmentValueHeight: 20 + + highJudgmentValueSystem: 0 + highJudgmentValuePosition0: Wall(25) + highJudgmentValuePosition1: 620 + binHighJudgmentValueLength: 15.4 + binHighJudgmentValueHeight: 20 + + lowJudgmentValueSystem: 0 + lowJudgmentValuePosition0: Wall(25) + lowJudgmentValuePosition1: 645 + binLowJudgmentValueLength: 15.4 + binLowJudgmentValueHeight: 20 + + lowerJudgmentValueSystem: 0 + lowerJudgmentValuePosition0: Wall(25) + lowerJudgmentValuePosition1: 670 + binLowerJudgmentValueLength: 15.4 + binLowerJudgmentValueHeight: 20 + + lowestJudgmentValueSystem: 0 + lowestJudgmentValuePosition0: Wall(25) + lowestJudgmentValuePosition1: 695 + binLowestJudgmentValueLength: 15.4 + binLowestJudgmentValueHeight: 20 + + limiterPosition: 0 + limiterLength: 1 + limiterHeight: JudgmentMainPosition(-5) + + inputVisualizerSystem: InputVisualizerSystem() + inputVisualizerPosition0: InputVisualizerPosition0() + inputVisualizerPosition1: InputVisualizerPosition1() + binInputVisualizerLength: 8.47 + binInputVisualizerHeight: 11 + + judgmentVisualizerSystem: 3 + judgmentVisualizerPosition0: MainPosition(0) + judgmentVisualizerPosition1: JudgmentVisualizerPosition1() + judgmentVisualizerLength: P1BuiltLength(1.0) + judgmentVisualizerHeight: 10 + judgmentVisualizerContentsLength: 1 + judgmentVisualizerContentsHeight: 10 + + hunterSystem: 1 + hunterPosition0: Contents(0.5) + hunterPosition1: HunterPosition1() + binHunterLength: 14.63 + binHunterHeight: 19 + + titleSystem0: 0 + titleSystem1: 1 + titlePosition0: 5 + titlePosition1: 674 + titleLength: 1270 + titleHeight: 20 + + artistSystem0: 0 + artistSystem1: 1 + artistPosition0: 5 + artistPosition1: 699 + artistLength: 1270 + artistHeight: 16 + + mediaInputPosition0: MediaPosition0() + mediaInputPosition1: 0 + mediaInputLength: MediaLength() + mediaInputHeight: 720 + + audioVisualizerPosition0: 0 + audioVisualizerPosition1: 0 + audioVisualizerLength: 1280 + audioVisualizerHeight: 720 + + mainJudgmentMeterPosition1: JudgmentMainPosition(-99) + mainJudgmentMeterHeight: MainJudgmentMeterHeight(), 199, ~, ~, ~, MainJudgmentMeterHeight(), 199, ~, ~, MainJudgmentMeterHeight() + + judgmentInputVisualizerPosition0: MainPosition(0) + judgmentInputVisualizerPosition1: 644 + judgmentInputVisualizerLength: P1BuiltLength(1) + judgmentInputVisualizerHeight: 76 + + pausedUnpausePosition0: 539 + pausedUnpausePosition1: 239 + pausedUnpauseLength: 202 + pausedUnpauseHeight: 53 + + pausedConfigurePosition0: 539 + pausedConfigurePosition1: 302 + pausedConfigureLength: 202 + pausedConfigureHeight: 53 + + pausedUndoPosition0: 539 + pausedUndoPosition1: 365 + pausedUndoLength: 202 + pausedUndoHeight: 53 + + pausedStopPosition0: 539 + pausedStopPosition1: 428 + pausedStopLength: 202 + pausedStopHeight: 53 + +font: + titleLevel: 20.0 + artistLevel: 16.0 diff --git a/Qwilight/Assets/UI/Default/Default.zip b/Qwilight/Assets/UI/Default/Default.zip new file mode 100644 index 0000000..a72d041 --- /dev/null +++ b/Qwilight/Assets/UI/Default/Default.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41d612b02e6be84670434565f53411eda893ce287db8d4cf1a6cb42c563fe877 +size 27063661 diff --git a/Qwilight/Assets/x64/CChromaEditorLibrary64.dll b/Qwilight/Assets/x64/CChromaEditorLibrary64.dll new file mode 100644 index 0000000..608576a --- /dev/null +++ b/Qwilight/Assets/x64/CChromaEditorLibrary64.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14e5709b9de7c454ecfb0b9386591ed64f67af6e35be27b8b695bcafc8ac256a +size 436112 diff --git a/Qwilight/Assets/x64/LogitechLedEnginesWrapper.dll b/Qwilight/Assets/x64/LogitechLedEnginesWrapper.dll new file mode 100644 index 0000000..815b40c --- /dev/null +++ b/Qwilight/Assets/x64/LogitechLedEnginesWrapper.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46a0773e5ae6ef5b24557f3051e18a62527c7b2c133360dfb21522cbfe9cbdd1 +size 20104 diff --git a/Qwilight/Assets/x64/concrt140_app.dll b/Qwilight/Assets/x64/concrt140_app.dll new file mode 100644 index 0000000..e6dbcdc --- /dev/null +++ b/Qwilight/Assets/x64/concrt140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d72a4391c4852bf4f0937f18d7edbf9ac4343e19861d7856c249615c12e4dd9c +size 58248 diff --git a/Qwilight/Assets/x64/ffmpeg.exe b/Qwilight/Assets/x64/ffmpeg.exe new file mode 100644 index 0000000..e323423 --- /dev/null +++ b/Qwilight/Assets/x64/ffmpeg.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9fb1e0934e04b91b6924de97edd2e1b80fc5dfa0a7f08c32b9c5cca3a12717b +size 131666944 diff --git a/Qwilight/Assets/x64/fmod.dll b/Qwilight/Assets/x64/fmod.dll new file mode 100644 index 0000000..5425dd6 --- /dev/null +++ b/Qwilight/Assets/x64/fmod.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba377c62ad807fe17e4177b46259237035e544a5893367e296fbae07b11b1bcb +size 1852928 diff --git a/Qwilight/Assets/x64/msvcp140_1_app.dll b/Qwilight/Assets/x64/msvcp140_1_app.dll new file mode 100644 index 0000000..5ab19cf --- /dev/null +++ b/Qwilight/Assets/x64/msvcp140_1_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5d37b76fe107d5d23f498b582cf11dc1b3c4649c844ed7dc7c2e27001072823 +size 19336 diff --git a/Qwilight/Assets/x64/msvcp140_2_app.dll b/Qwilight/Assets/x64/msvcp140_2_app.dll new file mode 100644 index 0000000..7816bb3 --- /dev/null +++ b/Qwilight/Assets/x64/msvcp140_2_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:580c855e1e58510207b9156df9bdb32ffbd15ce4405babcb90694212a8798587 +size 21384 diff --git a/Qwilight/Assets/x64/msvcp140_app.dll b/Qwilight/Assets/x64/msvcp140_app.dll new file mode 100644 index 0000000..7a99faa --- /dev/null +++ b/Qwilight/Assets/x64/msvcp140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0637809160ce043e5530daf6b93bf59611b4de409274c55ba87a2cef57cb202 +size 259968 diff --git a/Qwilight/Assets/x64/sl.common.dll b/Qwilight/Assets/x64/sl.common.dll new file mode 100644 index 0000000..e1715a6 --- /dev/null +++ b/Qwilight/Assets/x64/sl.common.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89757451c31aaef5c6e9787ef340e5e47948b69a3a6ab23aa52449b2deb9be5a +size 643544 diff --git a/Qwilight/Assets/x64/sl.interposer.dll b/Qwilight/Assets/x64/sl.interposer.dll new file mode 100644 index 0000000..f43a3ca --- /dev/null +++ b/Qwilight/Assets/x64/sl.interposer.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b15b4060b25a57f9c3293582489720b4ee1895e0610b20b3aa0f2e3f6c151106 +size 519640 diff --git a/Qwilight/Assets/x64/sl.reflex.dll b/Qwilight/Assets/x64/sl.reflex.dll new file mode 100644 index 0000000..79bfb4e --- /dev/null +++ b/Qwilight/Assets/x64/sl.reflex.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a069419c7e4cad6dad443515af3a61112e16f9a442914c274c09fc8a8c4dba2b +size 175576 diff --git a/Qwilight/Assets/x64/steam_api64.dll b/Qwilight/Assets/x64/steam_api64.dll new file mode 100644 index 0000000..3017a99 --- /dev/null +++ b/Qwilight/Assets/x64/steam_api64.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:473f5a312b56519f347741b63f3dea590946b96ea40ef3803d5f452c39af2f1e +size 262944 diff --git a/Qwilight/Assets/x64/vcamp140_app.dll b/Qwilight/Assets/x64/vcamp140_app.dll new file mode 100644 index 0000000..329300a --- /dev/null +++ b/Qwilight/Assets/x64/vcamp140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e32420c9f3046a0112fd5fb47401978565db2bcad95857be7a4bc83f05f7aa6f +size 46984 diff --git a/Qwilight/Assets/x64/vccorlib140_app.dll b/Qwilight/Assets/x64/vccorlib140_app.dll new file mode 100644 index 0000000..873096a --- /dev/null +++ b/Qwilight/Assets/x64/vccorlib140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e758adafe70e48a4f79b19b6c2013e35714415054b6b3ee672eb91b58e91f6c8 +size 51080 diff --git a/Qwilight/Assets/x64/vcomp140_app.dll b/Qwilight/Assets/x64/vcomp140_app.dll new file mode 100644 index 0000000..92cc505 --- /dev/null +++ b/Qwilight/Assets/x64/vcomp140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6ef242b68b291a1d8475abd4bb8548ddbbc7d4fba7c9bb511ef2e92028b6c84 +size 25480 diff --git a/Qwilight/Assets/x64/vcruntime140_1_app.dll b/Qwilight/Assets/x64/vcruntime140_1_app.dll new file mode 100644 index 0000000..29d60f9 --- /dev/null +++ b/Qwilight/Assets/x64/vcruntime140_1_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2efe940aae0ac70e11daeeec5a200a24aa3d208e558bc18109d85a2b97a16f6e +size 18824 diff --git a/Qwilight/Assets/x64/vcruntime140_app.dll b/Qwilight/Assets/x64/vcruntime140_app.dll new file mode 100644 index 0000000..a95d216 --- /dev/null +++ b/Qwilight/Assets/x64/vcruntime140_app.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8da0fb0d749c44de827dee17fad98f473b9c66f429fbacae7bb2ad1c0166cb2c +size 22920 diff --git a/Qwilight/Assets/x64/windowsappruntimeinstall-x64.exe b/Qwilight/Assets/x64/windowsappruntimeinstall-x64.exe new file mode 100644 index 0000000..cd66772 --- /dev/null +++ b/Qwilight/Assets/x64/windowsappruntimeinstall-x64.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:123de6f4cbbc1c99694c408076dda79f4d50c0b75a9dd95425b7fd01b219c1c4 +size 64180144 diff --git a/Qwilight/ChromaSDK/ChromaAnimationAPI.cs b/Qwilight/ChromaSDK/ChromaAnimationAPI.cs new file mode 100644 index 0000000..1b2977b --- /dev/null +++ b/Qwilight/ChromaSDK/ChromaAnimationAPI.cs @@ -0,0 +1,10071 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +namespace ChromaSDK +{ + public class Keyboard + { + //! Definitions of keys. + public enum RZKEY + { + RZKEY_ESC = 0x0001, /*!< Esc (VK_ESCAPE) */ + RZKEY_F1 = 0x0003, /*!< F1 (VK_F1) */ + RZKEY_F2 = 0x0004, /*!< F2 (VK_F2) */ + RZKEY_F3 = 0x0005, /*!< F3 (VK_F3) */ + RZKEY_F4 = 0x0006, /*!< F4 (VK_F4) */ + RZKEY_F5 = 0x0007, /*!< F5 (VK_F5) */ + RZKEY_F6 = 0x0008, /*!< F6 (VK_F6) */ + RZKEY_F7 = 0x0009, /*!< F7 (VK_F7) */ + RZKEY_F8 = 0x000A, /*!< F8 (VK_F8) */ + RZKEY_F9 = 0x000B, /*!< F9 (VK_F9) */ + RZKEY_F10 = 0x000C, /*!< F10 (VK_F10) */ + RZKEY_F11 = 0x000D, /*!< F11 (VK_F11) */ + RZKEY_F12 = 0x000E, /*!< F12 (VK_F12) */ + RZKEY_1 = 0x0102, /*!< 1 (VK_1) */ + RZKEY_2 = 0x0103, /*!< 2 (VK_2) */ + RZKEY_3 = 0x0104, /*!< 3 (VK_3) */ + RZKEY_4 = 0x0105, /*!< 4 (VK_4) */ + RZKEY_5 = 0x0106, /*!< 5 (VK_5) */ + RZKEY_6 = 0x0107, /*!< 6 (VK_6) */ + RZKEY_7 = 0x0108, /*!< 7 (VK_7) */ + RZKEY_8 = 0x0109, /*!< 8 (VK_8) */ + RZKEY_9 = 0x010A, /*!< 9 (VK_9) */ + RZKEY_0 = 0x010B, /*!< 0 (VK_0) */ + RZKEY_A = 0x0302, /*!< A (VK_A) */ + RZKEY_B = 0x0407, /*!< B (VK_B) */ + RZKEY_C = 0x0405, /*!< C (VK_C) */ + RZKEY_D = 0x0304, /*!< D (VK_D) */ + RZKEY_E = 0x0204, /*!< E (VK_E) */ + RZKEY_F = 0x0305, /*!< F (VK_F) */ + RZKEY_G = 0x0306, /*!< G (VK_G) */ + RZKEY_H = 0x0307, /*!< H (VK_H) */ + RZKEY_I = 0x0209, /*!< I (VK_I) */ + RZKEY_J = 0x0308, /*!< J (VK_J) */ + RZKEY_K = 0x0309, /*!< K (VK_K) */ + RZKEY_L = 0x030A, /*!< L (VK_L) */ + RZKEY_M = 0x0409, /*!< M (VK_M) */ + RZKEY_N = 0x0408, /*!< N (VK_N) */ + RZKEY_O = 0x020A, /*!< O (VK_O) */ + RZKEY_P = 0x020B, /*!< P (VK_P) */ + RZKEY_Q = 0x0202, /*!< Q (VK_Q) */ + RZKEY_R = 0x0205, /*!< R (VK_R) */ + RZKEY_S = 0x0303, /*!< S (VK_S) */ + RZKEY_T = 0x0206, /*!< T (VK_T) */ + RZKEY_U = 0x0208, /*!< U (VK_U) */ + RZKEY_V = 0x0406, /*!< V (VK_V) */ + RZKEY_W = 0x0203, /*!< W (VK_W) */ + RZKEY_X = 0x0404, /*!< X (VK_X) */ + RZKEY_Y = 0x0207, /*!< Y (VK_Y) */ + RZKEY_Z = 0x0403, /*!< Z (VK_Z) */ + RZKEY_NUMLOCK = 0x0112, /*!< Numlock (VK_NUMLOCK) */ + RZKEY_NUMPAD0 = 0x0513, /*!< Numpad 0 (VK_NUMPAD0) */ + RZKEY_NUMPAD1 = 0x0412, /*!< Numpad 1 (VK_NUMPAD1) */ + RZKEY_NUMPAD2 = 0x0413, /*!< Numpad 2 (VK_NUMPAD2) */ + RZKEY_NUMPAD3 = 0x0414, /*!< Numpad 3 (VK_NUMPAD3) */ + RZKEY_NUMPAD4 = 0x0312, /*!< Numpad 4 (VK_NUMPAD4) */ + RZKEY_NUMPAD5 = 0x0313, /*!< Numpad 5 (VK_NUMPAD5) */ + RZKEY_NUMPAD6 = 0x0314, /*!< Numpad 6 (VK_NUMPAD6) */ + RZKEY_NUMPAD7 = 0x0212, /*!< Numpad 7 (VK_NUMPAD7) */ + RZKEY_NUMPAD8 = 0x0213, /*!< Numpad 8 (VK_NUMPAD8) */ + RZKEY_NUMPAD9 = 0x0214, /*!< Numpad 9 (VK_ NUMPAD9*/ + RZKEY_NUMPAD_DIVIDE = 0x0113, /*!< Divide (VK_DIVIDE) */ + RZKEY_NUMPAD_MULTIPLY = 0x0114, /*!< Multiply (VK_MULTIPLY) */ + RZKEY_NUMPAD_SUBTRACT = 0x0115, /*!< Subtract (VK_SUBTRACT) */ + RZKEY_NUMPAD_ADD = 0x0215, /*!< Add (VK_ADD) */ + RZKEY_NUMPAD_ENTER = 0x0415, /*!< Enter (VK_RETURN - Extended) */ + RZKEY_NUMPAD_DECIMAL = 0x0514, /*!< Decimal (VK_DECIMAL) */ + RZKEY_PRINTSCREEN = 0x000F, /*!< Print Screen (VK_PRINT) */ + RZKEY_SCROLL = 0x0010, /*!< Scroll Lock (VK_SCROLL) */ + RZKEY_PAUSE = 0x0011, /*!< Pause (VK_PAUSE) */ + RZKEY_INSERT = 0x010F, /*!< Insert (VK_INSERT) */ + RZKEY_HOME = 0x0110, /*!< Home (VK_HOME) */ + RZKEY_PAGEUP = 0x0111, /*!< Page Up (VK_PRIOR) */ + RZKEY_DELETE = 0x020f, /*!< Delete (VK_DELETE) */ + RZKEY_END = 0x0210, /*!< End (VK_END) */ + RZKEY_PAGEDOWN = 0x0211, /*!< Page Down (VK_NEXT) */ + RZKEY_UP = 0x0410, /*!< Up (VK_UP) */ + RZKEY_LEFT = 0x050F, /*!< Left (VK_LEFT) */ + RZKEY_DOWN = 0x0510, /*!< Down (VK_DOWN) */ + RZKEY_RIGHT = 0x0511, /*!< Right (VK_RIGHT) */ + RZKEY_TAB = 0x0201, /*!< Tab (VK_TAB) */ + RZKEY_CAPSLOCK = 0x0301, /*!< Caps Lock(VK_CAPITAL) */ + RZKEY_BACKSPACE = 0x010E, /*!< Backspace (VK_BACK) */ + RZKEY_ENTER = 0x030E, /*!< Enter (VK_RETURN) */ + RZKEY_LCTRL = 0x0501, /*!< Left Control(VK_LCONTROL) */ + RZKEY_LWIN = 0x0502, /*!< Left Window (VK_LWIN) */ + RZKEY_LALT = 0x0503, /*!< Left Alt (VK_LMENU) */ + RZKEY_SPACE = 0x0507, /*!< Spacebar (VK_SPACE) */ + RZKEY_RALT = 0x050B, /*!< Right Alt (VK_RMENU) */ + RZKEY_FN = 0x050C, /*!< Function key. */ + RZKEY_RMENU = 0x050D, /*!< Right Menu (VK_APPS) */ + RZKEY_RCTRL = 0x050E, /*!< Right Control (VK_RCONTROL) */ + RZKEY_LSHIFT = 0x0401, /*!< Left Shift (VK_LSHIFT) */ + RZKEY_RSHIFT = 0x040E, /*!< Right Shift (VK_RSHIFT) */ + RZKEY_MACRO1 = 0x0100, /*!< Macro Key 1 */ + RZKEY_MACRO2 = 0x0200, /*!< Macro Key 2 */ + RZKEY_MACRO3 = 0x0300, /*!< Macro Key 3 */ + RZKEY_MACRO4 = 0x0400, /*!< Macro Key 4 */ + RZKEY_MACRO5 = 0x0500, /*!< Macro Key 5 */ + RZKEY_OEM_1 = 0x0101, /*!< ~ (tilde/半角/全角) (VK_OEM_3) */ + RZKEY_OEM_2 = 0x010C, /*!< -- (minus) (VK_OEM_MINUS) */ + RZKEY_OEM_3 = 0x010D, /*!< = (equal) (VK_OEM_PLUS) */ + RZKEY_OEM_4 = 0x020C, /*!< [ (left sqaure bracket) (VK_OEM_4) */ + RZKEY_OEM_5 = 0x020D, /*!< ] (right square bracket) (VK_OEM_6) */ + RZKEY_OEM_6 = 0x020E, /*!< \ (backslash) (VK_OEM_5) */ + RZKEY_OEM_7 = 0x030B, /*!< ; (semi-colon) (VK_OEM_1) */ + RZKEY_OEM_8 = 0x030C, /*!< ' (apostrophe) (VK_OEM_7) */ + RZKEY_OEM_9 = 0x040A, /*!< , (comma) (VK_OEM_COMMA) */ + RZKEY_OEM_10 = 0x040B, /*!< . (period) (VK_OEM_PERIOD) */ + RZKEY_OEM_11 = 0x040C, /*!< / (forward slash) (VK_OEM_2) */ + RZKEY_EUR_1 = 0x030D, /*!< "#" (VK_OEM_5) */ + RZKEY_EUR_2 = 0x0402, /*!< \ (VK_OEM_102) */ + RZKEY_JPN_1 = 0x0015, /*!< ¥ (0xFF) */ + RZKEY_JPN_2 = 0x040D, /*!< \ (0xC1) */ + RZKEY_JPN_3 = 0x0504, /*!< 無変換 (VK_OEM_PA1) */ + RZKEY_JPN_4 = 0x0509, /*!< 変換 (0xFF) */ + RZKEY_JPN_5 = 0x050A, /*!< ひらがな/カタカナ (0xFF) */ + RZKEY_KOR_1 = 0x0015, /*!< | (0xFF) */ + RZKEY_KOR_2 = 0x030D, /*!< (VK_OEM_5) */ + RZKEY_KOR_3 = 0x0402, /*!< (VK_OEM_102) */ + RZKEY_KOR_4 = 0x040D, /*!< (0xC1) */ + RZKEY_KOR_5 = 0x0504, /*!< (VK_OEM_PA1) */ + RZKEY_KOR_6 = 0x0509, /*!< 한/영 (0xFF) */ + RZKEY_KOR_7 = 0x050A, /*!< (0xFF) */ + RZKEY_INVALID = 0xFFFF /*!< Invalid keys. */ + } + + //! Definition of LEDs. + public enum RZLED + { + RZLED_LOGO = 0x0014 /*!< Razer logo */ + }; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct APPINFOTYPE + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string Title; //TCHAR Title[256]; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)] + public string Description; //TCHAR Description[1024]; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string Author_Name; //TCHAR Name[256]; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string Author_Contact; //TCHAR Contact[256]; + + public UInt32 SupportedDevice; //DWORD SupportedDevice; + + public UInt32 Category; //DWORD Category; + } + + [StructLayout(LayoutKind.Sequential)] + public struct FChromaSDKGuid + { + Guid Data; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DEVICE_INFO_TYPE + { + int DeviceType; + uint Connected; + } + + public enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_WAVE, //!< Wave effect (This effect type has deprecated and should not be used). + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect type has deprecated and should not be used). + CHROMA_BREATHING, //!< Breathing effect (This effect type has deprecated and should not be used). + CHROMA_BLINKING, //!< Blinking effect (This effect type has deprecated and should not be used). + CHROMA_REACTIVE, //!< Reactive effect (This effect type has deprecated and should not be used). + CHROMA_STATIC, //!< Static effect. + CHROMA_CUSTOM, //!< Custom effect. For mice, please see Mouse::CHROMA_CUSTOM2. + CHROMA_RESERVED, //!< Reserved + CHROMA_INVALID //!< Invalid effect. + } + + namespace Stream + { + public enum StreamStatusType + { + READY = 0, // ready for commands + AUTHORIZING = 1, // the session is being authorized + BROADCASTING = 2, // the session is being broadcast + WATCHING = 3, // A stream is being watched + NOT_AUTHORIZED = 4, // The session is not authorized + BROADCAST_DUPLICATE = 5, // The session has duplicate broadcasters + SERVICE_OFFLINE = 6, // The service is offline + } + + public class Default + { + const uint LENGTH_SHORTCODE = 6; + const uint LENGTH_STREAM_ID = 48; + const uint LENGTH_STREAM_KEY = 48; + const uint LENGTH_STREAM_FOCUS = 48; + + static string GetDefaultString(uint length) + { + string result = string.Empty; + for (uint i = 0; i < length; ++i) + { + result += " "; + } + return result; + } + + public readonly static string Shortcode = GetDefaultString(LENGTH_SHORTCODE); + public readonly static string StreamId = GetDefaultString(LENGTH_STREAM_ID); + public readonly static string StreamKey = GetDefaultString(LENGTH_STREAM_KEY); + public readonly static string StreamFocus = GetDefaultString(LENGTH_STREAM_FOCUS); + } + } + + public class ChromaAnimationAPI + { + +#if X64 + const string DLL_NAME = "CChromaEditorLibrary64"; +#else + const string DLL_NAME = "CChromaEditorLibrary"; +#endif + +#region Data Structures + + public enum DeviceType + { + Invalid = -1, + DE_1D = 0, + DE_2D = 1, + MAX = 2, + } + + public enum Device + { + Invalid = -1, + ChromaLink = 0, + Headset = 1, + Keyboard = 2, + Keypad = 3, + Mouse = 4, + Mousepad = 5, + KeyboardExtended = 6, + MAX = 7, + } + + public enum Device1D + { + Invalid = -1, + ChromaLink = 0, + Headset = 1, + Mousepad = 2, + MAX = 3, + } + + public enum Device2D + { + Invalid = -1, + Keyboard = 0, + Keypad = 1, + Mouse = 2, + KeyboardExtended = 3, + MAX = 4, + } + + public class FChromaSDKDeviceFrameIndex + { + // Index corresponds to EChromaSDKDeviceEnum; + public int[] _mFrameIndex = new int[(int)Device.MAX]; + + public FChromaSDKDeviceFrameIndex() + { + _mFrameIndex[(int)Device.ChromaLink] = 0; + _mFrameIndex[(int)Device.Headset] = 0; + _mFrameIndex[(int)Device.Keyboard] = 0; + _mFrameIndex[(int)Device.Keypad] = 0; + _mFrameIndex[(int)Device.Mouse] = 0; + _mFrameIndex[(int)Device.Mousepad] = 0; + _mFrameIndex[(int)Device.KeyboardExtended] = 0; + } + } + + public enum EChromaSDKSceneBlend + { + SB_None, + SB_Invert, + SB_Threshold, + SB_Lerp, + }; + + public enum EChromaSDKSceneMode + { + SM_Replace, + SM_Max, + SM_Min, + SM_Average, + SM_Multiply, + SM_Add, + SM_Subtract, + }; + + public class FChromaSDKSceneEffect + { + public string _mAnimation = ""; + public bool _mState = false; + public int _mPrimaryColor = 0; + public int _mSecondaryColor = 0; + public int _mSpeed = 1; + public EChromaSDKSceneBlend _mBlend = EChromaSDKSceneBlend.SB_None; + public EChromaSDKSceneMode _mMode = EChromaSDKSceneMode.SM_Replace; + + public FChromaSDKDeviceFrameIndex _mFrameIndex = new FChromaSDKDeviceFrameIndex(); + } + + public class FChromaSDKScene + { + public List _mEffects = new List(); + public bool GetState(int effect) + { + if (effect >= 0 && effect < _mEffects.Count) + { + return _mEffects[effect]._mState; + } + else + { + return false; + } + } + public void ToggleState(int effect) + { + if (effect >= 0 && effect < _mEffects.Count) + { + _mEffects[effect]._mState = !_mEffects[effect]._mState; + } + } + } + + +#endregion + +#region Helpers (handle path conversions) + + /// + /// Helper to convert path string to IntPtr + /// + /// + /// + private static IntPtr GetPathIntPtr(string path) + { + if (string.IsNullOrEmpty(path)) + { + return IntPtr.Zero; + } + FileInfo fi = new FileInfo(path); + byte[] array = ASCIIEncoding.ASCII.GetBytes(fi.FullName + "\0"); + IntPtr lpData = Marshal.AllocHGlobal(array.Length); + Marshal.Copy(array, 0, lpData, array.Length); + return lpData; + } + + /// + /// Helper to Ascii path string to IntPtr + /// + /// + /// + private static IntPtr GetAsciiIntPtr(string str) + { + if (string.IsNullOrEmpty(str)) + { + return IntPtr.Zero; + } + byte[] array = ASCIIEncoding.ASCII.GetBytes(str + "\0"); + IntPtr lpData = Marshal.AllocHGlobal(array.Length); + Marshal.Copy(array, 0, lpData, array.Length); + return lpData; + } + + /// + /// Helper to Unicode path string to IntPtr + /// + /// + /// + private static IntPtr GetUnicodeIntPtr(string str) + { + if (string.IsNullOrEmpty(str)) + { + return IntPtr.Zero; + } + byte[] array = UnicodeEncoding.Unicode.GetBytes(str + "\0"); + IntPtr lpData = Marshal.AllocHGlobal(array.Length); + Marshal.Copy(array, 0, lpData, array.Length); + return lpData; + } + + /// + /// Helper to recycle the IntPtr + /// + /// + private static void FreeIntPtr(IntPtr lpData) + { + if (lpData != IntPtr.Zero) + { + Marshal.FreeHGlobal(lpData); + } + } + + public static int UninitAPI() + { + UnloadLibrarySDK(); + UnloadLibraryStreamingPlugin(); + + return 0; + } + +#endregion + + + #region Public API Methods + /// + /// Return the sum of colors + /// + public static int AddColor(int color1, int color2) + { + int result = PluginAddColor(color1, color2); + return result; + } + /// + /// Adds a frame to the `Chroma` animation and sets the `duration` (in seconds). + /// The `color` is expected to be an array of the dimensions for the `deviceType/device`. + /// The `length` parameter is the size of the `color` array. For `EChromaSDKDevice1DEnum` + /// the array size should be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array + /// size should be `MAX ROW` times `MAX COLUMN`. Returns the animation id upon + /// success. Returns negative one upon failure. + /// + public static int AddFrame(int animationId, float duration, int[] colors, int length) + { + int result = PluginAddFrame(animationId, duration, colors, length); + return result; + } + /// + /// Add source color to target where color is not black for frame id, reference + /// source and target by id. + /// + public static void AddNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginAddNonZeroAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Add source color to target where color is not black for all frames, reference + /// source and target by id. + /// + public static void AddNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginAddNonZeroAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Add source color to target where color is not black for all frames, reference + /// source and target by name. + /// + public static void AddNonZeroAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AddNonZeroAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAddNonZeroAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Add source color to target where color is not black for all frames starting + /// at offset for the length of the source, reference source and target by + /// id. + /// + public static void AddNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginAddNonZeroAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Add source color to target where color is not black for all frames starting + /// at offset for the length of the source, reference source and target by + /// name. + /// + public static void AddNonZeroAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AddNonZeroAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAddNonZeroAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Add source color to target where color is not black for frame id, reference + /// source and target by name. + /// + public static void AddNonZeroAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Add source color to target where color is not black for the source frame + /// and target offset frame, reference source and target by id. + /// + public static void AddNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginAddNonZeroAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Add source color to target where color is not black for the source frame + /// and target offset frame, reference source and target by name. + /// + public static void AddNonZeroAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AddNonZeroAllKeysOffsetNameD(string sourceAnimation, string targetAnimation, double frameId, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAddNonZeroAllKeysOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Add source color to target where the target color is not black for all frames, + /// reference source and target by id. + /// + public static void AddNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginAddNonZeroTargetAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Add source color to target where the target color is not black for all frames, + /// reference source and target by name. + /// + public static void AddNonZeroTargetAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroTargetAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AddNonZeroTargetAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAddNonZeroTargetAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Add source color to target where the target color is not black for all frames + /// starting at offset for the length of the source, reference source and target + /// by id. + /// + public static void AddNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginAddNonZeroTargetAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Add source color to target where the target color is not black for all frames + /// starting at offset for the length of the source, reference source and target + /// by name. + /// + public static void AddNonZeroTargetAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroTargetAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AddNonZeroTargetAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAddNonZeroTargetAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Add source color to target where target color is not blank from the source + /// frame to the target offset frame, reference source and target by id. + /// + public static void AddNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginAddNonZeroTargetAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Add source color to target where target color is not blank from the source + /// frame to the target offset frame, reference source and target by name. + /// + /// + public static void AddNonZeroTargetAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAddNonZeroTargetAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AddNonZeroTargetAllKeysOffsetNameD(string sourceAnimation, string targetAnimation, double frameId, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAddNonZeroTargetAllKeysOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Append all source frames to the target animation, reference source and target + /// by id. + /// + public static void AppendAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginAppendAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Append all source frames to the target animation, reference source and target + /// by name. + /// + public static void AppendAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginAppendAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double AppendAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginAppendAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// `PluginClearAll` will issue a `CLEAR` effect for all devices. + /// + public static void ClearAll() + { + PluginClearAll(); + } + /// + /// `PluginClearAnimationType` will issue a `CLEAR` effect for the given device. + /// + /// + public static void ClearAnimationType(int deviceType, int device) + { + PluginClearAnimationType(deviceType, device); + } + /// + /// `PluginCloseAll` closes all open animations so they can be reloaded from + /// disk. The set of animations will be stopped if playing. + /// + public static void CloseAll() + { + PluginCloseAll(); + } + /// + /// Closes the `Chroma` animation to free up resources referenced by id. Returns + /// the animation id upon success. Returns negative one upon failure. This + /// might be used while authoring effects if there was a change necessitating + /// re-opening the animation. The animation id can no longer be used once closed. + /// + /// + public static int CloseAnimation(int animationId) + { + int result = PluginCloseAnimation(animationId); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double CloseAnimationD(double animationId) + { + double result = PluginCloseAnimationD(animationId); + return result; + } + /// + /// Closes the `Chroma` animation referenced by name so that the animation can + /// be reloaded from disk. + /// + public static void CloseAnimationName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginCloseAnimationName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double CloseAnimationNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginCloseAnimationNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// `PluginCloseComposite` closes a set of animations so they can be reloaded + /// from disk. The set of animations will be stopped if playing. + /// + public static void CloseComposite(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + PluginCloseComposite(lp_Name); + FreeIntPtr(lp_Name); + } + /// + /// D suffix for limited data types. + /// + public static double CloseCompositeD(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + double result = PluginCloseCompositeD(lp_Name); + FreeIntPtr(lp_Name); + return result; + } + /// + /// Copy source animation to target animation for the given frame. Source and + /// target are referenced by id. + /// + public static void CopyAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginCopyAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Copy source animation to target animation for the given frame. Source and + /// target are referenced by id. + /// + public static void CopyAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Copy animation to named target animation in memory. If target animation + /// exists, close first. Source is referenced by id. + /// + public static int CopyAnimation(int sourceAnimationId, string targetAnimation) + { + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + int result = PluginCopyAnimation(sourceAnimationId, lp_TargetAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy animation to named target animation in memory. If target animation + /// exists, close first. Source is referenced by name. + /// + public static void CopyAnimationName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyAnimationName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyAnimationNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyAnimationNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy blue channel to other channels for all frames. Intensity range is 0.0 + /// to 1.0. Reference the animation by id. + /// + public static void CopyBlueChannelAllFrames(int animationId, float redIntensity, float greenIntensity) + { + PluginCopyBlueChannelAllFrames(animationId, redIntensity, greenIntensity); + } + /// + /// Copy blue channel to other channels for all frames. Intensity range is 0.0 + /// to 1.0. Reference the animation by name. + /// + public static void CopyBlueChannelAllFramesName(string path, float redIntensity, float greenIntensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginCopyBlueChannelAllFramesName(lp_Path, redIntensity, greenIntensity); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double CopyBlueChannelAllFramesNameD(string path, double redIntensity, double greenIntensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginCopyBlueChannelAllFramesNameD(lp_Path, redIntensity, greenIntensity); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Copy green channel to other channels for all frames. Intensity range is + /// 0.0 to 1.0. Reference the animation by id. + /// + public static void CopyGreenChannelAllFrames(int animationId, float redIntensity, float blueIntensity) + { + PluginCopyGreenChannelAllFrames(animationId, redIntensity, blueIntensity); + } + /// + /// Copy green channel to other channels for all frames. Intensity range is + /// 0.0 to 1.0. Reference the animation by name. + /// + public static void CopyGreenChannelAllFramesName(string path, float redIntensity, float blueIntensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginCopyGreenChannelAllFramesName(lp_Path, redIntensity, blueIntensity); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double CopyGreenChannelAllFramesNameD(string path, double redIntensity, double blueIntensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginCopyGreenChannelAllFramesNameD(lp_Path, redIntensity, blueIntensity); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame. Reference the source and target by id. + /// + public static void CopyKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey) + { + PluginCopyKeyColor(sourceAnimationId, targetAnimationId, frameId, rzkey); + } + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames. Reference the source and target by id. + /// + public static void CopyKeyColorAllFrames(int sourceAnimationId, int targetAnimationId, int rzkey) + { + PluginCopyKeyColorAllFrames(sourceAnimationId, targetAnimationId, rzkey); + } + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames. Reference the source and target by name. + /// + public static void CopyKeyColorAllFramesName(string sourceAnimation, string targetAnimation, int rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyKeyColorAllFramesName(lp_SourceAnimation, lp_TargetAnimation, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyKeyColorAllFramesNameD(string sourceAnimation, string targetAnimation, double rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyKeyColorAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames, starting at the offset for the length of the source animation. + /// Source and target are referenced by id. + /// + public static void CopyKeyColorAllFramesOffset(int sourceAnimationId, int targetAnimationId, int rzkey, int offset) + { + PluginCopyKeyColorAllFramesOffset(sourceAnimationId, targetAnimationId, rzkey, offset); + } + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames, starting at the offset for the length of the source animation. + /// Source and target are referenced by name. + /// + public static void CopyKeyColorAllFramesOffsetName(string sourceAnimation, string targetAnimation, int rzkey, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyKeyColorAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, rzkey, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyKeyColorAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double rzkey, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyKeyColorAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, rzkey, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame. + /// + public static void CopyKeyColorName(string sourceAnimation, string targetAnimation, int frameId, int rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyKeyColorName(lp_SourceAnimation, lp_TargetAnimation, frameId, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyKeyColorNameD(string sourceAnimation, string targetAnimation, double frameId, double rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyKeyColorNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for the given frame. Reference the source and target by + /// id. + /// + public static void CopyKeysColor(int sourceAnimationId, int targetAnimationId, int frameId, int[] keys, int size) + { + PluginCopyKeysColor(sourceAnimationId, targetAnimationId, frameId, keys, size); + } + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for all frames. Reference the source and target by id. + /// + /// + public static void CopyKeysColorAllFrames(int sourceAnimationId, int targetAnimationId, int[] keys, int size) + { + PluginCopyKeysColorAllFrames(sourceAnimationId, targetAnimationId, keys, size); + } + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for all frames. Reference the source and target by name. + /// + /// + public static void CopyKeysColorAllFramesName(string sourceAnimation, string targetAnimation, int[] keys, int size) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyKeysColorAllFramesName(lp_SourceAnimation, lp_TargetAnimation, keys, size); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for the given frame. Reference the source and target by + /// name. + /// + public static void CopyKeysColorName(string sourceAnimation, string targetAnimation, int frameId, int[] keys, int size) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyKeysColorName(lp_SourceAnimation, lp_TargetAnimation, frameId, keys, size); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation from the source frame to the target frame. Reference the + /// source and target by id. + /// + public static void CopyKeysColorOffset(int sourceAnimationId, int targetAnimationId, int sourceFrameId, int targetFrameId, int[] keys, int size) + { + PluginCopyKeysColorOffset(sourceAnimationId, targetAnimationId, sourceFrameId, targetFrameId, keys, size); + } + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation from the source frame to the target frame. Reference the + /// source and target by name. + /// + public static void CopyKeysColorOffsetName(string sourceAnimation, string targetAnimation, int sourceFrameId, int targetFrameId, int[] keys, int size) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyKeysColorOffsetName(lp_SourceAnimation, lp_TargetAnimation, sourceFrameId, targetFrameId, keys, size); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Copy source animation to target animation for the given frame. Source and + /// target are referenced by id. + /// + public static void CopyNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginCopyNonZeroAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames. Reference source and target by id. + /// + public static void CopyNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginCopyNonZeroAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames. Reference source and target by name. + /// + public static void CopyNonZeroAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames starting at the offset for the length of the source animation. The + /// source and target are referenced by id. + /// + public static void CopyNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginCopyNonZeroAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames starting at the offset for the length of the source animation. The + /// source and target are referenced by name. + /// + public static void CopyNonZeroAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from source animation to target animation for the specified + /// frame. Source and target are referenced by id. + /// + public static void CopyNonZeroAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroAllKeysNameD(string sourceAnimation, string targetAnimation, double frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroAllKeysNameD(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from the source animation to the target animation from + /// the source frame to the target offset frame. Source and target are referenced + /// by id. + /// + public static void CopyNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginCopyNonZeroAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Copy nonzero colors from the source animation to the target animation from + /// the source frame to the target offset frame. Source and target are referenced + /// by name. + /// + public static void CopyNonZeroAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroAllKeysOffsetNameD(string sourceAnimation, string targetAnimation, double frameId, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroAllKeysOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame where color is not zero. + /// + public static void CopyNonZeroKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey) + { + PluginCopyNonZeroKeyColor(sourceAnimationId, targetAnimationId, frameId, rzkey); + } + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame where color is not zero. + /// + public static void CopyNonZeroKeyColorName(string sourceAnimation, string targetAnimation, int frameId, int rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroKeyColorName(lp_SourceAnimation, lp_TargetAnimation, frameId, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroKeyColorNameD(string sourceAnimation, string targetAnimation, double frameId, double rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroKeyColorNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified frame. Source and target + /// are referenced by id. + /// + public static void CopyNonZeroTargetAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginCopyNonZeroTargetAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames. Source and target are referenced + /// by id. + /// + public static void CopyNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginCopyNonZeroTargetAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames. Source and target are referenced + /// by name. + /// + public static void CopyNonZeroTargetAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroTargetAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroTargetAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroTargetAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames. Source and target are referenced + /// by name. + /// + public static void CopyNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginCopyNonZeroTargetAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames starting at the target offset + /// for the length of the source animation. Source and target animations are + /// referenced by name. + /// + public static void CopyNonZeroTargetAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroTargetAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroTargetAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroTargetAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified frame. The source and target + /// are referenced by name. + /// + public static void CopyNonZeroTargetAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroTargetAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroTargetAllKeysNameD(string sourceAnimation, string targetAnimation, double frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroTargetAllKeysNameD(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified source frame and target offset + /// frame. The source and target are referenced by id. + /// + public static void CopyNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginCopyNonZeroTargetAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified source frame and target offset + /// frame. The source and target are referenced by name. + /// + public static void CopyNonZeroTargetAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroTargetAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroTargetAllKeysOffsetNameD(string sourceAnimation, string targetAnimation, double frameId, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroTargetAllKeysOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is zero for all frames. Source and target are referenced + /// by id. + /// + public static void CopyNonZeroTargetZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginCopyNonZeroTargetZeroAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is zero for all frames. Source and target are referenced + /// by name. + /// + public static void CopyNonZeroTargetZeroAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyNonZeroTargetZeroAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyNonZeroTargetZeroAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyNonZeroTargetZeroAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy red channel to other channels for all frames. Intensity range is 0.0 + /// to 1.0. Reference the animation by id. + /// + public static void CopyRedChannelAllFrames(int animationId, float greenIntensity, float blueIntensity) + { + PluginCopyRedChannelAllFrames(animationId, greenIntensity, blueIntensity); + } + /// + /// Copy green channel to other channels for all frames. Intensity range is + /// 0.0 to 1.0. Reference the animation by name. + /// + public static void CopyRedChannelAllFramesName(string path, float greenIntensity, float blueIntensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginCopyRedChannelAllFramesName(lp_Path, greenIntensity, blueIntensity); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double CopyRedChannelAllFramesNameD(string path, double greenIntensity, double blueIntensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginCopyRedChannelAllFramesNameD(lp_Path, greenIntensity, blueIntensity); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Copy zero colors from source animation to target animation for the frame. + /// Source and target are referenced by id. + /// + public static void CopyZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginCopyZeroAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Copy zero colors from source animation to target animation for all frames. + /// Source and target are referenced by id. + /// + public static void CopyZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginCopyZeroAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Copy zero colors from source animation to target animation for all frames. + /// Source and target are referenced by name. + /// + public static void CopyZeroAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyZeroAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyZeroAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy zero colors from source animation to target animation for all frames + /// starting at the target offset for the length of the source animation. Source + /// and target are referenced by id. + /// + public static void CopyZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginCopyZeroAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Copy zero colors from source animation to target animation for all frames + /// starting at the target offset for the length of the source animation. Source + /// and target are referenced by name. + /// + public static void CopyZeroAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyZeroAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyZeroAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy zero colors from source animation to target animation for the frame. + /// Source and target are referenced by name. + /// + public static void CopyZeroAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Copy zero colors from source animation to target animation for the frame + /// id starting at the target offset for the length of the source animation. + /// Source and target are referenced by id. + /// + public static void CopyZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginCopyZeroAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Copy zero colors from source animation to target animation for the frame + /// id starting at the target offset for the length of the source animation. + /// Source and target are referenced by name. + /// + public static void CopyZeroAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Copy zero key color from source animation to target animation for the specified + /// frame. Source and target are referenced by id. + /// + public static void CopyZeroKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey) + { + PluginCopyZeroKeyColor(sourceAnimationId, targetAnimationId, frameId, rzkey); + } + /// + /// Copy zero key color from source animation to target animation for the specified + /// frame. Source and target are referenced by name. + /// + public static void CopyZeroKeyColorName(string sourceAnimation, string targetAnimation, int frameId, int rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroKeyColorName(lp_SourceAnimation, lp_TargetAnimation, frameId, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyZeroKeyColorNameD(string sourceAnimation, string targetAnimation, double frameId, double rzkey) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyZeroKeyColorNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, rzkey); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for the frame. Source and target are referenced by id. + /// + public static void CopyZeroTargetAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginCopyZeroTargetAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for all frames. Source and target are referenced by id. + /// + public static void CopyZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginCopyZeroTargetAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for all frames. Source and target are referenced by name. + /// + public static void CopyZeroTargetAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroTargetAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double CopyZeroTargetAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginCopyZeroTargetAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for the frame. Source and target are referenced by name. + /// + public static void CopyZeroTargetAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginCopyZeroTargetAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateChromaLinkEffect(int effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateChromaLinkEffect(effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateEffect(Guid deviceId, EFFECT_TYPE effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateEffect(deviceId, (int)effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateHeadsetEffect(int effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateHeadsetEffect(effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateKeyboardEffect(int effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateKeyboardEffect(effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateKeypadEffect(int effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateKeypadEffect(effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateMouseEffect(int effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateMouseEffect(effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreCreateMousepadEffect(int effect, IntPtr pParam, out Guid pEffectId) + { + int result = PluginCoreCreateMousepadEffect(effect, pParam, out pEffectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreDeleteEffect(Guid effectId) + { + int result = PluginCoreDeleteEffect(effectId); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreInit() + { + int result = PluginCoreInit(); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreInitSDK(ref ChromaSDK.APPINFOTYPE appInfo) + { + int result = PluginCoreInitSDK(ref appInfo); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreQueryDevice(Guid deviceId, out DEVICE_INFO_TYPE deviceInfo) + { + int result = PluginCoreQueryDevice(deviceId, out deviceInfo); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreSetEffect(Guid effectId) + { + int result = PluginCoreSetEffect(effectId); + return result; + } + /// + /// Begin broadcasting Chroma RGB data using the stored stream key as the endpoint. + /// Intended for Cloud Gaming Platforms, restore the streaming key when the + /// game instance is launched to continue streaming. streamId is a null terminated + /// string streamKey is a null terminated string StreamGetStatus() should return + /// the READY status to use this method. + /// + public static bool CoreStreamBroadcast(string streamId, string streamKey) + { + string str_StreamId = streamId; + IntPtr lp_StreamId = GetAsciiIntPtr(str_StreamId); + string str_StreamKey = streamKey; + IntPtr lp_StreamKey = GetAsciiIntPtr(str_StreamKey); + bool result = PluginCoreStreamBroadcast(lp_StreamId, lp_StreamKey); + FreeIntPtr(lp_StreamId); + FreeIntPtr(lp_StreamKey); + return result; + } + /// + /// End broadcasting Chroma RGB data. StreamGetStatus() should return the BROADCASTING + /// status to use this method. + /// + public static bool CoreStreamBroadcastEnd() + { + bool result = PluginCoreStreamBroadcastEnd(); + return result; + } + /// + /// shortcode: Pass the address of a preallocated character buffer to get the + /// streaming auth code. The buffer should have a minimum length of 6. length: + /// Length will return as zero if the streaming auth code could not be obtained. + /// If length is greater than zero, it will be the length of the returned streaming + /// auth code. Once you have the shortcode, it should be shown to the user + /// so they can associate the stream with their Razer ID StreamGetStatus() + /// should return the READY status before invoking this method. platform: is + /// the null terminated string that identifies the source of the stream: { + /// GEFORCE_NOW, LUNA, STADIA, GAME_PASS } title: is the null terminated string + /// that identifies the application or game. + /// + public static void CoreStreamGetAuthShortcode(ref string shortcode, out byte length, string platform, string title) + { + string str_Shortcode = shortcode; + IntPtr lp_Shortcode = GetAsciiIntPtr(str_Shortcode); + string str_Platform = platform; + IntPtr lp_Platform = GetUnicodeIntPtr(str_Platform); + string str_Title = title; + IntPtr lp_Title = GetUnicodeIntPtr(str_Title); + PluginCoreStreamGetAuthShortcode(lp_Shortcode, out length, lp_Platform, lp_Title); + if (lp_Shortcode != IntPtr.Zero) + { + shortcode = Marshal.PtrToStringAnsi(lp_Shortcode); + } + FreeIntPtr(lp_Shortcode); + FreeIntPtr(lp_Platform); + FreeIntPtr(lp_Title); + } + /// + /// focus: Pass the address of a preallocated character buffer to get the stream + /// focus. The buffer should have a length of 48 length: Length will return + /// as zero if the stream focus could not be obtained. If length is greater + /// than zero, it will be the length of the returned stream focus. + /// + public static bool CoreStreamGetFocus(ref string focus, out byte length) + { + string str_Focus = focus; + IntPtr lp_Focus = GetAsciiIntPtr(str_Focus); + bool result = PluginCoreStreamGetFocus(lp_Focus, out length); + if (lp_Focus != IntPtr.Zero) + { + focus = Marshal.PtrToStringAnsi(lp_Focus); + } + FreeIntPtr(lp_Focus); + return result; + } + /// + /// Intended for Cloud Gaming Platforms, store the stream id to persist in user + /// preferences to continue streaming if the game is suspended or closed. shortcode: + /// The shortcode is a null terminated string. Use the shortcode that authorized + /// the stream to obtain the stream id. streamId should be a preallocated buffer + /// to get the stream key. The buffer should have a length of 48. length: Length + /// will return zero if the key could not be obtained. If the length is greater + /// than zero, it will be the length of the returned streaming id. Retrieve + /// the stream id after authorizing the shortcode. The authorization window + /// will expire in 5 minutes. Be sure to save the stream key before the window + /// expires. StreamGetStatus() should return the READY status to use this method. + /// + /// + public static void CoreStreamGetId(string shortcode, ref string streamId, out byte length) + { + string str_Shortcode = shortcode; + IntPtr lp_Shortcode = GetAsciiIntPtr(str_Shortcode); + string str_StreamId = streamId; + IntPtr lp_StreamId = GetAsciiIntPtr(str_StreamId); + PluginCoreStreamGetId(lp_Shortcode, lp_StreamId, out length); + FreeIntPtr(lp_Shortcode); + if (lp_StreamId != IntPtr.Zero) + { + streamId = Marshal.PtrToStringAnsi(lp_StreamId); + } + FreeIntPtr(lp_StreamId); + } + /// + /// Intended for Cloud Gaming Platforms, store the streaming key to persist + /// in user preferences to continue streaming if the game is suspended or closed. + /// shortcode: The shortcode is a null terminated string. Use the shortcode + /// that authorized the stream to obtain the stream key. If the status is in + /// the BROADCASTING or WATCHING state, passing a NULL shortcode will return + /// the active streamId. streamKey should be a preallocated buffer to get the + /// stream key. The buffer should have a length of 48. length: Length will + /// return zero if the key could not be obtained. If the length is greater + /// than zero, it will be the length of the returned streaming key. Retrieve + /// the stream key after authorizing the shortcode. The authorization window + /// will expire in 5 minutes. Be sure to save the stream key before the window + /// expires. StreamGetStatus() should return the READY status to use this method. + /// + /// + public static void CoreStreamGetKey(string shortcode, ref string streamKey, out byte length) + { + string str_Shortcode = shortcode; + IntPtr lp_Shortcode = GetAsciiIntPtr(str_Shortcode); + string str_StreamKey = streamKey; + IntPtr lp_StreamKey = GetAsciiIntPtr(str_StreamKey); + PluginCoreStreamGetKey(lp_Shortcode, lp_StreamKey, out length); + FreeIntPtr(lp_Shortcode); + if (lp_StreamKey != IntPtr.Zero) + { + streamKey = Marshal.PtrToStringAnsi(lp_StreamKey); + } + FreeIntPtr(lp_StreamKey); + } + /// + /// Returns StreamStatus, the current status of the service + /// + public static ChromaSDK.Stream.StreamStatusType CoreStreamGetStatus() + { + ChromaSDK.Stream.StreamStatusType result = PluginCoreStreamGetStatus(); + return result; + } + /// + /// Convert StreamStatusType to a printable string + /// + public static string CoreStreamGetStatusString(ChromaSDK.Stream.StreamStatusType status) + { + string result = Marshal.PtrToStringAnsi(PluginCoreStreamGetStatusString(status)); + return result; + } + /// + /// This prevents the stream id and stream key from being obtained through the + /// shortcode. This closes the auth window. shortcode is a null terminated + /// string. StreamGetStatus() should return the READY status to use this method. + /// returns success when shortcode has been released + /// + public static bool CoreStreamReleaseShortcode(string shortcode) + { + string str_Shortcode = shortcode; + IntPtr lp_Shortcode = GetAsciiIntPtr(str_Shortcode); + bool result = PluginCoreStreamReleaseShortcode(lp_Shortcode); + FreeIntPtr(lp_Shortcode); + return result; + } + /// + /// The focus is a null terminated string. Set the focus identifer for the application + /// designated to automatically change the streaming state. Returns true on + /// success. + /// + public static bool CoreStreamSetFocus(string focus) + { + string str_Focus = focus; + IntPtr lp_Focus = GetAsciiIntPtr(str_Focus); + bool result = PluginCoreStreamSetFocus(lp_Focus); + FreeIntPtr(lp_Focus); + return result; + } + /// + /// Returns true if the Chroma streaming is supported. If false is returned, + /// avoid calling stream methods. + /// + public static bool CoreStreamSupportsStreaming() + { + bool result = PluginCoreStreamSupportsStreaming(); + return result; + } + /// + /// Begin watching the Chroma RGB data using streamID parameter. streamId is + /// a null terminated string. StreamGetStatus() should return the READY status + /// to use this method. + /// + public static bool CoreStreamWatch(string streamId, ulong timestamp) + { + string str_StreamId = streamId; + IntPtr lp_StreamId = GetAsciiIntPtr(str_StreamId); + bool result = PluginCoreStreamWatch(lp_StreamId, timestamp); + FreeIntPtr(lp_StreamId); + return result; + } + /// + /// End watching Chroma RGB data stream. StreamGetStatus() should return the + /// WATCHING status to use this method. + /// + public static bool CoreStreamWatchEnd() + { + bool result = PluginCoreStreamWatchEnd(); + return result; + } + /// + /// Direct access to low level API. + /// + public static int CoreUnInit() + { + int result = PluginCoreUnInit(); + return result; + } + /// + /// Creates a `Chroma` animation at the given path. The `deviceType` parameter + /// uses `EChromaSDKDeviceTypeEnum` as an integer. The `device` parameter uses + /// `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` as an integer, respective + /// to the `deviceType`. Returns the animation id upon success. Returns negative + /// one upon failure. Saves a `Chroma` animation file with the `.chroma` extension + /// at the given path. Returns the animation id upon success. Returns negative + /// one upon failure. + /// + public static int CreateAnimation(string path, int deviceType, int device) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginCreateAnimation(lp_Path, deviceType, device); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Creates a `Chroma` animation in memory without creating a file. The `deviceType` + /// parameter uses `EChromaSDKDeviceTypeEnum` as an integer. The `device` parameter + /// uses `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` as an integer, + /// respective to the `deviceType`. Returns the animation id upon success. + /// Returns negative one upon failure. Returns the animation id upon success. + /// Returns negative one upon failure. + /// + public static int CreateAnimationInMemory(int deviceType, int device) + { + int result = PluginCreateAnimationInMemory(deviceType, device); + return result; + } + /// + /// Create a device specific effect. + /// + public static int CreateEffect(Guid deviceId, EFFECT_TYPE effect, int[] colors, int size, out FChromaSDKGuid effectId) + { + int result = PluginCreateEffect(deviceId, (int)effect, colors, size, out effectId); + return result; + } + /// + /// Delete an effect given the effect id. + /// + public static int DeleteEffect(Guid effectId) + { + int result = PluginDeleteEffect(effectId); + return result; + } + /// + /// Duplicate the first animation frame so that the animation length matches + /// the frame count. Animation is referenced by id. + /// + public static void DuplicateFirstFrame(int animationId, int frameCount) + { + PluginDuplicateFirstFrame(animationId, frameCount); + } + /// + /// Duplicate the first animation frame so that the animation length matches + /// the frame count. Animation is referenced by name. + /// + public static void DuplicateFirstFrameName(string path, int frameCount) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginDuplicateFirstFrameName(lp_Path, frameCount); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double DuplicateFirstFrameNameD(string path, double frameCount) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginDuplicateFirstFrameNameD(lp_Path, frameCount); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Duplicate all the frames of the animation to double the animation length. + /// Frame 1 becomes frame 1 and 2. Frame 2 becomes frame 3 and 4. And so on. + /// The animation is referenced by id. + /// + public static void DuplicateFrames(int animationId) + { + PluginDuplicateFrames(animationId); + } + /// + /// Duplicate all the frames of the animation to double the animation length. + /// Frame 1 becomes frame 1 and 2. Frame 2 becomes frame 3 and 4. And so on. + /// The animation is referenced by name. + /// + public static void DuplicateFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginDuplicateFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double DuplicateFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginDuplicateFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Duplicate all the animation frames in reverse so that the animation plays + /// forwards and backwards. Animation is referenced by id. + /// + public static void DuplicateMirrorFrames(int animationId) + { + PluginDuplicateMirrorFrames(animationId); + } + /// + /// Duplicate all the animation frames in reverse so that the animation plays + /// forwards and backwards. Animation is referenced by name. + /// + public static void DuplicateMirrorFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginDuplicateMirrorFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double DuplicateMirrorFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginDuplicateMirrorFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fade the animation to black starting at the fade frame index to the end + /// of the animation. Animation is referenced by id. + /// + public static void FadeEndFrames(int animationId, int fade) + { + PluginFadeEndFrames(animationId, fade); + } + /// + /// Fade the animation to black starting at the fade frame index to the end + /// of the animation. Animation is referenced by name. + /// + public static void FadeEndFramesName(string path, int fade) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFadeEndFramesName(lp_Path, fade); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FadeEndFramesNameD(string path, double fade) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFadeEndFramesNameD(lp_Path, fade); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fade the animation from black to full color starting at 0 to the fade frame + /// index. Animation is referenced by id. + /// + public static void FadeStartFrames(int animationId, int fade) + { + PluginFadeStartFrames(animationId, fade); + } + /// + /// Fade the animation from black to full color starting at 0 to the fade frame + /// index. Animation is referenced by name. + /// + public static void FadeStartFramesName(string path, int fade) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFadeStartFramesName(lp_Path, fade); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FadeStartFramesNameD(string path, double fade) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFadeStartFramesNameD(lp_Path, fade); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by id. + /// + public static void FillColor(int animationId, int frameId, int color) + { + PluginFillColor(animationId, frameId, color); + } + /// + /// Set the RGB value for all colors for all frames. Animation is referenced + /// by id. + /// + public static void FillColorAllFrames(int animationId, int color) + { + PluginFillColorAllFrames(animationId, color); + } + /// + /// Set the RGB value for all colors for all frames. Animation is referenced + /// by name. + /// + public static void FillColorAllFramesName(string path, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillColorAllFramesName(lp_Path, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillColorAllFramesNameD(string path, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillColorAllFramesNameD(lp_Path, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the RGB value for all colors for all frames. Use the range of 0 to 255 + /// for red, green, and blue parameters. Animation is referenced by id. + /// + public static void FillColorAllFramesRGB(int animationId, int red, int green, int blue) + { + PluginFillColorAllFramesRGB(animationId, red, green, blue); + } + /// + /// Set the RGB value for all colors for all frames. Use the range of 0 to 255 + /// for red, green, and blue parameters. Animation is referenced by name. + /// + public static void FillColorAllFramesRGBName(string path, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillColorAllFramesRGBName(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillColorAllFramesRGBNameD(string path, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillColorAllFramesRGBNameD(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by name. + /// + public static void FillColorName(string path, int frameId, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillColorName(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillColorNameD(string path, double frameId, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillColorNameD(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by id. + /// + public static void FillColorRGB(int animationId, int frameId, int red, int green, int blue) + { + PluginFillColorRGB(animationId, frameId, red, green, blue); + } + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by name. + /// + public static void FillColorRGBName(string path, int frameId, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillColorRGBName(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillColorRGBNameD(string path, double frameId, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillColorRGBNameD(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Animation is referenced by id. + /// + public static void FillNonZeroColor(int animationId, int frameId, int color) + { + PluginFillNonZeroColor(animationId, frameId, color); + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Animation is referenced by id. + /// + public static void FillNonZeroColorAllFrames(int animationId, int color) + { + PluginFillNonZeroColorAllFrames(animationId, color); + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Animation is referenced by name. + /// + public static void FillNonZeroColorAllFramesName(string path, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillNonZeroColorAllFramesName(lp_Path, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillNonZeroColorAllFramesNameD(string path, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillNonZeroColorAllFramesNameD(lp_Path, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by id. + /// + public static void FillNonZeroColorAllFramesRGB(int animationId, int red, int green, int blue) + { + PluginFillNonZeroColorAllFramesRGB(animationId, red, green, blue); + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by name. + /// + public static void FillNonZeroColorAllFramesRGBName(string path, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillNonZeroColorAllFramesRGBName(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillNonZeroColorAllFramesRGBNameD(string path, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillNonZeroColorAllFramesRGBNameD(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Animation is referenced by name. + /// + public static void FillNonZeroColorName(string path, int frameId, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillNonZeroColorName(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillNonZeroColorNameD(string path, double frameId, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillNonZeroColorNameD(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by id. + /// + public static void FillNonZeroColorRGB(int animationId, int frameId, int red, int green, int blue) + { + PluginFillNonZeroColorRGB(animationId, frameId, red, green, blue); + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by name. + /// + public static void FillNonZeroColorRGBName(string path, int frameId, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillNonZeroColorRGBName(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillNonZeroColorRGBNameD(string path, double frameId, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillNonZeroColorRGBNameD(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the frame with random RGB values for the given frame. Animation is + /// referenced by id. + /// + public static void FillRandomColors(int animationId, int frameId) + { + PluginFillRandomColors(animationId, frameId); + } + /// + /// Fill the frame with random RGB values for all frames. Animation is referenced + /// by id. + /// + public static void FillRandomColorsAllFrames(int animationId) + { + PluginFillRandomColorsAllFrames(animationId); + } + /// + /// Fill the frame with random RGB values for all frames. Animation is referenced + /// by name. + /// + public static void FillRandomColorsAllFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillRandomColorsAllFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillRandomColorsAllFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillRandomColorsAllFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the frame with random black and white values for the specified frame. + /// Animation is referenced by id. + /// + public static void FillRandomColorsBlackAndWhite(int animationId, int frameId) + { + PluginFillRandomColorsBlackAndWhite(animationId, frameId); + } + /// + /// Fill the frame with random black and white values for all frames. Animation + /// is referenced by id. + /// + public static void FillRandomColorsBlackAndWhiteAllFrames(int animationId) + { + PluginFillRandomColorsBlackAndWhiteAllFrames(animationId); + } + /// + /// Fill the frame with random black and white values for all frames. Animation + /// is referenced by name. + /// + public static void FillRandomColorsBlackAndWhiteAllFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillRandomColorsBlackAndWhiteAllFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillRandomColorsBlackAndWhiteAllFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillRandomColorsBlackAndWhiteAllFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the frame with random black and white values for the specified frame. + /// Animation is referenced by name. + /// + public static void FillRandomColorsBlackAndWhiteName(string path, int frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillRandomColorsBlackAndWhiteName(lp_Path, frameId); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillRandomColorsBlackAndWhiteNameD(string path, double frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillRandomColorsBlackAndWhiteNameD(lp_Path, frameId); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the frame with random RGB values for the given frame. Animation is + /// referenced by name. + /// + public static void FillRandomColorsName(string path, int frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillRandomColorsName(lp_Path, frameId); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillRandomColorsNameD(string path, double frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillRandomColorsNameD(lp_Path, frameId); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by id. + /// + public static void FillThresholdColors(int animationId, int frameId, int threshold, int color) + { + PluginFillThresholdColors(animationId, frameId, threshold, color); + } + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by id. + /// + public static void FillThresholdColorsAllFrames(int animationId, int threshold, int color) + { + PluginFillThresholdColorsAllFrames(animationId, threshold, color); + } + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by name. + /// + public static void FillThresholdColorsAllFramesName(string path, int threshold, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdColorsAllFramesName(lp_Path, threshold, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdColorsAllFramesNameD(string path, double threshold, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdColorsAllFramesNameD(lp_Path, threshold, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill all frames with RGB color where the animation color is less than the + /// threshold. Animation is referenced by id. + /// + public static void FillThresholdColorsAllFramesRGB(int animationId, int threshold, int red, int green, int blue) + { + PluginFillThresholdColorsAllFramesRGB(animationId, threshold, red, green, blue); + } + /// + /// Fill all frames with RGB color where the animation color is less than the + /// threshold. Animation is referenced by name. + /// + public static void FillThresholdColorsAllFramesRGBName(string path, int threshold, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdColorsAllFramesRGBName(lp_Path, threshold, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdColorsAllFramesRGBNameD(string path, double threshold, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdColorsAllFramesRGBNameD(lp_Path, threshold, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill all frames with the min RGB color where the animation color is less + /// than the min threshold AND with the max RGB color where the animation is + /// more than the max threshold. Animation is referenced by id. + /// + public static void FillThresholdColorsMinMaxAllFramesRGB(int animationId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + PluginFillThresholdColorsMinMaxAllFramesRGB(animationId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + } + /// + /// Fill all frames with the min RGB color where the animation color is less + /// than the min threshold AND with the max RGB color where the animation is + /// more than the max threshold. Animation is referenced by name. + /// + public static void FillThresholdColorsMinMaxAllFramesRGBName(string path, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdColorsMinMaxAllFramesRGBName(lp_Path, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdColorsMinMaxAllFramesRGBNameD(string path, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdColorsMinMaxAllFramesRGBNameD(lp_Path, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with the min RGB color where the animation color + /// is less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by id. + /// + public static void FillThresholdColorsMinMaxRGB(int animationId, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + PluginFillThresholdColorsMinMaxRGB(animationId, frameId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + } + /// + /// Fill the specified frame with the min RGB color where the animation color + /// is less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by name. + /// + public static void FillThresholdColorsMinMaxRGBName(string path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdColorsMinMaxRGBName(lp_Path, frameId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdColorsMinMaxRGBNameD(string path, double frameId, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdColorsMinMaxRGBNameD(lp_Path, frameId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by name. + /// + public static void FillThresholdColorsName(string path, int frameId, int threshold, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdColorsName(lp_Path, frameId, threshold, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdColorsNameD(string path, double frameId, double threshold, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdColorsNameD(lp_Path, frameId, threshold, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by id. + /// + public static void FillThresholdColorsRGB(int animationId, int frameId, int threshold, int red, int green, int blue) + { + PluginFillThresholdColorsRGB(animationId, frameId, threshold, red, green, blue); + } + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by name. + /// + public static void FillThresholdColorsRGBName(string path, int frameId, int threshold, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdColorsRGBName(lp_Path, frameId, threshold, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdColorsRGBNameD(string path, double frameId, double threshold, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdColorsRGBNameD(lp_Path, frameId, threshold, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by id. + /// + public static void FillThresholdRGBColorsAllFramesRGB(int animationId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue) + { + PluginFillThresholdRGBColorsAllFramesRGB(animationId, redThreshold, greenThreshold, blueThreshold, red, green, blue); + } + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by name. + /// + public static void FillThresholdRGBColorsAllFramesRGBName(string path, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdRGBColorsAllFramesRGBName(lp_Path, redThreshold, greenThreshold, blueThreshold, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdRGBColorsAllFramesRGBNameD(string path, double redThreshold, double greenThreshold, double blueThreshold, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdRGBColorsAllFramesRGBNameD(lp_Path, redThreshold, greenThreshold, blueThreshold, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by id. + /// + public static void FillThresholdRGBColorsRGB(int animationId, int frameId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue) + { + PluginFillThresholdRGBColorsRGB(animationId, frameId, redThreshold, greenThreshold, blueThreshold, red, green, blue); + } + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by name. + /// + public static void FillThresholdRGBColorsRGBName(string path, int frameId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillThresholdRGBColorsRGBName(lp_Path, frameId, redThreshold, greenThreshold, blueThreshold, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillThresholdRGBColorsRGBNameD(string path, double frameId, double redThreshold, double greenThreshold, double blueThreshold, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillThresholdRGBColorsRGBNameD(lp_Path, frameId, redThreshold, greenThreshold, blueThreshold, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by id. + /// + public static void FillZeroColor(int animationId, int frameId, int color) + { + PluginFillZeroColor(animationId, frameId, color); + } + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by id. + /// + public static void FillZeroColorAllFrames(int animationId, int color) + { + PluginFillZeroColorAllFrames(animationId, color); + } + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by name. + /// + public static void FillZeroColorAllFramesName(string path, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillZeroColorAllFramesName(lp_Path, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillZeroColorAllFramesNameD(string path, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillZeroColorAllFramesNameD(lp_Path, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by id. + /// + public static void FillZeroColorAllFramesRGB(int animationId, int red, int green, int blue) + { + PluginFillZeroColorAllFramesRGB(animationId, red, green, blue); + } + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by name. + /// + public static void FillZeroColorAllFramesRGBName(string path, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillZeroColorAllFramesRGBName(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillZeroColorAllFramesRGBNameD(string path, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillZeroColorAllFramesRGBNameD(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by name. + /// + public static void FillZeroColorName(string path, int frameId, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillZeroColorName(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillZeroColorNameD(string path, double frameId, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillZeroColorNameD(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by id. + /// + public static void FillZeroColorRGB(int animationId, int frameId, int red, int green, int blue) + { + PluginFillZeroColorRGB(animationId, frameId, red, green, blue); + } + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by name. + /// + public static void FillZeroColorRGBName(string path, int frameId, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginFillZeroColorRGBName(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double FillZeroColorRGBNameD(string path, double frameId, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginFillZeroColorRGBNameD(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. Animation is + /// referenced by id. + /// + public static int Get1DColor(int animationId, int frameId, int led) + { + int result = PluginGet1DColor(animationId, frameId, led); + return result; + } + /// + /// Get the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. Animation is + /// referenced by name. + /// + public static int Get1DColorName(string path, int frameId, int led) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGet1DColorName(lp_Path, frameId, led); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double Get1DColorNameD(string path, double frameId, double led) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGet1DColorNameD(lp_Path, frameId, led); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// Animation is referenced by id. + /// + public static int Get2DColor(int animationId, int frameId, int row, int column) + { + int result = PluginGet2DColor(animationId, frameId, row, column); + return result; + } + /// + /// Get the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// Animation is referenced by name. + /// + public static int Get2DColorName(string path, int frameId, int row, int column) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGet2DColorName(lp_Path, frameId, row, column); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double Get2DColorNameD(string path, double frameId, double row, double column) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGet2DColorNameD(lp_Path, frameId, row, column); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the animation id for the named animation. + /// + public static int GetAnimation(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + int result = PluginGetAnimation(lp_Name); + FreeIntPtr(lp_Name); + return result; + } + /// + /// `PluginGetAnimationCount` will return the number of loaded animations. + /// + public static int GetAnimationCount() + { + int result = PluginGetAnimationCount(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetAnimationD(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + double result = PluginGetAnimationD(lp_Name); + FreeIntPtr(lp_Name); + return result; + } + /// + /// `PluginGetAnimationId` will return the `animationId` given the `index` of + /// the loaded animation. The `index` is zero-based and less than the number + /// returned by `PluginGetAnimationCount`. Use `PluginGetAnimationName` to + /// get the name of the animation. + /// + public static int GetAnimationId(int index) + { + int result = PluginGetAnimationId(index); + return result; + } + /// + /// `PluginGetAnimationName` takes an `animationId` and returns the name of + /// the animation of the `.chroma` animation file. If a name is not available + /// then an empty string will be returned. + /// + public static string GetAnimationName(int animationId) + { + string result = Marshal.PtrToStringAnsi(PluginGetAnimationName(animationId)); + return result; + } + /// + /// Get the current frame of the animation referenced by id. + /// + public static int GetCurrentFrame(int animationId) + { + int result = PluginGetCurrentFrame(animationId); + return result; + } + /// + /// Get the current frame of the animation referenced by name. + /// + public static int GetCurrentFrameName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGetCurrentFrameName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetCurrentFrameNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGetCurrentFrameNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Returns the `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` of a `Chroma` + /// animation respective to the `deviceType`, as an integer upon success. Returns + /// negative one upon failure. + /// + public static int GetDevice(int animationId) + { + int result = PluginGetDevice(animationId); + return result; + } + /// + /// Returns the `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` of a `Chroma` + /// animation respective to the `deviceType`, as an integer upon success. Returns + /// negative one upon failure. + /// + public static int GetDeviceName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGetDeviceName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetDeviceNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGetDeviceNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Returns the `EChromaSDKDeviceTypeEnum` of a `Chroma` animation as an integer + /// upon success. Returns negative one upon failure. + /// + public static int GetDeviceType(int animationId) + { + int result = PluginGetDeviceType(animationId); + return result; + } + /// + /// Returns the `EChromaSDKDeviceTypeEnum` of a `Chroma` animation as an integer + /// upon success. Returns negative one upon failure. + /// + public static int GetDeviceTypeName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGetDeviceTypeName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetDeviceTypeNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGetDeviceTypeNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the frame colors and duration (in seconds) for a `Chroma` animation + /// referenced by id. The `color` is expected to be an array of the expected + /// dimensions for the `deviceType/device`. The `length` parameter is the size + /// of the `color` array. For `EChromaSDKDevice1DEnum` the array size should + /// be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should be `MAX + /// ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// + public static int GetFrame(int animationId, int frameIndex, out float duration, int[] colors, int length, int[] keys, int keysLength) + { + int result = PluginGetFrame(animationId, frameIndex, out duration, colors, length, keys, keysLength); + return result; + } + /// + /// Returns the frame count of a `Chroma` animation upon success. Returns negative + /// one upon failure. + /// + public static int GetFrameCount(int animationId) + { + int result = PluginGetFrameCount(animationId); + return result; + } + /// + /// Returns the frame count of a `Chroma` animation upon success. Returns negative + /// one upon failure. + /// + public static int GetFrameCountName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGetFrameCountName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetFrameCountNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGetFrameCountNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the frame colors and duration (in seconds) for a `Chroma` animation + /// referenced by name. The `color` is expected to be an array of the expected + /// dimensions for the `deviceType/device`. The `length` parameter is the size + /// of the `color` array. For `EChromaSDKDevice1DEnum` the array size should + /// be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should be `MAX + /// ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// + public static int GetFrameName(string path, int frameIndex, out float duration, int[] colors, int length, int[] keys, int keysLength) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGetFrameName(lp_Path, frameIndex, out duration, colors, length, keys, keysLength); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the color of an animation key for the given frame referenced by id. + /// + /// + public static int GetKeyColor(int animationId, int frameId, int rzkey) + { + int result = PluginGetKeyColor(animationId, frameId, rzkey); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetKeyColorD(string path, double frameId, double rzkey) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginGetKeyColorD(lp_Path, frameId, rzkey); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Get the color of an animation key for the given frame referenced by name. + /// + /// + public static int GetKeyColorName(string path, int frameId, int rzkey) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginGetKeyColorName(lp_Path, frameId, rzkey); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Returns `RZRESULT_SUCCESS` if the plugin has been initialized successfully. + /// Returns `RZRESULT_DLL_NOT_FOUND` if core Chroma library is not found. Returns + /// `RZRESULT_DLL_INVALID_SIGNATURE` if core Chroma library has an invalid + /// signature. + /// + public static int GetLibraryLoadedState() + { + int result = PluginGetLibraryLoadedState(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetLibraryLoadedStateD() + { + double result = PluginGetLibraryLoadedStateD(); + return result; + } + /// + /// Returns the `MAX COLUMN` given the `EChromaSDKDevice2DEnum` device as an + /// integer upon success. Returns negative one upon failure. + /// + public static int GetMaxColumn(Device2D device) + { + int result = PluginGetMaxColumn((int)device); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetMaxColumnD(double device) + { + double result = PluginGetMaxColumnD(device); + return result; + } + /// + /// Returns the MAX LEDS given the `EChromaSDKDevice1DEnum` device as an integer + /// upon success. Returns negative one upon failure. + /// + public static int GetMaxLeds(Device1D device) + { + int result = PluginGetMaxLeds((int)device); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetMaxLedsD(double device) + { + double result = PluginGetMaxLedsD(device); + return result; + } + /// + /// Returns the `MAX ROW` given the `EChromaSDKDevice2DEnum` device as an integer + /// upon success. Returns negative one upon failure. + /// + public static int GetMaxRow(Device2D device) + { + int result = PluginGetMaxRow((int)device); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetMaxRowD(double device) + { + double result = PluginGetMaxRowD(device); + return result; + } + /// + /// `PluginGetPlayingAnimationCount` will return the number of playing animations. + /// + /// + public static int GetPlayingAnimationCount() + { + int result = PluginGetPlayingAnimationCount(); + return result; + } + /// + /// `PluginGetPlayingAnimationId` will return the `animationId` given the `index` + /// of the playing animation. The `index` is zero-based and less than the number + /// returned by `PluginGetPlayingAnimationCount`. Use `PluginGetAnimationName` + /// to get the name of the animation. + /// + public static int GetPlayingAnimationId(int index) + { + int result = PluginGetPlayingAnimationId(index); + return result; + } + /// + /// Get the RGB color given red, green, and blue. + /// + public static int GetRGB(int red, int green, int blue) + { + int result = PluginGetRGB(red, green, blue); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double GetRGBD(double red, double green, double blue) + { + double result = PluginGetRGBD(red, green, blue); + return result; + } + /// + /// Check if the animation has loop enabled referenced by id. + /// + public static bool HasAnimationLoop(int animationId) + { + bool result = PluginHasAnimationLoop(animationId); + return result; + } + /// + /// Check if the animation has loop enabled referenced by name. + /// + public static bool HasAnimationLoopName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + bool result = PluginHasAnimationLoopName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double HasAnimationLoopNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginHasAnimationLoopNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Initialize the ChromaSDK. Zero indicates success, otherwise failure. Many + /// API methods auto initialize the ChromaSDK if not already initialized. + /// + public static int Init() + { + int result = PluginInit(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double InitD() + { + double result = PluginInitD(); + return result; + } + /// + /// Initialize the ChromaSDK. AppInfo populates the details in Synapse. Zero + /// indicates success, otherwise failure. Many API methods auto initialize + /// the ChromaSDK if not already initialized. + /// + public static int InitSDK(ref ChromaSDK.APPINFOTYPE appInfo) + { + int result = PluginInitSDK(ref appInfo); + return result; + } + /// + /// Insert an animation delay by duplicating the frame by the delay number of + /// times. Animation is referenced by id. + /// + public static void InsertDelay(int animationId, int frameId, int delay) + { + PluginInsertDelay(animationId, frameId, delay); + } + /// + /// Insert an animation delay by duplicating the frame by the delay number of + /// times. Animation is referenced by name. + /// + public static void InsertDelayName(string path, int frameId, int delay) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginInsertDelayName(lp_Path, frameId, delay); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double InsertDelayNameD(string path, double frameId, double delay) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginInsertDelayNameD(lp_Path, frameId, delay); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Duplicate the source frame index at the target frame index. Animation is + /// referenced by id. + /// + public static void InsertFrame(int animationId, int sourceFrame, int targetFrame) + { + PluginInsertFrame(animationId, sourceFrame, targetFrame); + } + /// + /// Duplicate the source frame index at the target frame index. Animation is + /// referenced by name. + /// + public static void InsertFrameName(string path, int sourceFrame, int targetFrame) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginInsertFrameName(lp_Path, sourceFrame, targetFrame); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double InsertFrameNameD(string path, double sourceFrame, double targetFrame) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginInsertFrameNameD(lp_Path, sourceFrame, targetFrame); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Invert all the colors at the specified frame. Animation is referenced by + /// id. + /// + public static void InvertColors(int animationId, int frameId) + { + PluginInvertColors(animationId, frameId); + } + /// + /// Invert all the colors for all frames. Animation is referenced by id. + /// + public static void InvertColorsAllFrames(int animationId) + { + PluginInvertColorsAllFrames(animationId); + } + /// + /// Invert all the colors for all frames. Animation is referenced by name. + /// + public static void InvertColorsAllFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginInvertColorsAllFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double InvertColorsAllFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginInvertColorsAllFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Invert all the colors at the specified frame. Animation is referenced by + /// name. + /// + public static void InvertColorsName(string path, int frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginInvertColorsName(lp_Path, frameId); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double InvertColorsNameD(string path, double frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginInvertColorsNameD(lp_Path, frameId); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Check if the animation is paused referenced by id. + /// + public static bool IsAnimationPaused(int animationId) + { + bool result = PluginIsAnimationPaused(animationId); + return result; + } + /// + /// Check if the animation is paused referenced by name. + /// + public static bool IsAnimationPausedName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + bool result = PluginIsAnimationPausedName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsAnimationPausedNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginIsAnimationPausedNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// The editor dialog is a non-blocking modal window, this method returns true + /// if the modal window is open, otherwise false. + /// + public static bool IsDialogOpen() + { + bool result = PluginIsDialogOpen(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsDialogOpenD() + { + double result = PluginIsDialogOpenD(); + return result; + } + /// + /// Returns true if the plugin has been initialized. Returns false if the plugin + /// is uninitialized. + /// + public static bool IsInitialized() + { + bool result = PluginIsInitialized(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsInitializedD() + { + double result = PluginIsInitializedD(); + return result; + } + /// + /// If the method can be invoked the method returns true. + /// + public static bool IsPlatformSupported() + { + bool result = PluginIsPlatformSupported(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsPlatformSupportedD() + { + double result = PluginIsPlatformSupportedD(); + return result; + } + /// + /// `PluginIsPlayingName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The method + /// will return whether the animation is playing or not. Animation is referenced + /// by id. + /// + public static bool IsPlaying(int animationId) + { + bool result = PluginIsPlaying(animationId); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsPlayingD(double animationId) + { + double result = PluginIsPlayingD(animationId); + return result; + } + /// + /// `PluginIsPlayingName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The method + /// will return whether the animation is playing or not. Animation is referenced + /// by name. + /// + public static bool IsPlayingName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + bool result = PluginIsPlayingName(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsPlayingNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginIsPlayingNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// `PluginIsPlayingType` automatically handles initializing the `ChromaSDK`. + /// If any animation is playing for the `deviceType` and `device` combination, + /// the method will return true, otherwise false. + /// + public static bool IsPlayingType(int deviceType, int device) + { + bool result = PluginIsPlayingType(deviceType, device); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double IsPlayingTypeD(double deviceType, double device) + { + double result = PluginIsPlayingTypeD(deviceType, device); + return result; + } + /// + /// Do a lerp math operation on a float. + /// + public static float Lerp(float start, float end, float amt) + { + float result = PluginLerp(start, end, amt); + return result; + } + /// + /// Lerp from one color to another given t in the range 0.0 to 1.0. + /// + public static int LerpColor(int from, int to, float t) + { + int result = PluginLerpColor(from, to, t); + return result; + } + /// + /// Loads `Chroma` effects so that the animation can be played immediately. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// + public static int LoadAnimation(int animationId) + { + int result = PluginLoadAnimation(animationId); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double LoadAnimationD(double animationId) + { + double result = PluginLoadAnimationD(animationId); + return result; + } + /// + /// Load the named animation. + /// + public static void LoadAnimationName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginLoadAnimationName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// Load a composite set of animations. + /// + public static void LoadComposite(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + PluginLoadComposite(lp_Name); + FreeIntPtr(lp_Name); + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by id. + /// + public static void MakeBlankFrames(int animationId, int frameCount, float duration, int color) + { + PluginMakeBlankFrames(animationId, frameCount, duration, color); + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by name. + /// + public static void MakeBlankFramesName(string path, int frameCount, float duration, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMakeBlankFramesName(lp_Path, frameCount, duration, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MakeBlankFramesNameD(string path, double frameCount, double duration, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMakeBlankFramesNameD(lp_Path, frameCount, duration, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random. Animation is referenced + /// by id. + /// + public static void MakeBlankFramesRandom(int animationId, int frameCount, float duration) + { + PluginMakeBlankFramesRandom(animationId, frameCount, duration); + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random black and white. Animation + /// is referenced by id. + /// + public static void MakeBlankFramesRandomBlackAndWhite(int animationId, int frameCount, float duration) + { + PluginMakeBlankFramesRandomBlackAndWhite(animationId, frameCount, duration); + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random black and white. Animation + /// is referenced by name. + /// + public static void MakeBlankFramesRandomBlackAndWhiteName(string path, int frameCount, float duration) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMakeBlankFramesRandomBlackAndWhiteName(lp_Path, frameCount, duration); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MakeBlankFramesRandomBlackAndWhiteNameD(string path, double frameCount, double duration) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMakeBlankFramesRandomBlackAndWhiteNameD(lp_Path, frameCount, duration); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random. Animation is referenced + /// by name. + /// + public static void MakeBlankFramesRandomName(string path, int frameCount, float duration) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMakeBlankFramesRandomName(lp_Path, frameCount, duration); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MakeBlankFramesRandomNameD(string path, double frameCount, double duration) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMakeBlankFramesRandomNameD(lp_Path, frameCount, duration); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by id. + /// + public static void MakeBlankFramesRGB(int animationId, int frameCount, float duration, int red, int green, int blue) + { + PluginMakeBlankFramesRGB(animationId, frameCount, duration, red, green, blue); + } + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by name. + /// + public static void MakeBlankFramesRGBName(string path, int frameCount, float duration, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMakeBlankFramesRGBName(lp_Path, frameCount, duration, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MakeBlankFramesRGBNameD(string path, double frameCount, double duration, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMakeBlankFramesRGBNameD(lp_Path, frameCount, duration, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Flips the color grid horizontally for all `Chroma` animation frames. Returns + /// the animation id upon success. Returns negative one upon failure. + /// + public static int MirrorHorizontally(int animationId) + { + int result = PluginMirrorHorizontally(animationId); + return result; + } + /// + /// Flips the color grid vertically for all `Chroma` animation frames. This + /// method has no effect for `EChromaSDKDevice1DEnum` devices. Returns the + /// animation id upon success. Returns negative one upon failure. + /// + public static int MirrorVertically(int animationId) + { + int result = PluginMirrorVertically(animationId); + return result; + } + /// + /// Multiply the color intensity with the lerp result from color 1 to color + /// 2 using the frame index divided by the frame count for the `t` parameter. + /// Animation is referenced in id. + /// + public static void MultiplyColorLerpAllFrames(int animationId, int color1, int color2) + { + PluginMultiplyColorLerpAllFrames(animationId, color1, color2); + } + /// + /// Multiply the color intensity with the lerp result from color 1 to color + /// 2 using the frame index divided by the frame count for the `t` parameter. + /// Animation is referenced in name. + /// + public static void MultiplyColorLerpAllFramesName(string path, int color1, int color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyColorLerpAllFramesName(lp_Path, color1, color2); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyColorLerpAllFramesNameD(string path, double color1, double color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyColorLerpAllFramesNameD(lp_Path, color1, color2); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply all the colors in the frame by the intensity value. The valid the + /// intensity range is from 0.0 to 255.0. RGB components are multiplied equally. + /// An intensity of 0.5 would half the color value. Black colors in the frame + /// will not be affected by this method. + /// + public static void MultiplyIntensity(int animationId, int frameId, float intensity) + { + PluginMultiplyIntensity(animationId, frameId, intensity); + } + /// + /// Multiply all the colors for all frames by the intensity value. The valid + /// the intensity range is from 0.0 to 255.0. RGB components are multiplied + /// equally. An intensity of 0.5 would half the color value. Black colors in + /// the frame will not be affected by this method. + /// + public static void MultiplyIntensityAllFrames(int animationId, float intensity) + { + PluginMultiplyIntensityAllFrames(animationId, intensity); + } + /// + /// Multiply all the colors for all frames by the intensity value. The valid + /// the intensity range is from 0.0 to 255.0. RGB components are multiplied + /// equally. An intensity of 0.5 would half the color value. Black colors in + /// the frame will not be affected by this method. + /// + public static void MultiplyIntensityAllFramesName(string path, float intensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyIntensityAllFramesName(lp_Path, intensity); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyIntensityAllFramesNameD(string path, double intensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyIntensityAllFramesNameD(lp_Path, intensity); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by id. + /// + public static void MultiplyIntensityAllFramesRGB(int animationId, int red, int green, int blue) + { + PluginMultiplyIntensityAllFramesRGB(animationId, red, green, blue); + } + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by name. + /// + public static void MultiplyIntensityAllFramesRGBName(string path, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyIntensityAllFramesRGBName(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyIntensityAllFramesRGBNameD(string path, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyIntensityAllFramesRGBNameD(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by id. + /// + public static void MultiplyIntensityColor(int animationId, int frameId, int color) + { + PluginMultiplyIntensityColor(animationId, frameId, color); + } + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by id. + /// + public static void MultiplyIntensityColorAllFrames(int animationId, int color) + { + PluginMultiplyIntensityColorAllFrames(animationId, color); + } + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by name. + /// + public static void MultiplyIntensityColorAllFramesName(string path, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyIntensityColorAllFramesName(lp_Path, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyIntensityColorAllFramesNameD(string path, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyIntensityColorAllFramesNameD(lp_Path, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by name. + /// + public static void MultiplyIntensityColorName(string path, int frameId, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyIntensityColorName(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyIntensityColorNameD(string path, double frameId, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyIntensityColorNameD(lp_Path, frameId, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply all the colors in the frame by the intensity value. The valid the + /// intensity range is from 0.0 to 255.0. RGB components are multiplied equally. + /// An intensity of 0.5 would half the color value. Black colors in the frame + /// will not be affected by this method. + /// + public static void MultiplyIntensityName(string path, int frameId, float intensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyIntensityName(lp_Path, frameId, intensity); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyIntensityNameD(string path, double frameId, double intensity) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyIntensityNameD(lp_Path, frameId, intensity); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by id. + /// + public static void MultiplyIntensityRGB(int animationId, int frameId, int red, int green, int blue) + { + PluginMultiplyIntensityRGB(animationId, frameId, red, green, blue); + } + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by name. + /// + public static void MultiplyIntensityRGBName(string path, int frameId, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyIntensityRGBName(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyIntensityRGBNameD(string path, double frameId, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyIntensityRGBNameD(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the color lerp result between color 1 and + /// 2 using the frame color value as the `t` value. Animation is referenced + /// by id. + /// + public static void MultiplyNonZeroTargetColorLerp(int animationId, int frameId, int color1, int color2) + { + PluginMultiplyNonZeroTargetColorLerp(animationId, frameId, color1, color2); + } + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by id. + /// + /// + public static void MultiplyNonZeroTargetColorLerpAllFrames(int animationId, int color1, int color2) + { + PluginMultiplyNonZeroTargetColorLerpAllFrames(animationId, color1, color2); + } + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by name. + /// + /// + public static void MultiplyNonZeroTargetColorLerpAllFramesName(string path, int color1, int color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyNonZeroTargetColorLerpAllFramesName(lp_Path, color1, color2); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyNonZeroTargetColorLerpAllFramesNameD(string path, double color1, double color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyNonZeroTargetColorLerpAllFramesNameD(lp_Path, color1, color2); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the color lerp result between RGB 1 and 2 + /// using the frame color value as the `t` value. Animation is referenced by + /// id. + /// + public static void MultiplyNonZeroTargetColorLerpAllFramesRGB(int animationId, int red1, int green1, int blue1, int red2, int green2, int blue2) + { + PluginMultiplyNonZeroTargetColorLerpAllFramesRGB(animationId, red1, green1, blue1, red2, green2, blue2); + } + /// + /// Multiply the specific frame by the color lerp result between RGB 1 and 2 + /// using the frame color value as the `t` value. Animation is referenced by + /// name. + /// + public static void MultiplyNonZeroTargetColorLerpAllFramesRGBName(string path, int red1, int green1, int blue1, int red2, int green2, int blue2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyNonZeroTargetColorLerpAllFramesRGBName(lp_Path, red1, green1, blue1, red2, green2, blue2); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyNonZeroTargetColorLerpAllFramesRGBNameD(string path, double red1, double green1, double blue1, double red2, double green2, double blue2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyNonZeroTargetColorLerpAllFramesRGBNameD(lp_Path, red1, green1, blue1, red2, green2, blue2); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the color lerp result between color 1 and + /// 2 using the frame color value as the `t` value. Animation is referenced + /// by id. + /// + public static void MultiplyTargetColorLerp(int animationId, int frameId, int color1, int color2) + { + PluginMultiplyTargetColorLerp(animationId, frameId, color1, color2); + } + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by id. + /// + /// + public static void MultiplyTargetColorLerpAllFrames(int animationId, int color1, int color2) + { + PluginMultiplyTargetColorLerpAllFrames(animationId, color1, color2); + } + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by name. + /// + /// + public static void MultiplyTargetColorLerpAllFramesName(string path, int color1, int color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyTargetColorLerpAllFramesName(lp_Path, color1, color2); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyTargetColorLerpAllFramesNameD(string path, double color1, double color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyTargetColorLerpAllFramesNameD(lp_Path, color1, color2); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply all frames by the color lerp result between RGB 1 and 2 using the + /// frame color value as the `t` value. Animation is referenced by id. + /// + public static void MultiplyTargetColorLerpAllFramesRGB(int animationId, int red1, int green1, int blue1, int red2, int green2, int blue2) + { + PluginMultiplyTargetColorLerpAllFramesRGB(animationId, red1, green1, blue1, red2, green2, blue2); + } + /// + /// Multiply all frames by the color lerp result between RGB 1 and 2 using the + /// frame color value as the `t` value. Animation is referenced by name. + /// + public static void MultiplyTargetColorLerpAllFramesRGBName(string path, int red1, int green1, int blue1, int red2, int green2, int blue2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyTargetColorLerpAllFramesRGBName(lp_Path, red1, green1, blue1, red2, green2, blue2); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double MultiplyTargetColorLerpAllFramesRGBNameD(string path, double red1, double green1, double blue1, double red2, double green2, double blue2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginMultiplyTargetColorLerpAllFramesRGBNameD(lp_Path, red1, green1, blue1, red2, green2, blue2); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Multiply the specific frame by the color lerp result between color 1 and + /// 2 using the frame color value as the `t` value. Animation is referenced + /// by name. + /// + public static void MultiplyTargetColorLerpName(string path, int frameId, int color1, int color2) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginMultiplyTargetColorLerpName(lp_Path, frameId, color1, color2); + FreeIntPtr(lp_Path); + } + /// + /// Offset all colors in the frame using the RGB offset. Use the range of -255 + /// to 255 for red, green, and blue parameters. Negative values remove color. + /// Positive values add color. + /// + public static void OffsetColors(int animationId, int frameId, int red, int green, int blue) + { + PluginOffsetColors(animationId, frameId, red, green, blue); + } + /// + /// Offset all colors for all frames using the RGB offset. Use the range of + /// -255 to 255 for red, green, and blue parameters. Negative values remove + /// color. Positive values add color. + /// + public static void OffsetColorsAllFrames(int animationId, int red, int green, int blue) + { + PluginOffsetColorsAllFrames(animationId, red, green, blue); + } + /// + /// Offset all colors for all frames using the RGB offset. Use the range of + /// -255 to 255 for red, green, and blue parameters. Negative values remove + /// color. Positive values add color. + /// + public static void OffsetColorsAllFramesName(string path, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginOffsetColorsAllFramesName(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double OffsetColorsAllFramesNameD(string path, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOffsetColorsAllFramesNameD(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Offset all colors in the frame using the RGB offset. Use the range of -255 + /// to 255 for red, green, and blue parameters. Negative values remove color. + /// Positive values add color. + /// + public static void OffsetColorsName(string path, int frameId, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginOffsetColorsName(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double OffsetColorsNameD(string path, double frameId, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOffsetColorsNameD(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors in the frame using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// + public static void OffsetNonZeroColors(int animationId, int frameId, int red, int green, int blue) + { + PluginOffsetNonZeroColors(animationId, frameId, red, green, blue); + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors for all frames using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// + public static void OffsetNonZeroColorsAllFrames(int animationId, int red, int green, int blue) + { + PluginOffsetNonZeroColorsAllFrames(animationId, red, green, blue); + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors for all frames using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// + public static void OffsetNonZeroColorsAllFramesName(string path, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginOffsetNonZeroColorsAllFramesName(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double OffsetNonZeroColorsAllFramesNameD(string path, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOffsetNonZeroColorsAllFramesNameD(lp_Path, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors in the frame using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// + public static void OffsetNonZeroColorsName(string path, int frameId, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginOffsetNonZeroColorsName(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double OffsetNonZeroColorsNameD(string path, double frameId, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOffsetNonZeroColorsNameD(lp_Path, frameId, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Opens a `Chroma` animation file so that it can be played. Returns an animation + /// id >= 0 upon success. Returns negative one if there was a failure. The + /// animation id is used in most of the API methods. + /// + public static int OpenAnimation(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginOpenAnimation(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double OpenAnimationD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOpenAnimationD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Opens a `Chroma` animation data from memory so that it can be played. `Data` + /// is a pointer to BYTE array of the loaded animation in memory. `Name` will + /// be assigned to the animation when loaded. Returns an animation id >= 0 + /// upon success. Returns negative one if there was a failure. The animation + /// id is used in most of the API methods. + /// + public static int OpenAnimationFromMemory(byte[] data, string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + int result = PluginOpenAnimationFromMemory(data, lp_Name); + FreeIntPtr(lp_Name); + return result; + } + /// + /// Opens a `Chroma` animation file with the `.chroma` extension. Returns zero + /// upon success. Returns negative one if there was a failure. + /// + public static int OpenEditorDialog(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginOpenEditorDialog(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Open the named animation in the editor dialog and play the animation at + /// start. + /// + public static int OpenEditorDialogAndPlay(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginOpenEditorDialogAndPlay(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double OpenEditorDialogAndPlayD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOpenEditorDialogAndPlayD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double OpenEditorDialogD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginOpenEditorDialogD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Sets the `duration` for all grames in the `Chroma` animation to the `duration` + /// parameter. Returns the animation id upon success. Returns negative one + /// upon failure. + /// + public static int OverrideFrameDuration(int animationId, float duration) + { + int result = PluginOverrideFrameDuration(animationId, duration); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double OverrideFrameDurationD(double animationId, double duration) + { + double result = PluginOverrideFrameDurationD(animationId, duration); + return result; + } + /// + /// Override the duration of all frames with the `duration` value. Animation + /// is referenced by name. + /// + public static void OverrideFrameDurationName(string path, float duration) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginOverrideFrameDurationName(lp_Path, duration); + FreeIntPtr(lp_Path); + } + /// + /// Pause the current animation referenced by id. + /// + public static void PauseAnimation(int animationId) + { + PluginPauseAnimation(animationId); + } + /// + /// Pause the current animation referenced by name. + /// + public static void PauseAnimationName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginPauseAnimationName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double PauseAnimationNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginPauseAnimationNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Plays the `Chroma` animation. This will load the animation, if not loaded + /// previously. Returns the animation id upon success. Returns negative one + /// upon failure. + /// + public static int PlayAnimation(int animationId) + { + int result = PluginPlayAnimation(animationId); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double PlayAnimationD(double animationId) + { + double result = PluginPlayAnimationD(animationId); + return result; + } + /// + /// `PluginPlayAnimationFrame` automatically handles initializing the `ChromaSDK`. + /// The method will play the animation given the `animationId` with looping + /// `on` or `off` starting at the `frameId`. + /// + public static void PlayAnimationFrame(int animationId, int frameId, bool loop) + { + PluginPlayAnimationFrame(animationId, frameId, loop); + } + /// + /// `PluginPlayAnimationFrameName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The animation + /// will play with looping `on` or `off` starting at the `frameId`. + /// + public static void PlayAnimationFrameName(string path, int frameId, bool loop) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginPlayAnimationFrameName(lp_Path, frameId, loop); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double PlayAnimationFrameNameD(string path, double frameId, double loop) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginPlayAnimationFrameNameD(lp_Path, frameId, loop); + FreeIntPtr(lp_Path); + return result; + } + /// + /// `PluginPlayAnimationLoop` automatically handles initializing the `ChromaSDK`. + /// The method will play the animation given the `animationId` with looping + /// `on` or `off`. + /// + public static void PlayAnimationLoop(int animationId, bool loop) + { + PluginPlayAnimationLoop(animationId, loop); + } + /// + /// `PluginPlayAnimationName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The animation + /// will play with looping `on` or `off`. + /// + public static void PlayAnimationName(string path, bool loop) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginPlayAnimationName(lp_Path, loop); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double PlayAnimationNameD(string path, double loop) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginPlayAnimationNameD(lp_Path, loop); + FreeIntPtr(lp_Path); + return result; + } + /// + /// `PluginPlayComposite` automatically handles initializing the `ChromaSDK`. + /// The named animation files for the `.chroma` set will be automatically opened. + /// The set of animations will play with looping `on` or `off`. + /// + public static void PlayComposite(string name, bool loop) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + PluginPlayComposite(lp_Name, loop); + FreeIntPtr(lp_Name); + } + /// + /// D suffix for limited data types. + /// + public static double PlayCompositeD(string name, double loop) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + double result = PluginPlayCompositeD(lp_Name, loop); + FreeIntPtr(lp_Name); + return result; + } + /// + /// Displays the `Chroma` animation frame on `Chroma` hardware given the `frameIndex`. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// + public static int PreviewFrame(int animationId, int frameIndex) + { + int result = PluginPreviewFrame(animationId, frameIndex); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double PreviewFrameD(double animationId, double frameIndex) + { + double result = PluginPreviewFrameD(animationId, frameIndex); + return result; + } + /// + /// Displays the `Chroma` animation frame on `Chroma` hardware given the `frameIndex`. + /// Animaton is referenced by name. + /// + public static void PreviewFrameName(string path, int frameIndex) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginPreviewFrameName(lp_Path, frameIndex); + FreeIntPtr(lp_Path); + } + /// + /// Reduce the frames of the animation by removing every nth element. Animation + /// is referenced by id. + /// + public static void ReduceFrames(int animationId, int n) + { + PluginReduceFrames(animationId, n); + } + /// + /// Reduce the frames of the animation by removing every nth element. Animation + /// is referenced by name. + /// + public static void ReduceFramesName(string path, int n) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginReduceFramesName(lp_Path, n); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double ReduceFramesNameD(string path, double n) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginReduceFramesNameD(lp_Path, n); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Resets the `Chroma` animation to 1 blank frame. Returns the animation id + /// upon success. Returns negative one upon failure. + /// + public static int ResetAnimation(int animationId) + { + int result = PluginResetAnimation(animationId); + return result; + } + /// + /// Resume the animation with loop `ON` or `OFF` referenced by id. + /// + public static void ResumeAnimation(int animationId, bool loop) + { + PluginResumeAnimation(animationId, loop); + } + /// + /// Resume the animation with loop `ON` or `OFF` referenced by name. + /// + public static void ResumeAnimationName(string path, bool loop) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginResumeAnimationName(lp_Path, loop); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double ResumeAnimationNameD(string path, double loop) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginResumeAnimationNameD(lp_Path, loop); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Reverse the animation frame order of the `Chroma` animation. Returns the + /// animation id upon success. Returns negative one upon failure. Animation + /// is referenced by id. + /// + public static int Reverse(int animationId) + { + int result = PluginReverse(animationId); + return result; + } + /// + /// Reverse the animation frame order of the `Chroma` animation. Animation is + /// referenced by id. + /// + public static void ReverseAllFrames(int animationId) + { + PluginReverseAllFrames(animationId); + } + /// + /// Reverse the animation frame order of the `Chroma` animation. Animation is + /// referenced by name. + /// + public static void ReverseAllFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginReverseAllFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double ReverseAllFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginReverseAllFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Save the animation referenced by id to the path specified. + /// + public static int SaveAnimation(int animationId, string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginSaveAnimation(animationId, lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Save the named animation to the target path specified. + /// + public static int SaveAnimationName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + int result = PluginSaveAnimationName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Set the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. The animation + /// is referenced by id. + /// + public static void Set1DColor(int animationId, int frameId, int led, int color) + { + PluginSet1DColor(animationId, frameId, led, color); + } + /// + /// Set the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. The animation + /// is referenced by name. + /// + public static void Set1DColorName(string path, int frameId, int led, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSet1DColorName(lp_Path, frameId, led, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double Set1DColorNameD(string path, double frameId, double led, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSet1DColorNameD(lp_Path, frameId, led, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// The animation is referenced by id. + /// + public static void Set2DColor(int animationId, int frameId, int row, int column, int color) + { + PluginSet2DColor(animationId, frameId, row, column, color); + } + /// + /// Set the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// The animation is referenced by name. + /// + public static void Set2DColorName(string path, int frameId, int row, int column, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSet2DColorName(lp_Path, frameId, row, column, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double Set2DColorNameD(string path, double frameId, double rowColumnIndex, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSet2DColorNameD(lp_Path, frameId, rowColumnIndex, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// When custom color is set, the custom key mode will be used. The animation + /// is referenced by id. + /// + public static void SetChromaCustomColorAllFrames(int animationId) + { + PluginSetChromaCustomColorAllFrames(animationId); + } + /// + /// When custom color is set, the custom key mode will be used. The animation + /// is referenced by name. + /// + public static void SetChromaCustomColorAllFramesName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetChromaCustomColorAllFramesName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetChromaCustomColorAllFramesNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetChromaCustomColorAllFramesNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the Chroma custom key color flag on all frames. `True` changes the layout + /// from grid to key. `True` changes the layout from key to grid. Animation + /// is referenced by id. + /// + public static void SetChromaCustomFlag(int animationId, bool flag) + { + PluginSetChromaCustomFlag(animationId, flag); + } + /// + /// Set the Chroma custom key color flag on all frames. `True` changes the layout + /// from grid to key. `True` changes the layout from key to grid. Animation + /// is referenced by name. + /// + public static void SetChromaCustomFlagName(string path, bool flag) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetChromaCustomFlagName(lp_Path, flag); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetChromaCustomFlagNameD(string path, double flag) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetChromaCustomFlagNameD(lp_Path, flag); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the current frame of the animation referenced by id. + /// + public static void SetCurrentFrame(int animationId, int frameId) + { + PluginSetCurrentFrame(animationId, frameId); + } + /// + /// Set the current frame of the animation referenced by name. + /// + public static void SetCurrentFrameName(string path, int frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetCurrentFrameName(lp_Path, frameId); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetCurrentFrameNameD(string path, double frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetCurrentFrameNameD(lp_Path, frameId); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the custom alpha flag on the color array + /// + public static int SetCustomColorFlag2D(int device, int[] colors) + { + int result = PluginSetCustomColorFlag2D(device, colors); + return result; + } + /// + /// Changes the `deviceType` and `device` of a `Chroma` animation. If the device + /// is changed, the `Chroma` animation will be reset with 1 blank frame. Returns + /// the animation id upon success. Returns negative one upon failure. + /// + public static int SetDevice(int animationId, int deviceType, int device) + { + int result = PluginSetDevice(animationId, deviceType, device); + return result; + } + /// + /// SetEffect will display the referenced effect id. + /// + public static int SetEffect(Guid effectId) + { + int result = PluginSetEffect(effectId); + return result; + } + /// + /// SetEffectCustom1D will display the referenced colors immediately + /// + public static int SetEffectCustom1D(int device, int[] colors) + { + int result = PluginSetEffectCustom1D(device, colors); + return result; + } + /// + /// SetEffectCustom2D will display the referenced colors immediately. + /// + public static int SetEffectCustom2D(int device, int[] colors) + { + int result = PluginSetEffectCustom2D(device, colors); + return result; + } + /// + /// SetEffectKeyboardCustom2D will display the referenced custom keyboard colors + /// immediately. Colors represent a visual grid layout. Keys represent the + /// hotkeys for any layout. + /// + public static int SetEffectKeyboardCustom2D(int device, int[] colors, int[] keys) + { + int result = PluginSetEffectKeyboardCustom2D(device, colors, keys); + return result; + } + /// + /// When the idle animation is used, the named animation will play when no other + /// animations are playing. Reference the animation by id. + /// + public static void SetIdleAnimation(int animationId) + { + PluginSetIdleAnimation(animationId); + } + /// + /// When the idle animation is used, the named animation will play when no other + /// animations are playing. Reference the animation by name. + /// + public static void SetIdleAnimationName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetIdleAnimationName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// Set animation key to a static color for the given frame. + /// + public static void SetKeyColor(int animationId, int frameId, int rzkey, int color) + { + PluginSetKeyColor(animationId, frameId, rzkey, color); + } + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by id. + /// + public static void SetKeyColorAllFrames(int animationId, int rzkey, int color) + { + PluginSetKeyColorAllFrames(animationId, rzkey, color); + } + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by name. + /// + public static void SetKeyColorAllFramesName(string path, int rzkey, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyColorAllFramesName(lp_Path, rzkey, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyColorAllFramesNameD(string path, double rzkey, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyColorAllFramesNameD(lp_Path, rzkey, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by id. + /// + public static void SetKeyColorAllFramesRGB(int animationId, int rzkey, int red, int green, int blue) + { + PluginSetKeyColorAllFramesRGB(animationId, rzkey, red, green, blue); + } + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by name. + /// + public static void SetKeyColorAllFramesRGBName(string path, int rzkey, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyColorAllFramesRGBName(lp_Path, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyColorAllFramesRGBNameD(string path, double rzkey, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyColorAllFramesRGBNameD(lp_Path, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set animation key to a static color for the given frame. + /// + public static void SetKeyColorName(string path, int frameId, int rzkey, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyColorName(lp_Path, frameId, rzkey, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyColorNameD(string path, double frameId, double rzkey, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyColorNameD(lp_Path, frameId, rzkey, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the key to the specified key color for the specified frame. Animation + /// is referenced by id. + /// + public static void SetKeyColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue) + { + PluginSetKeyColorRGB(animationId, frameId, rzkey, red, green, blue); + } + /// + /// Set the key to the specified key color for the specified frame. Animation + /// is referenced by name. + /// + public static void SetKeyColorRGBName(string path, int frameId, int rzkey, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyColorRGBName(lp_Path, frameId, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyColorRGBNameD(string path, double frameId, double rzkey, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyColorRGBNameD(lp_Path, frameId, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set animation key to a static color for the given frame if the existing + /// color is not already black. + /// + public static void SetKeyNonZeroColor(int animationId, int frameId, int rzkey, int color) + { + PluginSetKeyNonZeroColor(animationId, frameId, rzkey, color); + } + /// + /// Set animation key to a static color for the given frame if the existing + /// color is not already black. + /// + public static void SetKeyNonZeroColorName(string path, int frameId, int rzkey, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyNonZeroColorName(lp_Path, frameId, rzkey, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyNonZeroColorNameD(string path, double frameId, double rzkey, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyNonZeroColorNameD(lp_Path, frameId, rzkey, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set the key to the specified key color for the specified frame where color + /// is not black. Animation is referenced by id. + /// + public static void SetKeyNonZeroColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue) + { + PluginSetKeyNonZeroColorRGB(animationId, frameId, rzkey, red, green, blue); + } + /// + /// Set the key to the specified key color for the specified frame where color + /// is not black. Animation is referenced by name. + /// + public static void SetKeyNonZeroColorRGBName(string path, int frameId, int rzkey, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyNonZeroColorRGBName(lp_Path, frameId, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyNonZeroColorRGBNameD(string path, double frameId, double rzkey, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyNonZeroColorRGBNameD(lp_Path, frameId, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set animation key by row and column to a static color for the given frame. + /// + /// + public static void SetKeyRowColumnColorName(string path, int frameId, int row, int column, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyRowColumnColorName(lp_Path, frameId, row, column, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame. Animation + /// is referenced by id. + /// + public static void SetKeysColor(int animationId, int frameId, int[] rzkeys, int keyCount, int color) + { + PluginSetKeysColor(animationId, frameId, rzkeys, keyCount, color); + } + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by id. + /// + public static void SetKeysColorAllFrames(int animationId, int[] rzkeys, int keyCount, int color) + { + PluginSetKeysColorAllFrames(animationId, rzkeys, keyCount, color); + } + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by name. + /// + public static void SetKeysColorAllFramesName(string path, int[] rzkeys, int keyCount, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysColorAllFramesName(lp_Path, rzkeys, keyCount, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by id. + /// + public static void SetKeysColorAllFramesRGB(int animationId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + PluginSetKeysColorAllFramesRGB(animationId, rzkeys, keyCount, red, green, blue); + } + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by name. + /// + public static void SetKeysColorAllFramesRGBName(string path, int[] rzkeys, int keyCount, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysColorAllFramesRGBName(lp_Path, rzkeys, keyCount, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame. + /// + public static void SetKeysColorName(string path, int frameId, int[] rzkeys, int keyCount, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysColorName(lp_Path, frameId, rzkeys, keyCount, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame. Animation + /// is referenced by id. + /// + public static void SetKeysColorRGB(int animationId, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + PluginSetKeysColorRGB(animationId, frameId, rzkeys, keyCount, red, green, blue); + } + /// + /// Set an array of animation keys to a static color for the given frame. Animation + /// is referenced by name. + /// + public static void SetKeysColorRGBName(string path, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysColorRGBName(lp_Path, frameId, rzkeys, keyCount, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame if + /// the existing color is not already black. + /// + public static void SetKeysNonZeroColor(int animationId, int frameId, int[] rzkeys, int keyCount, int color) + { + PluginSetKeysNonZeroColor(animationId, frameId, rzkeys, keyCount, color); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is not black. Animation is referenced by id. + /// + public static void SetKeysNonZeroColorAllFrames(int animationId, int[] rzkeys, int keyCount, int color) + { + PluginSetKeysNonZeroColorAllFrames(animationId, rzkeys, keyCount, color); + } + /// + /// Set an array of animation keys to a static color for all frames if the existing + /// color is not already black. Reference animation by name. + /// + public static void SetKeysNonZeroColorAllFramesName(string path, int[] rzkeys, int keyCount, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysNonZeroColorAllFramesName(lp_Path, rzkeys, keyCount, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame if + /// the existing color is not already black. Reference animation by name. + /// + public static void SetKeysNonZeroColorName(string path, int frameId, int[] rzkeys, int keyCount, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysNonZeroColorName(lp_Path, frameId, rzkeys, keyCount, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is not black. Animation is referenced by id. + /// + public static void SetKeysNonZeroColorRGB(int animationId, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + PluginSetKeysNonZeroColorRGB(animationId, frameId, rzkeys, keyCount, red, green, blue); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is not black. Animation is referenced by name. + /// + public static void SetKeysNonZeroColorRGBName(string path, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysNonZeroColorRGBName(lp_Path, frameId, rzkeys, keyCount, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by id. + /// + public static void SetKeysZeroColor(int animationId, int frameId, int[] rzkeys, int keyCount, int color) + { + PluginSetKeysZeroColor(animationId, frameId, rzkeys, keyCount, color); + } + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by id. + /// + public static void SetKeysZeroColorAllFrames(int animationId, int[] rzkeys, int keyCount, int color) + { + PluginSetKeysZeroColorAllFrames(animationId, rzkeys, keyCount, color); + } + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by name. + /// + public static void SetKeysZeroColorAllFramesName(string path, int[] rzkeys, int keyCount, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysZeroColorAllFramesName(lp_Path, rzkeys, keyCount, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by id. + /// + public static void SetKeysZeroColorAllFramesRGB(int animationId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + PluginSetKeysZeroColorAllFramesRGB(animationId, rzkeys, keyCount, red, green, blue); + } + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by name. + /// + public static void SetKeysZeroColorAllFramesRGBName(string path, int[] rzkeys, int keyCount, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysZeroColorAllFramesRGBName(lp_Path, rzkeys, keyCount, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by name. + /// + public static void SetKeysZeroColorName(string path, int frameId, int[] rzkeys, int keyCount, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysZeroColorName(lp_Path, frameId, rzkeys, keyCount, color); + FreeIntPtr(lp_Path); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by id. + /// + public static void SetKeysZeroColorRGB(int animationId, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + PluginSetKeysZeroColorRGB(animationId, frameId, rzkeys, keyCount, red, green, blue); + } + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by name. + /// + public static void SetKeysZeroColorRGBName(string path, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeysZeroColorRGBName(lp_Path, frameId, rzkeys, keyCount, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by id. + /// + public static void SetKeyZeroColor(int animationId, int frameId, int rzkey, int color) + { + PluginSetKeyZeroColor(animationId, frameId, rzkey, color); + } + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by name. + /// + public static void SetKeyZeroColorName(string path, int frameId, int rzkey, int color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyZeroColorName(lp_Path, frameId, rzkey, color); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyZeroColorNameD(string path, double frameId, double rzkey, double color) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyZeroColorNameD(lp_Path, frameId, rzkey, color); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by id. + /// + public static void SetKeyZeroColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue) + { + PluginSetKeyZeroColorRGB(animationId, frameId, rzkey, red, green, blue); + } + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by name. + /// + public static void SetKeyZeroColorRGBName(string path, int frameId, int rzkey, int red, int green, int blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSetKeyZeroColorRGBName(lp_Path, frameId, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SetKeyZeroColorRGBNameD(string path, double frameId, double rzkey, double red, double green, double blue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSetKeyZeroColorRGBNameD(lp_Path, frameId, rzkey, red, green, blue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Invokes the setup for a debug logging callback so that `stdout` is redirected + /// to the callback. This is used by `Unity` so that debug messages can appear + /// in the console window. + /// + public static void SetLogDelegate(IntPtr fp) + { + PluginSetLogDelegate(fp); + } + /// + /// Sets the target device to the static color. + /// + public static void SetStaticColor(int deviceType, int device, int color) + { + PluginSetStaticColor(deviceType, device, color); + } + /// + /// Sets all devices to the static color. + /// + public static void SetStaticColorAll(int color) + { + PluginSetStaticColorAll(color); + } + /// + /// Sets the target device to the static color. + /// + public static void StaticColor(int deviceType, int device, int color) + { + PluginStaticColor(deviceType, device, color); + } + /// + /// Sets all devices to the static color. + /// + public static void StaticColorAll(int color) + { + PluginStaticColorAll(color); + } + /// + /// D suffix for limited data types. + /// + public static double StaticColorD(double deviceType, double device, double color) + { + double result = PluginStaticColorD(deviceType, device, color); + return result; + } + /// + /// `PluginStopAll` will automatically stop all animations that are playing. + /// + /// + public static void StopAll() + { + PluginStopAll(); + } + /// + /// Stops animation playback if in progress. Returns the animation id upon success. + /// Returns negative one upon failure. + /// + public static int StopAnimation(int animationId) + { + int result = PluginStopAnimation(animationId); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double StopAnimationD(double animationId) + { + double result = PluginStopAnimationD(animationId); + return result; + } + /// + /// `PluginStopAnimationName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The animation + /// will stop if playing. + /// + public static void StopAnimationName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginStopAnimationName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double StopAnimationNameD(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginStopAnimationNameD(lp_Path); + FreeIntPtr(lp_Path); + return result; + } + /// + /// `PluginStopAnimationType` automatically handles initializing the `ChromaSDK`. + /// If any animation is playing for the `deviceType` and `device` combination, + /// it will be stopped. + /// + public static void StopAnimationType(int deviceType, int device) + { + PluginStopAnimationType(deviceType, device); + } + /// + /// D suffix for limited data types. + /// + public static double StopAnimationTypeD(double deviceType, double device) + { + double result = PluginStopAnimationTypeD(deviceType, device); + return result; + } + /// + /// `PluginStopComposite` automatically handles initializing the `ChromaSDK`. + /// The named animation files for the `.chroma` set will be automatically opened. + /// The set of animations will be stopped if playing. + /// + public static void StopComposite(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + PluginStopComposite(lp_Name); + FreeIntPtr(lp_Name); + } + /// + /// D suffix for limited data types. + /// + public static double StopCompositeD(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + double result = PluginStopCompositeD(lp_Name); + FreeIntPtr(lp_Name); + return result; + } + /// + /// Return color1 - color2 + /// + public static int SubtractColor(int color1, int color2) + { + int result = PluginSubtractColor(color1, color2); + return result; + } + /// + /// Subtract the source color from the target color for the frame where the + /// target color is not black. Source and target are referenced by id. + /// + public static void SubtractNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId) + { + PluginSubtractNonZeroAllKeys(sourceAnimationId, targetAnimationId, frameId); + } + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black. Source and target are referenced by id. + /// + public static void SubtractNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginSubtractNonZeroAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black. Source and target are referenced by name. + /// + public static void SubtractNonZeroAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractNonZeroAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginSubtractNonZeroAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black starting at offset for the length of the source. + /// Source and target are referenced by id. + /// + public static void SubtractNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginSubtractNonZeroAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black starting at offset for the length of the source. + /// Source and target are referenced by name. + /// + public static void SubtractNonZeroAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractNonZeroAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginSubtractNonZeroAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Subtract the source color from the target color for the frame where the + /// target color is not black. Source and target are referenced by name. + /// + public static void SubtractNonZeroAllKeysName(string sourceAnimation, string targetAnimation, int frameId) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroAllKeysName(lp_SourceAnimation, lp_TargetAnimation, frameId); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// Subtract the source color from the target where color is not black for the + /// source frame and target offset frame, reference source and target by id. + /// + /// + public static void SubtractNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginSubtractNonZeroAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Subtract the source color from the target where color is not black for the + /// source frame and target offset frame, reference source and target by name. + /// + /// + public static void SubtractNonZeroAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractNonZeroAllKeysOffsetNameD(string sourceAnimation, string targetAnimation, double frameId, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginSubtractNonZeroAllKeysOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames. Reference source and target by id. + /// + public static void SubtractNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId) + { + PluginSubtractNonZeroTargetAllKeysAllFrames(sourceAnimationId, targetAnimationId); + } + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames. Reference source and target by name. + /// + public static void SubtractNonZeroTargetAllKeysAllFramesName(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroTargetAllKeysAllFramesName(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractNonZeroTargetAllKeysAllFramesNameD(string sourceAnimation, string targetAnimation) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginSubtractNonZeroTargetAllKeysAllFramesNameD(lp_SourceAnimation, lp_TargetAnimation); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames starting at the target offset for the length of + /// the source. Reference source and target by id. + /// + public static void SubtractNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset) + { + PluginSubtractNonZeroTargetAllKeysAllFramesOffset(sourceAnimationId, targetAnimationId, offset); + } + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames starting at the target offset for the length of + /// the source. Reference source and target by name. + /// + public static void SubtractNonZeroTargetAllKeysAllFramesOffsetName(string sourceAnimation, string targetAnimation, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroTargetAllKeysAllFramesOffsetName(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractNonZeroTargetAllKeysAllFramesOffsetNameD(string sourceAnimation, string targetAnimation, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginSubtractNonZeroTargetAllKeysAllFramesOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Subtract the source color from the target color where the target color is + /// not black from the source frame to the target offset frame. Reference source + /// and target by id. + /// + public static void SubtractNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset) + { + PluginSubtractNonZeroTargetAllKeysOffset(sourceAnimationId, targetAnimationId, frameId, offset); + } + /// + /// Subtract the source color from the target color where the target color is + /// not black from the source frame to the target offset frame. Reference source + /// and target by name. + /// + public static void SubtractNonZeroTargetAllKeysOffsetName(string sourceAnimation, string targetAnimation, int frameId, int offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + PluginSubtractNonZeroTargetAllKeysOffsetName(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractNonZeroTargetAllKeysOffsetNameD(string sourceAnimation, string targetAnimation, double frameId, double offset) + { + string str_SourceAnimation = sourceAnimation; + IntPtr lp_SourceAnimation = GetPathIntPtr(str_SourceAnimation); + string str_TargetAnimation = targetAnimation; + IntPtr lp_TargetAnimation = GetPathIntPtr(str_TargetAnimation); + double result = PluginSubtractNonZeroTargetAllKeysOffsetNameD(lp_SourceAnimation, lp_TargetAnimation, frameId, offset); + FreeIntPtr(lp_SourceAnimation); + FreeIntPtr(lp_TargetAnimation); + return result; + } + /// + /// Subtract all frames with the min RGB color where the animation color is + /// less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by id. + /// + public static void SubtractThresholdColorsMinMaxAllFramesRGB(int animationId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + PluginSubtractThresholdColorsMinMaxAllFramesRGB(animationId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + } + /// + /// Subtract all frames with the min RGB color where the animation color is + /// less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by name. + /// + public static void SubtractThresholdColorsMinMaxAllFramesRGBName(string path, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSubtractThresholdColorsMinMaxAllFramesRGBName(lp_Path, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractThresholdColorsMinMaxAllFramesRGBNameD(string path, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSubtractThresholdColorsMinMaxAllFramesRGBNameD(lp_Path, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Subtract the specified frame with the min RGB color where the animation + /// color is less than the min threshold AND with the max RGB color where the + /// animation is more than the max threshold. Animation is referenced by id. + /// + /// + public static void SubtractThresholdColorsMinMaxRGB(int animationId, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + PluginSubtractThresholdColorsMinMaxRGB(animationId, frameId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + } + /// + /// Subtract the specified frame with the min RGB color where the animation + /// color is less than the min threshold AND with the max RGB color where the + /// animation is more than the max threshold. Animation is referenced by name. + /// + /// + public static void SubtractThresholdColorsMinMaxRGBName(string path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginSubtractThresholdColorsMinMaxRGBName(lp_Path, frameId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double SubtractThresholdColorsMinMaxRGBNameD(string path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginSubtractThresholdColorsMinMaxRGBNameD(lp_Path, frameId, minThreshold, minRed, minGreen, minBlue, maxThreshold, maxRed, maxGreen, maxBlue); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Trim the end of the animation. The length of the animation will be the lastFrameId + /// plus one. Reference the animation by id. + /// + public static void TrimEndFrames(int animationId, int lastFrameId) + { + PluginTrimEndFrames(animationId, lastFrameId); + } + /// + /// Trim the end of the animation. The length of the animation will be the lastFrameId + /// plus one. Reference the animation by name. + /// + public static void TrimEndFramesName(string path, int lastFrameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginTrimEndFramesName(lp_Path, lastFrameId); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double TrimEndFramesNameD(string path, double lastFrameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginTrimEndFramesNameD(lp_Path, lastFrameId); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Remove the frame from the animation. Reference animation by id. + /// + public static void TrimFrame(int animationId, int frameId) + { + PluginTrimFrame(animationId, frameId); + } + /// + /// Remove the frame from the animation. Reference animation by name. + /// + public static void TrimFrameName(string path, int frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginTrimFrameName(lp_Path, frameId); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double TrimFrameNameD(string path, double frameId) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginTrimFrameNameD(lp_Path, frameId); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Trim the start of the animation starting at frame 0 for the number of frames. + /// Reference the animation by id. + /// + public static void TrimStartFrames(int animationId, int numberOfFrames) + { + PluginTrimStartFrames(animationId, numberOfFrames); + } + /// + /// Trim the start of the animation starting at frame 0 for the number of frames. + /// Reference the animation by name. + /// + public static void TrimStartFramesName(string path, int numberOfFrames) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginTrimStartFramesName(lp_Path, numberOfFrames); + FreeIntPtr(lp_Path); + } + /// + /// D suffix for limited data types. + /// + public static double TrimStartFramesNameD(string path, double numberOfFrames) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + double result = PluginTrimStartFramesNameD(lp_Path, numberOfFrames); + FreeIntPtr(lp_Path); + return result; + } + /// + /// Uninitializes the `ChromaSDK`. Returns 0 upon success. Returns negative + /// one upon failure. + /// + public static int Uninit() + { + int result = PluginUninit(); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double UninitD() + { + double result = PluginUninitD(); + return result; + } + /// + /// Unloads `Chroma` effects to free up resources. Returns the animation id + /// upon success. Returns negative one upon failure. Reference the animation + /// by id. + /// + public static int UnloadAnimation(int animationId) + { + int result = PluginUnloadAnimation(animationId); + return result; + } + /// + /// D suffix for limited data types. + /// + public static double UnloadAnimationD(double animationId) + { + double result = PluginUnloadAnimationD(animationId); + return result; + } + /// + /// Unload the animation effects. Reference the animation by name. + /// + public static void UnloadAnimationName(string path) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginUnloadAnimationName(lp_Path); + FreeIntPtr(lp_Path); + } + /// + /// Unload the the composite set of animation effects. Reference the animation + /// by name. + /// + public static void UnloadComposite(string name) + { + string str_Name = name; + IntPtr lp_Name = GetPathIntPtr(str_Name); + PluginUnloadComposite(lp_Name); + FreeIntPtr(lp_Name); + } + /// + /// Unload the Razer Chroma SDK Library before exiting the application. + /// + public static void UnloadLibrarySDK() + { + PluginUnloadLibrarySDK(); + } + /// + /// Unload the Razer Chroma Streaming Plugin Library before exiting the application. + /// + /// + public static void UnloadLibraryStreamingPlugin() + { + PluginUnloadLibraryStreamingPlugin(); + } + /// + /// Updates the `frameIndex` of the `Chroma` animation referenced by id and + /// sets the `duration` (in seconds). The `color` is expected to be an array + /// of the dimensions for the `deviceType/device`. The `length` parameter is + /// the size of the `color` array. For `EChromaSDKDevice1DEnum` the array size + /// should be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should + /// be `MAX ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// + /// + public static int UpdateFrame(int animationId, int frameIndex, float duration, int[] colors, int length, int[] keys, int keysLength) + { + int result = PluginUpdateFrame(animationId, frameIndex, duration, colors, length, keys, keysLength); + return result; + } + /// + /// Update the `frameIndex` of the `Chroma` animation referenced by name and + /// sets the `duration` (in seconds). The `color` is expected to be an array + /// of the dimensions for the `deviceType/device`. The `length` parameter is + /// the size of the `color` array. For `EChromaSDKDevice1DEnum` the array size + /// should be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should + /// be `MAX ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// + public static int UpdateFrameName(string path, int frameIndex, float duration, int[] colors, int length, int[] keys, int keysLength) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + int result = PluginUpdateFrameName(lp_Path, frameIndex, duration, colors, length, keys, keysLength); + FreeIntPtr(lp_Path); + return result; + } + /// + /// When the idle animation flag is true, when no other animations are playing, + /// the idle animation will be used. The idle animation will not be affected + /// by the API calls to PluginIsPlaying, PluginStopAnimationType, PluginGetPlayingAnimationId, + /// and PluginGetPlayingAnimationCount. Then the idle animation flag is false, + /// the idle animation is disabled. `Device` uses `EChromaSDKDeviceEnum` enums. + /// + /// + public static void UseIdleAnimation(int device, bool flag) + { + PluginUseIdleAnimation(device, flag); + } + /// + /// Set idle animation flag for all devices. + /// + public static void UseIdleAnimations(bool flag) + { + PluginUseIdleAnimations(flag); + } + /// + /// Set preloading animation flag, which is set to true by default. Reference + /// animation by id. + /// + public static void UsePreloading(int animationId, bool flag) + { + PluginUsePreloading(animationId, flag); + } + /// + /// Set preloading animation flag, which is set to true by default. Reference + /// animation by name. + /// + public static void UsePreloadingName(string path, bool flag) + { + string str_Path = path; + IntPtr lp_Path = GetPathIntPtr(str_Path); + PluginUsePreloadingName(lp_Path, flag); + FreeIntPtr(lp_Path); + } + #endregion + + #region Private DLL Hooks + /// + /// Return the sum of colors + /// EXPORT_API int PluginAddColor(const int color1, const int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginAddColor(int color1, int color2); + /// + /// Adds a frame to the `Chroma` animation and sets the `duration` (in seconds). + /// The `color` is expected to be an array of the dimensions for the `deviceType/device`. + /// The `length` parameter is the size of the `color` array. For `EChromaSDKDevice1DEnum` + /// the array size should be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array + /// size should be `MAX ROW` times `MAX COLUMN`. Returns the animation id upon + /// success. Returns negative one upon failure. + /// EXPORT_API int PluginAddFrame(int animationId, float duration, int* colors, int length); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginAddFrame(int animationId, float duration, int[] colors, int length); + /// + /// Add source color to target where color is not black for frame id, reference + /// source and target by id. + /// EXPORT_API void PluginAddNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Add source color to target where color is not black for all frames, reference + /// source and target by id. + /// EXPORT_API void PluginAddNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Add source color to target where color is not black for all frames, reference + /// source and target by name. + /// EXPORT_API void PluginAddNonZeroAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAddNonZeroAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAddNonZeroAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Add source color to target where color is not black for all frames starting + /// at offset for the length of the source, reference source and target by + /// id. + /// EXPORT_API void PluginAddNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Add source color to target where color is not black for all frames starting + /// at offset for the length of the source, reference source and target by + /// name. + /// EXPORT_API void PluginAddNonZeroAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAddNonZeroAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAddNonZeroAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Add source color to target where color is not black for frame id, reference + /// source and target by name. + /// EXPORT_API void PluginAddNonZeroAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// Add source color to target where color is not black for the source frame + /// and target offset frame, reference source and target by id. + /// EXPORT_API void PluginAddNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Add source color to target where color is not black for the source frame + /// and target offset frame, reference source and target by name. + /// EXPORT_API void PluginAddNonZeroAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAddNonZeroAllKeysOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAddNonZeroAllKeysOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double offset); + /// + /// Add source color to target where the target color is not black for all frames, + /// reference source and target by id. + /// EXPORT_API void PluginAddNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Add source color to target where the target color is not black for all frames, + /// reference source and target by name. + /// EXPORT_API void PluginAddNonZeroTargetAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroTargetAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAddNonZeroTargetAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAddNonZeroTargetAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Add source color to target where the target color is not black for all frames + /// starting at offset for the length of the source, reference source and target + /// by id. + /// EXPORT_API void PluginAddNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Add source color to target where the target color is not black for all frames + /// starting at offset for the length of the source, reference source and target + /// by name. + /// EXPORT_API void PluginAddNonZeroTargetAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroTargetAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAddNonZeroTargetAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAddNonZeroTargetAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Add source color to target where target color is not blank from the source + /// frame to the target offset frame, reference source and target by id. + /// EXPORT_API void PluginAddNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Add source color to target where target color is not blank from the source + /// frame to the target offset frame, reference source and target by name. + /// + /// EXPORT_API void PluginAddNonZeroTargetAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAddNonZeroTargetAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAddNonZeroTargetAllKeysOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAddNonZeroTargetAllKeysOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double offset); + /// + /// Append all source frames to the target animation, reference source and target + /// by id. + /// EXPORT_API void PluginAppendAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAppendAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Append all source frames to the target animation, reference source and target + /// by name. + /// EXPORT_API void PluginAppendAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginAppendAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginAppendAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginAppendAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// `PluginClearAll` will issue a `CLEAR` effect for all devices. + /// EXPORT_API void PluginClearAll(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginClearAll(); + /// + /// `PluginClearAnimationType` will issue a `CLEAR` effect for the given device. + /// + /// EXPORT_API void PluginClearAnimationType(int deviceType, int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginClearAnimationType(int deviceType, int device); + /// + /// `PluginCloseAll` closes all open animations so they can be reloaded from + /// disk. The set of animations will be stopped if playing. + /// EXPORT_API void PluginCloseAll(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCloseAll(); + /// + /// Closes the `Chroma` animation to free up resources referenced by id. Returns + /// the animation id upon success. Returns negative one upon failure. This + /// might be used while authoring effects if there was a change necessitating + /// re-opening the animation. The animation id can no longer be used once closed. + /// + /// EXPORT_API int PluginCloseAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCloseAnimation(int animationId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCloseAnimationD(double animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCloseAnimationD(double animationId); + /// + /// Closes the `Chroma` animation referenced by name so that the animation can + /// be reloaded from disk. + /// EXPORT_API void PluginCloseAnimationName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCloseAnimationName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCloseAnimationNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCloseAnimationNameD(IntPtr path); + /// + /// `PluginCloseComposite` closes a set of animations so they can be reloaded + /// from disk. The set of animations will be stopped if playing. + /// EXPORT_API void PluginCloseComposite(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCloseComposite(IntPtr name); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCloseCompositeD(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCloseCompositeD(IntPtr name); + /// + /// Copy source animation to target animation for the given frame. Source and + /// target are referenced by id. + /// EXPORT_API void PluginCopyAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Copy source animation to target animation for the given frame. Source and + /// target are referenced by id. + /// EXPORT_API void PluginCopyAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// Copy animation to named target animation in memory. If target animation + /// exists, close first. Source is referenced by id. + /// EXPORT_API int PluginCopyAnimation(int sourceAnimationId, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCopyAnimation(int sourceAnimationId, IntPtr targetAnimation); + /// + /// Copy animation to named target animation in memory. If target animation + /// exists, close first. Source is referenced by name. + /// EXPORT_API void PluginCopyAnimationName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyAnimationName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyAnimationNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyAnimationNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Copy blue channel to other channels for all frames. Intensity range is 0.0 + /// to 1.0. Reference the animation by id. + /// EXPORT_API void PluginCopyBlueChannelAllFrames(int animationId, float redIntensity, float greenIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyBlueChannelAllFrames(int animationId, float redIntensity, float greenIntensity); + /// + /// Copy blue channel to other channels for all frames. Intensity range is 0.0 + /// to 1.0. Reference the animation by name. + /// EXPORT_API void PluginCopyBlueChannelAllFramesName(const char* path, float redIntensity, float greenIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyBlueChannelAllFramesName(IntPtr path, float redIntensity, float greenIntensity); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyBlueChannelAllFramesNameD(const char* path, double redIntensity, double greenIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyBlueChannelAllFramesNameD(IntPtr path, double redIntensity, double greenIntensity); + /// + /// Copy green channel to other channels for all frames. Intensity range is + /// 0.0 to 1.0. Reference the animation by id. + /// EXPORT_API void PluginCopyGreenChannelAllFrames(int animationId, float redIntensity, float blueIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyGreenChannelAllFrames(int animationId, float redIntensity, float blueIntensity); + /// + /// Copy green channel to other channels for all frames. Intensity range is + /// 0.0 to 1.0. Reference the animation by name. + /// EXPORT_API void PluginCopyGreenChannelAllFramesName(const char* path, float redIntensity, float blueIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyGreenChannelAllFramesName(IntPtr path, float redIntensity, float blueIntensity); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyGreenChannelAllFramesNameD(const char* path, double redIntensity, double blueIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyGreenChannelAllFramesNameD(IntPtr path, double redIntensity, double blueIntensity); + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame. Reference the source and target by id. + /// EXPORT_API void PluginCopyKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames. Reference the source and target by id. + /// EXPORT_API void PluginCopyKeyColorAllFrames(int sourceAnimationId, int targetAnimationId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeyColorAllFrames(int sourceAnimationId, int targetAnimationId, int rzkey); + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames. Reference the source and target by name. + /// EXPORT_API void PluginCopyKeyColorAllFramesName(const char* sourceAnimation, const char* targetAnimation, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeyColorAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation, int rzkey); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyKeyColorAllFramesNameD(const char* sourceAnimation, const char* targetAnimation, double rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyKeyColorAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double rzkey); + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames, starting at the offset for the length of the source animation. + /// Source and target are referenced by id. + /// EXPORT_API void PluginCopyKeyColorAllFramesOffset(int sourceAnimationId, int targetAnimationId, int rzkey, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeyColorAllFramesOffset(int sourceAnimationId, int targetAnimationId, int rzkey, int offset); + /// + /// Copy animation key color from the source animation to the target animation + /// for all frames, starting at the offset for the length of the source animation. + /// Source and target are referenced by name. + /// EXPORT_API void PluginCopyKeyColorAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int rzkey, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeyColorAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int rzkey, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyKeyColorAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double rzkey, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyKeyColorAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double rzkey, double offset); + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame. + /// EXPORT_API void PluginCopyKeyColorName(const char* sourceAnimation, const char* targetAnimation, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeyColorName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int rzkey); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyKeyColorNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyKeyColorNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double rzkey); + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for the given frame. Reference the source and target by + /// id. + /// EXPORT_API void PluginCopyKeysColor(int sourceAnimationId, int targetAnimationId, int frameId, const int* keys, int size); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeysColor(int sourceAnimationId, int targetAnimationId, int frameId, int[] keys, int size); + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for all frames. Reference the source and target by id. + /// + /// EXPORT_API void PluginCopyKeysColorAllFrames(int sourceAnimationId, int targetAnimationId, const int* keys, int size); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeysColorAllFrames(int sourceAnimationId, int targetAnimationId, int[] keys, int size); + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for all frames. Reference the source and target by name. + /// + /// EXPORT_API void PluginCopyKeysColorAllFramesName(const char* sourceAnimation, const char* targetAnimation, const int* keys, int size); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeysColorAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation, int[] keys, int size); + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation for the given frame. Reference the source and target by + /// name. + /// EXPORT_API void PluginCopyKeysColorName(const char* sourceAnimation, const char* targetAnimation, int frameId, const int* keys, int size); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeysColorName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int[] keys, int size); + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation from the source frame to the target frame. Reference the + /// source and target by id. + /// EXPORT_API void PluginCopyKeysColorOffset(int sourceAnimationId, int targetAnimationId, int sourceFrameId, int targetFrameId, const int* keys, int size); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeysColorOffset(int sourceAnimationId, int targetAnimationId, int sourceFrameId, int targetFrameId, int[] keys, int size); + /// + /// Copy animation color for a set of keys from the source animation to the + /// target animation from the source frame to the target frame. Reference the + /// source and target by name. + /// EXPORT_API void PluginCopyKeysColorOffsetName(const char* sourceAnimation, const char* targetAnimation, int sourceFrameId, int targetFrameId, const int* keys, int size); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyKeysColorOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int sourceFrameId, int targetFrameId, int[] keys, int size); + /// + /// Copy source animation to target animation for the given frame. Source and + /// target are referenced by id. + /// EXPORT_API void PluginCopyNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames. Reference source and target by id. + /// EXPORT_API void PluginCopyNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames. Reference source and target by name. + /// EXPORT_API void PluginCopyNonZeroAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames starting at the offset for the length of the source animation. The + /// source and target are referenced by id. + /// EXPORT_API void PluginCopyNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Copy nonzero colors from a source animation to a target animation for all + /// frames starting at the offset for the length of the source animation. The + /// source and target are referenced by name. + /// EXPORT_API void PluginCopyNonZeroAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Copy nonzero colors from source animation to target animation for the specified + /// frame. Source and target are referenced by id. + /// EXPORT_API void PluginCopyNonZeroAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroAllKeysNameD(const char* sourceAnimation, const char* targetAnimation, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroAllKeysNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId); + /// + /// Copy nonzero colors from the source animation to the target animation from + /// the source frame to the target offset frame. Source and target are referenced + /// by id. + /// EXPORT_API void PluginCopyNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Copy nonzero colors from the source animation to the target animation from + /// the source frame to the target offset frame. Source and target are referenced + /// by name. + /// EXPORT_API void PluginCopyNonZeroAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroAllKeysOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroAllKeysOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double offset); + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame where color is not zero. + /// EXPORT_API void PluginCopyNonZeroKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); + /// + /// Copy animation key color from the source animation to the target animation + /// for the given frame where color is not zero. + /// EXPORT_API void PluginCopyNonZeroKeyColorName(const char* sourceAnimation, const char* targetAnimation, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroKeyColorName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int rzkey); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroKeyColorNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroKeyColorNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double rzkey); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified frame. Source and target + /// are referenced by id. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames. Source and target are referenced + /// by id. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames. Source and target are referenced + /// by name. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroTargetAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroTargetAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames. Source and target are referenced + /// by name. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for all frames starting at the target offset + /// for the length of the source animation. Source and target animations are + /// referenced by name. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroTargetAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroTargetAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified frame. The source and target + /// are referenced by name. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroTargetAllKeysNameD(const char* sourceAnimation, const char* targetAnimation, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroTargetAllKeysNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified source frame and target offset + /// frame. The source and target are referenced by id. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is nonzero for the specified source frame and target offset + /// frame. The source and target are referenced by name. + /// EXPORT_API void PluginCopyNonZeroTargetAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroTargetAllKeysOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroTargetAllKeysOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double offset); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is zero for all frames. Source and target are referenced + /// by id. + /// EXPORT_API void PluginCopyNonZeroTargetZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Copy nonzero colors from the source animation to the target animation where + /// the target color is zero for all frames. Source and target are referenced + /// by name. + /// EXPORT_API void PluginCopyNonZeroTargetZeroAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyNonZeroTargetZeroAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyNonZeroTargetZeroAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyNonZeroTargetZeroAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Copy red channel to other channels for all frames. Intensity range is 0.0 + /// to 1.0. Reference the animation by id. + /// EXPORT_API void PluginCopyRedChannelAllFrames(int animationId, float greenIntensity, float blueIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyRedChannelAllFrames(int animationId, float greenIntensity, float blueIntensity); + /// + /// Copy green channel to other channels for all frames. Intensity range is + /// 0.0 to 1.0. Reference the animation by name. + /// EXPORT_API void PluginCopyRedChannelAllFramesName(const char* path, float greenIntensity, float blueIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyRedChannelAllFramesName(IntPtr path, float greenIntensity, float blueIntensity); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyRedChannelAllFramesNameD(const char* path, double greenIntensity, double blueIntensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyRedChannelAllFramesNameD(IntPtr path, double greenIntensity, double blueIntensity); + /// + /// Copy zero colors from source animation to target animation for the frame. + /// Source and target are referenced by id. + /// EXPORT_API void PluginCopyZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Copy zero colors from source animation to target animation for all frames. + /// Source and target are referenced by id. + /// EXPORT_API void PluginCopyZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Copy zero colors from source animation to target animation for all frames. + /// Source and target are referenced by name. + /// EXPORT_API void PluginCopyZeroAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyZeroAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyZeroAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Copy zero colors from source animation to target animation for all frames + /// starting at the target offset for the length of the source animation. Source + /// and target are referenced by id. + /// EXPORT_API void PluginCopyZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Copy zero colors from source animation to target animation for all frames + /// starting at the target offset for the length of the source animation. Source + /// and target are referenced by name. + /// EXPORT_API void PluginCopyZeroAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyZeroAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyZeroAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Copy zero colors from source animation to target animation for the frame. + /// Source and target are referenced by name. + /// EXPORT_API void PluginCopyZeroAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// Copy zero colors from source animation to target animation for the frame + /// id starting at the target offset for the length of the source animation. + /// Source and target are referenced by id. + /// EXPORT_API void PluginCopyZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Copy zero colors from source animation to target animation for the frame + /// id starting at the target offset for the length of the source animation. + /// Source and target are referenced by name. + /// EXPORT_API void PluginCopyZeroAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// Copy zero key color from source animation to target animation for the specified + /// frame. Source and target are referenced by id. + /// EXPORT_API void PluginCopyZeroKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroKeyColor(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); + /// + /// Copy zero key color from source animation to target animation for the specified + /// frame. Source and target are referenced by name. + /// EXPORT_API void PluginCopyZeroKeyColorName(const char* sourceAnimation, const char* targetAnimation, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroKeyColorName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int rzkey); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyZeroKeyColorNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyZeroKeyColorNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double rzkey); + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for the frame. Source and target are referenced by id. + /// EXPORT_API void PluginCopyZeroTargetAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroTargetAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for all frames. Source and target are referenced by id. + /// EXPORT_API void PluginCopyZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for all frames. Source and target are referenced by name. + /// EXPORT_API void PluginCopyZeroTargetAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroTargetAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginCopyZeroTargetAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginCopyZeroTargetAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Copy nonzero color from source animation to target animation where target + /// is zero for the frame. Source and target are referenced by name. + /// EXPORT_API void PluginCopyZeroTargetAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCopyZeroTargetAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateChromaLinkEffect(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateChromaLinkEffect(int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateEffect(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateEffect(Guid deviceId, int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateHeadsetEffect(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateHeadsetEffect(int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateKeyboardEffect(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateKeyboardEffect(int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateKeypadEffect(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateKeypadEffect(int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateMouseEffect(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateMouseEffect(int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreCreateMousepadEffect(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreCreateMousepadEffect(int effect, IntPtr pParam, out Guid pEffectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreDeleteEffect(RZEFFECTID EffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreDeleteEffect(Guid effectId); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreInit(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreInit(); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreInitSDK(ChromaSDK::APPINFOTYPE* AppInfo); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreInitSDK(ref ChromaSDK.APPINFOTYPE appInfo); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreQueryDevice(RZDEVICEID DeviceId, ChromaSDK::DEVICE_INFO_TYPE& DeviceInfo); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreQueryDevice(Guid deviceId, out DEVICE_INFO_TYPE deviceInfo); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreSetEffect(RZEFFECTID EffectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreSetEffect(Guid effectId); + /// + /// Begin broadcasting Chroma RGB data using the stored stream key as the endpoint. + /// Intended for Cloud Gaming Platforms, restore the streaming key when the + /// game instance is launched to continue streaming. streamId is a null terminated + /// string streamKey is a null terminated string StreamGetStatus() should return + /// the READY status to use this method. + /// EXPORT_API bool PluginCoreStreamBroadcast(const char* streamId, const char* streamKey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamBroadcast(IntPtr streamId, IntPtr streamKey); + /// + /// End broadcasting Chroma RGB data. StreamGetStatus() should return the BROADCASTING + /// status to use this method. + /// EXPORT_API bool PluginCoreStreamBroadcastEnd(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamBroadcastEnd(); + /// + /// shortcode: Pass the address of a preallocated character buffer to get the + /// streaming auth code. The buffer should have a minimum length of 6. length: + /// Length will return as zero if the streaming auth code could not be obtained. + /// If length is greater than zero, it will be the length of the returned streaming + /// auth code. Once you have the shortcode, it should be shown to the user + /// so they can associate the stream with their Razer ID StreamGetStatus() + /// should return the READY status before invoking this method. platform: is + /// the null terminated string that identifies the source of the stream: { + /// GEFORCE_NOW, LUNA, STADIA, GAME_PASS } title: is the null terminated string + /// that identifies the application or game. + /// EXPORT_API void PluginCoreStreamGetAuthShortcode(char* shortcode, unsigned char* length, const wchar_t* platform, const wchar_t* title); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCoreStreamGetAuthShortcode(IntPtr shortcode, out byte length, IntPtr platform, IntPtr title); + /// + /// focus: Pass the address of a preallocated character buffer to get the stream + /// focus. The buffer should have a length of 48 length: Length will return + /// as zero if the stream focus could not be obtained. If length is greater + /// than zero, it will be the length of the returned stream focus. + /// EXPORT_API bool PluginCoreStreamGetFocus(char* focus, unsigned char* length); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamGetFocus(IntPtr focus, out byte length); + /// + /// Intended for Cloud Gaming Platforms, store the stream id to persist in user + /// preferences to continue streaming if the game is suspended or closed. shortcode: + /// The shortcode is a null terminated string. Use the shortcode that authorized + /// the stream to obtain the stream id. streamId should be a preallocated buffer + /// to get the stream key. The buffer should have a length of 48. length: Length + /// will return zero if the key could not be obtained. If the length is greater + /// than zero, it will be the length of the returned streaming id. Retrieve + /// the stream id after authorizing the shortcode. The authorization window + /// will expire in 5 minutes. Be sure to save the stream key before the window + /// expires. StreamGetStatus() should return the READY status to use this method. + /// + /// EXPORT_API void PluginCoreStreamGetId(const char* shortcode, char* streamId, unsigned char* length); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCoreStreamGetId(IntPtr shortcode, IntPtr streamId, out byte length); + /// + /// Intended for Cloud Gaming Platforms, store the streaming key to persist + /// in user preferences to continue streaming if the game is suspended or closed. + /// shortcode: The shortcode is a null terminated string. Use the shortcode + /// that authorized the stream to obtain the stream key. If the status is in + /// the BROADCASTING or WATCHING state, passing a NULL shortcode will return + /// the active streamId. streamKey should be a preallocated buffer to get the + /// stream key. The buffer should have a length of 48. length: Length will + /// return zero if the key could not be obtained. If the length is greater + /// than zero, it will be the length of the returned streaming key. Retrieve + /// the stream key after authorizing the shortcode. The authorization window + /// will expire in 5 minutes. Be sure to save the stream key before the window + /// expires. StreamGetStatus() should return the READY status to use this method. + /// + /// EXPORT_API void PluginCoreStreamGetKey(const char* shortcode, char* streamKey, unsigned char* length); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginCoreStreamGetKey(IntPtr shortcode, IntPtr streamKey, out byte length); + /// + /// Returns StreamStatus, the current status of the service + /// EXPORT_API ChromaSDK::Stream::StreamStatusType PluginCoreStreamGetStatus(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern ChromaSDK.Stream.StreamStatusType PluginCoreStreamGetStatus(); + /// + /// Convert StreamStatusType to a printable string + /// EXPORT_API const char* PluginCoreStreamGetStatusString(ChromaSDK::Stream::StreamStatusType status); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern IntPtr PluginCoreStreamGetStatusString(ChromaSDK.Stream.StreamStatusType status); + /// + /// This prevents the stream id and stream key from being obtained through the + /// shortcode. This closes the auth window. shortcode is a null terminated + /// string. StreamGetStatus() should return the READY status to use this method. + /// returns success when shortcode has been released + /// EXPORT_API bool PluginCoreStreamReleaseShortcode(const char* shortcode); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamReleaseShortcode(IntPtr shortcode); + /// + /// The focus is a null terminated string. Set the focus identifer for the application + /// designated to automatically change the streaming state. Returns true on + /// success. + /// EXPORT_API bool PluginCoreStreamSetFocus(const char* focus); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamSetFocus(IntPtr focus); + /// + /// Returns true if the Chroma streaming is supported. If false is returned, + /// avoid calling stream methods. + /// EXPORT_API bool PluginCoreStreamSupportsStreaming(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamSupportsStreaming(); + /// + /// Begin watching the Chroma RGB data using streamID parameter. streamId is + /// a null terminated string. StreamGetStatus() should return the READY status + /// to use this method. + /// EXPORT_API bool PluginCoreStreamWatch(const char* streamId, unsigned long long timestamp); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamWatch(IntPtr streamId, ulong timestamp); + /// + /// End watching Chroma RGB data stream. StreamGetStatus() should return the + /// WATCHING status to use this method. + /// EXPORT_API bool PluginCoreStreamWatchEnd(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginCoreStreamWatchEnd(); + /// + /// Direct access to low level API. + /// EXPORT_API RZRESULT PluginCoreUnInit(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCoreUnInit(); + /// + /// Creates a `Chroma` animation at the given path. The `deviceType` parameter + /// uses `EChromaSDKDeviceTypeEnum` as an integer. The `device` parameter uses + /// `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` as an integer, respective + /// to the `deviceType`. Returns the animation id upon success. Returns negative + /// one upon failure. Saves a `Chroma` animation file with the `.chroma` extension + /// at the given path. Returns the animation id upon success. Returns negative + /// one upon failure. + /// EXPORT_API int PluginCreateAnimation(const char* path, int deviceType, int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCreateAnimation(IntPtr path, int deviceType, int device); + /// + /// Creates a `Chroma` animation in memory without creating a file. The `deviceType` + /// parameter uses `EChromaSDKDeviceTypeEnum` as an integer. The `device` parameter + /// uses `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` as an integer, + /// respective to the `deviceType`. Returns the animation id upon success. + /// Returns negative one upon failure. Returns the animation id upon success. + /// Returns negative one upon failure. + /// EXPORT_API int PluginCreateAnimationInMemory(int deviceType, int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCreateAnimationInMemory(int deviceType, int device); + /// + /// Create a device specific effect. + /// EXPORT_API RZRESULT PluginCreateEffect(RZDEVICEID deviceId, ChromaSDK::EFFECT_TYPE effect, int* colors, int size, ChromaSDK::FChromaSDKGuid* effectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginCreateEffect(Guid deviceId, int effect, int[] colors, int size, out FChromaSDKGuid effectId); + /// + /// Delete an effect given the effect id. + /// EXPORT_API RZRESULT PluginDeleteEffect(const ChromaSDK::FChromaSDKGuid& effectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginDeleteEffect(Guid effectId); + /// + /// Duplicate the first animation frame so that the animation length matches + /// the frame count. Animation is referenced by id. + /// EXPORT_API void PluginDuplicateFirstFrame(int animationId, int frameCount); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginDuplicateFirstFrame(int animationId, int frameCount); + /// + /// Duplicate the first animation frame so that the animation length matches + /// the frame count. Animation is referenced by name. + /// EXPORT_API void PluginDuplicateFirstFrameName(const char* path, int frameCount); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginDuplicateFirstFrameName(IntPtr path, int frameCount); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginDuplicateFirstFrameNameD(const char* path, double frameCount); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginDuplicateFirstFrameNameD(IntPtr path, double frameCount); + /// + /// Duplicate all the frames of the animation to double the animation length. + /// Frame 1 becomes frame 1 and 2. Frame 2 becomes frame 3 and 4. And so on. + /// The animation is referenced by id. + /// EXPORT_API void PluginDuplicateFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginDuplicateFrames(int animationId); + /// + /// Duplicate all the frames of the animation to double the animation length. + /// Frame 1 becomes frame 1 and 2. Frame 2 becomes frame 3 and 4. And so on. + /// The animation is referenced by name. + /// EXPORT_API void PluginDuplicateFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginDuplicateFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginDuplicateFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginDuplicateFramesNameD(IntPtr path); + /// + /// Duplicate all the animation frames in reverse so that the animation plays + /// forwards and backwards. Animation is referenced by id. + /// EXPORT_API void PluginDuplicateMirrorFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginDuplicateMirrorFrames(int animationId); + /// + /// Duplicate all the animation frames in reverse so that the animation plays + /// forwards and backwards. Animation is referenced by name. + /// EXPORT_API void PluginDuplicateMirrorFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginDuplicateMirrorFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginDuplicateMirrorFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginDuplicateMirrorFramesNameD(IntPtr path); + /// + /// Fade the animation to black starting at the fade frame index to the end + /// of the animation. Animation is referenced by id. + /// EXPORT_API void PluginFadeEndFrames(int animationId, int fade); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFadeEndFrames(int animationId, int fade); + /// + /// Fade the animation to black starting at the fade frame index to the end + /// of the animation. Animation is referenced by name. + /// EXPORT_API void PluginFadeEndFramesName(const char* path, int fade); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFadeEndFramesName(IntPtr path, int fade); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFadeEndFramesNameD(const char* path, double fade); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFadeEndFramesNameD(IntPtr path, double fade); + /// + /// Fade the animation from black to full color starting at 0 to the fade frame + /// index. Animation is referenced by id. + /// EXPORT_API void PluginFadeStartFrames(int animationId, int fade); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFadeStartFrames(int animationId, int fade); + /// + /// Fade the animation from black to full color starting at 0 to the fade frame + /// index. Animation is referenced by name. + /// EXPORT_API void PluginFadeStartFramesName(const char* path, int fade); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFadeStartFramesName(IntPtr path, int fade); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFadeStartFramesNameD(const char* path, double fade); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFadeStartFramesNameD(IntPtr path, double fade); + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by id. + /// EXPORT_API void PluginFillColor(int animationId, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColor(int animationId, int frameId, int color); + /// + /// Set the RGB value for all colors for all frames. Animation is referenced + /// by id. + /// EXPORT_API void PluginFillColorAllFrames(int animationId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorAllFrames(int animationId, int color); + /// + /// Set the RGB value for all colors for all frames. Animation is referenced + /// by name. + /// EXPORT_API void PluginFillColorAllFramesName(const char* path, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorAllFramesName(IntPtr path, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillColorAllFramesNameD(const char* path, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillColorAllFramesNameD(IntPtr path, double color); + /// + /// Set the RGB value for all colors for all frames. Use the range of 0 to 255 + /// for red, green, and blue parameters. Animation is referenced by id. + /// EXPORT_API void PluginFillColorAllFramesRGB(int animationId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorAllFramesRGB(int animationId, int red, int green, int blue); + /// + /// Set the RGB value for all colors for all frames. Use the range of 0 to 255 + /// for red, green, and blue parameters. Animation is referenced by name. + /// EXPORT_API void PluginFillColorAllFramesRGBName(const char* path, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorAllFramesRGBName(IntPtr path, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillColorAllFramesRGBNameD(const char* path, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillColorAllFramesRGBNameD(IntPtr path, double red, double green, double blue); + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by name. + /// EXPORT_API void PluginFillColorName(const char* path, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorName(IntPtr path, int frameId, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillColorNameD(const char* path, double frameId, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillColorNameD(IntPtr path, double frameId, double color); + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by id. + /// EXPORT_API void PluginFillColorRGB(int animationId, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorRGB(int animationId, int frameId, int red, int green, int blue); + /// + /// Set the RGB value for all colors in the specified frame. Animation is referenced + /// by name. + /// EXPORT_API void PluginFillColorRGBName(const char* path, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillColorRGBName(IntPtr path, int frameId, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillColorRGBNameD(const char* path, double frameId, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillColorRGBNameD(IntPtr path, double frameId, double red, double green, double blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Animation is referenced by id. + /// EXPORT_API void PluginFillNonZeroColor(int animationId, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColor(int animationId, int frameId, int color); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Animation is referenced by id. + /// EXPORT_API void PluginFillNonZeroColorAllFrames(int animationId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorAllFrames(int animationId, int color); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Animation is referenced by name. + /// EXPORT_API void PluginFillNonZeroColorAllFramesName(const char* path, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorAllFramesName(IntPtr path, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillNonZeroColorAllFramesNameD(const char* path, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillNonZeroColorAllFramesNameD(IntPtr path, double color); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by id. + /// EXPORT_API void PluginFillNonZeroColorAllFramesRGB(int animationId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorAllFramesRGB(int animationId, int red, int green, int blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors for all frames. + /// Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by name. + /// EXPORT_API void PluginFillNonZeroColorAllFramesRGBName(const char* path, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorAllFramesRGBName(IntPtr path, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillNonZeroColorAllFramesRGBNameD(const char* path, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillNonZeroColorAllFramesRGBNameD(IntPtr path, double red, double green, double blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Animation is referenced by name. + /// EXPORT_API void PluginFillNonZeroColorName(const char* path, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorName(IntPtr path, int frameId, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillNonZeroColorNameD(const char* path, double frameId, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillNonZeroColorNameD(IntPtr path, double frameId, double color); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by id. + /// EXPORT_API void PluginFillNonZeroColorRGB(int animationId, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorRGB(int animationId, int frameId, int red, int green, int blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Set the RGB value for a subset of colors in the specified + /// frame. Use the range of 0 to 255 for red, green, and blue parameters. Animation + /// is referenced by name. + /// EXPORT_API void PluginFillNonZeroColorRGBName(const char* path, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillNonZeroColorRGBName(IntPtr path, int frameId, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillNonZeroColorRGBNameD(const char* path, double frameId, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillNonZeroColorRGBNameD(IntPtr path, double frameId, double red, double green, double blue); + /// + /// Fill the frame with random RGB values for the given frame. Animation is + /// referenced by id. + /// EXPORT_API void PluginFillRandomColors(int animationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColors(int animationId, int frameId); + /// + /// Fill the frame with random RGB values for all frames. Animation is referenced + /// by id. + /// EXPORT_API void PluginFillRandomColorsAllFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsAllFrames(int animationId); + /// + /// Fill the frame with random RGB values for all frames. Animation is referenced + /// by name. + /// EXPORT_API void PluginFillRandomColorsAllFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsAllFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillRandomColorsAllFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillRandomColorsAllFramesNameD(IntPtr path); + /// + /// Fill the frame with random black and white values for the specified frame. + /// Animation is referenced by id. + /// EXPORT_API void PluginFillRandomColorsBlackAndWhite(int animationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsBlackAndWhite(int animationId, int frameId); + /// + /// Fill the frame with random black and white values for all frames. Animation + /// is referenced by id. + /// EXPORT_API void PluginFillRandomColorsBlackAndWhiteAllFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsBlackAndWhiteAllFrames(int animationId); + /// + /// Fill the frame with random black and white values for all frames. Animation + /// is referenced by name. + /// EXPORT_API void PluginFillRandomColorsBlackAndWhiteAllFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsBlackAndWhiteAllFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillRandomColorsBlackAndWhiteAllFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillRandomColorsBlackAndWhiteAllFramesNameD(IntPtr path); + /// + /// Fill the frame with random black and white values for the specified frame. + /// Animation is referenced by name. + /// EXPORT_API void PluginFillRandomColorsBlackAndWhiteName(const char* path, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsBlackAndWhiteName(IntPtr path, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillRandomColorsBlackAndWhiteNameD(const char* path, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillRandomColorsBlackAndWhiteNameD(IntPtr path, double frameId); + /// + /// Fill the frame with random RGB values for the given frame. Animation is + /// referenced by name. + /// EXPORT_API void PluginFillRandomColorsName(const char* path, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillRandomColorsName(IntPtr path, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillRandomColorsNameD(const char* path, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillRandomColorsNameD(IntPtr path, double frameId); + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdColors(int animationId, int frameId, int threshold, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColors(int animationId, int frameId, int threshold, int color); + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdColorsAllFrames(int animationId, int threshold, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsAllFrames(int animationId, int threshold, int color); + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdColorsAllFramesName(const char* path, int threshold, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsAllFramesName(IntPtr path, int threshold, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdColorsAllFramesNameD(const char* path, double threshold, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdColorsAllFramesNameD(IntPtr path, double threshold, double color); + /// + /// Fill all frames with RGB color where the animation color is less than the + /// threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdColorsAllFramesRGB(int animationId, int threshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsAllFramesRGB(int animationId, int threshold, int red, int green, int blue); + /// + /// Fill all frames with RGB color where the animation color is less than the + /// threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdColorsAllFramesRGBName(const char* path, int threshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsAllFramesRGBName(IntPtr path, int threshold, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdColorsAllFramesRGBNameD(const char* path, double threshold, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdColorsAllFramesRGBNameD(IntPtr path, double threshold, double red, double green, double blue); + /// + /// Fill all frames with the min RGB color where the animation color is less + /// than the min threshold AND with the max RGB color where the animation is + /// more than the max threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdColorsMinMaxAllFramesRGB(int animationId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsMinMaxAllFramesRGB(int animationId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// Fill all frames with the min RGB color where the animation color is less + /// than the min threshold AND with the max RGB color where the animation is + /// more than the max threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdColorsMinMaxAllFramesRGBName(const char* path, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsMinMaxAllFramesRGBName(IntPtr path, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdColorsMinMaxAllFramesRGBNameD(const char* path, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdColorsMinMaxAllFramesRGBNameD(IntPtr path, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue); + /// + /// Fill the specified frame with the min RGB color where the animation color + /// is less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdColorsMinMaxRGB(int animationId, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsMinMaxRGB(int animationId, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// Fill the specified frame with the min RGB color where the animation color + /// is less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdColorsMinMaxRGBName(const char* path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsMinMaxRGBName(IntPtr path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdColorsMinMaxRGBNameD(const char* path, double frameId, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdColorsMinMaxRGBNameD(IntPtr path, double frameId, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue); + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdColorsName(const char* path, int frameId, int threshold, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsName(IntPtr path, int frameId, int threshold, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdColorsNameD(const char* path, double frameId, double threshold, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdColorsNameD(IntPtr path, double frameId, double threshold, double color); + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdColorsRGB(int animationId, int frameId, int threshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsRGB(int animationId, int frameId, int threshold, int red, int green, int blue); + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdColorsRGBName(const char* path, int frameId, int threshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdColorsRGBName(IntPtr path, int frameId, int threshold, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdColorsRGBNameD(const char* path, double frameId, double threshold, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdColorsRGBNameD(IntPtr path, double frameId, double threshold, double red, double green, double blue); + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdRGBColorsAllFramesRGB(int animationId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdRGBColorsAllFramesRGB(int animationId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + /// Fill all frames with RGB color where the animation color is less than the + /// RGB threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdRGBColorsAllFramesRGBName(const char* path, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdRGBColorsAllFramesRGBName(IntPtr path, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdRGBColorsAllFramesRGBNameD(const char* path, double redThreshold, double greenThreshold, double blueThreshold, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdRGBColorsAllFramesRGBNameD(IntPtr path, double redThreshold, double greenThreshold, double blueThreshold, double red, double green, double blue); + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by id. + /// EXPORT_API void PluginFillThresholdRGBColorsRGB(int animationId, int frameId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdRGBColorsRGB(int animationId, int frameId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + /// Fill the specified frame with RGB color where the animation color is less + /// than the RGB threshold. Animation is referenced by name. + /// EXPORT_API void PluginFillThresholdRGBColorsRGBName(const char* path, int frameId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillThresholdRGBColorsRGBName(IntPtr path, int frameId, int redThreshold, int greenThreshold, int blueThreshold, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillThresholdRGBColorsRGBNameD(const char* path, double frameId, double redThreshold, double greenThreshold, double blueThreshold, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillThresholdRGBColorsRGBNameD(IntPtr path, double frameId, double redThreshold, double greenThreshold, double blueThreshold, double red, double green, double blue); + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by id. + /// EXPORT_API void PluginFillZeroColor(int animationId, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColor(int animationId, int frameId, int color); + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by id. + /// EXPORT_API void PluginFillZeroColorAllFrames(int animationId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorAllFrames(int animationId, int color); + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by name. + /// EXPORT_API void PluginFillZeroColorAllFramesName(const char* path, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorAllFramesName(IntPtr path, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillZeroColorAllFramesNameD(const char* path, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillZeroColorAllFramesNameD(IntPtr path, double color); + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by id. + /// EXPORT_API void PluginFillZeroColorAllFramesRGB(int animationId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorAllFramesRGB(int animationId, int red, int green, int blue); + /// + /// Fill all frames with RGB color where the animation color is zero. Animation + /// is referenced by name. + /// EXPORT_API void PluginFillZeroColorAllFramesRGBName(const char* path, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorAllFramesRGBName(IntPtr path, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillZeroColorAllFramesRGBNameD(const char* path, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillZeroColorAllFramesRGBNameD(IntPtr path, double red, double green, double blue); + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by name. + /// EXPORT_API void PluginFillZeroColorName(const char* path, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorName(IntPtr path, int frameId, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillZeroColorNameD(const char* path, double frameId, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillZeroColorNameD(IntPtr path, double frameId, double color); + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by id. + /// EXPORT_API void PluginFillZeroColorRGB(int animationId, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorRGB(int animationId, int frameId, int red, int green, int blue); + /// + /// Fill the specified frame with RGB color where the animation color is zero. + /// Animation is referenced by name. + /// EXPORT_API void PluginFillZeroColorRGBName(const char* path, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginFillZeroColorRGBName(IntPtr path, int frameId, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginFillZeroColorRGBNameD(const char* path, double frameId, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginFillZeroColorRGBNameD(IntPtr path, double frameId, double red, double green, double blue); + /// + /// Get the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. Animation is + /// referenced by id. + /// EXPORT_API int PluginGet1DColor(int animationId, int frameId, int led); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGet1DColor(int animationId, int frameId, int led); + /// + /// Get the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. Animation is + /// referenced by name. + /// EXPORT_API int PluginGet1DColorName(const char* path, int frameId, int led); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGet1DColorName(IntPtr path, int frameId, int led); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGet1DColorNameD(const char* path, double frameId, double led); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGet1DColorNameD(IntPtr path, double frameId, double led); + /// + /// Get the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// Animation is referenced by id. + /// EXPORT_API int PluginGet2DColor(int animationId, int frameId, int row, int column); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGet2DColor(int animationId, int frameId, int row, int column); + /// + /// Get the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// Animation is referenced by name. + /// EXPORT_API int PluginGet2DColorName(const char* path, int frameId, int row, int column); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGet2DColorName(IntPtr path, int frameId, int row, int column); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGet2DColorNameD(const char* path, double frameId, double row, double column); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGet2DColorNameD(IntPtr path, double frameId, double row, double column); + /// + /// Get the animation id for the named animation. + /// EXPORT_API int PluginGetAnimation(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetAnimation(IntPtr name); + /// + /// `PluginGetAnimationCount` will return the number of loaded animations. + /// EXPORT_API int PluginGetAnimationCount(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetAnimationCount(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetAnimationD(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetAnimationD(IntPtr name); + /// + /// `PluginGetAnimationId` will return the `animationId` given the `index` of + /// the loaded animation. The `index` is zero-based and less than the number + /// returned by `PluginGetAnimationCount`. Use `PluginGetAnimationName` to + /// get the name of the animation. + /// EXPORT_API int PluginGetAnimationId(int index); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetAnimationId(int index); + /// + /// `PluginGetAnimationName` takes an `animationId` and returns the name of + /// the animation of the `.chroma` animation file. If a name is not available + /// then an empty string will be returned. + /// EXPORT_API const char* PluginGetAnimationName(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern IntPtr PluginGetAnimationName(int animationId); + /// + /// Get the current frame of the animation referenced by id. + /// EXPORT_API int PluginGetCurrentFrame(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetCurrentFrame(int animationId); + /// + /// Get the current frame of the animation referenced by name. + /// EXPORT_API int PluginGetCurrentFrameName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetCurrentFrameName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetCurrentFrameNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetCurrentFrameNameD(IntPtr path); + /// + /// Returns the `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` of a `Chroma` + /// animation respective to the `deviceType`, as an integer upon success. Returns + /// negative one upon failure. + /// EXPORT_API int PluginGetDevice(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetDevice(int animationId); + /// + /// Returns the `EChromaSDKDevice1DEnum` or `EChromaSDKDevice2DEnum` of a `Chroma` + /// animation respective to the `deviceType`, as an integer upon success. Returns + /// negative one upon failure. + /// EXPORT_API int PluginGetDeviceName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetDeviceName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetDeviceNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetDeviceNameD(IntPtr path); + /// + /// Returns the `EChromaSDKDeviceTypeEnum` of a `Chroma` animation as an integer + /// upon success. Returns negative one upon failure. + /// EXPORT_API int PluginGetDeviceType(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetDeviceType(int animationId); + /// + /// Returns the `EChromaSDKDeviceTypeEnum` of a `Chroma` animation as an integer + /// upon success. Returns negative one upon failure. + /// EXPORT_API int PluginGetDeviceTypeName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetDeviceTypeName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetDeviceTypeNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetDeviceTypeNameD(IntPtr path); + /// + /// Get the frame colors and duration (in seconds) for a `Chroma` animation + /// referenced by id. The `color` is expected to be an array of the expected + /// dimensions for the `deviceType/device`. The `length` parameter is the size + /// of the `color` array. For `EChromaSDKDevice1DEnum` the array size should + /// be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should be `MAX + /// ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// EXPORT_API int PluginGetFrame(int animationId, int frameIndex, float* duration, int* colors, int length, int* keys, int keysLength); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetFrame(int animationId, int frameIndex, out float duration, int[] colors, int length, int[] keys, int keysLength); + /// + /// Returns the frame count of a `Chroma` animation upon success. Returns negative + /// one upon failure. + /// EXPORT_API int PluginGetFrameCount(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetFrameCount(int animationId); + /// + /// Returns the frame count of a `Chroma` animation upon success. Returns negative + /// one upon failure. + /// EXPORT_API int PluginGetFrameCountName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetFrameCountName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetFrameCountNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetFrameCountNameD(IntPtr path); + /// + /// Get the frame colors and duration (in seconds) for a `Chroma` animation + /// referenced by name. The `color` is expected to be an array of the expected + /// dimensions for the `deviceType/device`. The `length` parameter is the size + /// of the `color` array. For `EChromaSDKDevice1DEnum` the array size should + /// be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should be `MAX + /// ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// EXPORT_API int PluginGetFrameName(const char* path, int frameIndex, float* duration, int* colors, int length, int* keys, int keysLength); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetFrameName(IntPtr path, int frameIndex, out float duration, int[] colors, int length, int[] keys, int keysLength); + /// + /// Get the color of an animation key for the given frame referenced by id. + /// + /// EXPORT_API int PluginGetKeyColor(int animationId, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetKeyColor(int animationId, int frameId, int rzkey); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetKeyColorD(const char* path, double frameId, double rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetKeyColorD(IntPtr path, double frameId, double rzkey); + /// + /// Get the color of an animation key for the given frame referenced by name. + /// + /// EXPORT_API int PluginGetKeyColorName(const char* path, int frameId, int rzkey); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetKeyColorName(IntPtr path, int frameId, int rzkey); + /// + /// Returns `RZRESULT_SUCCESS` if the plugin has been initialized successfully. + /// Returns `RZRESULT_DLL_NOT_FOUND` if core Chroma library is not found. Returns + /// `RZRESULT_DLL_INVALID_SIGNATURE` if core Chroma library has an invalid + /// signature. + /// EXPORT_API RZRESULT PluginGetLibraryLoadedState(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetLibraryLoadedState(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetLibraryLoadedStateD(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetLibraryLoadedStateD(); + /// + /// Returns the `MAX COLUMN` given the `EChromaSDKDevice2DEnum` device as an + /// integer upon success. Returns negative one upon failure. + /// EXPORT_API int PluginGetMaxColumn(int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetMaxColumn(int device); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetMaxColumnD(double device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetMaxColumnD(double device); + /// + /// Returns the MAX LEDS given the `EChromaSDKDevice1DEnum` device as an integer + /// upon success. Returns negative one upon failure. + /// EXPORT_API int PluginGetMaxLeds(int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetMaxLeds(int device); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetMaxLedsD(double device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetMaxLedsD(double device); + /// + /// Returns the `MAX ROW` given the `EChromaSDKDevice2DEnum` device as an integer + /// upon success. Returns negative one upon failure. + /// EXPORT_API int PluginGetMaxRow(int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetMaxRow(int device); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetMaxRowD(double device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetMaxRowD(double device); + /// + /// `PluginGetPlayingAnimationCount` will return the number of playing animations. + /// + /// EXPORT_API int PluginGetPlayingAnimationCount(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetPlayingAnimationCount(); + /// + /// `PluginGetPlayingAnimationId` will return the `animationId` given the `index` + /// of the playing animation. The `index` is zero-based and less than the number + /// returned by `PluginGetPlayingAnimationCount`. Use `PluginGetAnimationName` + /// to get the name of the animation. + /// EXPORT_API int PluginGetPlayingAnimationId(int index); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetPlayingAnimationId(int index); + /// + /// Get the RGB color given red, green, and blue. + /// EXPORT_API int PluginGetRGB(int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginGetRGB(int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginGetRGBD(double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginGetRGBD(double red, double green, double blue); + /// + /// Check if the animation has loop enabled referenced by id. + /// EXPORT_API bool PluginHasAnimationLoop(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginHasAnimationLoop(int animationId); + /// + /// Check if the animation has loop enabled referenced by name. + /// EXPORT_API bool PluginHasAnimationLoopName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginHasAnimationLoopName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginHasAnimationLoopNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginHasAnimationLoopNameD(IntPtr path); + /// + /// Initialize the ChromaSDK. Zero indicates success, otherwise failure. Many + /// API methods auto initialize the ChromaSDK if not already initialized. + /// EXPORT_API RZRESULT PluginInit(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginInit(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginInitD(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginInitD(); + /// + /// Initialize the ChromaSDK. AppInfo populates the details in Synapse. Zero + /// indicates success, otherwise failure. Many API methods auto initialize + /// the ChromaSDK if not already initialized. + /// EXPORT_API RZRESULT PluginInitSDK(ChromaSDK::APPINFOTYPE* AppInfo); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginInitSDK(ref ChromaSDK.APPINFOTYPE appInfo); + /// + /// Insert an animation delay by duplicating the frame by the delay number of + /// times. Animation is referenced by id. + /// EXPORT_API void PluginInsertDelay(int animationId, int frameId, int delay); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInsertDelay(int animationId, int frameId, int delay); + /// + /// Insert an animation delay by duplicating the frame by the delay number of + /// times. Animation is referenced by name. + /// EXPORT_API void PluginInsertDelayName(const char* path, int frameId, int delay); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInsertDelayName(IntPtr path, int frameId, int delay); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginInsertDelayNameD(const char* path, double frameId, double delay); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginInsertDelayNameD(IntPtr path, double frameId, double delay); + /// + /// Duplicate the source frame index at the target frame index. Animation is + /// referenced by id. + /// EXPORT_API void PluginInsertFrame(int animationId, int sourceFrame, int targetFrame); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInsertFrame(int animationId, int sourceFrame, int targetFrame); + /// + /// Duplicate the source frame index at the target frame index. Animation is + /// referenced by name. + /// EXPORT_API void PluginInsertFrameName(const char* path, int sourceFrame, int targetFrame); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInsertFrameName(IntPtr path, int sourceFrame, int targetFrame); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginInsertFrameNameD(const char* path, double sourceFrame, double targetFrame); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginInsertFrameNameD(IntPtr path, double sourceFrame, double targetFrame); + /// + /// Invert all the colors at the specified frame. Animation is referenced by + /// id. + /// EXPORT_API void PluginInvertColors(int animationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInvertColors(int animationId, int frameId); + /// + /// Invert all the colors for all frames. Animation is referenced by id. + /// EXPORT_API void PluginInvertColorsAllFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInvertColorsAllFrames(int animationId); + /// + /// Invert all the colors for all frames. Animation is referenced by name. + /// EXPORT_API void PluginInvertColorsAllFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInvertColorsAllFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginInvertColorsAllFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginInvertColorsAllFramesNameD(IntPtr path); + /// + /// Invert all the colors at the specified frame. Animation is referenced by + /// name. + /// EXPORT_API void PluginInvertColorsName(const char* path, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginInvertColorsName(IntPtr path, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginInvertColorsNameD(const char* path, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginInvertColorsNameD(IntPtr path, double frameId); + /// + /// Check if the animation is paused referenced by id. + /// EXPORT_API bool PluginIsAnimationPaused(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsAnimationPaused(int animationId); + /// + /// Check if the animation is paused referenced by name. + /// EXPORT_API bool PluginIsAnimationPausedName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsAnimationPausedName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsAnimationPausedNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsAnimationPausedNameD(IntPtr path); + /// + /// The editor dialog is a non-blocking modal window, this method returns true + /// if the modal window is open, otherwise false. + /// EXPORT_API bool PluginIsDialogOpen(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsDialogOpen(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsDialogOpenD(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsDialogOpenD(); + /// + /// Returns true if the plugin has been initialized. Returns false if the plugin + /// is uninitialized. + /// EXPORT_API bool PluginIsInitialized(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsInitialized(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsInitializedD(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsInitializedD(); + /// + /// If the method can be invoked the method returns true. + /// EXPORT_API bool PluginIsPlatformSupported(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsPlatformSupported(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsPlatformSupportedD(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsPlatformSupportedD(); + /// + /// `PluginIsPlayingName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The method + /// will return whether the animation is playing or not. Animation is referenced + /// by id. + /// EXPORT_API bool PluginIsPlaying(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsPlaying(int animationId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsPlayingD(double animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsPlayingD(double animationId); + /// + /// `PluginIsPlayingName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The method + /// will return whether the animation is playing or not. Animation is referenced + /// by name. + /// EXPORT_API bool PluginIsPlayingName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsPlayingName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsPlayingNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsPlayingNameD(IntPtr path); + /// + /// `PluginIsPlayingType` automatically handles initializing the `ChromaSDK`. + /// If any animation is playing for the `deviceType` and `device` combination, + /// the method will return true, otherwise false. + /// EXPORT_API bool PluginIsPlayingType(int deviceType, int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + private static extern bool PluginIsPlayingType(int deviceType, int device); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginIsPlayingTypeD(double deviceType, double device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginIsPlayingTypeD(double deviceType, double device); + /// + /// Do a lerp math operation on a float. + /// EXPORT_API float PluginLerp(float start, float end, float amt); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern float PluginLerp(float start, float end, float amt); + /// + /// Lerp from one color to another given t in the range 0.0 to 1.0. + /// EXPORT_API int PluginLerpColor(int from, int to, float t); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginLerpColor(int from, int to, float t); + /// + /// Loads `Chroma` effects so that the animation can be played immediately. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// EXPORT_API int PluginLoadAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginLoadAnimation(int animationId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginLoadAnimationD(double animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginLoadAnimationD(double animationId); + /// + /// Load the named animation. + /// EXPORT_API void PluginLoadAnimationName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginLoadAnimationName(IntPtr path); + /// + /// Load a composite set of animations. + /// EXPORT_API void PluginLoadComposite(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginLoadComposite(IntPtr name); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by id. + /// EXPORT_API void PluginMakeBlankFrames(int animationId, int frameCount, float duration, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFrames(int animationId, int frameCount, float duration, int color); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by name. + /// EXPORT_API void PluginMakeBlankFramesName(const char* path, int frameCount, float duration, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesName(IntPtr path, int frameCount, float duration, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMakeBlankFramesNameD(const char* path, double frameCount, double duration, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMakeBlankFramesNameD(IntPtr path, double frameCount, double duration, double color); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random. Animation is referenced + /// by id. + /// EXPORT_API void PluginMakeBlankFramesRandom(int animationId, int frameCount, float duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesRandom(int animationId, int frameCount, float duration); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random black and white. Animation + /// is referenced by id. + /// EXPORT_API void PluginMakeBlankFramesRandomBlackAndWhite(int animationId, int frameCount, float duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesRandomBlackAndWhite(int animationId, int frameCount, float duration); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random black and white. Animation + /// is referenced by name. + /// EXPORT_API void PluginMakeBlankFramesRandomBlackAndWhiteName(const char* path, int frameCount, float duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesRandomBlackAndWhiteName(IntPtr path, int frameCount, float duration); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMakeBlankFramesRandomBlackAndWhiteNameD(const char* path, double frameCount, double duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMakeBlankFramesRandomBlackAndWhiteNameD(IntPtr path, double frameCount, double duration); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color is random. Animation is referenced + /// by name. + /// EXPORT_API void PluginMakeBlankFramesRandomName(const char* path, int frameCount, float duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesRandomName(IntPtr path, int frameCount, float duration); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMakeBlankFramesRandomNameD(const char* path, double frameCount, double duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMakeBlankFramesRandomNameD(IntPtr path, double frameCount, double duration); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by id. + /// EXPORT_API void PluginMakeBlankFramesRGB(int animationId, int frameCount, float duration, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesRGB(int animationId, int frameCount, float duration, int red, int green, int blue); + /// + /// Make a blank animation for the length of the frame count. Frame duration + /// defaults to the duration. The frame color defaults to color. Animation + /// is referenced by name. + /// EXPORT_API void PluginMakeBlankFramesRGBName(const char* path, int frameCount, float duration, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMakeBlankFramesRGBName(IntPtr path, int frameCount, float duration, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMakeBlankFramesRGBNameD(const char* path, double frameCount, double duration, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMakeBlankFramesRGBNameD(IntPtr path, double frameCount, double duration, double red, double green, double blue); + /// + /// Flips the color grid horizontally for all `Chroma` animation frames. Returns + /// the animation id upon success. Returns negative one upon failure. + /// EXPORT_API int PluginMirrorHorizontally(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginMirrorHorizontally(int animationId); + /// + /// Flips the color grid vertically for all `Chroma` animation frames. This + /// method has no effect for `EChromaSDKDevice1DEnum` devices. Returns the + /// animation id upon success. Returns negative one upon failure. + /// EXPORT_API int PluginMirrorVertically(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginMirrorVertically(int animationId); + /// + /// Multiply the color intensity with the lerp result from color 1 to color + /// 2 using the frame index divided by the frame count for the `t` parameter. + /// Animation is referenced in id. + /// EXPORT_API void PluginMultiplyColorLerpAllFrames(int animationId, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyColorLerpAllFrames(int animationId, int color1, int color2); + /// + /// Multiply the color intensity with the lerp result from color 1 to color + /// 2 using the frame index divided by the frame count for the `t` parameter. + /// Animation is referenced in name. + /// EXPORT_API void PluginMultiplyColorLerpAllFramesName(const char* path, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyColorLerpAllFramesName(IntPtr path, int color1, int color2); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyColorLerpAllFramesNameD(const char* path, double color1, double color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyColorLerpAllFramesNameD(IntPtr path, double color1, double color2); + /// + /// Multiply all the colors in the frame by the intensity value. The valid the + /// intensity range is from 0.0 to 255.0. RGB components are multiplied equally. + /// An intensity of 0.5 would half the color value. Black colors in the frame + /// will not be affected by this method. + /// EXPORT_API void PluginMultiplyIntensity(int animationId, int frameId, float intensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensity(int animationId, int frameId, float intensity); + /// + /// Multiply all the colors for all frames by the intensity value. The valid + /// the intensity range is from 0.0 to 255.0. RGB components are multiplied + /// equally. An intensity of 0.5 would half the color value. Black colors in + /// the frame will not be affected by this method. + /// EXPORT_API void PluginMultiplyIntensityAllFrames(int animationId, float intensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityAllFrames(int animationId, float intensity); + /// + /// Multiply all the colors for all frames by the intensity value. The valid + /// the intensity range is from 0.0 to 255.0. RGB components are multiplied + /// equally. An intensity of 0.5 would half the color value. Black colors in + /// the frame will not be affected by this method. + /// EXPORT_API void PluginMultiplyIntensityAllFramesName(const char* path, float intensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityAllFramesName(IntPtr path, float intensity); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyIntensityAllFramesNameD(const char* path, double intensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyIntensityAllFramesNameD(IntPtr path, double intensity); + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by id. + /// EXPORT_API void PluginMultiplyIntensityAllFramesRGB(int animationId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityAllFramesRGB(int animationId, int red, int green, int blue); + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by name. + /// EXPORT_API void PluginMultiplyIntensityAllFramesRGBName(const char* path, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityAllFramesRGBName(IntPtr path, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyIntensityAllFramesRGBNameD(const char* path, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyIntensityAllFramesRGBNameD(IntPtr path, double red, double green, double blue); + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by id. + /// EXPORT_API void PluginMultiplyIntensityColor(int animationId, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityColor(int animationId, int frameId, int color); + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by id. + /// EXPORT_API void PluginMultiplyIntensityColorAllFrames(int animationId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityColorAllFrames(int animationId, int color); + /// + /// Multiply all frames by the RBG color intensity. Animation is referenced + /// by name. + /// EXPORT_API void PluginMultiplyIntensityColorAllFramesName(const char* path, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityColorAllFramesName(IntPtr path, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyIntensityColorAllFramesNameD(const char* path, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyIntensityColorAllFramesNameD(IntPtr path, double color); + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by name. + /// EXPORT_API void PluginMultiplyIntensityColorName(const char* path, int frameId, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityColorName(IntPtr path, int frameId, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyIntensityColorNameD(const char* path, double frameId, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyIntensityColorNameD(IntPtr path, double frameId, double color); + /// + /// Multiply all the colors in the frame by the intensity value. The valid the + /// intensity range is from 0.0 to 255.0. RGB components are multiplied equally. + /// An intensity of 0.5 would half the color value. Black colors in the frame + /// will not be affected by this method. + /// EXPORT_API void PluginMultiplyIntensityName(const char* path, int frameId, float intensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityName(IntPtr path, int frameId, float intensity); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyIntensityNameD(const char* path, double frameId, double intensity); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyIntensityNameD(IntPtr path, double frameId, double intensity); + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by id. + /// EXPORT_API void PluginMultiplyIntensityRGB(int animationId, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityRGB(int animationId, int frameId, int red, int green, int blue); + /// + /// Multiply the specific frame by the RBG color intensity. Animation is referenced + /// by name. + /// EXPORT_API void PluginMultiplyIntensityRGBName(const char* path, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyIntensityRGBName(IntPtr path, int frameId, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyIntensityRGBNameD(const char* path, double frameId, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyIntensityRGBNameD(IntPtr path, double frameId, double red, double green, double blue); + /// + /// Multiply the specific frame by the color lerp result between color 1 and + /// 2 using the frame color value as the `t` value. Animation is referenced + /// by id. + /// EXPORT_API void PluginMultiplyNonZeroTargetColorLerp(int animationId, int frameId, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyNonZeroTargetColorLerp(int animationId, int frameId, int color1, int color2); + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by id. + /// + /// EXPORT_API void PluginMultiplyNonZeroTargetColorLerpAllFrames(int animationId, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyNonZeroTargetColorLerpAllFrames(int animationId, int color1, int color2); + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by name. + /// + /// EXPORT_API void PluginMultiplyNonZeroTargetColorLerpAllFramesName(const char* path, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyNonZeroTargetColorLerpAllFramesName(IntPtr path, int color1, int color2); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyNonZeroTargetColorLerpAllFramesNameD(const char* path, double color1, double color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyNonZeroTargetColorLerpAllFramesNameD(IntPtr path, double color1, double color2); + /// + /// Multiply the specific frame by the color lerp result between RGB 1 and 2 + /// using the frame color value as the `t` value. Animation is referenced by + /// id. + /// EXPORT_API void PluginMultiplyNonZeroTargetColorLerpAllFramesRGB(int animationId, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyNonZeroTargetColorLerpAllFramesRGB(int animationId, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + /// Multiply the specific frame by the color lerp result between RGB 1 and 2 + /// using the frame color value as the `t` value. Animation is referenced by + /// name. + /// EXPORT_API void PluginMultiplyNonZeroTargetColorLerpAllFramesRGBName(const char* path, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyNonZeroTargetColorLerpAllFramesRGBName(IntPtr path, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyNonZeroTargetColorLerpAllFramesRGBNameD(const char* path, double red1, double green1, double blue1, double red2, double green2, double blue2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyNonZeroTargetColorLerpAllFramesRGBNameD(IntPtr path, double red1, double green1, double blue1, double red2, double green2, double blue2); + /// + /// Multiply the specific frame by the color lerp result between color 1 and + /// 2 using the frame color value as the `t` value. Animation is referenced + /// by id. + /// EXPORT_API void PluginMultiplyTargetColorLerp(int animationId, int frameId, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyTargetColorLerp(int animationId, int frameId, int color1, int color2); + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by id. + /// + /// EXPORT_API void PluginMultiplyTargetColorLerpAllFrames(int animationId, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyTargetColorLerpAllFrames(int animationId, int color1, int color2); + /// + /// Multiply all frames by the color lerp result between color 1 and 2 using + /// the frame color value as the `t` value. Animation is referenced by name. + /// + /// EXPORT_API void PluginMultiplyTargetColorLerpAllFramesName(const char* path, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyTargetColorLerpAllFramesName(IntPtr path, int color1, int color2); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyTargetColorLerpAllFramesNameD(const char* path, double color1, double color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyTargetColorLerpAllFramesNameD(IntPtr path, double color1, double color2); + /// + /// Multiply all frames by the color lerp result between RGB 1 and 2 using the + /// frame color value as the `t` value. Animation is referenced by id. + /// EXPORT_API void PluginMultiplyTargetColorLerpAllFramesRGB(int animationId, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyTargetColorLerpAllFramesRGB(int animationId, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + /// Multiply all frames by the color lerp result between RGB 1 and 2 using the + /// frame color value as the `t` value. Animation is referenced by name. + /// EXPORT_API void PluginMultiplyTargetColorLerpAllFramesRGBName(const char* path, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyTargetColorLerpAllFramesRGBName(IntPtr path, int red1, int green1, int blue1, int red2, int green2, int blue2); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginMultiplyTargetColorLerpAllFramesRGBNameD(const char* path, double red1, double green1, double blue1, double red2, double green2, double blue2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginMultiplyTargetColorLerpAllFramesRGBNameD(IntPtr path, double red1, double green1, double blue1, double red2, double green2, double blue2); + /// + /// Multiply the specific frame by the color lerp result between color 1 and + /// 2 using the frame color value as the `t` value. Animation is referenced + /// by name. + /// EXPORT_API void PluginMultiplyTargetColorLerpName(const char* path, int frameId, int color1, int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginMultiplyTargetColorLerpName(IntPtr path, int frameId, int color1, int color2); + /// + /// Offset all colors in the frame using the RGB offset. Use the range of -255 + /// to 255 for red, green, and blue parameters. Negative values remove color. + /// Positive values add color. + /// EXPORT_API void PluginOffsetColors(int animationId, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetColors(int animationId, int frameId, int red, int green, int blue); + /// + /// Offset all colors for all frames using the RGB offset. Use the range of + /// -255 to 255 for red, green, and blue parameters. Negative values remove + /// color. Positive values add color. + /// EXPORT_API void PluginOffsetColorsAllFrames(int animationId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetColorsAllFrames(int animationId, int red, int green, int blue); + /// + /// Offset all colors for all frames using the RGB offset. Use the range of + /// -255 to 255 for red, green, and blue parameters. Negative values remove + /// color. Positive values add color. + /// EXPORT_API void PluginOffsetColorsAllFramesName(const char* path, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetColorsAllFramesName(IntPtr path, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOffsetColorsAllFramesNameD(const char* path, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOffsetColorsAllFramesNameD(IntPtr path, double red, double green, double blue); + /// + /// Offset all colors in the frame using the RGB offset. Use the range of -255 + /// to 255 for red, green, and blue parameters. Negative values remove color. + /// Positive values add color. + /// EXPORT_API void PluginOffsetColorsName(const char* path, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetColorsName(IntPtr path, int frameId, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOffsetColorsNameD(const char* path, double frameId, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOffsetColorsNameD(IntPtr path, double frameId, double red, double green, double blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors in the frame using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// EXPORT_API void PluginOffsetNonZeroColors(int animationId, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetNonZeroColors(int animationId, int frameId, int red, int green, int blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors for all frames using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// EXPORT_API void PluginOffsetNonZeroColorsAllFrames(int animationId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetNonZeroColorsAllFrames(int animationId, int red, int green, int blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors for all frames using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// EXPORT_API void PluginOffsetNonZeroColorsAllFramesName(const char* path, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetNonZeroColorsAllFramesName(IntPtr path, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOffsetNonZeroColorsAllFramesNameD(const char* path, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOffsetNonZeroColorsAllFramesNameD(IntPtr path, double red, double green, double blue); + /// + /// This method will only update colors in the animation that are not already + /// set to black. Offset a subset of colors in the frame using the RGB offset. + /// Use the range of -255 to 255 for red, green, and blue parameters. Negative + /// values remove color. Positive values add color. + /// EXPORT_API void PluginOffsetNonZeroColorsName(const char* path, int frameId, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOffsetNonZeroColorsName(IntPtr path, int frameId, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOffsetNonZeroColorsNameD(const char* path, double frameId, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOffsetNonZeroColorsNameD(IntPtr path, double frameId, double red, double green, double blue); + /// + /// Opens a `Chroma` animation file so that it can be played. Returns an animation + /// id >= 0 upon success. Returns negative one if there was a failure. The + /// animation id is used in most of the API methods. + /// EXPORT_API int PluginOpenAnimation(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginOpenAnimation(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOpenAnimationD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOpenAnimationD(IntPtr path); + /// + /// Opens a `Chroma` animation data from memory so that it can be played. `Data` + /// is a pointer to BYTE array of the loaded animation in memory. `Name` will + /// be assigned to the animation when loaded. Returns an animation id >= 0 + /// upon success. Returns negative one if there was a failure. The animation + /// id is used in most of the API methods. + /// EXPORT_API int PluginOpenAnimationFromMemory(const BYTE* data, const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginOpenAnimationFromMemory(byte[] data, IntPtr name); + /// + /// Opens a `Chroma` animation file with the `.chroma` extension. Returns zero + /// upon success. Returns negative one if there was a failure. + /// EXPORT_API int PluginOpenEditorDialog(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginOpenEditorDialog(IntPtr path); + /// + /// Open the named animation in the editor dialog and play the animation at + /// start. + /// EXPORT_API int PluginOpenEditorDialogAndPlay(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginOpenEditorDialogAndPlay(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOpenEditorDialogAndPlayD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOpenEditorDialogAndPlayD(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOpenEditorDialogD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOpenEditorDialogD(IntPtr path); + /// + /// Sets the `duration` for all grames in the `Chroma` animation to the `duration` + /// parameter. Returns the animation id upon success. Returns negative one + /// upon failure. + /// EXPORT_API int PluginOverrideFrameDuration(int animationId, float duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginOverrideFrameDuration(int animationId, float duration); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginOverrideFrameDurationD(double animationId, double duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginOverrideFrameDurationD(double animationId, double duration); + /// + /// Override the duration of all frames with the `duration` value. Animation + /// is referenced by name. + /// EXPORT_API void PluginOverrideFrameDurationName(const char* path, float duration); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginOverrideFrameDurationName(IntPtr path, float duration); + /// + /// Pause the current animation referenced by id. + /// EXPORT_API void PluginPauseAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPauseAnimation(int animationId); + /// + /// Pause the current animation referenced by name. + /// EXPORT_API void PluginPauseAnimationName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPauseAnimationName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginPauseAnimationNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginPauseAnimationNameD(IntPtr path); + /// + /// Plays the `Chroma` animation. This will load the animation, if not loaded + /// previously. Returns the animation id upon success. Returns negative one + /// upon failure. + /// EXPORT_API int PluginPlayAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginPlayAnimation(int animationId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginPlayAnimationD(double animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginPlayAnimationD(double animationId); + /// + /// `PluginPlayAnimationFrame` automatically handles initializing the `ChromaSDK`. + /// The method will play the animation given the `animationId` with looping + /// `on` or `off` starting at the `frameId`. + /// EXPORT_API void PluginPlayAnimationFrame(int animationId, int frameId, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPlayAnimationFrame(int animationId, int frameId, bool loop); + /// + /// `PluginPlayAnimationFrameName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The animation + /// will play with looping `on` or `off` starting at the `frameId`. + /// EXPORT_API void PluginPlayAnimationFrameName(const char* path, int frameId, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPlayAnimationFrameName(IntPtr path, int frameId, bool loop); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginPlayAnimationFrameNameD(const char* path, double frameId, double loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginPlayAnimationFrameNameD(IntPtr path, double frameId, double loop); + /// + /// `PluginPlayAnimationLoop` automatically handles initializing the `ChromaSDK`. + /// The method will play the animation given the `animationId` with looping + /// `on` or `off`. + /// EXPORT_API void PluginPlayAnimationLoop(int animationId, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPlayAnimationLoop(int animationId, bool loop); + /// + /// `PluginPlayAnimationName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The animation + /// will play with looping `on` or `off`. + /// EXPORT_API void PluginPlayAnimationName(const char* path, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPlayAnimationName(IntPtr path, bool loop); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginPlayAnimationNameD(const char* path, double loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginPlayAnimationNameD(IntPtr path, double loop); + /// + /// `PluginPlayComposite` automatically handles initializing the `ChromaSDK`. + /// The named animation files for the `.chroma` set will be automatically opened. + /// The set of animations will play with looping `on` or `off`. + /// EXPORT_API void PluginPlayComposite(const char* name, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPlayComposite(IntPtr name, bool loop); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginPlayCompositeD(const char* name, double loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginPlayCompositeD(IntPtr name, double loop); + /// + /// Displays the `Chroma` animation frame on `Chroma` hardware given the `frameIndex`. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// EXPORT_API int PluginPreviewFrame(int animationId, int frameIndex); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginPreviewFrame(int animationId, int frameIndex); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginPreviewFrameD(double animationId, double frameIndex); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginPreviewFrameD(double animationId, double frameIndex); + /// + /// Displays the `Chroma` animation frame on `Chroma` hardware given the `frameIndex`. + /// Animaton is referenced by name. + /// EXPORT_API void PluginPreviewFrameName(const char* path, int frameIndex); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginPreviewFrameName(IntPtr path, int frameIndex); + /// + /// Reduce the frames of the animation by removing every nth element. Animation + /// is referenced by id. + /// EXPORT_API void PluginReduceFrames(int animationId, int n); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginReduceFrames(int animationId, int n); + /// + /// Reduce the frames of the animation by removing every nth element. Animation + /// is referenced by name. + /// EXPORT_API void PluginReduceFramesName(const char* path, int n); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginReduceFramesName(IntPtr path, int n); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginReduceFramesNameD(const char* path, double n); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginReduceFramesNameD(IntPtr path, double n); + /// + /// Resets the `Chroma` animation to 1 blank frame. Returns the animation id + /// upon success. Returns negative one upon failure. + /// EXPORT_API int PluginResetAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginResetAnimation(int animationId); + /// + /// Resume the animation with loop `ON` or `OFF` referenced by id. + /// EXPORT_API void PluginResumeAnimation(int animationId, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginResumeAnimation(int animationId, bool loop); + /// + /// Resume the animation with loop `ON` or `OFF` referenced by name. + /// EXPORT_API void PluginResumeAnimationName(const char* path, bool loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginResumeAnimationName(IntPtr path, bool loop); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginResumeAnimationNameD(const char* path, double loop); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginResumeAnimationNameD(IntPtr path, double loop); + /// + /// Reverse the animation frame order of the `Chroma` animation. Returns the + /// animation id upon success. Returns negative one upon failure. Animation + /// is referenced by id. + /// EXPORT_API int PluginReverse(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginReverse(int animationId); + /// + /// Reverse the animation frame order of the `Chroma` animation. Animation is + /// referenced by id. + /// EXPORT_API void PluginReverseAllFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginReverseAllFrames(int animationId); + /// + /// Reverse the animation frame order of the `Chroma` animation. Animation is + /// referenced by name. + /// EXPORT_API void PluginReverseAllFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginReverseAllFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginReverseAllFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginReverseAllFramesNameD(IntPtr path); + /// + /// Save the animation referenced by id to the path specified. + /// EXPORT_API int PluginSaveAnimation(int animationId, const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSaveAnimation(int animationId, IntPtr path); + /// + /// Save the named animation to the target path specified. + /// EXPORT_API int PluginSaveAnimationName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSaveAnimationName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Set the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. The animation + /// is referenced by id. + /// EXPORT_API void PluginSet1DColor(int animationId, int frameId, int led, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSet1DColor(int animationId, int frameId, int led, int color); + /// + /// Set the animation color for a frame given the `1D` `led`. The `led` should + /// be greater than or equal to 0 and less than the `MaxLeds`. The animation + /// is referenced by name. + /// EXPORT_API void PluginSet1DColorName(const char* path, int frameId, int led, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSet1DColorName(IntPtr path, int frameId, int led, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSet1DColorNameD(const char* path, double frameId, double led, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSet1DColorNameD(IntPtr path, double frameId, double led, double color); + /// + /// Set the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// The animation is referenced by id. + /// EXPORT_API void PluginSet2DColor(int animationId, int frameId, int row, int column, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSet2DColor(int animationId, int frameId, int row, int column, int color); + /// + /// Set the animation color for a frame given the `2D` `row` and `column`. The + /// `row` should be greater than or equal to 0 and less than the `MaxRow`. + /// The `column` should be greater than or equal to 0 and less than the `MaxColumn`. + /// The animation is referenced by name. + /// EXPORT_API void PluginSet2DColorName(const char* path, int frameId, int row, int column, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSet2DColorName(IntPtr path, int frameId, int row, int column, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSet2DColorNameD(const char* path, double frameId, double rowColumnIndex, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSet2DColorNameD(IntPtr path, double frameId, double rowColumnIndex, double color); + /// + /// When custom color is set, the custom key mode will be used. The animation + /// is referenced by id. + /// EXPORT_API void PluginSetChromaCustomColorAllFrames(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetChromaCustomColorAllFrames(int animationId); + /// + /// When custom color is set, the custom key mode will be used. The animation + /// is referenced by name. + /// EXPORT_API void PluginSetChromaCustomColorAllFramesName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetChromaCustomColorAllFramesName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetChromaCustomColorAllFramesNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetChromaCustomColorAllFramesNameD(IntPtr path); + /// + /// Set the Chroma custom key color flag on all frames. `True` changes the layout + /// from grid to key. `True` changes the layout from key to grid. Animation + /// is referenced by id. + /// EXPORT_API void PluginSetChromaCustomFlag(int animationId, bool flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetChromaCustomFlag(int animationId, bool flag); + /// + /// Set the Chroma custom key color flag on all frames. `True` changes the layout + /// from grid to key. `True` changes the layout from key to grid. Animation + /// is referenced by name. + /// EXPORT_API void PluginSetChromaCustomFlagName(const char* path, bool flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetChromaCustomFlagName(IntPtr path, bool flag); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetChromaCustomFlagNameD(const char* path, double flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetChromaCustomFlagNameD(IntPtr path, double flag); + /// + /// Set the current frame of the animation referenced by id. + /// EXPORT_API void PluginSetCurrentFrame(int animationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetCurrentFrame(int animationId, int frameId); + /// + /// Set the current frame of the animation referenced by name. + /// EXPORT_API void PluginSetCurrentFrameName(const char* path, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetCurrentFrameName(IntPtr path, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetCurrentFrameNameD(const char* path, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetCurrentFrameNameD(IntPtr path, double frameId); + /// + /// Set the custom alpha flag on the color array + /// EXPORT_API RZRESULT PluginSetCustomColorFlag2D(int device, int* colors); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSetCustomColorFlag2D(int device, int[] colors); + /// + /// Changes the `deviceType` and `device` of a `Chroma` animation. If the device + /// is changed, the `Chroma` animation will be reset with 1 blank frame. Returns + /// the animation id upon success. Returns negative one upon failure. + /// EXPORT_API int PluginSetDevice(int animationId, int deviceType, int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSetDevice(int animationId, int deviceType, int device); + /// + /// SetEffect will display the referenced effect id. + /// EXPORT_API RZRESULT PluginSetEffect(const ChromaSDK::FChromaSDKGuid& effectId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSetEffect(Guid effectId); + /// + /// SetEffectCustom1D will display the referenced colors immediately + /// EXPORT_API RZRESULT PluginSetEffectCustom1D(const int device, const int* colors); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSetEffectCustom1D(int device, int[] colors); + /// + /// SetEffectCustom2D will display the referenced colors immediately. + /// EXPORT_API RZRESULT PluginSetEffectCustom2D(const int device, const int* colors); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSetEffectCustom2D(int device, int[] colors); + /// + /// SetEffectKeyboardCustom2D will display the referenced custom keyboard colors + /// immediately. Colors represent a visual grid layout. Keys represent the + /// hotkeys for any layout. + /// EXPORT_API RZRESULT PluginSetEffectKeyboardCustom2D(const int device, const int* colors, const int* keys); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSetEffectKeyboardCustom2D(int device, int[] colors, int[] keys); + /// + /// When the idle animation is used, the named animation will play when no other + /// animations are playing. Reference the animation by id. + /// EXPORT_API void PluginSetIdleAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetIdleAnimation(int animationId); + /// + /// When the idle animation is used, the named animation will play when no other + /// animations are playing. Reference the animation by name. + /// EXPORT_API void PluginSetIdleAnimationName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetIdleAnimationName(IntPtr path); + /// + /// Set animation key to a static color for the given frame. + /// EXPORT_API void PluginSetKeyColor(int animationId, int frameId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColor(int animationId, int frameId, int rzkey, int color); + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by id. + /// EXPORT_API void PluginSetKeyColorAllFrames(int animationId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorAllFrames(int animationId, int rzkey, int color); + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by name. + /// EXPORT_API void PluginSetKeyColorAllFramesName(const char* path, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorAllFramesName(IntPtr path, int rzkey, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyColorAllFramesNameD(const char* path, double rzkey, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyColorAllFramesNameD(IntPtr path, double rzkey, double color); + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by id. + /// EXPORT_API void PluginSetKeyColorAllFramesRGB(int animationId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorAllFramesRGB(int animationId, int rzkey, int red, int green, int blue); + /// + /// Set the key to the specified key color for all frames. Animation is referenced + /// by name. + /// EXPORT_API void PluginSetKeyColorAllFramesRGBName(const char* path, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorAllFramesRGBName(IntPtr path, int rzkey, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyColorAllFramesRGBNameD(const char* path, double rzkey, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyColorAllFramesRGBNameD(IntPtr path, double rzkey, double red, double green, double blue); + /// + /// Set animation key to a static color for the given frame. + /// EXPORT_API void PluginSetKeyColorName(const char* path, int frameId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorName(IntPtr path, int frameId, int rzkey, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyColorNameD(const char* path, double frameId, double rzkey, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyColorNameD(IntPtr path, double frameId, double rzkey, double color); + /// + /// Set the key to the specified key color for the specified frame. Animation + /// is referenced by id. + /// EXPORT_API void PluginSetKeyColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue); + /// + /// Set the key to the specified key color for the specified frame. Animation + /// is referenced by name. + /// EXPORT_API void PluginSetKeyColorRGBName(const char* path, int frameId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyColorRGBName(IntPtr path, int frameId, int rzkey, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyColorRGBNameD(const char* path, double frameId, double rzkey, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyColorRGBNameD(IntPtr path, double frameId, double rzkey, double red, double green, double blue); + /// + /// Set animation key to a static color for the given frame if the existing + /// color is not already black. + /// EXPORT_API void PluginSetKeyNonZeroColor(int animationId, int frameId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyNonZeroColor(int animationId, int frameId, int rzkey, int color); + /// + /// Set animation key to a static color for the given frame if the existing + /// color is not already black. + /// EXPORT_API void PluginSetKeyNonZeroColorName(const char* path, int frameId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyNonZeroColorName(IntPtr path, int frameId, int rzkey, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyNonZeroColorNameD(const char* path, double frameId, double rzkey, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyNonZeroColorNameD(IntPtr path, double frameId, double rzkey, double color); + /// + /// Set the key to the specified key color for the specified frame where color + /// is not black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeyNonZeroColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyNonZeroColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue); + /// + /// Set the key to the specified key color for the specified frame where color + /// is not black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeyNonZeroColorRGBName(const char* path, int frameId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyNonZeroColorRGBName(IntPtr path, int frameId, int rzkey, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyNonZeroColorRGBNameD(const char* path, double frameId, double rzkey, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyNonZeroColorRGBNameD(IntPtr path, double frameId, double rzkey, double red, double green, double blue); + /// + /// Set animation key by row and column to a static color for the given frame. + /// + /// EXPORT_API void PluginSetKeyRowColumnColorName(const char* path, int frameId, int row, int column, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyRowColumnColorName(IntPtr path, int frameId, int row, int column, int color); + /// + /// Set an array of animation keys to a static color for the given frame. Animation + /// is referenced by id. + /// EXPORT_API void PluginSetKeysColor(int animationId, int frameId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColor(int animationId, int frameId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by id. + /// EXPORT_API void PluginSetKeysColorAllFrames(int animationId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorAllFrames(int animationId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by name. + /// EXPORT_API void PluginSetKeysColorAllFramesName(const char* path, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorAllFramesName(IntPtr path, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by id. + /// EXPORT_API void PluginSetKeysColorAllFramesRGB(int animationId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorAllFramesRGB(int animationId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for all frames. Animation + /// is referenced by name. + /// EXPORT_API void PluginSetKeysColorAllFramesRGBName(const char* path, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorAllFramesRGBName(IntPtr path, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame. + /// EXPORT_API void PluginSetKeysColorName(const char* path, int frameId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorName(IntPtr path, int frameId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for the given frame. Animation + /// is referenced by id. + /// EXPORT_API void PluginSetKeysColorRGB(int animationId, int frameId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorRGB(int animationId, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame. Animation + /// is referenced by name. + /// EXPORT_API void PluginSetKeysColorRGBName(const char* path, int frameId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysColorRGBName(IntPtr path, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame if + /// the existing color is not already black. + /// EXPORT_API void PluginSetKeysNonZeroColor(int animationId, int frameId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysNonZeroColor(int animationId, int frameId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is not black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeysNonZeroColorAllFrames(int animationId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysNonZeroColorAllFrames(int animationId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames if the existing + /// color is not already black. Reference animation by name. + /// EXPORT_API void PluginSetKeysNonZeroColorAllFramesName(const char* path, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysNonZeroColorAllFramesName(IntPtr path, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for the given frame if + /// the existing color is not already black. Reference animation by name. + /// EXPORT_API void PluginSetKeysNonZeroColorName(const char* path, int frameId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysNonZeroColorName(IntPtr path, int frameId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is not black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeysNonZeroColorRGB(int animationId, int frameId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysNonZeroColorRGB(int animationId, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is not black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeysNonZeroColorRGBName(const char* path, int frameId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysNonZeroColorRGBName(IntPtr path, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeysZeroColor(int animationId, int frameId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColor(int animationId, int frameId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeysZeroColorAllFrames(int animationId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorAllFrames(int animationId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeysZeroColorAllFramesName(const char* path, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorAllFramesName(IntPtr path, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeysZeroColorAllFramesRGB(int animationId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorAllFramesRGB(int animationId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for all frames where the + /// color is black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeysZeroColorAllFramesRGBName(const char* path, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorAllFramesRGBName(IntPtr path, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeysZeroColorName(const char* path, int frameId, const int* rzkeys, int keyCount, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorName(IntPtr path, int frameId, int[] rzkeys, int keyCount, int color); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeysZeroColorRGB(int animationId, int frameId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorRGB(int animationId, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set an array of animation keys to a static color for the given frame where + /// the color is black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeysZeroColorRGBName(const char* path, int frameId, const int* rzkeys, int keyCount, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeysZeroColorRGBName(IntPtr path, int frameId, int[] rzkeys, int keyCount, int red, int green, int blue); + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeyZeroColor(int animationId, int frameId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyZeroColor(int animationId, int frameId, int rzkey, int color); + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeyZeroColorName(const char* path, int frameId, int rzkey, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyZeroColorName(IntPtr path, int frameId, int rzkey, int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyZeroColorNameD(const char* path, double frameId, double rzkey, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyZeroColorNameD(IntPtr path, double frameId, double rzkey, double color); + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by id. + /// EXPORT_API void PluginSetKeyZeroColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyZeroColorRGB(int animationId, int frameId, int rzkey, int red, int green, int blue); + /// + /// Set animation key to a static color for the given frame where the color + /// is black. Animation is referenced by name. + /// EXPORT_API void PluginSetKeyZeroColorRGBName(const char* path, int frameId, int rzkey, int red, int green, int blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetKeyZeroColorRGBName(IntPtr path, int frameId, int rzkey, int red, int green, int blue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSetKeyZeroColorRGBNameD(const char* path, double frameId, double rzkey, double red, double green, double blue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSetKeyZeroColorRGBNameD(IntPtr path, double frameId, double rzkey, double red, double green, double blue); + /// + /// Invokes the setup for a debug logging callback so that `stdout` is redirected + /// to the callback. This is used by `Unity` so that debug messages can appear + /// in the console window. + /// EXPORT_API void PluginSetLogDelegate(DebugLogPtr fp); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetLogDelegate(IntPtr fp); + /// + /// Sets the target device to the static color. + /// EXPORT_API void PluginSetStaticColor(int deviceType, int device, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetStaticColor(int deviceType, int device, int color); + /// + /// Sets all devices to the static color. + /// EXPORT_API void PluginSetStaticColorAll(int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSetStaticColorAll(int color); + /// + /// Sets the target device to the static color. + /// EXPORT_API void PluginStaticColor(int deviceType, int device, int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginStaticColor(int deviceType, int device, int color); + /// + /// Sets all devices to the static color. + /// EXPORT_API void PluginStaticColorAll(int color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginStaticColorAll(int color); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginStaticColorD(double deviceType, double device, double color); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginStaticColorD(double deviceType, double device, double color); + /// + /// `PluginStopAll` will automatically stop all animations that are playing. + /// + /// EXPORT_API void PluginStopAll(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginStopAll(); + /// + /// Stops animation playback if in progress. Returns the animation id upon success. + /// Returns negative one upon failure. + /// EXPORT_API int PluginStopAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginStopAnimation(int animationId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginStopAnimationD(double animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginStopAnimationD(double animationId); + /// + /// `PluginStopAnimationName` automatically handles initializing the `ChromaSDK`. + /// The named `.chroma` animation file will be automatically opened. The animation + /// will stop if playing. + /// EXPORT_API void PluginStopAnimationName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginStopAnimationName(IntPtr path); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginStopAnimationNameD(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginStopAnimationNameD(IntPtr path); + /// + /// `PluginStopAnimationType` automatically handles initializing the `ChromaSDK`. + /// If any animation is playing for the `deviceType` and `device` combination, + /// it will be stopped. + /// EXPORT_API void PluginStopAnimationType(int deviceType, int device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginStopAnimationType(int deviceType, int device); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginStopAnimationTypeD(double deviceType, double device); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginStopAnimationTypeD(double deviceType, double device); + /// + /// `PluginStopComposite` automatically handles initializing the `ChromaSDK`. + /// The named animation files for the `.chroma` set will be automatically opened. + /// The set of animations will be stopped if playing. + /// EXPORT_API void PluginStopComposite(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginStopComposite(IntPtr name); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginStopCompositeD(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginStopCompositeD(IntPtr name); + /// + /// Return color1 - color2 + /// EXPORT_API int PluginSubtractColor(const int color1, const int color2); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginSubtractColor(int color1, int color2); + /// + /// Subtract the source color from the target color for the frame where the + /// target color is not black. Source and target are referenced by id. + /// EXPORT_API void PluginSubtractNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeys(int sourceAnimationId, int targetAnimationId, int frameId); + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black. Source and target are referenced by id. + /// EXPORT_API void PluginSubtractNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black. Source and target are referenced by name. + /// EXPORT_API void PluginSubtractNonZeroAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractNonZeroAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractNonZeroAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black starting at offset for the length of the source. + /// Source and target are referenced by id. + /// EXPORT_API void PluginSubtractNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Subtract the source color from the target color for all frames where the + /// target color is not black starting at offset for the length of the source. + /// Source and target are referenced by name. + /// EXPORT_API void PluginSubtractNonZeroAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractNonZeroAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractNonZeroAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Subtract the source color from the target color for the frame where the + /// target color is not black. Source and target are referenced by name. + /// EXPORT_API void PluginSubtractNonZeroAllKeysName(const char* sourceAnimation, const char* targetAnimation, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId); + /// + /// Subtract the source color from the target where color is not black for the + /// source frame and target offset frame, reference source and target by id. + /// + /// EXPORT_API void PluginSubtractNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Subtract the source color from the target where color is not black for the + /// source frame and target offset frame, reference source and target by name. + /// + /// EXPORT_API void PluginSubtractNonZeroAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractNonZeroAllKeysOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractNonZeroAllKeysOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double offset); + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames. Reference source and target by id. + /// EXPORT_API void PluginSubtractNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroTargetAllKeysAllFrames(int sourceAnimationId, int targetAnimationId); + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames. Reference source and target by name. + /// EXPORT_API void PluginSubtractNonZeroTargetAllKeysAllFramesName(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroTargetAllKeysAllFramesName(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractNonZeroTargetAllKeysAllFramesNameD(const char* sourceAnimation, const char* targetAnimation); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractNonZeroTargetAllKeysAllFramesNameD(IntPtr sourceAnimation, IntPtr targetAnimation); + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames starting at the target offset for the length of + /// the source. Reference source and target by id. + /// EXPORT_API void PluginSubtractNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroTargetAllKeysAllFramesOffset(int sourceAnimationId, int targetAnimationId, int offset); + /// + /// Subtract the source color from the target color where the target color is + /// not black for all frames starting at the target offset for the length of + /// the source. Reference source and target by name. + /// EXPORT_API void PluginSubtractNonZeroTargetAllKeysAllFramesOffsetName(const char* sourceAnimation, const char* targetAnimation, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroTargetAllKeysAllFramesOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractNonZeroTargetAllKeysAllFramesOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractNonZeroTargetAllKeysAllFramesOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double offset); + /// + /// Subtract the source color from the target color where the target color is + /// not black from the source frame to the target offset frame. Reference source + /// and target by id. + /// EXPORT_API void PluginSubtractNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroTargetAllKeysOffset(int sourceAnimationId, int targetAnimationId, int frameId, int offset); + /// + /// Subtract the source color from the target color where the target color is + /// not black from the source frame to the target offset frame. Reference source + /// and target by name. + /// EXPORT_API void PluginSubtractNonZeroTargetAllKeysOffsetName(const char* sourceAnimation, const char* targetAnimation, int frameId, int offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractNonZeroTargetAllKeysOffsetName(IntPtr sourceAnimation, IntPtr targetAnimation, int frameId, int offset); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractNonZeroTargetAllKeysOffsetNameD(const char* sourceAnimation, const char* targetAnimation, double frameId, double offset); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractNonZeroTargetAllKeysOffsetNameD(IntPtr sourceAnimation, IntPtr targetAnimation, double frameId, double offset); + /// + /// Subtract all frames with the min RGB color where the animation color is + /// less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by id. + /// EXPORT_API void PluginSubtractThresholdColorsMinMaxAllFramesRGB(const int animationId, const int minThreshold, const int minRed, const int minGreen, const int minBlue, const int maxThreshold, const int maxRed, const int maxGreen, const int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractThresholdColorsMinMaxAllFramesRGB(int animationId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// Subtract all frames with the min RGB color where the animation color is + /// less than the min threshold AND with the max RGB color where the animation + /// is more than the max threshold. Animation is referenced by name. + /// EXPORT_API void PluginSubtractThresholdColorsMinMaxAllFramesRGBName(const char* path, const int minThreshold, const int minRed, const int minGreen, const int minBlue, const int maxThreshold, const int maxRed, const int maxGreen, const int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractThresholdColorsMinMaxAllFramesRGBName(IntPtr path, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractThresholdColorsMinMaxAllFramesRGBNameD(const char* path, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractThresholdColorsMinMaxAllFramesRGBNameD(IntPtr path, double minThreshold, double minRed, double minGreen, double minBlue, double maxThreshold, double maxRed, double maxGreen, double maxBlue); + /// + /// Subtract the specified frame with the min RGB color where the animation + /// color is less than the min threshold AND with the max RGB color where the + /// animation is more than the max threshold. Animation is referenced by id. + /// + /// EXPORT_API void PluginSubtractThresholdColorsMinMaxRGB(const int animationId, const int frameId, const int minThreshold, const int minRed, const int minGreen, const int minBlue, const int maxThreshold, const int maxRed, const int maxGreen, const int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractThresholdColorsMinMaxRGB(int animationId, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// Subtract the specified frame with the min RGB color where the animation + /// color is less than the min threshold AND with the max RGB color where the + /// animation is more than the max threshold. Animation is referenced by name. + /// + /// EXPORT_API void PluginSubtractThresholdColorsMinMaxRGBName(const char* path, const int frameId, const int minThreshold, const int minRed, const int minGreen, const int minBlue, const int maxThreshold, const int maxRed, const int maxGreen, const int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginSubtractThresholdColorsMinMaxRGBName(IntPtr path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginSubtractThresholdColorsMinMaxRGBNameD(const char* path, const int frameId, const int minThreshold, const int minRed, const int minGreen, const int minBlue, const int maxThreshold, const int maxRed, const int maxGreen, const int maxBlue); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginSubtractThresholdColorsMinMaxRGBNameD(IntPtr path, int frameId, int minThreshold, int minRed, int minGreen, int minBlue, int maxThreshold, int maxRed, int maxGreen, int maxBlue); + /// + /// Trim the end of the animation. The length of the animation will be the lastFrameId + /// plus one. Reference the animation by id. + /// EXPORT_API void PluginTrimEndFrames(int animationId, int lastFrameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginTrimEndFrames(int animationId, int lastFrameId); + /// + /// Trim the end of the animation. The length of the animation will be the lastFrameId + /// plus one. Reference the animation by name. + /// EXPORT_API void PluginTrimEndFramesName(const char* path, int lastFrameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginTrimEndFramesName(IntPtr path, int lastFrameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginTrimEndFramesNameD(const char* path, double lastFrameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginTrimEndFramesNameD(IntPtr path, double lastFrameId); + /// + /// Remove the frame from the animation. Reference animation by id. + /// EXPORT_API void PluginTrimFrame(int animationId, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginTrimFrame(int animationId, int frameId); + /// + /// Remove the frame from the animation. Reference animation by name. + /// EXPORT_API void PluginTrimFrameName(const char* path, int frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginTrimFrameName(IntPtr path, int frameId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginTrimFrameNameD(const char* path, double frameId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginTrimFrameNameD(IntPtr path, double frameId); + /// + /// Trim the start of the animation starting at frame 0 for the number of frames. + /// Reference the animation by id. + /// EXPORT_API void PluginTrimStartFrames(int animationId, int numberOfFrames); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginTrimStartFrames(int animationId, int numberOfFrames); + /// + /// Trim the start of the animation starting at frame 0 for the number of frames. + /// Reference the animation by name. + /// EXPORT_API void PluginTrimStartFramesName(const char* path, int numberOfFrames); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginTrimStartFramesName(IntPtr path, int numberOfFrames); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginTrimStartFramesNameD(const char* path, double numberOfFrames); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginTrimStartFramesNameD(IntPtr path, double numberOfFrames); + /// + /// Uninitializes the `ChromaSDK`. Returns 0 upon success. Returns negative + /// one upon failure. + /// EXPORT_API RZRESULT PluginUninit(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginUninit(); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginUninitD(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginUninitD(); + /// + /// Unloads `Chroma` effects to free up resources. Returns the animation id + /// upon success. Returns negative one upon failure. Reference the animation + /// by id. + /// EXPORT_API int PluginUnloadAnimation(int animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginUnloadAnimation(int animationId); + /// + /// D suffix for limited data types. + /// EXPORT_API double PluginUnloadAnimationD(double animationId); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern double PluginUnloadAnimationD(double animationId); + /// + /// Unload the animation effects. Reference the animation by name. + /// EXPORT_API void PluginUnloadAnimationName(const char* path); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUnloadAnimationName(IntPtr path); + /// + /// Unload the the composite set of animation effects. Reference the animation + /// by name. + /// EXPORT_API void PluginUnloadComposite(const char* name); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUnloadComposite(IntPtr name); + /// + /// Unload the Razer Chroma SDK Library before exiting the application. + /// EXPORT_API void PluginUnloadLibrarySDK(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUnloadLibrarySDK(); + /// + /// Unload the Razer Chroma Streaming Plugin Library before exiting the application. + /// + /// EXPORT_API void PluginUnloadLibraryStreamingPlugin(); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUnloadLibraryStreamingPlugin(); + /// + /// Updates the `frameIndex` of the `Chroma` animation referenced by id and + /// sets the `duration` (in seconds). The `color` is expected to be an array + /// of the dimensions for the `deviceType/device`. The `length` parameter is + /// the size of the `color` array. For `EChromaSDKDevice1DEnum` the array size + /// should be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should + /// be `MAX ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// + /// EXPORT_API int PluginUpdateFrame(int animationId, int frameIndex, float duration, int* colors, int length, int* keys, int keysLength); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginUpdateFrame(int animationId, int frameIndex, float duration, int[] colors, int length, int[] keys, int keysLength); + /// + /// Update the `frameIndex` of the `Chroma` animation referenced by name and + /// sets the `duration` (in seconds). The `color` is expected to be an array + /// of the dimensions for the `deviceType/device`. The `length` parameter is + /// the size of the `color` array. For `EChromaSDKDevice1DEnum` the array size + /// should be `MAX LEDS`. For `EChromaSDKDevice2DEnum` the array size should + /// be `MAX ROW` times `MAX COLUMN`. Keys are populated only for EChromaSDKDevice2DEnum::DE_Keyboard + /// and EChromaSDKDevice2DEnum::DE_KeyboardExtended. Keys will only use the + /// EChromaSDKDevice2DEnum::DE_Keyboard `MAX_ROW` times `MAX_COLUMN` keysLength. + /// Returns the animation id upon success. Returns negative one upon failure. + /// + /// EXPORT_API int PluginUpdateFrameName(const char* path, int frameIndex, float duration, int* colors, int length, int* keys, int keysLength); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern int PluginUpdateFrameName(IntPtr path, int frameIndex, float duration, int[] colors, int length, int[] keys, int keysLength); + /// + /// When the idle animation flag is true, when no other animations are playing, + /// the idle animation will be used. The idle animation will not be affected + /// by the API calls to PluginIsPlaying, PluginStopAnimationType, PluginGetPlayingAnimationId, + /// and PluginGetPlayingAnimationCount. Then the idle animation flag is false, + /// the idle animation is disabled. `Device` uses `EChromaSDKDeviceEnum` enums. + /// + /// EXPORT_API void PluginUseIdleAnimation(int device, bool flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUseIdleAnimation(int device, bool flag); + /// + /// Set idle animation flag for all devices. + /// EXPORT_API void PluginUseIdleAnimations(bool flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUseIdleAnimations(bool flag); + /// + /// Set preloading animation flag, which is set to true by default. Reference + /// animation by id. + /// EXPORT_API void PluginUsePreloading(int animationId, bool flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUsePreloading(int animationId, bool flag); + /// + /// Set preloading animation flag, which is set to true by default. Reference + /// animation by name. + /// EXPORT_API void PluginUsePreloadingName(const char* path, bool flag); + /// + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] + private static extern void PluginUsePreloadingName(IntPtr path, bool flag); + #endregion + } +} diff --git a/Qwilight/ChromaSDK/RazerErrors.cs b/Qwilight/ChromaSDK/RazerErrors.cs new file mode 100644 index 0000000..ad7756a --- /dev/null +++ b/Qwilight/ChromaSDK/RazerErrors.cs @@ -0,0 +1,90 @@ +namespace ChromaSDK +{ + class RazerErrors + { + // Error codes + //! Invalid + public const int RZRESULT_INVALID = -1; + //! Success + public const int RZRESULT_SUCCESS = 0; + //! Access denied + public const int RZRESULT_ACCESS_DENIED = 5; + //! Invalid handle + public const int RZRESULT_INVALID_HANDLE = 6; + //! Not supported + public const int RZRESULT_NOT_SUPPORTED = 50; + //! Invalid parameter. + public const int RZRESULT_INVALID_PARAMETER = 87; + //! The service has not been started + public const int RZRESULT_SERVICE_NOT_ACTIVE = 1062; + //! Cannot start more than one instance of the specified program. + public const int RZRESULT_SINGLE_INSTANCE_APP = 1152; + //! Device not connected + public const int RZRESULT_DEVICE_NOT_CONNECTED = 1167; + //! Element not found. + public const int RZRESULT_NOT_FOUND = 1168; + //! Request aborted. + public const int RZRESULT_REQUEST_ABORTED = 1235; + //! An attempt was made to perform an initialization operation when initialization has already been completed. + public const int RZRESULT_ALREADY_INITIALIZED = 1247; + //! Resource not available or disabled + public const int RZRESULT_RESOURCE_DISABLED = 4309; + //! Device not available or supported + public const int RZRESULT_DEVICE_NOT_AVAILABLE = 4319; + //! The group or resource is not in the correct state to perform the requested operation. + public const int RZRESULT_NOT_VALID_STATE = 5023; + //! No more items + public const int RZRESULT_NO_MORE_ITEMS = 259; + //! DLL not found + public const int RZRESULT_DLL_NOT_FOUND = 6023; + //! Invalid signature + public const int RZRESULT_DLL_INVALID_SIGNATURE = 6033; + //! General failure. + public const int RZRESULT_FAILED = unchecked((int)2147500037); + public static string GetResultString(int result) + { + switch (result) + { + case RZRESULT_INVALID: + return "RZRESULT_INVALID"; + case RZRESULT_SUCCESS: + return "RZRESULT_SUCCESS"; + case RZRESULT_ACCESS_DENIED: + return "RZRESULT_ACCESS_DENIED"; + case RZRESULT_INVALID_HANDLE: + return "RZRESULT_INVALID_HANDLE"; + case RZRESULT_NOT_SUPPORTED: + return "RZRESULT_NOT_SUPPORTED"; + case RZRESULT_INVALID_PARAMETER: + return "RZRESULT_INVALID_PARAMETER"; + case RZRESULT_SERVICE_NOT_ACTIVE: + return "RZRESULT_SERVICE_NOT_ACTIVE"; + case RZRESULT_SINGLE_INSTANCE_APP: + return "RZRESULT_SINGLE_INSTANCE_APP"; + case RZRESULT_DEVICE_NOT_CONNECTED: + return "RZRESULT_DEVICE_NOT_CONNECTED"; + case RZRESULT_NOT_FOUND: + return "RZRESULT_NOT_FOUND"; + case RZRESULT_REQUEST_ABORTED: + return "RZRESULT_REQUEST_ABORTED"; + case RZRESULT_ALREADY_INITIALIZED: + return "RZRESULT_ALREADY_INITIALIZED"; + case RZRESULT_RESOURCE_DISABLED: + return "RZRESULT_RESOURCE_DISABLED"; + case RZRESULT_DEVICE_NOT_AVAILABLE: + return "RZRESULT_DEVICE_NOT_AVAILABLE"; + case RZRESULT_NOT_VALID_STATE: + return "RZRESULT_NOT_VALID_STATE"; + case RZRESULT_NO_MORE_ITEMS: + return "RZRESULT_NO_MORE_ITEMS"; + case RZRESULT_DLL_NOT_FOUND: + return "RZRESULT_DLL_NOT_FOUND"; + case RZRESULT_DLL_INVALID_SIGNATURE: + return "RZRESULT_DLL_INVALID_SIGNATURE"; + case RZRESULT_FAILED: + return "RZRESULT_FAILED"; + } + return result.ToString(); + } + } +} diff --git a/Qwilight/Comment.proto b/Qwilight/Comment.proto new file mode 100644 index 0000000..7e3c510 --- /dev/null +++ b/Qwilight/Comment.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + +option csharp_namespace = "Qwilight"; +option java_package = "net.taehui"; +option java_outer_classname = "CommentClass"; + +message Comment { + string date = 1; + int32 highestJudgment = 2; + int32 higherJudgment = 3; + int32 highJudgment = 4; + int32 lowJudgment = 5; + int32 lowerJudgment = 6; + int32 lowestJudgment = 7; + repeated InputEvent inputs = 8; + repeated MultiplierEvent multipliers = 9; + repeated PaintEvent paints = 10; + int32 loopUnit = 11; + repeated JudgmentMeterEvent judgmentMeters = 12; + repeated AudioMultiplierEvent audioMultipliers = 13; + double levyingMultiplier = 14; + double levyingAudioMultiplier = 15; +} + +message InputEvent { + int32 input = 1; + double wait = 2; + int32 noteID = 3; + int32 judged = 4; +} + +message MultiplierEvent { + double multiplier = 1; + double wait = 2; + bool isAutoEvent = 3; +} + +message JudgmentMeterEvent { + double judgmentMeter = 1; + double wait = 2; + int32 assist = 3; +} + +message PaintEvent { + double hitPoints = 1; + int32 stand = 2; + int32 band = 3; + double point = 4; + double wait = 5; +} + +message AudioMultiplierEvent { + double audioMultiplier = 1; + double wait = 2; +} \ No newline at end of file diff --git a/Qwilight/Event.proto b/Qwilight/Event.proto new file mode 100644 index 0000000..3e2d21b --- /dev/null +++ b/Qwilight/Event.proto @@ -0,0 +1,329 @@ +syntax = "proto3"; + +option csharp_namespace = "Qwilight"; +option java_package = "net.taehui"; +option java_outer_classname = "EventClass"; + +message Event { + int64 millis = 1; + string avatarID = 2; + EventID eventID = 3; + string text = 4; + repeated bytes data = 5; + oneof fastText { + QwilightCallNet qwilightCallNet = 6; + TwilightCallNet twilightCallNet = 7; + QwilightIOInput qwilightIOInput = 8; + TwilightIOInput twilightIOInput = 9; + QwilightIOJudge qwilightIOJudge = 10; + TwilightIOJudge twilightIOJudge = 11; + QwilightIOJudgmentMeter qwilightIOJudgmentMeter = 12; + TwilightIOJudgmentMeter twilightIOJudgmentMeter = 13; + QwilightIONoteVisibility qwilightIONoteVisibility = 14; + TwilightIONoteVisibility twilightIONoteVisibility = 15; + QwilightIOMultiplier qwilightIOMultiplier = 16; + TwilightIOMultiplier twilightIOMultiplier = 17; + QwilightIOAudioMultiplier qwilightIOAudioMultiplier = 18; + TwilightIOAudioMultiplier twilightIOAudioMultiplier = 19; + TwilightAudioInput twilightAudioInput = 20; + QwilightPostItem qwilightPostItem = 21; + TwilightPostItem twilightPostItem = 22; + } + + message TwilightCallNet { + string handlerID = 1; + repeated CallNetItem data = 2; + + message CallNetItem { + AvatarNetStatus avatarNetStatus = 1; + string avatarID = 2; + string avatarName = 3; + int32 stand = 4; + int32 band = 5; + double point = 6; + double hitPoints = 7; + bool isFailed = 8; + int32 lastJudged = 9; + int32 hitPointsMode = 10; + int32 targetPosition = 11; + repeated NetDrawing drawings = 12; + DrawingComponent drawingComponent = 13; + } + } + + message QwilightCallNet { + string siteID = 1; + string handlerID = 2; + AvatarNetStatus avatarNetStatus = 3; + int32 stand = 4; + int32 highestBand = 5; + double point = 6; + double hitPoints = 7; + bool isFailed = 8; + int32 lastJudged = 9; + repeated NetDrawing drawings = 10; + DrawingComponent drawingComponent = 11; + string title = 12; + string artist = 13; + string genre = 14; + int32 level = 15; + string levelText = 16; + string wantLevelID = 17; + int32 autoMode = 18; + int32 noteSaltMode = 19; + double audioMultiplier = 20; + int32 faintNoteMode = 21; + int32 judgmentMode = 22; + int32 hitPointsMode = 23; + int32 noteMobilityMode = 24; + int32 longNoteMode = 25; + int32 inputFavorMode = 26; + int32 noteModifyMode = 27; + int32 bpmMode = 28; + int32 waveMode = 29; + int32 setNoteMode = 30; + int32 lowestJudgmentConditionMode = 31; + int32 totalNotes = 32; + double judgmentStage = 33; + double hitPointsValue = 34; + int32 highestInputCount = 35; + double length = 36; + double bpm = 37; + double multiplier = 38; + int32 inputMode = 39; + double highestJudgment0 = 40; + double higherJudgment0 = 41; + double highJudgment0 = 42; + double lowJudgment0 = 43; + double lowerJudgment0 = 44; + double lowestJudgment0 = 45; + double highestJudgment1 = 46; + double higherJudgment1 = 47; + double highJudgment1 = 48; + double lowJudgment1 = 49; + double lowerJudgment1 = 50; + double lowestJudgment1 = 51; + int32 highestJudgment = 52; + int32 higherJudgment = 53; + int32 highJudgment = 54; + int32 lowJudgment = 55; + int32 lowerJudgment = 56; + int32 lowestJudgment = 57; + } + + enum AvatarNetStatus { + Default = 0; + Clear = 1; + Failed = 2; + } + + message NetDrawing { + Variety drawingVariety = 1; + uint32 param = 2; + double position0 = 3; + double position1 = 4; + double length = 5; + double height = 6; + + enum Variety { + Note = 0; + Main = 1; + Meter = 2; + } + } + + message DrawingComponent { + float p2BuiltLength = 1; + float judgmentMainPosition = 2; + } + + message QwilightIOInput { + repeated string avatarIDs = 1; + string handlerID = 2; + int32 input = 3; + int32 power = 4; + } + + message TwilightIOInput { + string handlerID = 1; + int32 input = 2; + int32 power = 3; + } + + message QwilightIOJudge { + repeated string avatarIDs = 1; + string handlerID = 2; + int32 noteID = 3; + int32 judged = 4; + } + + message TwilightIOJudge { + string handlerID = 1; + int32 noteID = 2; + int32 judged = 3; + } + + message QwilightIOJudgmentMeter { + repeated string avatarIDs = 1; + string handlerID = 2; + int32 input = 3; + double judgmentMeter = 4; + int32 assist = 5; + } + + message TwilightIOJudgmentMeter { + string handlerID = 1; + int32 input = 2; + double judgmentMeter = 3; + int32 assist = 4; + } + + message QwilightIONoteVisibility { + repeated string avatarIDs = 1; + string handlerID = 2; + int32 noteID = 3; + bool setValidJudgedNotes = 4; + bool setNoteFailed = 5; + } + + message TwilightIONoteVisibility { + string handlerID = 1; + int32 noteID = 2; + bool setValidJudgedNotes = 3; + bool setNoteFailed = 4; + } + + message QwilightIOMultiplier { + repeated string avatarIDs = 1; + string handlerID = 2; + double multiplier = 3; + } + + message TwilightIOMultiplier { + string handlerID = 1; + double multiplier = 2; + } + + message QwilightIOAudioMultiplier { + repeated string avatarIDs = 1; + string handlerID = 2; + double audioMultiplier = 3; + } + + message TwilightIOAudioMultiplier { + string handlerID = 1; + double audioMultiplier = 2; + } + + message TwilightAudioInput { + string siteID = 1; + string avatarID = 2; + } + + message QwilightPostItem { + string siteID = 1; + string handlerID = 2; + int32 postedItem = 3; + int32 isPositive = 4; + double lowestWait = 5; + double highestWait = 6; + } + + message TwilightPostItem { + string handlerID = 1; + int32 postedItem = 2; + string avatarName = 3; + double wait = 4; + } + + enum EventID { + SIGN_IN = 0; + NOT_SIGN_IN = 1; + WARNING = 2; + SITE_YELL = 3; + CALL_BUNDLE = 4; + SAVE_AS_BUNDLE = 5; + SAVING_BUNDLE = 6; + WIPE_BUNDLE = 7; + SET_BUNDLE = 8; + CALL_UBUNTU = 9; + CALL_SITE_AVATAR = 10; + COMMENT = 11; + SET_SITUATION = 12; + NEW_TITLE = 13; + STOP_SAVING_BUNDLE = 14; + SAVED_BUNDLE = 15; + SAVE_BUNDLE = 16; + ENTER_SITE = 17; + QUIT_SITE = 18; + WIPE_UBUNTU = 19; + NEW_SITE = 20; + NEW_UBUNTU = 21; + EXILE_AVATAR = 22; + NEW_SILENT_SITE = 23; + ESTABLISH = 24; + CALL_CONFIGURE = 25; + SET_CONFIGURE = 26; + NOTIFY_INFO = 27; + LEVY_NET = 28; + COMPILED = 29; + CALL_NET = 30; + SET_MODE_COMPONENT = 31; + SET_FAVOR_MODE_COMPONENT = 32; + SET_VALID_HUNTER_MODE = 33; + CALL_NET_SITE_COMMENTS = 34; + SET_NOTE_FILE = 35; + SET_SITE_NAME = 36; + SET_SITE_HAND = 37; + QUIT_NET = 38; + SAVING_AS_BUNDLE = 39; + SAVED_AS_BUNDLE = 40; + STOP_SAVING_AS_BUNDLE = 41; + SAVE_DEFAULT_NOTE = 42; + POST_FILE = 43; + SAVE_DEFAULT_UI = 44; + SET_FAVOR_AUDIO_MULTIPLIER = 45; + CALL_SITE_NET = 46; + NOTIFY_YES = 47; + CALL_IO = 48; + CALL_IO_COMPONENT = 49; + COMPILED_IO = 50; + LEVY_IO = 51; + IO_INPUT = 52; + IO_JUDGE = 53; + IO_NOTE_VISIBILITY = 54; + IO_JUDGMENT_METER = 56; + IO_MULTIPLIER = 57; + IO_AUDIO_MULTIPLIER = 58; + IO_PAUSE = 59; + IO_QUIT = 60; + IO_NOT = 61; + AUDIO_INPUT = 62; + CALL_SITE_MODE_COMPONENT = 63; + COMMENTARY = 65; + WWW_LEVEL = 66; + AVATAR_TITLE = 67; + INVALIDATE_AVATAR_DRAWING = 68; + INVALIDATE_AVATAR_TITLE = 69; + LEVEL_UP = 70; + SET_FAVOR_NOTE_FILE = 71; + GET_SITE_YELLS = 72; + SET_LANGUAGE = 73; + VALVE_COMMENT = 74; + ABILITY_UP = 75; + CLOSE = 76; + UNAVAILABLE_DATE = 77; + AVATAR_EDGE = 78; + INVALIDATE_AVATAR_EDGE = 79; + FAILED_VALIDATE_TOTEM = 80; + MODIFY_SITE_YELL = 81; + WIPE_SITE_YELL = 82; + ALREADY_LOADING_BUNDLE = 83; + SET_FAVOR = 84; + SET_AUTO_SITE_HAND = 85; + SET_AVATAR_GROUP = 86; + POST_ITEM = 87; + SET_VALID_NET_MODE = 88; + SET_ALLOWED_POSTABLE_ITEMS = 89; + } +} \ No newline at end of file diff --git a/Qwilight/FMOD/fmod.cs b/Qwilight/FMOD/fmod.cs new file mode 100644 index 0000000..ecb0274 --- /dev/null +++ b/Qwilight/FMOD/fmod.cs @@ -0,0 +1,4083 @@ +/* ======================================================================================== */ +/* FMOD Core API - C# wrapper. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/docs/2.02/api/core-api.html */ +/* ======================================================================================== */ + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace FMOD +{ + /* + FMOD version number. Check this against FMOD::System::getVersion / System_GetVersion + 0xaaaabbcc -> aaaa = major version number. bb = minor version number. cc = development version number. + */ + public partial class VERSION + { + public const int number = 0x00020219; +#if !UNITY_2019_4_OR_NEWER + public const string dll = "fmod"; +#endif + } + + public class CONSTANTS + { + public const int MAX_CHANNEL_WIDTH = 32; + public const int MAX_LISTENERS = 8; + public const int REVERB_MAXINSTANCES = 4; + public const int MAX_SYSTEMS = 8; + } + + /* + FMOD core types + */ + public enum RESULT : int + { + OK, + ERR_BADCOMMAND, + ERR_CHANNEL_ALLOC, + ERR_CHANNEL_STOLEN, + ERR_DMA, + ERR_DSP_CONNECTION, + ERR_DSP_DONTPROCESS, + ERR_DSP_FORMAT, + ERR_DSP_INUSE, + ERR_DSP_NOTFOUND, + ERR_DSP_RESERVED, + ERR_DSP_SILENCE, + ERR_DSP_TYPE, + ERR_FILE_BAD, + ERR_FILE_COULDNOTSEEK, + ERR_FILE_DISKEJECTED, + ERR_FILE_EOF, + ERR_FILE_ENDOFDATA, + ERR_FILE_NOTFOUND, + ERR_FORMAT, + ERR_HEADER_MISMATCH, + ERR_HTTP, + ERR_HTTP_ACCESS, + ERR_HTTP_PROXY_AUTH, + ERR_HTTP_SERVER_ERROR, + ERR_HTTP_TIMEOUT, + ERR_INITIALIZATION, + ERR_INITIALIZED, + ERR_INTERNAL, + ERR_INVALID_FLOAT, + ERR_INVALID_HANDLE, + ERR_INVALID_PARAM, + ERR_INVALID_POSITION, + ERR_INVALID_SPEAKER, + ERR_INVALID_SYNCPOINT, + ERR_INVALID_THREAD, + ERR_INVALID_VECTOR, + ERR_MAXAUDIBLE, + ERR_MEMORY, + ERR_MEMORY_CANTPOINT, + ERR_NEEDS3D, + ERR_NEEDSHARDWARE, + ERR_NET_CONNECT, + ERR_NET_SOCKET_ERROR, + ERR_NET_URL, + ERR_NET_WOULD_BLOCK, + ERR_NOTREADY, + ERR_OUTPUT_ALLOCATED, + ERR_OUTPUT_CREATEBUFFER, + ERR_OUTPUT_DRIVERCALL, + ERR_OUTPUT_FORMAT, + ERR_OUTPUT_INIT, + ERR_OUTPUT_NODRIVERS, + ERR_PLUGIN, + ERR_PLUGIN_MISSING, + ERR_PLUGIN_RESOURCE, + ERR_PLUGIN_VERSION, + ERR_RECORD, + ERR_REVERB_CHANNELGROUP, + ERR_REVERB_INSTANCE, + ERR_SUBSOUNDS, + ERR_SUBSOUND_ALLOCATED, + ERR_SUBSOUND_CANTMOVE, + ERR_TAGNOTFOUND, + ERR_TOOMANYCHANNELS, + ERR_TRUNCATED, + ERR_UNIMPLEMENTED, + ERR_UNINITIALIZED, + ERR_UNSUPPORTED, + ERR_VERSION, + ERR_EVENT_ALREADY_LOADED, + ERR_EVENT_LIVEUPDATE_BUSY, + ERR_EVENT_LIVEUPDATE_MISMATCH, + ERR_EVENT_LIVEUPDATE_TIMEOUT, + ERR_EVENT_NOTFOUND, + ERR_STUDIO_UNINITIALIZED, + ERR_STUDIO_NOT_LOADED, + ERR_INVALID_STRING, + ERR_ALREADY_LOCKED, + ERR_NOT_LOCKED, + ERR_RECORD_DISCONNECTED, + ERR_TOOMANYSAMPLES, + } + + public enum CHANNELCONTROL_TYPE : int + { + CHANNEL, + CHANNELGROUP, + MAX + } + + [StructLayout(LayoutKind.Sequential)] + public struct VECTOR + { + public float x; + public float y; + public float z; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ATTRIBUTES_3D + { + public VECTOR position; + public VECTOR velocity; + public VECTOR forward; + public VECTOR up; + } + + [StructLayout(LayoutKind.Sequential)] + public partial struct GUID + { + public int Data1; + public int Data2; + public int Data3; + public int Data4; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ASYNCREADINFO + { + public IntPtr handle; + public uint offset; + public uint sizebytes; + public int priority; + + public IntPtr userdata; + public IntPtr buffer; + public uint bytesread; + public FILE_ASYNCDONE_FUNC done; + } + + public enum OUTPUTTYPE : int + { + AUTODETECT, + + UNKNOWN, + NOSOUND, + WAVWRITER, + NOSOUND_NRT, + WAVWRITER_NRT, + + WASAPI, + ASIO, + PULSEAUDIO, + ALSA, + COREAUDIO, + AUDIOTRACK, + OPENSL, + AUDIOOUT, + AUDIO3D, + WEBAUDIO, + NNAUDIO, + WINSONIC, + AAUDIO, + AUDIOWORKLET, + PHASE, + OHAUDIO, + + MAX, + } + + public enum PORT_TYPE : int + { + MUSIC, + COPYRIGHT_MUSIC, + VOICE, + CONTROLLER, + PERSONAL, + VIBRATION, + AUX, + + MAX + } + + public enum DEBUG_MODE : int + { + TTY, + FILE, + CALLBACK, + } + + [Flags] + public enum DEBUG_FLAGS : uint + { + NONE = 0x00000000, + ERROR = 0x00000001, + WARNING = 0x00000002, + LOG = 0x00000004, + + TYPE_MEMORY = 0x00000100, + TYPE_FILE = 0x00000200, + TYPE_CODEC = 0x00000400, + TYPE_TRACE = 0x00000800, + + DISPLAY_TIMESTAMPS = 0x00010000, + DISPLAY_LINENUMBERS = 0x00020000, + DISPLAY_THREAD = 0x00040000, + } + + [Flags] + public enum MEMORY_TYPE : uint + { + NORMAL = 0x00000000, + STREAM_FILE = 0x00000001, + STREAM_DECODE = 0x00000002, + SAMPLEDATA = 0x00000004, + DSP_BUFFER = 0x00000008, + PLUGIN = 0x00000010, + PERSISTENT = 0x00200000, + ALL = 0xFFFFFFFF + } + + public enum SPEAKERMODE : int + { + DEFAULT, + RAW, + MONO, + STEREO, + QUAD, + SURROUND, + _5POINT1, + _7POINT1, + _7POINT1POINT4, + + MAX, + } + + public enum SPEAKER : int + { + NONE = -1, + FRONT_LEFT, + FRONT_RIGHT, + FRONT_CENTER, + LOW_FREQUENCY, + SURROUND_LEFT, + SURROUND_RIGHT, + BACK_LEFT, + BACK_RIGHT, + TOP_FRONT_LEFT, + TOP_FRONT_RIGHT, + TOP_BACK_LEFT, + TOP_BACK_RIGHT, + + MAX, + } + + [Flags] + public enum CHANNELMASK : uint + { + FRONT_LEFT = 0x00000001, + FRONT_RIGHT = 0x00000002, + FRONT_CENTER = 0x00000004, + LOW_FREQUENCY = 0x00000008, + SURROUND_LEFT = 0x00000010, + SURROUND_RIGHT = 0x00000020, + BACK_LEFT = 0x00000040, + BACK_RIGHT = 0x00000080, + BACK_CENTER = 0x00000100, + + MONO = (FRONT_LEFT), + STEREO = (FRONT_LEFT | FRONT_RIGHT), + LRC = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER), + QUAD = (FRONT_LEFT | FRONT_RIGHT | SURROUND_LEFT | SURROUND_RIGHT), + SURROUND = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SURROUND_LEFT | SURROUND_RIGHT), + _5POINT1 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SURROUND_LEFT | SURROUND_RIGHT), + _5POINT1_REARS = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT), + _7POINT0 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SURROUND_LEFT | SURROUND_RIGHT | BACK_LEFT | BACK_RIGHT), + _7POINT1 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SURROUND_LEFT | SURROUND_RIGHT | BACK_LEFT | BACK_RIGHT) + } + + public enum CHANNELORDER : int + { + DEFAULT, + WAVEFORMAT, + PROTOOLS, + ALLMONO, + ALLSTEREO, + ALSA, + + MAX, + } + + public enum PLUGINTYPE : int + { + OUTPUT, + CODEC, + DSP, + + MAX, + } + + [StructLayout(LayoutKind.Sequential)] + public struct PLUGINLIST + { + PLUGINTYPE type; + IntPtr description; + } + + [Flags] + public enum INITFLAGS : uint + { + NORMAL = 0x00000000, + STREAM_FROM_UPDATE = 0x00000001, + MIX_FROM_UPDATE = 0x00000002, + _3D_RIGHTHANDED = 0x00000004, + CLIP_OUTPUT = 0x00000008, + CHANNEL_LOWPASS = 0x00000100, + CHANNEL_DISTANCEFILTER = 0x00000200, + PROFILE_ENABLE = 0x00010000, + VOL0_BECOMES_VIRTUAL = 0x00020000, + GEOMETRY_USECLOSEST = 0x00040000, + PREFER_DOLBY_DOWNMIX = 0x00080000, + THREAD_UNSAFE = 0x00100000, + PROFILE_METER_ALL = 0x00200000, + MEMORY_TRACKING = 0x00400000, + } + + public enum SOUND_TYPE : int + { + UNKNOWN, + AIFF, + ASF, + DLS, + FLAC, + FSB, + IT, + MIDI, + MOD, + MPEG, + OGGVORBIS, + PLAYLIST, + RAW, + S3M, + USER, + WAV, + XM, + XMA, + AUDIOQUEUE, + AT9, + VORBIS, + MEDIA_FOUNDATION, + MEDIACODEC, + FADPCM, + OPUS, + + MAX, + } + + public enum SOUND_FORMAT : int + { + NONE, + PCM8, + PCM16, + PCM24, + PCM32, + PCMFLOAT, + BITSTREAM, + + MAX + } + + [Flags] + public enum MODE : uint + { + DEFAULT = 0x00000000, + LOOP_OFF = 0x00000001, + LOOP_NORMAL = 0x00000002, + LOOP_BIDI = 0x00000004, + _2D = 0x00000008, + _3D = 0x00000010, + CREATESTREAM = 0x00000080, + CREATESAMPLE = 0x00000100, + CREATECOMPRESSEDSAMPLE = 0x00000200, + OPENUSER = 0x00000400, + OPENMEMORY = 0x00000800, + OPENMEMORY_POINT = 0x10000000, + OPENRAW = 0x00001000, + OPENONLY = 0x00002000, + ACCURATETIME = 0x00004000, + MPEGSEARCH = 0x00008000, + NONBLOCKING = 0x00010000, + UNIQUE = 0x00020000, + _3D_HEADRELATIVE = 0x00040000, + _3D_WORLDRELATIVE = 0x00080000, + _3D_INVERSEROLLOFF = 0x00100000, + _3D_LINEARROLLOFF = 0x00200000, + _3D_LINEARSQUAREROLLOFF = 0x00400000, + _3D_INVERSETAPEREDROLLOFF = 0x00800000, + _3D_CUSTOMROLLOFF = 0x04000000, + _3D_IGNOREGEOMETRY = 0x40000000, + IGNORETAGS = 0x02000000, + LOWMEM = 0x08000000, + VIRTUAL_PLAYFROMSTART = 0x80000000 + } + + public enum OPENSTATE : int + { + READY = 0, + LOADING, + ERROR, + CONNECTING, + BUFFERING, + SEEKING, + PLAYING, + SETPOSITION, + + MAX, + } + + public enum SOUNDGROUP_BEHAVIOR : int + { + BEHAVIOR_FAIL, + BEHAVIOR_MUTE, + BEHAVIOR_STEALLOWEST, + + MAX, + } + + public enum CHANNELCONTROL_CALLBACK_TYPE : int + { + END, + VIRTUALVOICE, + SYNCPOINT, + OCCLUSION, + + MAX, + } + + public struct CHANNELCONTROL_DSP_INDEX + { + public const int HEAD = -1; + public const int FADER = -2; + public const int TAIL = -3; + } + + public enum ERRORCALLBACK_INSTANCETYPE : int + { + NONE, + SYSTEM, + CHANNEL, + CHANNELGROUP, + CHANNELCONTROL, + SOUND, + SOUNDGROUP, + DSP, + DSPCONNECTION, + GEOMETRY, + REVERB3D, + STUDIO_SYSTEM, + STUDIO_EVENTDESCRIPTION, + STUDIO_EVENTINSTANCE, + STUDIO_PARAMETERINSTANCE, + STUDIO_BUS, + STUDIO_VCA, + STUDIO_BANK, + STUDIO_COMMANDREPLAY + } + + [StructLayout(LayoutKind.Sequential)] + public struct ERRORCALLBACK_INFO + { + public RESULT result; + public ERRORCALLBACK_INSTANCETYPE instancetype; + public IntPtr instance; + public StringWrapper functionname; + public StringWrapper functionparams; + } + + [StructLayout(LayoutKind.Sequential)] + public struct CPU_USAGE + { + public float dsp; /* DSP mixing CPU usage. */ + public float stream; /* Streaming engine CPU usage. */ + public float geometry; /* Geometry engine CPU usage. */ + public float update; /* System::update CPU usage. */ + public float convolution1; /* Convolution reverb processing thread #1 CPU usage */ + public float convolution2; /* Convolution reverb processing thread #2 CPU usage */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_DATA_PARAMETER_INFO + { + public IntPtr data; + public uint length; + public int index; + } + + [Flags] + public enum SYSTEM_CALLBACK_TYPE : uint + { + DEVICELISTCHANGED = 0x00000001, + DEVICELOST = 0x00000002, + MEMORYALLOCATIONFAILED = 0x00000004, + THREADCREATED = 0x00000008, + BADDSPCONNECTION = 0x00000010, + PREMIX = 0x00000020, + POSTMIX = 0x00000040, + ERROR = 0x00000080, + MIDMIX = 0x00000100, + THREADDESTROYED = 0x00000200, + PREUPDATE = 0x00000400, + POSTUPDATE = 0x00000800, + RECORDLISTCHANGED = 0x00001000, + BUFFEREDNOMIX = 0x00002000, + DEVICEREINITIALIZE = 0x00004000, + OUTPUTUNDERRUN = 0x00008000, + RECORDPOSITIONCHANGED = 0x00010000, + ALL = 0xFFFFFFFF, + } + + /* + FMOD Callbacks + */ + public delegate RESULT DEBUG_CALLBACK (DEBUG_FLAGS flags, IntPtr file, int line, IntPtr func, IntPtr message); + public delegate RESULT SYSTEM_CALLBACK (IntPtr system, SYSTEM_CALLBACK_TYPE type, IntPtr commanddata1, IntPtr commanddata2, IntPtr userdata); + public delegate RESULT CHANNELCONTROL_CALLBACK (IntPtr channelcontrol, CHANNELCONTROL_TYPE controltype, CHANNELCONTROL_CALLBACK_TYPE callbacktype, IntPtr commanddata1, IntPtr commanddata2); + public delegate RESULT DSP_CALLBACK (IntPtr dsp, DSP_CALLBACK_TYPE type, IntPtr data); + public delegate RESULT SOUND_NONBLOCK_CALLBACK (IntPtr sound, RESULT result); + public delegate RESULT SOUND_PCMREAD_CALLBACK (IntPtr sound, IntPtr data, uint datalen); + public delegate RESULT SOUND_PCMSETPOS_CALLBACK (IntPtr sound, int subsound, uint position, TIMEUNIT postype); + public delegate RESULT FILE_OPEN_CALLBACK (IntPtr name, ref uint filesize, ref IntPtr handle, IntPtr userdata); + public delegate RESULT FILE_CLOSE_CALLBACK (IntPtr handle, IntPtr userdata); + public delegate RESULT FILE_READ_CALLBACK (IntPtr handle, IntPtr buffer, uint sizebytes, ref uint bytesread, IntPtr userdata); + public delegate RESULT FILE_SEEK_CALLBACK (IntPtr handle, uint pos, IntPtr userdata); + public delegate RESULT FILE_ASYNCREAD_CALLBACK (IntPtr info, IntPtr userdata); + public delegate RESULT FILE_ASYNCCANCEL_CALLBACK(IntPtr info, IntPtr userdata); + public delegate void FILE_ASYNCDONE_FUNC (IntPtr info, RESULT result); + public delegate IntPtr MEMORY_ALLOC_CALLBACK (uint size, MEMORY_TYPE type, IntPtr sourcestr); + public delegate IntPtr MEMORY_REALLOC_CALLBACK (IntPtr ptr, uint size, MEMORY_TYPE type, IntPtr sourcestr); + public delegate void MEMORY_FREE_CALLBACK (IntPtr ptr, MEMORY_TYPE type, IntPtr sourcestr); + public delegate float CB_3D_ROLLOFF_CALLBACK (IntPtr channelcontrol, float distance); + + public enum DSP_RESAMPLER : int + { + DEFAULT, + NOINTERP, + LINEAR, + CUBIC, + SPLINE, + + MAX, + } + + public enum DSP_CALLBACK_TYPE : int + { + DATAPARAMETERRELEASE, + + MAX, + } + + public enum DSPCONNECTION_TYPE : int + { + STANDARD, + SIDECHAIN, + SEND, + SEND_SIDECHAIN, + + MAX, + } + + public enum TAGTYPE : int + { + UNKNOWN = 0, + ID3V1, + ID3V2, + VORBISCOMMENT, + SHOUTCAST, + ICECAST, + ASF, + MIDI, + PLAYLIST, + FMOD, + USER, + + MAX + } + + public enum TAGDATATYPE : int + { + BINARY = 0, + INT, + FLOAT, + STRING, + STRING_UTF16, + STRING_UTF16BE, + STRING_UTF8, + + MAX + } + + [StructLayout(LayoutKind.Sequential)] + public struct TAG + { + public TAGTYPE type; + public TAGDATATYPE datatype; + public StringWrapper name; + public IntPtr data; + public uint datalen; + public bool updated; + } + + [Flags] + public enum TIMEUNIT : uint + { + MS = 0x00000001, + PCM = 0x00000002, + PCMBYTES = 0x00000004, + RAWBYTES = 0x00000008, + PCMFRACTION = 0x00000010, + MODORDER = 0x00000100, + MODROW = 0x00000200, + MODPATTERN = 0x00000400, + } + + public struct PORT_INDEX + { + public const ulong NONE = 0xFFFFFFFFFFFFFFFF; + public const ulong FLAG_VR_CONTROLLER = 0x1000000000000000; + } + + [StructLayout(LayoutKind.Sequential)] + public struct CREATESOUNDEXINFO + { + public int cbsize; + public uint length; + public uint fileoffset; + public int numchannels; + public int defaultfrequency; + public SOUND_FORMAT format; + public uint decodebuffersize; + public int initialsubsound; + public int numsubsounds; + public IntPtr inclusionlist; + public int inclusionlistnum; + public IntPtr pcmreadcallback_internal; + public IntPtr pcmsetposcallback_internal; + public IntPtr nonblockcallback_internal; + public IntPtr dlsname; + public IntPtr encryptionkey; + public int maxpolyphony; + public IntPtr userdata; + public SOUND_TYPE suggestedsoundtype; + public IntPtr fileuseropen_internal; + public IntPtr fileuserclose_internal; + public IntPtr fileuserread_internal; + public IntPtr fileuserseek_internal; + public IntPtr fileuserasyncread_internal; + public IntPtr fileuserasynccancel_internal; + public IntPtr fileuserdata; + public int filebuffersize; + public CHANNELORDER channelorder; + public IntPtr initialsoundgroup; + public uint initialseekposition; + public TIMEUNIT initialseekpostype; + public int ignoresetfilesystem; + public uint audioqueuepolicy; + public uint minmidigranularity; + public int nonblockthreadid; + public IntPtr fsbguid; + + public SOUND_PCMREAD_CALLBACK pcmreadcallback + { + set { pcmreadcallback_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return pcmreadcallback_internal == IntPtr.Zero ? null : (SOUND_PCMREAD_CALLBACK)Marshal.GetDelegateForFunctionPointer(pcmreadcallback_internal, typeof(SOUND_PCMREAD_CALLBACK)); } + } + public SOUND_PCMSETPOS_CALLBACK pcmsetposcallback + { + set { pcmsetposcallback_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return pcmsetposcallback_internal == IntPtr.Zero ? null : (SOUND_PCMSETPOS_CALLBACK)Marshal.GetDelegateForFunctionPointer(pcmsetposcallback_internal, typeof(SOUND_PCMSETPOS_CALLBACK)); } + } + public SOUND_NONBLOCK_CALLBACK nonblockcallback + { + set { nonblockcallback_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return nonblockcallback_internal == IntPtr.Zero ? null : (SOUND_NONBLOCK_CALLBACK)Marshal.GetDelegateForFunctionPointer(nonblockcallback_internal, typeof(SOUND_NONBLOCK_CALLBACK)); } + } + public FILE_OPEN_CALLBACK fileuseropen + { + set { fileuseropen_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return fileuseropen_internal == IntPtr.Zero ? null : (FILE_OPEN_CALLBACK)Marshal.GetDelegateForFunctionPointer(fileuseropen_internal, typeof(FILE_OPEN_CALLBACK)); } + } + public FILE_CLOSE_CALLBACK fileuserclose + { + set { fileuserclose_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return fileuserclose_internal == IntPtr.Zero ? null : (FILE_CLOSE_CALLBACK)Marshal.GetDelegateForFunctionPointer(fileuserclose_internal, typeof(FILE_CLOSE_CALLBACK)); } + } + public FILE_READ_CALLBACK fileuserread + { + set { fileuserread_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return fileuserread_internal == IntPtr.Zero ? null : (FILE_READ_CALLBACK)Marshal.GetDelegateForFunctionPointer(fileuserread_internal, typeof(FILE_READ_CALLBACK)); } + } + public FILE_SEEK_CALLBACK fileuserseek + { + set { fileuserseek_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return fileuserseek_internal == IntPtr.Zero ? null : (FILE_SEEK_CALLBACK)Marshal.GetDelegateForFunctionPointer(fileuserseek_internal, typeof(FILE_SEEK_CALLBACK)); } + } + public FILE_ASYNCREAD_CALLBACK fileuserasyncread + { + set { fileuserasyncread_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return fileuserasyncread_internal == IntPtr.Zero ? null : (FILE_ASYNCREAD_CALLBACK)Marshal.GetDelegateForFunctionPointer(fileuserasyncread_internal, typeof(FILE_ASYNCREAD_CALLBACK)); } + } + public FILE_ASYNCCANCEL_CALLBACK fileuserasynccancel + { + set { fileuserasynccancel_internal = (value == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(value)); } + get { return fileuserasynccancel_internal == IntPtr.Zero ? null : (FILE_ASYNCCANCEL_CALLBACK)Marshal.GetDelegateForFunctionPointer(fileuserasynccancel_internal, typeof(FILE_ASYNCCANCEL_CALLBACK)); } + } + + } + +#pragma warning disable 414 + [StructLayout(LayoutKind.Sequential)] + public struct REVERB_PROPERTIES + { + public float DecayTime; + public float EarlyDelay; + public float LateDelay; + public float HFReference; + public float HFDecayRatio; + public float Diffusion; + public float Density; + public float LowShelfFrequency; + public float LowShelfGain; + public float HighCut; + public float EarlyLateMix; + public float WetLevel; + + #region wrapperinternal + public REVERB_PROPERTIES(float decayTime, float earlyDelay, float lateDelay, float hfReference, + float hfDecayRatio, float diffusion, float density, float lowShelfFrequency, float lowShelfGain, + float highCut, float earlyLateMix, float wetLevel) + { + DecayTime = decayTime; + EarlyDelay = earlyDelay; + LateDelay = lateDelay; + HFReference = hfReference; + HFDecayRatio = hfDecayRatio; + Diffusion = diffusion; + Density = density; + LowShelfFrequency = lowShelfFrequency; + LowShelfGain = lowShelfGain; + HighCut = highCut; + EarlyLateMix = earlyLateMix; + WetLevel = wetLevel; + } + #endregion + } +#pragma warning restore 414 + + public class PRESET + { + public static REVERB_PROPERTIES OFF() { return new REVERB_PROPERTIES( 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f );} + public static REVERB_PROPERTIES GENERIC() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f );} + public static REVERB_PROPERTIES PADDEDCELL() { return new REVERB_PROPERTIES( 170, 1, 2, 5000, 10, 100, 100, 250, 0, 160, 84, -7.8f );} + public static REVERB_PROPERTIES ROOM() { return new REVERB_PROPERTIES( 400, 2, 3, 5000, 83, 100, 100, 250, 0, 6050, 88, -9.4f );} + public static REVERB_PROPERTIES BATHROOM() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 54, 100, 60, 250, 0, 2900, 83, 0.5f );} + public static REVERB_PROPERTIES LIVINGROOM() { return new REVERB_PROPERTIES( 500, 3, 4, 5000, 10, 100, 100, 250, 0, 160, 58, -19.0f );} + public static REVERB_PROPERTIES STONEROOM() { return new REVERB_PROPERTIES( 2300, 12, 17, 5000, 64, 100, 100, 250, 0, 7800, 71, -8.5f );} + public static REVERB_PROPERTIES AUDITORIUM() { return new REVERB_PROPERTIES( 4300, 20, 30, 5000, 59, 100, 100, 250, 0, 5850, 64, -11.7f );} + public static REVERB_PROPERTIES CONCERTHALL() { return new REVERB_PROPERTIES( 3900, 20, 29, 5000, 70, 100, 100, 250, 0, 5650, 80, -9.8f );} + public static REVERB_PROPERTIES CAVE() { return new REVERB_PROPERTIES( 2900, 15, 22, 5000, 100, 100, 100, 250, 0, 20000, 59, -11.3f );} + public static REVERB_PROPERTIES ARENA() { return new REVERB_PROPERTIES( 7200, 20, 30, 5000, 33, 100, 100, 250, 0, 4500, 80, -9.6f );} + public static REVERB_PROPERTIES HANGAR() { return new REVERB_PROPERTIES( 10000, 20, 30, 5000, 23, 100, 100, 250, 0, 3400, 72, -7.4f );} + public static REVERB_PROPERTIES CARPETTEDHALLWAY() { return new REVERB_PROPERTIES( 300, 2, 30, 5000, 10, 100, 100, 250, 0, 500, 56, -24.0f );} + public static REVERB_PROPERTIES HALLWAY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 59, 100, 100, 250, 0, 7800, 87, -5.5f );} + public static REVERB_PROPERTIES STONECORRIDOR() { return new REVERB_PROPERTIES( 270, 13, 20, 5000, 79, 100, 100, 250, 0, 9000, 86, -6.0f );} + public static REVERB_PROPERTIES ALLEY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 86, 100, 100, 250, 0, 8300, 80, -9.8f );} + public static REVERB_PROPERTIES FOREST() { return new REVERB_PROPERTIES( 1500, 162, 88, 5000, 54, 79, 100, 250, 0, 760, 94, -12.3f );} + public static REVERB_PROPERTIES CITY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 67, 50, 100, 250, 0, 4050, 66, -26.0f );} + public static REVERB_PROPERTIES MOUNTAINS() { return new REVERB_PROPERTIES( 1500, 300, 100, 5000, 21, 27, 100, 250, 0, 1220, 82, -24.0f );} + public static REVERB_PROPERTIES QUARRY() { return new REVERB_PROPERTIES( 1500, 61, 25, 5000, 83, 100, 100, 250, 0, 3400, 100, -5.0f );} + public static REVERB_PROPERTIES PLAIN() { return new REVERB_PROPERTIES( 1500, 179, 100, 5000, 50, 21, 100, 250, 0, 1670, 65, -28.0f );} + public static REVERB_PROPERTIES PARKINGLOT() { return new REVERB_PROPERTIES( 1700, 8, 12, 5000, 100, 100, 100, 250, 0, 20000, 56, -19.5f );} + public static REVERB_PROPERTIES SEWERPIPE() { return new REVERB_PROPERTIES( 2800, 14, 21, 5000, 14, 80, 60, 250, 0, 3400, 66, 1.2f );} + public static REVERB_PROPERTIES UNDERWATER() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 10, 100, 100, 250, 0, 500, 92, 7.0f );} + } + + [StructLayout(LayoutKind.Sequential)] + public struct ADVANCEDSETTINGS + { + public int cbSize; + public int maxMPEGCodecs; + public int maxADPCMCodecs; + public int maxXMACodecs; + public int maxVorbisCodecs; + public int maxAT9Codecs; + public int maxFADPCMCodecs; + public int maxPCMCodecs; + public int ASIONumChannels; + public IntPtr ASIOChannelList; + public IntPtr ASIOSpeakerList; + public float vol0virtualvol; + public uint defaultDecodeBufferSize; + public ushort profilePort; + public uint geometryMaxFadeTime; + public float distanceFilterCenterFreq; + public int reverb3Dinstance; + public int DSPBufferPoolSize; + public DSP_RESAMPLER resamplerMethod; + public uint randomSeed; + public int maxConvolutionThreads; + public int maxOpusCodecs; + } + + [Flags] + public enum DRIVER_STATE : uint + { + CONNECTED = 0x00000001, + DEFAULT = 0x00000002, + } + + public enum THREAD_PRIORITY : int + { + /* Platform specific priority range */ + PLATFORM_MIN = -32 * 1024, + PLATFORM_MAX = 32 * 1024, + + /* Platform agnostic priorities, maps internally to platform specific value */ + DEFAULT = PLATFORM_MIN - 1, + LOW = PLATFORM_MIN - 2, + MEDIUM = PLATFORM_MIN - 3, + HIGH = PLATFORM_MIN - 4, + VERY_HIGH = PLATFORM_MIN - 5, + EXTREME = PLATFORM_MIN - 6, + CRITICAL = PLATFORM_MIN - 7, + + /* Thread defaults */ + MIXER = EXTREME, + FEEDER = CRITICAL, + STREAM = VERY_HIGH, + FILE = HIGH, + NONBLOCKING = HIGH, + RECORD = HIGH, + GEOMETRY = LOW, + PROFILER = MEDIUM, + STUDIO_UPDATE = MEDIUM, + STUDIO_LOAD_BANK = MEDIUM, + STUDIO_LOAD_SAMPLE = MEDIUM, + CONVOLUTION1 = VERY_HIGH, + CONVOLUTION2 = VERY_HIGH + + } + + public enum THREAD_STACK_SIZE : uint + { + DEFAULT = 0, + MIXER = 80 * 1024, + FEEDER = 16 * 1024, + STREAM = 96 * 1024, + FILE = 64 * 1024, + NONBLOCKING = 112 * 1024, + RECORD = 16 * 1024, + GEOMETRY = 48 * 1024, + PROFILER = 128 * 1024, + STUDIO_UPDATE = 96 * 1024, + STUDIO_LOAD_BANK = 96 * 1024, + STUDIO_LOAD_SAMPLE = 96 * 1024, + CONVOLUTION1 = 16 * 1024, + CONVOLUTION2 = 16 * 1024 + } + + [Flags] + public enum THREAD_AFFINITY : long + { + /* Platform agnostic thread groupings */ + GROUP_DEFAULT = 0x4000000000000000, + GROUP_A = 0x4000000000000001, + GROUP_B = 0x4000000000000002, + GROUP_C = 0x4000000000000003, + + /* Thread defaults */ + MIXER = GROUP_A, + FEEDER = GROUP_C, + STREAM = GROUP_C, + FILE = GROUP_C, + NONBLOCKING = GROUP_C, + RECORD = GROUP_C, + GEOMETRY = GROUP_C, + PROFILER = GROUP_C, + STUDIO_UPDATE = GROUP_B, + STUDIO_LOAD_BANK = GROUP_C, + STUDIO_LOAD_SAMPLE = GROUP_C, + CONVOLUTION1 = GROUP_C, + CONVOLUTION2 = GROUP_C, + + /* Core mask, valid up to 1 << 61 */ + CORE_ALL = 0, + CORE_0 = 1 << 0, + CORE_1 = 1 << 1, + CORE_2 = 1 << 2, + CORE_3 = 1 << 3, + CORE_4 = 1 << 4, + CORE_5 = 1 << 5, + CORE_6 = 1 << 6, + CORE_7 = 1 << 7, + CORE_8 = 1 << 8, + CORE_9 = 1 << 9, + CORE_10 = 1 << 10, + CORE_11 = 1 << 11, + CORE_12 = 1 << 12, + CORE_13 = 1 << 13, + CORE_14 = 1 << 14, + CORE_15 = 1 << 15 + } + + public enum THREAD_TYPE : int + { + MIXER, + FEEDER, + STREAM, + FILE, + NONBLOCKING, + RECORD, + GEOMETRY, + PROFILER, + STUDIO_UPDATE, + STUDIO_LOAD_BANK, + STUDIO_LOAD_SAMPLE, + CONVOLUTION1, + CONVOLUTION2, + + MAX + } + + /* + FMOD System factory functions. Use this to create an FMOD System Instance. below you will see System init/close to get started. + */ + public struct Factory + { + public static RESULT System_Create(out System system) + { + return FMOD5_System_Create(out system.handle, VERSION.number); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Create(out IntPtr system, uint headerversion); + + #endregion + } + + /* + FMOD global system functions (optional). + */ + public struct Memory + { + public static RESULT Initialize(IntPtr poolmem, int poollen, MEMORY_ALLOC_CALLBACK useralloc, MEMORY_REALLOC_CALLBACK userrealloc, MEMORY_FREE_CALLBACK userfree, MEMORY_TYPE memtypeflags = MEMORY_TYPE.ALL) + { + return FMOD5_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree, memtypeflags); + } + + public static RESULT GetStats(out int currentalloced, out int maxalloced, bool blocking = true) + { + return FMOD5_Memory_GetStats(out currentalloced, out maxalloced, blocking); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Memory_Initialize(IntPtr poolmem, int poollen, MEMORY_ALLOC_CALLBACK useralloc, MEMORY_REALLOC_CALLBACK userrealloc, MEMORY_FREE_CALLBACK userfree, MEMORY_TYPE memtypeflags); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Memory_GetStats (out int currentalloced, out int maxalloced, bool blocking); + + #endregion + } + + public struct Debug + { + public static RESULT Initialize(DEBUG_FLAGS flags, DEBUG_MODE mode = DEBUG_MODE.TTY, DEBUG_CALLBACK callback = null, string filename = null) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_Debug_Initialize(flags, mode, callback, encoder.byteFromStringUTF8(filename)); + } + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Debug_Initialize(DEBUG_FLAGS flags, DEBUG_MODE mode, DEBUG_CALLBACK callback, byte[] filename); + + #endregion + } + + public struct Thread + { + public static RESULT SetAttributes(THREAD_TYPE type, THREAD_AFFINITY affinity = THREAD_AFFINITY.GROUP_DEFAULT, THREAD_PRIORITY priority = THREAD_PRIORITY.DEFAULT, THREAD_STACK_SIZE stacksize = THREAD_STACK_SIZE.DEFAULT) + { + return FMOD5_Thread_SetAttributes(type, affinity, priority, stacksize); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Thread_SetAttributes(THREAD_TYPE type, THREAD_AFFINITY affinity, THREAD_PRIORITY priority, THREAD_STACK_SIZE stacksize); + #endregion + } + + /* + 'System' API. + */ + public struct System + { + public RESULT release() + { + return FMOD5_System_Release(this.handle); + } + + // Setup functions. + public RESULT setOutput(OUTPUTTYPE output) + { + return FMOD5_System_SetOutput(this.handle, output); + } + public RESULT getOutput(out OUTPUTTYPE output) + { + return FMOD5_System_GetOutput(this.handle, out output); + } + public RESULT getNumDrivers(out int numdrivers) + { + return FMOD5_System_GetNumDrivers(this.handle, out numdrivers); + } + public RESULT getDriverInfo(int id, out string name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_System_GetDriverInfo(this.handle, id, stringMem, namelen, out guid, out systemrate, out speakermode, out speakermodechannels); + using (StringHelper.ThreadSafeEncoding encoding = StringHelper.GetFreeHelper()) + { + name = encoding.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getDriverInfo(int id, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels) + { + return FMOD5_System_GetDriverInfo(this.handle, id, IntPtr.Zero, 0, out guid, out systemrate, out speakermode, out speakermodechannels); + } + public RESULT setDriver(int driver) + { + return FMOD5_System_SetDriver(this.handle, driver); + } + public RESULT getDriver(out int driver) + { + return FMOD5_System_GetDriver(this.handle, out driver); + } + public RESULT setSoftwareChannels(int numsoftwarechannels) + { + return FMOD5_System_SetSoftwareChannels(this.handle, numsoftwarechannels); + } + public RESULT getSoftwareChannels(out int numsoftwarechannels) + { + return FMOD5_System_GetSoftwareChannels(this.handle, out numsoftwarechannels); + } + public RESULT setSoftwareFormat(int samplerate, SPEAKERMODE speakermode, int numrawspeakers) + { + return FMOD5_System_SetSoftwareFormat(this.handle, samplerate, speakermode, numrawspeakers); + } + public RESULT getSoftwareFormat(out int samplerate, out SPEAKERMODE speakermode, out int numrawspeakers) + { + return FMOD5_System_GetSoftwareFormat(this.handle, out samplerate, out speakermode, out numrawspeakers); + } + public RESULT setDSPBufferSize(uint bufferlength, int numbuffers) + { + return FMOD5_System_SetDSPBufferSize(this.handle, bufferlength, numbuffers); + } + public RESULT getDSPBufferSize(out uint bufferlength, out int numbuffers) + { + return FMOD5_System_GetDSPBufferSize(this.handle, out bufferlength, out numbuffers); + } + public RESULT setFileSystem(FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek, FILE_ASYNCREAD_CALLBACK userasyncread, FILE_ASYNCCANCEL_CALLBACK userasynccancel, int blockalign) + { + return FMOD5_System_SetFileSystem(this.handle, useropen, userclose, userread, userseek, userasyncread, userasynccancel, blockalign); + } + public RESULT attachFileSystem(FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek) + { + return FMOD5_System_AttachFileSystem(this.handle, useropen, userclose, userread, userseek); + } + public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) + { + settings.cbSize = MarshalHelper.SizeOf(typeof(ADVANCEDSETTINGS)); + return FMOD5_System_SetAdvancedSettings(this.handle, ref settings); + } + public RESULT getAdvancedSettings(ref ADVANCEDSETTINGS settings) + { + settings.cbSize = MarshalHelper.SizeOf(typeof(ADVANCEDSETTINGS)); + return FMOD5_System_GetAdvancedSettings(this.handle, ref settings); + } + public RESULT setCallback(SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask = SYSTEM_CALLBACK_TYPE.ALL) + { + return FMOD5_System_SetCallback(this.handle, callback, callbackmask); + } + + // Plug-in support. + public RESULT setPluginPath(string path) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_SetPluginPath(this.handle, encoder.byteFromStringUTF8(path)); + } + } + public RESULT loadPlugin(string filename, out uint handle, uint priority = 0) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_LoadPlugin(this.handle, encoder.byteFromStringUTF8(filename), out handle, priority); + } + } + public RESULT unloadPlugin(uint handle) + { + return FMOD5_System_UnloadPlugin(this.handle, handle); + } + public RESULT getNumNestedPlugins(uint handle, out int count) + { + return FMOD5_System_GetNumNestedPlugins(this.handle, handle, out count); + } + public RESULT getNestedPlugin(uint handle, int index, out uint nestedhandle) + { + return FMOD5_System_GetNestedPlugin(this.handle, handle, index, out nestedhandle); + } + public RESULT getNumPlugins(PLUGINTYPE plugintype, out int numplugins) + { + return FMOD5_System_GetNumPlugins(this.handle, plugintype, out numplugins); + } + public RESULT getPluginHandle(PLUGINTYPE plugintype, int index, out uint handle) + { + return FMOD5_System_GetPluginHandle(this.handle, plugintype, index, out handle); + } + public RESULT getPluginInfo(uint handle, out PLUGINTYPE plugintype, out string name, int namelen, out uint version) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_System_GetPluginInfo(this.handle, handle, out plugintype, stringMem, namelen, out version); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getPluginInfo(uint handle, out PLUGINTYPE plugintype, out uint version) + { + return FMOD5_System_GetPluginInfo(this.handle, handle, out plugintype, IntPtr.Zero, 0, out version); + } + public RESULT setOutputByPlugin(uint handle) + { + return FMOD5_System_SetOutputByPlugin(this.handle, handle); + } + public RESULT getOutputByPlugin(out uint handle) + { + return FMOD5_System_GetOutputByPlugin(this.handle, out handle); + } + public RESULT createDSPByPlugin(uint handle, out DSP dsp) + { + return FMOD5_System_CreateDSPByPlugin(this.handle, handle, out dsp.handle); + } + public RESULT getDSPInfoByPlugin(uint handle, out IntPtr description) + { + return FMOD5_System_GetDSPInfoByPlugin(this.handle, handle, out description); + } + public RESULT registerDSP(ref DSP_DESCRIPTION description, out uint handle) + { + return FMOD5_System_RegisterDSP(this.handle, ref description, out handle); + } + + // Init/Close. + public RESULT init(int maxchannels, INITFLAGS flags, IntPtr extradriverdata) + { + return FMOD5_System_Init(this.handle, maxchannels, flags, extradriverdata); + } + public RESULT close() + { + return FMOD5_System_Close(this.handle); + } + + // General post-init system functions. + public RESULT update() + { + return FMOD5_System_Update(this.handle); + } + public RESULT setSpeakerPosition(SPEAKER speaker, float x, float y, bool active) + { + return FMOD5_System_SetSpeakerPosition(this.handle, speaker, x, y, active); + } + public RESULT getSpeakerPosition(SPEAKER speaker, out float x, out float y, out bool active) + { + return FMOD5_System_GetSpeakerPosition(this.handle, speaker, out x, out y, out active); + } + public RESULT setStreamBufferSize(uint filebuffersize, TIMEUNIT filebuffersizetype) + { + return FMOD5_System_SetStreamBufferSize(this.handle, filebuffersize, filebuffersizetype); + } + public RESULT getStreamBufferSize(out uint filebuffersize, out TIMEUNIT filebuffersizetype) + { + return FMOD5_System_GetStreamBufferSize(this.handle, out filebuffersize, out filebuffersizetype); + } + public RESULT set3DSettings(float dopplerscale, float distancefactor, float rolloffscale) + { + return FMOD5_System_Set3DSettings(this.handle, dopplerscale, distancefactor, rolloffscale); + } + public RESULT get3DSettings(out float dopplerscale, out float distancefactor, out float rolloffscale) + { + return FMOD5_System_Get3DSettings(this.handle, out dopplerscale, out distancefactor, out rolloffscale); + } + public RESULT set3DNumListeners(int numlisteners) + { + return FMOD5_System_Set3DNumListeners(this.handle, numlisteners); + } + public RESULT get3DNumListeners(out int numlisteners) + { + return FMOD5_System_Get3DNumListeners(this.handle, out numlisteners); + } + public RESULT set3DListenerAttributes(int listener, ref VECTOR pos, ref VECTOR vel, ref VECTOR forward, ref VECTOR up) + { + return FMOD5_System_Set3DListenerAttributes(this.handle, listener, ref pos, ref vel, ref forward, ref up); + } + public RESULT get3DListenerAttributes(int listener, out VECTOR pos, out VECTOR vel, out VECTOR forward, out VECTOR up) + { + return FMOD5_System_Get3DListenerAttributes(this.handle, listener, out pos, out vel, out forward, out up); + } + public RESULT set3DRolloffCallback(CB_3D_ROLLOFF_CALLBACK callback) + { + return FMOD5_System_Set3DRolloffCallback(this.handle, callback); + } + public RESULT mixerSuspend() + { + return FMOD5_System_MixerSuspend(this.handle); + } + public RESULT mixerResume() + { + return FMOD5_System_MixerResume(this.handle); + } + public RESULT getDefaultMixMatrix(SPEAKERMODE sourcespeakermode, SPEAKERMODE targetspeakermode, float[] matrix, int matrixhop) + { + return FMOD5_System_GetDefaultMixMatrix(this.handle, sourcespeakermode, targetspeakermode, matrix, matrixhop); + } + public RESULT getSpeakerModeChannels(SPEAKERMODE mode, out int channels) + { + return FMOD5_System_GetSpeakerModeChannels(this.handle, mode, out channels); + } + + // System information functions. + public RESULT getVersion(out uint version) + { + return FMOD5_System_GetVersion(this.handle, out version); + } + public RESULT getOutputHandle(out IntPtr handle) + { + return FMOD5_System_GetOutputHandle(this.handle, out handle); + } + public RESULT getChannelsPlaying(out int channels) + { + return FMOD5_System_GetChannelsPlaying(this.handle, out channels, IntPtr.Zero); + } + public RESULT getChannelsPlaying(out int channels, out int realchannels) + { + return FMOD5_System_GetChannelsPlaying(this.handle, out channels, out realchannels); + } + public RESULT getCPUUsage(out CPU_USAGE usage) + { + return FMOD5_System_GetCPUUsage(this.handle, out usage); + } + public RESULT getFileUsage(out Int64 sampleBytesRead, out Int64 streamBytesRead, out Int64 otherBytesRead) + { + return FMOD5_System_GetFileUsage(this.handle, out sampleBytesRead, out streamBytesRead, out otherBytesRead); + } + + // Sound/DSP/Channel/FX creation and retrieval. + public RESULT createSound(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateSound(this.handle, encoder.byteFromStringUTF8(name), mode, ref exinfo, out sound.handle); + } + } + public RESULT createSound(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateSound(this.handle, data, mode, ref exinfo, out sound.handle); + } + public RESULT createSound(IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateSound(this.handle, name_or_data, mode, ref exinfo, out sound.handle); + } + public RESULT createSound(string name, MODE mode, out Sound sound) + { + CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); + exinfo.cbsize = MarshalHelper.SizeOf(typeof(CREATESOUNDEXINFO)); + + return createSound(name, mode, ref exinfo, out sound); + } + public RESULT createStream(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateStream(this.handle, encoder.byteFromStringUTF8(name), mode, ref exinfo, out sound.handle); + } + } + public RESULT createStream(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateStream(this.handle, data, mode, ref exinfo, out sound.handle); + } + public RESULT createStream(IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateStream(this.handle, name_or_data, mode, ref exinfo, out sound.handle); + } + public RESULT createStream(string name, MODE mode, out Sound sound) + { + CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); + exinfo.cbsize = MarshalHelper.SizeOf(typeof(CREATESOUNDEXINFO)); + + return createStream(name, mode, ref exinfo, out sound); + } + public RESULT createDSP(ref DSP_DESCRIPTION description, out DSP dsp) + { + return FMOD5_System_CreateDSP(this.handle, ref description, out dsp.handle); + } + public RESULT createDSPByType(DSP_TYPE type, out DSP dsp) + { + return FMOD5_System_CreateDSPByType(this.handle, type, out dsp.handle); + } + public RESULT createChannelGroup(string name, out ChannelGroup channelgroup) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateChannelGroup(this.handle, encoder.byteFromStringUTF8(name), out channelgroup.handle); + } + } + public RESULT createSoundGroup(string name, out SoundGroup soundgroup) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateSoundGroup(this.handle, encoder.byteFromStringUTF8(name), out soundgroup.handle); + } + } + public RESULT createReverb3D(out Reverb3D reverb) + { + return FMOD5_System_CreateReverb3D(this.handle, out reverb.handle); + } + public RESULT playSound(Sound sound, ChannelGroup channelgroup, bool paused, out Channel channel) + { + return FMOD5_System_PlaySound(this.handle, sound.handle, channelgroup.handle, paused, out channel.handle); + } + public RESULT playDSP(DSP dsp, ChannelGroup channelgroup, bool paused, out Channel channel) + { + return FMOD5_System_PlayDSP(this.handle, dsp.handle, channelgroup.handle, paused, out channel.handle); + } + public RESULT getChannel(int channelid, out Channel channel) + { + return FMOD5_System_GetChannel(this.handle, channelid, out channel.handle); + } + public RESULT getDSPInfoByType(DSP_TYPE type, out IntPtr description) + { + return FMOD5_System_GetDSPInfoByType(this.handle, type, out description); + } + public RESULT getMasterChannelGroup(out ChannelGroup channelgroup) + { + return FMOD5_System_GetMasterChannelGroup(this.handle, out channelgroup.handle); + } + public RESULT getMasterSoundGroup(out SoundGroup soundgroup) + { + return FMOD5_System_GetMasterSoundGroup(this.handle, out soundgroup.handle); + } + + // Routing to ports. + public RESULT attachChannelGroupToPort(PORT_TYPE portType, ulong portIndex, ChannelGroup channelgroup, bool passThru = false) + { + return FMOD5_System_AttachChannelGroupToPort(this.handle, portType, portIndex, channelgroup.handle, passThru); + } + public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup) + { + return FMOD5_System_DetachChannelGroupFromPort(this.handle, channelgroup.handle); + } + + // Reverb api. + public RESULT setReverbProperties(int instance, ref REVERB_PROPERTIES prop) + { + return FMOD5_System_SetReverbProperties(this.handle, instance, ref prop); + } + public RESULT getReverbProperties(int instance, out REVERB_PROPERTIES prop) + { + return FMOD5_System_GetReverbProperties(this.handle, instance, out prop); + } + + // System level DSP functionality. + public RESULT lockDSP() + { + return FMOD5_System_LockDSP(this.handle); + } + public RESULT unlockDSP() + { + return FMOD5_System_UnlockDSP(this.handle); + } + + // Recording api + public RESULT getRecordNumDrivers(out int numdrivers, out int numconnected) + { + return FMOD5_System_GetRecordNumDrivers(this.handle, out numdrivers, out numconnected); + } + public RESULT getRecordDriverInfo(int id, out string name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_System_GetRecordDriverInfo(this.handle, id, stringMem, namelen, out guid, out systemrate, out speakermode, out speakermodechannels, out state); + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getRecordDriverInfo(int id, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state) + { + return FMOD5_System_GetRecordDriverInfo(this.handle, id, IntPtr.Zero, 0, out guid, out systemrate, out speakermode, out speakermodechannels, out state); + } + public RESULT getRecordPosition(int id, out uint position) + { + return FMOD5_System_GetRecordPosition(this.handle, id, out position); + } + public RESULT recordStart(int id, Sound sound, bool loop) + { + return FMOD5_System_RecordStart(this.handle, id, sound.handle, loop); + } + public RESULT recordStop(int id) + { + return FMOD5_System_RecordStop(this.handle, id); + } + public RESULT isRecording(int id, out bool recording) + { + return FMOD5_System_IsRecording(this.handle, id, out recording); + } + + // Geometry api + public RESULT createGeometry(int maxpolygons, int maxvertices, out Geometry geometry) + { + return FMOD5_System_CreateGeometry(this.handle, maxpolygons, maxvertices, out geometry.handle); + } + public RESULT setGeometrySettings(float maxworldsize) + { + return FMOD5_System_SetGeometrySettings(this.handle, maxworldsize); + } + public RESULT getGeometrySettings(out float maxworldsize) + { + return FMOD5_System_GetGeometrySettings(this.handle, out maxworldsize); + } + public RESULT loadGeometry(IntPtr data, int datasize, out Geometry geometry) + { + return FMOD5_System_LoadGeometry(this.handle, data, datasize, out geometry.handle); + } + public RESULT getGeometryOcclusion(ref VECTOR listener, ref VECTOR source, out float direct, out float reverb) + { + return FMOD5_System_GetGeometryOcclusion(this.handle, ref listener, ref source, out direct, out reverb); + } + + // Network functions + public RESULT setNetworkProxy(string proxy) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_SetNetworkProxy(this.handle, encoder.byteFromStringUTF8(proxy)); + } + } + public RESULT getNetworkProxy(out string proxy, int proxylen) + { + IntPtr stringMem = Marshal.AllocHGlobal(proxylen); + + RESULT result = FMOD5_System_GetNetworkProxy(this.handle, stringMem, proxylen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + proxy = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT setNetworkTimeout(int timeout) + { + return FMOD5_System_SetNetworkTimeout(this.handle, timeout); + } + public RESULT getNetworkTimeout(out int timeout) + { + return FMOD5_System_GetNetworkTimeout(this.handle, out timeout); + } + + // Userdata set/get + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_System_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_System_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Release (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetOutput (IntPtr system, OUTPUTTYPE output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetOutput (IntPtr system, out OUTPUTTYPE output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNumDrivers (IntPtr system, out int numdrivers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDriverInfo (IntPtr system, int id, IntPtr name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetDriver (IntPtr system, int driver); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDriver (IntPtr system, out int driver); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetSoftwareChannels (IntPtr system, int numsoftwarechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSoftwareChannels (IntPtr system, out int numsoftwarechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetSoftwareFormat (IntPtr system, int samplerate, SPEAKERMODE speakermode, int numrawspeakers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSoftwareFormat (IntPtr system, out int samplerate, out SPEAKERMODE speakermode, out int numrawspeakers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetDSPBufferSize (IntPtr system, uint bufferlength, int numbuffers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDSPBufferSize (IntPtr system, out uint bufferlength, out int numbuffers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetFileSystem (IntPtr system, FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek, FILE_ASYNCREAD_CALLBACK userasyncread, FILE_ASYNCCANCEL_CALLBACK userasynccancel, int blockalign); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_AttachFileSystem (IntPtr system, FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetCallback (IntPtr system, SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetPluginPath (IntPtr system, byte[] path); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_LoadPlugin (IntPtr system, byte[] filename, out uint handle, uint priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_UnloadPlugin (IntPtr system, uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNumNestedPlugins (IntPtr system, uint handle, out int count); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNestedPlugin (IntPtr system, uint handle, int index, out uint nestedhandle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNumPlugins (IntPtr system, PLUGINTYPE plugintype, out int numplugins); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetPluginHandle (IntPtr system, PLUGINTYPE plugintype, int index, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetPluginInfo (IntPtr system, uint handle, out PLUGINTYPE plugintype, IntPtr name, int namelen, out uint version); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetOutputByPlugin (IntPtr system, uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetOutputByPlugin (IntPtr system, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateDSPByPlugin (IntPtr system, uint handle, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDSPInfoByPlugin (IntPtr system, uint handle, out IntPtr description); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_RegisterDSP (IntPtr system, ref DSP_DESCRIPTION description, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Init (IntPtr system, int maxchannels, INITFLAGS flags, IntPtr extradriverdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Close (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Update (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetSpeakerPosition (IntPtr system, SPEAKER speaker, float x, float y, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSpeakerPosition (IntPtr system, SPEAKER speaker, out float x, out float y, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetStreamBufferSize (IntPtr system, uint filebuffersize, TIMEUNIT filebuffersizetype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetStreamBufferSize (IntPtr system, out uint filebuffersize, out TIMEUNIT filebuffersizetype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DSettings (IntPtr system, float dopplerscale, float distancefactor, float rolloffscale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Get3DSettings (IntPtr system, out float dopplerscale, out float distancefactor, out float rolloffscale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DNumListeners (IntPtr system, int numlisteners); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Get3DNumListeners (IntPtr system, out int numlisteners); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DListenerAttributes (IntPtr system, int listener, ref VECTOR pos, ref VECTOR vel, ref VECTOR forward, ref VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Get3DListenerAttributes (IntPtr system, int listener, out VECTOR pos, out VECTOR vel, out VECTOR forward, out VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DRolloffCallback (IntPtr system, CB_3D_ROLLOFF_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_MixerSuspend (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_MixerResume (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDefaultMixMatrix (IntPtr system, SPEAKERMODE sourcespeakermode, SPEAKERMODE targetspeakermode, float[] matrix, int matrixhop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSpeakerModeChannels (IntPtr system, SPEAKERMODE mode, out int channels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetVersion (IntPtr system, out uint version); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetOutputHandle (IntPtr system, out IntPtr handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetChannelsPlaying (IntPtr system, out int channels, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetChannelsPlaying (IntPtr system, out int channels, out int realchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetCPUUsage (IntPtr system, out CPU_USAGE usage); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetFileUsage (IntPtr system, out Int64 sampleBytesRead, out Int64 streamBytesRead, out Int64 otherBytesRead); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateSound (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateSound (IntPtr system, IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateStream (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateStream (IntPtr system, IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateDSP (IntPtr system, ref DSP_DESCRIPTION description, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateDSPByType (IntPtr system, DSP_TYPE type, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateChannelGroup (IntPtr system, byte[] name, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateSoundGroup (IntPtr system, byte[] name, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateReverb3D (IntPtr system, out IntPtr reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_PlaySound (IntPtr system, IntPtr sound, IntPtr channelgroup, bool paused, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_PlayDSP (IntPtr system, IntPtr dsp, IntPtr channelgroup, bool paused, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetChannel (IntPtr system, int channelid, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDSPInfoByType (IntPtr system, DSP_TYPE type, out IntPtr description); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetMasterChannelGroup (IntPtr system, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetMasterSoundGroup (IntPtr system, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_AttachChannelGroupToPort (IntPtr system, PORT_TYPE portType, ulong portIndex, IntPtr channelgroup, bool passThru); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_DetachChannelGroupFromPort(IntPtr system, IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetReverbProperties (IntPtr system, int instance, ref REVERB_PROPERTIES prop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetReverbProperties (IntPtr system, int instance, out REVERB_PROPERTIES prop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_LockDSP (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_UnlockDSP (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetRecordNumDrivers (IntPtr system, out int numdrivers, out int numconnected); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetRecordDriverInfo (IntPtr system, int id, IntPtr name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetRecordPosition (IntPtr system, int id, out uint position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_RecordStart (IntPtr system, int id, IntPtr sound, bool loop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_RecordStop (IntPtr system, int id); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_IsRecording (IntPtr system, int id, out bool recording); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateGeometry (IntPtr system, int maxpolygons, int maxvertices, out IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetGeometrySettings (IntPtr system, float maxworldsize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetGeometrySettings (IntPtr system, out float maxworldsize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_LoadGeometry (IntPtr system, IntPtr data, int datasize, out IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetGeometryOcclusion (IntPtr system, ref VECTOR listener, ref VECTOR source, out float direct, out float reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetNetworkProxy (IntPtr system, byte[] proxy); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNetworkProxy (IntPtr system, IntPtr proxy, int proxylen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetNetworkTimeout (IntPtr system, int timeout); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNetworkTimeout (IntPtr system, out int timeout); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetUserData (IntPtr system, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetUserData (IntPtr system, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public System(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + + /* + 'Sound' API. + */ + public struct Sound + { + public RESULT release() + { + return FMOD5_Sound_Release(this.handle); + } + public RESULT getSystemObject(out System system) + { + return FMOD5_Sound_GetSystemObject(this.handle, out system.handle); + } + + // Standard sound manipulation functions. + public RESULT @lock(uint offset, uint length, out IntPtr ptr1, out IntPtr ptr2, out uint len1, out uint len2) + { + return FMOD5_Sound_Lock(this.handle, offset, length, out ptr1, out ptr2, out len1, out len2); + } + public RESULT unlock(IntPtr ptr1, IntPtr ptr2, uint len1, uint len2) + { + return FMOD5_Sound_Unlock(this.handle, ptr1, ptr2, len1, len2); + } + public RESULT setDefaults(float frequency, int priority) + { + return FMOD5_Sound_SetDefaults(this.handle, frequency, priority); + } + public RESULT getDefaults(out float frequency, out int priority) + { + return FMOD5_Sound_GetDefaults(this.handle, out frequency, out priority); + } + public RESULT set3DMinMaxDistance(float min, float max) + { + return FMOD5_Sound_Set3DMinMaxDistance(this.handle, min, max); + } + public RESULT get3DMinMaxDistance(out float min, out float max) + { + return FMOD5_Sound_Get3DMinMaxDistance(this.handle, out min, out max); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD5_Sound_Set3DConeSettings(this.handle, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD5_Sound_Get3DConeSettings(this.handle, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD5_Sound_Set3DCustomRolloff(this.handle, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD5_Sound_Get3DCustomRolloff(this.handle, out points, out numpoints); + } + + public RESULT getSubSound(int index, out Sound subsound) + { + return FMOD5_Sound_GetSubSound(this.handle, index, out subsound.handle); + } + public RESULT getSubSoundParent(out Sound parentsound) + { + return FMOD5_Sound_GetSubSoundParent(this.handle, out parentsound.handle); + } + public RESULT getName(out string name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_Sound_GetName(this.handle, stringMem, namelen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getLength(out uint length, TIMEUNIT lengthtype) + { + return FMOD5_Sound_GetLength(this.handle, out length, lengthtype); + } + public RESULT getFormat(out SOUND_TYPE type, out SOUND_FORMAT format, out int channels, out int bits) + { + return FMOD5_Sound_GetFormat(this.handle, out type, out format, out channels, out bits); + } + public RESULT getNumSubSounds(out int numsubsounds) + { + return FMOD5_Sound_GetNumSubSounds(this.handle, out numsubsounds); + } + public RESULT getNumTags(out int numtags, out int numtagsupdated) + { + return FMOD5_Sound_GetNumTags(this.handle, out numtags, out numtagsupdated); + } + public RESULT getTag(string name, int index, out TAG tag) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_Sound_GetTag(this.handle, encoder.byteFromStringUTF8(name), index, out tag); + } + } + public RESULT getOpenState(out OPENSTATE openstate, out uint percentbuffered, out bool starving, out bool diskbusy) + { + return FMOD5_Sound_GetOpenState(this.handle, out openstate, out percentbuffered, out starving, out diskbusy); + } + public RESULT readData(byte[] buffer) + { + return FMOD5_Sound_ReadData(this.handle, buffer, (uint)buffer.Length, IntPtr.Zero); + } + public RESULT readData(byte[] buffer, out uint read) + { + return FMOD5_Sound_ReadData(this.handle, buffer, (uint)buffer.Length, out read); + } + [Obsolete("Use Sound.readData(byte[], out uint) or Sound.readData(byte[]) instead.")] + public RESULT readData(IntPtr buffer, uint length, out uint read) + { + return FMOD5_Sound_ReadData(this.handle, buffer, length, out read); + } + public RESULT seekData(uint pcm) + { + return FMOD5_Sound_SeekData(this.handle, pcm); + } + public RESULT setSoundGroup(SoundGroup soundgroup) + { + return FMOD5_Sound_SetSoundGroup(this.handle, soundgroup.handle); + } + public RESULT getSoundGroup(out SoundGroup soundgroup) + { + return FMOD5_Sound_GetSoundGroup(this.handle, out soundgroup.handle); + } + + // Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks. + public RESULT getNumSyncPoints(out int numsyncpoints) + { + return FMOD5_Sound_GetNumSyncPoints(this.handle, out numsyncpoints); + } + public RESULT getSyncPoint(int index, out IntPtr point) + { + return FMOD5_Sound_GetSyncPoint(this.handle, index, out point); + } + public RESULT getSyncPointInfo(IntPtr point, out string name, int namelen, out uint offset, TIMEUNIT offsettype) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_Sound_GetSyncPointInfo(this.handle, point, stringMem, namelen, out offset, offsettype); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getSyncPointInfo(IntPtr point, out uint offset, TIMEUNIT offsettype) + { + return FMOD5_Sound_GetSyncPointInfo(this.handle, point, IntPtr.Zero, 0, out offset, offsettype); + } + public RESULT addSyncPoint(uint offset, TIMEUNIT offsettype, string name, out IntPtr point) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_Sound_AddSyncPoint(this.handle, offset, offsettype, encoder.byteFromStringUTF8(name), out point); + } + } + public RESULT deleteSyncPoint(IntPtr point) + { + return FMOD5_Sound_DeleteSyncPoint(this.handle, point); + } + + // Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time. + public RESULT setMode(MODE mode) + { + return FMOD5_Sound_SetMode(this.handle, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD5_Sound_GetMode(this.handle, out mode); + } + public RESULT setLoopCount(int loopcount) + { + return FMOD5_Sound_SetLoopCount(this.handle, loopcount); + } + public RESULT getLoopCount(out int loopcount) + { + return FMOD5_Sound_GetLoopCount(this.handle, out loopcount); + } + public RESULT setLoopPoints(uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Sound_SetLoopPoints(this.handle, loopstart, loopstarttype, loopend, loopendtype); + } + public RESULT getLoopPoints(out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Sound_GetLoopPoints(this.handle, out loopstart, loopstarttype, out loopend, loopendtype); + } + + // For MOD/S3M/XM/IT/MID sequenced formats only. + public RESULT getMusicNumChannels(out int numchannels) + { + return FMOD5_Sound_GetMusicNumChannels(this.handle, out numchannels); + } + public RESULT setMusicChannelVolume(int channel, float volume) + { + return FMOD5_Sound_SetMusicChannelVolume(this.handle, channel, volume); + } + public RESULT getMusicChannelVolume(int channel, out float volume) + { + return FMOD5_Sound_GetMusicChannelVolume(this.handle, channel, out volume); + } + public RESULT setMusicSpeed(float speed) + { + return FMOD5_Sound_SetMusicSpeed(this.handle, speed); + } + public RESULT getMusicSpeed(out float speed) + { + return FMOD5_Sound_GetMusicSpeed(this.handle, out speed); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Sound_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Sound_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Release (IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSystemObject (IntPtr sound, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Lock (IntPtr sound, uint offset, uint length, out IntPtr ptr1, out IntPtr ptr2, out uint len1, out uint len2); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Unlock (IntPtr sound, IntPtr ptr1, IntPtr ptr2, uint len1, uint len2); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetDefaults (IntPtr sound, float frequency, int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetDefaults (IntPtr sound, out float frequency, out int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Set3DMinMaxDistance (IntPtr sound, float min, float max); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Get3DMinMaxDistance (IntPtr sound, out float min, out float max); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Set3DConeSettings (IntPtr sound, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Get3DConeSettings (IntPtr sound, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Set3DCustomRolloff (IntPtr sound, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Get3DCustomRolloff (IntPtr sound, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSubSound (IntPtr sound, int index, out IntPtr subsound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSubSoundParent (IntPtr sound, out IntPtr parentsound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetName (IntPtr sound, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetLength (IntPtr sound, out uint length, TIMEUNIT lengthtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetFormat (IntPtr sound, out SOUND_TYPE type, out SOUND_FORMAT format, out int channels, out int bits); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetNumSubSounds (IntPtr sound, out int numsubsounds); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetNumTags (IntPtr sound, out int numtags, out int numtagsupdated); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetTag (IntPtr sound, byte[] name, int index, out TAG tag); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetOpenState (IntPtr sound, out OPENSTATE openstate, out uint percentbuffered, out bool starving, out bool diskbusy); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_ReadData (IntPtr sound, byte[] buffer, uint length, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_ReadData (IntPtr sound, byte[] buffer, uint length, out uint read); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_ReadData (IntPtr sound, IntPtr buffer, uint length, out uint read); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SeekData (IntPtr sound, uint pcm); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetSoundGroup (IntPtr sound, IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSoundGroup (IntPtr sound, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetNumSyncPoints (IntPtr sound, out int numsyncpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSyncPoint (IntPtr sound, int index, out IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSyncPointInfo (IntPtr sound, IntPtr point, IntPtr name, int namelen, out uint offset, TIMEUNIT offsettype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_AddSyncPoint (IntPtr sound, uint offset, TIMEUNIT offsettype, byte[] name, out IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_DeleteSyncPoint (IntPtr sound, IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetMode (IntPtr sound, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMode (IntPtr sound, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetLoopCount (IntPtr sound, int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetLoopCount (IntPtr sound, out int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetLoopPoints (IntPtr sound, uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetLoopPoints (IntPtr sound, out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMusicNumChannels (IntPtr sound, out int numchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetMusicChannelVolume (IntPtr sound, int channel, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMusicChannelVolume (IntPtr sound, int channel, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetMusicSpeed (IntPtr sound, float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMusicSpeed (IntPtr sound, out float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetUserData (IntPtr sound, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetUserData (IntPtr sound, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public Sound(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'ChannelControl' API + */ + interface IChannelControl + { + RESULT getSystemObject (out System system); + + // General control functionality for Channels and ChannelGroups. + RESULT stop (); + RESULT setPaused (bool paused); + RESULT getPaused (out bool paused); + RESULT setVolume (float volume); + RESULT getVolume (out float volume); + RESULT setVolumeRamp (bool ramp); + RESULT getVolumeRamp (out bool ramp); + RESULT getAudibility (out float audibility); + RESULT setPitch (float pitch); + RESULT getPitch (out float pitch); + RESULT setMute (bool mute); + RESULT getMute (out bool mute); + RESULT setReverbProperties (int instance, float wet); + RESULT getReverbProperties (int instance, out float wet); + RESULT setLowPassGain (float gain); + RESULT getLowPassGain (out float gain); + RESULT setMode (MODE mode); + RESULT getMode (out MODE mode); + RESULT setCallback (CHANNELCONTROL_CALLBACK callback); + RESULT isPlaying (out bool isplaying); + + // Note all 'set' functions alter a final matrix, this is why the only get function is getMixMatrix, to avoid other get functions returning incorrect/obsolete values. + RESULT setPan (float pan); + RESULT setMixLevelsOutput (float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + RESULT setMixLevelsInput (float[] levels, int numlevels); + RESULT setMixMatrix (float[] matrix, int outchannels, int inchannels, int inchannel_hop); + RESULT getMixMatrix (float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + + // Clock based functionality. + RESULT getDSPClock (out ulong dspclock, out ulong parentclock); + RESULT setDelay (ulong dspclock_start, ulong dspclock_end, bool stopchannels); + RESULT getDelay (out ulong dspclock_start, out ulong dspclock_end); + RESULT getDelay (out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + RESULT addFadePoint (ulong dspclock, float volume); + RESULT setFadePointRamp (ulong dspclock, float volume); + RESULT removeFadePoints (ulong dspclock_start, ulong dspclock_end); + RESULT getFadePoints (ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + + // DSP effects. + RESULT getDSP (int index, out DSP dsp); + RESULT addDSP (int index, DSP dsp); + RESULT removeDSP (DSP dsp); + RESULT getNumDSPs (out int numdsps); + RESULT setDSPIndex (DSP dsp, int index); + RESULT getDSPIndex (DSP dsp, out int index); + + // 3D functionality. + RESULT set3DAttributes (ref VECTOR pos, ref VECTOR vel); + RESULT get3DAttributes (out VECTOR pos, out VECTOR vel); + RESULT set3DMinMaxDistance (float mindistance, float maxdistance); + RESULT get3DMinMaxDistance (out float mindistance, out float maxdistance); + RESULT set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume); + RESULT get3DConeSettings (out float insideconeangle, out float outsideconeangle, out float outsidevolume); + RESULT set3DConeOrientation (ref VECTOR orientation); + RESULT get3DConeOrientation (out VECTOR orientation); + RESULT set3DCustomRolloff (ref VECTOR points, int numpoints); + RESULT get3DCustomRolloff (out IntPtr points, out int numpoints); + RESULT set3DOcclusion (float directocclusion, float reverbocclusion); + RESULT get3DOcclusion (out float directocclusion, out float reverbocclusion); + RESULT set3DSpread (float angle); + RESULT get3DSpread (out float angle); + RESULT set3DLevel (float level); + RESULT get3DLevel (out float level); + RESULT set3DDopplerLevel (float level); + RESULT get3DDopplerLevel (out float level); + RESULT set3DDistanceFilter (bool custom, float customLevel, float centerFreq); + RESULT get3DDistanceFilter (out bool custom, out float customLevel, out float centerFreq); + + // Userdata set/get. + RESULT setUserData (IntPtr userdata); + RESULT getUserData (out IntPtr userdata); + } + + /* + 'Channel' API + */ + public struct Channel : IChannelControl + { + // Channel specific control functionality. + public RESULT setFrequency(float frequency) + { + return FMOD5_Channel_SetFrequency(this.handle, frequency); + } + public RESULT getFrequency(out float frequency) + { + return FMOD5_Channel_GetFrequency(this.handle, out frequency); + } + public RESULT setPriority(int priority) + { + return FMOD5_Channel_SetPriority(this.handle, priority); + } + public RESULT getPriority(out int priority) + { + return FMOD5_Channel_GetPriority(this.handle, out priority); + } + public RESULT setPosition(uint position, TIMEUNIT postype) + { + return FMOD5_Channel_SetPosition(this.handle, position, postype); + } + public RESULT getPosition(out uint position, TIMEUNIT postype) + { + return FMOD5_Channel_GetPosition(this.handle, out position, postype); + } + public RESULT setChannelGroup(ChannelGroup channelgroup) + { + return FMOD5_Channel_SetChannelGroup(this.handle, channelgroup.handle); + } + public RESULT getChannelGroup(out ChannelGroup channelgroup) + { + return FMOD5_Channel_GetChannelGroup(this.handle, out channelgroup.handle); + } + public RESULT setLoopCount(int loopcount) + { + return FMOD5_Channel_SetLoopCount(this.handle, loopcount); + } + public RESULT getLoopCount(out int loopcount) + { + return FMOD5_Channel_GetLoopCount(this.handle, out loopcount); + } + public RESULT setLoopPoints(uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Channel_SetLoopPoints(this.handle, loopstart, loopstarttype, loopend, loopendtype); + } + public RESULT getLoopPoints(out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Channel_GetLoopPoints(this.handle, out loopstart, loopstarttype, out loopend, loopendtype); + } + + // Information only functions. + public RESULT isVirtual(out bool isvirtual) + { + return FMOD5_Channel_IsVirtual(this.handle, out isvirtual); + } + public RESULT getCurrentSound(out Sound sound) + { + return FMOD5_Channel_GetCurrentSound(this.handle, out sound.handle); + } + public RESULT getIndex(out int index) + { + return FMOD5_Channel_GetIndex(this.handle, out index); + } + + public RESULT getSystemObject(out System system) + { + return FMOD5_Channel_GetSystemObject(this.handle, out system.handle); + } + + // General control functionality for Channels and ChannelGroups. + public RESULT stop() + { + return FMOD5_Channel_Stop(this.handle); + } + public RESULT setPaused(bool paused) + { + return FMOD5_Channel_SetPaused(this.handle, paused); + } + public RESULT getPaused(out bool paused) + { + return FMOD5_Channel_GetPaused(this.handle, out paused); + } + public RESULT setVolume(float volume) + { + return FMOD5_Channel_SetVolume(this.handle, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD5_Channel_GetVolume(this.handle, out volume); + } + public RESULT setVolumeRamp(bool ramp) + { + return FMOD5_Channel_SetVolumeRamp(this.handle, ramp); + } + public RESULT getVolumeRamp(out bool ramp) + { + return FMOD5_Channel_GetVolumeRamp(this.handle, out ramp); + } + public RESULT getAudibility(out float audibility) + { + return FMOD5_Channel_GetAudibility(this.handle, out audibility); + } + public RESULT setPitch(float pitch) + { + return FMOD5_Channel_SetPitch(this.handle, pitch); + } + public RESULT getPitch(out float pitch) + { + return FMOD5_Channel_GetPitch(this.handle, out pitch); + } + public RESULT setMute(bool mute) + { + return FMOD5_Channel_SetMute(this.handle, mute); + } + public RESULT getMute(out bool mute) + { + return FMOD5_Channel_GetMute(this.handle, out mute); + } + public RESULT setReverbProperties(int instance, float wet) + { + return FMOD5_Channel_SetReverbProperties(this.handle, instance, wet); + } + public RESULT getReverbProperties(int instance, out float wet) + { + return FMOD5_Channel_GetReverbProperties(this.handle, instance, out wet); + } + public RESULT setLowPassGain(float gain) + { + return FMOD5_Channel_SetLowPassGain(this.handle, gain); + } + public RESULT getLowPassGain(out float gain) + { + return FMOD5_Channel_GetLowPassGain(this.handle, out gain); + } + public RESULT setMode(MODE mode) + { + return FMOD5_Channel_SetMode(this.handle, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD5_Channel_GetMode(this.handle, out mode); + } + public RESULT setCallback(CHANNELCONTROL_CALLBACK callback) + { + return FMOD5_Channel_SetCallback(this.handle, callback); + } + public RESULT isPlaying(out bool isplaying) + { + return FMOD5_Channel_IsPlaying(this.handle, out isplaying); + } + + // Note all 'set' functions alter a final matrix, this is why the only get function is getMixMatrix, to avoid other get functions returning incorrect/obsolete values. + public RESULT setPan(float pan) + { + return FMOD5_Channel_SetPan(this.handle, pan); + } + public RESULT setMixLevelsOutput(float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright) + { + return FMOD5_Channel_SetMixLevelsOutput(this.handle, frontleft, frontright, center, lfe, surroundleft, surroundright, backleft, backright); + } + public RESULT setMixLevelsInput(float[] levels, int numlevels) + { + return FMOD5_Channel_SetMixLevelsInput(this.handle, levels, numlevels); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop = 0) + { + return FMOD5_Channel_SetMixMatrix(this.handle, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop = 0) + { + return FMOD5_Channel_GetMixMatrix(this.handle, matrix, out outchannels, out inchannels, inchannel_hop); + } + + // Clock based functionality. + public RESULT getDSPClock(out ulong dspclock, out ulong parentclock) + { + return FMOD5_Channel_GetDSPClock(this.handle, out dspclock, out parentclock); + } + public RESULT setDelay(ulong dspclock_start, ulong dspclock_end, bool stopchannels = true) + { + return FMOD5_Channel_SetDelay(this.handle, dspclock_start, dspclock_end, stopchannels); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end) + { + return FMOD5_Channel_GetDelay(this.handle, out dspclock_start, out dspclock_end, IntPtr.Zero); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels) + { + return FMOD5_Channel_GetDelay(this.handle, out dspclock_start, out dspclock_end, out stopchannels); + } + public RESULT addFadePoint(ulong dspclock, float volume) + { + return FMOD5_Channel_AddFadePoint(this.handle, dspclock, volume); + } + public RESULT setFadePointRamp(ulong dspclock, float volume) + { + return FMOD5_Channel_SetFadePointRamp(this.handle, dspclock, volume); + } + public RESULT removeFadePoints(ulong dspclock_start, ulong dspclock_end) + { + return FMOD5_Channel_RemoveFadePoints(this.handle, dspclock_start, dspclock_end); + } + public RESULT getFadePoints(ref uint numpoints, ulong[] point_dspclock, float[] point_volume) + { + return FMOD5_Channel_GetFadePoints(this.handle, ref numpoints, point_dspclock, point_volume); + } + + // DSP effects. + public RESULT getDSP(int index, out DSP dsp) + { + return FMOD5_Channel_GetDSP(this.handle, index, out dsp.handle); + } + public RESULT addDSP(int index, DSP dsp) + { + return FMOD5_Channel_AddDSP(this.handle, index, dsp.handle); + } + public RESULT removeDSP(DSP dsp) + { + return FMOD5_Channel_RemoveDSP(this.handle, dsp.handle); + } + public RESULT getNumDSPs(out int numdsps) + { + return FMOD5_Channel_GetNumDSPs(this.handle, out numdsps); + } + public RESULT setDSPIndex(DSP dsp, int index) + { + return FMOD5_Channel_SetDSPIndex(this.handle, dsp.handle, index); + } + public RESULT getDSPIndex(DSP dsp, out int index) + { + return FMOD5_Channel_GetDSPIndex(this.handle, dsp.handle, out index); + } + + // 3D functionality. + public RESULT set3DAttributes(ref VECTOR pos, ref VECTOR vel) + { + return FMOD5_Channel_Set3DAttributes(this.handle, ref pos, ref vel); + } + public RESULT get3DAttributes(out VECTOR pos, out VECTOR vel) + { + return FMOD5_Channel_Get3DAttributes(this.handle, out pos, out vel); + } + public RESULT set3DMinMaxDistance(float mindistance, float maxdistance) + { + return FMOD5_Channel_Set3DMinMaxDistance(this.handle, mindistance, maxdistance); + } + public RESULT get3DMinMaxDistance(out float mindistance, out float maxdistance) + { + return FMOD5_Channel_Get3DMinMaxDistance(this.handle, out mindistance, out maxdistance); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD5_Channel_Set3DConeSettings(this.handle, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD5_Channel_Get3DConeSettings(this.handle, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DConeOrientation(ref VECTOR orientation) + { + return FMOD5_Channel_Set3DConeOrientation(this.handle, ref orientation); + } + public RESULT get3DConeOrientation(out VECTOR orientation) + { + return FMOD5_Channel_Get3DConeOrientation(this.handle, out orientation); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD5_Channel_Set3DCustomRolloff(this.handle, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD5_Channel_Get3DCustomRolloff(this.handle, out points, out numpoints); + } + public RESULT set3DOcclusion(float directocclusion, float reverbocclusion) + { + return FMOD5_Channel_Set3DOcclusion(this.handle, directocclusion, reverbocclusion); + } + public RESULT get3DOcclusion(out float directocclusion, out float reverbocclusion) + { + return FMOD5_Channel_Get3DOcclusion(this.handle, out directocclusion, out reverbocclusion); + } + public RESULT set3DSpread(float angle) + { + return FMOD5_Channel_Set3DSpread(this.handle, angle); + } + public RESULT get3DSpread(out float angle) + { + return FMOD5_Channel_Get3DSpread(this.handle, out angle); + } + public RESULT set3DLevel(float level) + { + return FMOD5_Channel_Set3DLevel(this.handle, level); + } + public RESULT get3DLevel(out float level) + { + return FMOD5_Channel_Get3DLevel(this.handle, out level); + } + public RESULT set3DDopplerLevel(float level) + { + return FMOD5_Channel_Set3DDopplerLevel(this.handle, level); + } + public RESULT get3DDopplerLevel(out float level) + { + return FMOD5_Channel_Get3DDopplerLevel(this.handle, out level); + } + public RESULT set3DDistanceFilter(bool custom, float customLevel, float centerFreq) + { + return FMOD5_Channel_Set3DDistanceFilter(this.handle, custom, customLevel, centerFreq); + } + public RESULT get3DDistanceFilter(out bool custom, out float customLevel, out float centerFreq) + { + return FMOD5_Channel_Get3DDistanceFilter(this.handle, out custom, out customLevel, out centerFreq); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Channel_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Channel_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetFrequency (IntPtr channel, float frequency); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetFrequency (IntPtr channel, out float frequency); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPriority (IntPtr channel, int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPriority (IntPtr channel, out int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPosition (IntPtr channel, uint position, TIMEUNIT postype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPosition (IntPtr channel, out uint position, TIMEUNIT postype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetChannelGroup (IntPtr channel, IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetChannelGroup (IntPtr channel, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetLoopCount (IntPtr channel, int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetLoopCount (IntPtr channel, out int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetLoopPoints (IntPtr channel, uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetLoopPoints (IntPtr channel, out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_IsVirtual (IntPtr channel, out bool isvirtual); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetCurrentSound (IntPtr channel, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetIndex (IntPtr channel, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetSystemObject (IntPtr channel, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Stop (IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPaused (IntPtr channel, bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPaused (IntPtr channel, out bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetVolume (IntPtr channel, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetVolume (IntPtr channel, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetVolumeRamp (IntPtr channel, bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetVolumeRamp (IntPtr channel, out bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetAudibility (IntPtr channel, out float audibility); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPitch (IntPtr channel, float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPitch (IntPtr channel, out float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMute (IntPtr channel, bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetMute (IntPtr channel, out bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetReverbProperties (IntPtr channel, int instance, float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetReverbProperties (IntPtr channel, int instance, out float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetLowPassGain (IntPtr channel, float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetLowPassGain (IntPtr channel, out float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMode (IntPtr channel, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetMode (IntPtr channel, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetCallback (IntPtr channel, CHANNELCONTROL_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_IsPlaying (IntPtr channel, out bool isplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPan (IntPtr channel, float pan); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMixLevelsOutput (IntPtr channel, float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMixLevelsInput (IntPtr channel, float[] levels, int numlevels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMixMatrix (IntPtr channel, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetMixMatrix (IntPtr channel, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDSPClock (IntPtr channel, out ulong dspclock, out ulong parentclock); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetDelay (IntPtr channel, ulong dspclock_start, ulong dspclock_end, bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDelay (IntPtr channel, out ulong dspclock_start, out ulong dspclock_end, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDelay (IntPtr channel, out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_AddFadePoint (IntPtr channel, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetFadePointRamp (IntPtr channel, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_RemoveFadePoints (IntPtr channel, ulong dspclock_start, ulong dspclock_end); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetFadePoints (IntPtr channel, ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDSP (IntPtr channel, int index, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_AddDSP (IntPtr channel, int index, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_RemoveDSP (IntPtr channel, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetNumDSPs (IntPtr channel, out int numdsps); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetDSPIndex (IntPtr channel, IntPtr dsp, int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDSPIndex (IntPtr channel, IntPtr dsp, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DAttributes (IntPtr channel, ref VECTOR pos, ref VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DAttributes (IntPtr channel, out VECTOR pos, out VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DMinMaxDistance (IntPtr channel, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DMinMaxDistance (IntPtr channel, out float mindistance, out float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DConeSettings (IntPtr channel, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DConeSettings (IntPtr channel, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DConeOrientation (IntPtr channel, ref VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DConeOrientation (IntPtr channel, out VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DCustomRolloff (IntPtr channel, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DCustomRolloff (IntPtr channel, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DOcclusion (IntPtr channel, float directocclusion, float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DOcclusion (IntPtr channel, out float directocclusion, out float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DSpread (IntPtr channel, float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DSpread (IntPtr channel, out float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DLevel (IntPtr channel, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DLevel (IntPtr channel, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DDopplerLevel (IntPtr channel, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DDopplerLevel (IntPtr channel, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DDistanceFilter (IntPtr channel, bool custom, float customLevel, float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DDistanceFilter (IntPtr channel, out bool custom, out float customLevel, out float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetUserData (IntPtr channel, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetUserData (IntPtr channel, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public Channel(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'ChannelGroup' API + */ + public struct ChannelGroup : IChannelControl + { + public RESULT release() + { + return FMOD5_ChannelGroup_Release(this.handle); + } + + // Nested channel groups. + public RESULT addGroup(ChannelGroup group, bool propagatedspclock = true) + { + return FMOD5_ChannelGroup_AddGroup(this.handle, group.handle, propagatedspclock, IntPtr.Zero); + } + public RESULT addGroup(ChannelGroup group, bool propagatedspclock, out DSPConnection connection) + { + return FMOD5_ChannelGroup_AddGroup(this.handle, group.handle, propagatedspclock, out connection.handle); + } + public RESULT getNumGroups(out int numgroups) + { + return FMOD5_ChannelGroup_GetNumGroups(this.handle, out numgroups); + } + public RESULT getGroup(int index, out ChannelGroup group) + { + return FMOD5_ChannelGroup_GetGroup(this.handle, index, out group.handle); + } + public RESULT getParentGroup(out ChannelGroup group) + { + return FMOD5_ChannelGroup_GetParentGroup(this.handle, out group.handle); + } + + // Information only functions. + public RESULT getName(out string name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_ChannelGroup_GetName(this.handle, stringMem, namelen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getNumChannels(out int numchannels) + { + return FMOD5_ChannelGroup_GetNumChannels(this.handle, out numchannels); + } + public RESULT getChannel(int index, out Channel channel) + { + return FMOD5_ChannelGroup_GetChannel(this.handle, index, out channel.handle); + } + + public RESULT getSystemObject(out System system) + { + return FMOD5_ChannelGroup_GetSystemObject(this.handle, out system.handle); + } + + // General control functionality for Channels and ChannelGroups. + public RESULT stop() + { + return FMOD5_ChannelGroup_Stop(this.handle); + } + public RESULT setPaused(bool paused) + { + return FMOD5_ChannelGroup_SetPaused(this.handle, paused); + } + public RESULT getPaused(out bool paused) + { + return FMOD5_ChannelGroup_GetPaused(this.handle, out paused); + } + public RESULT setVolume(float volume) + { + return FMOD5_ChannelGroup_SetVolume(this.handle, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD5_ChannelGroup_GetVolume(this.handle, out volume); + } + public RESULT setVolumeRamp(bool ramp) + { + return FMOD5_ChannelGroup_SetVolumeRamp(this.handle, ramp); + } + public RESULT getVolumeRamp(out bool ramp) + { + return FMOD5_ChannelGroup_GetVolumeRamp(this.handle, out ramp); + } + public RESULT getAudibility(out float audibility) + { + return FMOD5_ChannelGroup_GetAudibility(this.handle, out audibility); + } + public RESULT setPitch(float pitch) + { + return FMOD5_ChannelGroup_SetPitch(this.handle, pitch); + } + public RESULT getPitch(out float pitch) + { + return FMOD5_ChannelGroup_GetPitch(this.handle, out pitch); + } + public RESULT setMute(bool mute) + { + return FMOD5_ChannelGroup_SetMute(this.handle, mute); + } + public RESULT getMute(out bool mute) + { + return FMOD5_ChannelGroup_GetMute(this.handle, out mute); + } + public RESULT setReverbProperties(int instance, float wet) + { + return FMOD5_ChannelGroup_SetReverbProperties(this.handle, instance, wet); + } + public RESULT getReverbProperties(int instance, out float wet) + { + return FMOD5_ChannelGroup_GetReverbProperties(this.handle, instance, out wet); + } + public RESULT setLowPassGain(float gain) + { + return FMOD5_ChannelGroup_SetLowPassGain(this.handle, gain); + } + public RESULT getLowPassGain(out float gain) + { + return FMOD5_ChannelGroup_GetLowPassGain(this.handle, out gain); + } + public RESULT setMode(MODE mode) + { + return FMOD5_ChannelGroup_SetMode(this.handle, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD5_ChannelGroup_GetMode(this.handle, out mode); + } + public RESULT setCallback(CHANNELCONTROL_CALLBACK callback) + { + return FMOD5_ChannelGroup_SetCallback(this.handle, callback); + } + public RESULT isPlaying(out bool isplaying) + { + return FMOD5_ChannelGroup_IsPlaying(this.handle, out isplaying); + } + + // Note all 'set' functions alter a final matrix, this is why the only get function is getMixMatrix, to avoid other get functions returning incorrect/obsolete values. + public RESULT setPan(float pan) + { + return FMOD5_ChannelGroup_SetPan(this.handle, pan); + } + public RESULT setMixLevelsOutput(float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright) + { + return FMOD5_ChannelGroup_SetMixLevelsOutput(this.handle, frontleft, frontright, center, lfe, surroundleft, surroundright, backleft, backright); + } + public RESULT setMixLevelsInput(float[] levels, int numlevels) + { + return FMOD5_ChannelGroup_SetMixLevelsInput(this.handle, levels, numlevels); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop) + { + return FMOD5_ChannelGroup_SetMixMatrix(this.handle, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop) + { + return FMOD5_ChannelGroup_GetMixMatrix(this.handle, matrix, out outchannels, out inchannels, inchannel_hop); + } + + // Clock based functionality. + public RESULT getDSPClock(out ulong dspclock, out ulong parentclock) + { + return FMOD5_ChannelGroup_GetDSPClock(this.handle, out dspclock, out parentclock); + } + public RESULT setDelay(ulong dspclock_start, ulong dspclock_end, bool stopchannels) + { + return FMOD5_ChannelGroup_SetDelay(this.handle, dspclock_start, dspclock_end, stopchannels); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end) + { + return FMOD5_ChannelGroup_GetDelay(this.handle, out dspclock_start, out dspclock_end, IntPtr.Zero); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels) + { + return FMOD5_ChannelGroup_GetDelay(this.handle, out dspclock_start, out dspclock_end, out stopchannels); + } + public RESULT addFadePoint(ulong dspclock, float volume) + { + return FMOD5_ChannelGroup_AddFadePoint(this.handle, dspclock, volume); + } + public RESULT setFadePointRamp(ulong dspclock, float volume) + { + return FMOD5_ChannelGroup_SetFadePointRamp(this.handle, dspclock, volume); + } + public RESULT removeFadePoints(ulong dspclock_start, ulong dspclock_end) + { + return FMOD5_ChannelGroup_RemoveFadePoints(this.handle, dspclock_start, dspclock_end); + } + public RESULT getFadePoints(ref uint numpoints, ulong[] point_dspclock, float[] point_volume) + { + return FMOD5_ChannelGroup_GetFadePoints(this.handle, ref numpoints, point_dspclock, point_volume); + } + + // DSP effects. + public RESULT getDSP(int index, out DSP dsp) + { + return FMOD5_ChannelGroup_GetDSP(this.handle, index, out dsp.handle); + } + public RESULT addDSP(int index, DSP dsp) + { + return FMOD5_ChannelGroup_AddDSP(this.handle, index, dsp.handle); + } + public RESULT removeDSP(DSP dsp) + { + return FMOD5_ChannelGroup_RemoveDSP(this.handle, dsp.handle); + } + public RESULT getNumDSPs(out int numdsps) + { + return FMOD5_ChannelGroup_GetNumDSPs(this.handle, out numdsps); + } + public RESULT setDSPIndex(DSP dsp, int index) + { + return FMOD5_ChannelGroup_SetDSPIndex(this.handle, dsp.handle, index); + } + public RESULT getDSPIndex(DSP dsp, out int index) + { + return FMOD5_ChannelGroup_GetDSPIndex(this.handle, dsp.handle, out index); + } + + // 3D functionality. + public RESULT set3DAttributes(ref VECTOR pos, ref VECTOR vel) + { + return FMOD5_ChannelGroup_Set3DAttributes(this.handle, ref pos, ref vel); + } + public RESULT get3DAttributes(out VECTOR pos, out VECTOR vel) + { + return FMOD5_ChannelGroup_Get3DAttributes(this.handle, out pos, out vel); + } + public RESULT set3DMinMaxDistance(float mindistance, float maxdistance) + { + return FMOD5_ChannelGroup_Set3DMinMaxDistance(this.handle, mindistance, maxdistance); + } + public RESULT get3DMinMaxDistance(out float mindistance, out float maxdistance) + { + return FMOD5_ChannelGroup_Get3DMinMaxDistance(this.handle, out mindistance, out maxdistance); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD5_ChannelGroup_Set3DConeSettings(this.handle, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD5_ChannelGroup_Get3DConeSettings(this.handle, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DConeOrientation(ref VECTOR orientation) + { + return FMOD5_ChannelGroup_Set3DConeOrientation(this.handle, ref orientation); + } + public RESULT get3DConeOrientation(out VECTOR orientation) + { + return FMOD5_ChannelGroup_Get3DConeOrientation(this.handle, out orientation); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD5_ChannelGroup_Set3DCustomRolloff(this.handle, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD5_ChannelGroup_Get3DCustomRolloff(this.handle, out points, out numpoints); + } + public RESULT set3DOcclusion(float directocclusion, float reverbocclusion) + { + return FMOD5_ChannelGroup_Set3DOcclusion(this.handle, directocclusion, reverbocclusion); + } + public RESULT get3DOcclusion(out float directocclusion, out float reverbocclusion) + { + return FMOD5_ChannelGroup_Get3DOcclusion(this.handle, out directocclusion, out reverbocclusion); + } + public RESULT set3DSpread(float angle) + { + return FMOD5_ChannelGroup_Set3DSpread(this.handle, angle); + } + public RESULT get3DSpread(out float angle) + { + return FMOD5_ChannelGroup_Get3DSpread(this.handle, out angle); + } + public RESULT set3DLevel(float level) + { + return FMOD5_ChannelGroup_Set3DLevel(this.handle, level); + } + public RESULT get3DLevel(out float level) + { + return FMOD5_ChannelGroup_Get3DLevel(this.handle, out level); + } + public RESULT set3DDopplerLevel(float level) + { + return FMOD5_ChannelGroup_Set3DDopplerLevel(this.handle, level); + } + public RESULT get3DDopplerLevel(out float level) + { + return FMOD5_ChannelGroup_Get3DDopplerLevel(this.handle, out level); + } + public RESULT set3DDistanceFilter(bool custom, float customLevel, float centerFreq) + { + return FMOD5_ChannelGroup_Set3DDistanceFilter(this.handle, custom, customLevel, centerFreq); + } + public RESULT get3DDistanceFilter(out bool custom, out float customLevel, out float centerFreq) + { + return FMOD5_ChannelGroup_Get3DDistanceFilter(this.handle, out custom, out customLevel, out centerFreq); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_ChannelGroup_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_ChannelGroup_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Release (IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddGroup (IntPtr channelgroup, IntPtr group, bool propagatedspclock, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddGroup (IntPtr channelgroup, IntPtr group, bool propagatedspclock, out IntPtr connection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetNumGroups (IntPtr channelgroup, out int numgroups); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetGroup (IntPtr channelgroup, int index, out IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetParentGroup (IntPtr channelgroup, out IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetName (IntPtr channelgroup, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetNumChannels (IntPtr channelgroup, out int numchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetChannel (IntPtr channelgroup, int index, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetSystemObject (IntPtr channelgroup, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Stop (IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetPaused (IntPtr channelgroup, bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetPaused (IntPtr channelgroup, out bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetVolume (IntPtr channelgroup, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetVolume (IntPtr channelgroup, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetVolumeRamp (IntPtr channelgroup, bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetVolumeRamp (IntPtr channelgroup, out bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetAudibility (IntPtr channelgroup, out float audibility); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetPitch (IntPtr channelgroup, float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetPitch (IntPtr channelgroup, out float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMute (IntPtr channelgroup, bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetMute (IntPtr channelgroup, out bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetReverbProperties (IntPtr channelgroup, int instance, float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetReverbProperties (IntPtr channelgroup, int instance, out float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetLowPassGain (IntPtr channelgroup, float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetLowPassGain (IntPtr channelgroup, out float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMode (IntPtr channelgroup, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetMode (IntPtr channelgroup, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetCallback (IntPtr channelgroup, CHANNELCONTROL_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_IsPlaying (IntPtr channelgroup, out bool isplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetPan (IntPtr channelgroup, float pan); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMixLevelsOutput (IntPtr channelgroup, float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMixLevelsInput (IntPtr channelgroup, float[] levels, int numlevels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMixMatrix (IntPtr channelgroup, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetMixMatrix (IntPtr channelgroup, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDSPClock (IntPtr channelgroup, out ulong dspclock, out ulong parentclock); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetDelay (IntPtr channelgroup, ulong dspclock_start, ulong dspclock_end, bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDelay (IntPtr channelgroup, out ulong dspclock_start, out ulong dspclock_end, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDelay (IntPtr channelgroup, out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddFadePoint (IntPtr channelgroup, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetFadePointRamp (IntPtr channelgroup, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_RemoveFadePoints (IntPtr channelgroup, ulong dspclock_start, ulong dspclock_end); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetFadePoints (IntPtr channelgroup, ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDSP (IntPtr channelgroup, int index, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddDSP (IntPtr channelgroup, int index, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_RemoveDSP (IntPtr channelgroup, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetNumDSPs (IntPtr channelgroup, out int numdsps); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetDSPIndex (IntPtr channelgroup, IntPtr dsp, int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDSPIndex (IntPtr channelgroup, IntPtr dsp, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DAttributes (IntPtr channelgroup, ref VECTOR pos, ref VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DAttributes (IntPtr channelgroup, out VECTOR pos, out VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DMinMaxDistance (IntPtr channelgroup, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DMinMaxDistance (IntPtr channelgroup, out float mindistance, out float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DConeSettings (IntPtr channelgroup, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DConeSettings (IntPtr channelgroup, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DConeOrientation(IntPtr channelgroup, ref VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DConeOrientation(IntPtr channelgroup, out VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DCustomRolloff (IntPtr channelgroup, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DCustomRolloff (IntPtr channelgroup, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DOcclusion (IntPtr channelgroup, float directocclusion, float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DOcclusion (IntPtr channelgroup, out float directocclusion, out float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DSpread (IntPtr channelgroup, float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DSpread (IntPtr channelgroup, out float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DLevel (IntPtr channelgroup, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DLevel (IntPtr channelgroup, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DDopplerLevel (IntPtr channelgroup, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DDopplerLevel (IntPtr channelgroup, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DDistanceFilter (IntPtr channelgroup, bool custom, float customLevel, float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DDistanceFilter (IntPtr channelgroup, out bool custom, out float customLevel, out float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetUserData (IntPtr channelgroup, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetUserData (IntPtr channelgroup, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public ChannelGroup(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'SoundGroup' API + */ + public struct SoundGroup + { + public RESULT release() + { + return FMOD5_SoundGroup_Release(this.handle); + } + + public RESULT getSystemObject(out System system) + { + return FMOD5_SoundGroup_GetSystemObject(this.handle, out system.handle); + } + + // SoundGroup control functions. + public RESULT setMaxAudible(int maxaudible) + { + return FMOD5_SoundGroup_SetMaxAudible(this.handle, maxaudible); + } + public RESULT getMaxAudible(out int maxaudible) + { + return FMOD5_SoundGroup_GetMaxAudible(this.handle, out maxaudible); + } + public RESULT setMaxAudibleBehavior(SOUNDGROUP_BEHAVIOR behavior) + { + return FMOD5_SoundGroup_SetMaxAudibleBehavior(this.handle, behavior); + } + public RESULT getMaxAudibleBehavior(out SOUNDGROUP_BEHAVIOR behavior) + { + return FMOD5_SoundGroup_GetMaxAudibleBehavior(this.handle, out behavior); + } + public RESULT setMuteFadeSpeed(float speed) + { + return FMOD5_SoundGroup_SetMuteFadeSpeed(this.handle, speed); + } + public RESULT getMuteFadeSpeed(out float speed) + { + return FMOD5_SoundGroup_GetMuteFadeSpeed(this.handle, out speed); + } + public RESULT setVolume(float volume) + { + return FMOD5_SoundGroup_SetVolume(this.handle, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD5_SoundGroup_GetVolume(this.handle, out volume); + } + public RESULT stop() + { + return FMOD5_SoundGroup_Stop(this.handle); + } + + // Information only functions. + public RESULT getName(out string name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_SoundGroup_GetName(this.handle, stringMem, namelen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getNumSounds(out int numsounds) + { + return FMOD5_SoundGroup_GetNumSounds(this.handle, out numsounds); + } + public RESULT getSound(int index, out Sound sound) + { + return FMOD5_SoundGroup_GetSound(this.handle, index, out sound.handle); + } + public RESULT getNumPlaying(out int numplaying) + { + return FMOD5_SoundGroup_GetNumPlaying(this.handle, out numplaying); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_SoundGroup_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_SoundGroup_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_Release (IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetSystemObject (IntPtr soundgroup, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetMaxAudible (IntPtr soundgroup, int maxaudible); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetMaxAudible (IntPtr soundgroup, out int maxaudible); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetMaxAudibleBehavior (IntPtr soundgroup, SOUNDGROUP_BEHAVIOR behavior); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetMaxAudibleBehavior (IntPtr soundgroup, out SOUNDGROUP_BEHAVIOR behavior); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetMuteFadeSpeed (IntPtr soundgroup, float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetMuteFadeSpeed (IntPtr soundgroup, out float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetVolume (IntPtr soundgroup, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetVolume (IntPtr soundgroup, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_Stop (IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetName (IntPtr soundgroup, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetNumSounds (IntPtr soundgroup, out int numsounds); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetSound (IntPtr soundgroup, int index, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetNumPlaying (IntPtr soundgroup, out int numplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetUserData (IntPtr soundgroup, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetUserData (IntPtr soundgroup, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public SoundGroup(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'DSP' API + */ + public struct DSP + { + public RESULT release() + { + return FMOD5_DSP_Release(this.handle); + } + public RESULT getSystemObject(out System system) + { + return FMOD5_DSP_GetSystemObject(this.handle, out system.handle); + } + + // Connection / disconnection / input and output enumeration. + public RESULT addInput(DSP input) + { + return FMOD5_DSP_AddInput(this.handle, input.handle, IntPtr.Zero, DSPCONNECTION_TYPE.STANDARD); + } + public RESULT addInput(DSP input, out DSPConnection connection, DSPCONNECTION_TYPE type = DSPCONNECTION_TYPE.STANDARD) + { + return FMOD5_DSP_AddInput(this.handle, input.handle, out connection.handle, type); + } + public RESULT disconnectFrom(DSP target, DSPConnection connection) + { + return FMOD5_DSP_DisconnectFrom(this.handle, target.handle, connection.handle); + } + public RESULT disconnectAll(bool inputs, bool outputs) + { + return FMOD5_DSP_DisconnectAll(this.handle, inputs, outputs); + } + public RESULT getNumInputs(out int numinputs) + { + return FMOD5_DSP_GetNumInputs(this.handle, out numinputs); + } + public RESULT getNumOutputs(out int numoutputs) + { + return FMOD5_DSP_GetNumOutputs(this.handle, out numoutputs); + } + public RESULT getInput(int index, out DSP input, out DSPConnection inputconnection) + { + return FMOD5_DSP_GetInput(this.handle, index, out input.handle, out inputconnection.handle); + } + public RESULT getOutput(int index, out DSP output, out DSPConnection outputconnection) + { + return FMOD5_DSP_GetOutput(this.handle, index, out output.handle, out outputconnection.handle); + } + + // DSP unit control. + public RESULT setActive(bool active) + { + return FMOD5_DSP_SetActive(this.handle, active); + } + public RESULT getActive(out bool active) + { + return FMOD5_DSP_GetActive(this.handle, out active); + } + public RESULT setBypass(bool bypass) + { + return FMOD5_DSP_SetBypass(this.handle, bypass); + } + public RESULT getBypass(out bool bypass) + { + return FMOD5_DSP_GetBypass(this.handle, out bypass); + } + public RESULT setWetDryMix(float prewet, float postwet, float dry) + { + return FMOD5_DSP_SetWetDryMix(this.handle, prewet, postwet, dry); + } + public RESULT getWetDryMix(out float prewet, out float postwet, out float dry) + { + return FMOD5_DSP_GetWetDryMix(this.handle, out prewet, out postwet, out dry); + } + public RESULT setChannelFormat(CHANNELMASK channelmask, int numchannels, SPEAKERMODE source_speakermode) + { + return FMOD5_DSP_SetChannelFormat(this.handle, channelmask, numchannels, source_speakermode); + } + public RESULT getChannelFormat(out CHANNELMASK channelmask, out int numchannels, out SPEAKERMODE source_speakermode) + { + return FMOD5_DSP_GetChannelFormat(this.handle, out channelmask, out numchannels, out source_speakermode); + } + public RESULT getOutputChannelFormat(CHANNELMASK inmask, int inchannels, SPEAKERMODE inspeakermode, out CHANNELMASK outmask, out int outchannels, out SPEAKERMODE outspeakermode) + { + return FMOD5_DSP_GetOutputChannelFormat(this.handle, inmask, inchannels, inspeakermode, out outmask, out outchannels, out outspeakermode); + } + public RESULT reset() + { + return FMOD5_DSP_Reset(this.handle); + } + public RESULT setCallback(DSP_CALLBACK callback) + { + return FMOD5_DSP_SetCallback(this.handle, callback); + } + + // DSP parameter control. + public RESULT setParameterFloat(int index, float value) + { + return FMOD5_DSP_SetParameterFloat(this.handle, index, value); + } + public RESULT setParameterInt(int index, int value) + { + return FMOD5_DSP_SetParameterInt(this.handle, index, value); + } + public RESULT setParameterBool(int index, bool value) + { + return FMOD5_DSP_SetParameterBool(this.handle, index, value); + } + public RESULT setParameterData(int index, byte[] data) + { + return FMOD5_DSP_SetParameterData(this.handle, index, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0), (uint)data.Length); + } + public RESULT getParameterFloat(int index, out float value) + { + return FMOD5_DSP_GetParameterFloat(this.handle, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterInt(int index, out int value) + { + return FMOD5_DSP_GetParameterInt(this.handle, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterBool(int index, out bool value) + { + return FMOD5_DSP_GetParameterBool(this.handle, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterData(int index, out IntPtr data, out uint length) + { + return FMOD5_DSP_GetParameterData(this.handle, index, out data, out length, IntPtr.Zero, 0); + } + public RESULT getNumParameters(out int numparams) + { + return FMOD5_DSP_GetNumParameters(this.handle, out numparams); + } + public RESULT getParameterInfo(int index, out DSP_PARAMETER_DESC desc) + { + IntPtr descPtr; + RESULT result = FMOD5_DSP_GetParameterInfo(this.handle, index, out descPtr); + desc = (DSP_PARAMETER_DESC)MarshalHelper.PtrToStructure(descPtr, typeof(DSP_PARAMETER_DESC)); + return result; + } + public RESULT getDataParameterIndex(int datatype, out int index) + { + return FMOD5_DSP_GetDataParameterIndex(this.handle, datatype, out index); + } + public RESULT showConfigDialog(IntPtr hwnd, bool show) + { + return FMOD5_DSP_ShowConfigDialog(this.handle, hwnd, show); + } + + // DSP attributes. + public RESULT getInfo(out string name, out uint version, out int channels, out int configwidth, out int configheight) + { + IntPtr nameMem = Marshal.AllocHGlobal(32); + + RESULT result = FMOD5_DSP_GetInfo(this.handle, nameMem, out version, out channels, out configwidth, out configheight); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(nameMem); + } + Marshal.FreeHGlobal(nameMem); + return result; + } + public RESULT getInfo(out uint version, out int channels, out int configwidth, out int configheight) + { + return FMOD5_DSP_GetInfo(this.handle, IntPtr.Zero, out version, out channels, out configwidth, out configheight); ; + } + public RESULT getType(out DSP_TYPE type) + { + return FMOD5_DSP_GetType(this.handle, out type); + } + public RESULT getIdle(out bool idle) + { + return FMOD5_DSP_GetIdle(this.handle, out idle); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_DSP_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_DSP_GetUserData(this.handle, out userdata); + } + + // Metering. + public RESULT setMeteringEnabled(bool inputEnabled, bool outputEnabled) + { + return FMOD5_DSP_SetMeteringEnabled(this.handle, inputEnabled, outputEnabled); + } + public RESULT getMeteringEnabled(out bool inputEnabled, out bool outputEnabled) + { + return FMOD5_DSP_GetMeteringEnabled(this.handle, out inputEnabled, out outputEnabled); + } + + public RESULT getMeteringInfo(IntPtr zero, out DSP_METERING_INFO outputInfo) + { + return FMOD5_DSP_GetMeteringInfo(this.handle, zero, out outputInfo); + } + public RESULT getMeteringInfo(out DSP_METERING_INFO inputInfo, IntPtr zero) + { + return FMOD5_DSP_GetMeteringInfo(this.handle, out inputInfo, zero); + } + public RESULT getMeteringInfo(out DSP_METERING_INFO inputInfo, out DSP_METERING_INFO outputInfo) + { + return FMOD5_DSP_GetMeteringInfo(this.handle, out inputInfo, out outputInfo); + } + + public RESULT getCPUUsage(out uint exclusive, out uint inclusive) + { + return FMOD5_DSP_GetCPUUsage(this.handle, out exclusive, out inclusive); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_Release (IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetSystemObject (IntPtr dsp, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_AddInput (IntPtr dsp, IntPtr input, IntPtr zero, DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_AddInput (IntPtr dsp, IntPtr input, out IntPtr connection, DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_DisconnectFrom (IntPtr dsp, IntPtr target, IntPtr connection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_DisconnectAll (IntPtr dsp, bool inputs, bool outputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetNumInputs (IntPtr dsp, out int numinputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetNumOutputs (IntPtr dsp, out int numoutputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetInput (IntPtr dsp, int index, out IntPtr input, out IntPtr inputconnection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetOutput (IntPtr dsp, int index, out IntPtr output, out IntPtr outputconnection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetActive (IntPtr dsp, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetActive (IntPtr dsp, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetBypass (IntPtr dsp, bool bypass); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetBypass (IntPtr dsp, out bool bypass); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetWetDryMix (IntPtr dsp, float prewet, float postwet, float dry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetWetDryMix (IntPtr dsp, out float prewet, out float postwet, out float dry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetChannelFormat (IntPtr dsp, CHANNELMASK channelmask, int numchannels, SPEAKERMODE source_speakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetChannelFormat (IntPtr dsp, out CHANNELMASK channelmask, out int numchannels, out SPEAKERMODE source_speakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetOutputChannelFormat (IntPtr dsp, CHANNELMASK inmask, int inchannels, SPEAKERMODE inspeakermode, out CHANNELMASK outmask, out int outchannels, out SPEAKERMODE outspeakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_Reset (IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetCallback (IntPtr dsp, DSP_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterFloat (IntPtr dsp, int index, float value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterInt (IntPtr dsp, int index, int value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterBool (IntPtr dsp, int index, bool value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterData (IntPtr dsp, int index, IntPtr data, uint length); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterFloat (IntPtr dsp, int index, out float value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterInt (IntPtr dsp, int index, out int value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterBool (IntPtr dsp, int index, out bool value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterData (IntPtr dsp, int index, out IntPtr data, out uint length, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetNumParameters (IntPtr dsp, out int numparams); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterInfo (IntPtr dsp, int index, out IntPtr desc); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetDataParameterIndex (IntPtr dsp, int datatype, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_ShowConfigDialog (IntPtr dsp, IntPtr hwnd, bool show); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetInfo (IntPtr dsp, IntPtr name, out uint version, out int channels, out int configwidth, out int configheight); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetType (IntPtr dsp, out DSP_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetIdle (IntPtr dsp, out bool idle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetUserData (IntPtr dsp, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetUserData (IntPtr dsp, out IntPtr userdata); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_SetMeteringEnabled (IntPtr dsp, bool inputEnabled, bool outputEnabled); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringEnabled (IntPtr dsp, out bool inputEnabled, out bool outputEnabled); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, IntPtr zero, out DSP_METERING_INFO outputInfo); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, out DSP_METERING_INFO inputInfo, IntPtr zero); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, out DSP_METERING_INFO inputInfo, out DSP_METERING_INFO outputInfo); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetCPUUsage (IntPtr dsp, out uint exclusive, out uint inclusive); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public DSP(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'DSPConnection' API + */ + public struct DSPConnection + { + public RESULT getInput(out DSP input) + { + return FMOD5_DSPConnection_GetInput(this.handle, out input.handle); + } + public RESULT getOutput(out DSP output) + { + return FMOD5_DSPConnection_GetOutput(this.handle, out output.handle); + } + public RESULT setMix(float volume) + { + return FMOD5_DSPConnection_SetMix(this.handle, volume); + } + public RESULT getMix(out float volume) + { + return FMOD5_DSPConnection_GetMix(this.handle, out volume); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop = 0) + { + return FMOD5_DSPConnection_SetMixMatrix(this.handle, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop = 0) + { + return FMOD5_DSPConnection_GetMixMatrix(this.handle, matrix, out outchannels, out inchannels, inchannel_hop); + } + public RESULT getType(out DSPCONNECTION_TYPE type) + { + return FMOD5_DSPConnection_GetType(this.handle, out type); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_DSPConnection_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_DSPConnection_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetInput (IntPtr dspconnection, out IntPtr input); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetOutput (IntPtr dspconnection, out IntPtr output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_SetMix (IntPtr dspconnection, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetMix (IntPtr dspconnection, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_SetMixMatrix (IntPtr dspconnection, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetMixMatrix (IntPtr dspconnection, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetType (IntPtr dspconnection, out DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_SetUserData (IntPtr dspconnection, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetUserData (IntPtr dspconnection, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public DSPConnection(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'Geometry' API + */ + public struct Geometry + { + public RESULT release() + { + return FMOD5_Geometry_Release(this.handle); + } + + // Polygon manipulation. + public RESULT addPolygon(float directocclusion, float reverbocclusion, bool doublesided, int numvertices, VECTOR[] vertices, out int polygonindex) + { + return FMOD5_Geometry_AddPolygon(this.handle, directocclusion, reverbocclusion, doublesided, numvertices, vertices, out polygonindex); + } + public RESULT getNumPolygons(out int numpolygons) + { + return FMOD5_Geometry_GetNumPolygons(this.handle, out numpolygons); + } + public RESULT getMaxPolygons(out int maxpolygons, out int maxvertices) + { + return FMOD5_Geometry_GetMaxPolygons(this.handle, out maxpolygons, out maxvertices); + } + public RESULT getPolygonNumVertices(int index, out int numvertices) + { + return FMOD5_Geometry_GetPolygonNumVertices(this.handle, index, out numvertices); + } + public RESULT setPolygonVertex(int index, int vertexindex, ref VECTOR vertex) + { + return FMOD5_Geometry_SetPolygonVertex(this.handle, index, vertexindex, ref vertex); + } + public RESULT getPolygonVertex(int index, int vertexindex, out VECTOR vertex) + { + return FMOD5_Geometry_GetPolygonVertex(this.handle, index, vertexindex, out vertex); + } + public RESULT setPolygonAttributes(int index, float directocclusion, float reverbocclusion, bool doublesided) + { + return FMOD5_Geometry_SetPolygonAttributes(this.handle, index, directocclusion, reverbocclusion, doublesided); + } + public RESULT getPolygonAttributes(int index, out float directocclusion, out float reverbocclusion, out bool doublesided) + { + return FMOD5_Geometry_GetPolygonAttributes(this.handle, index, out directocclusion, out reverbocclusion, out doublesided); + } + + // Object manipulation. + public RESULT setActive(bool active) + { + return FMOD5_Geometry_SetActive(this.handle, active); + } + public RESULT getActive(out bool active) + { + return FMOD5_Geometry_GetActive(this.handle, out active); + } + public RESULT setRotation(ref VECTOR forward, ref VECTOR up) + { + return FMOD5_Geometry_SetRotation(this.handle, ref forward, ref up); + } + public RESULT getRotation(out VECTOR forward, out VECTOR up) + { + return FMOD5_Geometry_GetRotation(this.handle, out forward, out up); + } + public RESULT setPosition(ref VECTOR position) + { + return FMOD5_Geometry_SetPosition(this.handle, ref position); + } + public RESULT getPosition(out VECTOR position) + { + return FMOD5_Geometry_GetPosition(this.handle, out position); + } + public RESULT setScale(ref VECTOR scale) + { + return FMOD5_Geometry_SetScale(this.handle, ref scale); + } + public RESULT getScale(out VECTOR scale) + { + return FMOD5_Geometry_GetScale(this.handle, out scale); + } + public RESULT save(IntPtr data, out int datasize) + { + return FMOD5_Geometry_Save(this.handle, data, out datasize); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Geometry_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Geometry_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_Release (IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_AddPolygon (IntPtr geometry, float directocclusion, float reverbocclusion, bool doublesided, int numvertices, VECTOR[] vertices, out int polygonindex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetNumPolygons (IntPtr geometry, out int numpolygons); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetMaxPolygons (IntPtr geometry, out int maxpolygons, out int maxvertices); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPolygonNumVertices(IntPtr geometry, int index, out int numvertices); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetPolygonVertex (IntPtr geometry, int index, int vertexindex, ref VECTOR vertex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPolygonVertex (IntPtr geometry, int index, int vertexindex, out VECTOR vertex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetPolygonAttributes (IntPtr geometry, int index, float directocclusion, float reverbocclusion, bool doublesided); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPolygonAttributes (IntPtr geometry, int index, out float directocclusion, out float reverbocclusion, out bool doublesided); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetActive (IntPtr geometry, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetActive (IntPtr geometry, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetRotation (IntPtr geometry, ref VECTOR forward, ref VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetRotation (IntPtr geometry, out VECTOR forward, out VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetPosition (IntPtr geometry, ref VECTOR position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPosition (IntPtr geometry, out VECTOR position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetScale (IntPtr geometry, ref VECTOR scale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetScale (IntPtr geometry, out VECTOR scale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_Save (IntPtr geometry, IntPtr data, out int datasize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetUserData (IntPtr geometry, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetUserData (IntPtr geometry, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public Geometry(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'Reverb3D' API + */ + public struct Reverb3D + { + public RESULT release() + { + return FMOD5_Reverb3D_Release(this.handle); + } + + // Reverb manipulation. + public RESULT set3DAttributes(ref VECTOR position, float mindistance, float maxdistance) + { + return FMOD5_Reverb3D_Set3DAttributes(this.handle, ref position, mindistance, maxdistance); + } + public RESULT get3DAttributes(ref VECTOR position, ref float mindistance, ref float maxdistance) + { + return FMOD5_Reverb3D_Get3DAttributes(this.handle, ref position, ref mindistance, ref maxdistance); + } + public RESULT setProperties(ref REVERB_PROPERTIES properties) + { + return FMOD5_Reverb3D_SetProperties(this.handle, ref properties); + } + public RESULT getProperties(ref REVERB_PROPERTIES properties) + { + return FMOD5_Reverb3D_GetProperties(this.handle, ref properties); + } + public RESULT setActive(bool active) + { + return FMOD5_Reverb3D_SetActive(this.handle, active); + } + public RESULT getActive(out bool active) + { + return FMOD5_Reverb3D_GetActive(this.handle, out active); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Reverb3D_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Reverb3D_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_Release (IntPtr reverb3d); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_Set3DAttributes (IntPtr reverb3d, ref VECTOR position, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_Get3DAttributes (IntPtr reverb3d, ref VECTOR position, ref float mindistance, ref float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_SetProperties (IntPtr reverb3d, ref REVERB_PROPERTIES properties); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_GetProperties (IntPtr reverb3d, ref REVERB_PROPERTIES properties); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_SetActive (IntPtr reverb3d, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_GetActive (IntPtr reverb3d, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_SetUserData (IntPtr reverb3d, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_GetUserData (IntPtr reverb3d, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public Reverb3D(IntPtr ptr) { this.handle = ptr; } + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + #region Helper Functions + [StructLayout(LayoutKind.Sequential)] + public struct StringWrapper + { + IntPtr nativeUtf8Ptr; + + public StringWrapper(IntPtr ptr) + { + nativeUtf8Ptr = ptr; + } + + public static implicit operator string(StringWrapper fstring) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return encoder.stringFromNative(fstring.nativeUtf8Ptr); + } + } + + public bool StartsWith(byte[] prefix) + { + if (nativeUtf8Ptr == IntPtr.Zero) + { + return false; + } + + for (int i = 0; i < prefix.Length; i++) + { + if (Marshal.ReadByte(nativeUtf8Ptr, i) != prefix[i]) + { + return false; + } + } + + return true; + } + + public bool Equals(byte[] comparison) + { + if (nativeUtf8Ptr == IntPtr.Zero) + { + return false; + } + + for (int i = 0; i < comparison.Length; i++) + { + if (Marshal.ReadByte(nativeUtf8Ptr, i) != comparison[i]) + { + return false; + } + } + + if (Marshal.ReadByte(nativeUtf8Ptr, comparison.Length) != 0) + { + return false; + } + + return true; + } + } + + static class StringHelper + { + public class ThreadSafeEncoding : IDisposable + { + UTF8Encoding encoding = new UTF8Encoding(); + byte[] encodedBuffer = new byte[128]; + char[] decodedBuffer = new char[128]; + bool inUse; + GCHandle gcHandle; + + public bool InUse() { return inUse; } + public void SetInUse() { inUse = true; } + + private int roundUpPowerTwo(int number) + { + int newNumber = 1; + while (newNumber <= number) + { + newNumber *= 2; + } + + return newNumber; + } + + public byte[] byteFromStringUTF8(string s) + { + if (s == null) + { + return null; + } + + int maximumLength = encoding.GetMaxByteCount(s.Length) + 1; // +1 for null terminator + if (maximumLength > encodedBuffer.Length) + { + int encodedLength = encoding.GetByteCount(s) + 1; // +1 for null terminator + if (encodedLength > encodedBuffer.Length) + { + encodedBuffer = new byte[roundUpPowerTwo(encodedLength)]; + } + } + + int byteCount = encoding.GetBytes(s, 0, s.Length, encodedBuffer, 0); + encodedBuffer[byteCount] = 0; // Apply null terminator + + return encodedBuffer; + } + + public IntPtr intptrFromStringUTF8(string s) + { + if (s == null) + { + return IntPtr.Zero; + } + + gcHandle = GCHandle.Alloc(byteFromStringUTF8(s), GCHandleType.Pinned); + return gcHandle.AddrOfPinnedObject(); + } + + public string stringFromNative(IntPtr nativePtr) + { + if (nativePtr == IntPtr.Zero) + { + return ""; + } + + int nativeLen = 0; + while (Marshal.ReadByte(nativePtr, nativeLen) != 0) + { + nativeLen++; + } + + if (nativeLen == 0) + { + return ""; + } + + if (nativeLen > encodedBuffer.Length) + { + encodedBuffer = new byte[roundUpPowerTwo(nativeLen)]; + } + + Marshal.Copy(nativePtr, encodedBuffer, 0, nativeLen); + + int maximumLength = encoding.GetMaxCharCount(nativeLen); + if (maximumLength > decodedBuffer.Length) + { + int decodedLength = encoding.GetCharCount(encodedBuffer, 0, nativeLen); + if (decodedLength > decodedBuffer.Length) + { + decodedBuffer = new char[roundUpPowerTwo(decodedLength)]; + } + } + + int charCount = encoding.GetChars(encodedBuffer, 0, nativeLen, decodedBuffer, 0); + + return new String(decodedBuffer, 0, charCount); + } + + public void Dispose() + { + if (gcHandle.IsAllocated) + { + gcHandle.Free(); + } + lock (encoders) + { + inUse = false; + } + } + } + + static List encoders = new List(1); + + public static ThreadSafeEncoding GetFreeHelper() + { + lock (encoders) + { + ThreadSafeEncoding helper = null; + // Search for not in use helper + for (int i = 0; i < encoders.Count; i++) + { + if (!encoders[i].InUse()) + { + helper = encoders[i]; + break; + } + } + // Otherwise create another helper + if (helper == null) + { + helper = new ThreadSafeEncoding(); + encoders.Add(helper); + } + helper.SetInUse(); + return helper; + } + } + } + + // Some of the Marshal functions were marked as deprecated / obsolete, however that decision was reversed: https://github.com/dotnet/corefx/pull/10541 + // Use the old syntax (non-generic) to ensure maximum compatibility (especially with Unity) ignoring the warnings + public static class MarshalHelper + { +#pragma warning disable 618 + public static int SizeOf(Type t) + { + return Marshal.SizeOf(t); // Always use Type version, never Object version as it boxes causes GC allocations + } + + public static object PtrToStructure(IntPtr ptr, Type structureType) + { + return Marshal.PtrToStructure(ptr, structureType); + } +#pragma warning restore 618 + } + + #endregion +} diff --git a/Qwilight/FMOD/fmod_dsp.cs b/Qwilight/FMOD/fmod_dsp.cs new file mode 100644 index 0000000..537fe5c --- /dev/null +++ b/Qwilight/FMOD/fmod_dsp.cs @@ -0,0 +1,897 @@ +/* ======================================================================================== */ +/* FMOD Core API - DSP header file. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ +/* */ +/* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */ +/* dsp system. With this header you can make your own DSP plugin that FMOD can */ +/* register and use. See the documentation and examples on how to make a working plugin. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/docs/2.02/api/plugin-api-dsp.html */ +/* =========================================================================================*/ + +using System; +using System.Text; +using System.Runtime.InteropServices; + +namespace FMOD +{ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_BUFFER_ARRAY + { + public int numbuffers; + public int[] buffernumchannels; + public CHANNELMASK[] bufferchannelmask; + public IntPtr[] buffers; + public SPEAKERMODE speakermode; + } + + public enum DSP_PROCESS_OPERATION + { + PROCESS_PERFORM = 0, + PROCESS_QUERY + } + + [StructLayout(LayoutKind.Sequential)] + public struct COMPLEX + { + public float real; + public float imag; + } + + public enum DSP_PAN_SURROUND_FLAGS + { + DEFAULT = 0, + ROTATION_NOT_BIASED = 1, + } + + + /* + DSP callbacks + */ + public delegate RESULT DSP_CREATE_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_RELEASE_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_RESET_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SETPOSITION_CALLBACK (ref DSP_STATE dsp_state, uint pos); + public delegate RESULT DSP_READ_CALLBACK (ref DSP_STATE dsp_state, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, ref int outchannels); + public delegate RESULT DSP_SHOULDIPROCESS_CALLBACK (ref DSP_STATE dsp_state, bool inputsidle, uint length, CHANNELMASK inmask, int inchannels, SPEAKERMODE speakermode); + public delegate RESULT DSP_PROCESS_CALLBACK (ref DSP_STATE dsp_state, uint length, ref DSP_BUFFER_ARRAY inbufferarray, ref DSP_BUFFER_ARRAY outbufferarray, bool inputsidle, DSP_PROCESS_OPERATION op); + public delegate RESULT DSP_SETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, float value); + public delegate RESULT DSP_SETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, int value); + public delegate RESULT DSP_SETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, bool value); + public delegate RESULT DSP_SETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, IntPtr data, uint length); + public delegate RESULT DSP_GETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, ref float value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, ref int value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, ref bool value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, ref IntPtr data, ref uint length, IntPtr valuestr); + public delegate RESULT DSP_SYSTEM_REGISTER_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SYSTEM_DEREGISTER_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SYSTEM_MIX_CALLBACK (ref DSP_STATE dsp_state, int stage); + + + /* + DSP functions + */ + public delegate IntPtr DSP_ALLOC_FUNC (uint size, MEMORY_TYPE type, IntPtr sourcestr); + public delegate IntPtr DSP_REALLOC_FUNC (IntPtr ptr, uint size, MEMORY_TYPE type, IntPtr sourcestr); + public delegate void DSP_FREE_FUNC (IntPtr ptr, MEMORY_TYPE type, IntPtr sourcestr); + public delegate void DSP_LOG_FUNC (DEBUG_FLAGS level, IntPtr file, int line, IntPtr function, IntPtr str); + public delegate RESULT DSP_GETSAMPLERATE_FUNC (ref DSP_STATE dsp_state, ref int rate); + public delegate RESULT DSP_GETBLOCKSIZE_FUNC (ref DSP_STATE dsp_state, ref uint blocksize); + public delegate RESULT DSP_GETSPEAKERMODE_FUNC (ref DSP_STATE dsp_state, ref int speakermode_mixer, ref int speakermode_output); + public delegate RESULT DSP_GETCLOCK_FUNC (ref DSP_STATE dsp_state, out ulong clock, out uint offset, out uint length); + public delegate RESULT DSP_GETLISTENERATTRIBUTES_FUNC (ref DSP_STATE dsp_state, ref int numlisteners, IntPtr attributes); + public delegate RESULT DSP_GETUSERDATA_FUNC (ref DSP_STATE dsp_state, out IntPtr userdata); + public delegate RESULT DSP_DFT_FFTREAL_FUNC (ref DSP_STATE dsp_state, int size, IntPtr signal, IntPtr dft, IntPtr window, int signalhop); + public delegate RESULT DSP_DFT_IFFTREAL_FUNC (ref DSP_STATE dsp_state, int size, IntPtr dft, IntPtr signal, IntPtr window, int signalhop); + public delegate RESULT DSP_PAN_SUMMONOMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, float lowFrequencyGain, float overallGain, IntPtr matrix); + public delegate RESULT DSP_PAN_SUMSTEREOMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, float pan, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_SUMSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix, DSP_PAN_SURROUND_FLAGS flags); + public delegate RESULT DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_GETROLLOFFGAIN_FUNC (ref DSP_STATE dsp_state, DSP_PAN_3D_ROLLOFF_TYPE rolloff, float distance, float mindistance, float maxdistance, out float gain); + + + public enum DSP_TYPE : int + { + UNKNOWN, + MIXER, + OSCILLATOR, + LOWPASS, + ITLOWPASS, + HIGHPASS, + ECHO, + FADER, + FLANGE, + DISTORTION, + NORMALIZE, + LIMITER, + PARAMEQ, + PITCHSHIFT, + CHORUS, + VSTPLUGIN, + WINAMPPLUGIN, + ITECHO, + COMPRESSOR, + SFXREVERB, + LOWPASS_SIMPLE, + DELAY, + TREMOLO, + LADSPAPLUGIN, + SEND, + RETURN, + HIGHPASS_SIMPLE, + PAN, + THREE_EQ, + FFT, + LOUDNESS_METER, + ENVELOPEFOLLOWER, + CONVOLUTIONREVERB, + CHANNELMIX, + TRANSCEIVER, + OBJECTPAN, + MULTIBAND_EQ, + MAX + } + + public enum DSP_PARAMETER_TYPE + { + FLOAT = 0, + INT, + BOOL, + DATA, + MAX + } + + public enum DSP_PARAMETER_FLOAT_MAPPING_TYPE + { + DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR = 0, + DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO, + DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR, + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR + { + public int numpoints; + public IntPtr pointparamvalues; + public IntPtr pointpositions; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FLOAT_MAPPING + { + public DSP_PARAMETER_FLOAT_MAPPING_TYPE type; + public DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping; + } + + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_FLOAT + { + public float min; + public float max; + public float defaultval; + public DSP_PARAMETER_FLOAT_MAPPING mapping; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_INT + { + public int min; + public int max; + public int defaultval; + public bool goestoinf; + public IntPtr valuenames; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_BOOL + { + public bool defaultval; + public IntPtr valuenames; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_DATA + { + public int datatype; + } + + [StructLayout(LayoutKind.Explicit)] + public struct DSP_PARAMETER_DESC_UNION + { + [FieldOffset(0)] + public DSP_PARAMETER_DESC_FLOAT floatdesc; + [FieldOffset(0)] + public DSP_PARAMETER_DESC_INT intdesc; + [FieldOffset(0)] + public DSP_PARAMETER_DESC_BOOL booldesc; + [FieldOffset(0)] + public DSP_PARAMETER_DESC_DATA datadesc; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC + { + public DSP_PARAMETER_TYPE type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] label; + public string description; + + public DSP_PARAMETER_DESC_UNION desc; + } + + public enum DSP_PARAMETER_DATA_TYPE + { + DSP_PARAMETER_DATA_TYPE_USER = 0, + DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1, + DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2, + DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3, + DSP_PARAMETER_DATA_TYPE_FFT = -4, + DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5, + DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6 + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_OVERALLGAIN + { + public float linear_gain; + public float linear_gain_additive; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_3DATTRIBUTES + { + public ATTRIBUTES_3D relative; + public ATTRIBUTES_3D absolute; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_3DATTRIBUTES_MULTI + { + public int numlisteners; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public ATTRIBUTES_3D[] relative; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public float[] weight; + public ATTRIBUTES_3D absolute; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_SIDECHAIN + { + public int sidechainenable; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FFT + { + public int length; + public int numchannels; + + [MarshalAs(UnmanagedType.ByValArray,SizeConst=32)] + private IntPtr[] spectrum_internal; + + public float[][] spectrum + { + get + { + var buffer = new float[numchannels][]; + + for (int i = 0; i < numchannels; ++i) + { + buffer[i] = new float[length]; + Marshal.Copy(spectrum_internal[i], buffer[i], 0, length); + } + + return buffer; + } + } + + public void getSpectrum(ref float[][] buffer) + { + int bufferLength = Math.Min(buffer.Length, numchannels); + for (int i = 0; i < bufferLength; ++i) + { + getSpectrum(i, ref buffer[i]); + } + } + + public void getSpectrum(int channel, ref float[] buffer) + { + int bufferLength = Math.Min(buffer.Length, length); + Marshal.Copy(spectrum_internal[channel], buffer, 0, bufferLength); + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_LOUDNESS_METER_INFO_TYPE + { + public float momentaryloudness; + public float shorttermloudness; + public float integratedloudness; + public float loudness10thpercentile; + public float loudness95thpercentile; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 66)] + public float[] loudnesshistogram; + public float maxtruepeak; + public float maxmomentaryloudness; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_LOUDNESS_METER_WEIGHTING_TYPE + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public float[] channelweight; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_ATTENUATION_RANGE + { + public float min; + public float max; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_DESCRIPTION + { + public uint pluginsdkversion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] name; + public uint version; + public int numinputbuffers; + public int numoutputbuffers; + public DSP_CREATE_CALLBACK create; + public DSP_RELEASE_CALLBACK release; + public DSP_RESET_CALLBACK reset; + public DSP_READ_CALLBACK read; + public DSP_PROCESS_CALLBACK process; + public DSP_SETPOSITION_CALLBACK setposition; + + public int numparameters; + public IntPtr paramdesc; + public DSP_SETPARAM_FLOAT_CALLBACK setparameterfloat; + public DSP_SETPARAM_INT_CALLBACK setparameterint; + public DSP_SETPARAM_BOOL_CALLBACK setparameterbool; + public DSP_SETPARAM_DATA_CALLBACK setparameterdata; + public DSP_GETPARAM_FLOAT_CALLBACK getparameterfloat; + public DSP_GETPARAM_INT_CALLBACK getparameterint; + public DSP_GETPARAM_BOOL_CALLBACK getparameterbool; + public DSP_GETPARAM_DATA_CALLBACK getparameterdata; + public DSP_SHOULDIPROCESS_CALLBACK shouldiprocess; + public IntPtr userdata; + + public DSP_SYSTEM_REGISTER_CALLBACK sys_register; + public DSP_SYSTEM_DEREGISTER_CALLBACK sys_deregister; + public DSP_SYSTEM_MIX_CALLBACK sys_mix; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_DFT_FUNCTIONS + { + public DSP_DFT_FFTREAL_FUNC fftreal; + public DSP_DFT_IFFTREAL_FUNC inversefftreal; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_PAN_FUNCTIONS + { + public DSP_PAN_SUMMONOMATRIX_FUNC summonomatrix; + public DSP_PAN_SUMSTEREOMATRIX_FUNC sumstereomatrix; + public DSP_PAN_SUMSURROUNDMATRIX_FUNC sumsurroundmatrix; + public DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC summonotosurroundmatrix; + public DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC sumstereotosurroundmatrix; + public DSP_PAN_GETROLLOFFGAIN_FUNC getrolloffgain; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_FUNCTIONS + { + public DSP_ALLOC_FUNC alloc; + public DSP_REALLOC_FUNC realloc; + public DSP_FREE_FUNC free; + public DSP_GETSAMPLERATE_FUNC getsamplerate; + public DSP_GETBLOCKSIZE_FUNC getblocksize; + public IntPtr dft; + public IntPtr pan; + public DSP_GETSPEAKERMODE_FUNC getspeakermode; + public DSP_GETCLOCK_FUNC getclock; + public DSP_GETLISTENERATTRIBUTES_FUNC getlistenerattributes; + public DSP_LOG_FUNC log; + public DSP_GETUSERDATA_FUNC getuserdata; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE + { + public IntPtr instance; + public IntPtr plugindata; + public uint channelmask; + public int source_speakermode; + public IntPtr sidechaindata; + public int sidechainchannels; + public IntPtr functions; + public int systemobject; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_METERING_INFO + { + public int numsamples; + [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] + public float[] peaklevel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] + public float[] rmslevel; + public short numchannels; + } + + /* + ============================================================================================================== + + FMOD built in effect parameters. + Use DSP::setParameter with these enums for the 'index' parameter. + + ============================================================================================================== + */ + + public enum DSP_OSCILLATOR : int + { + TYPE, + RATE + } + + public enum DSP_LOWPASS : int + { + CUTOFF, + RESONANCE + } + + public enum DSP_ITLOWPASS : int + { + CUTOFF, + RESONANCE + } + + public enum DSP_HIGHPASS : int + { + CUTOFF, + RESONANCE + } + + public enum DSP_ECHO : int + { + DELAY, + FEEDBACK, + DRYLEVEL, + WETLEVEL + } + + public enum DSP_FADER : int + { + GAIN, + OVERALL_GAIN, + } + + public enum DSP_DELAY : int + { + CH0, + CH1, + CH2, + CH3, + CH4, + CH5, + CH6, + CH7, + CH8, + CH9, + CH10, + CH11, + CH12, + CH13, + CH14, + CH15, + MAXDELAY, + } + + public enum DSP_FLANGE : int + { + MIX, + DEPTH, + RATE + } + + public enum DSP_TREMOLO : int + { + FREQUENCY, + DEPTH, + SHAPE, + SKEW, + DUTY, + SQUARE, + PHASE, + SPREAD + } + + public enum DSP_DISTORTION : int + { + LEVEL + } + + public enum DSP_NORMALIZE : int + { + FADETIME, + THRESHOLD, + MAXAMP + } + + public enum DSP_LIMITER : int + { + RELEASETIME, + CEILING, + MAXIMIZERGAIN, + MODE, + } + + public enum DSP_PARAMEQ : int + { + CENTER, + BANDWIDTH, + GAIN + } + + public enum DSP_MULTIBAND_EQ : int + { + A_FILTER, + A_FREQUENCY, + A_Q, + A_GAIN, + B_FILTER, + B_FREQUENCY, + B_Q, + B_GAIN, + C_FILTER, + C_FREQUENCY, + C_Q, + C_GAIN, + D_FILTER, + D_FREQUENCY, + D_Q, + D_GAIN, + E_FILTER, + E_FREQUENCY, + E_Q, + E_GAIN, + } + + public enum DSP_MULTIBAND_EQ_FILTER_TYPE : int + { + DISABLED, + LOWPASS_12DB, + LOWPASS_24DB, + LOWPASS_48DB, + HIGHPASS_12DB, + HIGHPASS_24DB, + HIGHPASS_48DB, + LOWSHELF, + HIGHSHELF, + PEAKING, + BANDPASS, + NOTCH, + ALLPASS, + } + + public enum DSP_PITCHSHIFT : int + { + PITCH, + FFTSIZE, + OVERLAP, + MAXCHANNELS + } + + public enum DSP_CHORUS : int + { + MIX, + RATE, + DEPTH, + } + + public enum DSP_ITECHO : int + { + WETDRYMIX, + FEEDBACK, + LEFTDELAY, + RIGHTDELAY, + PANDELAY + } + + public enum DSP_COMPRESSOR : int + { + THRESHOLD, + RATIO, + ATTACK, + RELEASE, + GAINMAKEUP, + USESIDECHAIN, + LINKED + } + + public enum DSP_SFXREVERB : int + { + DECAYTIME, + EARLYDELAY, + LATEDELAY, + HFREFERENCE, + HFDECAYRATIO, + DIFFUSION, + DENSITY, + LOWSHELFFREQUENCY, + LOWSHELFGAIN, + HIGHCUT, + EARLYLATEMIX, + WETLEVEL, + DRYLEVEL + } + + public enum DSP_LOWPASS_SIMPLE : int + { + CUTOFF + } + + public enum DSP_SEND : int + { + RETURNID, + LEVEL, + } + + public enum DSP_RETURN : int + { + ID, + INPUT_SPEAKER_MODE + } + + public enum DSP_HIGHPASS_SIMPLE : int + { + CUTOFF + } + + public enum DSP_PAN_2D_STEREO_MODE_TYPE : int + { + DISTRIBUTED, + DISCRETE + } + + public enum DSP_PAN_MODE_TYPE : int + { + MONO, + STEREO, + SURROUND + } + + public enum DSP_PAN_3D_ROLLOFF_TYPE : int + { + LINEARSQUARED, + LINEAR, + INVERSE, + INVERSETAPERED, + CUSTOM + } + + public enum DSP_PAN_3D_EXTENT_MODE_TYPE : int + { + AUTO, + USER, + OFF + } + + public enum DSP_PAN : int + { + MODE, + _2D_STEREO_POSITION, + _2D_DIRECTION, + _2D_EXTENT, + _2D_ROTATION, + _2D_LFE_LEVEL, + _2D_STEREO_MODE, + _2D_STEREO_SEPARATION, + _2D_STEREO_AXIS, + ENABLED_SPEAKERS, + _3D_POSITION, + _3D_ROLLOFF, + _3D_MIN_DISTANCE, + _3D_MAX_DISTANCE, + _3D_EXTENT_MODE, + _3D_SOUND_SIZE, + _3D_MIN_EXTENT, + _3D_PAN_BLEND, + LFE_UPMIX_ENABLED, + OVERALL_GAIN, + SURROUND_SPEAKER_MODE, + _2D_HEIGHT_BLEND, + ATTENUATION_RANGE, + OVERRIDE_RANGE + } + + public enum DSP_THREE_EQ_CROSSOVERSLOPE_TYPE : int + { + _12DB, + _24DB, + _48DB + } + + public enum DSP_THREE_EQ : int + { + LOWGAIN, + MIDGAIN, + HIGHGAIN, + LOWCROSSOVER, + HIGHCROSSOVER, + CROSSOVERSLOPE + } + + public enum DSP_FFT_WINDOW : int + { + RECT, + TRIANGLE, + HAMMING, + HANNING, + BLACKMAN, + BLACKMANHARRIS + } + + public enum DSP_FFT : int + { + WINDOWSIZE, + WINDOWTYPE, + SPECTRUMDATA, + DOMINANT_FREQ + } + + + public enum DSP_LOUDNESS_METER : int + { + STATE, + WEIGHTING, + INFO + } + + + public enum DSP_LOUDNESS_METER_STATE_TYPE : int + { + RESET_INTEGRATED = -3, + RESET_MAXPEAK = -2, + RESET_ALL = -1, + PAUSED = 0, + ANALYZING = 1 + } + + public enum DSP_ENVELOPEFOLLOWER : int + { + ATTACK, + RELEASE, + ENVELOPE, + USESIDECHAIN + } + + public enum DSP_CONVOLUTION_REVERB : int + { + IR, + WET, + DRY, + LINKED + } + + public enum DSP_CHANNELMIX_OUTPUT : int + { + DEFAULT, + ALLMONO, + ALLSTEREO, + ALLQUAD, + ALL5POINT1, + ALL7POINT1, + ALLLFE, + ALL7POINT1POINT4 + } + + public enum DSP_CHANNELMIX : int + { + OUTPUTGROUPING, + GAIN_CH0, + GAIN_CH1, + GAIN_CH2, + GAIN_CH3, + GAIN_CH4, + GAIN_CH5, + GAIN_CH6, + GAIN_CH7, + GAIN_CH8, + GAIN_CH9, + GAIN_CH10, + GAIN_CH11, + GAIN_CH12, + GAIN_CH13, + GAIN_CH14, + GAIN_CH15, + GAIN_CH16, + GAIN_CH17, + GAIN_CH18, + GAIN_CH19, + GAIN_CH20, + GAIN_CH21, + GAIN_CH22, + GAIN_CH23, + GAIN_CH24, + GAIN_CH25, + GAIN_CH26, + GAIN_CH27, + GAIN_CH28, + GAIN_CH29, + GAIN_CH30, + GAIN_CH31, + OUTPUT_CH0, + OUTPUT_CH1, + OUTPUT_CH2, + OUTPUT_CH3, + OUTPUT_CH4, + OUTPUT_CH5, + OUTPUT_CH6, + OUTPUT_CH7, + OUTPUT_CH8, + OUTPUT_CH9, + OUTPUT_CH10, + OUTPUT_CH11, + OUTPUT_CH12, + OUTPUT_CH13, + OUTPUT_CH14, + OUTPUT_CH15, + OUTPUT_CH16, + OUTPUT_CH17, + OUTPUT_CH18, + OUTPUT_CH19, + OUTPUT_CH20, + OUTPUT_CH21, + OUTPUT_CH22, + OUTPUT_CH23, + OUTPUT_CH24, + OUTPUT_CH25, + OUTPUT_CH26, + OUTPUT_CH27, + OUTPUT_CH28, + OUTPUT_CH29, + OUTPUT_CH30, + OUTPUT_CH31, + } + + public enum DSP_TRANSCEIVER_SPEAKERMODE : int + { + AUTO = -1, + MONO = 0, + STEREO, + SURROUND, + } + + public enum DSP_TRANSCEIVER : int + { + TRANSMIT, + GAIN, + CHANNEL, + TRANSMITSPEAKERMODE + } + + public enum DSP_OBJECTPAN : int + { + _3D_POSITION, + _3D_ROLLOFF, + _3D_MIN_DISTANCE, + _3D_MAX_DISTANCE, + _3D_EXTENT_MODE, + _3D_SOUND_SIZE, + _3D_MIN_EXTENT, + OVERALL_GAIN, + OUTPUTGAIN, + ATTENUATION_RANGE, + OVERRIDE_RANGE + } +} diff --git a/Qwilight/FMOD/fmod_errors.cs b/Qwilight/FMOD/fmod_errors.cs new file mode 100644 index 0000000..63f3140 --- /dev/null +++ b/Qwilight/FMOD/fmod_errors.cs @@ -0,0 +1,106 @@ +/* ============================================================================================== */ +/* FMOD Core / Studio API - Error string header file. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ +/* */ +/* Use this header if you want to store or display a string version / english explanation */ +/* of the FMOD error codes. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/docs/2.02/api/core-api-common.html#fmod_result */ +/* =============================================================================================== */ + +namespace FMOD +{ + public class Error + { + public static string String(FMOD.RESULT errcode) + { + switch (errcode) + { + case FMOD.RESULT.OK: return "No errors."; + case FMOD.RESULT.ERR_BADCOMMAND: return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound)."; + case FMOD.RESULT.ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel."; + case FMOD.RESULT.ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound."; + case FMOD.RESULT.ERR_DMA: return "DMA Failure. See debug output for more information."; + case FMOD.RESULT.ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts."; + case FMOD.RESULT.ERR_DSP_DONTPROCESS: return "DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph."; + case FMOD.RESULT.ERR_DSP_FORMAT: return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map."; + case FMOD.RESULT.ERR_DSP_INUSE: return "DSP is already in the mixer's DSP network. It must be removed before being reinserted or released."; + case FMOD.RESULT.ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified."; + case FMOD.RESULT.ERR_DSP_RESERVED: return "DSP operation error. Cannot perform operation on this DSP as it is reserved by the system."; + case FMOD.RESULT.ERR_DSP_SILENCE: return "DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph."; + case FMOD.RESULT.ERR_DSP_TYPE: return "DSP operation cannot be performed on a DSP of this type."; + case FMOD.RESULT.ERR_FILE_BAD: return "Error loading file."; + case FMOD.RESULT.ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format."; + case FMOD.RESULT.ERR_FILE_DISKEJECTED: return "Media was ejected while reading."; + case FMOD.RESULT.ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated?)."; + case FMOD.RESULT.ERR_FILE_ENDOFDATA: return "End of current chunk reached while trying to read data."; + case FMOD.RESULT.ERR_FILE_NOTFOUND: return "File not found."; + case FMOD.RESULT.ERR_FORMAT: return "Unsupported file or audio format."; + case FMOD.RESULT.ERR_HEADER_MISMATCH: return "There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library."; + case FMOD.RESULT.ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere."; + case FMOD.RESULT.ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden."; + case FMOD.RESULT.ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource."; + case FMOD.RESULT.ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred."; + case FMOD.RESULT.ERR_HTTP_TIMEOUT: return "The HTTP request timed out."; + case FMOD.RESULT.ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function."; + case FMOD.RESULT.ERR_INITIALIZED: return "Cannot call this command after System::init."; + case FMOD.RESULT.ERR_INTERNAL: return "An error occurred that wasn't supposed to. Contact support."; + case FMOD.RESULT.ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float."; + case FMOD.RESULT.ERR_INVALID_HANDLE: return "An invalid object handle was used."; + case FMOD.RESULT.ERR_INVALID_PARAM: return "An invalid parameter was passed to this function."; + case FMOD.RESULT.ERR_INVALID_POSITION: return "An invalid seek position was passed to this function."; + case FMOD.RESULT.ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode."; + case FMOD.RESULT.ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle."; + case FMOD.RESULT.ERR_INVALID_THREAD: return "Tried to call a function on a thread that is not supported."; + case FMOD.RESULT.ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular."; + case FMOD.RESULT.ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup."; + case FMOD.RESULT.ERR_MEMORY: return "Not enough memory or resources."; + case FMOD.RESULT.ERR_MEMORY_CANTPOINT: return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used."; + case FMOD.RESULT.ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound."; + case FMOD.RESULT.ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support."; + case FMOD.RESULT.ERR_NET_CONNECT: return "Couldn't connect to the specified host."; + case FMOD.RESULT.ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere."; + case FMOD.RESULT.ERR_NET_URL: return "The specified URL couldn't be resolved."; + case FMOD.RESULT.ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately."; + case FMOD.RESULT.ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready."; + case FMOD.RESULT.ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused."; + case FMOD.RESULT.ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer."; + case FMOD.RESULT.ERR_OUTPUT_DRIVERCALL: return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted."; + case FMOD.RESULT.ERR_OUTPUT_FORMAT: return "Soundcard does not support the specified format."; + case FMOD.RESULT.ERR_OUTPUT_INIT: return "Error initializing output device."; + case FMOD.RESULT.ERR_OUTPUT_NODRIVERS: return "The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails."; + case FMOD.RESULT.ERR_PLUGIN: return "An unspecified error has been returned from a plugin."; + case FMOD.RESULT.ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available."; + case FMOD.RESULT.ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be allocated or found. (ie the DLS file for MIDI playback)"; + case FMOD.RESULT.ERR_PLUGIN_VERSION: return "A plugin was built with an unsupported SDK version."; + case FMOD.RESULT.ERR_RECORD: return "An error occurred trying to initialize the recording device."; + case FMOD.RESULT.ERR_REVERB_CHANNELGROUP: return "Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection."; + case FMOD.RESULT.ERR_REVERB_INSTANCE: return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist."; + case FMOD.RESULT.ERR_SUBSOUNDS: return "The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound."; + case FMOD.RESULT.ERR_SUBSOUND_ALLOCATED: return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first."; + case FMOD.RESULT.ERR_SUBSOUND_CANTMOVE: return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file."; + case FMOD.RESULT.ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags."; + case FMOD.RESULT.ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat."; + case FMOD.RESULT.ERR_TRUNCATED: return "The retrieved string is too long to fit in the supplied buffer and has been truncated."; + case FMOD.RESULT.ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be! contact support!"; + case FMOD.RESULT.ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called."; + case FMOD.RESULT.ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified."; + case FMOD.RESULT.ERR_VERSION: return "The version number of this file format is not supported."; + case FMOD.RESULT.ERR_EVENT_ALREADY_LOADED: return "The specified bank has already been loaded."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_BUSY: return "The live update connection failed due to the game already being connected."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_MISMATCH: return "The live update connection failed due to the game data being out of sync with the tool."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_TIMEOUT: return "The live update connection timed out."; + case FMOD.RESULT.ERR_EVENT_NOTFOUND: return "The requested event, bus or vca could not be found."; + case FMOD.RESULT.ERR_STUDIO_UNINITIALIZED: return "The Studio::System object is not yet initialized."; + case FMOD.RESULT.ERR_STUDIO_NOT_LOADED: return "The specified resource is not loaded, so it can't be unloaded."; + case FMOD.RESULT.ERR_INVALID_STRING: return "An invalid string was passed to this function."; + case FMOD.RESULT.ERR_ALREADY_LOCKED: return "The specified resource is already locked."; + case FMOD.RESULT.ERR_NOT_LOCKED: return "The specified resource is not locked, so it can't be unlocked."; + case FMOD.RESULT.ERR_RECORD_DISCONNECTED: return "The specified recording driver has been disconnected."; + case FMOD.RESULT.ERR_TOOMANYSAMPLES: return "The length provided exceed the allowable limit."; + default: return "Unknown error."; + } + } + } +} diff --git a/Qwilight/LedCSharp/LogitechGSDK.cs b/Qwilight/LedCSharp/LogitechGSDK.cs new file mode 100644 index 0000000..44576f8 --- /dev/null +++ b/Qwilight/LedCSharp/LogitechGSDK.cs @@ -0,0 +1,238 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace LedCSharp +{ + public enum keyboardNames + { + ESC = 0x01, + F1 = 0x3b, + F2 = 0x3c, + F3 = 0x3d, + F4 = 0x3e, + F5 = 0x3f, + F6 = 0x40, + F7 = 0x41, + F8 = 0x42, + F9 = 0x43, + F10 = 0x44, + F11 = 0x57, + F12 = 0x58, + PRINT_SCREEN = 0x137, + SCROLL_LOCK = 0x46, + PAUSE_BREAK = 0x145, + TILDE = 0x29, + ONE = 0x02, + TWO = 0x03, + THREE = 0x04, + FOUR = 0x05, + FIVE = 0x06, + SIX = 0x07, + SEVEN = 0x08, + EIGHT = 0x09, + NINE = 0x0A, + ZERO = 0x0B, + MINUS = 0x0C, + EQUALS = 0x0D, + BACKSPACE = 0x0E, + INSERT = 0x152, + HOME = 0x147, + PAGE_UP = 0x149, + NUM_LOCK = 0x45, + NUM_SLASH = 0x135, + NUM_ASTERISK = 0x37, + NUM_MINUS = 0x4A, + TAB = 0x0F, + Q = 0x10, + W = 0x11, + E = 0x12, + R = 0x13, + T = 0x14, + Y = 0x15, + U = 0x16, + I = 0x17, + O = 0x18, + P = 0x19, + OPEN_BRACKET = 0x1A, + CLOSE_BRACKET = 0x1B, + BACKSLASH = 0x2B, + KEYBOARD_DELETE = 0x153, + END = 0x14F, + PAGE_DOWN = 0x151, + NUM_SEVEN = 0x47, + NUM_EIGHT = 0x48, + NUM_NINE = 0x49, + NUM_PLUS = 0x4E, + CAPS_LOCK = 0x3A, + A = 0x1E, + S = 0x1F, + D = 0x20, + F = 0x21, + G = 0x22, + H = 0x23, + J = 0x24, + K = 0x25, + L = 0x26, + SEMICOLON = 0x27, + APOSTROPHE = 0x28, + ENTER = 0x1C, + NUM_FOUR = 0x4B, + NUM_FIVE = 0x4C, + NUM_SIX = 0x4D, + LEFT_SHIFT = 0x2A, + Z = 0x2C, + X = 0x2D, + C = 0x2E, + V = 0x2F, + B = 0x30, + N = 0x31, + M = 0x32, + COMMA = 0x33, + PERIOD = 0x34, + FORWARD_SLASH = 0x35, + RIGHT_SHIFT = 0x36, + ARROW_UP = 0x148, + NUM_ONE = 0x4F, + NUM_TWO = 0x50, + NUM_THREE = 0x51, + NUM_ENTER = 0x11C, + LEFT_CONTROL = 0x1D, + LEFT_WINDOWS = 0x15B, + LEFT_ALT = 0x38, + SPACE = 0x39, + RIGHT_ALT = 0x138, + RIGHT_WINDOWS = 0x15C, + APPLICATION_SELECT = 0x15D, + RIGHT_CONTROL = 0x11D, + ARROW_LEFT = 0x14B, + ARROW_DOWN = 0x150, + ARROW_RIGHT = 0x14D, + NUM_ZERO = 0x52, + NUM_PERIOD = 0x53, + G_1 = 0xFFF1, + G_2 = 0xFFF2, + G_3 = 0xFFF3, + G_4 = 0xFFF4, + G_5 = 0xFFF5, + G_6 = 0xFFF6, + G_7 = 0xFFF7, + G_8 = 0xFFF8, + G_9 = 0xFFF9, + G_LOGO = 0xFFFF1, + G_BADGE = 0xFFFF2 + }; + + public enum DeviceType + { + Keyboard = 0x0, + Mouse = 0x3, + Mousemat = 0x4, + Headset = 0x8, + Speaker = 0xe + } + + public class LogitechGSDK + { + //LED SDK + private const int LOGI_DEVICETYPE_MONOCHROME_ORD = 0; + private const int LOGI_DEVICETYPE_RGB_ORD = 1; + private const int LOGI_DEVICETYPE_PERKEY_RGB_ORD = 2; + + public const int LOGI_DEVICETYPE_MONOCHROME = (1 << LOGI_DEVICETYPE_MONOCHROME_ORD); + public const int LOGI_DEVICETYPE_RGB = (1 << LOGI_DEVICETYPE_RGB_ORD); + public const int LOGI_DEVICETYPE_PERKEY_RGB = (1 << LOGI_DEVICETYPE_PERKEY_RGB_ORD); + public const int LOGI_DEVICETYPE_ALL = (LOGI_DEVICETYPE_MONOCHROME | LOGI_DEVICETYPE_RGB | LOGI_DEVICETYPE_PERKEY_RGB); + + public const int LOGI_LED_BITMAP_WIDTH = 21; + public const int LOGI_LED_BITMAP_HEIGHT = 6; + public const int LOGI_LED_BITMAP_BYTES_PER_KEY = 4; + + public const int LOGI_LED_BITMAP_SIZE = LOGI_LED_BITMAP_WIDTH * LOGI_LED_BITMAP_HEIGHT * LOGI_LED_BITMAP_BYTES_PER_KEY; + public const int LOGI_LED_DURATION_INFINITE = 0; + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedInit(); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedInitWithName(String name); + + //Config option functions + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedGetConfigOptionNumber([MarshalAs(UnmanagedType.LPWStr)]String configPath, ref double defaultNumber); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedGetConfigOptionBool([MarshalAs(UnmanagedType.LPWStr)]String configPath, ref bool defaultRed); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedGetConfigOptionColor([MarshalAs(UnmanagedType.LPWStr)]String configPath, ref int defaultRed, ref int defaultGreen, ref int defaultBlue); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedGetConfigOptionKeyInput([MarshalAs(UnmanagedType.LPWStr)]String configPath, StringBuilder buffer, int bufsize); + ///////////////////// + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetTargetDevice(int targetDevice); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedGetSdkVersion(ref int majorNum, ref int minorNum, ref int buildNum); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSaveCurrentLighting(); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLighting(int redPercentage, int greenPercentage, int bluePercentage); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedRestoreLighting(); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedFlashLighting(int redPercentage, int greenPercentage, int bluePercentage, int milliSecondsDuration, int milliSecondsInterval); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedPulseLighting(int redPercentage, int greenPercentage, int bluePercentage, int milliSecondsDuration, int milliSecondsInterval); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedStopEffects(); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedExcludeKeysFromBitmap(keyboardNames[] keyList, int listCount); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLightingFromBitmap(byte[] bitmap); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLightingForKeyWithScanCode(int keyCode, int redPercentage, int greenPercentage, int bluePercentage); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLightingForKeyWithHidCode(int keyCode, int redPercentage, int greenPercentage, int bluePercentage); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLightingForKeyWithQuartzCode(int keyCode, int redPercentage, int greenPercentage, int bluePercentage); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLightingForKeyWithKeyName(keyboardNames keyCode, int redPercentage, int greenPercentage, int bluePercentage); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSaveLightingForKey(keyboardNames keyName); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedRestoreLightingForKey(keyboardNames keyName); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedFlashSingleKey(keyboardNames keyName, int redPercentage, int greenPercentage, int bluePercentage, int msDuration, int msInterval); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedPulseSingleKey(keyboardNames keyName, int startRedPercentage, int startGreenPercentage, int startBluePercentage, int finishRedPercentage, int finishGreenPercentage, int finishBluePercentage, int msDuration, bool isInfinite); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedStopEffectsOnKey(keyboardNames keyName); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern bool LogiLedSetLightingForTargetZone(DeviceType deviceType, int zone, int redPercentage, int greenPercentage, int bluePercentage); + + [DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)] + public static extern void LogiLedShutdown(); + } + +} diff --git a/Qwilight/NativeMethods.txt b/Qwilight/NativeMethods.txt new file mode 100644 index 0000000..fc566ce --- /dev/null +++ b/Qwilight/NativeMethods.txt @@ -0,0 +1,38 @@ +AllocConsole +CW_USEDEFAULT +CallWindowProc +ChangeDisplaySettings +CreateWindowEx +DefWindowProc +DispatchMessage +DwmSetWindowAttribute +ENUM_DISPLAY_SETTINGS_MODE +EnumDisplaySettings +FreeConsole +GetAsyncKeyState +GetCurrentConsoleFontEx +GetDpiForWindow +GetMessage +GetRawInputData +GetWindowInfo +IDirect3DDxgiInterfaceAccess +MessageBox +PostMessage +RegisterClassEx +RegisterRawInputDevices +SCANCODE_LSHIFT +SCANCODE_RSHIFT +SetWindowLongPtr +SetWindowPos +SetWindowText +TranslateMessage +WM_ACTIVATE +WM_CLOSE +WM_DESTROY +WM_DPICHANGED +WM_INPUT +WM_KEYDOWN +WM_MOVE +WM_SIZE +timeBeginPeriod +IGraphicsCaptureItemInterop \ No newline at end of file diff --git a/Qwilight/Properties/launchSettings.json b/Qwilight/Properties/launchSettings.json new file mode 100644 index 0000000..17ad07f --- /dev/null +++ b/Qwilight/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Qwilight": { + "commandName": "Project", + "commandLineArgs": "--vs" + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj new file mode 100644 index 0000000..4ae2ee3 --- /dev/null +++ b/Qwilight/Qwilight.csproj @@ -0,0 +1,313 @@ + + + WinExe + 10.0.19041.0 + net7.0-windows10.0.22621.0 + True + Debug;Release + x64;ARM64 + Qwilight.ico + Taehui + 불로그 + 1.16.6.564 + 1.16.6.564 + 1.16.6 + True + enable + true + None + false + Qwilight.View.QwilightClass + embedded + true + app.manifest + + + + $(DefineConstants);X64 + x64 + win10-x64 + + + + $(DefineConstants);ARM64 + ARM64 + win10-arm64 + + + + + + + + + + + + + + + + + + + + all + + + + + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + + diff --git a/Qwilight/Qwilight.ico b/Qwilight/Qwilight.ico new file mode 100644 index 0000000..6761de8 --- /dev/null +++ b/Qwilight/Qwilight.ico Binary files differ diff --git a/Qwilight/Qwilight/AvatarWww.cs b/Qwilight/Qwilight/AvatarWww.cs new file mode 100644 index 0000000..2694ab0 --- /dev/null +++ b/Qwilight/Qwilight/AvatarWww.cs @@ -0,0 +1,118 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Windows.Media; + +namespace Qwilight +{ + public sealed partial class AvatarWww : Model + { + bool _wantAvatarDrawing = true; + ImageSource _avatarDrawing; + bool _wantAvatarTitle; + AvatarTitle? _avatarTitle; + bool _wantAvatarEdge; + ImageSource _avatarEdge; + bool _allowNotAvatarTitle; + + public string AvatarID { get; } + + public ImageSource AvatarDrawing + { + get + { + if (_wantAvatarDrawing) + { + _wantAvatarDrawing = false; + Task.Run(async () => SetProperty(ref _avatarDrawing, (await AvatarDrawingSystem.Instance.GetAvatarDrawing(AvatarID)).DefaultDrawing, nameof(AvatarDrawing))); + } + return _avatarDrawing; + } + } + + public AvatarTitle? AvatarTitleValue + { + get + { + if (_wantAvatarTitle) + { + _wantAvatarTitle = false; + Task.Run(async () => SetProperty(ref _avatarTitle, await AvatarTitleSystem.Instance.GetAvatarTitle(AvatarID, _allowNotAvatarTitle), nameof(AvatarTitleValue))); + } + return _avatarTitle; + } + } + + public ImageSource AvatarEdge + { + get + { + if (_wantAvatarEdge) + { + _wantAvatarEdge = false; + Task.Run(async () => SetProperty(ref _avatarEdge, (await AvatarEdgeSystem.Instance.GetAvatarEdge(AvatarID)).DefaultDrawing, nameof(AvatarEdge))); + } + return _avatarEdge; + } + } + + [RelayCommand] + void OnViewAvatar() + { + if (AvatarID.StartsWith('*')) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAvatarViewFault); + } + else + { + var avatarViewModel = ViewModels.Instance.AvatarValue; + avatarViewModel.Close(); + avatarViewModel.AvatarID = Utility.GetDefaultAvatarID(AvatarID); + avatarViewModel.Open(); + } + } + + [RelayCommand] + void OnViewBundle() + { + if (AvatarID.StartsWith('*')) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAvatarBundleFault); + } + else + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallBundle, AvatarID); + } + } + + [RelayCommand] + void OnNewUbuntu() + { + if (AvatarID.StartsWith('*')) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAvatarUbuntuFault); + } + else + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.NewUbuntu, AvatarID); + } + } + + public override bool Equals(object obj) => obj is AvatarWww avatarWww && AvatarID == avatarWww.AvatarID; + + public override int GetHashCode() => AvatarID.GetHashCode(); + + public AvatarWww(string avatarID, AvatarTitle? avatarTitle = null, ImageSource avatarEdge = null, bool allowNotAvatarTitle = false) + { + _allowNotAvatarTitle = allowNotAvatarTitle; + AvatarID = avatarID; + _avatarDrawing = AvatarDrawingSystem.Instance.JustGetAvatarDrawing(avatarID)?.DefaultDrawing; + _wantAvatarDrawing = _avatarDrawing == null; + _avatarTitle = avatarTitle ?? AvatarTitleSystem.Instance.JustGetAvatarTitle(avatarID, _allowNotAvatarTitle); + _wantAvatarTitle = _avatarTitle == null; + _avatarEdge = avatarEdge ?? AvatarEdgeSystem.Instance.JustGetAvatarEdge(avatarID)?.DefaultDrawing; + _wantAvatarEdge = _avatarEdge == null; + } + } +} diff --git a/Qwilight/Qwilight/Bound.cs b/Qwilight/Qwilight/Bound.cs new file mode 100644 index 0000000..3bae132 --- /dev/null +++ b/Qwilight/Qwilight/Bound.cs @@ -0,0 +1,58 @@ +using Qwilight.Utilities; +using System.Numerics; +using Windows.Foundation; + +namespace Qwilight +{ + public struct Bound + { + public double Position0; + public double Position1; + public double Length; + public double Height; + + public Bound(double position0, double position1, double length, double height) + { + Position0 = position0; + Position1 = position1; + Length = length; + Height = height; + } + + public void Set(double position0, double position1, double length, double height) + { + Position0 = position0; + Position1 = position1; + Length = Math.Max(0.0, length); + Height = Math.Max(0.0, height); + } + + public void SetPosition(double position0, double position1) => Set(position0, position1, 0.0, 0.0); + + public void SetArea(double length, double height) => Set(0.0, 0.0, length, height); + + public void Set(float[] point) + { + Position0 = point[0]; + Position1 = point[1]; + Length = Math.Max(0.0, point[2]); + Height = Math.Max(0.0, point[3]); + } + + public bool IsPoint(Point lastPointed) => Utility.IsPoint(Position0, Position1, Length, Height, lastPointed.X, lastPointed.Y); + + public bool CanPaint => Length > 0.0 && Height > 0.0; + + public static implicit operator Windows.Foundation.Rect(Bound r) => new Windows.Foundation.Rect(r.Position0, r.Position1, r.Length, r.Height); + + public static implicit operator Vector2(Bound r) => new Vector2((float)r.Position0, (float)r.Position1); + + public static implicit operator System.Windows.Rect(Bound r) => new System.Windows.Rect(r.Position0, r.Position1, r.Length, r.Height); + + public static implicit operator System.Windows.Point(Bound r) => new System.Windows.Point(r.Position0, r.Position1); + + public static implicit operator Bound(Windows.Foundation.Rect r) => new Bound(r.X, r.Y, r.Width, r.Height); + + public static implicit operator Bound(System.Windows.Rect r) => new Bound(r.X, r.Y, r.Width, r.Height); + } +} diff --git a/Qwilight/Qwilight/Comment.cs b/Qwilight/Qwilight/Comment.cs new file mode 100644 index 0000000..f5466a7 --- /dev/null +++ b/Qwilight/Qwilight/Comment.cs @@ -0,0 +1,2113 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Comment.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Qwilight { + + /// Holder for reflection information generated from Comment.proto + public static partial class CommentReflection { + + #region Descriptor + /// File descriptor for Comment.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CommentReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg1Db21tZW50LnByb3RvIq4DCgdDb21tZW50EgwKBGRhdGUYASABKAkSFwoP", + "aGlnaGVzdEp1ZGdtZW50GAIgASgFEhYKDmhpZ2hlckp1ZGdtZW50GAMgASgF", + "EhQKDGhpZ2hKdWRnbWVudBgEIAEoBRITCgtsb3dKdWRnbWVudBgFIAEoBRIV", + "Cg1sb3dlckp1ZGdtZW50GAYgASgFEhYKDmxvd2VzdEp1ZGdtZW50GAcgASgF", + "EhsKBmlucHV0cxgIIAMoCzILLklucHV0RXZlbnQSJQoLbXVsdGlwbGllcnMY", + "CSADKAsyEC5NdWx0aXBsaWVyRXZlbnQSGwoGcGFpbnRzGAogAygLMgsuUGFp", + "bnRFdmVudBIQCghsb29wVW5pdBgLIAEoBRIrCg5qdWRnbWVudE1ldGVycxgM", + "IAMoCzITLkp1ZGdtZW50TWV0ZXJFdmVudBIvChBhdWRpb011bHRpcGxpZXJz", + "GA0gAygLMhUuQXVkaW9NdWx0aXBsaWVyRXZlbnQSGQoRbGV2eWluZ011bHRp", + "cGxpZXIYDiABKAESHgoWbGV2eWluZ0F1ZGlvTXVsdGlwbGllchgPIAEoASJJ", + "CgpJbnB1dEV2ZW50Eg0KBWlucHV0GAEgASgFEgwKBHdhaXQYAiABKAESDgoG", + "bm90ZUlEGAMgASgFEg4KBmp1ZGdlZBgEIAEoBSJICg9NdWx0aXBsaWVyRXZl", + "bnQSEgoKbXVsdGlwbGllchgBIAEoARIMCgR3YWl0GAIgASgBEhMKC2lzQXV0", + "b0V2ZW50GAMgASgIIkkKEkp1ZGdtZW50TWV0ZXJFdmVudBIVCg1qdWRnbWVu", + "dE1ldGVyGAEgASgBEgwKBHdhaXQYAiABKAESDgoGYXNzaXN0GAMgASgFIlkK", + "ClBhaW50RXZlbnQSEQoJaGl0UG9pbnRzGAEgASgBEg0KBXN0YW5kGAIgASgF", + "EgwKBGJhbmQYAyABKAUSDQoFcG9pbnQYBCABKAESDAoEd2FpdBgFIAEoASI9", + "ChRBdWRpb011bHRpcGxpZXJFdmVudBIXCg9hdWRpb011bHRpcGxpZXIYASAB", + "KAESDAoEd2FpdBgCIAEoAUIlCgpuZXQudGFlaHVpQgxDb21tZW50Q2xhc3Oq", + "AghRd2lsaWdodGIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Comment), global::Qwilight.Comment.Parser, new[]{ "Date", "HighestJudgment", "HigherJudgment", "HighJudgment", "LowJudgment", "LowerJudgment", "LowestJudgment", "Inputs", "Multipliers", "Paints", "LoopUnit", "JudgmentMeters", "AudioMultipliers", "LevyingMultiplier", "LevyingAudioMultiplier" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.InputEvent), global::Qwilight.InputEvent.Parser, new[]{ "Input", "Wait", "NoteID", "Judged" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.MultiplierEvent), global::Qwilight.MultiplierEvent.Parser, new[]{ "Multiplier", "Wait", "IsAutoEvent" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.JudgmentMeterEvent), global::Qwilight.JudgmentMeterEvent.Parser, new[]{ "JudgmentMeter", "Wait", "Assist" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.PaintEvent), global::Qwilight.PaintEvent.Parser, new[]{ "HitPoints", "Stand", "Band", "Point", "Wait" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.AudioMultiplierEvent), global::Qwilight.AudioMultiplierEvent.Parser, new[]{ "AudioMultiplier", "Wait" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class Comment : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Comment()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.CommentReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Comment() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Comment(Comment other) : this() { + date_ = other.date_; + highestJudgment_ = other.highestJudgment_; + higherJudgment_ = other.higherJudgment_; + highJudgment_ = other.highJudgment_; + lowJudgment_ = other.lowJudgment_; + lowerJudgment_ = other.lowerJudgment_; + lowestJudgment_ = other.lowestJudgment_; + inputs_ = other.inputs_.Clone(); + multipliers_ = other.multipliers_.Clone(); + paints_ = other.paints_.Clone(); + loopUnit_ = other.loopUnit_; + judgmentMeters_ = other.judgmentMeters_.Clone(); + audioMultipliers_ = other.audioMultipliers_.Clone(); + levyingMultiplier_ = other.levyingMultiplier_; + levyingAudioMultiplier_ = other.levyingAudioMultiplier_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Comment Clone() { + return new Comment(this); + } + + /// Field number for the "date" field. + public const int DateFieldNumber = 1; + private string date_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Date { + get { return date_; } + set { + date_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "highestJudgment" field. + public const int HighestJudgmentFieldNumber = 2; + private int highestJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HighestJudgment { + get { return highestJudgment_; } + set { + highestJudgment_ = value; + } + } + + /// Field number for the "higherJudgment" field. + public const int HigherJudgmentFieldNumber = 3; + private int higherJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HigherJudgment { + get { return higherJudgment_; } + set { + higherJudgment_ = value; + } + } + + /// Field number for the "highJudgment" field. + public const int HighJudgmentFieldNumber = 4; + private int highJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HighJudgment { + get { return highJudgment_; } + set { + highJudgment_ = value; + } + } + + /// Field number for the "lowJudgment" field. + public const int LowJudgmentFieldNumber = 5; + private int lowJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowJudgment { + get { return lowJudgment_; } + set { + lowJudgment_ = value; + } + } + + /// Field number for the "lowerJudgment" field. + public const int LowerJudgmentFieldNumber = 6; + private int lowerJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowerJudgment { + get { return lowerJudgment_; } + set { + lowerJudgment_ = value; + } + } + + /// Field number for the "lowestJudgment" field. + public const int LowestJudgmentFieldNumber = 7; + private int lowestJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowestJudgment { + get { return lowestJudgment_; } + set { + lowestJudgment_ = value; + } + } + + /// Field number for the "inputs" field. + public const int InputsFieldNumber = 8; + private static readonly pb::FieldCodec _repeated_inputs_codec + = pb::FieldCodec.ForMessage(66, global::Qwilight.InputEvent.Parser); + private readonly pbc::RepeatedField inputs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Inputs { + get { return inputs_; } + } + + /// Field number for the "multipliers" field. + public const int MultipliersFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_multipliers_codec + = pb::FieldCodec.ForMessage(74, global::Qwilight.MultiplierEvent.Parser); + private readonly pbc::RepeatedField multipliers_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Multipliers { + get { return multipliers_; } + } + + /// Field number for the "paints" field. + public const int PaintsFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_paints_codec + = pb::FieldCodec.ForMessage(82, global::Qwilight.PaintEvent.Parser); + private readonly pbc::RepeatedField paints_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Paints { + get { return paints_; } + } + + /// Field number for the "loopUnit" field. + public const int LoopUnitFieldNumber = 11; + private int loopUnit_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LoopUnit { + get { return loopUnit_; } + set { + loopUnit_ = value; + } + } + + /// Field number for the "judgmentMeters" field. + public const int JudgmentMetersFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_judgmentMeters_codec + = pb::FieldCodec.ForMessage(98, global::Qwilight.JudgmentMeterEvent.Parser); + private readonly pbc::RepeatedField judgmentMeters_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField JudgmentMeters { + get { return judgmentMeters_; } + } + + /// Field number for the "audioMultipliers" field. + public const int AudioMultipliersFieldNumber = 13; + private static readonly pb::FieldCodec _repeated_audioMultipliers_codec + = pb::FieldCodec.ForMessage(106, global::Qwilight.AudioMultiplierEvent.Parser); + private readonly pbc::RepeatedField audioMultipliers_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AudioMultipliers { + get { return audioMultipliers_; } + } + + /// Field number for the "levyingMultiplier" field. + public const int LevyingMultiplierFieldNumber = 14; + private double levyingMultiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LevyingMultiplier { + get { return levyingMultiplier_; } + set { + levyingMultiplier_ = value; + } + } + + /// Field number for the "levyingAudioMultiplier" field. + public const int LevyingAudioMultiplierFieldNumber = 15; + private double levyingAudioMultiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LevyingAudioMultiplier { + get { return levyingAudioMultiplier_; } + set { + levyingAudioMultiplier_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Comment); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Comment other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Date != other.Date) return false; + if (HighestJudgment != other.HighestJudgment) return false; + if (HigherJudgment != other.HigherJudgment) return false; + if (HighJudgment != other.HighJudgment) return false; + if (LowJudgment != other.LowJudgment) return false; + if (LowerJudgment != other.LowerJudgment) return false; + if (LowestJudgment != other.LowestJudgment) return false; + if(!inputs_.Equals(other.inputs_)) return false; + if(!multipliers_.Equals(other.multipliers_)) return false; + if(!paints_.Equals(other.paints_)) return false; + if (LoopUnit != other.LoopUnit) return false; + if(!judgmentMeters_.Equals(other.judgmentMeters_)) return false; + if(!audioMultipliers_.Equals(other.audioMultipliers_)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LevyingMultiplier, other.LevyingMultiplier)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LevyingAudioMultiplier, other.LevyingAudioMultiplier)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Date.Length != 0) hash ^= Date.GetHashCode(); + if (HighestJudgment != 0) hash ^= HighestJudgment.GetHashCode(); + if (HigherJudgment != 0) hash ^= HigherJudgment.GetHashCode(); + if (HighJudgment != 0) hash ^= HighJudgment.GetHashCode(); + if (LowJudgment != 0) hash ^= LowJudgment.GetHashCode(); + if (LowerJudgment != 0) hash ^= LowerJudgment.GetHashCode(); + if (LowestJudgment != 0) hash ^= LowestJudgment.GetHashCode(); + hash ^= inputs_.GetHashCode(); + hash ^= multipliers_.GetHashCode(); + hash ^= paints_.GetHashCode(); + if (LoopUnit != 0) hash ^= LoopUnit.GetHashCode(); + hash ^= judgmentMeters_.GetHashCode(); + hash ^= audioMultipliers_.GetHashCode(); + if (LevyingMultiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LevyingMultiplier); + if (LevyingAudioMultiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LevyingAudioMultiplier); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Date.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Date); + } + if (HighestJudgment != 0) { + output.WriteRawTag(16); + output.WriteInt32(HighestJudgment); + } + if (HigherJudgment != 0) { + output.WriteRawTag(24); + output.WriteInt32(HigherJudgment); + } + if (HighJudgment != 0) { + output.WriteRawTag(32); + output.WriteInt32(HighJudgment); + } + if (LowJudgment != 0) { + output.WriteRawTag(40); + output.WriteInt32(LowJudgment); + } + if (LowerJudgment != 0) { + output.WriteRawTag(48); + output.WriteInt32(LowerJudgment); + } + if (LowestJudgment != 0) { + output.WriteRawTag(56); + output.WriteInt32(LowestJudgment); + } + inputs_.WriteTo(output, _repeated_inputs_codec); + multipliers_.WriteTo(output, _repeated_multipliers_codec); + paints_.WriteTo(output, _repeated_paints_codec); + if (LoopUnit != 0) { + output.WriteRawTag(88); + output.WriteInt32(LoopUnit); + } + judgmentMeters_.WriteTo(output, _repeated_judgmentMeters_codec); + audioMultipliers_.WriteTo(output, _repeated_audioMultipliers_codec); + if (LevyingMultiplier != 0D) { + output.WriteRawTag(113); + output.WriteDouble(LevyingMultiplier); + } + if (LevyingAudioMultiplier != 0D) { + output.WriteRawTag(121); + output.WriteDouble(LevyingAudioMultiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Date.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Date); + } + if (HighestJudgment != 0) { + output.WriteRawTag(16); + output.WriteInt32(HighestJudgment); + } + if (HigherJudgment != 0) { + output.WriteRawTag(24); + output.WriteInt32(HigherJudgment); + } + if (HighJudgment != 0) { + output.WriteRawTag(32); + output.WriteInt32(HighJudgment); + } + if (LowJudgment != 0) { + output.WriteRawTag(40); + output.WriteInt32(LowJudgment); + } + if (LowerJudgment != 0) { + output.WriteRawTag(48); + output.WriteInt32(LowerJudgment); + } + if (LowestJudgment != 0) { + output.WriteRawTag(56); + output.WriteInt32(LowestJudgment); + } + inputs_.WriteTo(ref output, _repeated_inputs_codec); + multipliers_.WriteTo(ref output, _repeated_multipliers_codec); + paints_.WriteTo(ref output, _repeated_paints_codec); + if (LoopUnit != 0) { + output.WriteRawTag(88); + output.WriteInt32(LoopUnit); + } + judgmentMeters_.WriteTo(ref output, _repeated_judgmentMeters_codec); + audioMultipliers_.WriteTo(ref output, _repeated_audioMultipliers_codec); + if (LevyingMultiplier != 0D) { + output.WriteRawTag(113); + output.WriteDouble(LevyingMultiplier); + } + if (LevyingAudioMultiplier != 0D) { + output.WriteRawTag(121); + output.WriteDouble(LevyingAudioMultiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Date.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Date); + } + if (HighestJudgment != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(HighestJudgment); + } + if (HigherJudgment != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(HigherJudgment); + } + if (HighJudgment != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(HighJudgment); + } + if (LowJudgment != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LowJudgment); + } + if (LowerJudgment != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LowerJudgment); + } + if (LowestJudgment != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LowestJudgment); + } + size += inputs_.CalculateSize(_repeated_inputs_codec); + size += multipliers_.CalculateSize(_repeated_multipliers_codec); + size += paints_.CalculateSize(_repeated_paints_codec); + if (LoopUnit != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LoopUnit); + } + size += judgmentMeters_.CalculateSize(_repeated_judgmentMeters_codec); + size += audioMultipliers_.CalculateSize(_repeated_audioMultipliers_codec); + if (LevyingMultiplier != 0D) { + size += 1 + 8; + } + if (LevyingAudioMultiplier != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Comment other) { + if (other == null) { + return; + } + if (other.Date.Length != 0) { + Date = other.Date; + } + if (other.HighestJudgment != 0) { + HighestJudgment = other.HighestJudgment; + } + if (other.HigherJudgment != 0) { + HigherJudgment = other.HigherJudgment; + } + if (other.HighJudgment != 0) { + HighJudgment = other.HighJudgment; + } + if (other.LowJudgment != 0) { + LowJudgment = other.LowJudgment; + } + if (other.LowerJudgment != 0) { + LowerJudgment = other.LowerJudgment; + } + if (other.LowestJudgment != 0) { + LowestJudgment = other.LowestJudgment; + } + inputs_.Add(other.inputs_); + multipliers_.Add(other.multipliers_); + paints_.Add(other.paints_); + if (other.LoopUnit != 0) { + LoopUnit = other.LoopUnit; + } + judgmentMeters_.Add(other.judgmentMeters_); + audioMultipliers_.Add(other.audioMultipliers_); + if (other.LevyingMultiplier != 0D) { + LevyingMultiplier = other.LevyingMultiplier; + } + if (other.LevyingAudioMultiplier != 0D) { + LevyingAudioMultiplier = other.LevyingAudioMultiplier; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Date = input.ReadString(); + break; + } + case 16: { + HighestJudgment = input.ReadInt32(); + break; + } + case 24: { + HigherJudgment = input.ReadInt32(); + break; + } + case 32: { + HighJudgment = input.ReadInt32(); + break; + } + case 40: { + LowJudgment = input.ReadInt32(); + break; + } + case 48: { + LowerJudgment = input.ReadInt32(); + break; + } + case 56: { + LowestJudgment = input.ReadInt32(); + break; + } + case 66: { + inputs_.AddEntriesFrom(input, _repeated_inputs_codec); + break; + } + case 74: { + multipliers_.AddEntriesFrom(input, _repeated_multipliers_codec); + break; + } + case 82: { + paints_.AddEntriesFrom(input, _repeated_paints_codec); + break; + } + case 88: { + LoopUnit = input.ReadInt32(); + break; + } + case 98: { + judgmentMeters_.AddEntriesFrom(input, _repeated_judgmentMeters_codec); + break; + } + case 106: { + audioMultipliers_.AddEntriesFrom(input, _repeated_audioMultipliers_codec); + break; + } + case 113: { + LevyingMultiplier = input.ReadDouble(); + break; + } + case 121: { + LevyingAudioMultiplier = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Date = input.ReadString(); + break; + } + case 16: { + HighestJudgment = input.ReadInt32(); + break; + } + case 24: { + HigherJudgment = input.ReadInt32(); + break; + } + case 32: { + HighJudgment = input.ReadInt32(); + break; + } + case 40: { + LowJudgment = input.ReadInt32(); + break; + } + case 48: { + LowerJudgment = input.ReadInt32(); + break; + } + case 56: { + LowestJudgment = input.ReadInt32(); + break; + } + case 66: { + inputs_.AddEntriesFrom(ref input, _repeated_inputs_codec); + break; + } + case 74: { + multipliers_.AddEntriesFrom(ref input, _repeated_multipliers_codec); + break; + } + case 82: { + paints_.AddEntriesFrom(ref input, _repeated_paints_codec); + break; + } + case 88: { + LoopUnit = input.ReadInt32(); + break; + } + case 98: { + judgmentMeters_.AddEntriesFrom(ref input, _repeated_judgmentMeters_codec); + break; + } + case 106: { + audioMultipliers_.AddEntriesFrom(ref input, _repeated_audioMultipliers_codec); + break; + } + case 113: { + LevyingMultiplier = input.ReadDouble(); + break; + } + case 121: { + LevyingAudioMultiplier = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class InputEvent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InputEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.CommentReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InputEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InputEvent(InputEvent other) : this() { + input_ = other.input_; + wait_ = other.wait_; + noteID_ = other.noteID_; + judged_ = other.judged_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InputEvent Clone() { + return new InputEvent(this); + } + + /// Field number for the "input" field. + public const int InputFieldNumber = 1; + private int input_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Input { + get { return input_; } + set { + input_ = value; + } + } + + /// Field number for the "wait" field. + public const int WaitFieldNumber = 2; + private double wait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Wait { + get { return wait_; } + set { + wait_ = value; + } + } + + /// Field number for the "noteID" field. + public const int NoteIDFieldNumber = 3; + private int noteID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteID { + get { return noteID_; } + set { + noteID_ = value; + } + } + + /// Field number for the "judged" field. + public const int JudgedFieldNumber = 4; + private int judged_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Judged { + get { return judged_; } + set { + judged_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as InputEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(InputEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Input != other.Input) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Wait, other.Wait)) return false; + if (NoteID != other.NoteID) return false; + if (Judged != other.Judged) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Input != 0) hash ^= Input.GetHashCode(); + if (Wait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Wait); + if (NoteID != 0) hash ^= NoteID.GetHashCode(); + if (Judged != 0) hash ^= Judged.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Input != 0) { + output.WriteRawTag(8); + output.WriteInt32(Input); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (NoteID != 0) { + output.WriteRawTag(24); + output.WriteInt32(NoteID); + } + if (Judged != 0) { + output.WriteRawTag(32); + output.WriteInt32(Judged); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Input != 0) { + output.WriteRawTag(8); + output.WriteInt32(Input); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (NoteID != 0) { + output.WriteRawTag(24); + output.WriteInt32(NoteID); + } + if (Judged != 0) { + output.WriteRawTag(32); + output.WriteInt32(Judged); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Input != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Input); + } + if (Wait != 0D) { + size += 1 + 8; + } + if (NoteID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NoteID); + } + if (Judged != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Judged); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(InputEvent other) { + if (other == null) { + return; + } + if (other.Input != 0) { + Input = other.Input; + } + if (other.Wait != 0D) { + Wait = other.Wait; + } + if (other.NoteID != 0) { + NoteID = other.NoteID; + } + if (other.Judged != 0) { + Judged = other.Judged; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Input = input.ReadInt32(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + case 24: { + NoteID = input.ReadInt32(); + break; + } + case 32: { + Judged = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Input = input.ReadInt32(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + case 24: { + NoteID = input.ReadInt32(); + break; + } + case 32: { + Judged = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class MultiplierEvent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MultiplierEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.CommentReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MultiplierEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MultiplierEvent(MultiplierEvent other) : this() { + multiplier_ = other.multiplier_; + wait_ = other.wait_; + isAutoEvent_ = other.isAutoEvent_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MultiplierEvent Clone() { + return new MultiplierEvent(this); + } + + /// Field number for the "multiplier" field. + public const int MultiplierFieldNumber = 1; + private double multiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Multiplier { + get { return multiplier_; } + set { + multiplier_ = value; + } + } + + /// Field number for the "wait" field. + public const int WaitFieldNumber = 2; + private double wait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Wait { + get { return wait_; } + set { + wait_ = value; + } + } + + /// Field number for the "isAutoEvent" field. + public const int IsAutoEventFieldNumber = 3; + private bool isAutoEvent_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsAutoEvent { + get { return isAutoEvent_; } + set { + isAutoEvent_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as MultiplierEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(MultiplierEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Multiplier, other.Multiplier)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Wait, other.Wait)) return false; + if (IsAutoEvent != other.IsAutoEvent) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Multiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Multiplier); + if (Wait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Wait); + if (IsAutoEvent != false) hash ^= IsAutoEvent.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Multiplier != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Multiplier); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (IsAutoEvent != false) { + output.WriteRawTag(24); + output.WriteBool(IsAutoEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Multiplier != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Multiplier); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (IsAutoEvent != false) { + output.WriteRawTag(24); + output.WriteBool(IsAutoEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Multiplier != 0D) { + size += 1 + 8; + } + if (Wait != 0D) { + size += 1 + 8; + } + if (IsAutoEvent != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(MultiplierEvent other) { + if (other == null) { + return; + } + if (other.Multiplier != 0D) { + Multiplier = other.Multiplier; + } + if (other.Wait != 0D) { + Wait = other.Wait; + } + if (other.IsAutoEvent != false) { + IsAutoEvent = other.IsAutoEvent; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + Multiplier = input.ReadDouble(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + case 24: { + IsAutoEvent = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + Multiplier = input.ReadDouble(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + case 24: { + IsAutoEvent = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class JudgmentMeterEvent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JudgmentMeterEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.CommentReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JudgmentMeterEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JudgmentMeterEvent(JudgmentMeterEvent other) : this() { + judgmentMeter_ = other.judgmentMeter_; + wait_ = other.wait_; + assist_ = other.assist_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JudgmentMeterEvent Clone() { + return new JudgmentMeterEvent(this); + } + + /// Field number for the "judgmentMeter" field. + public const int JudgmentMeterFieldNumber = 1; + private double judgmentMeter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double JudgmentMeter { + get { return judgmentMeter_; } + set { + judgmentMeter_ = value; + } + } + + /// Field number for the "wait" field. + public const int WaitFieldNumber = 2; + private double wait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Wait { + get { return wait_; } + set { + wait_ = value; + } + } + + /// Field number for the "assist" field. + public const int AssistFieldNumber = 3; + private int assist_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Assist { + get { return assist_; } + set { + assist_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as JudgmentMeterEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(JudgmentMeterEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(JudgmentMeter, other.JudgmentMeter)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Wait, other.Wait)) return false; + if (Assist != other.Assist) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (JudgmentMeter != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(JudgmentMeter); + if (Wait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Wait); + if (Assist != 0) hash ^= Assist.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (JudgmentMeter != 0D) { + output.WriteRawTag(9); + output.WriteDouble(JudgmentMeter); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (Assist != 0) { + output.WriteRawTag(24); + output.WriteInt32(Assist); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (JudgmentMeter != 0D) { + output.WriteRawTag(9); + output.WriteDouble(JudgmentMeter); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (Assist != 0) { + output.WriteRawTag(24); + output.WriteInt32(Assist); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (JudgmentMeter != 0D) { + size += 1 + 8; + } + if (Wait != 0D) { + size += 1 + 8; + } + if (Assist != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Assist); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(JudgmentMeterEvent other) { + if (other == null) { + return; + } + if (other.JudgmentMeter != 0D) { + JudgmentMeter = other.JudgmentMeter; + } + if (other.Wait != 0D) { + Wait = other.Wait; + } + if (other.Assist != 0) { + Assist = other.Assist; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + JudgmentMeter = input.ReadDouble(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + case 24: { + Assist = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + JudgmentMeter = input.ReadDouble(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + case 24: { + Assist = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class PaintEvent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PaintEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.CommentReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaintEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaintEvent(PaintEvent other) : this() { + hitPoints_ = other.hitPoints_; + stand_ = other.stand_; + band_ = other.band_; + point_ = other.point_; + wait_ = other.wait_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaintEvent Clone() { + return new PaintEvent(this); + } + + /// Field number for the "hitPoints" field. + public const int HitPointsFieldNumber = 1; + private double hitPoints_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HitPoints { + get { return hitPoints_; } + set { + hitPoints_ = value; + } + } + + /// Field number for the "stand" field. + public const int StandFieldNumber = 2; + private int stand_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Stand { + get { return stand_; } + set { + stand_ = value; + } + } + + /// Field number for the "band" field. + public const int BandFieldNumber = 3; + private int band_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Band { + get { return band_; } + set { + band_ = value; + } + } + + /// Field number for the "point" field. + public const int PointFieldNumber = 4; + private double point_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Point { + get { return point_; } + set { + point_ = value; + } + } + + /// Field number for the "wait" field. + public const int WaitFieldNumber = 5; + private double wait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Wait { + get { return wait_; } + set { + wait_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PaintEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PaintEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HitPoints, other.HitPoints)) return false; + if (Stand != other.Stand) return false; + if (Band != other.Band) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Point, other.Point)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Wait, other.Wait)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HitPoints != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HitPoints); + if (Stand != 0) hash ^= Stand.GetHashCode(); + if (Band != 0) hash ^= Band.GetHashCode(); + if (Point != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Point); + if (Wait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Wait); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HitPoints != 0D) { + output.WriteRawTag(9); + output.WriteDouble(HitPoints); + } + if (Stand != 0) { + output.WriteRawTag(16); + output.WriteInt32(Stand); + } + if (Band != 0) { + output.WriteRawTag(24); + output.WriteInt32(Band); + } + if (Point != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Point); + } + if (Wait != 0D) { + output.WriteRawTag(41); + output.WriteDouble(Wait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HitPoints != 0D) { + output.WriteRawTag(9); + output.WriteDouble(HitPoints); + } + if (Stand != 0) { + output.WriteRawTag(16); + output.WriteInt32(Stand); + } + if (Band != 0) { + output.WriteRawTag(24); + output.WriteInt32(Band); + } + if (Point != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Point); + } + if (Wait != 0D) { + output.WriteRawTag(41); + output.WriteDouble(Wait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HitPoints != 0D) { + size += 1 + 8; + } + if (Stand != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Stand); + } + if (Band != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Band); + } + if (Point != 0D) { + size += 1 + 8; + } + if (Wait != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PaintEvent other) { + if (other == null) { + return; + } + if (other.HitPoints != 0D) { + HitPoints = other.HitPoints; + } + if (other.Stand != 0) { + Stand = other.Stand; + } + if (other.Band != 0) { + Band = other.Band; + } + if (other.Point != 0D) { + Point = other.Point; + } + if (other.Wait != 0D) { + Wait = other.Wait; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + HitPoints = input.ReadDouble(); + break; + } + case 16: { + Stand = input.ReadInt32(); + break; + } + case 24: { + Band = input.ReadInt32(); + break; + } + case 33: { + Point = input.ReadDouble(); + break; + } + case 41: { + Wait = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + HitPoints = input.ReadDouble(); + break; + } + case 16: { + Stand = input.ReadInt32(); + break; + } + case 24: { + Band = input.ReadInt32(); + break; + } + case 33: { + Point = input.ReadDouble(); + break; + } + case 41: { + Wait = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class AudioMultiplierEvent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AudioMultiplierEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.CommentReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AudioMultiplierEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AudioMultiplierEvent(AudioMultiplierEvent other) : this() { + audioMultiplier_ = other.audioMultiplier_; + wait_ = other.wait_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AudioMultiplierEvent Clone() { + return new AudioMultiplierEvent(this); + } + + /// Field number for the "audioMultiplier" field. + public const int AudioMultiplierFieldNumber = 1; + private double audioMultiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double AudioMultiplier { + get { return audioMultiplier_; } + set { + audioMultiplier_ = value; + } + } + + /// Field number for the "wait" field. + public const int WaitFieldNumber = 2; + private double wait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Wait { + get { return wait_; } + set { + wait_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as AudioMultiplierEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(AudioMultiplierEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(AudioMultiplier, other.AudioMultiplier)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Wait, other.Wait)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (AudioMultiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(AudioMultiplier); + if (Wait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Wait); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (AudioMultiplier != 0D) { + output.WriteRawTag(9); + output.WriteDouble(AudioMultiplier); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (AudioMultiplier != 0D) { + output.WriteRawTag(9); + output.WriteDouble(AudioMultiplier); + } + if (Wait != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Wait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (AudioMultiplier != 0D) { + size += 1 + 8; + } + if (Wait != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(AudioMultiplierEvent other) { + if (other == null) { + return; + } + if (other.AudioMultiplier != 0D) { + AudioMultiplier = other.AudioMultiplier; + } + if (other.Wait != 0D) { + Wait = other.Wait; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + AudioMultiplier = input.ReadDouble(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + AudioMultiplier = input.ReadDouble(); + break; + } + case 17: { + Wait = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Qwilight/Qwilight/Compiler/BMSCompiler.cs b/Qwilight/Qwilight/Compiler/BMSCompiler.cs new file mode 100644 index 0000000..3148d78 --- /dev/null +++ b/Qwilight/Qwilight/Compiler/BMSCompiler.cs @@ -0,0 +1,1249 @@ +using Qwilight.Compute; +using Qwilight.Note; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.Collections.Concurrent; +using System.IO; +using System.Text; +using UtfUnknown; + +namespace Qwilight.Compiler +{ + public class BMSCompiler : BaseCompiler + { + static readonly char[] _delimiters = new[] { ':', ' ', '.', ';' }; + static readonly Dictionary _formatMap = new() + { + { "1e517d8a7f7e34e58db1c62aeaf590b7445eb56f12d976af196afb9cda98339108346cacc8939c3cb004eee75f141f1e8104fa7ee425fa95acdf705b3c8064dc:0", 949 }, + { "8247524b799f34b78ff725cd97a2775fd7aed0f8637b2ad9899dc3cb87d9559d0c1ba093671fbf451a6faed185624e1ce01cef43c07f837885489777cd9a6947:0", 949 }, + { "85b2df20ed4b96f7aa62e17fb0480e74d19720b218586f676d90031794c11dba4cba02a65c73e3ed12759a228d7ac9e1d1e1a2f30e20cc74a06c296afe8a1a4f:0", 949 }, + { "af7a5b1825e19909fcd7e03160eb0b62c1ae8368b7825c890c3c7cfc9849e7c6d37aaa45688b88f6d2659587e2a1ae73d59f0ff64427ae1a1b6283cd12fa17e8:0", 949 }, + { "86f8bc62e9b1aeee9cc86111d2411704d20f0746be9da5cbb18f201eb34887923385b55f30736886fa4bb6211b7ce4fa3b5069485eb9c6e8f71e7634d2590fee:0", 949 }, + { "09e972e16e0ab8ee1cb85e67ed6fc3d80a3e6250eeabfcd1c63f6060a14d27fa753fc7d1474daaf8abc0f220d4077533ec06214cc22d12192bfd275145485ee9:0", 949 }, + { "bfd28d1ae0e65cf0196f599936103b565f95f2ce5bc456ed358269e9d9b4c3b5a7c0fc326482336940fe40c3f73ab4e0429c41921c6c23c3c73932a751dc0938:0", 949 }, + { "7754d64f9443af0dd6aa82f79d940ac19e263086caa4d4b4be6c28b51ad80fdd07cbe0fa588fff044a5df3fd818ca7ef3fd7726131da599035544cefcacce20f:0", 949 }, + { "af492b5a23c46b31de7aa624d6348ec3dc1b64221962c1fcc2fbdc92df332ee0ad8af235bb4de842a35dd2b76882f1ac0f41b39e57c67a4f014cd851c2e33bea:0", 949 }, + { "46cdd63acf234ef9830dfcfa3c37e2cb56076672109a08c20f7009064589d2de6980ec694cac11c0ad470fb01c3dc52c280968fcdff05be239ff0eae7f1598a0:0", 949 }, + { "c7c3884ca7033c7b250658d9b18c64f6850a99c69b7b74e478c554cbefcdb3165382c8ef48f17d08765a4ba3c21a69a3e1d480f7fb25ccbde03f5ce0addd8310:0", 949 }, + { "3ad9a18d77732225061e38064b6643491c8e999f6081c308f24f4a459cce7e739ca118e371bbf7b032b42c389736e48b53a966b0b0761b67e27a52257bb142d5:0", 949 }, + { "d1fbc5e49c22c75adc263aca6ae1cf04f5f25efbdfa42256953ee7437c345524cbfa8764b9a0336cada2d0c59fa31e4f5a67af1b71a96596d7532c874c4d507c:0", 949 }, + { "7a94c200d203f690d3cc17393ec5413c5d0213a16dff4b3dad75c94e4c1e6a1295cab5c8dd875c76c97f402e541ff2ee15a95c601095622e5eb6789c67dcd071:0", 949 }, + { "5ac89954044141254dace3e8da705b3ded9b99a54e83d2e70bcd7094ea4446ab9661992669ba67350fd6384d091631bca3bdecd5683c7db2aa06fcb566fb2927:0", 949 }, + { "f404418123d17e4560e9b32d2375dc120c53b9ee850f9ebe6920949950fee3c0397d1cac13537200b0bfbcd754daa71b8db4358418c8e530a9c825fb2309b61e:0", 949 }, + { "beb151001ec1ba01bdcbc269dffb054a664cb5a5bb5979c9dfccaaab9c4fb19bda1e943919ee3cfd3fae022a81b41bffba3565acf5d6d0434dd3a7c5d49bf4c4:0", 949 }, + { "60f8b3d9a7fd626150311623d4f6a428b053eca9a9b062e38db688f65646de92ae44a10a001582e4f4a0d49bac124fd4ae1869799731e2bb1053816ad1d5e451:0", 949 }, + { "cad4905526fd2c9d76ebc0763199fda80be35eb162624290e6cc9c567446fa4eb00588a5a22d0ee2ee4e28c6c684463a172e1ba35329bafde3f201f6fc3c3bd2:0", 949 }, + { "b90e46e5bb5f52f55ac451cf7d13073019670c0dc19f27d5e31fd8d9ee8c2d088cbb1768cb42569a0007992ff512ed7b93a2b43aa5462e0284995e14c97e36a3:0", 949 }, + { "73050fa440f63c2a9f9844824a70df5226e6e0ed1a27b4e9e45b18a9e0b988697cfaf9360a4f568c121213fcd4e518acfbf60e7bb981d8302c0a90b91d990542:0", 949 }, + { "f04bb8bfbd9abd19ef6f166f9a12e750f12270e393881b18acaf902de5e3d50baa14e030a6d598789d1f491912f954ab9dfc82e565f9f7bc7fd4a2f4ea2c4269:0", 949 }, + { "2ee33d8150c20832627ca7c0ce0987ec464575414b989cb48583083707459c5dafd399f22d1f61b720290b8a77bfd26e4b3a95bcb190b3dbcafc29fa40dacf5d:0", 949 }, + { "e9762943bf3434eb1a15aab69e485ed9927c8c6ca9a1f6c7e51756f17fa191fe9a50d96fa2c2764fddb10a1bd716c7c6b0c36d1c64f9fffd94a554bb1de67b96:0", 949 } + }; + static readonly Dictionary _mediaMap = new() + { + { "f09141432f4d624126a10a502e0542d6724f1d316cf8987f556c0063be8b77e9a0fd2cd731528e09385c175110af4eabf78fc00e97d1733c4e056a887ccf31e1:0", "BGA.mpg" } + }; + + class BMSInputItem : IComparable + { + public InputNote InputNote { get; set; } + + public int CompareTo(BMSInputItem other) => InputNote.CompareTo(other.InputNote); + } + + sealed class BMSLongInputItem : BMSInputItem + { + public string BMSID { get; set; } = string.Empty; + } + + class EarlyBMSInputItem : IComparable + { + public double BMSPosition { get; set; } + + public int CompareTo(EarlyBMSInputItem other) => BMSPosition.CompareTo(other.BMSPosition); + } + + sealed class EarlyBMSLongInputItem : EarlyBMSInputItem + { + public string BMSID { get; set; } = string.Empty; + } + + readonly List _lines = new(); + readonly SortedDictionary _bmsPositionLogicalYMap = new(); + readonly SortedDictionary _bmsPositionMultiplierMap = new(); + readonly Dictionary _bmsIDStopMap = new(); + readonly Dictionary _bmsIDMultiplierMap = new(); + readonly SortedDictionary _bmsPositionWaitMap = new(); + bool _hasMedia; + bool _hasFailedMedia; + string _longNoteBMSID; + int _highestMeter; + bool _is4K; + bool _is6K; + + public BMSCompiler(BMSFile bmsFile, CancellationTokenSource setCancelCompiler) : base(bmsFile, setCancelCompiler) + { + } + + public override double GetWaitValue(double waitPosition) => _bmsPositionWaitMap[waitPosition]; + + public override void CompileImpl(Computing targetComputing, byte[] noteFileContents, int salt) + { + var bmsPositionStopMap = new SortedDictionary(); + var meterMeterMultiplierMap = new SortedDictionary + { + { -1, 1.0 } + }; + var bmsIDBPMMap = new Dictionary(); + using (var rms = PoolSystem.Instance.GetDataFlow(noteFileContents)) + { + var format = NoteFormatID; + if (format == -1) + { + if (!_formatMap.TryGetValue(NoteFile.GetNoteID512(), out format)) + { + var formatComputer = CharsetDetector.DetectFromStream(rms).Detected; + rms.Position = 0; + format = formatComputer != null && formatComputer.Confidence >= 0.875 && formatComputer.Encoding != null ? formatComputer.Encoding.CodePage : 932; + } + } + using var sr = new StreamReader(rms, Encoding.GetEncoding(format), false); + var saltComputer = new Random(salt); + var lastBin = 0; + var isValidStatement = true; + string line; + while ((line = sr.ReadLine()) != null) + { + if (line.StartsWith('#')) + { + var lineAt1 = line[1..]; + var delimited = lineAt1.Split(_delimiters, 2); + var property = delimited[0]; + if (property.EqualsCaseless("IF")) + { + isValidStatement = lastBin == Utility.ToInt32(delimited[1]); + continue; + } + if (isValidStatement) + { + if (delimited.Length > 1) + { + if (property.EqualsCaseless("RANDOM")) + { + var rValue = Utility.ToInt32(delimited[1]); + lastBin = 1 + saltComputer.Next(rValue); + if (rValue > 1) + { + targetComputing.IsSalt = true; + } + continue; + } + } + _lines.Add(line); + } + else if (property.EqualsCaseless("ELSE") || property.EqualsCaseless("ENDIF") || property.EqualsCaseless("IFEND")) + { + isValidStatement = true; + } + } + } + } + foreach (var line in _lines) + { + var lineAt1 = line[1..]; + var delimited = lineAt1.Split(_delimiters, 2); + if (IsMainBMSData(lineAt1)) + { + var property = delimited.Length > 1 ? delimited[0] : delimited[0].Substring(0, 5); + property = property.PadLeft(5, '0'); + var meter = Utility.ToInt32(property.Substring(0, 3)); + _highestMeter = Math.Max(meter, _highestMeter); + if (property[3] == '0' && property[4] == '2') + { + meterMeterMultiplierMap[meter] = Utility.ToFloat64(delimited.Length > 1 ? delimited[1] : delimited[0][5..]); + } + } + else + { + var property = delimited[0].Trim(); + if (delimited.Length > 1) + { + var data = delimited[1].Trim(); + if (property.IsFrontCaselsss("BPM")) + { + if (property.Length > 3) + { + bmsIDBPMMap[property.Substring(3, 2)] = Utility.ToFloat64(data); + } + else + { + if (Utility.ToFloat64(data, out var levyingBPM)) + { + targetComputing.LevyingBPM = levyingBPM; + } + else + { + var delimitedData = data.Split(" "); + if (delimitedData.Length > 1) + { + bmsIDBPMMap[delimitedData[0]] = Utility.ToFloat64(delimitedData[1]); + } + else + { + targetComputing.LevyingBPM = Utility.ToFloat64(data.Split('-')[0]); + } + } + } + } + else if (property.IsFrontCaselsss("BMP")) + { + if (property == "00") + { + _hasFailedMedia = true; + } + } + else if (property.EqualsCaseless("LNOBJ")) + { + _longNoteBMSID = data; + } + else if (property.EqualsCaseless("LNMODE")) + { + switch (targetComputing.LongNoteModeDate) + { + case Component.LongNoteMode100: + targetComputing.IsAutoLongNote = false; + break; + case Component.LongNoteMode11420: + case Component.LongNoteMode1164: + switch (Utility.ToInt32(data)) + { + case 1: + targetComputing.IsAutoLongNote = true; + break; + case 2: + case 3: + targetComputing.IsAutoLongNote = false; + break; + } + break; + } + } + else if (property.EqualsCaseless("PREVIEW")) + { + targetComputing.TrailerAudioName = data; + } + } + else + { + if (property.EqualsCaseless("4K")) + { + _is4K = true; + } + else if (property.EqualsCaseless("6K")) + { + _is6K = true; + } + } + } + } + var earlyBMSInputItemSet = new Dictionary>(); + var earlyBMSLongInputItemSet = new Dictionary>(); + ComponentValue = new Component(targetComputing.LevyingBPM); + var bmsPositionSet = new SortedSet(); + var title = string.Empty; + var titleAssister = string.Empty; + var artist = string.Empty; + var artistAssister = string.Empty; + var audioTargets = new List(); + var audioValues = new HashSet(); + foreach (var line in _lines) + { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); + var lineAt1 = line[1..]; + var delimited = lineAt1.Split(_delimiters, 2); + if (IsMainBMSData(lineAt1)) + { + var property = delimited.Length > 1 ? delimited[0] : delimited[0].Substring(0, 5); + property = property.PadLeft(5, '0'); + var noteVariety0 = property[3]; + var noteVariety1 = property[4]; + var data = delimited.Length > 1 ? delimited[1] : delimited[0][5..]; + var dataCount = data.Length - data.Length % 2; + var meter = Utility.ToInt32(property.Substring(0, 3)); + for (var meterCount = 0; meterCount < dataCount; meterCount += 2) + { + var bmsID = data.Substring(meterCount, 2); + if (bmsID != "00") + { + var bmsPosition = (double)meterCount / dataCount + meter; + var rawInput = property[3..5]; + switch (noteVariety0) + { + case '0': + switch (noteVariety1) + { + case '1': + bmsPositionSet.Add(bmsPosition); + HighestPosition = Math.Max(HighestPosition, bmsPosition); + break; + case '4': + case '7': + bmsPositionSet.Add(bmsPosition); + HighestPosition = Math.Max(HighestPosition, bmsPosition); + _hasMedia = true; + break; + case '6': + bmsPositionSet.Add(bmsPosition); + HighestPosition = Math.Max(HighestPosition, bmsPosition); + _hasMedia = true; + _hasFailedMedia = true; + break; + case '3': + case '8': + case '9': + bmsPositionSet.Add(bmsPosition); + break; + } + break; + case '1': + case '2': + if (noteVariety1 != '7') + { + if (string.IsNullOrEmpty(_longNoteBMSID)) + { + ++targetComputing.TotalNotes; + if (noteVariety1 == '6') + { + ++targetComputing.AutoableNotes; + } + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + } + else + { + earlyBMSLongInputItemSet.Into(rawInput, new EarlyBMSLongInputItem + { + BMSPosition = bmsPosition, + BMSID = bmsID + }); + } + } + bmsPositionSet.Add(bmsPosition); + break; + case '3': + case '4': + case '7': + case '9': + bmsPositionSet.Add(bmsPosition); + break; + case '5': + case '6': + if (noteVariety1 != '7') + { + if (!string.IsNullOrEmpty(_longNoteBMSID) && _longNoteBMSID.EqualsCaseless(bmsID)) + { + earlyBMSLongInputItemSet.Into(rawInput, new EarlyBMSLongInputItem + { + BMSPosition = bmsPosition, + BMSID = bmsID + }); + } + else + { + earlyBMSInputItemSet.Into(rawInput, new EarlyBMSInputItem + { + BMSPosition = bmsPosition + }); + } + bmsPositionSet.Add(bmsPosition); + } + break; + case 'D': + case 'E': + if (noteVariety1 != '7') + { + ++targetComputing.TrapNotes; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + bmsPositionSet.Add(bmsPosition); + } + break; + case 'S': + switch (noteVariety1) + { + case 'C': + bmsPositionSet.Add(bmsPosition); + break; + } + break; + } + } + } + } + else + { + if (delimited.Length > 1) + { + var property = delimited[0].Trim(); + var data = delimited[1].Trim(); + if (property.IsFrontCaselsss("WAV")) + { + if (!string.IsNullOrEmpty(data)) + { + audioTargets.Add(property.Substring(3, 2)); + } + } + else if (property.IsFrontCaselsss("STOP")) + { + _bmsIDStopMap[property.Substring(4, 2)] = Utility.ToFloat64(data); + } + else if (property.IsFrontCaselsss("SCROLL")) + { + _bmsIDMultiplierMap[property.Substring(6, 2)] = Utility.ToFloat64(data); + } + else if (property.EqualsCaseless("TITLE")) + { + title = data; + } + else if (property.EqualsCaseless("SUBTITLE")) + { + titleAssister = data; + } + else if (property.EqualsCaseless("ARTIST")) + { + artist = data; + } + else if (property.EqualsCaseless("SUBARTIST")) + { + artistAssister = data; + } + else if (property.EqualsCaseless("GENRE")) + { + targetComputing.Genre = data; + } + else if (property.EqualsCaseless("PLAYLEVEL")) + { + if (Utility.ToFloat64(data, out var levelTextValue)) + { + targetComputing.LevelTextValue = levelTextValue; + levelTextValue = Math.Abs(Math.Floor(levelTextValue)); + if (levelTextValue < 100) + { + targetComputing.LevelText = $"LV. {levelTextValue}"; + } + else + { + targetComputing.LevelText = $"LV. {levelTextValue % 100:00}"; + } + } + else + { + targetComputing.LevelText = data; + } + } + else if (property.EqualsCaseless("DIFFICULTY")) + { + if (Utility.ToInt32(data, out var level)) + { + targetComputing.LevelValue = (BaseNoteFile.Level)Math.Clamp(level, (int)BaseNoteFile.Level.Level0, (int)BaseNoteFile.Level.Level5); + } + } + else if (property.EqualsCaseless("STAGEFILE")) + { + if (string.IsNullOrEmpty(targetComputing.NoteDrawingName)) + { + targetComputing.NoteDrawingName = data; + } + } + else if (property.EqualsCaseless("BACKBMP")) + { + if (string.IsNullOrEmpty(targetComputing.NoteDrawingName)) + { + targetComputing.NoteDrawingName = data; + } + } + else if (property.EqualsCaseless("BANNER")) + { + targetComputing.BannerDrawingName = data; + } + else if (property.EqualsCaseless("COMMENT")) + { + targetComputing.Tag = data; + } + else if (property.EqualsCaseless("RANK")) + { + if (Utility.ToInt32(data, out var judgmentStage)) + { + switch (Math.Clamp(judgmentStage, 0, 4)) + { + case 0: + targetComputing.JudgmentStage = 10; + break; + case 1: + targetComputing.JudgmentStage = 7; + break; + case 2: + targetComputing.JudgmentStage = 5; + break; + case 3: + targetComputing.JudgmentStage = 3; + break; + case 4: + targetComputing.JudgmentStage = 0; + break; + } + } + } + } + } + } + targetComputing.Title = string.IsNullOrEmpty(titleAssister) || title.EndsWith(titleAssister) ? title : $"{title} {titleAssister}"; + targetComputing.Artist = string.IsNullOrEmpty(artistAssister) ? artist : $"{artist} / {artistAssister}"; + + var isAutoLongNote = targetComputing.IsAutoLongNote; + foreach (var (rawInput, earlyBMSLongInputItems) in earlyBMSLongInputItemSet) + { + EarlyBMSLongInputItem lastEarlyBMSLongInputItem = null; + foreach (var earlyBMSLongInputItem in earlyBMSLongInputItems) + { + if (earlyBMSLongInputItem.BMSID.EqualsCaseless(_longNoteBMSID)) + { + if (lastEarlyBMSLongInputItem != null) + { + ++targetComputing.LongNotes; + targetComputing.TotalNotes += targetComputing.IsLongNoteStand1 ? 1 : 2; + if (rawInput[1] == '6') + { + targetComputing.AutoableNotes += targetComputing.IsLongNoteStand1 ? 1 : 2; + } + var bmsPosition = lastEarlyBMSLongInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + bmsPosition = earlyBMSLongInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + if (!isAutoLongNote) + { + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + } + lastEarlyBMSLongInputItem = null; + continue; + } + } + else + { + if (lastEarlyBMSLongInputItem != null) + { + ++targetComputing.TotalNotes; + if (rawInput[1] == '6') + { + ++targetComputing.AutoableNotes; + } + var bmsPosition = lastEarlyBMSLongInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + } + } + lastEarlyBMSLongInputItem = earlyBMSLongInputItem; + } + if (lastEarlyBMSLongInputItem != null) + { + ++targetComputing.TotalNotes; + if (rawInput[1] == '6') + { + ++targetComputing.AutoableNotes; + } + var bmsPosition = lastEarlyBMSLongInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + } + } + + foreach (var (rawInput, earlyBMSInputItems) in earlyBMSInputItemSet) + { + EarlyBMSInputItem lastEarlyBMSInputItem = null; + foreach (var earlyBMSInputItem in earlyBMSInputItems) + { + if (lastEarlyBMSInputItem != null) + { + ++targetComputing.LongNotes; + targetComputing.TotalNotes += targetComputing.IsLongNoteStand1 ? 1 : 2; + if (rawInput[1] == '6') + { + targetComputing.AutoableNotes += targetComputing.IsLongNoteStand1 ? 1 : 2; + } + var bmsPosition = lastEarlyBMSInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + bmsPosition = earlyBMSInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + if (!isAutoLongNote) + { + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + } + lastEarlyBMSInputItem = null; + } + else + { + lastEarlyBMSInputItem = earlyBMSInputItem; + } + } + if (lastEarlyBMSInputItem != null) + { + ++targetComputing.TotalNotes; + if (rawInput[1] == '6') + { + ++targetComputing.AutoableNotes; + } + var bmsPosition = lastEarlyBMSInputItem.BMSPosition; + HighestPosition = Math.Max(HighestPosition, bmsPosition); + PositionStandNoteCountMap[bmsPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsPosition) + 1; + } + } + + var inputSet = new HashSet(); + foreach (var line in _lines) + { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); + var lineAt1 = line[1..]; + var delimited = lineAt1.Split(_delimiters, 2); + if (IsMainBMSData(lineAt1)) + { + var property = delimited.Length > 1 ? delimited[0] : delimited[0].Substring(0, 5); + property = property.PadLeft(5, '0'); + var data = delimited.Length > 1 ? delimited[1] : delimited[0][5..]; + var dataCount = data.Length - data.Length % 2; + var meter = Utility.ToInt32(property.Substring(0, 3)); + for (var meterCount = 0; meterCount < dataCount; meterCount += 2) + { + var bmsID = data.Substring(meterCount, 2); + if (bmsID != "00") + { + var bmsPosition = (double)meterCount / dataCount + meter; + var noteVariety0 = property[3]; + var noteVariety1 = property[4]; + switch (noteVariety0) + { + case '0': + switch (noteVariety1) + { + case '3': + PositionBPMMap[bmsPosition] = Convert.ToInt32(bmsID, 16); + break; + case '8': + if (bmsIDBPMMap.TryGetValue(bmsID, out var bpm)) + { + PositionBPMMap[bmsPosition] = bpm; + } + break; + case '9': + if (_bmsIDStopMap.TryGetValue(bmsID, out var stop)) + { + if (stop < 0.0) + { + throw new ArgumentException(LanguageSystem.Instance.NegativeStopFault); + } + bmsPositionStopMap[bmsPosition] = stop; + } + break; + } + break; + case '1': + case '2': + case '5': + case '6': + if (audioTargets.Contains(bmsID)) + { + audioValues.Add(bmsID); + } + break; + case 'S': + switch (noteVariety1) + { + case 'C': + if (_bmsIDMultiplierMap.TryGetValue(bmsID, out var multiplier)) + { + _bmsPositionMultiplierMap[bmsPosition] = multiplier; + } + break; + } + break; + } + inputSet.Add(GetBMSInput(noteVariety0, noteVariety1, Component.InputMode.InputMode142)); + } + } + } + else + { + if (delimited.Length > 1) + { + var property = delimited[0].Trim(); + var data = delimited[1].Trim(); + if (property.EqualsCaseless("TOTAL")) + { + if (Utility.ToFloat64(data, out var value)) + { + if (value > 0.0) + { + targetComputing.HitPointsValue = value / (100 * targetComputing.TotalNotes); + } + } + } + } + } + } + InputMode = GetInputMode(inputSet); + + for (var i = 0; i <= _highestMeter + 1; ++i) + { + bmsPositionSet.Add(i); + } + var lastBMSPosition = 0.0; + var lastLogicalY = 0.0; + var lastWait = 0.0; + var lastMultiplier = 1.0; + foreach (var bmsPosition in bmsPositionSet) + { + var meterMultiplier = meterMeterMultiplierMap.GetValueOrDefault((int)lastBMSPosition, 1.0); + lastLogicalY -= (bmsPosition - lastBMSPosition) * lastMultiplier * meterMultiplier * ComponentValue.LogicalYMeter; + _bmsPositionLogicalYMap[bmsPosition] = lastLogicalY; + lastWait += ComponentValue.MillisMeter * meterMultiplier * (bmsPosition - lastBMSPosition); + _bmsPositionWaitMap[bmsPosition] = lastWait; + if (PositionBPMMap.TryGetValue(bmsPosition, out var bpm)) + { + ComponentValue.SetBPM(bpm); + } + if (bmsPositionStopMap.TryGetValue(bmsPosition, out var stop)) + { + lastWait += ComponentValue.MillisMeter * stop / Component.StandardMeter; + } + if (_bmsPositionMultiplierMap.TryGetValue(bmsPosition, out var multiplier)) + { + lastMultiplier = multiplier; + } + lastBMSPosition = bmsPosition; + } + targetComputing.IsBanned = audioValues.Count < 2 || targetComputing.TotalNotes == 0; + targetComputing.IsHellBPM = targetComputing.TrapNotes > 0; + } + + public override void CompileImpl(DefaultCompute defaultComputer, byte[] noteFileContents) + { + var bmsIDAudioItemMap = new ConcurrentDictionary(); + var bmsIDHandledItemMap = new ConcurrentDictionary(); + var parallelItems = new ConcurrentBag(); + if (defaultComputer.LoadContents) + { + try + { + var noteDrawingPath = Utility.GetAvailable(defaultComputer.NoteDrawingPath, Utility.AvailableFlag.Drawing); + if (!string.IsNullOrEmpty(noteDrawingPath)) + { + defaultComputer.NoteHandledDrawingItem = new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.Load(noteDrawingPath, defaultComputer), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(noteDrawingPath, defaultComputer) + }; + } + } + catch + { + } + } + var isBanalMedia = (!_hasMedia || defaultComputer.AlwaysBanalMedia) && defaultComputer.BanalMedia; + var isBanalFailedMedia = (!_hasFailedMedia || defaultComputer.AlwaysBanalFailedMedia) && defaultComputer.BanalFailedMedia; + defaultComputer.LoadStandardContents(isBanalMedia, isBanalFailedMedia, parallelItems); + foreach (var line in _lines) + { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); + var lineAt1 = line[1..]; + if (!IsMainBMSData(lineAt1)) + { + var delimited = lineAt1.Split(_delimiters, 2); + var property = delimited[0].Trim(); + if (delimited.Length > 1) + { + var data = delimited[1].Trim(); + if (property.IsFrontCaselsss("BMP")) + { + if (defaultComputer.LoadedMedia) + { + property = property.Substring(3, 2); + if ((property != "00" || !isBanalFailedMedia) && !isBanalMedia) + { + parallelItems.Add(() => + { + try + { + if (_mediaMap.TryGetValue(NoteFile.GetNoteID512(), out var media)) + { + data = media; + } + var mediaFilePath = Utility.GetAvailable(Path.Combine(NoteFile.EntryItem.EntryPath, data), Utility.AvailableFlag.Drawing | Utility.AvailableFlag.Media); + if (!string.IsNullOrEmpty(mediaFilePath)) + { + bmsIDHandledItemMap[property] = Utility.GetAvailable(mediaFilePath) switch + { + Utility.AvailableFlag.Drawing => new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.LoadBMS(mediaFilePath, defaultComputer), + DefaultDrawing = DrawingSystem.Instance.LoadDefaultBMS(mediaFilePath, defaultComputer) + }, + Utility.AvailableFlag.Media => MediaSystem.Instance.Load(Utility.GetFiles(Path.GetDirectoryName(mediaFilePath), $"{Path.GetFileNameWithoutExtension(mediaFilePath)}.*") + .Where(targetFile => targetFile.IsTailCaselsss(".mp4")) + .FirstOrDefault() ?? mediaFilePath, defaultComputer), + _ => null as IHandledItem, + }; + } + } + catch + { + } + }); + } + } + } + else if (property.IsFrontCaselsss("WAV")) + { + parallelItems.Add(() => + { + try + { + var audioFilePath = Utility.GetAvailable(Path.Combine(NoteFile.EntryItem.EntryPath, data), Utility.AvailableFlag.Audio); + if (!string.IsNullOrEmpty(audioFilePath)) + { + bmsIDAudioItemMap[property.Substring(3, 2)] = AudioSystem.Instance.Load(audioFilePath, defaultComputer, 1F, data); + } + } + catch + { + } + }); + } + } + } + } + + if (defaultComputer.LoadContents) + { + var endStatus = parallelItems.Count; + var status = 0; + Utility.HandleHMP(parallelItems, Configure.Instance.CompilingBin, parallelItem => + { + parallelItem(); + defaultComputer.SetCompilingStatus((double)Interlocked.Increment(ref status) / endStatus); + }, SetCancelCompiler?.Token); + } + + if (bmsIDHandledItemMap.TryGetValue("00", out var mediaItem)) + { + defaultComputer.WaitMediaNoteMap.Into(0.0, new MediaNote + { + MediaMode = MediaNote.Mode.Failed, + HasContents = defaultComputer.LoadedMedia, + MediaItem = mediaItem + }); + } + Notes.AddRange(Enumerable.Range(0, _highestMeter + 1).Select(i => + { + var logicalY = ComponentValue.LevyingHeight + _bmsPositionLogicalYMap[i]; + var wait = _bmsPositionWaitMap[i]; + defaultComputer.MeterWaitMap[i] = wait; + return new MeterNote(logicalY, wait, i); + })); + var inputCount = Component.InputCounts[(int)InputMode]; + var bmsInputItemSets = new SortedSet[inputCount + 1]; + for (var i = inputCount; i > 0; --i) + { + bmsInputItemSets[i] = new(); + } + var bmsLongInputItemSets = new SortedSet[inputCount + 1]; + for (var i = inputCount; i > 0; --i) + { + bmsLongInputItemSets[i] = new(); + } + foreach (var line in _lines) + { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); + var lineAt1 = line[1..]; + if (IsMainBMSData(lineAt1)) + { + var delimited = lineAt1.Split(_delimiters, 2); + var property = delimited.Length > 1 ? delimited[0] : delimited[0].Substring(0, 5); + property = property.PadLeft(5, '0'); + var noteVariety0 = property[3]; + var noteVariety1 = property[4]; + if (noteVariety0 != '0' || noteVariety1 != '2') + { + var data = delimited.Length > 1 ? delimited[1] : delimited[0][5..]; + var dataCount = data.Length - data.Length % 2; + var meter = Utility.ToInt32(property.Substring(0, 3)); + for (var meterCount = 0; meterCount < dataCount; meterCount += 2) + { + var bmsID = data.Substring(meterCount, 2); + if (bmsID != "00") + { + var input = GetBMSInput(noteVariety0, noteVariety1, InputMode); + var bmsPosition = (double)meterCount / dataCount + meter; + var logicalY = ComponentValue.LevyingHeight + _bmsPositionLogicalYMap[bmsPosition]; + var wait = _bmsPositionWaitMap[bmsPosition]; + bmsIDAudioItemMap.TryGetValue(bmsID, out var audioItem); + var audioNote = new AudioNote + { + AudioItem = audioItem + }; + bmsIDHandledItemMap.TryGetValue(bmsID, out mediaItem); + switch (noteVariety0) + { + case '0': + switch (noteVariety1) + { + case '1': + defaultComputer.WaitAudioNoteMap.Into(wait, audioNote); + break; + case '3': + case '8': + if (PositionBPMMap.TryGetValue(bmsPosition, out var bpm)) + { + WaitBPMMap[wait] = bpm; + } + break; + case '4' when !isBanalMedia: + defaultComputer.WaitMediaNoteMap.Into(wait, new MediaNote + { + MediaMode = MediaNote.Mode.Default, + MediaItem = mediaItem, + HasContents = defaultComputer.LoadedMedia + }); + break; + case '6' when !isBanalMedia && !isBanalFailedMedia: + defaultComputer.WaitMediaNoteMap.Into(wait, new MediaNote + { + MediaMode = MediaNote.Mode.Failed, + MediaItem = mediaItem, + HasContents = defaultComputer.LoadedMedia + }); + break; + case '7' when !isBanalMedia: + defaultComputer.WaitMediaNoteMap.Into(wait, new MediaNote + { + MediaMode = MediaNote.Mode.Layer, + MediaItem = mediaItem, + HasContents = defaultComputer.LoadedMedia + }); + break; + case '9': + WaitStopMap[wait] = _bmsIDStopMap.GetValueOrDefault(bmsID) / Component.StandardMeter; + break; + } + break; + case '1': + case '2': + if (input != default) + { + var inputNote = new InputNote(logicalY, wait, new[] { audioNote }, input); + if (string.IsNullOrEmpty(_longNoteBMSID)) + { + Notes.Add(inputNote); + } + else + { + bmsLongInputItemSets[input].Add(new BMSLongInputItem + { + InputNote = inputNote, + BMSID = bmsID + }); + } + } + break; + case '3': + case '4': + if (input != default) + { + Notes.Add(new VoidNote(logicalY, wait, new[] { audioNote }, input)); + } + break; + case '5': + case '6': + if (input != default) + { + var inputNote = new InputNote(logicalY, wait, new[] { audioNote }, input); + if (!string.IsNullOrEmpty(_longNoteBMSID) && _longNoteBMSID.EqualsCaseless(bmsID)) + { + bmsLongInputItemSets[input].Add(new BMSLongInputItem + { + InputNote = inputNote, + BMSID = bmsID + }); + } + else + { + bmsInputItemSets[input].Add(new BMSInputItem + { + InputNote = inputNote + }); + } + } + break; + case 'D': + case 'E': + if (input != default) + { + Notes.Add(new TrapNote(logicalY, wait, Array.Empty(), input)); + } + break; + case 'S': + switch (noteVariety1) + { + case 'C' when _bmsPositionMultiplierMap.TryGetValue(bmsPosition, out var multiplier): + WaitMultiplierMap[wait] = multiplier; + break; + } + break; + } + } + } + } + } + } + for (var i = inputCount; i > 0; --i) + { + BMSLongInputItem lastBMSLongInputItem = null; + foreach (var bmsLongInputItem in bmsLongInputItemSets[i]) + { + if (bmsLongInputItem.BMSID.EqualsCaseless(_longNoteBMSID)) + { + if (lastBMSLongInputItem != null) + { + var lastInputNote = lastBMSLongInputItem.InputNote; + var lastWait = lastInputNote.Wait; + var targetWait = bmsLongInputItem.InputNote.Wait; + Notes.RemoveAll((Predicate)(note => + { + var wait = note.Wait; + return lastWait <= wait && wait <= targetWait && note.LevyingInput == i; + })); + Notes.Add(new LongNote(lastInputNote.LogicalY, lastWait, lastInputNote.AudioNotes, lastInputNote.LevyingInput, targetWait - lastWait, lastInputNote.LogicalY - bmsLongInputItem.InputNote.LogicalY)); + lastBMSLongInputItem = null; + continue; + } + } + else + { + if (lastBMSLongInputItem != null) + { + Notes.Add(lastBMSLongInputItem.InputNote); + } + } + lastBMSLongInputItem = bmsLongInputItem; + } + if (lastBMSLongInputItem != null) + { + Notes.Add(lastBMSLongInputItem.InputNote); + } + } + for (var i = inputCount; i > 0; --i) + { + BMSInputItem lastBMSInputItem = null; + foreach (var bmsInputItem in bmsInputItemSets[i]) + { + if (lastBMSInputItem != null) + { + var lastInputNote = lastBMSInputItem.InputNote; + var lastWait = lastInputNote.Wait; + var targetWait = bmsInputItem.InputNote.Wait; + Notes.RemoveAll((Predicate)(note => + { + var wait = note.Wait; + return lastWait <= wait && wait <= targetWait && note.LevyingInput == i; + })); + Notes.Add(new LongNote(lastInputNote.LogicalY, lastWait, lastInputNote.AudioNotes, i, targetWait - lastWait, lastInputNote.LogicalY - bmsInputItem.InputNote.LogicalY)); + lastBMSInputItem = null; + } + else + { + lastBMSInputItem = bmsInputItem; + } + } + if (lastBMSInputItem != null) + { + Notes.Add(lastBMSInputItem.InputNote); + } + } + } + + public virtual Component.InputMode GetInputMode(ICollection inputSet) + { + if (_is4K) + { + return Component.InputMode.InputMode4; + } + if (_is6K) + { + return Component.InputMode.InputMode6; + } + if (inputSet.All(input => input == 0)) + { + return Component.InputMode.InputMode51; + } + var isMode71 = inputSet.Contains(7) || inputSet.Contains(8); + var isMode102 = inputSet.Contains(9) || inputSet.Contains(10) || inputSet.Contains(11) || inputSet.Contains(12) || inputSet.Contains(13); + var isMode142 = (isMode71 && isMode102) || inputSet.Contains(14) || inputSet.Contains(15); + if (isMode142) + { + return Component.InputMode.InputMode142; + } + if (isMode102) + { + return Component.InputMode.InputMode102; + } + if (isMode71) + { + return Component.InputMode.InputMode71; + } + return Component.InputMode.InputMode51; + } + + static bool IsMainBMSData(string lineAt1) + { + if (lineAt1.Length >= 5) + { + var lineAt13 = lineAt1[3]; + var lineAt14 = lineAt1[4]; + return char.IsDigit(lineAt1[0]) && char.IsDigit(lineAt1[1]) && char.IsDigit(lineAt1[2]) && (char.IsDigit(lineAt13) || ((lineAt13 == 'D' || lineAt13 == 'E') && char.IsDigit(lineAt14)) || (lineAt13 == 'S' && lineAt14 == 'C')); + } + else + { + return false; + } + } + + static int GetBMSInput(char noteVariety0, char noteVariety1, Component.InputMode inputMode) + { + switch (noteVariety0) + { + case '1': + case '3': + case '5': + case 'D': + switch (inputMode) + { + case Component.InputMode.InputMode4: + switch (noteVariety1) + { + case '1': + case '2': + return noteVariety1 - '0'; + case '4': + case '5': + return noteVariety1 - '1'; + } + break; + case Component.InputMode.InputMode51: + case Component.InputMode.InputMode102: + switch (noteVariety1) + { + case '1': + case '2': + case '3': + case '4': + case '5': + return noteVariety1 - '0' + 1; + case '6': + return 1; + } + break; + case Component.InputMode.InputMode6: + switch (noteVariety1) + { + case '1': + case '2': + case '3': + return noteVariety1 - '0'; + case '5': + return noteVariety1 - '1'; + case '8': + case '9': + return noteVariety1 - '3'; + } + break; + case Component.InputMode.InputMode71: + case Component.InputMode.InputMode142: + switch (noteVariety1) + { + case '1': + case '2': + case '3': + case '4': + case '5': + return noteVariety1 - '0' + 1; + case '6': + return 1; + case '8': + case '9': + return noteVariety1 - '1'; + } + break; + case Component.InputMode.InputMode9: + switch (noteVariety1) + { + case '1': + case '2': + case '3': + case '4': + case '5': + return noteVariety1 - '0'; + } + break; + } + break; + case '2': + case '4': + case '6': + case 'E': + switch (inputMode) + { + case Component.InputMode.InputMode102: + switch (noteVariety1) + { + case '1': + case '2': + case '3': + case '4': + case '5': + return noteVariety1 - '0' + 6; + case '6': + return 12; + } + break; + case Component.InputMode.InputMode142: + switch (noteVariety1) + { + case '1': + case '2': + case '3': + case '4': + case '5': + return noteVariety1 - '0' + 8; + case '6': + return 16; + case '8': + case '9': + return noteVariety1 - '2' + 8; + } + break; + case Component.InputMode.InputMode9: + switch (noteVariety1) + { + case '2': + case '3': + case '4': + case '5': + return noteVariety1 - '0' + 4; + } + break; + } + break; + } + return default; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compiler/BMSONCompiler.cs b/Qwilight/Qwilight/Compiler/BMSONCompiler.cs new file mode 100644 index 0000000..88bfe29 --- /dev/null +++ b/Qwilight/Qwilight/Compiler/BMSONCompiler.cs @@ -0,0 +1,707 @@ +using Qwilight.Compute; +using Qwilight.Note; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.Collections.Concurrent; +using System.IO; +using System.Text; +using UtfUnknown; + +namespace Qwilight.Compiler +{ + public sealed class BMSONCompiler : BaseCompiler + { + static int GetBMSONInput(object x, Component.InputMode inputMode) + { + if (x != null) + { + switch (inputMode) + { + case Component.InputMode.InputMode4: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode5: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode6: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode7: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode8: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode9: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode10: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode51: + switch ((int)(long)x) + { + case 8: + return 1; + case 1: + case 2: + case 3: + case 4: + case 5: + return (int)(long)x + 1; + } + break; + case Component.InputMode.InputMode71: + switch ((int)(long)x) + { + case 8: + return 1; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return (int)(long)x + 1; + } + break; + case Component.InputMode.InputMode102: + switch ((int)(long)x) + { + case 8: + return 1; + case 16: + return 12; + case 1: + case 2: + case 3: + case 4: + case 5: + return (int)(long)x + 1; + case 9: + case 10: + case 11: + case 12: + case 13: + return (int)(long)x - 2; + } + break; + case Component.InputMode.InputMode142: + switch ((int)(long)x) + { + case 8: + return 1; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return (int)(long)x + 1; + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + return (int)(long)x; + } + break; + case Component.InputMode.InputMode242: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + return (int)(long)x + 1; + case 25: + return 1; + case 26: + return 26; + } + break; + case Component.InputMode.InputMode484: + switch ((int)(long)x) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + return (int)(long)x + 2; + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + return (int)(long)x; + case 25: + return 1; + case 26: + return 2; + case 51: + return 51; + case 52: + return 52; + } + break; + } + } + return default; + } + + readonly Dictionary _bmsonPositionLogicalYMap = new(); + readonly SortedDictionary _bmsonPositionWaitMap = new(); + JSON.Bmson _text; + bool _hasMedia; + long _res; + + public BMSONCompiler(BMSONFile bmsonFile, CancellationTokenSource setCancelCompiler) : base(bmsonFile, setCancelCompiler) + { + } + + public override double GetWaitValue(double waitPosition) => _bmsonPositionWaitMap[waitPosition]; + + public override void CompileImpl(Computing targetComputing, byte[] noteFileContents, int salt) + { + using (var rms = PoolSystem.Instance.GetDataFlow(noteFileContents)) + { + var format = NoteFormatID; + if (format == -1) + { + var formatComputer = CharsetDetector.DetectFromStream(rms).Detected; + rms.Position = 0; + format = formatComputer != null && formatComputer.Confidence >= 0.875 && formatComputer.Encoding != null ? formatComputer.Encoding.CodePage : 65001; + } + _text = Utility.GetJSON(Encoding.GetEncoding(format).GetString(rms.GetBuffer(), 0, (int)rms.Length)); + } + var title = _text.info.title; + var titleAssister0 = _text.info.subtitle; + var titleAssister1 = _text.info.chart_name; + targetComputing.Title = $"{title}{(string.IsNullOrEmpty(titleAssister0) || title.EndsWith(titleAssister0) ? string.Empty : $" {titleAssister0}")}{(string.IsNullOrEmpty(titleAssister1) || title.EndsWith(titleAssister1) ? string.Empty : $" {titleAssister1}")}"; + targetComputing.Artist = string.Join(" / ", _text.info.subartists.Prepend(_text.info.artist)); + targetComputing.Genre = _text.info.genre; + targetComputing.BannerDrawingName = _text.info.banner_image; + var levelTextValue = _text.info.level; + targetComputing.LevelTextValue = levelTextValue; + levelTextValue = Math.Abs(levelTextValue); + if (levelTextValue < 100) + { + targetComputing.LevelText = $"LV. {levelTextValue}"; + } + else + { + targetComputing.LevelText = $"LV. {levelTextValue % 100:00}"; + } + var longNoteVariety = _text.info.ln_type; + targetComputing.IsAutoLongNote = longNoteVariety != 2 && longNoteVariety != 3; + switch (_text.info.mode_hint) + { + case "generic-4keys": + InputMode = Component.InputMode.InputMode4; + break; + case "generic-5keys": + case "popn-5k": + InputMode = Component.InputMode.InputMode5; + break; + case "generic-6keys": + InputMode = Component.InputMode.InputMode6; + break; + case "generic-7keys": + InputMode = Component.InputMode.InputMode7; + break; + case "generic-8keys": + InputMode = Component.InputMode.InputMode8; + break; + case "generic-9keys": + case "popn-9k": + InputMode = Component.InputMode.InputMode9; + break; + case "generic-10keys": + InputMode = Component.InputMode.InputMode10; + break; + case "beat-5k": + InputMode = Component.InputMode.InputMode51; + break; + case "beat-10k": + InputMode = Component.InputMode.InputMode102; + break; + case "beat-14k": + InputMode = Component.InputMode.InputMode142; + break; + case "keyboard-24k": + InputMode = Component.InputMode.InputMode242; + break; + case "keyboard-24k-double": + InputMode = Component.InputMode.InputMode484; + break; + default: + InputMode = Component.InputMode.InputMode71; + break; + } + targetComputing.JudgmentStage = 1500 / _text.info.judge_rank - 10; + targetComputing.HitPointsValue = Math.Abs(0.07605 * _text.info.total / (_text.info.total + 650)); + targetComputing.NoteDrawingName = string.IsNullOrEmpty(_text.info.back_image) ? string.IsNullOrEmpty(_text.info.eyecatch_image) ? _text.info.title_image : _text.info.eyecatch_image : _text.info.back_image; + + var bmsonPositionSet = new SortedSet + { + 0L + }; + var audioCount = 0; + foreach (var audioChannel in _text.sound_channels) + { + if (!string.IsNullOrEmpty(audioChannel.name)) + { + ++audioCount; + } + foreach (var note in audioChannel.notes) + { + var bmsonPosition = note.y; + var input = GetBMSONInput(note.x, InputMode); + var isInput = input > 0; + var isLongInput = note.l > 0L; + bmsonPositionSet.Add(bmsonPosition); + if (isInput) + { + PositionStandNoteCountMap[bmsonPosition] = PositionStandNoteCountMap.GetValueOrDefault(bmsonPosition) + 1; + var isAutoableInput = Component.AutoableInputs[(int)InputMode].Contains(input); + if (isLongInput) + { + ++targetComputing.TotalNotes; + if (isAutoableInput) + { + ++targetComputing.AutoableNotes; + } + ++targetComputing.LongNotes; + } + else + { + ++targetComputing.TotalNotes; + if (isAutoableInput) + { + ++targetComputing.AutoableNotes; + } + } + } + if (isLongInput) + { + bmsonPosition += note.l; + bmsonPositionSet.Add(bmsonPosition); + } + HighestPosition = Math.Max(HighestPosition, bmsonPosition); + } + } + if (targetComputing.TotalNotes == 0) + { + InputMode = Component.InputMode.InputMode51; + } + foreach (var trapChannel in _text.mine_channels) + { + foreach (var note in trapChannel.notes) + { + var bmsonPosition = note.y; + var input = GetBMSONInput(note.x, InputMode); + var isInput = input > 0; + bmsonPositionSet.Add(bmsonPosition); + if (isInput) + { + ++targetComputing.TrapNotes; + } + HighestPosition = Math.Max(HighestPosition, bmsonPosition); + } + } + foreach (var paint in _text.bga.bga_events) + { + bmsonPositionSet.Add(paint.y); + _hasMedia = true; + } + foreach (var paint in _text.bga.layer_events) + { + bmsonPositionSet.Add(paint.y); + } + foreach (var paint in _text.bga.poor_events) + { + bmsonPositionSet.Add(paint.y); + } + foreach (var line in _text.lines) + { + bmsonPositionSet.Add(line.y); + HighestPosition = Math.Max(HighestPosition, line.y); + } + foreach (var bpmEvent in _text.bpm_events) + { + var bmsonPosition = bpmEvent.y; + PositionBPMMap.Add(bmsonPosition, bpmEvent.bpm); + bmsonPositionSet.Add(bmsonPosition); + } + var bmsonPositionStopMap = new SortedDictionary(); + foreach (var stopEvent in _text.stop_events) + { + var bmsonPosition = stopEvent.y; + bmsonPositionStopMap.Add(bmsonPosition, bmsonPositionStopMap.GetValueOrDefault(bmsonPosition) + stopEvent.duration); + bmsonPositionSet.Add(bmsonPosition); + } + targetComputing.LevyingBPM = _text.info.init_bpm; + ComponentValue = new Component(targetComputing.LevyingBPM); + _res = _text.info.resolution * 4; + var lastBMSONPosition = 0L; + var lastWait = 0.0; + var lastBPM = targetComputing.LevyingBPM; + foreach (var bmsonPosition in bmsonPositionSet) + { + _bmsonPositionLogicalYMap[bmsonPosition] = bmsonPosition * -ComponentValue.LogicalYMeter / _res; + lastWait += ComponentValue.MillisMeter * (bmsonPosition - lastBMSONPosition) / _res; + if (PositionBPMMap.TryGetValue(bmsonPosition, out var bpm)) + { + lastBPM = bpm; + ComponentValue.SetBPM(bpm); + } + _bmsonPositionWaitMap[bmsonPosition] = lastWait; + if (bmsonPositionStopMap.TryGetValue(bmsonPosition, out var stop)) + { + lastWait += ComponentValue.MillisMeter * stop / _res; + } + lastBMSONPosition = bmsonPosition; + } + targetComputing.IsBanned = audioCount < 2 || targetComputing.TotalNotes == 0; + targetComputing.IsHellBPM = targetComputing.TrapNotes > 0; + } + + public override void CompileImpl(DefaultCompute defaultComputer, byte[] noteFileContents) + { + var audioFileNameAudioItemMap = new ConcurrentDictionary(); + var mediaIDHandledItemMap = new ConcurrentDictionary(); + var parallelItems = new ConcurrentBag(); + if (defaultComputer.LoadContents) + { + try + { + var noteDrawingPath = Utility.GetAvailable(defaultComputer.NoteDrawingPath, Utility.AvailableFlag.Drawing); + if (!string.IsNullOrEmpty(noteDrawingPath)) + { + defaultComputer.NoteHandledDrawingItem = new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.Load(noteDrawingPath, defaultComputer), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(noteDrawingPath, defaultComputer) + }; + } + } + catch + { + } + } + var isBanalMedia = (!_hasMedia || defaultComputer.AlwaysBanalMedia) && defaultComputer.BanalMedia; + defaultComputer.LoadStandardContents(isBanalMedia, defaultComputer.BanalFailedMedia, parallelItems); + foreach (var audioFileName in _text.sound_channels.Select(audioChannel => audioChannel.name).Concat(_text.mine_channels.Select(traoChannel => traoChannel.name))) + { + parallelItems.Add(() => + { + try + { + var audioFilePath = Path.IsPathFullyQualified(audioFileName) ? audioFileName : Utility.GetAvailable(Path.Combine(NoteFile.EntryItem.EntryPath, audioFileName), Utility.AvailableFlag.Audio); + if (!string.IsNullOrEmpty(audioFilePath)) + { + audioFileNameAudioItemMap[audioFileName] = AudioSystem.Instance.Load(audioFilePath, defaultComputer, 1F); + } + } + catch + { + } + }); + } + if (defaultComputer.LoadedMedia && !isBanalMedia) + { + foreach (var paint in _text.bga.bga_header) + { + parallelItems.Add(() => + { + try + { + var mediaFilePath = Path.IsPathFullyQualified(paint.name) ? paint.name : Utility.GetAvailable(Path.Combine(NoteFile.EntryItem.EntryPath, paint.name), Utility.AvailableFlag.Drawing | Utility.AvailableFlag.Media); + if (!string.IsNullOrEmpty(mediaFilePath)) + { + mediaIDHandledItemMap[Utility.ToInt64(paint.id.ToString())] = (Utility.GetAvailable(mediaFilePath)) switch + { + Utility.AvailableFlag.Drawing => new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.Load(mediaFilePath, defaultComputer), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(mediaFilePath, defaultComputer) + }, + Utility.AvailableFlag.Media => MediaSystem.Instance.Load(mediaFilePath, defaultComputer), + _ => null, + }; + } + } + catch + { + mediaIDHandledItemMap[Utility.ToInt64(paint.id.ToString())] = null; + } + }); + } + } + + if (defaultComputer.LoadContents) + { + var endStatus = parallelItems.Count; + var status = 0; + Utility.HandleHMP(parallelItems, Configure.Instance.CompilingBin, parallelItem => + { + parallelItem(); + defaultComputer.SetCompilingStatus((double)Interlocked.Increment(ref status) / endStatus); + }, SetCancelCompiler?.Token); + } + + if (!isBanalMedia) + { + var hasContents = defaultComputer.LoadedMedia; + foreach (var mediaEvent in _text.bga.bga_events) + { + var bmsonPosition = mediaEvent.y; + defaultComputer.WaitMediaNoteMap.Into(_bmsonPositionWaitMap[bmsonPosition], new MediaNote + { + MediaMode = MediaNote.Mode.Default, + MediaItem = mediaIDHandledItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), + HasContents = hasContents + }); + } + foreach (var mediaEvent in _text.bga.layer_events) + { + var bmsonPosition = mediaEvent.y; + defaultComputer.WaitMediaNoteMap.Into(_bmsonPositionWaitMap[bmsonPosition], new MediaNote + { + MediaMode = MediaNote.Mode.Layer, + MediaItem = mediaIDHandledItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), + HasContents = hasContents + }); + } + foreach (var mediaEvent in _text.bga.poor_events) + { + var bmsonPosition = mediaEvent.y; + defaultComputer.WaitMediaNoteMap.Into(_bmsonPositionWaitMap[bmsonPosition], new MediaNote + { + MediaMode = MediaNote.Mode.Failed, + MediaItem = mediaIDHandledItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), + HasContents = hasContents + }); + } + } + Notes.AddRange(Enumerable.Range(0, _text.lines.Length).Select(i => + { + var bmsonPosition = _text.lines[i].y; + var logicalY = ComponentValue.LevyingHeight + _bmsonPositionLogicalYMap[bmsonPosition]; + var wait = _bmsonPositionWaitMap[bmsonPosition]; + defaultComputer.MeterWaitMap[i] = wait; + return new MeterNote(logicalY, wait, i); + })); + foreach (var audioChannel in _text.sound_channels) + { + var lastAudioNotePosition = 0L; + var notes = audioChannel.notes.OrderBy(note => note.y).ToArray(); + var notesLength = notes.Length; + for (var i = 0; i < notesLength; ++i) + { + var note = notes[i]; + var isContinuous = note.c; + var bmsonPosition = note.y; + var logicalY = ComponentValue.LevyingHeight + _bmsonPositionLogicalYMap[bmsonPosition]; + var wait = _bmsonPositionWaitMap[bmsonPosition]; + audioFileNameAudioItemMap.TryGetValue(audioChannel.name, out var audioItem); + var audioNote = new AudioNote + { + AudioLevyingPosition = isContinuous ? (uint)(wait - _bmsonPositionWaitMap[lastAudioNotePosition]) : 0U, + AudioItem = audioItem, + Length = i + 1 < notesLength ? (uint?)(_bmsonPositionWaitMap[notes[i + 1].y] - wait) : null + }; + var input = GetBMSONInput(note.x, InputMode); + if (input > 0) + { + var targetNote = Notes.Find(note => note.Wait == wait && note.LevyingInput == input); + if (targetNote != null) + { + targetNote.AudioNotes.Add(audioNote); + } + else + { + if (note.l > 0L) + { + Notes.Add(new LongNote(logicalY, wait, new[] { audioNote }, input, _bmsonPositionWaitMap[bmsonPosition + note.l] - wait, logicalY - (ComponentValue.LevyingHeight + _bmsonPositionLogicalYMap[bmsonPosition + note.l]))); + } + else + { + Notes.Add(new InputNote(logicalY, wait, new[] { audioNote }, input)); + } + } + } + else if (audioItem != null) + { + defaultComputer.WaitAudioNoteMap.Into(wait, audioNote); + } + if (!isContinuous) + { + lastAudioNotePosition = bmsonPosition; + } + } + } + foreach (var trapChannel in _text.mine_channels) + { + foreach (var note in trapChannel.notes.OrderBy(note => note.y)) + { + var input = GetBMSONInput(note.x, InputMode); + if (input > 0) + { + var bmsonPosition = note.y; + var logicalY = ComponentValue.LevyingHeight + _bmsonPositionLogicalYMap[bmsonPosition]; + var wait = _bmsonPositionWaitMap[bmsonPosition]; + audioFileNameAudioItemMap.TryGetValue(trapChannel.name, out var audioItem); + var audioNote = new AudioNote + { + AudioItem = audioItem + }; + Notes.Add(new TrapNote(logicalY, wait, new[] { audioNote }, input, note.damage > 0)); + } + } + } + foreach (var (bmsonPosition, bpm) in PositionBPMMap) + { + WaitBPMMap[_bmsonPositionWaitMap[bmsonPosition]] = bpm; + } + foreach (var stopEvent in _text.stop_events) + { + WaitStopMap[_bmsonPositionWaitMap[stopEvent.y]] = (double)stopEvent.duration / _res; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compiler/BaseCompiler.cs b/Qwilight/Qwilight/Compiler/BaseCompiler.cs new file mode 100644 index 0000000..822d350 --- /dev/null +++ b/Qwilight/Qwilight/Compiler/BaseCompiler.cs @@ -0,0 +1,1140 @@ +using MoonSharp.Interpreter; +using Qwilight.Compute; +using Qwilight.Note; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.IO; + +namespace Qwilight.Compiler +{ + public abstract class BaseCompiler + { + public static BaseCompiler GetCompiler(BaseNoteFile noteFile, CancellationTokenSource setCancelCompiler) => noteFile switch + { + PMSFile pmsFile => new PMSCompiler(pmsFile, setCancelCompiler), + BMSONFile bmsonFile => new BMSONCompiler(bmsonFile, setCancelCompiler), + BMSFile bmsFile => new BMSCompiler(bmsFile, setCancelCompiler), + _ => default + }; + + public Component.InputMode InputMode { get; set; } + + public BaseNoteFile NoteFile { get; } + + public CancellationTokenSource SetCancelCompiler { get; } + + public int NoteFormatID { get; } + + public List Notes { get; } = new(); + + public Component ComponentValue { get; set; } + + public BaseCompiler(BaseNoteFile noteFile, CancellationTokenSource setCancelCompiler) + { + NoteFile = noteFile; + SetCancelCompiler = setCancelCompiler; + NoteFormatID = DB.Instance.GetFormat(noteFile); + } + + public abstract void CompileImpl(Computing targetComputing, byte[] noteFileContents, int salt); + + public abstract void CompileImpl(DefaultCompute defaultComputer, byte[] noteFileContents); + + public Dictionary WaitBPMMap { get; } = new(); + + public Dictionary WaitStopMap { get; } = new(); + + public SortedDictionary PositionBPMMap { get; } = new(); + + public SortedDictionary PositionStandNoteCountMap { get; } = new(); + + public SortedDictionary WaitMultiplierMap { get; } = new(Comparer.Create((x, y) => y.CompareTo(x))); + + public double HighestPosition { get; set; } + + public abstract double GetWaitValue(double waitPosition); + + void OnCompiled(Computing targetComputing) + { + targetComputing.InputMode = InputMode; + } + + public void Compile(Computing targetComputing, byte[] noteFileContents, int salt) + { + try + { + HandleCompile(targetComputing, noteFileContents, salt); + OnCompiled(targetComputing); + targetComputing.OnCompiled(); + } + catch (Exception e) + { + targetComputing.OnFault(e); + } + } + + void HandleCompile(Computing targetComputing, byte[] noteFileContents, int salt) + { + CompileImpl(targetComputing, noteFileContents, salt); + if (!string.IsNullOrEmpty(targetComputing.NoteDrawingName)) + { + targetComputing.NoteDrawingPath = Path.Combine(NoteFile.EntryItem.EntryPath, targetComputing.NoteDrawingName); + } + if (!string.IsNullOrEmpty(targetComputing.BannerDrawingName)) + { + targetComputing.BannerDrawingPath = Path.Combine(NoteFile.EntryItem.EntryPath, targetComputing.BannerDrawingName); + } + var trailerAudioName = targetComputing.TrailerAudioName; + targetComputing.TrailerAudioPath = Path.Combine(NoteFile.EntryItem.EntryPath, string.IsNullOrEmpty(trailerAudioName) ? "PREVIEW.WAV" : trailerAudioName); + var rawHighestBPM = targetComputing.LevyingBPM; + if (PositionBPMMap.Count > 0) + { + targetComputing.LowestBPM = Math.Min(PositionBPMMap.Values.Min(), targetComputing.LevyingBPM); + targetComputing.HighestBPM = Math.Max(PositionBPMMap.Values.Max(), targetComputing.LevyingBPM); + rawHighestBPM = targetComputing.HighestBPM; + var bpmWaitMap = new Dictionary(); + var lastBPM = targetComputing.LevyingBPM; + var lastBPMPosition = 0.0; + foreach (var (bpmPosition, bpm) in PositionBPMMap) + { + if (bpmPosition <= HighestPosition) + { + bpmWaitMap[lastBPM] = bpmWaitMap.GetValueOrDefault(lastBPM) + GetWaitValue(bpmPosition) - GetWaitValue(lastBPMPosition); + lastBPMPosition = bpmPosition; + lastBPM = bpm; + } + } + bpmWaitMap[lastBPM] = bpmWaitMap.GetValueOrDefault(lastBPM) + GetWaitValue(HighestPosition) - GetWaitValue(lastBPMPosition); + var longestWait = bpmWaitMap.Values.Max(); + var longestBPMs = bpmWaitMap.Where(pair => pair.Value == longestWait).Select(pair => pair.Key).ToArray(); + if (longestBPMs.Length > 0) + { + var validBPMs = longestBPMs.Where(bpm => bpm > 0.5 && bpm < 65536).ToArray(); + if (validBPMs.Length > 0) + { + targetComputing.BPM = validBPMs.Min(); + } + else + { + var validBPMWaitValues = bpmWaitMap.Where(pair => + { + var bpm = pair.Key; + return bpm > 0.5 && bpm < 65536; + }).ToArray(); + if (validBPMWaitValues.Length > 0) + { + var validLongestWait = validBPMWaitValues.Max(pair => pair.Value); + targetComputing.BPM = validBPMWaitValues.Where(pair => pair.Value == validLongestWait).Min().Key; + } + else + { + var bpm = longestBPMs.Max(); + if (bpm % 100001 == 0) + { + targetComputing.BPM = bpm / 100001; + } + else + { + targetComputing.BPM = bpm; + } + } + } + } + } + else + { + if (targetComputing.LevyingBPM % 100001 == 0) + { + targetComputing.BPM = targetComputing.LevyingBPM / 100001; + } + else + { + targetComputing.BPM = targetComputing.LevyingBPM; + } + targetComputing.LowestBPM = targetComputing.BPM; + targetComputing.HighestBPM = targetComputing.BPM; + } + targetComputing.Length = GetWaitValue(HighestPosition); + targetComputing.IsHellBPM &= rawHighestBPM >= 65536; + if (PositionStandNoteCountMap.Count > 0) + { + var positionStandNoteCounts = PositionStandNoteCountMap.ToArray(); + var lowestPosition = 0; + var lowestWait = GetWaitValue(positionStandNoteCounts[lowestPosition].Key); + var lowestCount = positionStandNoteCounts[lowestPosition].Value; + var highestInputCount = lowestCount; + var i = 1; + while (i < positionStandNoteCounts.Length) + { + var positionStandNoteCount = positionStandNoteCounts[i]; + if (GetWaitValue(positionStandNoteCount.Key) - lowestWait < 1000.0) + { + highestInputCount += positionStandNoteCount.Value; + ++i; + } + else + { + targetComputing.HighestInputCount = Math.Max(highestInputCount, targetComputing.HighestInputCount); + highestInputCount -= lowestCount; + ++lowestPosition; + lowestWait = GetWaitValue(positionStandNoteCounts[lowestPosition].Key); + lowestCount = positionStandNoteCounts[lowestPosition].Value; + } + } + targetComputing.HighestInputCount = Math.Max(highestInputCount, targetComputing.HighestInputCount); + } + targetComputing.PlatformText = Utility.GetPlatformText(targetComputing.Title, targetComputing.Artist, targetComputing.GenreText, targetComputing.LevelText); + targetComputing.AssistFileName = Path.GetFileName(Utility.GetFiles(NoteFile.EntryItem.EntryPath).FirstOrDefault(filePath => filePath.IsTailCaselsss(".txt") && filePath.ContainsCaselsss("README"))); + } + + public void Compile(DefaultCompute defaultComputer) + { + try + { + if (NoteFile.IsValid()) + { + defaultComputer.NoteFileContents = NoteFile.GetContents(); + HandleCompile(defaultComputer, defaultComputer.NoteFileContents, defaultComputer.ModeComponentValue.Salt); + HandleCompile(defaultComputer, defaultComputer.NoteFileContents); + OnCompiled(defaultComputer); + defaultComputer.OnCompiled(); + } + else + { + throw new InvalidOperationException(LanguageSystem.Instance.EditedNoteFileFault); + } + } + catch (OperationCanceledException) + { + defaultComputer.OnStopped(); + } + catch (ScriptRuntimeException e) + { + defaultComputer.OnFault(e); + } + catch (Exception e) + { + defaultComputer.OnFault(e); + } + finally + { + defaultComputer.SetCompilingStatus(0.0); + } + } + + void HandleCompile(DefaultCompute defaultComputer, byte[] noteFileContents) + { + CompileImpl(defaultComputer, noteFileContents); + if (defaultComputer.IsLongNoteStand1) + { + defaultComputer.TotalNotes = Notes.Sum(note => note.HasStand ? 1 : 0); + } + else + { + defaultComputer.TotalNotes = Notes.Sum(note => note.HasStand ? note.LongWait > 0.0 ? 2 : 1 : 0); + } + + if (defaultComputer.LoopingBanalMedia != null) + { + defaultComputer.WaitMediaNoteMap.Into(0.0, new() + { + MediaMode = MediaNote.Mode.Default, + IsLooping = true, + MediaItem = defaultComputer.LoopingBanalMedia, + HasContents = true + }); + } + if (defaultComputer.LoopingBanalFailedMedia != null) + { + defaultComputer.WaitMediaNoteMap.Into(0.0, new() + { + MediaMode = MediaNote.Mode.Failed, + IsLooping = true, + MediaItem = defaultComputer.LoopingBanalFailedMedia, + HasContents = true + }); + } + + // 특정 도전 과제용 라이프 게이지를 사용합니다. + if (defaultComputer.ModeComponentValue.HitPointsModeValue == ModeComponent.HitPointsMode.Test) + { + defaultComputer.HitPointsValue = 0.001; + } + + // 1P를 2P로 복사합니다. + if (defaultComputer.ModeComponentValue.PutCopyNotesAvailable) + { + switch (InputMode) + { + case Component.InputMode.InputMode51: + switch (defaultComputer.ModeComponentValue.PutCopyNotesValueV2) + { + case ModeComponent.PutCopyNotes.Copy: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var targetNote = CopyNote(Notes[i]); + if (targetNote != null) + { + if (targetNote.LevyingInput == 1) + { + targetNote.LevyingInput = 12; + } + else + { + targetNote.LevyingInput += 5; + } + Notes.Add(targetNote); + } + } + break; + case ModeComponent.PutCopyNotes.P1Symmetric: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var note = Notes[i]; + var targetNote = CopyNote(note); + if (targetNote != null) + { + if (note.LevyingInput != 1) + { + note.LevyingInput = 8 - note.LevyingInput; + } + + if (targetNote.LevyingInput == 1) + { + targetNote.LevyingInput = 12; + } + else + { + targetNote.LevyingInput += 5; + } + Notes.Add(targetNote); + } + } + break; + case ModeComponent.PutCopyNotes.P2Symmetric: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var targetNote = CopyNote(Notes[i]); + if (targetNote != null) + { + if (targetNote.LevyingInput == 1) + { + targetNote.LevyingInput = 12; + } + else + { + targetNote.LevyingInput = 13 - targetNote.LevyingInput; + } + Notes.Add(targetNote); + } + } + break; + } + InputMode = Component.InputMode.InputMode102; + break; + case Component.InputMode.InputMode71: + switch (defaultComputer.ModeComponentValue.PutCopyNotesValueV2) + { + case ModeComponent.PutCopyNotes.Copy: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var targetNote = CopyNote(Notes[i]); + if (targetNote != null) + { + if (targetNote.LevyingInput == 1) + { + targetNote.LevyingInput = 16; + } + else + { + targetNote.LevyingInput += 7; + } + Notes.Add(targetNote); + } + } + break; + case ModeComponent.PutCopyNotes.P1Symmetric: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var note = Notes[i]; + var targetNote = CopyNote(note); + if (targetNote != null) + { + if (note.LevyingInput != 1) + { + note.LevyingInput = 10 - note.LevyingInput; + } + + if (targetNote.LevyingInput == 1) + { + targetNote.LevyingInput = 16; + } + else + { + targetNote.LevyingInput += 7; + } + Notes.Add(targetNote); + } + } + break; + case ModeComponent.PutCopyNotes.P2Symmetric: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var targetNote = CopyNote(Notes[i]); + if (targetNote != null) + { + if (targetNote.LevyingInput == 1) + { + targetNote.LevyingInput = 16; + } + else + { + targetNote.LevyingInput = 17 - targetNote.LevyingInput; + } + Notes.Add(targetNote); + } + } + break; + } + InputMode = Component.InputMode.InputMode142; + break; + } + + BaseNote CopyNote(BaseNote note) => note switch + { + TrapNote trapNote => new TrapNote(trapNote.LogicalY, trapNote.Wait, trapNote.AudioNotes, trapNote.LevyingInput), + LongNote longNote => new LongNote(longNote.LogicalY, longNote.Wait, longNote.AudioNotes, longNote.LevyingInput, longNote.LongWait, longNote.LongHeight), + VoidNote voidNote => new VoidNote(voidNote.LogicalY, voidNote.Wait, voidNote.AudioNotes, voidNote.LevyingInput), + InputNote inputNote => new InputNote(inputNote.LogicalY, inputNote.Wait, inputNote.AudioNotes, inputNote.LevyingInput), + _ => null + }; + } + + var levyingInputMode = InputMode; + var inputFavorModeValue = defaultComputer.ModeComponentValue.InputFavorModeValue; + if (inputFavorModeValue != ModeComponent.InputFavorMode.Default) + { + var defaultFavorInputs = Component.FavorInputs[(int)InputMode, (int)inputFavorModeValue]; + for (var i = Notes.Count - 1; i >= 0; --i) + { + var note = Notes[i]; + if (note.HasInput) + { + var input = defaultFavorInputs[note.LevyingInput]; + if (input > 0) + { + note.LevyingInput = input; + } + else + { + Notes.RemoveAt(i); + foreach (var audioNote in note.AudioNotes) + { + defaultComputer.WaitAudioNoteMap.Into(note.Wait, audioNote); + } + } + } + } + switch (inputFavorModeValue) + { + case ModeComponent.InputFavorMode.Mode4: + InputMode = Component.InputMode.InputMode4; + break; + case ModeComponent.InputFavorMode.Mode5: + InputMode = Component.InputMode.InputMode5; + break; + case ModeComponent.InputFavorMode.Mode6: + InputMode = Component.InputMode.InputMode6; + break; + case ModeComponent.InputFavorMode.Mode7: + InputMode = Component.InputMode.InputMode7; + break; + case ModeComponent.InputFavorMode.Mode8: + InputMode = Component.InputMode.InputMode8; + break; + case ModeComponent.InputFavorMode.Mode9: + InputMode = Component.InputMode.InputMode9; + break; + case ModeComponent.InputFavorMode.Mode51: + InputMode = Component.InputMode.InputMode51; + break; + case ModeComponent.InputFavorMode.Mode71: + InputMode = Component.InputMode.InputMode71; + break; + case ModeComponent.InputFavorMode.Mode102: + InputMode = Component.InputMode.InputMode102; + break; + case ModeComponent.InputFavorMode.Mode142: + InputMode = Component.InputMode.InputMode142; + break; + case ModeComponent.InputFavorMode.Mode10: + InputMode = Component.InputMode.InputMode10; + break; + case ModeComponent.InputFavorMode.Mode242: + InputMode = Component.InputMode.InputMode242; + break; + case ModeComponent.InputFavorMode.Mode484: + InputMode = Component.InputMode.InputMode484; + break; + } + } + + var inputCount = Component.InputCounts[(int)InputMode]; + var autoableInputCount = Component.AutoableInputCounts[(int)InputMode]; + var autoableInputs = Component.AutoableInputs[(int)InputMode]; + var isCounterWave = defaultComputer.ModeComponentValue.WaveModeValue == ModeComponent.WaveMode.Counter; + + foreach (var (wait, bpm) in WaitBPMMap) + { + defaultComputer.WaitBPMMap[wait] = bpm; + } + foreach (var (wait, stop) in WaitStopMap) + { + var lastBPMs = defaultComputer.WaitBPMMap.Where(pair => pair.Key <= wait).ToArray(); + var lastBPM = lastBPMs.Length > 0 ? lastBPMs.Last().Value : defaultComputer.LevyingBPM; + ComponentValue.SetBPM(lastBPM); + defaultComputer.WaitBPMMap[wait] = 0.0; + defaultComputer.WaitBPMMap[wait + ComponentValue.MillisMeter * stop] = lastBPM; + } + var lastWait = double.MaxValue; + foreach (var (wait, multiplier) in WaitMultiplierMap) + { + var lastBPMs = defaultComputer.WaitBPMMap.Where(pair => pair.Key <= wait).ToArray(); + defaultComputer.WaitBPMMap[wait] = lastBPMs.Length > 0 ? lastBPMs.Last().Value : defaultComputer.LevyingBPM; + foreach (var targetWait in defaultComputer.WaitBPMMap.Keys.Where(targetWait => wait <= targetWait && targetWait < lastWait).ToArray()) + { + defaultComputer.WaitBPMMap[targetWait] *= multiplier; + } + lastWait = wait; + } + + switch (defaultComputer.ModeComponentValue.BPMModeValue) + { + case ModeComponent.BPMMode.Not: + defaultComputer.WaitBPMMap.Clear(); + defaultComputer.LevyingBPM = defaultComputer.BPM; + ComponentValue = new(defaultComputer.LevyingBPM); + foreach (var note in Notes) + { + note.LogicalY = ComponentValue.LevyingHeight - note.Wait * ComponentValue.LogicalYMillis; + note.LongHeight = note.LongWait * ComponentValue.LogicalYMillis; + } + break; + } + + var audioNoteSaltComputer = new Random(defaultComputer.ModeComponentValue.Salt); + foreach (var (wait, audioNotes) in defaultComputer.WaitAudioNoteMap.ToArray()) + { + defaultComputer.WaitAudioNoteMap[wait] = audioNotes.Select(audioNote => new AudioNote() + { + AudioItem = audioNote.AudioItem, + Length = audioNote.Length, + AudioLevyingPosition = audioNote.AudioLevyingPosition, + Salt = audioNoteSaltComputer.Next() + }).ToList(); + } + + Notes.Sort(); + var inputNotes = Notes.Where(note => note.HasInput).ToArray(); + if (inputNotes.Length > 0) + { + var saltComputer = new Random(defaultComputer.ModeComponentValue.Salt); + foreach (var inputNote in inputNotes) + { + inputNote.Salt = saltComputer.Next(); + } + var inputSaltComputer = new Random(defaultComputer.ModeComponentValue.Salt); + var inputSalts = new int[inputCount + 1]; + for (var i = inputCount; i >= 0; --i) + { + inputSalts[i] = inputSaltComputer.Next(); + } + foreach (var toSaltNote in inputNotes) + { + toSaltNote.InputSalt = inputSalts[toSaltNote.LevyingInput]; + } + if (defaultComputer.ModeComponentValue.NoteSaltModeValue != ModeComponent.NoteSaltMode.Default) + { + var saltInputComputer = new Random(defaultComputer.ModeComponentValue.Salt); + var isHalfSalt = defaultComputer.ModeComponentValue.NoteSaltModeValue == ModeComponent.NoteSaltMode.HalfInputSalt; + switch (defaultComputer.ModeComponentValue.NoteSaltModeValue) + { + case ModeComponent.NoteSaltMode.InputSalt: + case ModeComponent.NoteSaltMode.HalfInputSalt: + SaltInput(inputNotes); + break; + case ModeComponent.NoteSaltMode.MeterSalt: + var meterWaitCount = defaultComputer.MeterWaitMap.Count; + var levyingMeterWait = defaultComputer.MeterWaitMap[0]; + for (var i = 1; i < meterWaitCount; ++i) + { + var asMeterWait = defaultComputer.MeterWaitMap[i]; + var inputNoteInMeters = inputNotes.Where(note => + { + var wait = note.Wait; + return levyingMeterWait <= wait && wait < asMeterWait; + }).ToArray(); + if (inputNoteInMeters.Length > 0 && asMeterWait <= inputNoteInMeters.Max(note => note.Wait + note.LongWait)) + { + SaltInput(Array.Empty()); + continue; + } + SaltInput(inputNotes.Where(note => + { + var wait = note.Wait; + return levyingMeterWait <= wait && wait < asMeterWait; + }).ToArray()); + levyingMeterWait = asMeterWait; + defaultComputer.SetCompilingStatus((double)i / (meterWaitCount - 1)); + } + break; + default: + var endStatus = inputNotes.Length; + var status = 0; + var saltedNotes = new List(); + foreach (var targetNote in inputNotes) + { + var input = targetNote.LevyingInput; + switch (defaultComputer.ModeComponentValue.NoteSaltModeValue) + { + case ModeComponent.NoteSaltMode.Symmetric: + if (!autoableInputs.Contains(input)) + { + targetNote.LevyingInput = autoableInputCount switch + { + 0 => inputCount + 1 - input, + 1 => inputCount + 2 - input, + 2 => inputCount + 1 - input, + 4 => inputCount + 1 - input, + _ => default + }; + } + break; + case ModeComponent.NoteSaltMode.Salt: + if (!autoableInputs.Contains(input)) + { + targetNote.LevyingInput = autoableInputCount switch + { + 0 => SaltNote(saltedNotes, targetNote, 1, inputCount + 1), + 1 => SaltNote(saltedNotes, targetNote, 2, inputCount + 1), + 2 => SaltNote(saltedNotes, targetNote, 2, inputCount), + 4 => SaltNote(saltedNotes, targetNote, 3, inputCount - 1), + _ => default + }; + } + break; + } + defaultComputer.SetCompilingStatus((double)++status / endStatus); + } + break; + } + // 랜덤 + int SaltNote(ICollection saltedNotes, BaseNote targetNote, int levyingInput, int lastInput) + { + var wait = targetNote.Wait; + var longWait = targetNote.LongWait; + var levyingSaltInput = targetNote.Salt % (lastInput - levyingInput) + levyingInput; + var saltInput = levyingSaltInput; + var loopCount = lastInput - levyingInput; + do + { + if (saltedNotes.Any(note => + { + return note != targetNote && note.LevyingInput == saltInput && note.IsCollided(targetNote); + })) + { + if (++saltInput >= lastInput) + { + saltInput = levyingInput; + } + if (--loopCount > 0) + { + continue; + } + } + break; + } while (true); + saltedNotes.Add(targetNote); + return saltInput; + } + // 라인 랜덤 + void SaltInput(BaseNote[] notes) + { + var inputCountLength = inputCount - autoableInputCount; + var saltedInputs = new int[inputCountLength]; + for (var i = inputCountLength - 1; i >= 0; --i) + { + switch (autoableInputCount) + { + case 0: + saltedInputs[i] = i + 1; + break; + case 1: + case 2: + saltedInputs[i] = i + 2; + break; + } + } + if (isHalfSalt) + { + var endHalfInputCountLength = (int)Math.Ceiling(inputCountLength / 2.0); + for (var i = inputCountLength - 1; i > endHalfInputCountLength; --i) + { + var j = endHalfInputCountLength + saltInputComputer.Next(inputCountLength - endHalfInputCountLength); + (saltedInputs[i], saltedInputs[j]) = (saltedInputs[j], saltedInputs[i]); + } + var levyingHalfInputCountLength = inputCountLength / 2; + for (var i = levyingHalfInputCountLength - 1; i > 0; --i) + { + var j = saltInputComputer.Next(levyingHalfInputCountLength); + (saltedInputs[i], saltedInputs[j]) = (saltedInputs[j], saltedInputs[i]); + } + } + else + { + for (var i = inputCountLength - 1; i > 0; --i) + { + var j = saltInputComputer.Next(inputCountLength); + (saltedInputs[i], saltedInputs[j]) = (saltedInputs[j], saltedInputs[i]); + } + } + foreach (var note in notes) + { + var input = note.LevyingInput; + if (!autoableInputs.Contains(input)) + { + note.LevyingInput = autoableInputCount switch + { + 0 => saltedInputs[input - 1], + 1 => saltedInputs[input - 2], + 2 => saltedInputs[input - 2], + _ => default + }; + } + } + } + } + } + + var waitAudioNotes = defaultComputer.WaitAudioNoteMap.Where(pair => pair.Value.Count > 0).ToArray(); + var notes = Notes.Where(note => note.HasContents).ToArray(); + defaultComputer.Length = Utility.Max(notes.Select(note => note.Wait + note.LongWait).DefaultIfEmpty(0.0).Max(), + waitAudioNotes.Length > 0 ? waitAudioNotes.Max(pair => pair.Key) : 0.0, + defaultComputer.WaitMediaNoteMap.Count > 0 ? defaultComputer.WaitMediaNoteMap.Keys.Max() : 0.0 + ); + + var lastLevyingPosition = defaultComputer.Length; + var lastLevyingPositions = new double[5]; + for (var i = lastLevyingPositions.Length - 1; i >= 0; --i) + { + lastLevyingPositions[i] = lastLevyingPosition; + } + foreach (var (wait, mediaNotes) in defaultComputer.WaitMediaNoteMap.ToArray()) + { + defaultComputer.WaitMediaNoteMap[wait] = mediaNotes.Select(mediaNote => + { + var mediaItem = mediaNote.MediaItem; + var mediaNoteModified = new MediaNote + { + MediaMode = mediaNote.MediaMode, + IsLooping = mediaNote.IsLooping, + MediaItem = mediaItem, + HasContents = mediaNote.HasContents, + MediaLevyingPosition = mediaNote.MediaLevyingPosition, + Length = mediaItem == null || double.IsInfinity(mediaItem.Length) ? lastLevyingPositions[(int)mediaNote.MediaMode] - wait : mediaItem.Length + }; + lastLevyingPositions[(int)mediaNoteModified.MediaMode] = wait; + return mediaNoteModified; + }).ToList(); + } + + defaultComputer.AudioLength = Utility.Max(notes.Select(note => + { + var audioNotes = note.AudioNotes; + if (audioNotes.Count > 0) + { + return note.Wait + note.LongWait + audioNotes.Max(audioNote => audioNote.Length ?? audioNote.AudioItem?.Length ?? 0.0); + } + else + { + return note.Wait + note.LongWait; + } + }).DefaultIfEmpty(0.0).Max(), + waitAudioNotes.Length > 0 ? waitAudioNotes.Max(pair => pair.Key + pair.Value.Max(audioNote => audioNote.Length ?? audioNote.AudioItem?.Length ?? 0.0)) : 0.0, + defaultComputer.WaitMediaNoteMap.Count > 0 ? defaultComputer.WaitMediaNoteMap.Max(pair => pair.Key + pair.Value.Max(mediaNote => mediaNote.Length)) : 0.0 + ); + + // 거꾸로 플레이합니다. + if (isCounterWave) + { + foreach (var note in Notes) + { + note.Wait = defaultComputer.Length + Component.QuitWait - note.Wait - note.LongWait + Component.QuitWait; + } + + var waitAudioNoteMap = new SortedDictionary>(defaultComputer.WaitAudioNoteMap); + defaultComputer.WaitAudioNoteMap.Clear(); + foreach (var wait in waitAudioNoteMap.Keys) + { + var audioNotes = waitAudioNoteMap[wait]; + foreach (var audioNote in audioNotes) + { + Utility.Into(defaultComputer.WaitAudioNoteMap, defaultComputer.Length + Component.QuitWait - wait + Component.QuitWait - (audioNote.AudioItem?.Length ?? 0.0), audioNote); + } + } + + var waitMediaNoteMap = new SortedDictionary>(defaultComputer.WaitMediaNoteMap); + defaultComputer.WaitMediaNoteMap.Clear(); + foreach (var wait in waitMediaNoteMap.Keys) + { + var mediaNotes = waitMediaNoteMap[wait]; + foreach (var mediaNote in mediaNotes) + { + Utility.Into(defaultComputer.WaitMediaNoteMap, defaultComputer.Length + Component.QuitWait - wait + Component.QuitWait - mediaNote.Length, mediaNote); + } + } + + var lastBPM = defaultComputer.LevyingBPM; + var waitBPMMap = new Queue>(defaultComputer.WaitBPMMap); + defaultComputer.WaitBPMMap.Clear(); + foreach (var (wait, bpm) in waitBPMMap) + { + defaultComputer.WaitBPMMap[defaultComputer.Length - wait] = lastBPM; + lastBPM = bpm; + } + defaultComputer.LevyingBPM = lastBPM; + + SetWaitLogicalYMap(); + + foreach (var note in Notes) + { + note.LogicalY = defaultComputer.WaitLogicalYMap[note.Wait]; + note.LongHeight = note.LongWait > 0.0 ? defaultComputer.WaitLogicalYMap[note.Wait] - defaultComputer.WaitLogicalYMap[note.Wait + note.LongWait] : 0.0; + } + } + else + { + SetWaitLogicalYMap(); + } + void SetWaitLogicalYMap() + { + var loopingCounterSet = new SortedSet(); + var waitBPMMap = new Queue>(defaultComputer.WaitBPMMap); + foreach (var note in Notes) + { + var wait = note.Wait; + loopingCounterSet.Add(wait); + var longWait = note.LongWait; + if (longWait > 0.0) + { + loopingCounterSet.Add(wait + longWait); + } + } + foreach (var wait in defaultComputer.WaitAudioNoteMap.Keys) + { + loopingCounterSet.Add(wait); + } + foreach (var wait in defaultComputer.WaitMediaNoteMap.Keys) + { + loopingCounterSet.Add(wait); + } + var quitLength = defaultComputer.Length + Component.QuitWait; + for (var loopingCounter = -Component.LevyingWait; loopingCounter <= quitLength; loopingCounter += 1.0) + { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); + loopingCounterSet.Add(loopingCounter); + } + + defaultComputer.WaitLogicalYMap.Clear(); + var lastLoopingCounter = loopingCounterSet.Min(); + ComponentValue.SetBPM(defaultComputer.LevyingBPM); + defaultComputer.WaitLogicalYMap[lastLoopingCounter] = Component.StandardHeight - ComponentValue.LogicalYMillis * (lastLoopingCounter + Component.LevyingWait); + foreach (var loopingCounter in loopingCounterSet) + { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); + defaultComputer.WaitLogicalYMap[loopingCounter] = defaultComputer.WaitLogicalYMap[lastLoopingCounter] - Utility.GetDistance(ComponentValue, waitBPMMap, lastLoopingCounter, loopingCounter, out _); + lastLoopingCounter = loopingCounter; + } + } + + // 배경음을 노트로 만듭니다. + Notes.Sort(); + var setNoteModeValue = defaultComputer.ModeComponentValue.SetNoteModeValue; + if (setNoteModeValue == ModeComponent.SetNoteMode.Put || setNoteModeValue == ModeComponent.SetNoteMode.VoidPut) + { + var voidPutInputs = Component.VoidPutInputs[(int)levyingInputMode, (int)InputMode]; + var putNoteSet = defaultComputer.ModeComponentValue.PutNoteSet; + var putNoteSetMillis = defaultComputer.ModeComponentValue.PutNoteSetMillis; + var endStatus = defaultComputer.WaitAudioNoteMap.Count; + var status = 0; + foreach (var (wait, audioNotes) in defaultComputer.WaitAudioNoteMap) + { + foreach (var audioNote in audioNotes.ToArray()) + { + if (audioNote.Salt % 100 < putNoteSet) + { + switch (setNoteModeValue) + { + case ModeComponent.SetNoteMode.Put: + switch (autoableInputCount) + { + case 0: + NewNote(audioNote, GetInputs(1, inputCount)); + break; + case 1: + NewNote(audioNote, GetInputs(2, inputCount)); + break; + case 2: + NewNote(audioNote, GetInputs(2, inputCount - 1)); + break; + } + break; + case ModeComponent.SetNoteMode.VoidPut: + NewNote(audioNote, voidPutInputs); + break; + } + int[] GetInputs(int levyingInput, int lastInput) + { + var inputs = new int[lastInput - levyingInput + 1]; + for (var i = lastInput; i >= levyingInput; --i) + { + inputs[i - levyingInput] = i; + } + return inputs; + } + void NewNote(AudioNote audioNote, int[] inputs) + { + if (inputs.Length > 0) + { + var levyingPutInput = audioNote.Salt % inputs.Length; + var putInput = levyingPutInput; + var targetInput = inputs[putInput]; + do + { + if (Notes.Any(note => + { + var noteWait = note.Wait; + return note.HasInput && note.LevyingInput == targetInput && noteWait - putNoteSetMillis <= wait && wait <= noteWait + putNoteSetMillis + note.LongWait; + })) + { + if (++putInput >= inputs.Length) + { + putInput = 0; + } + if (putInput == levyingPutInput) + { + break; + } + targetInput = inputs[putInput]; + continue; + } + Notes.Add(new InputNote(defaultComputer.WaitLogicalYMap[wait], wait, new[] { audioNote }, targetInput)); + audioNotes.Remove(audioNote); + break; + } while (true); + } + } + } + } + defaultComputer.SetCompilingStatus((double)++status / endStatus); + } + } + + Notes.Sort(); + switch (defaultComputer.ModeComponentValue.NoteModifyModeValue) + { + // 롱 노트를 단일 노트로 만듭니다. + case ModeComponent.NoteModifyMode.InputNote: + for (var i = Notes.Count - 1; i >= 0; --i) + { + var note = Notes[i]; + if (note.LongWait > 0.0) + { + Notes[i] = new InputNote(note.LogicalY, note.Wait, note.AudioNotes, note.LevyingInput); + } + } + break; + // 단일 노트를 롱 노트로 만듭니다. + case ModeComponent.NoteModifyMode.LongNote: + var waitBPMMap = new Queue>(defaultComputer.WaitBPMMap); + var lowestLongNoteModify = defaultComputer.ModeComponentValue.LowestLongNoteModify; + var highestLongNoteModify = defaultComputer.ModeComponentValue.HighestLongNoteModify; + for (var i = inputCount; i > 0; --i) + { + var targetInputNotes = Notes.Where(note => note.LevyingInput == i).ToArray(); + var targetInputNoteCount = targetInputNotes.Length; + for (var j = 0; j < targetInputNoteCount; ++j) + { + var targetInputNote = targetInputNotes[j]; + if (j < targetInputNoteCount - 1 && targetInputNote.LongWait == 0.0 && targetInputNote.HasStand) + { + var longNoteModify = lowestLongNoteModify + targetInputNote.Salt % (highestLongNoteModify - lowestLongNoteModify + 1); + var targetNote = targetInputNotes[j + 1]; + var noteWait = targetInputNote.Wait; + var targetLoopingCounter = targetNote.Wait; + var loopingCounter = targetLoopingCounter - longNoteModify; + if (noteWait < loopingCounter) + { + var lastBPMs = defaultComputer.WaitBPMMap.Where(pair => pair.Key <= loopingCounter).ToArray(); + ComponentValue.SetBPM(lastBPMs.Length > 0 ? lastBPMs.Last().Value : defaultComputer.LevyingBPM); + var distance = Utility.GetDistance(ComponentValue, waitBPMMap, loopingCounter, targetLoopingCounter, out _); + Notes.Remove(targetInputNote); + Notes.Add(new LongNote(targetInputNote.LogicalY, noteWait, targetInputNote.AudioNotes, targetInputNote.LevyingInput, targetLoopingCounter - noteWait - longNoteModify, targetInputNote.LogicalY - targetNote.LogicalY - distance)); + } + } + } + } + break; + } + + // 실시간 NPS 그래프 계산 + var isAutoLongNote = defaultComputer.IsAutoLongNote; + var waitInputNoteCountMap = new SortedDictionary(); + var waitAutoableInputNoteCountMap = new SortedDictionary(); + foreach (var note in Notes.Where(note => note.HasStand)) + { + var wait = note.Wait; + waitInputNoteCountMap[wait] = waitInputNoteCountMap.GetValueOrDefault(wait) + 1; + var isAutoableInput = autoableInputs.Contains(note.LevyingInput); + if (isAutoableInput) + { + waitAutoableInputNoteCountMap[wait] = waitAutoableInputNoteCountMap.GetValueOrDefault(wait) + 1; + } + if (!isAutoLongNote) + { + var longWait = note.LongWait; + if (longWait > 0.0) + { + waitInputNoteCountMap[wait + longWait] = waitInputNoteCountMap.GetValueOrDefault(wait + longWait) + 1; + if (isAutoableInput) + { + waitAutoableInputNoteCountMap[wait + longWait] = waitAutoableInputNoteCountMap.GetValueOrDefault(wait + longWait) + 1; + } + } + } + } + SetInputNoteCounts(waitInputNoteCountMap, defaultComputer.InputNoteCounts); + SetInputNoteCounts(waitAutoableInputNoteCountMap, defaultComputer.AutoableInputNoteCounts); + void SetInputNoteCounts(SortedDictionary waitInputNoteCountMap, List inputNoteCounts) + { + if (waitInputNoteCountMap.Count > 0) + { + var length100 = defaultComputer.Length / 100; + if (length100 > 0.0) + { + var length1000 = length100 / 1000; + var lowestWait = 0.0; + var inputNoteCount = 0; + var i = 0; + while (i < waitInputNoteCountMap.Count) + { + var waitInputNoteCount = waitInputNoteCountMap.ElementAt(i); + if (waitInputNoteCount.Key - lowestWait < length100) + { + inputNoteCount += waitInputNoteCount.Value; + ++i; + } + else + { + inputNoteCounts.Add(inputNoteCount / length1000); + inputNoteCount = 0; + lowestWait += length100; + } + } + while (lowestWait < defaultComputer.Length) + { + inputNoteCounts.Add(inputNoteCount / length1000); + inputNoteCount = 0; + lowestWait += length100; + } + } + else + { + inputNoteCounts.Add(waitInputNoteCountMap.Single().Value); + } + } + } + + // 건너뛰기와 하이라이트 계산 + Notes.Sort(); + inputNotes = Notes.Where(note => note.HasInput).Where(note => note.HasStand).ToArray(); + if (inputNotes.Length > 0) + { + defaultComputer.PassableWait = Math.Round(inputNotes.First().Wait - Component.PassableWait); + var lastNoteWait = inputNotes.Max(note => note.Wait + note.LongWait); + if (double.IsNaN(defaultComputer.AudioLevyingPosition)) + { + var targetValue = double.NegativeInfinity; + var audioLevyingPosition = 0.0; + for (var i = defaultComputer.InputNoteCounts.Count - 1; i > 0; --i) + { + var value = (defaultComputer.InputNoteCounts[i] - defaultComputer.InputNoteCounts[i - 1]) * Math.Sqrt(50 * 50 - Math.Pow(50 - i, 2)); + if (value >= targetValue) + { + audioLevyingPosition = defaultComputer.Length * (i - 1) / 100; + targetValue = value; + } + } + defaultComputer.AudioLevyingPosition = audioLevyingPosition; + } + } + else + { + if (double.IsNaN(defaultComputer.AudioLevyingPosition)) + { + defaultComputer.AudioLevyingPosition = 0.0; + } + } + + // 리플레이 노트 + foreach (var inputEvent in defaultComputer.Comment.Inputs.Where(inputEvent => inputEvent.Input > 0)) + { + var wait = Utility.SetCommentWait(defaultComputer.CommentWaitDate, defaultComputer.AudioMultiplier, inputEvent.Wait); + wait = Math.Floor(wait); + var input = inputEvent.Input; + input = input & 255; + Notes.Add(new CommentNote(defaultComputer.WaitLogicalYMap[wait], wait, input)); + } + + foreach (var note in Notes) + { + if (note.HasStand) + { + foreach (var audioNote in note.AudioNotes) + { + defaultComputer.WaitInputAudioMap.Into(note.Wait, audioNote); + } + } + } + + if (defaultComputer.IsPostableItemMode) + { + var avatarsCount = defaultComputer.AvatarsCount; + var rateItem = defaultComputer.ValidNetMode switch + { + 1 => Math.Sqrt(5.0) / 100.0, + 2 => 5.0 / 100.0, + 3 => Math.Pow(5.0, 2) / 100.0, + 4 => avatarsCount, + _ => default + } / avatarsCount; + foreach (var note in Notes) + { + if (note.HasStand && Random.Shared.NextDouble() < rateItem) + { + note.SetItem(Random.Shared.Next(), defaultComputer.AllowedPostableitems); + } + } + } + + defaultComputer.ValidatedTotalNotes = Notes.Sum(note => note.HasStand ? note.LongWait > 0.0 ? 2 : 1 : 0); + + Notes.Sort(); + Notes.ForEach(note => + { + defaultComputer.Notes.Add(note); + note.ID = defaultComputer.Notes.Count - 1; + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compiler/PMSCompiler.cs b/Qwilight/Qwilight/Compiler/PMSCompiler.cs new file mode 100644 index 0000000..6d383f7 --- /dev/null +++ b/Qwilight/Qwilight/Compiler/PMSCompiler.cs @@ -0,0 +1,13 @@ +using Qwilight.NoteFile; + +namespace Qwilight.Compiler +{ + public sealed class PMSCompiler : BMSCompiler + { + public PMSCompiler(PMSFile pmsFile, CancellationTokenSource setCancelCompiler) : base(pmsFile, setCancelCompiler) + { + } + + public override Component.InputMode GetInputMode(ICollection inputSet) => Component.InputMode.InputMode9; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Component.cs b/Qwilight/Qwilight/Component.cs new file mode 100644 index 0000000..2804447 --- /dev/null +++ b/Qwilight/Qwilight/Component.cs @@ -0,0 +1,1192 @@ +namespace Qwilight +{ + public sealed class Component + { + public enum JudgmentAssist + { + Default, LongNoteUp + } + + public enum InputMapping + { + Mapping0, Mapping1, Mapping2, Mapping3 + } + + public enum InputMode + { + InputMode4 = 4, InputMode5, InputMode6, InputMode7, InputMode8, InputMode9, InputMode51, InputMode71, InputMode102, InputMode142, InputMode10, InputMode242, InputMode484 + } + + public enum Judged + { + Not = -1, Highest, Higher, High, Low, Lower, Lowest, Band1 = 9, Last = 10 + } + + public const double StandardHeight = 720.0; + public const double StandardBPM = 130.0; + public const int StandardMeter = 192; + public const double LevyingWait = 3000.0; + public const double QuitWait = 2000.0; + public const double PassableWait = 1000.0; + + public const int HitPointsMode100 = 0; + public const int HitPointsMode123 = 1; + public const int HitPointsMode11034 = 2; + public const int HitPointsMode11035 = 3; + public const int HitPointsMode11462 = 4; + public const int HitPointsMap100 = 0; + public const int HitPointsMap167 = 1; + public const int HitPointsMap170 = 2; + public const int HitPointsMap1132 = 3; + public const int JudgmentMap100 = 0; + public const int JudgmentMap130 = 1; + public const int JudgmentMap167 = 2; + public const int JudgmentMap168 = 3; + public const int JudgmentMap11034 = 4; + public const int JudgmentMap11035 = 5; + public const int JudgmentMap1110 = 6; + public const int LatestJudgmentMap = JudgmentMap1110; + public const int JudgmentMode100 = 0; + public const int JudgmentMode167 = 1; + public const int JudgmentMode11034 = 2; + public const int JudgmentMode11035 = 3; + public const int JudgmentMode1146 = 4; + public const int LatestJudgmentMode = JudgmentMode1146; + public const int LongNoteAssist100 = 0; + public const int LongNoteAssist167 = 1; + public const int LongNoteAssist11034 = 2; + public const int LongNoteAssist11035 = 3; + public const int LatestLongNoteAssist = LongNoteAssist11035; + public const int Point100 = 0; + public const int Point167 = 1; + public const int StandMode100 = 0; + public const int StandMode167 = 1; + public const int StandMode114118 = 2; + public const int StandMap100 = 0; + public const int StandMap114118 = 1; + public const int CommentWaitDate100 = 0; + public const int CommentWaitDate1311 = 1; + public const int CommentWaitDate164 = 2; + public const int TooLongLongNote100 = 0; + public const int TooLongLongNote113107 = 1; + public const int TooLongLongNote11420 = 2; + public const int TooLongLongNote11429 = 3; + public const int TrapNoteJudgmentDate100 = 0; + public const int TrapNoteJudgmentDate1146 = 1; + public const int LongNoteMode100 = 0; + public const int LongNoteMode11420 = 1; + public const int LongNoteMode1164 = 2; + public const int LatestLongNoteMode = LongNoteMode1164; + public const int PaintEventsDate100 = 0; + public const int PaintEventsDate11491 = 1; + + static readonly double[,,,] JudgmentMap = new double[7, 5, 6, 2]; + static readonly double[] LongNoteAssistMap = new double[4]; + static readonly double[] JudgmentCalibrateMap = new double[3]; + + public static readonly double[,] StandMap = new double[2, 6]; + public static readonly double[,] PointMap = new double[2, 6]; + public static readonly double[,,] HitPointsMap = new double[4, 8, 6]; + public static readonly int[] InputCounts = new int[17]; + public static readonly int[][] AutoableInputs = new int[17][]; + public static readonly int[] AutoableInputCounts = new int[17]; + public static readonly int[,][] InputMappingValues = new int[4, 17][]; + public static readonly int[,][] BasePaintMap = new int[4, 17][]; + public static readonly int[,][] FavorInputs = new int[17, 20][]; + public static readonly int[,][] VoidPutInputs = new int[17, 17][]; + public static readonly bool[][] IsIn2P = new bool[17][]; + public static readonly int[] Input1PCounts = new int[17]; + public static readonly bool[] Has2P = new bool[17]; + public static readonly int[,,][] LimiterCenterMap = new int[4, 17, 2][]; + public static readonly bool[][] Limiter57Map = new bool[17][]; + + static Component() + { + #region v1.0.0 + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Highest] = 1.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Higher] = 0.9; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Default, (int)Judged.High] = 0.3; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Low] = 0.1; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest] = 0.1 / 3; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Highest] = 1.5; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Higher] = 1.35; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.High] = 0.45; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Low] = 0.15; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lowest] = 0.025; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Highest] = 0.75; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Higher] = 0.675; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.High] = 0.225; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Low] = 0.075; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Lowest] = 0.05; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Highest] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Higher] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.High] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Low] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap100, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Lowest] = 1.0; + #endregion + #region v1.6.7 + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Highest] = 1.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Higher] = 0.9; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Default, (int)Judged.High] = 0.3; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Low] = 0.1; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest] = -0.027; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Highest] = 2.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Higher] = 1.8; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.High] = 0.6; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Low] = 0.2; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Lowest] = -0.0135; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Highest] = 1.5; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Higher] = 1.35; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.High] = 0.45; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Low] = 0.15; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lowest] = -0.02025; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Highest] = 0.75; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Higher] = 0.675; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.High] = 0.225; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Low] = 0.075; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Lowest] = -0.0405; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Highest] = 0.5; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Higher] = 0.45; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.High] = 0.15; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Low] = 0.05; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Lowest] = -0.054; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Highest] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Higher] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.High] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Low] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap167, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Lowest] = -1.0; + #endregion + #region v1.7.0 + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Highest] = 1.0; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Higher] = 0.2 / 3; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.High] = 0.1 / 3; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Low] = 0.1; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest] = 0.1 / 3; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Lowest, i] = 2.0 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Lower, i] = 1.5 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Higher, i] = 0.75 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Highest, i] = 0.5 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Failed, i] = 0.0; + } + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Lowest] = 0.5 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lowest] = 0.75 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Lowest] = 1.5 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Lowest] = 2.0 * HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap170, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Lowest] = 1.0; + #endregion + #region v1.13.2 + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Highest] = 1.0; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Higher] = 2.0 / 3; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.High] = 1.0 / 3; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Low] = 0.1; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lower] = 0.0; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest] = 0.1 / 3; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Lowest, i] = 2.0 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Lower, i] = 1.5 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Higher, i] = 0.75 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Highest, i] = 0.5 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, i]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Failed, i] = 0.0; + } + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Lowest, (int)Judged.Lowest] = 0.5 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lowest] = 0.75 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Higher, (int)Judged.Lowest] = 1.5 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Highest, (int)Judged.Lowest] = 2.0 * HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Failed, (int)Judged.Lowest] = 1.0; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Test, (int)Judged.Lowest] = HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Lower, (int)Judged.Lowest]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Test, (int)Judged.Lower] = HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Lower]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Test, (int)Judged.Low] = HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Low]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Test, (int)Judged.High] = HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.High]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Test, (int)Judged.Higher] = HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Higher]; + HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Test, (int)Judged.Highest] = HitPointsMap[HitPointsMap1132, (int)ModeComponent.HitPointsMode.Default, (int)Judged.Highest]; + #endregion + + #region v1.0.0 + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -16.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -64.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -97.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -127.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -151.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -211.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Highest, 0] = -22.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Higher, 0] = -89.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.High, 0] = -135.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Low, 0] = -177.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lower, 0] = -211.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = -211.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Highest, 0] = -11.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Higher, 0] = -45.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.High, 0] = -69.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Low, 0] = -90.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lower, 0] = -107.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = -211.5; + + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 1] = 16.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 1] = 64.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 1] = 97.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 1] = 127.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 1] = 151.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 1] = 211.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Highest, 1] = 22.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Higher, 1] = 89.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.High, 1] = 135.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Low, 1] = 177.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lower, 1] = 211.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 1] = 211.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Highest, 1] = 11.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Higher, 1] = 45.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.High, 1] = 69.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Low, 1] = 90.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lower, 1] = 107.5; + JudgmentMap[JudgmentMap100, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 1] = 211.5; + #endregion + #region v1.3.0 + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -16.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -64.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -97.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -127.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -151.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -169.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Highest, 0] = -22.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Higher, 0] = -89.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.High, 0] = -135.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Low, 0] = -177.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lower, 0] = -211.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = -236.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Highest, 0] = -11.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Higher, 0] = -45.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.High, 0] = -69.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Low, 0] = -90.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lower, 0] = -107.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = -121.5; + + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 1] = 16.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 1] = 64.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 1] = 97.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 1] = 127.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 1] = 151.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 1] = 169.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Highest, 1] = 22.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Higher, 1] = 89.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.High, 1] = 135.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Low, 1] = 177.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lower, 1] = 211.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 1] = 236.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Highest, 1] = 11.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Higher, 1] = 45.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.High, 1] = 69.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Low, 1] = 90.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lower, 1] = 107.5; + JudgmentMap[JudgmentMap130, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 1] = 121.5; + #endregion + #region v1.6.7 + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -15.0; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -60.0; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -90.0; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -125.0; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -165.0; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -210.0; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Lowest, i, 0] = 2.0 * JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Lower, i, 0] = 1.5 * JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Higher, i, 0] = 0.75 * JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Highest, i, 0] = 0.5 * JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, i, 0]; + } + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Lowest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = 0.75 * JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Highest, (int)Judged.Lowest, 0] = 0.5 * JudgmentMap[JudgmentMap167, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + for (var i = JudgmentMap.GetLength(1) - 1; i >= 0; --i) + { + for (var j = JudgmentMap.GetLength(2) - 1; j >= 0; --j) + { + JudgmentMap[JudgmentMap167, i, j, 1] = -JudgmentMap[JudgmentMap167, i, j, 0]; + } + } + #endregion + #region v1.6.8 + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -25.0; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -65.0; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -100.0; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -130.0; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -165.0; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -205.0; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Lowest, i, 0] = 2.0 * JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Lower, i, 0] = 1.5 * JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Higher, i, 0] = 0.75 * JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Highest, i, 0] = 0.5 * JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, i, 0]; + } + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Lowest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = 0.75 * JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Highest, (int)Judged.Lowest, 0] = 0.5 * JudgmentMap[JudgmentMap168, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + for (var i = JudgmentMap.GetLength(1) - 1; i >= 0; --i) + { + for (var j = JudgmentMap.GetLength(2) - 1; j >= 0; --j) + { + JudgmentMap[JudgmentMap168, i, j, 1] = -JudgmentMap[JudgmentMap168, i, j, 0]; + } + } + #endregion + #region v1.10.34 + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -20.0; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -45.0; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -75.0; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -110.0; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -150.0; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -195.0; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Lowest, i, 0] = 2.0 * JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Lower, i, 0] = 1.5 * JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Higher, i, 0] = 0.75 * JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Highest, i, 0] = 0.5 * JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, i, 0]; + } + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Lowest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Highest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11034, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + for (var i = JudgmentMap.GetLength(1) - 1; i >= 0; --i) + { + for (var j = JudgmentMap.GetLength(2) - 1; j >= 0; --j) + { + JudgmentMap[JudgmentMap11034, i, j, 1] = -JudgmentMap[JudgmentMap11034, i, j, 0]; + } + } + #endregion + #region v1.10.35 + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -25.0; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -65.0; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -100.0; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -130.0; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -165.0; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -205.0; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Lowest, i, 0] = 2.0 * JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Lower, i, 0] = 1.5 * JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Higher, i, 0] = 0.75 * JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Highest, i, 0] = 0.5 * JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, i, 0]; + } + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Lowest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Highest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap11035, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + for (var i = JudgmentMap.GetLength(1) - 1; i >= 0; --i) + { + for (var j = JudgmentMap.GetLength(2) - 1; j >= 0; --j) + { + JudgmentMap[JudgmentMap11035, i, j, 1] = -JudgmentMap[JudgmentMap11035, i, j, 0]; + } + } + #endregion + #region v1.11.0 + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Highest, 0] = -25.0; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Higher, 0] = -60.0; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.High, 0] = -95.0; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Low, 0] = -130.0; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lower, 0] = -165.0; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0] = -200.0; + for (var i = (int)Judged.Lower; i >= (int)Judged.Highest; --i) + { + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Lowest, i, 0] = 2.0 * JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Lower, i, 0] = 1.5 * JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Higher, i, 0] = 0.75 * JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, i, 0]; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Highest, i, 0] = 0.5 * JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, i, 0]; + } + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Lowest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Lower, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Higher, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Highest, (int)Judged.Lowest, 0] = JudgmentMap[JudgmentMap1110, (int)ModeComponent.JudgmentMode.Default, (int)Judged.Lowest, 0]; + for (var i = JudgmentMap.GetLength(1) - 1; i >= 0; --i) + { + for (var j = JudgmentMap.GetLength(2) - 1; j >= 0; --j) + { + JudgmentMap[JudgmentMap1110, i, j, 1] = -JudgmentMap[JudgmentMap1110, i, j, 0]; + } + } + #endregion + + JudgmentCalibrateMap[(int)ModeComponent.JudgmentMode.Lower] = 4.2; + JudgmentCalibrateMap[(int)ModeComponent.JudgmentMode.Default] = 3.0; + JudgmentCalibrateMap[(int)ModeComponent.JudgmentMode.Higher] = 2.1; + + #region v1.0.0 + PointMap[Point100, (int)Judged.Highest] = 1.0; + PointMap[Point100, (int)Judged.Higher] = 1.0; + PointMap[Point100, (int)Judged.High] = 2.0 / 3; + PointMap[Point100, (int)Judged.Low] = 1.0 / 3; + PointMap[Point100, (int)Judged.Lower] = 1.0 / 6; + PointMap[Point100, (int)Judged.Lowest] = 0.0; + #endregion + #region v1.6.7 + PointMap[Point167, (int)Judged.Highest] = 1.0; + PointMap[Point167, (int)Judged.Higher] = 1.0; + PointMap[Point167, (int)Judged.High] = 0.7; + PointMap[Point167, (int)Judged.Low] = 0.5; + PointMap[Point167, (int)Judged.Lower] = 0.3; + PointMap[Point167, (int)Judged.Lowest] = 0.0; + #endregion + + LongNoteAssistMap[LongNoteAssist100] = 1.0; + LongNoteAssistMap[LongNoteAssist167] = 1.5; + LongNoteAssistMap[LongNoteAssist11034] = 2.0; + LongNoteAssistMap[LongNoteAssist11035] = 1.5; + + #region v1.0.0 + StandMap[StandMap100, (int)Judged.Highest] = 1.0; + StandMap[StandMap100, (int)Judged.Higher] = 0.9; + StandMap[StandMap100, (int)Judged.High] = 0.3; + StandMap[StandMap100, (int)Judged.Low] = 0.1; + StandMap[StandMap100, (int)Judged.Lower] = 0.0; + StandMap[StandMap100, (int)Judged.Lowest] = 0.0; + #endregion + #region v1.14.118 + StandMap[StandMap114118, (int)Judged.Highest] = 1.0; + StandMap[StandMap114118, (int)Judged.Higher] = 0.9; + StandMap[StandMap114118, (int)Judged.High] = 0.1; + StandMap[StandMap114118, (int)Judged.Low] = 0.01; + StandMap[StandMap114118, (int)Judged.Lower] = 0.0; + StandMap[StandMap114118, (int)Judged.Lowest] = 0.0; + #endregion + + InputCounts[(int)InputMode.InputMode4] = 4; + InputCounts[(int)InputMode.InputMode5] = 5; + InputCounts[(int)InputMode.InputMode6] = 6; + InputCounts[(int)InputMode.InputMode7] = 7; + InputCounts[(int)InputMode.InputMode8] = 8; + InputCounts[(int)InputMode.InputMode9] = 9; + InputCounts[(int)InputMode.InputMode10] = 10; + InputCounts[(int)InputMode.InputMode51] = 6; + InputCounts[(int)InputMode.InputMode71] = 8; + InputCounts[(int)InputMode.InputMode102] = 12; + InputCounts[(int)InputMode.InputMode142] = 16; + InputCounts[(int)InputMode.InputMode242] = 26; + InputCounts[(int)InputMode.InputMode484] = 52; + + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode51] = new[] { default, 1, 2, 3, 4, 5, 6 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode102] = new[] { default, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 7 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode142] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 9 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode242] = new[] { default, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 2 }; + InputMappingValues[(int)InputMapping.Mapping0, (int)InputMode.InputMode484] = new[] { default, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 3, 4 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode51] = new[] { default, 1, 2, 3, 4, 5, 6 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode102] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode142] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode242] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }; + InputMappingValues[(int)InputMapping.Mapping1, (int)InputMode.InputMode484] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode51] = new[] { default, 6, 1, 2, 3, 4, 5 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode71] = new[] { default, 8, 1, 2, 3, 4, 5, 6, 7 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode102] = new[] { default, 6, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 7 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode142] = new[] { default, 8, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 9 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode242] = new[] { default, 26, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 1 }; + InputMappingValues[(int)InputMapping.Mapping2, (int)InputMode.InputMode484] = new[] { default, 52, 51, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 2, 1 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode51] = new[] { default, 6, 1, 2, 3, 4, 5 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode71] = new[] { default, 8, 1, 2, 3, 4, 5, 6, 7 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode102] = new[] { default, 6, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode142] = new[] { default, 8, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode242] = new[] { default, 26, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + InputMappingValues[(int)InputMapping.Mapping3, (int)InputMode.InputMode484] = new[] { default, 52, 51, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 49 }; + + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode51] = new[] { default, 1, 2, 3, 4, 5, 6 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode102] = new[] { default, 1, 2, 3, 4, 5, 6, 12, 7, 8, 9, 10, 11 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode142] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 16, 9, 10, 11, 12, 13, 14, 15 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode242] = new[] { default, 1, 26, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + BasePaintMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode484] = new[] { default, 1, 2, 51, 52, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode51] = new[] { default, 1, 2, 3, 4, 5, 6 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode102] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode142] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode242] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }; + BasePaintMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode484] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode51] = new[] { default, 2, 3, 4, 5, 6, 1 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode71] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 1 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode102] = new[] { default, 2, 3, 4, 5, 6, 1, 12, 7, 8, 9, 10, 11 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode142] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 1, 16, 9, 10, 11, 12, 13, 14, 15 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode242] = new[] { default, 26, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 1 }; + BasePaintMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode484] = new[] { default, 52, 51, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 2, 1 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode4] = new[] { default, 1, 2, 3, 4 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode5] = new[] { default, 1, 2, 3, 4, 5 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode51] = new[] { default, 2, 3, 4, 5, 6, 1 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode71] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 1 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode102] = new[] { default, 2, 3, 4, 5, 6, 1, 7, 8, 9, 10, 11, 12 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode142] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 1, 9, 10, 11, 12, 13, 14, 15, 16 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode242] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 1 }; + BasePaintMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode484] = new[] { default, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 51, 2, 1 }; + + AutoableInputs[(int)InputMode.InputMode4] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode5] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode6] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode7] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode8] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode9] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode10] = Array.Empty(); + AutoableInputs[(int)InputMode.InputMode51] = new[] { 1 }; + AutoableInputs[(int)InputMode.InputMode71] = new[] { 1 }; + AutoableInputs[(int)InputMode.InputMode102] = new[] { 1, 12 }; + AutoableInputs[(int)InputMode.InputMode142] = new[] { 1, 16 }; + AutoableInputs[(int)InputMode.InputMode242] = new[] { 1, 26 }; + AutoableInputs[(int)InputMode.InputMode484] = new[] { 1, 2, 51, 52 }; + + AutoableInputCounts[(int)InputMode.InputMode51] = 1; + AutoableInputCounts[(int)InputMode.InputMode71] = 1; + AutoableInputCounts[(int)InputMode.InputMode102] = 2; + AutoableInputCounts[(int)InputMode.InputMode142] = 2; + AutoableInputCounts[(int)InputMode.InputMode242] = 2; + AutoableInputCounts[(int)InputMode.InputMode484] = 4; + + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6 }; + + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4, 0 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6, 7 }; + + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4, 0, 0 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4, 5, 0 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5, 6, 0 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6, 7, 8 }; + + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4, 5, 0, 0 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4, 5, 6, 0 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5, 6, 0, 0 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6, 7, 8, 9 }; + + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4, 5, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 0 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5, 6, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 0 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9 }; + FavorInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6, 7, 8, 9, 10 }; + + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4, 5, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 0, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5, 6, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 0, 0 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + FavorInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + FavorInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 3, 4, 5, 6, 7, 9, 9, 10, 11, 12 }; + + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 0, 1, 2, 3, 4, 0 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 0, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 0, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 0, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 0, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 0, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 0, 1, 2, 3, 4, 5 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 1, 2, 3, 4, 5, 6 }; + FavorInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 1, 3, 4, 5, 6, 7 }; + + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 0, 1, 2, 3, 4, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 0, 1, 2, 3, 4, 5, 0, 0 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 0 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8 }; + FavorInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 1, 3, 4, 5, 6, 7, 8, 9 }; + + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 16 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 26 }; + FavorInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 52 }; + + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 1, 2, 3, 4, 5, 6, 0, 0, 7, 8, 9, 10, 11, 0, 0, 12 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 26 }; + FavorInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 52 }; + + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 1, 12, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 1, 16, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }; + FavorInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 52 }; + + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode4] = new[] { default, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode5] = new[] { default, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode6] = new[] { default, 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode7] = new[] { default, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode8] = new[] { default, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode9] = new[] { default, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode10] = new[] { default, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode51] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode71] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode102] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode142] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode242] = new[] { default, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26 }; + FavorInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode484] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }; + + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode5] = new[] { 5 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode6] = new[] { 5, 6 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode7] = new[] { 5, 6, 7 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode8] = new[] { 5, 6, 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 5, 6, 7, 8, 9 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 5, 6, 7, 8, 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode51] = new[] { 6 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode71] = new[] { 6, 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 6, 7, 8, 9, 10, 11 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode4, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode6] = new[] { 6 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode7] = new[] { 6, 7 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode8] = new[] { 6, 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 6, 7, 8, 9 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 6, 7, 8, 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode71] = new[] { 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 7, 8, 9, 10, 11 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode5, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode7] = new[] { 7 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode8] = new[] { 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 7, 8, 9 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 7, 8, 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode71] = new[] { 8 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 8, 9, 10, 11 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 8, 9, 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode6, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode8] = new[] { 8 }; + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 8, 9 }; + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 8, 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 9, 10, 11 }; + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 9, 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode7, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 9 }; + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 10, 11 }; + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode8, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode9] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 10 }; + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 11 }; + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode9, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode9] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode10] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 12 }; + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode10, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode6] = new[] { 6 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode7] = new[] { 6, 7 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode8] = new[] { 6, 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 6, 7, 8, 9 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 6, 7, 8, 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode71] = new[] { 7, 8 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 7, 8, 9, 10, 11, 12 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode51, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode8] = new[] { 8 }; + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode9] = new[] { 8, 9 }; + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode10] = new[] { 8, 9, 10 }; + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode102] = new[] { 9, 10, 11 }; + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 9, 10, 11, 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode71, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode9] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode10] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode102] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode142] = new[] { 12, 13, 14, 15 }; + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode102, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode9] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode10] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode102] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode142] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode242] = new[] { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + VoidPutInputs[(int)InputMode.InputMode142, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode9] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode10] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode102] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode142] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode242] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode242, (int)ModeComponent.InputFavorMode.Mode484] = new[] { 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }; + + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode4] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode5] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode6] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode7] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode8] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode9] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode10] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode51] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode71] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode102] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode142] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode242] = Array.Empty(); + VoidPutInputs[(int)InputMode.InputMode484, (int)ModeComponent.InputFavorMode.Mode484] = Array.Empty(); + + IsIn2P[(int)InputMode.InputMode4] = new bool[5]; + IsIn2P[(int)InputMode.InputMode5] = new bool[6]; + IsIn2P[(int)InputMode.InputMode6] = new bool[7]; + IsIn2P[(int)InputMode.InputMode7] = new bool[8]; + IsIn2P[(int)InputMode.InputMode8] = new bool[9]; + IsIn2P[(int)InputMode.InputMode9] = new bool[10]; + IsIn2P[(int)InputMode.InputMode10] = new bool[11]; + IsIn2P[(int)InputMode.InputMode51] = new bool[7]; + IsIn2P[(int)InputMode.InputMode71] = new bool[9]; + IsIn2P[(int)InputMode.InputMode102] = new[] { default, false, false, false, false, false, false, true, true, true, true, true, true }; + IsIn2P[(int)InputMode.InputMode142] = new[] { default, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true }; + IsIn2P[(int)InputMode.InputMode242] = new bool[27]; + IsIn2P[(int)InputMode.InputMode484] = new bool[53]; + + Input1PCounts[(int)InputMode.InputMode4] = 4; + Input1PCounts[(int)InputMode.InputMode5] = 5; + Input1PCounts[(int)InputMode.InputMode6] = 6; + Input1PCounts[(int)InputMode.InputMode7] = 7; + Input1PCounts[(int)InputMode.InputMode8] = 8; + Input1PCounts[(int)InputMode.InputMode9] = 9; + Input1PCounts[(int)InputMode.InputMode10] = 10; + Input1PCounts[(int)InputMode.InputMode51] = 6; + Input1PCounts[(int)InputMode.InputMode71] = 8; + Input1PCounts[(int)InputMode.InputMode102] = 6; + Input1PCounts[(int)InputMode.InputMode142] = 8; + Input1PCounts[(int)InputMode.InputMode242] = 26; + Input1PCounts[(int)InputMode.InputMode484] = 52; + + Has2P[(int)InputMode.InputMode102] = true; + Has2P[(int)InputMode.InputMode142] = true; + + for (var i = (int)InputMapping.Mapping3; i >= (int)InputMapping.Mapping0; --i) + { + for (var j = 1; j >= 0; --j) + { + LimiterCenterMap[i, (int)InputMode.InputMode4, j] = new[] { default, 0, 0, 1, 0 }; + LimiterCenterMap[i, (int)InputMode.InputMode5, j] = new[] { default, 0, 0, 2, 0, 0 }; + LimiterCenterMap[i, (int)InputMode.InputMode6, j] = new[] { default, 0, 0, 0, 1, 0, 0 }; + LimiterCenterMap[i, (int)InputMode.InputMode7, j] = new[] { default, 0, 0, 0, 2, 0, 0, 0 }; + LimiterCenterMap[i, (int)InputMode.InputMode8, j] = new[] { default, 0, 0, 0, 0, 1, 0, 0, 0 }; + LimiterCenterMap[i, (int)InputMode.InputMode9, j] = new[] { default, 0, 0, 0, 0, 2, 0, 0, 0, 0 }; + LimiterCenterMap[i, (int)InputMode.InputMode10, j] = new[] { default, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }; + } + } + for (var i = 1; i >= 0; --i) + { + for (var j = (int)InputMapping.Mapping3; j >= (int)InputMapping.Mapping0; --j) + { + LimiterCenterMap[j, (int)InputMode.InputMode51, i] = new[] { default, 0, 0, 0, 2, 0, 0 }; + LimiterCenterMap[j, (int)InputMode.InputMode71, i] = new[] { default, 0, 0, 0, 0, 2, 0, 0, 0 }; + } + LimiterCenterMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode242, i] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode484, i] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + for (var j = (int)InputMapping.Mapping2; j >= (int)InputMapping.Mapping1; --j) + { + LimiterCenterMap[j, (int)InputMode.InputMode242, i] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + LimiterCenterMap[j, (int)InputMode.InputMode484, i] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + } + LimiterCenterMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode242, i] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode484, i] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + } + LimiterCenterMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode102, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + LimiterCenterMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode102, 1] = new[] { default, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode142, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + LimiterCenterMap[(int)InputMapping.Mapping0, (int)InputMode.InputMode142, 1] = new[] { default, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode102, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode102, 1] = new[] { default, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode142, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping1, (int)InputMode.InputMode142, 1] = new[] { default, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode102, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + LimiterCenterMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode102, 1] = new[] { default, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode142, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + LimiterCenterMap[(int)InputMapping.Mapping2, (int)InputMode.InputMode142, 1] = new[] { default, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode102, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode102, 1] = new[] { default, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode142, 0] = new[] { default, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }; + LimiterCenterMap[(int)InputMapping.Mapping3, (int)InputMode.InputMode142, 1] = new[] { default, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 20, 0, 0, 0 }; + + Limiter57Map[(int)InputMode.InputMode242] = new[] { default, false, false, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, false }; + Limiter57Map[(int)InputMode.InputMode484] = new[] { default, false, false, false, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, false, false }; + } + + public static double GetJudgmentMillis(Judged judged, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int i, JudgmentAssist judgmentAssist = JudgmentAssist.Default) + { + var judgmentModeValue = (int)modeComponentValue.JudgmentModeValue; + var judgmentMillis = 0.0; + switch (judgmentModeDate) + { + case JudgmentMode100: + judgmentMillis = JudgmentMap[judgmentMapDate, judgmentModeValue, (int)judged, i]; + if (judged != (int)Judged.Highest && judged != Judged.Lowest) + { + judgmentMillis -= Math.Sign(judgmentMillis) * JudgmentCalibrateMap[judgmentModeValue] * judgmentStage; + } + break; + case JudgmentMode167: + if (modeComponentValue.JudgmentModeValue == ModeComponent.JudgmentMode.Favor) + { + judgmentMillis = modeComponentValue.FavorJudgments[(int)judged][i]; + } + else + { + judgmentMillis = JudgmentMap[judgmentMapDate, judgmentModeValue, (int)judged, i] / (judgmentStage / 10 + 1); + } + break; + case JudgmentMode11034: + if (modeComponentValue.JudgmentModeValue == ModeComponent.JudgmentMode.Favor) + { + judgmentMillis = modeComponentValue.FavorJudgments[(int)judged][i]; + } + else + { + judgmentMillis = JudgmentMap[judgmentMapDate, judgmentModeValue, (int)judged, i]; + if (judged != Judged.Lowest) + { + judgmentMillis *= -judgmentStage / 20 + 1; + } + } + break; + case JudgmentMode11035: + if (modeComponentValue.JudgmentModeValue == ModeComponent.JudgmentMode.Favor) + { + judgmentMillis = modeComponentValue.FavorJudgments[(int)judged][i]; + } + else + { + judgmentMillis = JudgmentMap[judgmentMapDate, judgmentModeValue, (int)judged, i]; + if (judged != Judged.Lowest) + { + judgmentMillis *= 10 / (judgmentStage + 10); + } + } + break; + case JudgmentMode1146: + if (modeComponentValue.JudgmentModeValue == ModeComponent.JudgmentMode.Favor) + { + judgmentMillis = modeComponentValue.FavorJudgments[(int)judged][i]; + } + else + { + judgmentMillis = JudgmentMap[judgmentMapDate, judgmentModeValue, (int)judged, i] * 10 / (judgmentStage + 10); + } + break; + } + switch (judgmentAssist) + { + case JudgmentAssist.LongNoteUp: + judgmentMillis *= LongNoteAssistMap[longNoteAssistDate]; + break; + } + return judgmentMillis; + } + + public static bool GetIsJudgment(double loopingCounter, Judged judged, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, JudgmentAssist judgmentAssist) => GetJudgmentMillis(judged, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, 0, judgmentAssist) <= loopingCounter && loopingCounter <= GetJudgmentMillis(judged, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, 1, judgmentAssist); + + public static Judged GetJudged(double judgmentMeter, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, JudgmentAssist judgmentAssist = JudgmentAssist.Default) + { + if (GetIsJudgment(judgmentMeter, Judged.Highest, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, judgmentAssist)) + { + return Judged.Highest; + } + else if (GetIsJudgment(judgmentMeter, Judged.Higher, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, judgmentAssist)) + { + return Judged.Higher; + } + else if (GetIsJudgment(judgmentMeter, Judged.High, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, judgmentAssist)) + { + return Judged.High; + } + else if (GetIsJudgment(judgmentMeter, Judged.Low, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, judgmentAssist)) + { + return Judged.Low; + } + else if (GetIsJudgment(judgmentMeter, Judged.Lower, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, judgmentAssist)) + { + return Judged.Lower; + } + else if (GetIsJudgment(judgmentMeter, Judged.Lowest, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, judgmentAssist)) + { + return Judged.Lowest; + } + return Judged.Not; + } + + public double MillisLoopUnit { get; } + + public double LevyingHeight { get; } + + public double LogicalYMillis { get; set; } + + public double LogicalYLoopUnit { get; set; } + + public double LogicalYMeter { get; set; } + + public double MillisMeter { get; set; } + + public Component(double bpm, int loopUnit) + { + MillisLoopUnit = 1000.0 / loopUnit; + SetBPM(bpm); + LevyingHeight = StandardHeight - LogicalYMillis * LevyingWait; + } + + public Component(double bpm) + { + SetBPM(bpm); + LevyingHeight = StandardHeight - LogicalYMillis * LevyingWait; + } + + public void SetBPM(double bpm) + { + LogicalYMeter = 192.0 * Math.Sign(bpm); + MillisMeter = 240000.0 / Math.Abs(bpm); + LogicalYMillis = LogicalYMeter / MillisMeter; + LogicalYLoopUnit = MillisLoopUnit * LogicalYMillis; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/AutoCompute.cs b/Qwilight/Qwilight/Compute/AutoCompute.cs new file mode 100644 index 0000000..13dba8f --- /dev/null +++ b/Qwilight/Qwilight/Compute/AutoCompute.cs @@ -0,0 +1,118 @@ +using MoonSharp.Interpreter; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.ViewModel; + +namespace Qwilight.Compute +{ + public class AutoCompute : DefaultCompute + { + public override bool CanPause => false; + + public override bool IsPassable => false; + + public override bool CanIO => false; + + public override bool CanSetPosition => true; + + public override bool CanModifyAutoMode => true; + + public override LastStatus LastStatusValue => TelnetSystem.Instance.IsAvailable ? base.LastStatusValue : LastStatus.Not; + + public override double HandledLength => AudioLength; + + public override bool HandleFailedAudio => Configure.Instance.HandleFailedAudio.Data == ViewItem.Always; + + public override bool ViewFailedDrawing => Configure.Instance.ViewFailedDrawing.Data == ViewItem.Always; + + public override bool ViewLowestJudgment => Configure.Instance.ViewLowestJudgment.Data == ViewItem.Always; + + public override void HandleWarning() + { + } + + public AutoCompute(BaseNoteFile[] noteFiles, ModeComponent defaultModeComponentValue, string avatarID, string avatarName, int levyingMeter, double levyingWait) : base(noteFiles, null, defaultModeComponentValue, avatarID, $"{avatarName} (Auto)", default, null, null, null) + { + IsFailMode = false; + LevyingMeter = levyingMeter; + LevyingWait = levyingWait; + IsAutoMode = true; + } + + public override void OnGetF() + { + } + + public override void OnHandled() + { + var mainViewModel = ViewModels.Instance.MainValue; + HandlingUISystem.Instance.HandleParallel(() => + { + if (!mainViewModel.IsQuitMode && Configure.Instance.SaltAuto && mainViewModel.EntryItems.Count(entryItem => !entryItem.IsLogical) > 1) + { + mainViewModel.SaltEntryView(); + mainViewModel.HandleAutoComputerImmediately(false); + } + else + { + SetUndo = true; + } + }); + } + + public override bool IsSuitableAsHwInput(int input) => !IsAutoMode && base.IsSuitableAsHwInput(input); + + public override bool IsSuitableAsAutoJudge(int input) => IsAutoMode || !IsSuitableAsInput(input); + + public override void SendSituation() + { + if (!ViewModels.Instance.MainValue.IsNoteFileMode) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)UbuntuItem.UbuntuSituation.AutoComputing, + situationText = PlatformText + }); + } + } + + public override void AtNoteFileMode() + { + SetAutoNoteWait(); + } + + public override void SetNoteFileMode(string faultText = null) + { + IsAutoMode = true; + ViewModels.Instance.MainValue.SetNoteFileMode(faultText); + } + + public override void AtQuitMode() + { + } + + public override void OnFault(ScriptRuntimeException e) + { + } + + public override void OnCompiled() + { + if (!IsSilent) + { + ViewModels.Instance.MainValue.ClosePausableAudioHandler(); + try + { + SetUIMap(); + } + catch + { + } + if (double.IsNaN(LevyingWait)) + { + LevyingWait = Configure.Instance.AutoHighlight ? AudioLevyingPosition : 0.0; + } + HandleComputer(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/CommentCompute.cs b/Qwilight/Qwilight/Compute/CommentCompute.cs new file mode 100644 index 0000000..84e9cd8 --- /dev/null +++ b/Qwilight/Qwilight/Compute/CommentCompute.cs @@ -0,0 +1,68 @@ +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; + +namespace Qwilight.Compute +{ + public sealed class CommentCompute : DefaultCompute + { + public override bool IsPassable => false; + + public override bool CanIO => false; + + public override bool CanSetPosition => true; + + public override string PlatformVarietyContents => LanguageSystem.Instance.PlatformCommentComputing; + + public override void HandleWarning() + { + if (ModeComponentValue.IsNoteSaltModeWarning(Comment.Date)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InputSaltCommentWarning); + } + } + + public CommentCompute(BaseNoteFile[] noteFiles, Comment[] comments, ModeComponent defaultModeComponentValue, string avatarID, string avatarName, string handlerID, EntryItem eventNoteEntryItem, DefaultCompute lastComputer, double levyingWait) : base(noteFiles, comments, defaultModeComponentValue, avatarID, avatarName, null, handlerID, eventNoteEntryItem, lastComputer) + { + if (Utility.IsLowerDate(Version.Parse(Comment.Date), 1, 1, 0)) + { + Comment.LoopUnit = 1000; + } + EventComment = Comment.Clone(); + LevyingWait = levyingWait; + } + + public override ICollection HandleTwilightNetItems(CommentItem[] commentItems) => commentItems.Where(commentItem => commentItem.AvatarWwwValue.AvatarID != AvatarID).ToArray(); + + public override void InitPassable() + { + ModeComponentValue.SentMultiplier = LevyingMultiplier; + ModeComponentValue.AudioMultiplier = LevyingAudioMultiplier; + } + + public override void AtNoteFileMode() + { + Close(); + } + + public override void AtQuitMode() + { + } + + public override void SendSituation() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsNoteFileMode) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)(mainViewModel.IsQuitMode ? UbuntuItem.UbuntuSituation.QuitMode : UbuntuItem.UbuntuSituation.CommentComputing), + situationText = PlatformText + }); + } + } + + public override bool IsSuitableAsHwInput(int input) => false; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Qwilight/Compute/DefaultCompute.cs new file mode 100644 index 0000000..7fdb69c --- /dev/null +++ b/Qwilight/Qwilight/Compute/DefaultCompute.cs @@ -0,0 +1,4726 @@ +using Google.Protobuf; +using Ionic.Zip; +using Microsoft.Graphics.Canvas; +using MoonSharp.Interpreter; +using Qwilight.Compiler; +using Qwilight.Note; +using Qwilight.NoteFile; +using Qwilight.PaintComponent; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using Qwilight.XOR; +using System.Collections.Concurrent; +using System.Diagnostics; +using System.IO; +using System.Windows.Media; +using Channel = FMOD.Channel; + +namespace Qwilight.Compute +{ + public class DefaultCompute : Computing, IAudioHandler, IAudioContainer, IDrawingContainer, IMediaContainer, IMediaHandler + { + public static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(DefaultCompute)); + + public enum WaitingTwilight + { + Default, Net, WaitIO, CallIO + } + + public enum QuitStatus + { + SPlus, S, APlus, A, B, C, D, F + } + + [Flags] + public enum InputFlag + { + Not = 0, + DefaultController = 1, + Controller = 2, + MIDI = 4, + Pointer = 8 + } + + public sealed class PostableItemStatus + { + public string AvatarName { get; set; } + + public bool IsLevyed { get; set; } + + public bool IsHandling { get; set; } + + public double Wait { get; set; } + + public double TotalWait { get; set; } + + public void Init(PostableItem postableItem, string avatarName, double wait) + { + AvatarName = avatarName; + TotalWait = wait; + Wait = wait; + IsLevyed = false; + IsHandling = true; + } + + public void Stop() + { + Wait = 0.0; + } + + public void Halt() + { + Stop(); + IsHandling = false; + } + + public bool Elapse(double millisLoopUnit, bool isElapsing) + { + if (isElapsing) + { + Wait = Math.Max(0.0, Wait - millisLoopUnit); + } + IsLevyed = true; + var isElapsed = IsHandling && Wait == 0.0; + IsHandling = Wait > 0.0; + return isElapsed; + } + } + + public Dictionary PostableItemStatusMap { get; } = new(); + + public Dictionary PostedItemFaints { get; } = new() + { + { -1, 0.0 }, + { 0, 0.0 }, + { 1, 0.0 } + }; + + readonly Action _lazyInit; + readonly double[] _paintPropertyMillis = new double[UI.HighestPaintPropertyID]; + readonly double[] _hitLongNotePaintMillis = new double[53]; + readonly double[] _lastEnlargedBandPaintMillis = new double[53]; + readonly int[] _targetMainFrames = new int[53]; + readonly int[] _targetInputFrames = new int[53]; + readonly bool _isLevyingComputer; + readonly BaseCompiler _targetCompiler; + readonly Thread _targetCompilerHandler; + readonly CancellationTokenSource _setCancelCompiler = new(); + readonly int _hitPointsModeDate; + readonly int _hitPointsMapDate; + readonly int _pointDate; + readonly int _standMapDate; + readonly int _standModeDate; + readonly int _tooLongLongNoteDate; + readonly List[] _lastIIDXInputAudioNoteMap = new List[53]; + readonly List _comments = new(); + readonly List _savedNetItems = new(); + readonly Dictionary DrawingCollection = new(); + readonly Stopwatch _loopingHandler = new(); + readonly ConcurrentQueue<(int, byte)> _rawInputQueue = new(); + readonly List[] _paintEventsGAS = new List[8]; + readonly object _targetHandlerCSX = new(); + readonly int _judgmentModeDate; + readonly int _judgmentMapDate; + readonly int _longNoteAssistDate; + readonly int _trapNoteJudgmentDate; + readonly int _paintEventsDate; + readonly List _handlingNotes = new(); + readonly Queue _eventPositions = new(); + readonly List _ioAvatarIDs = new(); + readonly List _pendingIOAvatarIDs = new(); + readonly List _sentIOAvatarIDs = new(); + readonly List _noteWaits = new(); + readonly XORFloat64[] _hitPointsGAS = new XORFloat64[6]; + Component _valueComponent; + bool _isPausing; + bool _isPausingWindowOpened; + double _bandPaintMillis; + double _autoMainMillis; + double _mainMillis; + double _inputMillis; + double _levelMillis; + double _judgmentMainPaintMillis; + double _mainJudgmentMeterPaintMillis; + double _pauseMillis; + int _lastPaintedBand; + Thread _targetHandler; + double _noteMillis; + double _failedDrawingMillis; + bool _wasNetItems; + bool _wasGetNetItems; + bool _wasGetNetComments; + int _validJudgedNotes; + CompilerStatus _targetCompilerStatus = CompilerStatus.Not; + double _standMultiplier; + bool _isPassable; + LastStatus _lastStatus = LastStatus.Not; + bool _paintEnlargedLastBand; + double _millisMeter; + double _millisStandardMeter; + bool _isPaused; + InputFlag _inputFlags = InputFlag.Not; + + public readonly DrawingComponent DrawingComponentValue = new(); + + public PostableItem[] PostableItems { get; } = new PostableItem[2]; + + public PostableItem[] LastPostableItems { get; } = new PostableItem[2]; + + public MoveValue[] PostableItemFaints { get; } = new MoveValue[2]; + + public string PostedItemText { get; set; } + + public int PostedItemVariety { get; set; } + + bool IsInEvents => _eventPositions.Count > 0; + + public string SiteID { get; set; } + + public int ValidNetMode { get; set; } + + public bool IsPostableItemMode => ValidNetMode > 0; + + public int AvatarsCount { get; set; } + + public PostableItem[] AllowedPostableitems { get; set; } + + public AudioHandler TrailerAudioHandler { get; } = new(); + + public List PaintedNotes { get; } = new(); + + public Comment EventComment { get; set; } + + public double GetIIDXMultiplierMillis(ModeComponent modeComponentValue) => Math.Max(0.0, (DrawingComponentValue.judgmentMainPosition - Configure.Instance.VeilDrawingHeight) / (modeComponentValue.Multiplier * modeComponentValue.AudioMultiplier * modeComponentValue.ComponentValue.LogicalYMillis)); + + public WwwLevelData WwwLevelDataValue { get; set; } + + public JSON.TwilightQuitNet.QuitNetItem[] PendingQuitNetItems { get; set; } + + public Comment[] PendingQuitNetComments { get; set; } + + public string JudgmentMeterText { get; set; } = string.Empty; + + public string EarlyLateText { get; set; } = string.Empty; + + public int EarlyValue { get; set; } + + public int LateValue { get; set; } + + public float HighestNetLength { get; set; } + + public float HighestNetHeight { get; set; } + + public Component.Judged LastJudged { get; set; } = Component.Judged.Not; + + public List NetItems { get; set; } = new(); + + public List Notes { get; } = new(); + + public int[] MainFrames { get; } = new int[53]; + + public int[] InputFrames { get; } = new int[53]; + + public int LevelFrame { get; set; } + + public int[] JudgmentMainFrames { get; } = new int[53]; + + public int[] MainJudgmentMeterFrames { get; } = new int[53]; + + public int[] PaintPropertyFrames { get; } = new int[UI.HighestPaintPropertyID]; + + public int AutoMainFrame { get; set; } + + public int[] PauseFrames { get; } = new int[3]; + + /// + /// 실시간 랭킹 시작 포함 인덱스 + /// + public int LevyingNetPosition { get; set; } + + /// + /// 실시간 랭킹 마지막 포함 인덱스 + /// + public int QuitNetPosition { get; set; } + + public WaitingTwilight WaitingTwilightLevel { get; set; } + + public double[] JudgmentMeters { get; } = new double[2]; + + public Queue[] JudgmentVisualizerValues { get; } = new Queue[2]; + + public Dictionary JudgmentPaints { get; } = new(); + + public Dictionary HitNotePaints { get; } = new(); + + public Dictionary HitLongNotePaints { get; } = new(); + + public Dictionary BandEnlargedMap { get; } = new(); + + public Dictionary BandDrawingFrames { get; } = new(); + + public List>[] JudgmentMeterEventValues { get; } = new List>[6]; + + public object EventValuesCSX { get; } = new(); + + public List> HitPointsEventValues { get; } = new(); + + public List> StandEventValues { get; } = new(); + + public List> PointEventValues { get; } = new(); + + public List> BandEventValues { get; } = new(); + + public Component.InputMapping InputMappingValue { get; set; } + + public BaseNoteFile NoteFile => NoteFiles[LevyingComputingPosition]; + + public string AvatarID => AvatarIDs[LevyingComputingPosition]; + + public string AvatarName => AvatarNames[LevyingComputingPosition]; + + public virtual string TotalNotesInQuit => NoteFiles.Length > 1 ? $"{TotalNotes} / {InheritedTotalNotes}" : $"{TotalNotes}"; + + public virtual string HighestJudgmentInQuit => NoteFiles.Length > 1 ? $"{Comment.HighestJudgment} / {InheritedHighestJudgment}" : $"{Comment.HighestJudgment}"; + + public virtual string HigherJudgmentInQuit => NoteFiles.Length > 1 ? $"{Comment.HigherJudgment} / {InheritedHigherJudgment}" : $"{Comment.HigherJudgment}"; + + public virtual string HighJudgmentInQuit => NoteFiles.Length > 1 ? $"{Comment.HighJudgment} / {InheritedHighJudgment}" : $"{Comment.HighJudgment}"; + + public virtual string LowJudgmentInQuit => NoteFiles.Length > 1 ? $"{Comment.LowJudgment} / {InheritedLowJudgment}" : $"{Comment.LowJudgment}"; + + public virtual string LowerJudgmentInQuit => NoteFiles.Length > 1 ? $"{Comment.LowerJudgment} / {InheritedLowerJudgment}" : $"{Comment.LowerJudgment}"; + + public virtual string LowestJudgmentInQuit => NoteFiles.Length > 1 ? $"{Comment.LowestJudgment} / {InheritedLowestJudgment}" : $"{Comment.LowestJudgment}"; + + public string BPMText => Utility.GetBPMText(BPM, LevyingMultiplier, LevyingAudioMultiplier); + + public string LengthText => Utility.GetLengthText(Length); + + public byte[] NoteFileContents { get; set; } + + public BaseNoteFile[] MyNoteFiles { get; set; } + + public BaseNoteFile[] NoteFiles { get; set; } + + public ModeComponent[] ModeComponentValues { get; set; } + + public string[] AvatarIDs { get; set; } + + public string[] AvatarNames { get; set; } + + public EntryItem EventNoteEntryItem { get; } + + public ModeComponent ModeComponentValue => ModeComponentValues[LevyingComputingPosition]; + + /// + /// 게임 끝난 후 이것으로 복원 + /// + public ModeComponent DefaultModeComponentValue { get; } + + /// + /// 미리듣기 게임 모드 호환 검사 + /// + public ModeComponent CompatibleModeComponentValue { get; } + + public Comment Comment => Comments[LevyingComputingPosition]; + + public Comment[] Comments { get; set; } + + public string HandlerID { get; } + + public ConcurrentQueue MultiplierQueue { get; } = new(); + + public ConcurrentQueue AudioMultiplierQueue { get; } = new(); + + public ConcurrentQueue TwilightCompiledIOQueue { get; } = new(); + + public ConcurrentQueue PostItemQueue { get; } = new(); + + public List IOAvatarNames { get; } = new(); + + public Queue> TwilightIOInputQueue { get; } = new(); + + public Queue> TwilightIOJudgeQueue { get; } = new(); + + public Queue> TwilightIOJudgmentMeterQueue { get; } = new(); + + public Queue> TwilightIONoteVisibilityQueue { get; } = new(); + + public Queue> TwilightIOMultiplierQueue { get; } = new(); + + public Queue> TwilightIOAudioMultiplierQueue { get; } = new(); + + public Queue TwilightPostItemQueue { get; } = new(); + + public Action IOLazyInit { get; set; } + + public double IOMillis { get; set; } + + public ConcurrentQueue InputCountQueue { get; } = new(); + + public bool IsHandling { get; set; } + + public double LowestJudgmentMillis { get; set; } + + public double HighestJudgmentMillis { get; set; } + + public MoveValue Hunter { get; } = new(); + + public double AudioMultiplier => Math.Round(ModeComponentValue.AudioMultiplier, 2); + + public bool IsCounterWave => ModeComponentValue.WaveModeValue == ModeComponent.WaveMode.Counter; + + public override BaseNoteFile.NoteVariety NoteVarietyValue => NoteFile.NoteVarietyValue; + + public Queue NetDrawings { get; set; } + + public bool IsValidNetDrawings { get; set; } = true; + + public void NewNetDrawing(bool isValidNetDrawings, Event.Types.NetDrawing.Types.Variety drawingVariety, uint param, double position0, double position1, double length, double height) + { + if (!isValidNetDrawings) + { + NetDrawings.Enqueue(new() + { + DrawingVariety = drawingVariety, + Param = param, + Position0 = position0, + Position1 = position1, + Length = length, + Height = height + }); + } + } + + public Event.Types.DrawingComponent NetDrawingComponentValue { get; set; } + + public virtual bool LoadContents => true; + + public virtual bool CanPause => WwwLevelDataValue?.AllowPause != false; + + public virtual bool CanUndo => WwwLevelDataValue?.AllowPause != false; + + public int FadingViewLayer { get; set; } = 1; + + public bool LoadedMedia { get; } = Configure.Instance.LoadedMedia; + + public bool IsFailMode { get; set; } = Configure.Instance.IsFailMode; + + public virtual Configure.InputAudioVariety InputAudioVarietyValue => Configure.Instance.InputAudioVarietyValue; + + public virtual string PlatformVarietyContents => IsAutoMode ? LanguageSystem.Instance.PlatformAutoComputing : LanguageSystem.Instance.PlatformDefaultComputing; + + public virtual bool CanSetPosition => false; + + public virtual bool CanModifyAutoMode => false; + + public virtual bool CanIO => !IsPostableItemMode; + + public virtual bool IsPassable => _isPassable; + + public virtual bool IsMeterVisible => false; + + /// + /// 멀티방에서 실시간 랭킹을 받은건지 여부 + /// + public bool IsTwilightNetItems { get; set; } + + public object IsTwilightNetItemsCSX { get; } = new(); + + public int InheritedHighestJudgment { get; set; } + + public int InheritedHigherJudgment { get; set; } + + public int InheritedHighJudgment { get; set; } + + public int InheritedLowJudgment { get; set; } + + public int InheritedLowerJudgment { get; set; } + + public int InheritedLowestJudgment { get; set; } + + public int LevyingComputingPosition { get; set; } + + public bool HasFailedJudgment { get; set; } + + public double TotalPoint { get; set; } + + public double SavedPoint { get; set; } + + public int LastStand { get; set; } + + public double SavedStand { get; set; } + + public double LevyingWait { get; set; } = double.NaN; + + public int LevyingMeter { get; set; } = -1; + + public int HighestComputingPosition { get; set; } + + public int InheritTotalStand { get; } + + public int InheritedTotalNotes { get; set; } + + public int Input1PCount { get; set; } + + public bool[] IsIn2P { get; set; } + + public bool Has2P { get; set; } + + public bool IsNewStand { get; set; } + + public int NetPosition { get; set; } = -1; + + public string CommentPlace0Text { get; set; } + + public string CommentPlace1Text { get; set; } + + public MoveValue Band { get; } = new(); + + public MoveValue Point => Points[LevyingComputingPosition]; + + public MoveValue Stand => Stands[LevyingComputingPosition]; + + public MoveValue HitPoints => HitPointsValues[LevyingComputingPosition]; + + public Primitive IsF => IsFs[LevyingComputingPosition]; + + public bool CanGAS => !IsPostableItemMode && ModeComponentValue.CanGAS && WwwLevelDataValue == null; + + public double DefaultHitPoints => CanGAS ? _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] : HitPoints.TargetValue; + + public MoveValue[] Points { get; set; } + + public MoveValue[] Stands { get; set; } + + public MoveValue[] HitPointsValues { get; set; } + + public Primitive[] IsFs { get; set; } + + public XORInt32 HighestBand { get; set; } + + public bool IsHandlingDrawing { get; set; } + + public bool AlwaysNotP2Position { get; set; } + + public bool SetStop { get; set; } + + public double HandlingBPM { get; set; } + + public double NoteMobilityCosine { get; set; } + + public double NoteMobilityValue { get; set; } + + public double FaintCosine { get; set; } + + public bool IsPausing + { + get => _isPausing; + + set + { + _isPausing = value; + ViewModels.Instance.MainValue.NotifyIsPausing(); + } + } + + public bool SetPass { get; set; } + + public bool IsSilent { get; set; } + + public int NoteFrame { get; set; } + + public HandledDrawingItem? NoteHandledDrawingItem { get; set; } + + public double Status { get; set; } + + public double LoopingCounter { get; set; } + + public int PauseCount => (int)Math.Ceiling(_pauseMillis / 1000.0); + + public bool SetUndo { get; set; } + + public double LevyingMultiplier { get; set; } + + public double LevyingAudioMultiplier { get; set; } + + public double TotallyLevyingMultiplier { get; set; } + + public double TotallyLevyingAudioMultiplier { get; set; } + + public bool SetPause { get; set; } + + public void SetCompilingStatus(double value) + { + Status = value; + Point.Value = value; + } + + public bool IsPausingWindowOpened + { + get => _isPausingWindowOpened; + + set + { + if (_isPausingWindowOpened != value) + { + _isPausingWindowOpened = value; + Utility.HandleUIAudio(value ? "Window 1" : "Window 0"); + } + } + } + + public void PaintDefaultMedia(DrawingContext targetSession, ref Bound r, int defaultMediaFaint) + { + if (defaultMediaFaint < 100) + { + targetSession.PushOpacity(defaultMediaFaint / 100.0); + } + + if (defaultMediaFaint > 0) + { + targetSession.DrawRectangle(Paints.Paint0, null, r); + if (Configure.Instance.Media && IsHandlingDrawing) + { + var defaultHandlerItem = GetHandlerItem(MediaNote.Mode.Default); + var layerHandlerItem = GetHandlerItem(MediaNote.Mode.Layer); + if ((defaultHandlerItem == null || defaultHandlerItem is DrawingHandlerItem) && (layerHandlerItem == null || layerHandlerItem is DrawingHandlerItem)) + { + targetSession.DrawRectangle(Paints.Paint0, null, r); + } + HandleHandlerItem(defaultHandlerItem, ref r); + HandleHandlerItem(layerHandlerItem, ref r); + + void HandleHandlerItem(IHandlerItem handler, ref Bound r) + { + switch (handler) + { + case DrawingHandlerItem drawingHandlerItem: + HandleDrawing(ref r, drawingHandlerItem.DrawingComputingValue); + break; + case MediaHandlerItem mediaHandlerItem: + var defaultMedia = mediaHandlerItem.HandledMediaItem.DefaultMedia; + if (defaultMedia != null) + { + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, defaultMedia.NaturalVideoWidth, defaultMedia.NaturalVideoHeight, r.Position0, r.Position1, r.Length, r.Height); + targetSession.DrawVideo(defaultMedia, r); + } + break; + } + } + } + else + { + HandleDrawing(ref r, NoteHandledDrawingItem ?? DrawingSystem.Instance.DefaultDrawing); + } + } + + if (defaultMediaFaint < 100) + { + targetSession.Pop(); + } + + void HandleDrawing(ref Bound r, HandledDrawingItem? drawingComputingValue) + { + var defaultDrawing = drawingComputingValue?.DefaultDrawing; + if (defaultDrawing != null) + { + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, defaultDrawing.Width, defaultDrawing.Height, r.Position0, r.Position1, r.Length, r.Height); + targetSession.DrawImage(defaultDrawing, r); + } + } + } + + public void PaintMedia(CanvasDrawingSession targetSession, ref Bound r, float mediaFaint) + { + if (mediaFaint < 1F) + { + targetSession.FillRectangle(r, DrawingSystem.Instance.FaintFilledPaints[(int)(100 * mediaFaint)]); + } + + if (mediaFaint > 0F) + { + if (Configure.Instance.MediaInput && !Configure.Instance.FavorMediaInput) + { + MediaInputSystem.Instance.PaintMediaInput(targetSession, ref r, mediaFaint); + } + else + { + lock (ContentsCSX) + { + if (HasContents) + { + if (Configure.Instance.Media && IsHandlingDrawing) + { + var defaultHandlerItem = GetHandlerItem(MediaNote.Mode.Default); + var layerHandlerItem = GetHandlerItem(MediaNote.Mode.Layer); + HandleHandlerItem(defaultHandlerItem, ref r); + HandleHandlerItem(layerHandlerItem, ref r); + + void HandleHandlerItem(IHandlerItem handler, ref Bound r) + { + switch (handler) + { + case DrawingHandlerItem drawingHandlerItem: + HandleDrawing(ref r, drawingHandlerItem.DrawingComputingValue); + break; + case MediaHandlerItem mediaHandlerItem: + var mediaFrame = mediaHandlerItem.MediaFrame; + if (mediaFrame != null) + { + var mediaFrameBound = mediaFrame.Bounds; + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, mediaFrameBound.Width, mediaFrameBound.Height, r.Position0, r.Position1, r.Length, r.Height); + targetSession.PaintDrawing(ref r, mediaFrame, mediaFaint); + } + break; + } + } + } + else + { + HandleDrawing(ref r, NoteHandledDrawingItem ?? DrawingSystem.Instance.DefaultDrawing); + } + + void HandleDrawing(ref Bound r, HandledDrawingItem? drawingComputingValue) + { + var drawing = drawingComputingValue?.Drawing; + if (drawing.HasValue) + { + var drawingValue = drawing.Value; + var drawingBound = drawingValue.DrawingBound; + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, drawingBound.Length, drawingBound.Height, r.Position0, r.Position1, r.Length, r.Height); + targetSession.PaintDrawing(ref r, drawingValue, mediaFaint); + } + } + } + } + } + } + } + + public virtual void SetCommentPlaceText() + { + if (NetItems.Count > 0) + { + CommentPlace0Text = $"#{NetItems.Single(netItem => netItem.IsMyNetItem).TargetPosition + 1}"; + CommentPlace1Text = $"/{NetItems.Count}"; + } + else + { + CommentPlace0Text = string.Empty; + CommentPlace1Text = string.Empty; + } + } + + public void NotifyCompute(int delta = 0) + { + LevyingComputingPosition += delta; + Title = NoteFile.Title; + Artist = NoteFile.Artist; + Genre = NoteFile.Genre; + LevelValue = NoteFile.LevelValue; + LevelText = NoteFile.LevelText; + PlatformText = NoteFile.PlatformText; + JudgmentStage = NoteFile.JudgmentStage; + HitPointsValue = NoteFile.HitPointsValue; + HighestInputCount = NoteFile.HighestInputCount; + Length = NoteFile.Length; + BPM = NoteFile.BPM; + InputMode = NoteFile.InputMode; + TotalNotes = NoteFile.TotalNotes; + if (PendingQuitNetItems != null) + { + var quitNetItem = PendingQuitNetItems[LevyingComputingPosition]; + InheritedTotalNotes = TotalNotes; + InheritedLowestJudgment = Comment.LowestJudgment; + IsF.SetValue(quitNetItem.isF); + HighestBand = quitNetItem.highestBand; + LevyingMultiplier = quitNetItem.multiplier; + LevyingAudioMultiplier = quitNetItem.audioMultiplier; + NetPosition = quitNetItem.netPosition; + } + SetCommentPlaceText(); + var date = Version.Parse(Comment.Date); + if (!Utility.IsLowerDate(date, 1, 7, 0)) + { + LevyingMultiplier = Comment.LevyingMultiplier; + LevyingAudioMultiplier = Comment.LevyingAudioMultiplier; + } + + lock (JudgmentMeterEventValues) + { + foreach (var judgmentMeterEventValues in JudgmentMeterEventValues) + { + judgmentMeterEventValues.Clear(); + } + foreach (var judgmentMeterEvent in Comment.JudgmentMeters) + { + var judgmentMeter = judgmentMeterEvent.JudgmentMeter; + var loopingCounter = judgmentMeterEvent.Wait; + if (Utility.IsLowerDate(date, 1, 3, 11)) + { + loopingCounter -= judgmentMeter; + } + judgmentMeter = Math.Clamp(judgmentMeter, Component.GetJudgmentMillis(Component.Judged.Lowest, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, 0, (Component.JudgmentAssist)judgmentMeterEvent.Assist), Component.GetJudgmentMillis(Component.Judged.Lowest, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, 1, (Component.JudgmentAssist)judgmentMeterEvent.Assist)); + JudgmentMeterEventValues[(int)Component.GetJudged(judgmentMeter, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, (Component.JudgmentAssist)judgmentMeterEvent.Assist)].Add(KeyValuePair.Create(loopingCounter, judgmentMeter)); + } + var judgmentMeters = Comment.JudgmentMeters.Select(judgmentMeterEvent => judgmentMeterEvent.JudgmentMeter).ToArray(); + var judgmentMetersLength = judgmentMeters.Length; + if (judgmentMetersLength > 0) + { + var average = judgmentMeters.Sum(judgmentMeter => judgmentMeter) / judgmentMetersLength; + var absAverage = judgmentMeters.Sum(judgmentMeter => Math.Abs(judgmentMeter)) / judgmentMetersLength; + JudgmentMeterText = $"AVG: {average:0.###} ms, |AVG|: {absAverage:0.###} ms, STD: {Math.Sqrt(judgmentMeters.Sum(judgmentMeter => Math.Pow(average - judgmentMeter, 2)) / judgmentMetersLength):0.###} ms"; + var lowJudgmentMeters = judgmentMeters.Where(judgmentMeter => Math.Abs(judgmentMeter) >= Configure.Instance.JudgmentMeterMillis).ToArray(); + EarlyLateText = $"Early: {lowJudgmentMeters.Count(lowJudgmentMeter => lowJudgmentMeter < 0.0)}, Late: {lowJudgmentMeters.Count(lowJudgmentMeter => lowJudgmentMeter > 0.0)}"; + } + else + { + JudgmentMeterText = string.Empty; + EarlyLateText = string.Empty; + } + } + + var paintEvents = (_paintEventsDate == Component.PaintEventsDate100 ? Comment.Paints.Select((paintEvent, i) => + { + paintEvent.Wait = i * Length / (Comment.Paints.Count - 1); + return paintEvent; + }) : Comment.Paints).Where(paintEvent => 0.0 <= paintEvent.Wait && paintEvent.Wait <= Length).ToArray(); + lock (EventValuesCSX) + { + HitPointsEventValues.Clear(); + PointEventValues.Clear(); + StandEventValues.Clear(); + BandEventValues.Clear(); + if (paintEvents.Length > 0) + { + for (var i = 100; i >= 0; --i) + { + var wait = Length * i / 100; + var lastPaintEvent = paintEvents.LastOrDefault(paintEvent => paintEvent.Wait <= wait) ?? new() + { + Wait = wait, + HitPoints = 1.0, + Point = 1.0 + }; + HitPointsEventValues.Add(KeyValuePair.Create(wait / Length, 1.0 - lastPaintEvent.HitPoints)); + PointEventValues.Add(KeyValuePair.Create(wait / Length, 1.0 - lastPaintEvent.Point)); + StandEventValues.Add(KeyValuePair.Create(wait / Length, Math.Min((double)(InheritTotalStand - lastPaintEvent.Stand) / InheritTotalStand, 1.0))); + BandEventValues.Add(KeyValuePair.Create(wait / Length, Math.Min((double)(InheritedTotalNotes - lastPaintEvent.Band) / InheritedTotalNotes, 1.0))); + } + } + } + SendSituation(); + } + + public float GetPosition(int input) + { + var lowerInput = (int)input; + return (float)(DrawingComponentValue.mainPosition + DrawingComponentValue.MainNoteLengthLevyingMap[lowerInput] + DrawingComponentValue.DrawingNoteLengthMap[lowerInput] * (input - lowerInput) + (IsIn2P[lowerInput] && DrawingComponentValue.MainNoteLengthMap[lowerInput] > 0F ? DrawingComponentValue.p2Position : 0F)); + } + + public void SetUIMap() + { + AlwaysNotP2Position = Configure.Instance.AlwaysNotP2Position; + InputMappingValue = Configure.Instance.InputMappingValue; + var inputCount = Component.InputCounts[(int)InputMode]; + if (AlwaysNotP2Position) + { + Input1PCount = inputCount; + IsIn2P = new bool[inputCount + 1]; + Has2P = false; + } + else + { + Input1PCount = Component.Input1PCounts[(int)InputMode]; + IsIn2P = Component.IsIn2P[(int)InputMode]; + Has2P = Component.Has2P[(int)InputMode]; + } + lock (UI.Instance.ContentsCSX) + { + if (string.IsNullOrEmpty(UI.Instance.FaultText)) + { + DrawingComponentValue.SetValue(this); + + foreach (var note in Notes) + { + if (note.HasInput) + { + note.SetLayer(this); + } + } + + lock (JudgmentPaints) + { + JudgmentPaints.Clear(); + } + lock (HitNotePaints) + { + HitNotePaints.Clear(); + } + lock (HitLongNotePaints) + { + HitLongNotePaints.Clear(); + } + HighestNetLength = 0F; + HighestNetHeight = 0F; + LevelFrame = 0; + NoteFrame = 0; + AutoMainFrame = 0; + Array.Clear(JudgmentMainFrames, 0, JudgmentMainFrames.Length); + Array.Clear(MainJudgmentMeterFrames, 0, MainJudgmentMeterFrames.Length); + Array.Clear(PaintPropertyFrames, 0, PaintPropertyFrames.Length); + for (var i = BandDrawingFrames.Count - 1; i >= 0; --i) + { + BandDrawingFrames[i] = 0; + } + for (var i = BandEnlargedMap.Count - 1; i >= 0; --i) + { + BandEnlargedMap[i] = 0.0; + } + + switch (UI.Instance.LoopingMain) + { + case 0: + case 1: + Array.Fill(MainFrames, 0); + Array.Fill(_targetMainFrames, 0); + break; + case 2: + var mainFrame = DrawingComponentValue.mainFrame; + Array.Fill(MainFrames, mainFrame); + Array.Fill(_targetMainFrames, mainFrame); + break; + } + switch (UI.Instance.LoopingInput) + { + case 0: + case 1: + Array.Fill(InputFrames, 0); + Array.Fill(_targetInputFrames, 0); + break; + case 2: + var inputFrame = DrawingComponentValue.inputFrame; + Array.Fill(InputFrames, inputFrame); + Array.Fill(_targetInputFrames, inputFrame); + break; + } + + ViewModels.Instance.MainValue.ModeComponentValue.NotifyIIDXMultiplierMillisText(); + + DrawingSystem.Instance.SetFontSystem(UI.Instance.TitleFont, DrawingComponentValue.titleSystem0, DrawingComponentValue.titleSystem1); + DrawingSystem.Instance.SetFontSystem(UI.Instance.ArtistFont, DrawingComponentValue.artistSystem0, DrawingComponentValue.artistSystem1); + DrawingSystem.Instance.SetFontSystem(UI.Instance.GenreFont, DrawingComponentValue.genreSystem0, DrawingComponentValue.genreSystem1); + DrawingSystem.Instance.SetFontSystem(UI.Instance.LevelTextFont, DrawingComponentValue.levelTextSystem0, DrawingComponentValue.levelTextSystem1); + DrawingSystem.Instance.SetFontSystem(UI.Instance.WantLevelFont, DrawingComponentValue.wantLevelSystem0, DrawingComponentValue.wantLevelSystem1); + + NetDrawingComponentValue = new() + { + P2BuiltLength = (float)(DrawingComponentValue.p2BuiltLength + (Has2P ? DrawingComponentValue.p2Position : 0F)), + JudgmentMainPosition = DrawingComponentValue.judgmentMainPosition + }; + } + } + } + + public void HandleComputer() => Task.Run(() => + { + lock (_targetHandlerCSX) + { + if (IsHandling) + { + _targetHandler.Interrupt(); + _targetHandler.Join(); + } + IsHandling = true; + _targetHandler = Utility.HandleLongParallel(HandleNotes); + } + SendSituation(); + }); + + public object ContentsCSX { get; } = new(); + + public bool HasContents { get; set; } = true; + + public void Close() + { + IsSilent = true; + SetStop = true; + SendNotCompiled(); + AudioSystem.Instance.Stop(TrailerAudioHandler); + Task.Run(() => + { + if (_targetCompiler != null) + { + lock (_targetCompiler) + { + if (_targetCompilerStatus == CompilerStatus.Compiling) + { + _setCancelCompiler.Cancel(); + _setCancelCompiler.Dispose(); + MediaModifierValue.StopModifyMedia(); + _targetCompilerHandler.Join(); + _targetCompilerStatus = CompilerStatus.Close; + } + } + } + lock (_targetHandlerCSX) + { + if (IsHandling) + { + _targetHandler.Join(); + } + } + lock (ContentsCSX) + { + if (HasContents) + { + AudioSystem.Instance.Stop(this); + AudioSystem.Instance.Close(this, this); + MediaSystem.Instance.Stop(this); + MediaSystem.Instance.Close(this, this); + DrawingSystem.Instance.Close(this); + HasContents = false; + } + } + }); + } + + public void LowerMultiplier() + { + if (IsHandling) + { + MultiplierQueue.Enqueue(double.NegativeInfinity); + } + } + + public void HigherMultiplier() + { + if (IsHandling) + { + MultiplierQueue.Enqueue(double.PositiveInfinity); + } + } + + public void LowerAudioMultiplier() + { + if (IsHandling) + { + AudioMultiplierQueue.Enqueue(double.NegativeInfinity); + } + } + + public void HigherAudioMultiplier() + { + if (IsHandling) + { + AudioMultiplierQueue.Enqueue(double.PositiveInfinity); + } + } + + void SetInheritedValues() + { + InheritedTotalNotes += TotalNotes; + InheritedHighestJudgment += Comment.HighestJudgment; + InheritedHigherJudgment += Comment.HigherJudgment; + InheritedHighJudgment += Comment.HighJudgment; + InheritedLowJudgment += Comment.LowJudgment; + InheritedLowerJudgment += Comment.LowerJudgment; + InheritedLowestJudgment += Comment.LowestJudgment; + } + + public void SetQuitMode() + { + SetStop = true; + SetInheritedValues(); + ViewModels.Instance.MainValue.SetQuitMode(this); + } + + public virtual void SetNoteFileMode(string faultText = null) + { + SetStop = true; + ViewModels.Instance.MainValue.SetNoteFileMode(faultText); + } + + public virtual void AtNoteFileMode() + { + SetAutoNoteWait(); + Close(); + } + + public void OnStopped() + { + if (!IsSilent) + { + SetNoteFileMode(); + } + } + + public override void OnCompiled() + { + if (!IsSilent) + { + ViewModels.Instance.MainValue.CloseAutoComputer(); + try + { + SetUIMap(); + } + catch (Exception e) + { + throw new ScriptRuntimeException(e); + } + HandleComputer(); + } + } + + public virtual void OnFault(ScriptRuntimeException e) + { + if (!IsSilent) + { + SetNoteFileMode(string.Format(LanguageSystem.Instance.UIFaultText, e.Message)); + } + } + + public override void OnFault(Exception e) + { + if (!IsSilent) + { + SetNoteFileMode(string.Format(LanguageSystem.Instance.CompileFaultText, e.Message)); + } + } + + public void InitNetComments() + { + _wasGetNetComments = false; + _wasNetItems = false; + _wasGetNetItems = false; + } + + public void AutoPause() + { + if (IsHandling && CanPause && !CanSetPosition && ValidatedTotalNotes > 0 && LastStatusValue == LastStatus.Not) + { +#if !DEBUG + Pause(); +#endif + } + } + + public void Pause() + { + IsPausingWindowOpened = true; + if (CanPause) + { + SetPause = true; + if (ValidatedTotalNotes > 0 && _validJudgedNotes > 0 && LastStatusValue == LastStatus.Not) + { + _isPaused = true; + } + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoPause, new + { + avatarIDs = _sentIOAvatarIDs, + handlerID = HandlerID, + isPaused = true + }); + } + } + } + + public void Unpause() + { + IsPausingWindowOpened = false; + SetPause = false; + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoPause, new + { + avatarIDs = _sentIOAvatarIDs, + handlerID = HandlerID, + isPaused = false + }); + } + } + + public bool IsSuitableAsInput(int input) => ModeComponentValue.AutoModeValue switch + { + ModeComponent.AutoMode.Default => true, + ModeComponent.AutoMode.Autoable => Array.IndexOf(Component.AutoableInputs[(int)InputMode], input) == -1, + _ => default, + }; + + public virtual bool IsSuitableAsHwInput(int input) => IsSuitableAsInput(input); + + public virtual bool IsSuitableAsAutoJudge(int input) => ModeComponentValue.AutoModeValue switch + { + ModeComponent.AutoMode.Default => false, + ModeComponent.AutoMode.Autoable => Component.AutoableInputs[(int)InputMode].Contains(input), + _ => default, + }; + + public void PostItem(int postableItemPosition) + { + PostItemQueue.Enqueue(postableItemPosition); + } + + public void Input(int input, InputFlag inputFlag = InputFlag.Not, byte inputPower = byte.MaxValue) + { + if (IsSuitableAsHwInput(Math.Abs(input))) + { + HandleInput(input, inputFlag, inputPower); + } + } + + public void HandleInput(int input, InputFlag inputFlag = InputFlag.Not, byte inputPower = byte.MaxValue) + { + if (IsHandling && !IsPausing) + { + _rawInputQueue.Enqueue((input, inputPower)); + if (input > 0) + { + _hitLongNotePaintMillis[input] = 0.0; + } + _inputFlags |= inputFlag; + } + } + + public bool IsAutoMode { get; set; } + + public MediaModifier MediaModifierValue { get; } = new(); + + public void ModifyAutoMode() + { + if (CanModifyAutoMode && !SetPause) + { + IsAutoMode = !IsAutoMode; + } + } + + public enum CompilerStatus + { + Not, Compiling, Close + } + + public enum LastStatus + { + Not, Last, Band1 + } + + public double AudioLength { get; set; } + + public int CommentWaitDate { get; } + + public bool BanalMedia { get; } = Configure.Instance.BanalMedia; + + public bool BanalFailedMedia { get; } = Configure.Instance.BanalFailedMedia; + + public bool AlwaysBanalMedia { get; } = Configure.Instance.AlwaysBanalMedia; + + public bool AlwaysBanalFailedMedia { get; } = Configure.Instance.AlwaysBanalFailedMedia; + + public string BanalMediaFilePath { get; } = Configure.Instance.BanalMediaFilePath; + + public string BanalFailedMediaFilePath { get; } = Configure.Instance.BanalFailedMediaFilePath; + + public double[][] JudgmentInputValues { get; } = new double[100][]; + + public SortedDictionary> WaitAudioNoteMap { get; } = new(); + + public SortedDictionary> WaitInputAudioMap { get; } = new(); + + public SortedDictionary> WaitMediaNoteMap { get; } = new(); + + public SortedDictionary MeterWaitMap { get; } = new(); + + public SortedDictionary WaitBPMMap { get; } = new(); + + public SortedDictionary WaitLogicalYMap { get; } = new(); + + public List AutoableInputNoteCounts { get; } = new(); + + public List InputNoteCounts { get; } = new(); + + public bool IsP => InheritedLowestJudgment == 0; + + public virtual QuitStatus QuitStatusValue => Utility.GetQuitStatusValue(Point.TargetValue, Stand.TargetValue, IsF ? 0.0 : HitPoints.TargetValue, NoteFiles.Length); + + public virtual double HandledLength => Length; + + public virtual LastStatus LastStatusValue => _lastStatus; + + public virtual bool IsPowered => true; + + public virtual bool HandleFailedAudio => Configure.Instance.HandleFailedAudio.Data != ViewItem.Not; + + public virtual bool ViewFailedDrawing => Configure.Instance.ViewFailedDrawing.Data != ViewItem.Not; + + public virtual bool ViewLowestJudgment => Configure.Instance.ViewLowestJudgment.Data != ViewItem.Not; + + public double PassableWait { get; set; } + + public int ValidatedTotalNotes { get; set; } + + public IHandledItem LoopingBanalMedia { get; set; } + + public IHandledItem LoopingBanalFailedMedia { get; set; } + + void SendPostItem(PostableItem postableItem) + { + var isPositive = postableItem.IsPositive; + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.PostItem, + QwilightPostItem = new() + { + SiteID = SiteID, + HandlerID = HandlerID, + PostedItem = (int)postableItem.VarietyValue, + IsPositive = AvatarsCount > 1 && isPositive.HasValue ? isPositive.Value ? 1 : 0 : -1, + LowestWait = postableItem.LowestWait, + HighestWait = postableItem.HighestWait + } + }); + } + + void SendIOInput(int input, byte inputPower) + { + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.IoInput, + QwilightIOInput = new() + { + AvatarIDs = + { + _sentIOAvatarIDs + }, + HandlerID = HandlerID, + Input = input, + Power = inputPower + } + }); + } + } + + void SendIOJudge(BaseNote note) + { + if (_sentIOAvatarIDs.Count > 0 && note.ID != -1) + { + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.IoJudge, + QwilightIOJudge = new() + { + AvatarIDs = + { + _sentIOAvatarIDs + }, + HandlerID = HandlerID, + NoteID = note.ID, + Judged = (int)note.Judged + } + }); + } + } + + void SendIOJudgmentMeter(int input, double judgmentMeter, Component.JudgmentAssist judgmentAssist) + { + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.IoJudgmentMeter, + QwilightIOJudgmentMeter = new() + { + AvatarIDs = + { + _sentIOAvatarIDs + }, + HandlerID = HandlerID, + Input = input, + JudgmentMeter = judgmentMeter, + Assist = (int)judgmentAssist + } + }); + } + } + + void SendIONoteVisibility(BaseNote note, bool setValidJudgedNotes, bool setNoteFailed) + { + if (_sentIOAvatarIDs.Count > 0 && note.ID != -1) + { + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.IoNoteVisibility, + QwilightIONoteVisibility = new() + { + AvatarIDs = + { + _sentIOAvatarIDs + }, + HandlerID = HandlerID, + NoteID = note.ID, + SetValidJudgedNotes = setValidJudgedNotes, + SetNoteFailed = setNoteFailed + } + }); + } + } + + public int SetNetItems(List netItems) + { + if (Configure.Instance.HunterVarietyV2Value.Mode == HunterVariety.HunterVarietyFavor) + { + netItems.Add(new(string.Empty, "Qwilight", DateTime.Now) + { + HitPointsModeValue = ModeComponent.HitPointsMode.Default, + IsFavorNetItem = true + }); + } + var targetNetItems = netItems.OrderByDescending(netItem => netItem.StandValue).ToList(); + for (var i = targetNetItems.Count - 1; i >= 0; --i) + { + targetNetItems[i].DrawingPosition = i; + targetNetItems[i].TargetPosition = i; + } + NetItems = targetNetItems; + return targetNetItems.Count; + } + + public virtual void HandleWarning() + { + if (ModeComponentValue.IsAudioMultiplierWarning) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.AudioMultiplierWarning, ModeComponentValue.AudioMultiplier.ToString("×0.00"))); + } + if (!Configure.Instance.AllowTwilightComment && !IsBanned & ModeComponentValue.CanBeTwilightComment && TwilightSystem.Instance.IsSignedIn) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.TwilightCommentWarning); + } + if (ModeComponentValue.HitPointsModeValue == ModeComponent.HitPointsMode.Test && string.IsNullOrEmpty(EventNoteEntryItem?.EventNoteID)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.TestHitPointsModeWarning); + } + } + + public DefaultCompute(BaseNoteFile[] noteFiles, Comment[] comments, ModeComponent defaultModeComponentValue, string avatarID, string avatarName, WwwLevelData wwwLevelDataValue = null, string handlerID = "", EntryItem eventNoteEntryItem = null, DefaultCompute lastComputer = null) + { + NoteFiles = noteFiles; + MyNoteFiles = noteFiles; + Stands = new MoveValue[NoteFiles.Length]; + // Array.Fill은 같은 객체 참조를 의도한 것 + Array.Fill(Stands, new()); + Points = new MoveValue[NoteFiles.Length]; + Array.Fill(Points, new(1.0)); + HitPointsValues = new MoveValue[NoteFiles.Length]; + Array.Fill(HitPointsValues, new(1.0)); + Array.Fill(_hitPointsGAS, HitPoints.TargetValue); + IsFs = new Primitive[NoteFiles.Length]; + Array.Fill(IsFs, new(false)); + ModeComponentValues = new ModeComponent[NoteFiles.Length]; + var modeComponentValue = ViewModels.Instance.MainValue.ModeComponentValue; + CompatibleModeComponentValue = modeComponentValue.Clone(); + Array.Fill(ModeComponentValues, modeComponentValue); + AvatarIDs = new string[NoteFiles.Length]; + Array.Fill(AvatarIDs, avatarID); + AvatarNames = new string[NoteFiles.Length]; + Array.Fill(AvatarNames, avatarName); + LevyingMultiplier = ModeComponentValue.Multiplier; + LevyingAudioMultiplier = AudioMultiplier; + InheritTotalStand = 1000000 * NoteFiles.Length; + DefaultModeComponentValue = defaultModeComponentValue; + _isLevyingComputer = lastComputer == null; + if (_isLevyingComputer) + { + TotallyLevyingMultiplier = LevyingMultiplier; + TotallyLevyingAudioMultiplier = LevyingAudioMultiplier; + WwwLevelDataValue = wwwLevelDataValue; + } + else + { + _lazyInit = new(() => + { + HitPoints.TargetValue = lastComputer.HitPoints.TargetValue; + Point.TargetValue = lastComputer.Point.TargetValue; + Band.TargetValue = lastComputer.Band.TargetValue; + Stand.TargetValue = lastComputer.Stand.TargetValue; + HighestBand = lastComputer.HighestBand; + TotalPoint = lastComputer.TotalPoint; + SavedPoint = lastComputer.SavedPoint; + EarlyValue = lastComputer.EarlyValue; + LateValue = lastComputer.LateValue; + HasFailedJudgment = lastComputer.HasFailedJudgment; + IsF.SetValue(lastComputer.IsF); + _isPaused = lastComputer._isPaused; + _inputFlags = lastComputer._inputFlags; + Array.Copy(lastComputer._hitPointsGAS, _hitPointsGAS, _hitPointsGAS.Length); + }); + LastStand = lastComputer.Stand.TargetValue; + TotallyLevyingMultiplier = lastComputer.TotallyLevyingMultiplier; + TotallyLevyingAudioMultiplier = lastComputer.TotallyLevyingAudioMultiplier; + WwwLevelDataValue = lastComputer.WwwLevelDataValue; + InheritedTotalNotes = lastComputer.InheritedTotalNotes; + InheritedHighestJudgment = lastComputer.InheritedHighestJudgment; + InheritedHigherJudgment = lastComputer.InheritedHigherJudgment; + InheritedHighJudgment = lastComputer.InheritedHighJudgment; + InheritedLowJudgment = lastComputer.InheritedLowJudgment; + InheritedLowerJudgment = lastComputer.InheritedLowerJudgment; + InheritedLowestJudgment = lastComputer.InheritedLowestJudgment; + LevyingComputingPosition = lastComputer.LevyingComputingPosition + 1; + HighestComputingPosition = lastComputer.HighestComputingPosition + 1; + _comments = lastComputer._comments; + } + if (comments != null) + { + Comments = comments; + } + else + { + Comments = new Comment[NoteFiles.Length]; + for (var i = Comments.Length - 1; i >= 0; --i) + { + Comments[i] = new() + { + Date = QwilightComponent.DateText, + LoopUnit = Configure.Instance.LoopUnit + }; + } + } + EventNoteEntryItem = eventNoteEntryItem; + HandlerID = handlerID ?? Guid.NewGuid().ToString(); + for (var i = 0; i < PostableItemFaints.Length; ++i) + { + PostableItemFaints[i] = new(); + } + for (var i = PostableItem.Values.Length - 1; i >= 0; --i) + { + PostableItemStatusMap[PostableItem.Values[i]] = new(); + } + for (var i = _paintEventsGAS.Length - 1; i >= 0; --i) + { + _paintEventsGAS[i] = new(); + } + for (var i = JudgmentVisualizerValues.Length - 1; i >= 0; --i) + { + JudgmentVisualizerValues[i] = new(); + } + for (var i = (int)Component.Judged.Lowest; i >= (int)Component.Judged.Highest; --i) + { + JudgmentMeterEventValues[i] = new(); + } + for (var i = JudgmentInputValues.Length - 1; i >= 0; --i) + { + JudgmentInputValues[i] = new double[6]; + } + var date = Version.Parse(Comment.Date); + _judgmentModeDate = Utility.IsLowerDate(date, 1, 6, 7) ? Component.JudgmentMode100 : Utility.IsLowerDate(date, 1, 10, 34) ? Component.JudgmentMode167 : Utility.IsLowerDate(date, 1, 10, 35) ? Component.JudgmentMode11034 : Utility.IsLowerDate(date, 1, 14, 6) ? Component.JudgmentMode11035 : Component.JudgmentMode1146; + _judgmentMapDate = Utility.IsLowerDate(date, 1, 3, 0) ? Component.JudgmentMap100 : Utility.IsLowerDate(date, 1, 6, 7) ? Component.JudgmentMap130 : Utility.IsLowerDate(date, 1, 6, 8) ? Component.JudgmentMap167 : Utility.IsLowerDate(date, 1, 10, 34) ? Component.JudgmentMap168 : Utility.IsLowerDate(date, 1, 10, 35) ? Component.JudgmentMap11034 : Utility.IsLowerDate(date, 1, 11, 0) ? Component.JudgmentMap11035 : Component.JudgmentMap1110; + _longNoteAssistDate = Utility.IsLowerDate(date, 1, 6, 7) ? Component.LongNoteAssist100 : Utility.IsLowerDate(date, 1, 10, 34) ? Component.LongNoteAssist167 : Utility.IsLowerDate(date, 1, 10, 35) ? Component.LongNoteAssist11034 : Component.LongNoteAssist11035; + _trapNoteJudgmentDate = Utility.IsLowerDate(date, 1, 14, 6) ? Component.TrapNoteJudgmentDate100 : Component.TrapNoteJudgmentDate1146; + _paintEventsDate = Utility.IsLowerDate(date, 1, 14, 91) ? Component.PaintEventsDate100 : Component.PaintEventsDate11491; + LongNoteModeDate = Utility.IsLowerDate(date, 1, 14, 20) ? Component.LongNoteMode100 : Utility.IsLowerDate(date, 1, 16, 4) ? Component.LongNoteMode11420 : Component.LongNoteMode1164; + NoteFile.SetConfigure(); + Title = NoteFile.Title; + Artist = NoteFile.Artist; + Genre = NoteFile.Genre; + LevelValue = NoteFile.LevelValue; + LevelText = NoteFile.LevelText; + InputMode = NoteFile.InputMode; + _hitPointsModeDate = Utility.IsLowerDate(date, 1, 2, 3) ? Component.HitPointsMode100 : Utility.IsLowerDate(date, 1, 10, 34) ? Component.HitPointsMode123 : Utility.IsLowerDate(date, 1, 10, 35) ? Component.HitPointsMode11034 : Utility.IsLowerDate(date, 1, 14, 62) ? Component.HitPointsMode11035 : Component.HitPointsMode11462; + _hitPointsMapDate = Utility.IsLowerDate(date, 1, 6, 7) ? Component.HitPointsMap100 : Utility.IsLowerDate(date, 1, 7, 0) ? Component.HitPointsMap167 : Utility.IsLowerDate(date, 1, 13, 2) ? Component.HitPointsMap170 : Component.HitPointsMap1132; + _pointDate = Utility.IsLowerDate(date, 1, 6, 7) ? Component.Point100 : Component.Point167; + _standMapDate = Utility.IsLowerDate(date, 1, 14, 118) ? Component.StandMap100 : Component.StandMap114118; + _standModeDate = Utility.IsLowerDate(date, 1, 6, 7) ? Component.StandMode100 : Utility.IsLowerDate(date, 1, 14, 118) ? Component.StandMode167 : Component.StandMode114118; + _tooLongLongNoteDate = Utility.IsLowerDate(date, 1, 13, 107) ? Component.TooLongLongNote100 : Utility.IsLowerDate(date, 1, 14, 20) ? Component.TooLongLongNote113107 : Utility.IsLowerDate(date, 1, 14, 29) ? Component.TooLongLongNote11420 : Component.TooLongLongNote11429; + _targetCompiler = BaseCompiler.GetCompiler(NoteFile, _setCancelCompiler); + _targetCompilerHandler = Utility.GetLongParallel(() => _targetCompiler.Compile(this)); + CommentWaitDate = Utility.IsLowerDate(date, 1, 3, 11) ? Component.CommentWaitDate100 : Utility.IsLowerDate(date, 1, 6, 4) ? Component.CommentWaitDate1311 : Component.CommentWaitDate164; + HandleWarning(); + } + + void SetIIDXInputAudioVariety(BaseNote note) + { + if (InputAudioVarietyValue == Configure.InputAudioVariety.IIDX) + { + _lastIIDXInputAudioNoteMap[note.TargetInput] = note.AudioNotes; + } + } + + public void LoadStandardContents(bool isBanalMedia, bool isBanalFailedMedia, IProducerConsumerCollection parallelItems) + { + if (LoadedMedia) + { + if (isBanalMedia && !string.IsNullOrEmpty(BanalMediaFilePath)) + { + parallelItems.TryAdd(() => + { + try + { + switch (Utility.GetAvailable(BanalMediaFilePath)) + { + case Utility.AvailableFlag.Drawing: + LoopingBanalMedia = new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.Load(BanalMediaFilePath, this), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(BanalMediaFilePath, this) + }; + break; + case Utility.AvailableFlag.Media: + LoopingBanalMedia = MediaSystem.Instance.Load(BanalMediaFilePath, this); + break; + } + } + catch + { + } + }); + } + if (isBanalFailedMedia && !string.IsNullOrEmpty(BanalFailedMediaFilePath)) + { + parallelItems.TryAdd(() => + { + try + { + switch (Utility.GetAvailable(BanalFailedMediaFilePath)) + { + case Utility.AvailableFlag.Drawing: + LoopingBanalFailedMedia = new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.Load(BanalFailedMediaFilePath, this), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(BanalFailedMediaFilePath, this) + }; + break; + case Utility.AvailableFlag.Media: + LoopingBanalFailedMedia = MediaSystem.Instance.Load(BanalFailedMediaFilePath, this); + break; + } + } + catch + { + } + }); + } + } + } + + void HandleNotes() + { + var lastMultiplier = ModeComponentValue.Multiplier; + var lastAudioMultiplier = AudioMultiplier; + var handledNotYet = true; + var wait100 = Length / 100; + var rawJudgmentInputCounts = new int[100][]; + for (var i = rawJudgmentInputCounts.Length - 1; i >= 0; --i) + { + rawJudgmentInputCounts[i] = new int[6]; + } + var lastJudgmentInputMaxValue = 0; + var logicalY = 0.0; + var judgmentMeters = new JudgmentMeter[3]; + for (var i = judgmentMeters.Length - 1; i >= 0; --i) + { + judgmentMeters[i] = new(); + } + var areValidJudgmentMeters = new bool[3]; + var waitBPMMap = new Queue>(WaitBPMMap); + var waitAudioNoteMap = new Queue>>(WaitAudioNoteMap.ToList()); + var waitInputAudioMap = new Queue>>(WaitInputAudioMap.ToList()); + var waitMediaNoteMap = new Queue>>(WaitMediaNoteMap.ToList()); + var endNoteID = Notes.Count - 1; + var wasLastStatus = false; + var handlingNoteID = 0; + var paintedNoteID = 0; + var audioChannelMap = new Dictionary(); + var loopingHandlerMillis = 0.0; + var commentInputID = 0; + var commentMultiplierID = 0; + var commentAudioMultiplierID = 0; + var inputCount = Component.InputCounts[(int)InputMode]; + _valueComponent = new(NoteFile.LevyingBPM, Comment.LoopUnit); + + var handleAudioNotesImpl = new Action>((waitModified, audioNotes) => + { + foreach (var audioNote in audioNotes) + { + var audioItem = audioNote.AudioItem; + if (audioItem.HasValue) + { + var audioLength = audioNote.Length; + var audioItemValue = audioItem.Value; + if (LoopingCounter <= waitModified + (audioLength ?? audioItemValue.Length)) + { + var bmsID = audioItemValue.BMSID; + StopLastEqualAudioItem(bmsID); + lock (ContentsCSX) + { + if (HasContents) + { + var audioChannel = AudioSystem.Instance.Handle(new() + { + AudioItem = audioItemValue, + AudioLevyingPosition = (uint)(LoopingCounter - waitModified + audioNote.AudioLevyingPosition), + Length = audioLength != null ? (uint?)(waitModified + audioLength - LoopingCounter) : null + }, AudioSystem.MainAudio, AudioMultiplier, IsCounterWave, this); + if (!string.IsNullOrEmpty(bmsID)) + { + audioChannelMap[bmsID] = audioChannel; + } + } + } + } + } + } + }); + var handleMediaNotesImpl = new Action>((waitModified, mediaNotes) => + { + foreach (var mediaNote in mediaNotes) + { + if (mediaNote.HasContents) + { + var mediaItem = mediaNote.MediaItem; + var isLooping = mediaNote.IsLooping; + if (isLooping || mediaItem == null || LoopingCounter < waitModified + mediaItem.Length) + { + lock (ContentsCSX) + { + if (HasContents) + { + var mediaMode = mediaNote.MediaMode; + DrawingCollection[mediaMode] = mediaItem?.Handle(this, isLooping ? TimeSpan.Zero : TimeSpan.FromMilliseconds(waitModified) - mediaNote.MediaLevyingPosition, mediaMode, isLooping); + IsHandlingDrawing = true; + } + } + } + } + } + }); + + try + { + Init(); + + if (LevyingMeter >= 0) + { + LevyingWait = MeterWaitMap[Math.Min(LevyingMeter, MeterWaitMap.Keys.Max())]; + LevyingMeter = -1; + } + var levyingWait = LevyingWait; + if (!double.IsNaN(levyingWait)) + { + levyingWait = Math.Round(levyingWait); + if (-Component.LevyingWait > levyingWait || Length + Component.QuitWait <= levyingWait) + { + levyingWait = 0.0; + } + foreach (var eventPosition in Notes.Where(note => note.HasStand).Select(note => note.Wait) + .Concat(Notes.Where(note => note.LongWait > 0.0).Select(note => note.Wait + note.LongWait)) + .Concat(EventComment?.Inputs?.Select(inputEvent => Utility.SetCommentWait(CommentWaitDate, AudioMultiplier, inputEvent.Wait)) ?? Enumerable.Empty()) + .Concat(EventComment?.Multipliers?.Select(multiplierEvent => Utility.SetCommentWait(CommentWaitDate, AudioMultiplier, multiplierEvent.Wait)) ?? Enumerable.Empty()) + .Concat(EventComment?.AudioMultipliers?.Select(audioMultiplierEvent => Utility.SetCommentWait(CommentWaitDate, AudioMultiplier, audioMultiplierEvent.Wait)) ?? Enumerable.Empty()) + .Where(wait => wait < levyingWait) + .Append(levyingWait) + .Distinct() + .Order()) + { + _eventPositions.Enqueue(eventPosition); + } + } + + var atLoopingCounter1000 = 0.0; + var lastLoopingCounter = LoopingCounter; + + var postedAudioMultiplier = 1.0; + var postedTrapNotesMillis = 1.0; + var postedAutoableNotesMillis = 1.0; + var postedSaltNotesMillis = 1.0; + + var ioMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - IOMillis; + while (!SetStop && !SetUndo) + { + if (LoopingCounter > HandledLength + Component.QuitWait && handledNotYet) + { + handledNotYet = false; + OnHandled(); + } + + if (!IsPausing && SetPause) + { + AudioSystem.Instance.Pause(this, true); + MediaSystem.Instance.Pause(this, true); + IsPausing = true; + } + + var millisLoopUnit = _valueComponent.MillisLoopUnit; + + var longNoteHitFrame = DrawingComponentValue.longNoteHitFrame; + var longNoteHitFramerate = DrawingComponentValue.longNoteHitFramerate; + var longNoteHitLoopFrame = DrawingComponentValue.longNoteHitLoopFrame; + var lastEnlargedBandLoopFrame = DrawingComponentValue.lastEnlargedBandLoopFrame; + var judgmentFrame = DrawingComponentValue.judgmentFrame; + var judgmentFramerate = DrawingComponentValue.judgmentFramerate; + var judgmentSystem = DrawingComponentValue.judgmentSystem; + var judgmentPosition0 = DrawingComponentValue.judgmentPosition0; + var judgmentPosition1 = DrawingComponentValue.judgmentPosition1; + var judgmentLength = DrawingComponentValue.judgmentLength; + var judgmentHeight = DrawingComponentValue.judgmentHeight; + var mainFrame = DrawingComponentValue.mainFrame; + var inputFrame = DrawingComponentValue.inputFrame; + var inputPaintFrame = DrawingComponentValue.hitInputPaintFrame; + + if (!_loopingHandler.IsRunning && !IsInEvents) + { + AudioSystem.Instance.Stop(TrailerAudioHandler); + _loopingHandler.Start(); + } + + if (IsPostableItemMode) + { + while (PostItemQueue.TryDequeue(out var postableItemPosition)) + { + if (!IsF) + { + if (PostableItems[0] != null ^ PostableItems[1] != null) + { + if (PostableItems[0] != null) + { + postableItemPosition = 0; + } + else if (PostableItems[1] != null) + { + postableItemPosition = 1; + } + } + var postableItem = PostableItems[postableItemPosition]; + if (postableItem != null) + { + PostableItems[postableItemPosition] = null; + PostableItemFaints[postableItemPosition].TargetValue = 0.0; + if (postableItem.IsPositive == false) + { + AudioSystem.Instance.Handle(new() + { + AudioItem = AudioSystem.Instance.PostedItemAudio + }, AudioSystem.SEAudio); + } + SendPostItem(postableItem); + } + } + } + + lock (TwilightPostItemQueue) + { + while (TwilightPostItemQueue.TryDequeue(out var twilightPostItem)) + { + var postedItem = PostableItem.Values[twilightPostItem.PostedItem]; + var aegisItem = PostableItem.Values[(int)PostableItem.Variety.PositiveAegis]; + var aegisItemStatus = PostableItemStatusMap[aegisItem]; + if (postedItem.IsPositive == false && aegisItemStatus.IsHandling) + { + aegisItemStatus.Stop(); + AudioSystem.Instance.Handle(new() + { + AudioItem = AudioSystem.Instance.PostableItemAudioMap[aegisItem] + }, AudioSystem.SEAudio); + PostedItemText = PoolSystem.Instance.GetFormattedText(LanguageSystem.Instance.AegisPostedItemText, twilightPostItem.AvatarName, postedItem.ToString()); + PostedItemVariety = 1; + PostedItemFaints[PostedItemVariety] = 1.0; + } + else + { + var wasAegis = false; + switch (postedItem.VarietyValue) + { + case PostableItem.Variety.PositiveJudgment: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeJudgment]].Halt(); + break; + case PostableItem.Variety.PositiveHitPoints: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeHitPoints]].Halt(); + break; + case PostableItem.Variety.PositiveHitPointsLevel: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeHitPointsLevel]].Halt(); + break; + case PostableItem.Variety.PositiveAegis: + foreach (var (postableItem, postableItemStatus) in PostableItemStatusMap) + { + if (postableItem.IsPositive == false && postableItemStatus.IsHandling) + { + postableItemStatus.Stop(); + wasAegis = true; + } + } + break; + case PostableItem.Variety.NegativeFaint: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeFading]].Halt(); + break; + case PostableItem.Variety.NegativeFading: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeFaint]].Halt(); + break; + case PostableItem.Variety.NegativeJudgment: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.PositiveJudgment]].Halt(); + break; + case PostableItem.Variety.NegativeHitPoints: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.PositiveHitPoints]].Halt(); + break; + case PostableItem.Variety.NegativeHitPointsLevel: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.PositiveHitPointsLevel]].Halt(); + break; + case PostableItem.Variety.Negative4D: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeZip]].Halt(); + break; + case PostableItem.Variety.NegativeZip: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.Negative4D]].Halt(); + break; + case PostableItem.Variety.NegativeAutoableNotes: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeSalt]].Halt(); + break; + case PostableItem.Variety.NegativeSalt: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeAutoableNotes]].Halt(); + break; + case PostableItem.Variety.LowerAudioMultiplier: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.HigherAudioMultiplier]].Halt(); + break; + case PostableItem.Variety.HigherAudioMultiplier: + PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.LowerAudioMultiplier]].Halt(); + break; + } + if (!wasAegis) + { + PostableItemStatusMap[postedItem].Init(postedItem, twilightPostItem.AvatarName, twilightPostItem.Wait); + } + AudioSystem.Instance.Handle(new() + { + AudioItem = AudioSystem.Instance.PostableItemAudioMap.GetValueOrDefault(postedItem) + }, AudioSystem.SEAudio); + PostedItemText = PoolSystem.Instance.GetFormattedText(postedItem.IsPositive == true ? LanguageSystem.Instance.PositivePostedItemText : LanguageSystem.Instance.NegativePostedItemText, twilightPostItem.AvatarName, postedItem.ToString()); + PostedItemVariety = postedItem.IsPositive.HasValue ? postedItem.IsPositive.Value ? 1 : 0 : -1; + PostedItemFaints[PostedItemVariety] = 1.0; + } + } + } + + lock (PostableItemStatusMap) + { + foreach (var (postableItem, postableItemStatus) in PostableItemStatusMap) + { + var isElapsing = true; + switch (postableItem.VarietyValue) + { + case PostableItem.Variety.PositiveHitPoints when HitPoints.TargetValue == 1.0: + isElapsing = false; + break; + } + if (postableItemStatus.IsHandling) + { + if (!postableItemStatus.IsLevyed) + { + switch (postableItem.VarietyValue) + { + case PostableItem.Variety.PositiveHitPointsLevel: + ModeComponentValue.HitPointsModeValue = ModeComponent.HitPointsMode.Lowest; + break; + case PostableItem.Variety.NegativeHitPointsLevel: + ModeComponentValue.HitPointsModeValue = ModeComponent.HitPointsMode.Higher; + break; + case PostableItem.Variety.NegativeFaint: + ModeComponentValue.FaintNoteModeValue = ModeComponent.FaintNoteMode.Faint; + break; + case PostableItem.Variety.NegativeFading: + ModeComponentValue.FaintNoteModeValue = ModeComponent.FaintNoteMode.Fading; + break; + case PostableItem.Variety.Negative4D: + ModeComponentValue.NoteMobilityModeValue = ModeComponent.NoteMobilityMode._4D; + break; + case PostableItem.Variety.NegativeZip: + ModeComponentValue.NoteMobilityModeValue = ModeComponent.NoteMobilityMode.Zip; + break; + case PostableItem.Variety.LowerAudioMultiplier: + postedAudioMultiplier = 0.5; + break; + case PostableItem.Variety.HigherAudioMultiplier: + postedAudioMultiplier = 1.5; + break; + case PostableItem.Variety.Pause: + AudioSystem.Instance.Pause(this, true); + MediaSystem.Instance.Pause(this, true); + SetPause = true; + IsPausing = true; + break; + } + } + else + { + switch (postableItem.VarietyValue) + { + case PostableItem.Variety.PositiveHitPoints: + HitPoints.TargetValue = Math.Min(HitPoints.TargetValue + millisLoopUnit / 1000.0 / (1000.0 / 60.0), 1.0); + break; + case PostableItem.Variety.NegativeHitPoints: + HitPoints.TargetValue = Math.Max(double.Epsilon, HitPoints.TargetValue - millisLoopUnit / 1000.0 / (1000.0 / 60.0)); + break; + case PostableItem.Variety.NegativeTrapNotes: + postedTrapNotesMillis += millisLoopUnit; + while (postedTrapNotesMillis >= 60.0) + { + postedTrapNotesMillis -= 60.0; + var autoableInputCount = Component.AutoableInputCounts[(int)InputMode]; + var input = 1 + autoableInputCount + Random.Shared.Next(Component.InputCounts[(int)InputMode] - autoableInputCount); + var wait = Math.Floor(Math.Min(LoopingCounter + 1000.0 * Random.Shared.Next(1000 / 60) / (1000 / 60), Length + Component.QuitWait)); + var isTrapNote = true; + foreach (var handlingNote in _handlingNotes) + { + if (input == handlingNote.TargetInput && (handlingNote.Wait - 60.0 <= wait && wait < handlingNote.Wait + handlingNote.LongWait + 60.0)) + { + isTrapNote = false; + } + } + if (isTrapNote) + { + var trapNote = new TrapNote(WaitLogicalYMap[wait], wait, Array.Empty(), input, true) + { + ID = -1 + }; + trapNote.InitY(logicalY); + _handlingNotes.Add(trapNote); + lock (PaintedNotes) + { + PaintedNotes.Add(trapNote); + } + } + } + break; + case PostableItem.Variety.NegativeAutoableNotes: + postedAutoableNotesMillis += millisLoopUnit; + while (postedAutoableNotesMillis >= 60.0) + { + postedAutoableNotesMillis -= 60.0; + foreach (var handlingNote in _handlingNotes) + { + if (handlingNote.HasStand && handlingNote.Judged == Component.Judged.Not && handlingNote.IsVisibleHalf(this) && handlingNote.TargetInput == handlingNote.LevyingInput) + { + var isAutoableNote = true; + foreach (var note in _handlingNotes) + { + if (note.TargetInput == 1 && handlingNote.IsCollided(note)) + { + isAutoableNote = false; + } + } + if (isAutoableNote) + { + handlingNote.TargetInput = 1; + handlingNote.SetLayer(this); + break; + } + } + } + } + break; + case PostableItem.Variety.NegativeSalt: + postedSaltNotesMillis += millisLoopUnit; + while (postedSaltNotesMillis >= 60.0) + { + postedSaltNotesMillis -= 60.0; + var autoableInputCount = Component.AutoableInputCounts[(int)InputMode]; + var input = 1 + autoableInputCount + Random.Shared.Next(Component.InputCounts[(int)InputMode] - autoableInputCount); + foreach (var handlingNote in _handlingNotes) + { + if (handlingNote.HasStand && handlingNote.Judged == Component.Judged.Not && handlingNote.IsVisibleHalf(this) && handlingNote.TargetInput == handlingNote.LevyingInput) + { + var isSaltedNote = true; + foreach (var note in _handlingNotes) + { + if (note.TargetInput == input && handlingNote.IsCollided(note)) + { + isSaltedNote = false; + } + } + if (isSaltedNote) + { + handlingNote.TargetInput = input; + handlingNote.SetLayer(this); + break; + } + } + } + } + break; + } + } + } + else + { + switch (postableItem.VarietyValue) + { + case PostableItem.Variety.NegativeFading: + if (FaintCosine == 1.0 && ModeComponentValue.FaintNoteModeValue == ModeComponent.FaintNoteMode.Fading) + { + ModeComponentValue.FaintNoteModeValue = ModeComponent.FaintNoteMode.Default; + } + break; + case PostableItem.Variety.NegativeZip: + if (NoteMobilityCosine == 1.0 && ModeComponentValue.NoteMobilityModeValue == ModeComponent.NoteMobilityMode.Zip) + { + ModeComponentValue.NoteMobilityModeValue = ModeComponent.NoteMobilityMode.Default; + } + break; + case PostableItem.Variety.Negative4D: + if (NoteMobilityValue == 0.0 && ModeComponentValue.NoteMobilityModeValue == ModeComponent.NoteMobilityMode._4D) + { + ModeComponentValue.NoteMobilityModeValue = ModeComponent.NoteMobilityMode.Default; + } + break; + } + } + if (postableItemStatus.Elapse(millisLoopUnit, isElapsing)) + { + switch (postableItem.VarietyValue) + { + case PostableItem.Variety.PositiveHitPointsLevel: + case PostableItem.Variety.NegativeHitPointsLevel: + ModeComponentValue.HitPointsModeValue = ModeComponent.HitPointsMode.Default; + break; + case PostableItem.Variety.NegativeFaint: + ModeComponentValue.FaintNoteModeValue = ModeComponent.FaintNoteMode.Default; + break; + case PostableItem.Variety.LowerAudioMultiplier: + case PostableItem.Variety.HigherAudioMultiplier: + postedAudioMultiplier = 1.0; + break; + case PostableItem.Variety.Pause: + AudioSystem.Instance.Pause(this, false); + MediaSystem.Instance.Pause(this, false); + SetPause = false; + IsPausing = false; + break; + } + } + } + } + + ModeComponentValue.AudioMultiplier += Utility.GetMove(postedAudioMultiplier, ModeComponentValue.AudioMultiplier, 1000.0 / millisLoopUnit); + for (var i = 1; i >= -1; --i) + { + PostedItemFaints[i] += Utility.GetMove(0.0, PostedItemFaints[i], 1000.0 / millisLoopUnit); + } + } + + if (IsPausing) + { + if (CanPause && !CanSetPosition && ValidatedTotalNotes > 0 && LastStatusValue == LastStatus.Not) + { + if (!SetPause) + { + if (_pauseMillis == 0.0) + { + Array.Clear(PauseFrames, 0, PauseFrames.Length); + _pauseMillis = 3000.0; + } + if (_pauseMillis % 1000.0 == 0.0) + { + HandleUIAudio("Pause"); + } + if ((_pauseMillis -= millisLoopUnit) <= 0.0) + { + AudioSystem.Instance.Pause(this, false); + MediaSystem.Instance.Pause(this, false); + IsPausing = false; + } + } + } + else + { + if (!SetPause) + { + AudioSystem.Instance.Pause(this, false); + MediaSystem.Instance.Pause(this, false); + IsPausing = false; + } + } + } + else + { + lastLoopingCounter = LoopingCounter; + if (_eventPositions.TryDequeue(out var eventPosition)) + { + LoopingCounter = eventPosition; + } + else + { + LoopingCounter += millisLoopUnit * AudioMultiplier; + } + + while (TwilightCompiledIOQueue.TryDequeue(out var twilightCompiledIO)) + { + if (twilightCompiledIO.isCompiled) + { + _ioAvatarIDs.Add(twilightCompiledIO.avatarID); + _pendingIOAvatarIDs.Add(twilightCompiledIO.avatarID); + IOAvatarNames.Add(twilightCompiledIO.avatarName); + } + else + { + _ioAvatarIDs.Remove(twilightCompiledIO.avatarID); + _pendingIOAvatarIDs.Remove(twilightCompiledIO.avatarID); + _sentIOAvatarIDs.Remove(twilightCompiledIO.avatarID); + IOAvatarNames.Remove(twilightCompiledIO.avatarName); + } + } + + if (_pendingIOAvatarIDs.Count > 0) + { + var data = Comment.ToByteString(); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.LevyIo, new + { + avatarIDs = _pendingIOAvatarIDs, + handlerID = HandlerID, + levyingWait = LoopingCounter, + lastStand = LastStand, + isF = (bool)IsF, + multiplier = ModeComponentValue.Multiplier, + audioMultiplier = AudioMultiplier, + ioMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }, data); + _sentIOAvatarIDs.AddRange(_pendingIOAvatarIDs); + _pendingIOAvatarIDs.Clear(); + } + + if (!IsInEvents && !IsPowered) + { + lock (TwilightIOInputQueue) + { + while (TwilightIOInputQueue.TryPeek(out var elapsable) && elapsable.IsElapsed(ioMillis)) + { + var twilightIOInput = elapsable.Value; + HandleInput(twilightIOInput.Input, DefaultCompute.InputFlag.Not, (byte)twilightIOInput.Power); + TwilightIOInputQueue.TryDequeue(out _); + } + foreach (var elapsable in TwilightIOInputQueue) + { + elapsable.Elapse(millisLoopUnit); + } + } + + lock (TwilightIOJudgeQueue) + { + while (TwilightIOJudgeQueue.TryPeek(out var elapsable) && elapsable.IsElapsed(ioMillis)) + { + var twilightIOJudge = elapsable.Value; + var note = Notes[twilightIOJudge.NoteID]; + SetNoteJudged(note, (Component.Judged)twilightIOJudge.Judged); + OnNoteJudged(note); + ++_validJudgedNotes; + TwilightIOJudgeQueue.TryDequeue(out _); + } + foreach (var elapsable in TwilightIOJudgeQueue) + { + elapsable.Elapse(millisLoopUnit); + } + } + + lock (TwilightIONoteVisibilityQueue) + { + while (TwilightIONoteVisibilityQueue.TryPeek(out var elapsable) && elapsable.IsElapsed(ioMillis)) + { + var twilightIONoteVisibility = elapsable.Value; + var note = Notes[twilightIONoteVisibility.NoteID]; + if (twilightIONoteVisibility.SetNoteFailed) + { + SetNoteFailed(note, twilightIONoteVisibility.SetValidJudgedNotes); + } + else + { + WipeNote(note, twilightIONoteVisibility.SetValidJudgedNotes); + } + if (twilightIONoteVisibility.SetValidJudgedNotes) + { + ++_validJudgedNotes; + } + TwilightIONoteVisibilityQueue.TryDequeue(out _); + } + foreach (var elapsable in TwilightIONoteVisibilityQueue) + { + elapsable.Elapse(millisLoopUnit); + } + } + + lock (TwilightIOJudgmentMeterQueue) + { + while (TwilightIOJudgmentMeterQueue.TryPeek(out var elapsable) && elapsable.IsElapsed(ioMillis)) + { + var twilightIOJudgmentMeter = elapsable.Value; + SetJudgmentMeter(LoopingCounter, twilightIOJudgmentMeter.Input, twilightIOJudgmentMeter.JudgmentMeter, (Component.JudgmentAssist)twilightIOJudgmentMeter.Assist); + TwilightIOJudgmentMeterQueue.TryDequeue(out _); + } + foreach (var elapsable in TwilightIOJudgmentMeterQueue) + { + elapsable.Elapse(millisLoopUnit); + } + } + + lock (TwilightIOMultiplierQueue) + { + while (TwilightIOMultiplierQueue.TryPeek(out var elapsable) && elapsable.IsElapsed(ioMillis)) + { + var twilightIOMultiplier = elapsable.Value; + MultiplierQueue.Enqueue(twilightIOMultiplier.Multiplier); + TwilightIOMultiplierQueue.TryDequeue(out _); + } + foreach (var elapsable in TwilightIOMultiplierQueue) + { + elapsable.Elapse(millisLoopUnit); + } + } + + lock (TwilightIOAudioMultiplierQueue) + { + while (TwilightIOAudioMultiplierQueue.TryPeek(out var elapsable) && elapsable.IsElapsed(ioMillis)) + { + var twilightIOAudioMultiplier = elapsable.Value; + AudioMultiplierQueue.Enqueue(twilightIOAudioMultiplier.AudioMultiplier); + TwilightIOAudioMultiplierQueue.TryDequeue(out _); + } + foreach (var elapsable in TwilightIOAudioMultiplierQueue) + { + elapsable.Elapse(millisLoopUnit); + } + } + } + + if (Length > 0.0) + { + Status = Math.Clamp(LoopingCounter / Length, 0.0, 1.0); + } + else + { + Status = LoopingCounter < 0.0 ? 0.0 : 1.0; + } + + var absSin = Math.Abs(Math.Sin(LoopingCounter / 1000.0 % (2 * Math.PI))); + NoteMobilityCosine += Utility.GetMove(IsPostableItemMode && !PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeZip]].IsHandling ? 1.0 : absSin, NoteMobilityCosine, 1000.0 / millisLoopUnit); + NoteMobilityValue += Utility.GetMove(IsPostableItemMode && !PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.Negative4D]].IsHandling ? 0.0 : 1.0, NoteMobilityValue, 1000.0 / millisLoopUnit); + FaintCosine += Utility.GetMove(IsPostableItemMode && !PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeFading]].IsHandling ? 1.0 : absSin, FaintCosine, 1000.0 / millisLoopUnit); + + if ((_isPassable = LoopingCounter < PassableWait) && SetPass) + { + LevyingWait = PassableWait; + HandleUIAudio("Pass"); + SetUndo = true; + continue; + } + + while (endNoteID >= handlingNoteID) + { + var note = Notes[handlingNoteID]; + if (note.IsClose(LoopingCounter)) + { + note.InitY(logicalY); + _handlingNotes.Add(note); + ++handlingNoteID; + } + else + { + break; + } + } + while (endNoteID >= paintedNoteID) + { + var note = Notes[paintedNoteID]; + if (note.IsWiped) + { + ++paintedNoteID; + continue; + } + else if (note.IsVisible(this)) + { + lock (PaintedNotes) + { + PaintedNotes.Add(note); + } + ++paintedNoteID; + } + else + { + break; + } + } + + var distance = Utility.GetDistance(_valueComponent, waitBPMMap, lastLoopingCounter, LoopingCounter, out var lastBPM); + if (!double.IsNaN(lastBPM)) + { + HandlingBPM = lastBPM; + _millisStandardMeter = Math.Abs(60000.0 / lastBPM); + _millisMeter = _millisStandardMeter; + } + logicalY -= distance; + + if (!IsInEvents) + { + Utility.LoopBefore(waitAudioNoteMap, LoopingCounter, Configure.Instance.AudioWait + Configure.Instance.BanalAudioWait, handleAudioNotesImpl); + if (!Configure.Instance.HandleInputAudio) + { + Utility.LoopBefore(waitInputAudioMap, LoopingCounter, Configure.Instance.AudioWait + Configure.Instance.BanalAudioWait, handleAudioNotesImpl); + } + Utility.LoopBefore(waitMediaNoteMap, LoopingCounter, Configure.Instance.MediaWait + Configure.Instance.BanalMediaWait, handleMediaNotesImpl); + } + + for (var j = _handlingNotes.Count - 1; j >= 0; --j) + { + var handlingNote = _handlingNotes[j]; + handlingNote.Move(distance); + handlingNote.MoveInputMillis(millisLoopUnit, this); + var targetInput = handlingNote.TargetInput; + var longWait = handlingNote.LongWait; + var wait = handlingNote.Wait; + var hasStand = handlingNote.HasStand; + if (HandleAutoJudged(handlingNote)) + { + WipeNote(handlingNote, false); + } + else + { + if (longWait > 0.0 && wait + longWait >= LoopingCounter && handlingNote.Judged != Component.Judged.Not && !handlingNote.IsFailed) + { + if (longNoteHitFrame > 0) + { + if (IsSuitableAsHitLongNotePaint(targetInput, longNoteHitLoopFrame, longNoteHitFramerate)) + { + lock (HitLongNotePaints) + { + HitLongNotePaints[-targetInput] = new(this, targetInput, longNoteHitFrame, longNoteHitFramerate); + } + } + if (IsSuitableAsEnlargedLastBandPaint(targetInput, lastEnlargedBandLoopFrame, longNoteHitFramerate)) + { + _paintEnlargedLastBand = true; + } + + bool IsSuitableAsHitLongNotePaint(int input, int longNoteHitLoopFrame, double longNoteHitFramerate) + { + _hitLongNotePaintMillis[input] += millisLoopUnit; + var longNoteHitLoopFramerate = 1000.0 * longNoteHitLoopFrame / longNoteHitFramerate; + if (_hitLongNotePaintMillis[input] >= longNoteHitLoopFramerate) + { + _hitLongNotePaintMillis[input] -= longNoteHitLoopFramerate; + return true; + } + return false; + } + + bool IsSuitableAsEnlargedLastBandPaint(int input, int lastEnlargedBandLoopFrame, double longNoteHitFramerate) + { + _lastEnlargedBandPaintMillis[input] += millisLoopUnit; + var lastEnlargedBandLoopFramerate = 1000.0 * lastEnlargedBandLoopFrame / longNoteHitFramerate; + if (_lastEnlargedBandPaintMillis[input] >= lastEnlargedBandLoopFramerate) + { + _lastEnlargedBandPaintMillis[input] -= lastEnlargedBandLoopFramerate; + return true; + } + return false; + } + } + var isIn2P = IsIn2P[targetInput]; + var paintID = isIn2P ? 1 : 0; + if (judgmentFrame > 0 && IsSuitableAsInput(targetInput) && !JudgmentPaints.ContainsKey(paintID)) + { + lock (JudgmentPaints) + { + JudgmentPaints[paintID] = new(this, handlingNote.Judged, isIn2P, judgmentSystem, judgmentPosition0, judgmentPosition1, judgmentFrame, judgmentFramerate, judgmentLength, judgmentHeight); + } + } + } + if (hasStand && (IsInEvents || IsPowered)) + { + if (handlingNote.IsFailedAsTooLate(LoopingCounter, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate) && handlingNote.Judged == Component.Judged.Not) + { + SetNoteJudged(handlingNote, Component.Judged.Lowest); + if (longWait > 0.0) + { + _validJudgedNotes += 2; + SetNoteFailed(handlingNote, true); + } + else + { + ++_validJudgedNotes; + WipeNote(handlingNote, false); + } + OnNoteJudged(handlingNote); + } + if (handlingNote.Judged != Component.Judged.Not && handlingNote.IsTooLong(LoopingCounter, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate)) + { + var isAutoLongNote = (IsAutoLongNote && ModeComponentValue.LongNoteModeValue != ModeComponent.LongNoteMode.Input) || ModeComponentValue.LongNoteModeValue == ModeComponent.LongNoteMode.Auto; + if (!handlingNote.IsFailed) + { + if (isAutoLongNote) + { + switch (LongNoteModeDate) + { + case Component.LongNoteMode1164: + SetNoteJudged(handlingNote, handlingNote.Judged); + OnNoteJudged(handlingNote); + break; + } + } + else + { + switch (_tooLongLongNoteDate) + { + case Component.TooLongLongNote100: + case Component.TooLongLongNote11420: + SetNoteJudged(handlingNote, Component.Judged.Lowest); + break; + case Component.TooLongLongNote113107: + case Component.TooLongLongNote11429: + SetNoteJudged(handlingNote, Component.Judged.Lower); + break; + } + OnNoteJudged(handlingNote); + } + ++_validJudgedNotes; + } + WipeNote(handlingNote, isAutoLongNote); + } + if (IsSuitableAsAutoJudge(targetInput) && !handlingNote.IsFailed) + { + var targetWait = wait; + if (ModeComponentValue.JudgmentModeValue == ModeComponent.JudgmentMode.Favor) + { + targetWait += (ModeComponentValue.FavorJudgments[(int)Component.Judged.Highest][0] + ModeComponentValue.FavorJudgments[(int)Component.Judged.Highest][1]) / 2; + } + if (targetWait <= LoopingCounter && handlingNote.Judged == Component.Judged.Not) + { + HandleInput(targetInput); + } + if (targetWait + longWait <= LoopingCounter) + { + HandleInput(-targetInput); + } + } + } + } + + bool HandleAutoJudged(BaseNote note) + { + switch (note.AutoJudge(LoopingCounter)?.IDValue) + { + case JudgedNoteData.ID.Not: + return true; + case JudgedNoteData.ID.HandleVoid: + SetIIDXInputAudioVariety(note); + return true; + case JudgedNoteData.ID.HandleMeter: + _millisMeter = _millisStandardMeter; + return true; + default: + return false; + } + } + } + + HandleComment(ref commentInputID, ref commentMultiplierID, ref commentAudioMultiplierID); + + while (_rawInputQueue.TryDequeue(out var rawInput)) + { + var input = rawInput.Item1; + var inputPower = rawInput.Item2; + var isInput = input > 0; + var absInput = Math.Abs(input); + if (isInput) + { + IlluminationSystem.Instance.InputValues[absInput] = 1.0; + } + IlluminationSystem.Instance.HasInputValues[absInput] = isInput; + if (input > 0) + { + switch (UI.Instance.LoopingMain) + { + case 0: + case 1: + _targetMainFrames[absInput] = mainFrame; + break; + case 2: + MainFrames[absInput] = 0; + _targetMainFrames[absInput] = 0; + break; + } + switch (UI.Instance.LoopingInput) + { + case 0: + case 1: + _targetInputFrames[absInput] = inputFrame; + break; + case 2: + InputFrames[absInput] = 0; + _targetInputFrames[absInput] = 0; + break; + } + } + else + { + switch (UI.Instance.LoopingMain) + { + case 0: + _targetMainFrames[absInput] = 0; + break; + case 1: + MainFrames[absInput] = 0; + _targetMainFrames[absInput] = 0; + break; + case 2: + _targetMainFrames[absInput] = mainFrame; + break; + } + switch (UI.Instance.LoopingInput) + { + case 0: + _targetInputFrames[absInput] = 0; + break; + case 1: + InputFrames[absInput] = 0; + _targetInputFrames[absInput] = 0; + break; + case 2: + _targetInputFrames[absInput] = inputFrame; + break; + } + } + if (IsSuitableAsInput(absInput) && handledNotYet) + { + Comment.Inputs.Add(new InputEvent + { + Input = input, + Wait = LoopingCounter + }); + } + SendIOInput(input, inputPower); + + var wasHandled = false; + foreach (var handlingNote in _handlingNotes) + { + if (handlingNote.TargetInput == absInput && !handlingNote.IsFailed && handlingNote.HasStand && (!isInput || handlingNote.Judged == Component.Judged.Not)) + { + var judgedNoteData = handlingNote.Judge(input, LoopingCounter, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, _trapNoteJudgmentDate, IsAutoLongNote); + if (judgedNoteData.HasValue) + { + if (isInput) + { + HandleInputAudio(handlingNote); + } + if (judgedNoteData.Value.IDValue != JudgedNoteData.ID.AutoLongNoteJudgment || !IsAutoLongNote) + { + InputCountQueue.Enqueue(LoopingCounter); + } + HandleJudged(handlingNote, judgedNoteData, LoopingCounter); + } + else + { + break; + } + wasHandled = true; + break; + } + } + if (!wasHandled) + { + foreach (var handlingNote in _handlingNotes) + { + if (handlingNote.TargetInput == absInput && !handlingNote.IsFailed && !handlingNote.HasStand) + { + var judgedNoteData = handlingNote.Judge(input, LoopingCounter, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, _trapNoteJudgmentDate, IsAutoLongNote); + if (judgedNoteData.HasValue) + { + HandleJudged(handlingNote, judgedNoteData, LoopingCounter); + wasHandled = true; + break; + } + } + } + } + if (!wasHandled && isInput && ModeComponentValue.LowestJudgmentConditionModeValue == ModeComponent.LowestJudgmentConditionMode.Wrong) + { + SetJudgedValue(Component.Judged.Lowest, IsIn2P[absInput], null); + wasHandled = true; + } + if (!wasHandled && isInput) + { + switch (InputAudioVarietyValue) + { + case Configure.InputAudioVariety.DJMAX: + foreach (var handlingNote in _handlingNotes) + { + if (handlingNote.TargetInput == absInput && !handlingNote.IsFailed) + { + HandleInputAudio(handlingNote); + break; + } + } + break; + case Configure.InputAudioVariety.IIDX when Configure.Instance.HandleInputAudio: + foreach (var audioNote in _lastIIDXInputAudioNoteMap[absInput]) + { + var audioItem = audioNote.AudioItem; + if (audioItem.HasValue) + { + var audioItemValue = audioItem.Value; + var lastEventPosition = IsInEvents ? _eventPositions.Last() : LoopingCounter; + if (lastEventPosition < LoopingCounter + audioItemValue.Length) + { + var bmsID = audioItemValue.BMSID; + StopLastEqualAudioItem(bmsID); + lock (ContentsCSX) + { + if (HasContents) + { + var audioChannel = AudioSystem.Instance.Handle(new() + { + AudioItem = audioItem, + Length = audioNote.Length, + AudioLevyingPosition = (uint)(audioNote.AudioLevyingPosition + lastEventPosition - LoopingCounter), + Salt = audioNote.Salt + }, AudioSystem.InputAudio, AudioMultiplier, IsCounterWave, this, 0.0, inputPower); + if (!string.IsNullOrEmpty(bmsID)) + { + audioChannelMap[bmsID] = audioChannel; + } + } + } + } + } + } + HandleStandardInputAudio(); + break; + } + } + + void HandleInputAudio(BaseNote note) + { + if (Configure.Instance.HandleInputAudio) + { + foreach (var audioNote in note.AudioNotes) + { + var audioItem = audioNote.AudioItem; + if (audioItem.HasValue) + { + var audioItemValue = audioItem.Value; + var lastEventPosition = IsInEvents ? _eventPositions.Last() : LoopingCounter; + if (lastEventPosition < LoopingCounter + (audioNote.Length ?? audioItemValue.Length)) + { + var bmsID = audioItemValue.BMSID; + StopLastEqualAudioItem(bmsID); + lock (ContentsCSX) + { + if (HasContents) + { + var audioChannel = AudioSystem.Instance.Handle(new() + { + AudioItem = audioItem, + Length = audioNote.Length, + AudioLevyingPosition = (uint)(audioNote.AudioLevyingPosition + lastEventPosition - LoopingCounter), + Salt = audioNote.Salt + }, AudioSystem.InputAudio, AudioMultiplier, IsCounterWave, this, 0.0, inputPower); + note.AudioChannels.Add(audioChannel); + if (!string.IsNullOrEmpty(bmsID)) + { + audioChannelMap[bmsID] = audioChannel; + } + } + } + } + } + } + HandleStandardInputAudio(); + } + } + + void HandleStandardInputAudio() + { + if (Configure.Instance.BanalAudio && AudioSystem.Instance.BanalAudio.HasValue) + { + var audioItemValue = AudioSystem.Instance.BanalAudio.Value; + var lastEventPosition = IsInEvents ? _eventPositions.Last() : LoopingCounter; + if (lastEventPosition < LoopingCounter + audioItemValue.Length) + { + StopLastEqualAudioItem(string.Empty); + audioChannelMap[string.Empty] = AudioSystem.Instance.Handle(new() + { + AudioItem = AudioSystem.Instance.BanalAudio + }, AudioSystem.InputAudio, AudioMultiplier, IsCounterWave, this, 0.0, inputPower); + } + } + } + } + + if (HitPoints.TargetValue == 0.0) + { + if (CanGAS) + { + switch (ModeComponentValue.HandlingHitPointsModeValue) + { + case ModeComponent.HitPointsMode.Highest: + ModeComponentValue.HandlingHitPointsModeValue = ModeComponent.HitPointsMode.Higher; + break; + case ModeComponent.HitPointsMode.Higher: + ModeComponentValue.HandlingHitPointsModeValue = ModeComponent.HitPointsMode.Default; + break; + } + HitPoints.TargetValue = _hitPointsGAS[(int)ModeComponentValue.HandlingHitPointsModeValue]; + Comment.Paints.Clear(); + var paintEventsGAS = _paintEventsGAS[(int)ModeComponentValue.HandlingHitPointsModeValue]; + Comment.Paints.AddRange(paintEventsGAS); + paintEventsGAS.Clear(); + } + else + { + OnGetF(); + } + } + if (LastStatusValue == LastStatus.Not && ValidatedTotalNotes > 0 && ValidatedTotalNotes == _validJudgedNotes) + { + _lastStatus = Comment.LowestJudgment > 0 ? LastStatus.Last : LastStatus.Band1; + } + WwwLevelDataValue?.SetSatisify(this); + + void HandleJudged(BaseNote judgedNote, JudgedNoteData? judgedNoteData, double loopingCounter) + { + if ((IsInEvents || IsPowered) && judgedNoteData.HasValue) + { + var judgedNoteDataValue = judgedNoteData.Value; + var targetInput = judgedNote.TargetInput; + var judged = judgedNoteDataValue.Judged; + if (judged != Component.Judged.Lowest && PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.PositiveJudgment]].IsHandling) + { + judged = Component.Judged.Highest; + } + if (judged != Component.Judged.Highest && judged != Component.Judged.Higher && PostableItemStatusMap[PostableItem.Values[(int)PostableItem.Variety.NegativeJudgment]].IsHandling) + { + judged = Component.Judged.Lowest; + } + switch (judgedNoteDataValue.IDValue) + { + case JudgedNoteData.ID.NoteJudgment: + SetNoteJudged(judgedNote, judged); + WipeNote(judgedNote, false); + if (IsSuitableAsInput(targetInput)) + { + SetJudgmentMeter(loopingCounter, targetInput, (int)judgedNoteDataValue.JudgmentMeter, Component.JudgmentAssist.Default); + } + OnNoteJudged(judgedNote); + ++_validJudgedNotes; + break; + case JudgedNoteData.ID.TrapNoteJudgment: + SetNoteJudged(judgedNote, judged); + WipeNote(judgedNote, false); + OnNoteJudged(judgedNote); + break; + case JudgedNoteData.ID.QuitLongNoteJudgment: + HandleQuitLongNoteJudgment(); + break; + case JudgedNoteData.ID.LevyLongNoteJudgment: + if (judged == Component.Judged.Lowest) + { + SetNoteFailed(judgedNote, true); + _validJudgedNotes += 2; + } + else + { + ++_validJudgedNotes; + } + SetNoteJudged(judgedNote, judged); + if (IsSuitableAsInput(targetInput)) + { + SetJudgmentMeter(loopingCounter, targetInput, (int)judgedNoteDataValue.JudgmentMeter, Component.JudgmentAssist.Default); + } + OnNoteJudged(judgedNote); + break; + case JudgedNoteData.ID.AutoLongNoteJudgment: + if (IsLongNoteStand1) + { + WipeNote(judgedNote, false); + ++_validJudgedNotes; + } + else + { + HandleQuitLongNoteJudgment(); + } + break; + case JudgedNoteData.ID.FailedLongNoteJudgment: + SetNoteFailed(judgedNote, false); + SetNoteJudged(judgedNote, Component.Judged.Lowest); + OnNoteJudged(judgedNote); + ++_validJudgedNotes; + break; + } + + void HandleQuitLongNoteJudgment() + { + SetNoteJudged(judgedNote, judged); + WipeNote(judgedNote, false); + if (!IsAutoLongNote && IsSuitableAsInput(targetInput)) + { + SetJudgmentMeter(loopingCounter, targetInput, (int)judgedNoteDataValue.JudgmentMeter, Component.JudgmentAssist.LongNoteUp); + } + OnNoteJudged(judgedNote); + ++_validJudgedNotes; + } + } + } + + void SetJudgmentMeter(double loopingCounter, int input, double judgmentMeter, Component.JudgmentAssist judgmentAssist) + { + var judgmentMeterPosition = IsIn2P[input] ? 1 : 0; + judgmentMeters[judgmentMeterPosition].Millis = judgmentMeter; + judgmentMeters[judgmentMeterPosition].Judged = Component.GetJudged(judgmentMeter, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, judgmentAssist); + areValidJudgmentMeters[judgmentMeterPosition] = true; + + judgmentMeters[2] = judgmentMeters[judgmentMeterPosition]; + areValidJudgmentMeters[2] = true; + + Comment.JudgmentMeters.Add(new JudgmentMeterEvent + { + JudgmentMeter = judgmentMeter, + Wait = loopingCounter - judgmentMeter, + Assist = (int)judgmentAssist + }); + + if (Math.Abs(judgmentMeter) >= Configure.Instance.JudgmentMeterMillis) + { + if (judgmentMeter > 0.0) + { + ++LateValue; + MainJudgmentMeterFrames[input] = DrawingComponentValue.mainJudgmentMeterFrame; + } + else if (judgmentMeter < 0.0) + { + ++EarlyValue; + MainJudgmentMeterFrames[input] = -DrawingComponentValue.mainJudgmentMeterFrame; + } + _noteWaits.Add(judgmentMeter); + } + if (!IsInEvents) + { + SendIOJudgmentMeter(input, judgmentMeter, judgmentAssist); + } + } + + void WipeNote(BaseNote note, bool setValidJudgedNotes) + { + _handlingNotes.Remove(note); + lock (PaintedNotes) + { + PaintedNotes.Remove(note); + } + note.IsWiped = true; + if (note.HasStand) + { + SendIONoteVisibility(note, setValidJudgedNotes, false); + } + } + } + + if (!IsInEvents) + { + switch (DrawingComponentValue.altJudgmentMeter) + { + case 0 when areValidJudgmentMeters[2]: + JudgmentMeters[0] = judgmentMeters[2].Millis; + break; + case 3 when areValidJudgmentMeters[2]: + JudgmentMeters[1] = judgmentMeters[2].Millis; + break; + case 2: + if (areValidJudgmentMeters[0]) + { + JudgmentMeters[0] = judgmentMeters[0].Millis; + } + if (areValidJudgmentMeters[1]) + { + JudgmentMeters[1] = judgmentMeters[1].Millis; + } + break; + } + switch (DrawingComponentValue.altJudgmentVisualizer) + { + case 2: + if (areValidJudgmentMeters[0]) + { + var judgmentMeter = judgmentMeters[0]; + var judgmentVisualizerValues = JudgmentVisualizerValues[0]; + lock (judgmentVisualizerValues) + { + judgmentVisualizerValues.Enqueue(new(Math.Clamp(0.5 + (judgmentMeter.Millis < 0.0 ? judgmentMeter.Millis / -LowestJudgmentMillis : judgmentMeter.Millis / HighestJudgmentMillis) / 2, 0.0, 1.0), judgmentMeter.Judged)); + } + } + if (areValidJudgmentMeters[1]) + { + var judgmentMeter = judgmentMeters[1]; + var judgmentVisualizerValues = JudgmentVisualizerValues[1]; + lock (judgmentVisualizerValues) + { + judgmentVisualizerValues.Enqueue(new(Math.Clamp(0.5 + (judgmentMeter.Millis < 0.0 ? judgmentMeter.Millis / -LowestJudgmentMillis : judgmentMeter.Millis / HighestJudgmentMillis) / 2, 0.0, 1.0), judgmentMeter.Judged)); + } + } + break; + case 0: + if (areValidJudgmentMeters[2]) + { + var judgmentMeter = judgmentMeters[2]; + var judgmentVisualizerValues = JudgmentVisualizerValues[0]; + lock (judgmentVisualizerValues) + { + judgmentVisualizerValues.Enqueue(new(Math.Clamp(0.5 + (judgmentMeter.Millis < 0.0 ? judgmentMeter.Millis / -LowestJudgmentMillis : judgmentMeter.Millis / HighestJudgmentMillis) / 2, 0.0, 1.0), judgmentMeter.Judged)); + } + } + break; + case 3: + if (areValidJudgmentMeters[2]) + { + var judgmentMeter = judgmentMeters[2]; + var judgmentVisualizerValues = JudgmentVisualizerValues[1]; + lock (judgmentVisualizerValues) + { + judgmentVisualizerValues.Enqueue(new(Math.Clamp(0.5 + (judgmentMeter.Millis < 0.0 ? judgmentMeter.Millis / -LowestJudgmentMillis : judgmentMeter.Millis / HighestJudgmentMillis) / 2, 0.0, 1.0), judgmentMeter.Judged)); + } + } + break; + } + Array.Fill(areValidJudgmentMeters, false); + + var noteFrame = DrawingComponentValue.noteFrame; + if (noteFrame > 0) + { + var noteFramerate = 1000.0 / DrawingComponentValue.noteFramerate; + _noteMillis += millisLoopUnit; + while (_noteMillis >= noteFramerate) + { + _noteMillis -= noteFramerate; + NoteFrame = (NoteFrame + 1) % noteFrame; + } + } + + var pauseFrame = DrawingComponentValue.pauseFrame; + var pauseCount = PauseCount; + if (pauseFrame > 0 && pauseCount > 0) + { + PauseFrames[pauseCount - 1] = pauseFrame - (int)Math.Ceiling((_pauseMillis - (1000.0 * (pauseCount - 1))) / (1000.0 / pauseFrame)); + } + + _mainMillis += millisLoopUnit; + var mainFramerate = 1000.0 / DrawingComponentValue.mainFramerate; + while (_mainMillis >= mainFramerate) + { + _mainMillis -= mainFramerate; + for (var i = inputCount; i > 0; --i) + { + MainFrames[i] += Math.Sign(_targetMainFrames[i] - MainFrames[i]); + } + } + + _inputMillis += millisLoopUnit; + var inputFramerate = 1000.0 / DrawingComponentValue.inputFramerate; + while (_inputMillis >= inputFramerate) + { + _inputMillis -= inputFramerate; + for (var i = inputCount; i > 0; --i) + { + InputFrames[i] += Math.Sign(_targetInputFrames[i] - InputFrames[i]); + } + } + + var levelFrame = DrawingComponentValue.levelFrame; + if (levelFrame > 0) + { + var levelFramerate = 1000.0 / DrawingComponentValue.levelFramerate; + _levelMillis += millisLoopUnit; + while (_levelMillis >= levelFramerate) + { + _levelMillis -= levelFramerate; + LevelFrame = (LevelFrame + 1) % levelFrame; + } + } + + var autoMainFrame = DrawingComponentValue.autoMainFrame; + if (autoMainFrame > 0) + { + var autoMainFramerate = 1000.0 / DrawingComponentValue.autoMainFramerate; + _autoMainMillis += millisLoopUnit; + while (_autoMainMillis >= autoMainFramerate) + { + _autoMainMillis -= autoMainFramerate; + AutoMainFrame = (AutoMainFrame + 1) % autoMainFrame; + } + } + + _judgmentMainPaintMillis += millisLoopUnit; + var judgmentMainFramerate = 1000.0 / DrawingComponentValue.judgmentMainFramerate; + while (_judgmentMainPaintMillis >= judgmentMainFramerate) + { + _judgmentMainPaintMillis -= judgmentMainFramerate; + for (var i = inputCount; i > 0; --i) + { + if (JudgmentMainFrames[i] > 0) + { + --JudgmentMainFrames[i]; + } + } + } + + _mainJudgmentMeterPaintMillis += millisLoopUnit; + var mainJudgmentMeterFramerate = 1000.0 / DrawingComponentValue.mainJudgmentMeterFramerate; + while (_mainJudgmentMeterPaintMillis >= mainJudgmentMeterFramerate) + { + _mainJudgmentMeterPaintMillis -= mainJudgmentMeterFramerate; + for (var i = inputCount; i > 0; --i) + { + MainJudgmentMeterFrames[i] += Math.Sign(-MainJudgmentMeterFrames[i]); + } + } + + lock (DrawingComponentValue.PaintPropertyCSX) + { + foreach (var paintPropertyID in DrawingComponentValue.PaintPropertyIDs) + { + var paintPropertyIntMap = DrawingComponentValue.PaintPropertyIntMap[paintPropertyID]; + var paintFramerate = 1000.0 / DrawingComponentValue.PaintPropertyValueMap[paintPropertyID][PaintProperty.ID.Framerate]; + _paintPropertyMillis[paintPropertyID] += millisLoopUnit; + while (_paintPropertyMillis[paintPropertyID] >= paintFramerate) + { + _paintPropertyMillis[paintPropertyID] -= paintFramerate; + switch (paintPropertyIntMap[PaintProperty.ID.Mode]) + { + case 0: + if (PaintPropertyFrames[paintPropertyID] + 1 < paintPropertyIntMap[PaintProperty.ID.Frame]) + { + ++PaintPropertyFrames[paintPropertyID]; + } + else + { + PaintPropertyFrames[paintPropertyID] = 0; + } + break; + case 1: + if (PaintPropertyFrames[paintPropertyID] > 0) + { + --PaintPropertyFrames[paintPropertyID]; + } + break; + case 2: + if (PaintPropertyFrames[paintPropertyID] + 1 < paintPropertyIntMap[PaintProperty.ID.Frame]) + { + ++PaintPropertyFrames[paintPropertyID]; + } + break; + } + } + } + } + + var band = Band.Value; + if (band > 0) + { + var bandFrame = DrawingComponentValue.bandFrame; + if (bandFrame > 0) + { + var enlargeBand = DrawingComponentValue.enlargeBand; + var digit = QwilightComponent.GetDigit(band) - 1; + for (var i = digit; i >= 0; --i) + { + var j = (int)Math.Pow(10, i); + if ((i == 0 && _paintEnlargedLastBand) || (_lastPaintedBand / j % 10 != band / j % 10)) + { + BandDrawingFrames[i] = bandFrame - 1; + BandEnlargedMap[i] = enlargeBand; + _paintEnlargedLastBand = false; + } + } + _lastPaintedBand = band; + _bandPaintMillis += millisLoopUnit; + var bandFramerate = 1000.0 / DrawingComponentValue.bandFramerate; + var unlargeBand = DrawingComponentValue.enlargeBand / DrawingComponentValue.bandFrame; + while (_bandPaintMillis >= bandFramerate) + { + _bandPaintMillis -= bandFramerate; + for (var i = digit; i >= 0; --i) + { + if (BandDrawingFrames.TryGetValue(i, out var bandDrawingFrame) && bandDrawingFrame > 0) + { + --BandDrawingFrames[i]; + } + if (BandEnlargedMap.TryGetValue(i, out var bandEnlarged) && bandEnlarged > 0) + { + BandEnlargedMap[i] -= unlargeBand; + } + } + } + } + } + + lock (JudgmentPaints) + { + foreach (var (paintID, judgmentPaint) in JudgmentPaints) + { + if (judgmentPaint.IsPaintAsToo(millisLoopUnit)) + { + JudgmentPaints.Remove(paintID); + } + } + } + lock (HitNotePaints) + { + foreach (var (paintID, hitNotePaint) in HitNotePaints) + { + if (hitNotePaint.IsPaintAsToo(millisLoopUnit)) + { + HitNotePaints.Remove(paintID); + } + } + } + lock (HitLongNotePaints) + { + foreach (var (paintID, hitLongNotePaint) in HitLongNotePaints) + { + if (hitLongNotePaint.IsPaintAsToo(millisLoopUnit)) + { + HitLongNotePaints.Remove(paintID); + } + } + } + + foreach (var netItem in NetItems) + { + netItem.IsFailedStatus = Math.Clamp(netItem.IsFailedStatus + Utility.GetMove(0.0, netItem.IsFailedStatus, 60.0 / millisLoopUnit), 0.0, 1.0); + if (Configure.Instance.FlowNetItem) + { + netItem.DrawingPosition += Utility.GetMove(netItem.TargetPosition, netItem.DrawingPosition, 60.0 / millisLoopUnit); + } + else + { + netItem.DrawingPosition = netItem.TargetPosition; + } + } + Band.Value += Utility.GetMove(Band.TargetValue, Band.Value, 60.0 / millisLoopUnit); + Stand.Value += Utility.GetMove(Stand.TargetValue, Stand.Value, 60.0 / millisLoopUnit); + HitPoints.Value = Math.Clamp(HitPoints.Value + Utility.GetMove(HitPoints.TargetValue, HitPoints.Value, 60.0 / millisLoopUnit), 0.0, 1.0); + Point.Value = Math.Clamp(Point.Value + Utility.GetMove(Point.TargetValue, Point.Value, 60.0 / millisLoopUnit), 0.0, 1.0); + Hunter.Value = Hunter.TargetValue.HasValue ? (Hunter.Value ?? 0) + Utility.GetMove(Hunter.TargetValue.Value, Hunter.Value ?? 0, 60.0 / millisLoopUnit) : null; + for (var i = PostableItemFaints.Length - 1; i >= 0; --i) + { + PostableItemFaints[i].Value = Math.Clamp(PostableItemFaints[i].Value + Utility.GetMove(PostableItemFaints[i].TargetValue, PostableItemFaints[i].Value, 60.0 / millisLoopUnit), 0.0, 1.0); + } + + foreach (var judgmentVisualizerValues in JudgmentVisualizerValues) + { + lock (judgmentVisualizerValues) + { + foreach (var judgmentVisualizerValue in judgmentVisualizerValues) + { + judgmentVisualizerValue.LoopingCounter -= millisLoopUnit; + } + while (judgmentVisualizerValues.TryPeek(out var judgmentVisualizerValue) && judgmentVisualizerValue.LoopingCounter <= 0.0) + { + judgmentVisualizerValues.Dequeue(); + } + } + } + + var targetLoopingCounter = LoopingCounter - 1000.0 * AudioMultiplier; + while (InputCountQueue.TryPeek(out var loopingCounter) && loopingCounter <= targetLoopingCounter) + { + InputCountQueue.TryDequeue(out _); + } + + atLoopingCounter1000 += millisLoopUnit; + if (atLoopingCounter1000 >= 1000.0) + { + + atLoopingCounter1000 %= 1000.0; + MediaSystem.Instance.SetMediaPosition(this); + if (WaitingTwilightLevel == WaitingTwilight.CallIO) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallIo, new + { + avatarID = AvatarID, + handlerID = HandlerID, + ioMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }); + } + } + + _millisMeter += millisLoopUnit; + if (_millisMeter >= _millisStandardMeter) + { + _millisMeter %= _millisStandardMeter; + if (Configure.Instance.HandleMeter) + { + IlluminationSystem.Instance.IsMeter = true; + Array.Fill(JudgmentMainFrames, DrawingComponentValue.judgmentMainFrame); + lock (DrawingComponentValue.PaintPropertyCSX) + { + foreach (var paintPropertyID in DrawingComponentValue.PaintPropertyIDs) + { + var paintPropertyIntMap = DrawingComponentValue.PaintPropertyIntMap[paintPropertyID]; + if (paintPropertyIntMap[PaintProperty.ID.Mode] == 1) + { + PaintPropertyFrames[paintPropertyID] = paintPropertyIntMap[PaintProperty.ID.Frame]; + } + } + } + } + } + + if (NetItems.Count > 1) + { + var hunterVariety = Configure.Instance.HunterVarietyV2Value.Mode; + if (hunterVariety == HunterVariety.HunterVarietyMe) + { + var hasNotMe = true; + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem && netItem.AvatarID == AvatarID) + { + hasNotMe = false; + break; + } + } + if (hasNotMe) + { + hunterVariety = HunterVariety.HunterVarietyHigher; + } + } + switch (hunterVariety) + { + case HunterVariety.HunterVariety1st: + var value1st = int.MinValue; + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem) + { + value1st = Math.Max(value1st, netItem.StandValue); + } + } + Hunter.TargetValue = Stand.TargetValue - value1st; + break; + case HunterVariety.HunterVarietyHigher: + var valueLowest = int.MaxValue; + var valueHighest = int.MinValue; + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem && netItem.StandValue >= Stand.TargetValue) + { + valueLowest = Math.Min(valueLowest, netItem.StandValue); + } + } + if (valueLowest != int.MaxValue) + { + Hunter.TargetValue = Stand.TargetValue - valueLowest; + } + else + { + valueHighest = int.MinValue; + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem) + { + valueHighest = Math.Max(valueHighest, netItem.StandValue); + } + } + Hunter.TargetValue = Stand.TargetValue - valueHighest; + } + break; + case HunterVariety.HunterVarietyLower: + valueHighest = int.MinValue; + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem && netItem.StandValue <= Stand.TargetValue) + { + valueHighest = Math.Max(valueHighest, netItem.StandValue); + } + } + if (valueHighest != int.MinValue) + { + Hunter.TargetValue = Stand.TargetValue - valueHighest; + } + else + { + valueLowest = int.MaxValue; + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem) + { + valueLowest = Math.Min(valueLowest, netItem.StandValue); + } + } + Hunter.TargetValue = Stand.TargetValue - valueLowest; + } + break; + case HunterVariety.HunterVarietyMe: + foreach (var netItem in NetItems) + { + if (!netItem.IsMyNetItem && netItem.AvatarID == AvatarID) + { + Hunter.TargetValue = Stand.TargetValue - netItem.StandValue; + break; + } + } + break; + case HunterVariety.HunterVarietyFavor: + foreach (var netItem in NetItems) + { + if (netItem.IsFavorNetItem) + { + Hunter.TargetValue = Stand.TargetValue - netItem.StandValue; + break; + } + } + break; + } + } + else + { + Hunter.TargetValue = null; + } + + _failedDrawingMillis = Math.Max(0.0, _failedDrawingMillis - millisLoopUnit); + + GetNetItems(); + GetNetComments(); + HandleNetItems(); + } + + if (!wasLastStatus && LastStatusValue != LastStatus.Not) + { + if (!IsF) + { + switch (LastStatusValue) + { + case LastStatus.Band1: + HandleUIAudio("Band!"); + break; + case LastStatus.Last: + HandleUIAudio("Last"); + break; + } + if (judgmentFrame > 0) + { + Component.Judged judged = 0; + var altJudgment = 0.0; + switch (LastStatusValue) + { + case LastStatus.Band1: + judged = Component.Judged.Band1; + judgmentPosition0 = DrawingComponentValue.band1Position0; + judgmentPosition1 = DrawingComponentValue.band1Position1; + judgmentSystem = DrawingComponentValue.band1System; + judgmentFrame = DrawingComponentValue.band1Frame; + judgmentFramerate = DrawingComponentValue.band1Framerate; + judgmentLength = DrawingComponentValue.band1Length; + judgmentHeight = DrawingComponentValue.band1Height; + altJudgment = DrawingComponentValue.altBand1; + HandleUIAudio("Band!"); + break; + case LastStatus.Last: + judged = Component.Judged.Last; + judgmentPosition0 = DrawingComponentValue.lastPosition0; + judgmentPosition1 = DrawingComponentValue.lastPosition1; + judgmentSystem = DrawingComponentValue.lastSystem; + judgmentFrame = DrawingComponentValue.lastFrame; + judgmentFramerate = DrawingComponentValue.lastFramerate; + judgmentLength = DrawingComponentValue.lastLength; + judgmentHeight = DrawingComponentValue.lastHeight; + altJudgment = DrawingComponentValue.altLast; + HandleUIAudio("Last"); + break; + } + if (!Has2P || altJudgment != 3) + { + lock (JudgmentPaints) + { + JudgmentPaints[2] = new(this, judged, false, judgmentSystem, judgmentPosition0, judgmentPosition1, judgmentFrame, judgmentFramerate, judgmentLength, judgmentHeight); + } + } + if (Has2P && altJudgment != 0) + { + lock (JudgmentPaints) + { + JudgmentPaints[3] = new(this, judged, true, judgmentSystem, judgmentPosition0, judgmentPosition1, judgmentFrame, judgmentFramerate, judgmentLength, judgmentHeight); + } + } + } + } + wasLastStatus = true; + } + + while (MultiplierQueue.TryDequeue(out var multiplier)) + { + if (double.IsInfinity(multiplier)) + { + if (multiplier > 0.0 ? ModeComponentValue.HigherMultiplier() : ModeComponentValue.LowerMultiplier()) + { + HandleUIAudio("Multiplier"); + } + } + else + { + if (ModeComponentValue.CanModifyMultiplier) + { + ModeComponentValue.MultiplierValue = multiplier; + } + else + { + ModeComponentValue.SentMultiplier = multiplier; + } + } + } + if (lastMultiplier != ModeComponentValue.Multiplier) + { + if (handledNotYet) + { + Comment.Multipliers.Add(new MultiplierEvent + { + Multiplier = ModeComponentValue.Multiplier, + Wait = LoopingCounter, + IsAutoEvent = false + }); + } + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.IoMultiplier, + QwilightIOMultiplier = new() + { + AvatarIDs = + { + _sentIOAvatarIDs + }, + HandlerID = HandlerID, + Multiplier = ModeComponentValue.Multiplier + } + }); + } + lastMultiplier = ModeComponentValue.Multiplier; + } + while (AudioMultiplierQueue.TryDequeue(out var audioMultiplierValue)) + { + if (double.IsInfinity(audioMultiplierValue)) + { + var isHigherAudioMultiplier = audioMultiplierValue > 0.0; + if ((WwwLevelDataValue == null || (isHigherAudioMultiplier ? Math.Round(WwwLevelDataValue.HighestAudioMultiplier - 0.01, 2) >= AudioMultiplier : AudioMultiplier >= Math.Round(WwwLevelDataValue.LowestAudioMultiplier + 0.01, 2))) && (isHigherAudioMultiplier ? ModeComponentValue.HigherAudioMultiplier() : ModeComponentValue.LowerAudioMultiplier())) + { + HandleUIAudio("Audio Multiplier"); + } + } + else + { + ModeComponentValue.AudioMultiplier = audioMultiplierValue; + } + } + if (lastAudioMultiplier != AudioMultiplier) + { + if (handledNotYet) + { + Comment.AudioMultipliers.Add(new AudioMultiplierEvent + { + AudioMultiplier = AudioMultiplier, + Wait = LoopingCounter + }); + Comment.Multipliers.Add(new MultiplierEvent + { + Multiplier = ModeComponentValue.Multiplier, + Wait = LoopingCounter, + IsAutoEvent = true + }); + } + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(new() + { + EventID = Event.Types.EventID.IoAudioMultiplier, + QwilightIOAudioMultiplier = new() + { + AvatarIDs = + { + _sentIOAvatarIDs + }, + HandlerID = HandlerID, + AudioMultiplier = AudioMultiplier + } + }); + } + AudioSystem.Instance.SetAudioMultiplier(this, AudioMultiplier); + MediaSystem.Instance.SetAudioMultiplier(this); + SetStandMultiplier(); + lastAudioMultiplier = AudioMultiplier; + } + + if (!IsInEvents) + { + loopingHandlerMillis += millisLoopUnit; + var toWait = loopingHandlerMillis - _loopingHandler.GetMillis(); +#if !DEBUG + if (toWait < -5000.0) + { + SetStop = true; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.SlowLoopingContents); + } + else +#endif + if (toWait > 0.0) + { + Thread.Sleep(TimeSpan.FromMilliseconds(toWait)); + } + } + } + } + catch (ThreadInterruptedException) + { + } + catch (Exception e) + { + var (faultFilePath, _) = Utility.SetFault(FaultEntryPath, e); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, e.Message, true, string.Empty, () => Utility.OpenAs(faultFilePath)); + } + finally + { + if (SetUndo) + { + if (_sentIOAvatarIDs.Count > 0) + { + _pendingIOAvatarIDs.AddRange(_sentIOAvatarIDs); + _sentIOAvatarIDs.Clear(); + } + HandleComputer(); + } + else + { + if (_ioAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoQuit, new + { + handlerID = HandlerID, + avatarIDs = _ioAvatarIDs, + isBanned = false + }); + } + } + IsHandling = false; + } + + void SetNoteJudged(BaseNote note, Component.Judged judged) + { + note.Judged = judged; + SendIOJudge(note); + } + + void SetNoteFailed(BaseNote note, bool setValidJudgedNotes) + { + note.IsFailed = true; + foreach (var audioChannel in note.AudioChannels) + { + lock (ContentsCSX) + { + if (HasContents) + { + AudioSystem.Instance.Stop(audioChannel); + } + } + } + SendIONoteVisibility(note, setValidJudgedNotes, true); + } + + void OnNoteJudged(BaseNote judgedNote) + { + var targetInput = judgedNote.TargetInput; + if (IsSuitableAsInput(targetInput)) + { + SetJudgedValue(judgedNote.Judged, IsIn2P[targetInput], judgedNote); + SetIIDXInputAudioVariety(judgedNote); + } + if (!IsInEvents) + { + if (judgedNote.Judged != Component.Judged.Lowest) + { + if (judgedNote.LongWait > 0.0) + { + var longNoteHitFrame = DrawingComponentValue.longNoteHitFrame; + if (longNoteHitFrame > 0) + { + lock (HitLongNotePaints) + { + HitLongNotePaints[-targetInput] = new(this, targetInput, longNoteHitFrame, DrawingComponentValue.longNoteHitFramerate); + } + } + } + else + { + var noteHitFrame = DrawingComponentValue.noteHitFrame; + if (noteHitFrame > 0) + { + lock (HitNotePaints) + { + HitNotePaints[targetInput] = new(this, targetInput, noteHitFrame, DrawingComponentValue.noteHitFramerate); + } + } + } + } + } + } + + void SetJudgedValue(Component.Judged judged, bool isIn2P, BaseNote note) + { + var isLowestJudgment = judged == Component.Judged.Lowest; + _failedDrawingMillis = isLowestJudgment ? Configure.Instance.FailedDrawingMillis : 0.0; + if (isLowestJudgment) + { + if (!IsInEvents) + { + if (note is TrapNote) + { + if (note.AudioNotes.Count > 0) + { + foreach (var audioNote in note.AudioNotes) + { + lock (ContentsCSX) + { + if (HasContents) + { + note.AudioChannels.Add(AudioSystem.Instance.Handle(audioNote, AudioSystem.InputAudio, AudioMultiplier, IsCounterWave, this)); + } + } + } + } + else + { + HandleUIAudio("Trap"); + } + if (Configure.Instance.VibrationModeValue == ControllerSystem.VibrationMode.Failed) + { + ControllerSystem.Instance.Vibrate(); + } + } + else if (Band.TargetValue >= Configure.Instance.HandleFailedAudioCount && HandleFailedAudio) + { + HandleUIAudio("Failed"); + if (Configure.Instance.VibrationModeValue == ControllerSystem.VibrationMode.Failed) + { + ControllerSystem.Instance.Vibrate(); + } + } + } + Band.TargetValue = 0; + HasFailedJudgment = true; + ++Comment.LowestJudgment; + OnFailed(); + } + else + { + HighestBand = Math.Max(++Band.TargetValue, HighestBand); + switch (judged) + { + case Component.Judged.Highest: + ++Comment.HighestJudgment; + break; + case Component.Judged.Higher: + ++Comment.HigherJudgment; + break; + case Component.Judged.High: + ++Comment.HighJudgment; + break; + case Component.Judged.Low: + ++Comment.LowJudgment; + break; + case Component.Judged.Lower: + ++Comment.LowerJudgment; + break; + case Component.Judged.Lowest: + break; + } + if (!IsF && (Component.Judged.Highest <= judged || judged <= Component.Judged.Low) && note.PostableItemValue != null) + { + var postableItemsLength = PostableItems.Length; + for (var i = 0; i < postableItemsLength; ++i) + { + if (PostableItems[i] == null) + { + PostableItems[i] = note.PostableItemValue; + LastPostableItems[i] = note.PostableItemValue; + PostableItemFaints[i].TargetValue = 1.0; + AudioSystem.Instance.Handle(new() + { + AudioItem = AudioSystem.Instance.PostableItemAudio + }, AudioSystem.SEAudio); + break; + } + } + } + } + LastJudged = judged; + Point.TargetValue = (SavedPoint += Component.PointMap[_pointDate, (int)judged]) / (TotalPoint += Component.PointMap[_pointDate, (int)Component.Judged.Highest]); + switch (_standModeDate) + { + case Component.StandMode100: + Stand.TargetValue = LastStand + (int)(1000000 * (SavedStand += _standMultiplier * Point.TargetValue * Component.StandMap[_standMapDate, (int)judged]) / (TotalNotes * Component.StandMap[_standMapDate, (int)Component.Judged.Highest])); + break; + case Component.StandMode167: + Stand.TargetValue = LastStand + (int)(1000000 * (SavedStand += _standMultiplier * (HasFailedJudgment ? Point.TargetValue : 1.0) * Component.StandMap[_standMapDate, (int)judged]) / (TotalNotes * Component.StandMap[_standMapDate, (int)Component.Judged.Highest])); + break; + case Component.StandMode114118: + Stand.TargetValue = LastStand + (int)(1000000 * (SavedStand += _standMultiplier * Component.StandMap[_standMapDate, (int)judged]) / (TotalNotes * Component.StandMap[_standMapDate, (int)Component.Judged.Highest])); + break; + } + if (!IsF) + { + switch (_hitPointsModeDate) + { + case Component.HitPointsMode100: + if (judged == Component.Judged.Lowest) + { + HitPoints.TargetValue -= 2.0 * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + case Component.HitPointsMode123: + if (judged == Component.Judged.Lowest) + { + HitPoints.TargetValue -= (1.5 * HitPoints.TargetValue + 0.5) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + case Component.HitPointsMode11034: + if (judged == Component.Judged.Lowest) + { + HitPoints.TargetValue -= (1.25 * HitPoints.TargetValue + 0.75) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + case Component.HitPointsMode11035: + switch (ModeComponentValue.HandlingHitPointsModeValue) + { + case ModeComponent.HitPointsMode.Favor: + HitPoints.TargetValue += HitPointsValue * ModeComponentValue.FavorHitPoints[(int)judged][0] / 100.0 + ModeComponentValue.FavorHitPoints[(int)judged][1] / 100.0; + break; + default: + if (judged == Component.Judged.Lowest) + { + HitPoints.TargetValue -= (1.5 * HitPoints.TargetValue + 0.5) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + } + break; + case Component.HitPointsMode11462: + switch (ModeComponentValue.HandlingHitPointsModeValue) + { + case ModeComponent.HitPointsMode.Favor: + HitPoints.TargetValue += HitPointsValue * ModeComponentValue.FavorHitPoints[(int)judged][0] / 100.0 + ModeComponentValue.FavorHitPoints[(int)judged][1] / 100.0; + break; + case ModeComponent.HitPointsMode.Test: + if (judged == Component.Judged.Lowest) + { + HitPoints.TargetValue -= (HitPoints.TargetValue + 1.0) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + case ModeComponent.HitPointsMode.Highest: + if (judged == Component.Judged.Lowest) + { + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] -= (1.5 * _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] + 0.5) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponent.HitPointsMode.Default, (int)judged]; + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Higher] -= (_hitPointsGAS[(int)ModeComponent.HitPointsMode.Higher] + 1.0) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponent.HitPointsMode.Higher, (int)judged]; + HitPoints.TargetValue -= 2.0 * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponent.HitPointsMode.Default, (int)judged]; + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Higher] += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponent.HitPointsMode.Higher, (int)judged]; + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + case ModeComponent.HitPointsMode.Higher: + if (judged == Component.Judged.Lowest) + { + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] -= (1.5 * _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] + 0.5) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponent.HitPointsMode.Default, (int)judged]; + HitPoints.TargetValue -= (HitPoints.TargetValue + 1.0) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponent.HitPointsMode.Default, (int)judged]; + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + default: + if (judged == Component.Judged.Lowest) + { + HitPoints.TargetValue -= (1.5 * HitPoints.TargetValue + 0.5) * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + else + { + HitPoints.TargetValue += HitPointsValue * Component.HitPointsMap[_hitPointsMapDate, (int)ModeComponentValue.HandlingHitPointsModeValue, (int)judged]; + } + break; + } + break; + } + HitPoints.TargetValue = Math.Clamp(HitPoints.TargetValue, 0.0, 1.0); + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default] = Math.Clamp(_hitPointsGAS[(int)ModeComponent.HitPointsMode.Default], 0.0, 1.0); + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Higher] = Math.Clamp(_hitPointsGAS[(int)ModeComponent.HitPointsMode.Higher], 0.0, 1.0); + _hitPointsGAS[(int)ModeComponent.HitPointsMode.Highest] = Math.Clamp(_hitPointsGAS[(int)ModeComponent.HitPointsMode.Highest], 0.0, 1.0); + + NewPaintEvent(); + } + if (!IsInEvents) + { + if (judged != Component.Judged.Not && (ViewLowestJudgment || judged != Component.Judged.Lowest)) + { + lock (JudgmentPaints) + { + JudgmentPaints[isIn2P ? 1 : 0] = new(this, judged, isIn2P, DrawingComponentValue.judgmentSystem, DrawingComponentValue.judgmentPosition0, DrawingComponentValue.judgmentPosition1, DrawingComponentValue.judgmentFrame, DrawingComponentValue.judgmentFramerate, DrawingComponentValue.judgmentLength, DrawingComponentValue.judgmentHeight); + } + } + } + + var judgmentInputPosition = (int)((note?.Wait ?? LoopingCounter) / wait100); + var judgmentInputCounts = rawJudgmentInputCounts.ElementAtOrDefault(judgmentInputPosition); + if (judgmentInputCounts != null) + { + ++judgmentInputCounts[(int)judged]; + + var totalJudgmentInputCount = judgmentInputCounts.Sum(); + if (lastJudgmentInputMaxValue < totalJudgmentInputCount) + { + lastJudgmentInputMaxValue = totalJudgmentInputCount; + for (var i = JudgmentInputValues.Length - 1; i >= 0; --i) + { + var judgmentInputValues = JudgmentInputValues[i]; + for (var j = judgmentInputValues.Length - 1; j >= 0; --j) + { + judgmentInputValues[j] = (double)(rawJudgmentInputCounts[i][j]) / lastJudgmentInputMaxValue; + } + } + } + else + { + var judgmentInputValues = JudgmentInputValues[judgmentInputPosition]; + for (var i = judgmentInputValues.Length - 1; i >= 0; --i) + { + judgmentInputValues[i] = (double)(judgmentInputCounts[i]) / lastJudgmentInputMaxValue; + } + } + } + } + + void StopLastEqualAudioItem(string bmsID) + { + if (Configure.Instance.StopLastEqualAudio && !string.IsNullOrEmpty(bmsID) && audioChannelMap.TryGetValue(bmsID, out var audioChannel)) + { + AudioSystem.Instance.Stop(audioChannel); + } + } + } + + public virtual void SendSituation() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsNoteFileMode) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)(mainViewModel.IsQuitMode ? UbuntuItem.UbuntuSituation.QuitMode : UbuntuItem.UbuntuSituation.DefaultComputing), + situationText = PlatformText + }); + } + } + + public virtual void AtQuitMode() + { + Utility.HandleUIAudio(IsF ? "F" : "Quit"); + + var date = DateTime.Now; + var eventNoteID = EventNoteEntryItem?.EventNoteID; + if (string.IsNullOrEmpty(eventNoteID)) + { + if (NoteFile.HandledValue != BaseNoteFile.Handled.Band1) + { + if (IsP) + { + NoteFile.HandledValue = BaseNoteFile.Handled.Band1; + } + else + { + if (IsF) + { + if (NoteFile.HandledValue == BaseNoteFile.Handled.Not) + { + NoteFile.HandledValue = BaseNoteFile.Handled.F; + } + } + else + { + if (ModeComponentValue.HandlingHitPointsModeValue == ModeComponent.HitPointsMode.Highest) + { + NoteFile.HandledValue = BaseNoteFile.Handled.HighestClear; + } + else if (ModeComponentValue.HandlingHitPointsModeValue == ModeComponent.HitPointsMode.Higher && NoteFile.HandledValue != BaseNoteFile.Handled.HighestClear) + { + NoteFile.HandledValue = BaseNoteFile.Handled.HigherClear; + } + else if (NoteFile.HandledValue != BaseNoteFile.Handled.HigherClear && NoteFile.HandledValue != BaseNoteFile.Handled.HighestClear) + { + NoteFile.HandledValue = BaseNoteFile.Handled.Clear; + } + } + } + } + DB.Instance.SetHandled(NoteFile); + + NoteFile.LatestDate = date; + ++NoteFile.HandledCount; + + DB.Instance.NewDate(NoteFile, default, date); + } + else + { + EventNoteEntryItem.LatestDate = date; + ++EventNoteEntryItem.HandledCount; + + DB.Instance.NewDate(default, eventNoteID, date); + } + + if (!IsF) + { + if (!ModeComponentValue.PutCopyNotesAvailable) + { + var commentID = Guid.NewGuid().ToString().Replace("-", string.Empty); + if (string.IsNullOrEmpty(eventNoteID)) + { + try + { + DB.Instance.SaveComment(date, NoteFile, string.Empty, commentID, AvatarName, TotallyLevyingMultiplier, TotallyLevyingAudioMultiplier, ModeComponentValue, Stand.TargetValue, HighestBand, IsP, Point.TargetValue, _isPaused, _inputFlags); + using var fs = File.OpenWrite(Path.Combine(QwilightComponent.CommentEntryPath, commentID)); + _comments.Single().WriteTo(fs); + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SaveCommentFailed, e.Message)); + } + if (!IsBanned && ModeComponentValue.CanBeTwilightComment && Configure.Instance.AllowTwilightComment) + { + if (TwilightSystem.Instance.IsSignedIn) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.Comment, new + { + dataID = NoteFile.DataID, + multiplier = TotallyLevyingMultiplier, + autoMode = (int)ModeComponentValue.AutoModeValue, + noteSaltMode = (int)ModeComponentValue.NoteSaltModeValue, + audioMultiplier = TotallyLevyingAudioMultiplier, + faintNoteMode = (int)ModeComponentValue.FaintNoteModeValue, + judgmentMode = (int)ModeComponentValue.JudgmentModeValue, + hitPointsMode = (int)ModeComponentValue.HandlingHitPointsModeValue, + noteMobilityMode = (int)ModeComponentValue.NoteMobilityModeValue, + longNoteMode = (int)ModeComponentValue.LongNoteModeValue, + inputFavorMode = (int)ModeComponentValue.InputFavorModeValue, + noteModifyMode = (int)ModeComponentValue.NoteModifyModeValue, + lowestJudgmentConditionMode = (int)ModeComponentValue.LowestJudgmentConditionModeValue, + stand = Stand.TargetValue, + highestBand = HighestBand, + point = Point.TargetValue, + salt = ModeComponentValue.Salt, + isPaused = _isPaused, + inputFlags = _inputFlags, + inputMode = InputMode + }, UnsafeByteOperations.UnsafeWrap(NoteFileContents), Comment.ToByteString()); + } + else if (QwilightComponent.IsValve) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.ValveComment, new + { + dataID = NoteFile.DataID, + stand = Stand.TargetValue, + hitPointsMode = (int)ModeComponentValue.HandlingHitPointsModeValue + }, UnsafeByteOperations.UnsafeWrap(NoteFileContents)); + } + } + } + else + { + try + { + DB.Instance.SaveComment(date, default, eventNoteID, commentID, AvatarName, TotallyLevyingMultiplier, TotallyLevyingAudioMultiplier, ModeComponentValue, Stand.TargetValue, HighestBand, IsP, Point.TargetValue, _isPaused, _inputFlags); + using (var zipFile = new ZipFile(Path.Combine(QwilightComponent.CommentEntryPath, Path.ChangeExtension(commentID, ".zip")))) + { + for (var i = _comments.Count - 1; i >= 0; --i) + { + using var rms = PoolSystem.Instance.GetDataFlow(); + _comments[i].WriteTo(rms); + rms.Position = 0; + zipFile.AddEntry(i.ToString(), rms); + zipFile.Save(); + } + } + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SaveCommentFailed, e.Message)); + } + } + if (WwwLevelDataValue != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.WwwLevel, new + { + noteID = eventNoteID ?? NoteFile.GetNoteID512(), + stand = Stand.TargetValue, + point = Point.TargetValue, + highestBand = HighestBand, + judgments = new[] + { + InheritedHighestJudgment, + InheritedHigherJudgment, + InheritedHighJudgment, + InheritedLowJudgment, + InheritedLowerJudgment, + InheritedLowestJudgment + }, + autoMode = (int)ModeComponentValue.AutoModeValue, + noteSaltMode = (int)ModeComponentValue.NoteSaltModeValue, + faintNoteMode = (int)ModeComponentValue.FaintNoteModeValue, + judgmentMode = (int)ModeComponentValue.JudgmentModeValue, + hitPointsMode = (int)ModeComponentValue.HandlingHitPointsModeValue, + noteMobilityMode = (int)ModeComponentValue.NoteMobilityModeValue, + longNoteMode = (int)ModeComponentValue.LongNoteModeValue, + inputFavorMode = (int)ModeComponentValue.InputFavorModeValue, + noteModifyMode = (int)ModeComponentValue.NoteModifyModeValue, + bpmMode = (int)ModeComponentValue.BPMModeValue, + waveMode = (int)ModeComponentValue.WaveModeValue, + setNoteMode = (int)ModeComponentValue.SetNoteModeValue, + lowestJudgmentConditionMode = (int)ModeComponentValue.LowestJudgmentConditionModeValue + }); + } + } + var netItems = _savedNetItems.Where(netItem => !netItem.IsMyNetItem && netItem.AvatarID == AvatarID).ToArray(); + IsNewStand = netItems.Length == 0 || Stand.TargetValue > netItems.Max(netItem => netItem.StandValue); + } + } + + void NewPaintEvent() + { + Comment.Paints.Add(new PaintEvent + { + HitPoints = HitPoints.TargetValue, + Stand = Stand.TargetValue, + Band = Band.TargetValue, + Point = Point.TargetValue, + Wait = LoopingCounter + }); + switch (ModeComponentValue.HandlingHitPointsModeValue) + { + case ModeComponent.HitPointsMode.Highest: + _paintEventsGAS[(int)ModeComponent.HitPointsMode.Higher].Add(new() + { + HitPoints = _hitPointsGAS[(int)ModeComponent.HitPointsMode.Higher], + Stand = Stand.TargetValue, + Band = Band.TargetValue, + Point = Point.TargetValue, + Wait = LoopingCounter + }); + + _paintEventsGAS[(int)ModeComponent.HitPointsMode.Default].Add(new() + { + HitPoints = _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default], + Stand = Stand.TargetValue, + Band = Band.TargetValue, + Point = Point.TargetValue, + Wait = LoopingCounter + }); + break; + case ModeComponent.HitPointsMode.Higher: + _paintEventsGAS[(int)ModeComponent.HitPointsMode.Default].Add(new() + { + HitPoints = _hitPointsGAS[(int)ModeComponent.HitPointsMode.Default], + Stand = Stand.TargetValue, + Band = Band.TargetValue, + Point = Point.TargetValue, + Wait = LoopingCounter + }); + break; + } + } + + public void HandleCompiler() => Task.Run(() => + { + try + { + SetUIMap(); + } + catch + { + } + if (_targetCompiler != null) + { + lock (_targetCompiler) + { + _targetCompilerStatus = CompilerStatus.Compiling; + _targetCompilerHandler.Start(); + } + } + }); + + public void SetWait() => DB.Instance.SetWait(NoteFile, Math.Clamp(Configure.Instance.AudioWait, -1000.0, 1000.0), Math.Clamp(Configure.Instance.MediaWait, -1000.0, 1000.0), Configure.Instance.Media); + + IHandlerItem GetHandlerItem(MediaNote.Mode mode) => ViewFailedDrawing && _failedDrawingMillis > 0.0 && DrawingCollection.TryGetValue(MediaNote.Mode.Failed, out var failedHandler) ? failedHandler : DrawingCollection.TryGetValue(mode, out var handler) ? handler : null; + + public virtual void SendNotCompiled() + { + } + + public virtual void InitPassable() + { + LevyingMultiplier = ModeComponentValue.Multiplier; + LevyingAudioMultiplier = AudioMultiplier; + Comment.LevyingMultiplier = LevyingMultiplier; + Comment.LevyingAudioMultiplier = LevyingAudioMultiplier; + if (_isLevyingComputer) + { + TotallyLevyingMultiplier = LevyingMultiplier; + TotallyLevyingAudioMultiplier = LevyingAudioMultiplier; + } + } + + public void Init() + { + _loopingHandler.Reset(); + for (var i = _lastIIDXInputAudioNoteMap.Length - 1; i > 0; --i) + { + _lastIIDXInputAudioNoteMap[i] = new(); + } + NoteMobilityCosine = 1.0; + NoteMobilityValue = 0.0; + FaintCosine = 1.0; + ModeComponentValue.HandlingHitPointsModeValue = ModeComponentValue.HitPointsModeValue; + _failedDrawingMillis = 0.0; + _validJudgedNotes = 0; + _lastStatus = LastStatus.Not; + SetJudgmentMillis(); + SetStandMultiplier(); + HitPoints.TargetValue = 1.0; + HitPoints.Value = 1.0; + Array.Fill(_hitPointsGAS, HitPoints.TargetValue); + Point.TargetValue = 1.0; + Point.Value = 1.0; + HandlingBPM = LevyingBPM; + _valueComponent.SetBPM(LevyingBPM); + _millisStandardMeter = 60000.0 / LevyingBPM; + _millisMeter = 0.0; + IsHandlingDrawing = false; + HasFailedJudgment = false; + _isPaused = false; + _inputFlags = InputFlag.Not; + AudioSystem.Instance.Stop(this); + MediaSystem.Instance.Stop(this); + foreach (var note in Notes) + { + note.Init(); + } + foreach (var netItem in NetItems) + { + netItem.LastPaintEventPosition = 0; + } + Array.Clear(JudgmentMeters, 0, JudgmentMeters.Length); + Array.Clear(_targetMainFrames, 0, _targetMainFrames.Length); + Array.Clear(_targetInputFrames, 0, _targetInputFrames.Length); + foreach (var paintEventsGAS in _paintEventsGAS) + { + paintEventsGAS.Clear(); + } + if (SetPass) + { + SetPass = false; + } + else + { + Comment.HighestJudgment = 0; + Comment.HigherJudgment = 0; + Comment.HighJudgment = 0; + Comment.LowJudgment = 0; + Comment.LowerJudgment = 0; + Comment.LowestJudgment = 0; + Comment.Inputs.Clear(); + Comment.Multipliers.Clear(); + Comment.AudioMultipliers.Clear(); + Comment.JudgmentMeters.Clear(); + Comment.Paints.Clear(); + InitPassable(); + } + IsPausing = false; + if (SetUndo) + { + SetUndo = false; + IsPausingWindowOpened = false; + SetPause = false; + } + else if (!_isLevyingComputer && WwwLevelDataValue?.AllowPause == false) + { + Configure.Instance.DefaultSpinningModeValue = Configure.DefaultSpinningMode.Unpause; + IsPausingWindowOpened = true; + SetPause = true; + } + _noteWaits.Clear(); + EarlyValue = 0; + LateValue = 0; + IsF.SetValue(false); + LoopingCounter = -Component.LevyingWait; + Status = 0.0; + Band.TargetValue = 0; + Stand.TargetValue = 0; + HighestBand = 0; + SavedStand = 0.0; + TotalPoint = 0.0; + SavedPoint = 0.0; + _bandPaintMillis = 0.0; + _mainMillis = 0.0; + _judgmentMainPaintMillis = 0.0; + _inputMillis = 0.0; + _levelMillis = 0.0; + _pauseMillis = 0.0; + _lastPaintedBand = 0; + _noteMillis = 0.0; + _eventPositions.Clear(); + _handlingNotes.Clear(); + lock (PaintedNotes) + { + PaintedNotes.Clear(); + } + DrawingCollection.Clear(); + foreach (var judgmentVisualizerValues in JudgmentVisualizerValues) + { + lock (judgmentVisualizerValues) + { + judgmentVisualizerValues.Clear(); + } + } + InputCountQueue.Clear(); + lock (JudgmentPaints) + { + JudgmentPaints.Clear(); + } + lock (HitNotePaints) + { + HitNotePaints.Clear(); + } + lock (HitLongNotePaints) + { + HitLongNotePaints.Clear(); + } + lock (JudgmentInputValues) + { + foreach (var judgmentInputValues in JudgmentInputValues) + { + Array.Clear(judgmentInputValues, 0, judgmentInputValues.Length); + } + } + _lazyInit?.Invoke(); + IOLazyInit?.Invoke(); + } + + public virtual void OnHandled() + { + if (!IsF) + { + SetCommentFile(); + } + if (!IsF && LevyingComputingPosition + 1 < NoteFiles.Length) + { + SetStop = true; + SetInheritedValues(); + var noteFile = NoteFiles[LevyingComputingPosition + 1]; + ModeComponentValue.ComputingValue = noteFile; + ModeComponentValue.SentMultiplier = ModeComponentValue.MultiplierValue / (ModeComponentValue.BPM * ModeComponentValue.AudioMultiplier); + ModeComponentValue.HitPointsModeValue = ModeComponentValue.HandlingHitPointsModeValue; + ViewModels.Instance.MainValue.SetComputingMode(this is CommentCompute ? new CommentCompute(NoteFiles, + Comments, + DefaultModeComponentValue, + AvatarID, + AvatarName, + HandlerID, + EventNoteEntryItem, + this, + double.NaN + ) : new DefaultCompute(NoteFiles, + Comments, + DefaultModeComponentValue, + AvatarID, + AvatarName, + WwwLevelDataValue, + HandlerID, + EventNoteEntryItem, + this)); + } + else + { + FadingViewLayer = IsF ? 3 : 2; + SetQuitMode(); + } + } + + public void SetAutoNoteWait() + { + if (Configure.Instance.AutoNoteWait && _noteWaits.Any()) + { + Configure.Instance.UIConfigureValue.NoteWait += _noteWaits.Average(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SetAutoNoteWait, (int)Configure.Instance.UIConfigureValue.NoteWait)); + } + } + + public virtual void HandleNetItems() + { + foreach (var netItem in NetItems) + { + if (netItem.IsMyNetItem) + { + netItem.SetValue(Stand.TargetValue, Band.TargetValue, Point.TargetValue, HitPoints.TargetValue, NoteFiles.Length); + netItem.HitPointsModeValue = ModeComponentValue.HandlingHitPointsModeValue; + } + else + { + var paintEvents = netItem.Comment?.Paints; + var paintEventsCount = paintEvents?.Count ?? 0; + if (_wasGetNetComments && paintEventsCount > 0) + { + switch (netItem.PaintEventsDate) + { + case Component.PaintEventsDate100: + switch (Status) + { + case 0.0: + netItem.SetValue(0, 0, 1.0, 1.0, NoteFiles.Length); + break; + case 1.0: + netItem.SetValue(netItem.CommentItem.Stand, netItem.BandValue, netItem.CommentItem.Point, netItem.HitPoints, NoteFiles.Length); + break; + default: + var paintEventEstimated = paintEvents[(int)(paintEventsCount * Status)]; + netItem.SetValue(paintEventEstimated.Stand, paintEventEstimated.Band, paintEventEstimated.Point, paintEventEstimated.HitPoints, NoteFiles.Length); + break; + } + break; + case Component.PaintEventsDate11491: + if (LoopingCounter < paintEvents[0].Wait) + { + netItem.SetValue(0, 0, 1.0, 1.0, NoteFiles.Length); + } + else + { + while (netItem.LastPaintEventPosition < paintEventsCount - 1 && paintEvents[netItem.LastPaintEventPosition + 1].Wait <= LoopingCounter) + { + ++netItem.LastPaintEventPosition; + } + var paintEventClosed = paintEvents[netItem.LastPaintEventPosition]; + netItem.SetValue(paintEventClosed.Stand, paintEventClosed.Band, paintEventClosed.Point, paintEventClosed.HitPoints, NoteFiles.Length); + } + break; + } + } + } + } + + foreach (var netItem in NetItems) + { + if (netItem.IsFavorNetItem) + { + var status = (double)_validJudgedNotes / ValidatedTotalNotes; + netItem.SetValue((int)(Configure.Instance.FavorHunterStand * (LevyingComputingPosition + status)), (int)(TotalNotes * status), 1.0, 1.0, NoteFiles.Length); + break; + } + } + + var targetPosition = SetValidNetItems(); + LevyingNetPosition = Math.Max(0, targetPosition - (Configure.Instance.NetItemCount - 1)); + QuitNetPosition = Math.Min(NetItems.Count - 1, LevyingNetPosition + Configure.Instance.NetItemCount - 1); + } + + int SetValidNetItems() + { + var targetPosition = 0; + foreach (var netItem in NetItems) + { + var setTargetPosition = 0; + foreach (var targetNetItem in NetItems) + { + if (targetNetItem.CompareTo(netItem) > 0) + { + ++setTargetPosition; + } + } + netItem.SetTargetPosition = setTargetPosition; + if (netItem.IsMyNetItem) + { + targetPosition = setTargetPosition; + } + } + foreach (var netItem in NetItems) + { + netItem.TargetPosition = netItem.SetTargetPosition; + } + return targetPosition; + } + + public virtual void GetNetItems() + { + if (!_wasNetItems) + { + _wasNetItems = true; + var netItem = new NetItem(AvatarID, AvatarName, DateTime.Now) + { + IsMyNetItem = true, + HitPointsModeValue = ModeComponentValue.HandlingHitPointsModeValue + }; + SetNetItems(new() + { + netItem + }); + Task.Run(async () => + { + var eventNoteID = EventNoteEntryItem?.EventNoteID; + var netItems = new List(); + switch (!string.IsNullOrEmpty(eventNoteID) || NoteFile.IsBanned ? 0 : Configure.Instance.CommentViewTabPosition) + { + case 0: + netItems.AddRange(GetNetItemsImpl(await DB.Instance.GetCommentItems(NoteFiles[0], eventNoteID, NoteFiles.Length))); + break; + case 1: + case 2: + var twilightWwwComment = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/comment?noteID={NoteFile.GetNoteID512()}&avatarID={Configure.Instance.AvatarID}&target={Configure.Instance.UbuntuNetItemTarget}"); + if (twilightWwwComment.HasValue) + { + netItems.AddRange(GetNetItemsImpl(HandleTwilightNetItems(Utility.GetCommentItems(twilightWwwComment.Value.comments, NoteFile)))); + } + break; + } + netItems.Add(netItem); + _savedNetItems.AddRange(netItems); + lock (IsTwilightNetItemsCSX) + { + if (!IsTwilightNetItems) + { + SetNetItems(netItems); + } + } + _wasGetNetItems = true; + + IEnumerable GetNetItemsImpl(ICollection commentItems) => commentItems.Select(commentItem => new NetItem(commentItem.AvatarWwwValue.AvatarID, commentItem.AvatarName, commentItem.Date, commentItem.Stand, commentItem.Band, commentItem.Point, commentItem.Stand / (1000000.0 * NoteFiles.Length)) + { + CommentItem = commentItem, + AvatarNetStatus = Event.Types.AvatarNetStatus.Clear, + QuitValue = Utility.GetQuitStatusValue(commentItem.Point, commentItem.Stand, 1.0, NoteFiles.Length), + HitPointsModeValue = commentItem.ModeComponentValue.HandlingHitPointsModeValue + }); + }); + } + } + + public virtual ICollection HandleTwilightNetItems(CommentItem[] commentItems) => commentItems; + + public virtual void OnFailed() => IlluminationSystem.Instance.IsFailed = true; + + public virtual void GetNetComments() + { + if (Configure.Instance.NetCommentFollow) + { + if (!_wasGetNetComments && _wasGetNetItems) + { + _wasGetNetComments = true; + Utility.HandleHMP(new ConcurrentBag(NetItems), QwilightComponent.CPUCount, async netItem => + { + if (netItem.Comment == null) + { + try + { + var commentItem = netItem.CommentItem; + if (commentItem != null) + { + var commentID = commentItem.CommentID; + if (commentItem.IsTwilightComment) + { + using var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/comment?noteID={NoteFile.GetNoteID512()}&commentID={commentID}"); + if (s.Length > 0) + { + netItem.Comment = Comment.Parser.ParseFrom(s); + } + } + else + { + if (EventNoteEntryItem != null) + { + var commentFilePath = Path.Combine(QwilightComponent.CommentEntryPath, Path.ChangeExtension(commentID, ".zip")); + if (File.Exists(commentFilePath)) + { + using (var zipFile = ZipFile.Read(commentFilePath)) + { + var zipEntry = zipFile[LevyingComputingPosition.ToString()]; + using var rms = PoolSystem.Instance.GetDataFlow((int)zipEntry.UncompressedSize); + zipFile[LevyingComputingPosition.ToString()].Extract(rms); + rms.Position = 0; + netItem.Comment = Comment.Parser.ParseFrom(rms); + } + } + } + else + { + var commentFilePath = Path.Combine(QwilightComponent.CommentEntryPath, commentID); + if (File.Exists(commentFilePath)) + { + using var fs = File.OpenRead(commentFilePath); + netItem.Comment = Comment.Parser.ParseFrom(fs); + } + } + } + } + } + catch + { + } + } + }); + } + } + else + { + if (_wasGetNetComments) + { + _wasGetNetComments = false; + foreach (var netItem in NetItems) + { + netItem.Comment = null; + } + } + } + } + + void HandleComment(ref int commentInputID, ref int commentMultiplierID, ref int commentAudioMultiplierID) + { + if (EventComment != null) + { + while (EventComment.Inputs.Count > commentInputID) + { + var inputEvent = EventComment.Inputs[commentInputID]; + if (Utility.SetCommentWait(CommentWaitDate, AudioMultiplier, inputEvent.Wait) <= LoopingCounter) + { + HandleInput(inputEvent.Input); + commentInputID++; + continue; + } + break; + } + while (EventComment.Multipliers.Count > commentMultiplierID) + { + var multiplierEvent = EventComment.Multipliers[commentMultiplierID]; + if (Utility.SetCommentWait(CommentWaitDate, AudioMultiplier, multiplierEvent.Wait) <= LoopingCounter) + { + MultiplierQueue.Enqueue(multiplierEvent.Multiplier); + ++commentMultiplierID; + if (!IsInEvents && !multiplierEvent.IsAutoEvent) + { + HandleUIAudio("Multiplier"); + } + continue; + } + else + { + break; + } + } + while (EventComment.AudioMultipliers.Count > commentAudioMultiplierID) + { + var audioMultiplierEvent = EventComment.AudioMultipliers[commentAudioMultiplierID]; + if (Utility.SetCommentWait(CommentWaitDate, AudioMultiplier, audioMultiplierEvent.Wait) <= LoopingCounter) + { + AudioMultiplierQueue.Enqueue(audioMultiplierEvent.AudioMultiplier); + ++commentAudioMultiplierID; + HandleUIAudio("Audio Multiplier"); + continue; + } + else + { + break; + } + } + } + } + + void HandleUIAudio(string audioFileName) + { + if (!IsInEvents) + { + Task.Run(() => + { + if (!UI.Instance.HandleAudio(audioFileName, null, null, 0.0)) + { + BaseUI.Instance.HandleAudio(audioFileName, null, null, 0.0); + } + }); + } + } + + public virtual void OnGetF() + { + IsF.SetValue(true); + if (IsFailMode) + { + OnHandled(); + } + } + + public void SetJudgmentMillis() + { + LowestJudgmentMillis = Component.GetJudgmentMillis(Component.Judged.Lowest, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, 0); + HighestJudgmentMillis = Component.GetJudgmentMillis(Component.Judged.Lowest, ModeComponentValue, JudgmentStage, _judgmentModeDate, _judgmentMapDate, _longNoteAssistDate, 1); + } + + public void SetStandMultiplier() + { + if (IsPostableItemMode) + { + _standMultiplier = 1.0; + } + else + { + _standMultiplier = Math.Min(AudioMultiplier, 1.0); + switch (ModeComponentValue.JudgmentModeValue) + { + case ModeComponent.JudgmentMode.Lower: + _standMultiplier *= 0.5; + break; + case ModeComponent.JudgmentMode.Lowest: + _standMultiplier *= 0.25; + break; + } + switch (ModeComponentValue.HandlingHitPointsModeValue) + { + case ModeComponent.HitPointsMode.Lower: + _standMultiplier *= 0.5; + break; + case ModeComponent.HitPointsMode.Lowest: + _standMultiplier *= 0.25; + break; + } + } + } + + public void SetCommentFile() => _comments.Add(Comment.Clone()); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/FlintCompute.cs b/Qwilight/Qwilight/Compute/FlintCompute.cs new file mode 100644 index 0000000..9641b34 --- /dev/null +++ b/Qwilight/Qwilight/Compute/FlintCompute.cs @@ -0,0 +1,25 @@ +using Qwilight.NoteFile; +using Qwilight.ViewModel; + +namespace Qwilight.Compute +{ + public class FlintCompute : AutoCompute + { + public override bool IsMeterVisible => true; + + public FlintCompute(BaseNoteFile noteFile, ModeComponent defaultModeComponentValue, string avatarID, string avatarName, int levyingMeter) : base(new[] { noteFile }, defaultModeComponentValue, avatarID, avatarName, levyingMeter, double.NaN) + { + } + + public override void AtNoteFileMode() + { + Close(); + var mainViewModel = ViewModels.Instance.MainValue; + var entryItemValue = mainViewModel.EntryItemValue; + if (entryItemValue != null) + { + mainViewModel.LoadEntryItem(entryItemValue.DefaultEntryItem, entryItemValue.EntryPath); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/IOCompute.cs b/Qwilight/Qwilight/Compute/IOCompute.cs new file mode 100644 index 0000000..afd290f --- /dev/null +++ b/Qwilight/Qwilight/Compute/IOCompute.cs @@ -0,0 +1,117 @@ +using MoonSharp.Interpreter; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.ViewModel; + +namespace Qwilight.Compute +{ + public sealed class IOCompute : DefaultCompute + { + public override bool IsPowered => false; + + public override bool CanPause => false; + + public override bool CanUndo => false; + + public override bool IsPassable => false; + + public override bool CanIO => false; + + public override Configure.InputAudioVariety InputAudioVarietyValue => Configure.InputAudioVariety.IIDX; + + public IOCompute(BaseNoteFile[] noteFiles, ModeComponent defaultModeComponentValue, JSON.TwilightCallIOComponent twilightCallIOComponent) : base(noteFiles, null, defaultModeComponentValue, twilightCallIOComponent.avatarID, twilightCallIOComponent.avatarName, null, twilightCallIOComponent.handlerID) + { + IsFailMode = twilightCallIOComponent.isFailMode; + WaitingTwilightLevel = WaitingTwilight.WaitIO; + var time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + IOMillis = time - ((time - twilightCallIOComponent.ioMillis) / 2 + twilightCallIOComponent.targetIOMillis); + } + + public override void GetNetItems() + { + lock (IsTwilightNetItemsCSX) + { + if (!IsTwilightNetItems) + { + base.GetNetItems(); + } + } + } + + public override void GetNetComments() + { + lock (IsTwilightNetItemsCSX) + { + if (!IsTwilightNetItems) + { + base.GetNetComments(); + } + } + } + + public override void OnHandled() + { + } + + public override void OnGetF() => IsF.SetValue(true); + + public override void SendNotCompiled() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.CompiledIo, new + { + avatarID = AvatarID, + handlerID = HandlerID, + isCompiled = false + }); + + public override bool IsSuitableAsHwInput(int input) => false; + + public override bool IsSuitableAsAutoJudge(int input) => false; + + public override void AtNoteFileMode() + { + Close(); + } + + public override void SendSituation() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsNoteFileMode) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)UbuntuItem.UbuntuSituation.IOComputing, + situationText = PlatformText + }); + } + } + + public override void HandleNetItems() + { + if (!IsTwilightNetItems) + { + base.HandleNetItems(); + } + } + + public override void OnCompiled() + { + if (!IsSilent) + { + ViewModels.Instance.MainValue.CloseAutoComputer(); + try + { + SetUIMap(); + } + catch (Exception e) + { + throw new ScriptRuntimeException(e); + } + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CompiledIo, new + { + avatarID = AvatarID, + handlerID = HandlerID, + isCompiled = true + }); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/NetCompute.cs b/Qwilight/Qwilight/Compute/NetCompute.cs new file mode 100644 index 0000000..8f2880a --- /dev/null +++ b/Qwilight/Qwilight/Compute/NetCompute.cs @@ -0,0 +1,244 @@ +using Google.Protobuf; +using MoonSharp.Interpreter; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using Qwilight.XOR; + +namespace Qwilight.Compute +{ + public class NetCompute : DefaultCompute + { + bool _hasPendingFailed; + + public override bool CanPause => false; + + public override bool CanUndo => false; + + public override bool IsPassable => false; + + public override QuitStatus QuitStatusValue => Utility.GetQuitStatusValue(Point.TargetValue, Stand.TargetValue, IsF ? 0.0 : HitPoints.TargetValue, 1); + + public override string TotalNotesInQuit => TotalNotes.ToString(); + + public override string HighestJudgmentInQuit => Comment.HighestJudgment.ToString(); + + public override string HigherJudgmentInQuit => Comment.HigherJudgment.ToString(); + + public override string HighJudgmentInQuit => Comment.HighJudgment.ToString(); + + public override string LowJudgmentInQuit => Comment.LowJudgment.ToString(); + + public override string LowerJudgmentInQuit => Comment.LowerJudgment.ToString(); + + public override string LowestJudgmentInQuit => Comment.LowestJudgment.ToString(); + + public NetCompute(BaseNoteFile[] noteFiles, ModeComponent modeComponentValue, string avatarID, string avatarName, JSON.TwilightLevyNet twilightLevyNet) : base(noteFiles, null, modeComponentValue, avatarID, avatarName, default, twilightLevyNet.handlerID) + { + WaitingTwilightLevel = WaitingTwilight.Net; + NetDrawings = new Queue(); + IsFailMode = false; + SiteID = twilightLevyNet.siteID; + ValidNetMode = twilightLevyNet.validNetMode; + AvatarsCount = twilightLevyNet.avatarsCount; + AllowedPostableitems = twilightLevyNet.allowedPostableItems.Select(i => PostableItem.Values[i]).ToArray(); + if (IsPostableItemMode && AvatarsCount == 1) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.PostableItemModeWarning); + } + } + + public override void AtQuitMode() + { + if (!IsPostableItemMode) + { + base.AtQuitMode(); + } + SetPendingQuitNetItems(); + } + + public void SetPendingQuitNetItems() + { + NoteFiles = PendingQuitNetItems.Select(quitNetItem => new NetNoteFile(quitNetItem)).ToArray(); + Comments = PendingQuitNetComments; + Stands = PendingQuitNetItems.Select(quitNetItem => new MoveValue(quitNetItem.stand)).ToArray(); + Points = PendingQuitNetItems.Select(quitNetItem => new MoveValue(quitNetItem.point)).ToArray(); + HitPointsValues = PendingQuitNetItems.Select(quitNetItem => new MoveValue(quitNetItem.hitPoints)).ToArray(); + IsFs = PendingQuitNetItems.Select(quitNetItem => new Primitive(quitNetItem.isF)).ToArray(); + ModeComponentValues = PendingQuitNetItems.Select((quitNetItem, i) => new ModeComponent(NoteFiles[i], quitNetItem)).ToArray(); + AvatarIDs = PendingQuitNetItems.Select(quitNetItem => quitNetItem.avatarID).ToArray(); + AvatarNames = PendingQuitNetItems.Select(quitNetItem => quitNetItem.avatarName).ToArray(); + HighestComputingPosition = NoteFiles.Length - 1; + LevyingComputingPosition = Array.IndexOf(PendingQuitNetItems, PendingQuitNetItems.Single(netItem => netItem.avatarID == AvatarID)); + Configure.Instance.NotifyTutorial(Configure.TutorialID.NetQuitMode); + } + + public override void GetNetItems() + { + } + + public override void GetNetComments() + { + } + + public override void OnFailed() + { + base.OnFailed(); + _hasPendingFailed = true; + } + + public override void HandleNetItems() + { + if (!IsF) + { + SendCallNetEvent(Event.Types.AvatarNetStatus.Default); + } + } + + public override void OnHandled() + { + if (!IsF) + { + SetCommentFile(); + SendCallNetEvent(Event.Types.AvatarNetStatus.Clear); + } + } + + public override void OnGetF() + { + if (!IsF) + { + IsF.SetValue(true); + SendCallNetEvent(Event.Types.AvatarNetStatus.Failed); + } + } + + public override void SendNotCompiled() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.Compiled, new + { + siteID = SiteID, + handlerID = HandlerID, + isCompiled = false + }); + + public override void SendSituation() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsNoteFileMode) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)(mainViewModel.IsQuitMode ? UbuntuItem.UbuntuSituation.QuitMode : UbuntuItem.UbuntuSituation.NetComputing), + situationText = PlatformText + }); + } + } + + public override void SetCommentPlaceText() + { + CommentPlace0Text = $"#{NetItems.Single(netItem => netItem.AvatarID == AvatarID).TargetPosition + 1}"; + CommentPlace1Text = $"/{NetItems.Count}"; + } + + public override void OnCompiled() + { + if (!IsSilent) + { + ViewModels.Instance.MainValue.CloseAutoComputer(); + try + { + SetUIMap(); + } + catch (Exception e) + { + throw new ScriptRuntimeException(e); + } + TwilightSystem.Instance.SendParallel(Event.Types.EventID.Compiled, new + { + siteID = SiteID, + handlerID = HandlerID, + isCompiled = true + }); + } + } + + public void SendCallNetEvent(Event.Types.AvatarNetStatus avatarNetStatus) + { + if (IsValidNetDrawings || avatarNetStatus != Event.Types.AvatarNetStatus.Default) + { + var eventItem = new Event(); + eventItem.EventID = Event.Types.EventID.CallNet; + var qwilightCallNet = new Event.Types.QwilightCallNet(); + qwilightCallNet.SiteID = SiteID; + qwilightCallNet.HandlerID = HandlerID; + qwilightCallNet.HitPointsMode = (int)ModeComponentValue.HandlingHitPointsModeValue; + qwilightCallNet.AvatarNetStatus = avatarNetStatus; + qwilightCallNet.Stand = Stand.TargetValue; + qwilightCallNet.HighestBand = HighestBand; + qwilightCallNet.Point = Point.TargetValue; + qwilightCallNet.HitPoints = HitPoints.TargetValue; + qwilightCallNet.IsFailed = _hasPendingFailed; + qwilightCallNet.LastJudged = (int)LastJudged; + if (avatarNetStatus == Event.Types.AvatarNetStatus.Default) + { + qwilightCallNet.Drawings.AddRange(NetDrawings); + NetDrawings.Clear(); + IsValidNetDrawings = false; + } + else + { + qwilightCallNet.Title = Title; + qwilightCallNet.Artist = Artist; + qwilightCallNet.Genre = Genre; + qwilightCallNet.Level = (int)LevelValue; + qwilightCallNet.LevelText = LevelText; + qwilightCallNet.WantLevelID = NoteFile.WantLevelID; + qwilightCallNet.AutoMode = (int)ModeComponentValue.AutoModeValue; + qwilightCallNet.NoteSaltMode = (int)ModeComponentValue.NoteSaltModeValue; + qwilightCallNet.AudioMultiplier = Comment.LevyingAudioMultiplier; + qwilightCallNet.FaintNoteMode = (int)ModeComponentValue.FaintNoteModeValue; + qwilightCallNet.JudgmentMode = (int)ModeComponentValue.JudgmentModeValue; + qwilightCallNet.NoteMobilityMode = (int)ModeComponentValue.NoteMobilityModeValue; + qwilightCallNet.LongNoteMode = (int)ModeComponentValue.LongNoteModeValue; + qwilightCallNet.InputFavorMode = (int)ModeComponentValue.InputFavorModeValue; + qwilightCallNet.NoteModifyMode = (int)ModeComponentValue.NoteModifyModeValue; + qwilightCallNet.BpmMode = (int)ModeComponentValue.BPMModeValue; + qwilightCallNet.WaveMode = (int)ModeComponentValue.WaveModeValue; + qwilightCallNet.SetNoteMode = (int)ModeComponentValue.SetNoteModeValue; + qwilightCallNet.LowestJudgmentConditionMode = (int)ModeComponentValue.LowestJudgmentConditionModeValue; + qwilightCallNet.TotalNotes = TotalNotes; + qwilightCallNet.JudgmentStage = JudgmentStage; + qwilightCallNet.HitPointsValue = HitPointsValue; + qwilightCallNet.HighestInputCount = HighestInputCount; + qwilightCallNet.Length = Length; + qwilightCallNet.Bpm = BPM; + qwilightCallNet.Multiplier = Comment.LevyingMultiplier; + qwilightCallNet.InputMode = (int)InputMode; + qwilightCallNet.HighestJudgment0 = ModeComponentValue.HighestJudgment0; + qwilightCallNet.HigherJudgment0 = ModeComponentValue.HigherJudgment0; + qwilightCallNet.HighJudgment0 = ModeComponentValue.HighJudgment0; + qwilightCallNet.LowJudgment0 = ModeComponentValue.LowJudgment0; + qwilightCallNet.LowerJudgment0 = ModeComponentValue.LowerJudgment0; + qwilightCallNet.LowestJudgment0 = ModeComponentValue.LowestJudgment0; + qwilightCallNet.HighestJudgment1 = ModeComponentValue.HighestJudgment1; + qwilightCallNet.HigherJudgment1 = ModeComponentValue.HigherJudgment1; + qwilightCallNet.HighJudgment1 = ModeComponentValue.HighJudgment1; + qwilightCallNet.LowJudgment1 = ModeComponentValue.LowJudgment1; + qwilightCallNet.LowerJudgment1 = ModeComponentValue.LowerJudgment1; + qwilightCallNet.LowestJudgment1 = ModeComponentValue.LowestJudgment1; + eventItem.Data.Add(Comment.ToByteString()); + } + qwilightCallNet.HighestJudgment = Comment.HighestJudgment; + qwilightCallNet.HigherJudgment = Comment.HigherJudgment; + qwilightCallNet.HighJudgment = Comment.HighJudgment; + qwilightCallNet.LowJudgment = Comment.LowJudgment; + qwilightCallNet.LowerJudgment = Comment.LowerJudgment; + qwilightCallNet.LowestJudgment = Comment.LowestJudgment; + qwilightCallNet.DrawingComponent = NetDrawingComponentValue; + eventItem.QwilightCallNet = qwilightCallNet; + TwilightSystem.Instance.SendParallel(eventItem); + _hasPendingFailed = false; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/QuitCompute.cs b/Qwilight/Qwilight/Compute/QuitCompute.cs new file mode 100644 index 0000000..6d68114 --- /dev/null +++ b/Qwilight/Qwilight/Compute/QuitCompute.cs @@ -0,0 +1,57 @@ +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.ViewModel; + +namespace Qwilight.Compute +{ + public sealed class QuitCompute : DefaultCompute + { + public QuitCompute(BaseNoteFile[] noteFiles, Comment[] comments, ModeComponent defaultModeComponentValue, CommentItem commentItem, EntryItem eventNoteEntryItem) : base(noteFiles, comments, defaultModeComponentValue, commentItem.AvatarWwwValue.AvatarID, commentItem.AvatarName, default, null, eventNoteEntryItem) + { + HighestComputingPosition = noteFiles.Length - 1; + foreach (var noteFile in noteFiles) + { + InheritedTotalNotes += noteFile.TotalNotes; + } + foreach (var comment in comments) + { + InheritedHighestJudgment += comment.HighestJudgment; + InheritedHigherJudgment += comment.HigherJudgment; + InheritedHighJudgment += comment.HighJudgment; + InheritedLowJudgment += comment.LowJudgment; + InheritedLowerJudgment += comment.LowerJudgment; + InheritedLowestJudgment += comment.LowestJudgment; + } + Stand.TargetValue = commentItem.Stand; + HighestBand = commentItem.Band; + Point.TargetValue = commentItem.Point; + CommentPlace0Text = commentItem.CommentPlace0Text; + CommentPlace1Text = commentItem.CommentPlace1Text; + } + + public override void HandleWarning() + { + } + + public override void AtQuitMode() + { + } + + public override void SetCommentPlaceText() + { + } + + public override void SendSituation() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsNoteFileMode) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)UbuntuItem.UbuntuSituation.QuitMode, + situationText = PlatformText + }); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/TestCompute.cs b/Qwilight/Qwilight/Compute/TestCompute.cs new file mode 100644 index 0000000..3d71ee0 --- /dev/null +++ b/Qwilight/Qwilight/Compute/TestCompute.cs @@ -0,0 +1,17 @@ +using Qwilight.NoteFile; + +namespace Qwilight.Compute +{ + public sealed class TestCompute : DefaultCompute + { + public TestCompute(BaseNoteFile noteFile) : base(new[] { noteFile }, null, null, string.Empty, string.Empty) + { + } + + public override bool LoadContents => false; + + public override void OnCompiled() + { + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Compute/WwwLevelData.cs b/Qwilight/Qwilight/Compute/WwwLevelData.cs new file mode 100644 index 0000000..0e0a4bd --- /dev/null +++ b/Qwilight/Qwilight/Compute/WwwLevelData.cs @@ -0,0 +1,58 @@ +namespace Qwilight.Compute +{ + public sealed class WwwLevelData + { + public bool IsStandSatisify { get; set; } + + public bool IsPointSatisify { get; set; } + + public bool IsBandSatisify { get; set; } + + public bool[] IsJudgmentsSatisify { get; } = new bool[6]; + + public void SetSatisify(DefaultCompute defaultComputer) + { + IsStandSatisify = IsSatisify(defaultComputer.Stand.TargetValue, Stand); + IsPointSatisify = IsSatisify(defaultComputer.Point.TargetValue, Point); + IsBandSatisify = IsSatisify(defaultComputer.Band.TargetValue, Band); + IsJudgmentsSatisify[(int)Component.Judged.Highest] = IsSatisify(defaultComputer.InheritedHighestJudgment + defaultComputer.Comment.HighestJudgment, Judgments?[(int)Component.Judged.Highest]); + IsJudgmentsSatisify[(int)Component.Judged.Higher] = IsSatisify(defaultComputer.InheritedHigherJudgment + defaultComputer.Comment.HigherJudgment, Judgments?[(int)Component.Judged.Higher]); + IsJudgmentsSatisify[(int)Component.Judged.High] = IsSatisify(defaultComputer.InheritedHighJudgment + defaultComputer.Comment.HighJudgment, Judgments?[(int)Component.Judged.High]); + IsJudgmentsSatisify[(int)Component.Judged.Low] = IsSatisify(defaultComputer.InheritedLowJudgment + defaultComputer.Comment.LowJudgment, Judgments?[(int)Component.Judged.Low]); + IsJudgmentsSatisify[(int)Component.Judged.Lower] = IsSatisify(defaultComputer.InheritedLowerJudgment + defaultComputer.Comment.LowerJudgment, Judgments?[(int)Component.Judged.Lower]); + IsJudgmentsSatisify[(int)Component.Judged.Lowest] = IsSatisify(defaultComputer.InheritedLowestJudgment + defaultComputer.Comment.LowestJudgment, Judgments?[(int)Component.Judged.Lowest]); + } + + static bool IsSatisify(int value, int[] values) + { + return values == null || value == Math.Clamp(value, values[0] != -1 ? values[0] : int.MinValue, values[1] != -1 ? values[1] : int.MaxValue); + } + + static bool IsSatisify(double value, double[] values) + { + return values == null || value == Math.Clamp(value, values[0] != -1.0 ? values[0] : double.MinValue, values[1] != -1.0 ? values[1] : double.MaxValue); + } + + public double LowestAudioMultiplier { get; set; } + + public double HighestAudioMultiplier { get; set; } + + public int[] Stand { get; set; } + + public string StandContents { get; set; } = string.Empty; + + public double[] Point { get; set; } + + public string PointContents { get; set; } = string.Empty; + + public int[] Band { get; set; } + + public string BandContents { get; set; } = string.Empty; + + public int[][] Judgments { get; set; } + + public string[] JudgmentContents { get; } = new string[6]; + + public bool AllowPause { get; set; } + } +} diff --git a/Qwilight/Qwilight/Computing.cs b/Qwilight/Qwilight/Computing.cs new file mode 100644 index 0000000..ae6a8e9 --- /dev/null +++ b/Qwilight/Qwilight/Computing.cs @@ -0,0 +1,223 @@ +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.Globalization; +using System.Text; +using System.Windows.Media; + +namespace Qwilight +{ + public abstract class Computing : Model + { + string _platformText; + int _longNoteModeDate; + string _genre; + + public int LongNoteModeDate + { + get => _longNoteModeDate; + + set + { + _longNoteModeDate = value; + SetAutoLongNote(); + } + } + + public bool IsAutoLongNote { get; set; } + + public bool IsLongNoteStand1 => LongNoteModeDate switch + { + Component.LongNoteMode11420 => IsAutoLongNote, + _ => false + }; + + public bool IsBanned { get; set; } + + public Component.InputMode InputMode { get; set; } + + public string Genre + { + get => _genre; + + set + { + _genre = value; + GenreText = Utility.GetGenreText(value); + } + } + + public string GenreText { get; set; } + + public string Artist { get; set; } + + public string Title { get; set; } + + public string PlatformText + { + get => _platformText; + + set + { + _platformText = value; + + if (Encoding.UTF8.GetByteCount(value) <= 128) + { + PlatformText128 = value; + } + else + { + var builder = new StringBuilder(); + var dataCount = 0; + var enumerator = StringInfo.GetTextElementEnumerator(value); + while (enumerator.MoveNext()) + { + var textElement = enumerator.GetTextElement(); + dataCount += Encoding.UTF8.GetByteCount(textElement); + if (dataCount <= 128) + { + builder.Append(textElement); + } + else + { + break; + } + } + PlatformText128 = builder.ToString(); + } + } + } + + public string PlatformText128 { get; set; } + + public string LevelText { get; set; } + + public double LevelTextValue { get; set; } + + public double LevyingBPM { get; set; } + + public double BPM { get; set; } + + public double Length { get; set; } + + public int TotalNotes { get; set; } + + public int AutoableNotes { get; set; } + + public int TrapNotes { get; set; } + + public int LongNotes { get; set; } + + public double JudgmentStage { get; set; } + + public double HitPointsValue { get; set; } + + public BaseNoteFile.Level LevelValue { get; set; } + + public string NoteDrawingName { get; set; } + + public string NoteDrawingPath { get; set; } + + public string BannerDrawingName { get; set; } + + public string BannerDrawingPath { get; set; } + + public string TrailerAudioName { get; set; } + + public string TrailerAudioPath { get; set; } + + public string AssistFileName { get; set; } + + public double AudioLevyingPosition { get; set; } + + public bool IsSalt { get; set; } + + public string Tag { get; set; } + + public double LowestBPM { get; set; } + + public double HighestBPM { get; set; } + + public int HighestInputCount { get; set; } + + public bool IsHellBPM { get; set; } + + public double AverageInputCount => Length > 0.0 ? 1000.0 * TotalNotes / Length : TotalNotes; + + public bool HasBPMMap => LowestBPM != HighestBPM; + + public string JudgmentStageContents => $"{JudgmentStage switch + { + 0.0 => "JUDGE: VEZ", + 3.0 => "JUDGE: EZ", + 5.0 => "JUDGE: NM", + 7.0 => "JUDGE: HD", + 10.0 => "JUDGE: VHD", + _ => $"LV. {Math.Round(JudgmentStage, 1)}" + }}, HP: {Math.Round(100 * HitPointsValue, 2)}%"; + + public string TotalNotesContents => $"{TotalNotes.ToString("#,##0")} (SC: {AutoableNotes.ToString("#,##0")}, {(IsAutoLongNote ? "LN" : "CN")}: {LongNotes.ToString("#,##0")}, MN: {TrapNotes.ToString("#,##0")})"; + + public string BPMMapValue => $"{Math.Round(LowestBPM, 2)} ~ {Math.Round(HighestBPM, 2)} BPM"; + + public abstract BaseNoteFile.NoteVariety NoteVarietyValue { get; } + + public Brush LevelPaint => BaseUI.Instance.LevelPaints[(int)LevelValue]; + + public Computing() => InitCompiled(); + + void SetAutoLongNote() + { + switch (LongNoteModeDate) + { + case Component.LongNoteMode100: + IsAutoLongNote = false; + break; + case Component.LongNoteMode11420: + case Component.LongNoteMode1164: + IsAutoLongNote = true; + break; + } + } + + public void InitCompiled() + { + LongNoteModeDate = Component.LatestLongNoteMode; + IsBanned = false; + InputMode = Component.InputMode.InputMode51; + Genre = string.Empty; + Artist = string.Empty; + Title = string.Empty; + PlatformText = string.Empty; + LevelText = string.Empty; + LevelTextValue = double.NaN; + LevyingBPM = Component.StandardBPM; + BPM = LevyingBPM; + Length = 0.0; + TotalNotes = 0; + AutoableNotes = 0; + LongNotes = 0; + TrapNotes = 0; + JudgmentStage = 5.0; + HitPointsValue = 0.01; + LevelValue = BaseNoteFile.Level.Level0; + NoteDrawingName = string.Empty; + NoteDrawingPath = string.Empty; + BannerDrawingName = string.Empty; + BannerDrawingPath = string.Empty; + TrailerAudioName = string.Empty; + TrailerAudioPath = string.Empty; + AssistFileName = string.Empty; + AudioLevyingPosition = double.NaN; + IsSalt = false; + Tag = string.Empty; + LowestBPM = LevyingBPM; + HighestBPM = LevyingBPM; + HighestInputCount = default; + IsHellBPM = false; + } + + public abstract void OnCompiled(); + + public abstract void OnFault(Exception e); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Elapsable.cs b/Qwilight/Qwilight/Elapsable.cs new file mode 100644 index 0000000..9cad49d --- /dev/null +++ b/Qwilight/Qwilight/Elapsable.cs @@ -0,0 +1,18 @@ +namespace Qwilight +{ + public class Elapsable + { + public T Value { get; set; } + + public double Elapsed { get; set; } + + public void Elapse(double millis) => Elapsed += millis; + + public bool IsElapsed(double millis) => Elapsed >= millis; + + public static Elapsable GetElapsable(T value) => new Elapsable + { + Value = value + }; + } +} diff --git a/Qwilight/Qwilight/Event.cs b/Qwilight/Qwilight/Event.cs new file mode 100644 index 0000000..4729a65 --- /dev/null +++ b/Qwilight/Qwilight/Event.cs @@ -0,0 +1,9519 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Event.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Qwilight { + + /// Holder for reflection information generated from Event.proto + public static partial class EventReflection { + + #region Descriptor + /// File descriptor for Event.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EventReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgtFdmVudC5wcm90byL+MAoFRXZlbnQSDgoGbWlsbGlzGAEgASgDEhAKCGF2", + "YXRhcklEGAIgASgJEh8KB2V2ZW50SUQYAyABKA4yDi5FdmVudC5FdmVudElE", + "EgwKBHRleHQYBCABKAkSDAoEZGF0YRgFIAMoDBIxCg9xd2lsaWdodENhbGxO", + "ZXQYBiABKAsyFi5FdmVudC5Rd2lsaWdodENhbGxOZXRIABIxCg90d2lsaWdo", + "dENhbGxOZXQYByABKAsyFi5FdmVudC5Ud2lsaWdodENhbGxOZXRIABIxCg9x", + "d2lsaWdodElPSW5wdXQYCCABKAsyFi5FdmVudC5Rd2lsaWdodElPSW5wdXRI", + "ABIxCg90d2lsaWdodElPSW5wdXQYCSABKAsyFi5FdmVudC5Ud2lsaWdodElP", + "SW5wdXRIABIxCg9xd2lsaWdodElPSnVkZ2UYCiABKAsyFi5FdmVudC5Rd2ls", + "aWdodElPSnVkZ2VIABIxCg90d2lsaWdodElPSnVkZ2UYCyABKAsyFi5FdmVu", + "dC5Ud2lsaWdodElPSnVkZ2VIABJBChdxd2lsaWdodElPSnVkZ21lbnRNZXRl", + "chgMIAEoCzIeLkV2ZW50LlF3aWxpZ2h0SU9KdWRnbWVudE1ldGVySAASQQoX", + "dHdpbGlnaHRJT0p1ZGdtZW50TWV0ZXIYDSABKAsyHi5FdmVudC5Ud2lsaWdo", + "dElPSnVkZ21lbnRNZXRlckgAEkMKGHF3aWxpZ2h0SU9Ob3RlVmlzaWJpbGl0", + "eRgOIAEoCzIfLkV2ZW50LlF3aWxpZ2h0SU9Ob3RlVmlzaWJpbGl0eUgAEkMK", + "GHR3aWxpZ2h0SU9Ob3RlVmlzaWJpbGl0eRgPIAEoCzIfLkV2ZW50LlR3aWxp", + "Z2h0SU9Ob3RlVmlzaWJpbGl0eUgAEjsKFHF3aWxpZ2h0SU9NdWx0aXBsaWVy", + "GBAgASgLMhsuRXZlbnQuUXdpbGlnaHRJT011bHRpcGxpZXJIABI7ChR0d2ls", + "aWdodElPTXVsdGlwbGllchgRIAEoCzIbLkV2ZW50LlR3aWxpZ2h0SU9NdWx0", + "aXBsaWVySAASRQoZcXdpbGlnaHRJT0F1ZGlvTXVsdGlwbGllchgSIAEoCzIg", + "LkV2ZW50LlF3aWxpZ2h0SU9BdWRpb011bHRpcGxpZXJIABJFChl0d2lsaWdo", + "dElPQXVkaW9NdWx0aXBsaWVyGBMgASgLMiAuRXZlbnQuVHdpbGlnaHRJT0F1", + "ZGlvTXVsdGlwbGllckgAEjcKEnR3aWxpZ2h0QXVkaW9JbnB1dBgUIAEoCzIZ", + "LkV2ZW50LlR3aWxpZ2h0QXVkaW9JbnB1dEgAEjMKEHF3aWxpZ2h0UG9zdEl0", + "ZW0YFSABKAsyFy5FdmVudC5Rd2lsaWdodFBvc3RJdGVtSAASMwoQdHdpbGln", + "aHRQb3N0SXRlbRgWIAEoCzIXLkV2ZW50LlR3aWxpZ2h0UG9zdEl0ZW1IABqp", + "AwoPVHdpbGlnaHRDYWxsTmV0EhEKCWhhbmRsZXJJRBgBIAEoCRIwCgRkYXRh", + "GAIgAygLMiIuRXZlbnQuVHdpbGlnaHRDYWxsTmV0LkNhbGxOZXRJdGVtGtAC", + "CgtDYWxsTmV0SXRlbRIvCg9hdmF0YXJOZXRTdGF0dXMYASABKA4yFi5FdmVu", + "dC5BdmF0YXJOZXRTdGF0dXMSEAoIYXZhdGFySUQYAiABKAkSEgoKYXZhdGFy", + "TmFtZRgDIAEoCRINCgVzdGFuZBgEIAEoBRIMCgRiYW5kGAUgASgFEg0KBXBv", + "aW50GAYgASgBEhEKCWhpdFBvaW50cxgHIAEoARIQCghpc0ZhaWxlZBgIIAEo", + "CBISCgpsYXN0SnVkZ2VkGAkgASgFEhUKDWhpdFBvaW50c01vZGUYCiABKAUS", + "FgoOdGFyZ2V0UG9zaXRpb24YCyABKAUSIwoIZHJhd2luZ3MYDCADKAsyES5F", + "dmVudC5OZXREcmF3aW5nEjEKEGRyYXdpbmdDb21wb25lbnQYDSABKAsyFy5F", + "dmVudC5EcmF3aW5nQ29tcG9uZW50Gp8KCg9Rd2lsaWdodENhbGxOZXQSDgoG", + "c2l0ZUlEGAEgASgJEhEKCWhhbmRsZXJJRBgCIAEoCRIvCg9hdmF0YXJOZXRT", + "dGF0dXMYAyABKA4yFi5FdmVudC5BdmF0YXJOZXRTdGF0dXMSDQoFc3RhbmQY", + "BCABKAUSEwoLaGlnaGVzdEJhbmQYBSABKAUSDQoFcG9pbnQYBiABKAESEQoJ", + "aGl0UG9pbnRzGAcgASgBEhAKCGlzRmFpbGVkGAggASgIEhIKCmxhc3RKdWRn", + "ZWQYCSABKAUSIwoIZHJhd2luZ3MYCiADKAsyES5FdmVudC5OZXREcmF3aW5n", + "EjEKEGRyYXdpbmdDb21wb25lbnQYCyABKAsyFy5FdmVudC5EcmF3aW5nQ29t", + "cG9uZW50Eg0KBXRpdGxlGAwgASgJEg4KBmFydGlzdBgNIAEoCRINCgVnZW5y", + "ZRgOIAEoCRINCgVsZXZlbBgPIAEoBRIRCglsZXZlbFRleHQYECABKAkSEwoL", + "d2FudExldmVsSUQYESABKAkSEAoIYXV0b01vZGUYEiABKAUSFAoMbm90ZVNh", + "bHRNb2RlGBMgASgFEhcKD2F1ZGlvTXVsdGlwbGllchgUIAEoARIVCg1mYWlu", + "dE5vdGVNb2RlGBUgASgFEhQKDGp1ZGdtZW50TW9kZRgWIAEoBRIVCg1oaXRQ", + "b2ludHNNb2RlGBcgASgFEhgKEG5vdGVNb2JpbGl0eU1vZGUYGCABKAUSFAoM", + "bG9uZ05vdGVNb2RlGBkgASgFEhYKDmlucHV0RmF2b3JNb2RlGBogASgFEhYK", + "Dm5vdGVNb2RpZnlNb2RlGBsgASgFEg8KB2JwbU1vZGUYHCABKAUSEAoId2F2", + "ZU1vZGUYHSABKAUSEwoLc2V0Tm90ZU1vZGUYHiABKAUSIwobbG93ZXN0SnVk", + "Z21lbnRDb25kaXRpb25Nb2RlGB8gASgFEhIKCnRvdGFsTm90ZXMYICABKAUS", + "FQoNanVkZ21lbnRTdGFnZRghIAEoARIWCg5oaXRQb2ludHNWYWx1ZRgiIAEo", + "ARIZChFoaWdoZXN0SW5wdXRDb3VudBgjIAEoBRIOCgZsZW5ndGgYJCABKAES", + "CwoDYnBtGCUgASgBEhIKCm11bHRpcGxpZXIYJiABKAESEQoJaW5wdXRNb2Rl", + "GCcgASgFEhgKEGhpZ2hlc3RKdWRnbWVudDAYKCABKAESFwoPaGlnaGVySnVk", + "Z21lbnQwGCkgASgBEhUKDWhpZ2hKdWRnbWVudDAYKiABKAESFAoMbG93SnVk", + "Z21lbnQwGCsgASgBEhYKDmxvd2VySnVkZ21lbnQwGCwgASgBEhcKD2xvd2Vz", + "dEp1ZGdtZW50MBgtIAEoARIYChBoaWdoZXN0SnVkZ21lbnQxGC4gASgBEhcK", + "D2hpZ2hlckp1ZGdtZW50MRgvIAEoARIVCg1oaWdoSnVkZ21lbnQxGDAgASgB", + "EhQKDGxvd0p1ZGdtZW50MRgxIAEoARIWCg5sb3dlckp1ZGdtZW50MRgyIAEo", + "ARIXCg9sb3dlc3RKdWRnbWVudDEYMyABKAESFwoPaGlnaGVzdEp1ZGdtZW50", + "GDQgASgFEhYKDmhpZ2hlckp1ZGdtZW50GDUgASgFEhQKDGhpZ2hKdWRnbWVu", + "dBg2IAEoBRITCgtsb3dKdWRnbWVudBg3IAEoBRIVCg1sb3dlckp1ZGdtZW50", + "GDggASgFEhYKDmxvd2VzdEp1ZGdtZW50GDkgASgFGr4BCgpOZXREcmF3aW5n", + "EjEKDmRyYXdpbmdWYXJpZXR5GAEgASgOMhkuRXZlbnQuTmV0RHJhd2luZy5W", + "YXJpZXR5Eg0KBXBhcmFtGAIgASgNEhEKCXBvc2l0aW9uMBgDIAEoARIRCglw", + "b3NpdGlvbjEYBCABKAESDgoGbGVuZ3RoGAUgASgBEg4KBmhlaWdodBgGIAEo", + "ASIoCgdWYXJpZXR5EggKBE5vdGUQABIICgRNYWluEAESCQoFTWV0ZXIQAhpH", + "ChBEcmF3aW5nQ29tcG9uZW50EhUKDXAyQnVpbHRMZW5ndGgYASABKAISHAoU", + "anVkZ21lbnRNYWluUG9zaXRpb24YAiABKAIaVQoPUXdpbGlnaHRJT0lucHV0", + "EhEKCWF2YXRhcklEcxgBIAMoCRIRCgloYW5kbGVySUQYAiABKAkSDQoFaW5w", + "dXQYAyABKAUSDQoFcG93ZXIYBCABKAUaQgoPVHdpbGlnaHRJT0lucHV0EhEK", + "CWhhbmRsZXJJRBgBIAEoCRINCgVpbnB1dBgCIAEoBRINCgVwb3dlchgDIAEo", + "BRpXCg9Rd2lsaWdodElPSnVkZ2USEQoJYXZhdGFySURzGAEgAygJEhEKCWhh", + "bmRsZXJJRBgCIAEoCRIOCgZub3RlSUQYAyABKAUSDgoGanVkZ2VkGAQgASgF", + "GkQKD1R3aWxpZ2h0SU9KdWRnZRIRCgloYW5kbGVySUQYASABKAkSDgoGbm90", + "ZUlEGAIgASgFEg4KBmp1ZGdlZBgDIAEoBRp1ChdRd2lsaWdodElPSnVkZ21l", + "bnRNZXRlchIRCglhdmF0YXJJRHMYASADKAkSEQoJaGFuZGxlcklEGAIgASgJ", + "Eg0KBWlucHV0GAMgASgFEhUKDWp1ZGdtZW50TWV0ZXIYBCABKAESDgoGYXNz", + "aXN0GAUgASgFGmIKF1R3aWxpZ2h0SU9KdWRnbWVudE1ldGVyEhEKCWhhbmRs", + "ZXJJRBgBIAEoCRINCgVpbnB1dBgCIAEoBRIVCg1qdWRnbWVudE1ldGVyGAMg", + "ASgBEg4KBmFzc2lzdBgEIAEoBRqEAQoYUXdpbGlnaHRJT05vdGVWaXNpYmls", + "aXR5EhEKCWF2YXRhcklEcxgBIAMoCRIRCgloYW5kbGVySUQYAiABKAkSDgoG", + "bm90ZUlEGAMgASgFEhsKE3NldFZhbGlkSnVkZ2VkTm90ZXMYBCABKAgSFQoN", + "c2V0Tm90ZUZhaWxlZBgFIAEoCBpxChhUd2lsaWdodElPTm90ZVZpc2liaWxp", + "dHkSEQoJaGFuZGxlcklEGAEgASgJEg4KBm5vdGVJRBgCIAEoBRIbChNzZXRW", + "YWxpZEp1ZGdlZE5vdGVzGAMgASgIEhUKDXNldE5vdGVGYWlsZWQYBCABKAga", + "UAoUUXdpbGlnaHRJT011bHRpcGxpZXISEQoJYXZhdGFySURzGAEgAygJEhEK", + "CWhhbmRsZXJJRBgCIAEoCRISCgptdWx0aXBsaWVyGAMgASgBGj0KFFR3aWxp", + "Z2h0SU9NdWx0aXBsaWVyEhEKCWhhbmRsZXJJRBgBIAEoCRISCgptdWx0aXBs", + "aWVyGAIgASgBGloKGVF3aWxpZ2h0SU9BdWRpb011bHRpcGxpZXISEQoJYXZh", + "dGFySURzGAEgAygJEhEKCWhhbmRsZXJJRBgCIAEoCRIXCg9hdWRpb011bHRp", + "cGxpZXIYAyABKAEaRwoZVHdpbGlnaHRJT0F1ZGlvTXVsdGlwbGllchIRCglo", + "YW5kbGVySUQYASABKAkSFwoPYXVkaW9NdWx0aXBsaWVyGAIgASgBGjYKElR3", + "aWxpZ2h0QXVkaW9JbnB1dBIOCgZzaXRlSUQYASABKAkSEAoIYXZhdGFySUQY", + "AiABKAkahgEKEFF3aWxpZ2h0UG9zdEl0ZW0SDgoGc2l0ZUlEGAEgASgJEhEK", + "CWhhbmRsZXJJRBgCIAEoCRISCgpwb3N0ZWRJdGVtGAMgASgFEhIKCmlzUG9z", + "aXRpdmUYBCABKAUSEgoKbG93ZXN0V2FpdBgFIAEoARITCgtoaWdoZXN0V2Fp", + "dBgGIAEoARpbChBUd2lsaWdodFBvc3RJdGVtEhEKCWhhbmRsZXJJRBgBIAEo", + "CRISCgpwb3N0ZWRJdGVtGAIgASgFEhIKCmF2YXRhck5hbWUYAyABKAkSDAoE", + "d2FpdBgEIAEoASI1Cg9BdmF0YXJOZXRTdGF0dXMSCwoHRGVmYXVsdBAAEgkK", + "BUNsZWFyEAESCgoGRmFpbGVkEAIiqg0KB0V2ZW50SUQSCwoHU0lHTl9JThAA", + "Eg8KC05PVF9TSUdOX0lOEAESCwoHV0FSTklORxACEg0KCVNJVEVfWUVMTBAD", + "Eg8KC0NBTExfQlVORExFEAQSEgoOU0FWRV9BU19CVU5ETEUQBRIRCg1TQVZJ", + "TkdfQlVORExFEAYSDwoLV0lQRV9CVU5ETEUQBxIOCgpTRVRfQlVORExFEAgS", + "DwoLQ0FMTF9VQlVOVFUQCRIUChBDQUxMX1NJVEVfQVZBVEFSEAoSCwoHQ09N", + "TUVOVBALEhEKDVNFVF9TSVRVQVRJT04QDBINCglORVdfVElUTEUQDRIWChJT", + "VE9QX1NBVklOR19CVU5ETEUQDhIQCgxTQVZFRF9CVU5ETEUQDxIPCgtTQVZF", + "X0JVTkRMRRAQEg4KCkVOVEVSX1NJVEUQERINCglRVUlUX1NJVEUQEhIPCgtX", + "SVBFX1VCVU5UVRATEgwKCE5FV19TSVRFEBQSDgoKTkVXX1VCVU5UVRAVEhAK", + "DEVYSUxFX0FWQVRBUhAWEhMKD05FV19TSUxFTlRfU0lURRAXEg0KCUVTVEFC", + "TElTSBAYEhIKDkNBTExfQ09ORklHVVJFEBkSEQoNU0VUX0NPTkZJR1VSRRAa", + "Eg8KC05PVElGWV9JTkZPEBsSDAoITEVWWV9ORVQQHBIMCghDT01QSUxFRBAd", + "EgwKCENBTExfTkVUEB4SFgoSU0VUX01PREVfQ09NUE9ORU5UEB8SHAoYU0VU", + "X0ZBVk9SX01PREVfQ09NUE9ORU5UECASGQoVU0VUX1ZBTElEX0hVTlRFUl9N", + "T0RFECESGgoWQ0FMTF9ORVRfU0lURV9DT01NRU5UUxAiEhEKDVNFVF9OT1RF", + "X0ZJTEUQIxIRCg1TRVRfU0lURV9OQU1FECQSEQoNU0VUX1NJVEVfSEFORBAl", + "EgwKCFFVSVRfTkVUECYSFAoQU0FWSU5HX0FTX0JVTkRMRRAnEhMKD1NBVkVE", + "X0FTX0JVTkRMRRAoEhkKFVNUT1BfU0FWSU5HX0FTX0JVTkRMRRApEhUKEVNB", + "VkVfREVGQVVMVF9OT1RFECoSDQoJUE9TVF9GSUxFECsSEwoPU0FWRV9ERUZB", + "VUxUX1VJECwSHgoaU0VUX0ZBVk9SX0FVRElPX01VTFRJUExJRVIQLRIRCg1D", + "QUxMX1NJVEVfTkVUEC4SDgoKTk9USUZZX1lFUxAvEgsKB0NBTExfSU8QMBIV", + "ChFDQUxMX0lPX0NPTVBPTkVOVBAxEg8KC0NPTVBJTEVEX0lPEDISCwoHTEVW", + "WV9JTxAzEgwKCElPX0lOUFVUEDQSDAoISU9fSlVER0UQNRIWChJJT19OT1RF", + "X1ZJU0lCSUxJVFkQNhIVChFJT19KVURHTUVOVF9NRVRFUhA4EhEKDUlPX01V", + "TFRJUExJRVIQORIXChNJT19BVURJT19NVUxUSVBMSUVSEDoSDAoISU9fUEFV", + "U0UQOxILCgdJT19RVUlUEDwSCgoGSU9fTk9UED0SDwoLQVVESU9fSU5QVVQQ", + "PhIcChhDQUxMX1NJVEVfTU9ERV9DT01QT05FTlQQPxIOCgpDT01NRU5UQVJZ", + "EEESDQoJV1dXX0xFVkVMEEISEAoMQVZBVEFSX1RJVExFEEMSHQoZSU5WQUxJ", + "REFURV9BVkFUQVJfRFJBV0lORxBEEhsKF0lOVkFMSURBVEVfQVZBVEFSX1RJ", + "VExFEEUSDAoITEVWRUxfVVAQRhIXChNTRVRfRkFWT1JfTk9URV9GSUxFEEcS", + "EgoOR0VUX1NJVEVfWUVMTFMQSBIQCgxTRVRfTEFOR1VBR0UQSRIRCg1WQUxW", + "RV9DT01NRU5UEEoSDgoKQUJJTElUWV9VUBBLEgkKBUNMT1NFEEwSFAoQVU5B", + "VkFJTEFCTEVfREFURRBNEg8KC0FWQVRBUl9FREdFEE4SGgoWSU5WQUxJREFU", + "RV9BVkFUQVJfRURHRRBPEhkKFUZBSUxFRF9WQUxJREFURV9UT1RFTRBQEhQK", + "EE1PRElGWV9TSVRFX1lFTEwQURISCg5XSVBFX1NJVEVfWUVMTBBSEhoKFkFM", + "UkVBRFlfTE9BRElOR19CVU5ETEUQUxINCglTRVRfRkFWT1IQVBIWChJTRVRf", + "QVVUT19TSVRFX0hBTkQQVRIUChBTRVRfQVZBVEFSX0dST1VQEFYSDQoJUE9T", + "VF9JVEVNEFcSFgoSU0VUX1ZBTElEX05FVF9NT0RFEFgSHgoaU0VUX0FMTE9X", + "RURfUE9TVEFCTEVfSVRFTVMQWUIKCghmYXN0VGV4dEIjCgpuZXQudGFlaHVp", + "QgpFdmVudENsYXNzqgIIUXdpbGlnaHRiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event), global::Qwilight.Event.Parser, new[]{ "Millis", "AvatarID", "EventID", "Text", "Data", "QwilightCallNet", "TwilightCallNet", "QwilightIOInput", "TwilightIOInput", "QwilightIOJudge", "TwilightIOJudge", "QwilightIOJudgmentMeter", "TwilightIOJudgmentMeter", "QwilightIONoteVisibility", "TwilightIONoteVisibility", "QwilightIOMultiplier", "TwilightIOMultiplier", "QwilightIOAudioMultiplier", "TwilightIOAudioMultiplier", "TwilightAudioInput", "QwilightPostItem", "TwilightPostItem" }, new[]{ "FastText" }, new[]{ typeof(global::Qwilight.Event.Types.AvatarNetStatus), typeof(global::Qwilight.Event.Types.EventID) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightCallNet), global::Qwilight.Event.Types.TwilightCallNet.Parser, new[]{ "HandlerID", "Data" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightCallNet.Types.CallNetItem), global::Qwilight.Event.Types.TwilightCallNet.Types.CallNetItem.Parser, new[]{ "AvatarNetStatus", "AvatarID", "AvatarName", "Stand", "Band", "Point", "HitPoints", "IsFailed", "LastJudged", "HitPointsMode", "TargetPosition", "Drawings", "DrawingComponent" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightCallNet), global::Qwilight.Event.Types.QwilightCallNet.Parser, new[]{ "SiteID", "HandlerID", "AvatarNetStatus", "Stand", "HighestBand", "Point", "HitPoints", "IsFailed", "LastJudged", "Drawings", "DrawingComponent", "Title", "Artist", "Genre", "Level", "LevelText", "WantLevelID", "AutoMode", "NoteSaltMode", "AudioMultiplier", "FaintNoteMode", "JudgmentMode", "HitPointsMode", "NoteMobilityMode", "LongNoteMode", "InputFavorMode", "NoteModifyMode", "BpmMode", "WaveMode", "SetNoteMode", "LowestJudgmentConditionMode", "TotalNotes", "JudgmentStage", "HitPointsValue", "HighestInputCount", "Length", "Bpm", "Multiplier", "InputMode", "HighestJudgment0", "HigherJudgment0", "HighJudgment0", "LowJudgment0", "LowerJudgment0", "LowestJudgment0", "HighestJudgment1", "HigherJudgment1", "HighJudgment1", "LowJudgment1", "LowerJudgment1", "LowestJudgment1", "HighestJudgment", "HigherJudgment", "HighJudgment", "LowJudgment", "LowerJudgment", "LowestJudgment" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.NetDrawing), global::Qwilight.Event.Types.NetDrawing.Parser, new[]{ "DrawingVariety", "Param", "Position0", "Position1", "Length", "Height" }, null, new[]{ typeof(global::Qwilight.Event.Types.NetDrawing.Types.Variety) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.DrawingComponent), global::Qwilight.Event.Types.DrawingComponent.Parser, new[]{ "P2BuiltLength", "JudgmentMainPosition" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightIOInput), global::Qwilight.Event.Types.QwilightIOInput.Parser, new[]{ "AvatarIDs", "HandlerID", "Input", "Power" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightIOInput), global::Qwilight.Event.Types.TwilightIOInput.Parser, new[]{ "HandlerID", "Input", "Power" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightIOJudge), global::Qwilight.Event.Types.QwilightIOJudge.Parser, new[]{ "AvatarIDs", "HandlerID", "NoteID", "Judged" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightIOJudge), global::Qwilight.Event.Types.TwilightIOJudge.Parser, new[]{ "HandlerID", "NoteID", "Judged" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightIOJudgmentMeter), global::Qwilight.Event.Types.QwilightIOJudgmentMeter.Parser, new[]{ "AvatarIDs", "HandlerID", "Input", "JudgmentMeter", "Assist" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightIOJudgmentMeter), global::Qwilight.Event.Types.TwilightIOJudgmentMeter.Parser, new[]{ "HandlerID", "Input", "JudgmentMeter", "Assist" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightIONoteVisibility), global::Qwilight.Event.Types.QwilightIONoteVisibility.Parser, new[]{ "AvatarIDs", "HandlerID", "NoteID", "SetValidJudgedNotes", "SetNoteFailed" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightIONoteVisibility), global::Qwilight.Event.Types.TwilightIONoteVisibility.Parser, new[]{ "HandlerID", "NoteID", "SetValidJudgedNotes", "SetNoteFailed" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightIOMultiplier), global::Qwilight.Event.Types.QwilightIOMultiplier.Parser, new[]{ "AvatarIDs", "HandlerID", "Multiplier" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightIOMultiplier), global::Qwilight.Event.Types.TwilightIOMultiplier.Parser, new[]{ "HandlerID", "Multiplier" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightIOAudioMultiplier), global::Qwilight.Event.Types.QwilightIOAudioMultiplier.Parser, new[]{ "AvatarIDs", "HandlerID", "AudioMultiplier" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightIOAudioMultiplier), global::Qwilight.Event.Types.TwilightIOAudioMultiplier.Parser, new[]{ "HandlerID", "AudioMultiplier" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightAudioInput), global::Qwilight.Event.Types.TwilightAudioInput.Parser, new[]{ "SiteID", "AvatarID" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.QwilightPostItem), global::Qwilight.Event.Types.QwilightPostItem.Parser, new[]{ "SiteID", "HandlerID", "PostedItem", "IsPositive", "LowestWait", "HighestWait" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Qwilight.Event.Types.TwilightPostItem), global::Qwilight.Event.Types.TwilightPostItem.Parser, new[]{ "HandlerID", "PostedItem", "AvatarName", "Wait" }, null, null, null, null)}) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class Event : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Event()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.EventReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Event() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Event(Event other) : this() { + millis_ = other.millis_; + avatarID_ = other.avatarID_; + eventID_ = other.eventID_; + text_ = other.text_; + data_ = other.data_.Clone(); + switch (other.FastTextCase) { + case FastTextOneofCase.QwilightCallNet: + QwilightCallNet = other.QwilightCallNet.Clone(); + break; + case FastTextOneofCase.TwilightCallNet: + TwilightCallNet = other.TwilightCallNet.Clone(); + break; + case FastTextOneofCase.QwilightIOInput: + QwilightIOInput = other.QwilightIOInput.Clone(); + break; + case FastTextOneofCase.TwilightIOInput: + TwilightIOInput = other.TwilightIOInput.Clone(); + break; + case FastTextOneofCase.QwilightIOJudge: + QwilightIOJudge = other.QwilightIOJudge.Clone(); + break; + case FastTextOneofCase.TwilightIOJudge: + TwilightIOJudge = other.TwilightIOJudge.Clone(); + break; + case FastTextOneofCase.QwilightIOJudgmentMeter: + QwilightIOJudgmentMeter = other.QwilightIOJudgmentMeter.Clone(); + break; + case FastTextOneofCase.TwilightIOJudgmentMeter: + TwilightIOJudgmentMeter = other.TwilightIOJudgmentMeter.Clone(); + break; + case FastTextOneofCase.QwilightIONoteVisibility: + QwilightIONoteVisibility = other.QwilightIONoteVisibility.Clone(); + break; + case FastTextOneofCase.TwilightIONoteVisibility: + TwilightIONoteVisibility = other.TwilightIONoteVisibility.Clone(); + break; + case FastTextOneofCase.QwilightIOMultiplier: + QwilightIOMultiplier = other.QwilightIOMultiplier.Clone(); + break; + case FastTextOneofCase.TwilightIOMultiplier: + TwilightIOMultiplier = other.TwilightIOMultiplier.Clone(); + break; + case FastTextOneofCase.QwilightIOAudioMultiplier: + QwilightIOAudioMultiplier = other.QwilightIOAudioMultiplier.Clone(); + break; + case FastTextOneofCase.TwilightIOAudioMultiplier: + TwilightIOAudioMultiplier = other.TwilightIOAudioMultiplier.Clone(); + break; + case FastTextOneofCase.TwilightAudioInput: + TwilightAudioInput = other.TwilightAudioInput.Clone(); + break; + case FastTextOneofCase.QwilightPostItem: + QwilightPostItem = other.QwilightPostItem.Clone(); + break; + case FastTextOneofCase.TwilightPostItem: + TwilightPostItem = other.TwilightPostItem.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Event Clone() { + return new Event(this); + } + + /// Field number for the "millis" field. + public const int MillisFieldNumber = 1; + private long millis_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Millis { + get { return millis_; } + set { + millis_ = value; + } + } + + /// Field number for the "avatarID" field. + public const int AvatarIDFieldNumber = 2; + private string avatarID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string AvatarID { + get { return avatarID_; } + set { + avatarID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "eventID" field. + public const int EventIDFieldNumber = 3; + private global::Qwilight.Event.Types.EventID eventID_ = global::Qwilight.Event.Types.EventID.SignIn; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.EventID EventID { + get { return eventID_; } + set { + eventID_ = value; + } + } + + /// Field number for the "text" field. + public const int TextFieldNumber = 4; + private string text_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Text { + get { return text_; } + set { + text_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_data_codec + = pb::FieldCodec.ForBytes(42); + private readonly pbc::RepeatedField data_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Data { + get { return data_; } + } + + /// Field number for the "qwilightCallNet" field. + public const int QwilightCallNetFieldNumber = 6; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightCallNet QwilightCallNet { + get { return fastTextCase_ == FastTextOneofCase.QwilightCallNet ? (global::Qwilight.Event.Types.QwilightCallNet) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightCallNet; + } + } + + /// Field number for the "twilightCallNet" field. + public const int TwilightCallNetFieldNumber = 7; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightCallNet TwilightCallNet { + get { return fastTextCase_ == FastTextOneofCase.TwilightCallNet ? (global::Qwilight.Event.Types.TwilightCallNet) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightCallNet; + } + } + + /// Field number for the "qwilightIOInput" field. + public const int QwilightIOInputFieldNumber = 8; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightIOInput QwilightIOInput { + get { return fastTextCase_ == FastTextOneofCase.QwilightIOInput ? (global::Qwilight.Event.Types.QwilightIOInput) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightIOInput; + } + } + + /// Field number for the "twilightIOInput" field. + public const int TwilightIOInputFieldNumber = 9; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightIOInput TwilightIOInput { + get { return fastTextCase_ == FastTextOneofCase.TwilightIOInput ? (global::Qwilight.Event.Types.TwilightIOInput) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightIOInput; + } + } + + /// Field number for the "qwilightIOJudge" field. + public const int QwilightIOJudgeFieldNumber = 10; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightIOJudge QwilightIOJudge { + get { return fastTextCase_ == FastTextOneofCase.QwilightIOJudge ? (global::Qwilight.Event.Types.QwilightIOJudge) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightIOJudge; + } + } + + /// Field number for the "twilightIOJudge" field. + public const int TwilightIOJudgeFieldNumber = 11; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightIOJudge TwilightIOJudge { + get { return fastTextCase_ == FastTextOneofCase.TwilightIOJudge ? (global::Qwilight.Event.Types.TwilightIOJudge) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightIOJudge; + } + } + + /// Field number for the "qwilightIOJudgmentMeter" field. + public const int QwilightIOJudgmentMeterFieldNumber = 12; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightIOJudgmentMeter QwilightIOJudgmentMeter { + get { return fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter ? (global::Qwilight.Event.Types.QwilightIOJudgmentMeter) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightIOJudgmentMeter; + } + } + + /// Field number for the "twilightIOJudgmentMeter" field. + public const int TwilightIOJudgmentMeterFieldNumber = 13; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightIOJudgmentMeter TwilightIOJudgmentMeter { + get { return fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter ? (global::Qwilight.Event.Types.TwilightIOJudgmentMeter) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightIOJudgmentMeter; + } + } + + /// Field number for the "qwilightIONoteVisibility" field. + public const int QwilightIONoteVisibilityFieldNumber = 14; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightIONoteVisibility QwilightIONoteVisibility { + get { return fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility ? (global::Qwilight.Event.Types.QwilightIONoteVisibility) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightIONoteVisibility; + } + } + + /// Field number for the "twilightIONoteVisibility" field. + public const int TwilightIONoteVisibilityFieldNumber = 15; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightIONoteVisibility TwilightIONoteVisibility { + get { return fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility ? (global::Qwilight.Event.Types.TwilightIONoteVisibility) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightIONoteVisibility; + } + } + + /// Field number for the "qwilightIOMultiplier" field. + public const int QwilightIOMultiplierFieldNumber = 16; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightIOMultiplier QwilightIOMultiplier { + get { return fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier ? (global::Qwilight.Event.Types.QwilightIOMultiplier) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightIOMultiplier; + } + } + + /// Field number for the "twilightIOMultiplier" field. + public const int TwilightIOMultiplierFieldNumber = 17; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightIOMultiplier TwilightIOMultiplier { + get { return fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier ? (global::Qwilight.Event.Types.TwilightIOMultiplier) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightIOMultiplier; + } + } + + /// Field number for the "qwilightIOAudioMultiplier" field. + public const int QwilightIOAudioMultiplierFieldNumber = 18; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightIOAudioMultiplier QwilightIOAudioMultiplier { + get { return fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier ? (global::Qwilight.Event.Types.QwilightIOAudioMultiplier) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightIOAudioMultiplier; + } + } + + /// Field number for the "twilightIOAudioMultiplier" field. + public const int TwilightIOAudioMultiplierFieldNumber = 19; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightIOAudioMultiplier TwilightIOAudioMultiplier { + get { return fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier ? (global::Qwilight.Event.Types.TwilightIOAudioMultiplier) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightIOAudioMultiplier; + } + } + + /// Field number for the "twilightAudioInput" field. + public const int TwilightAudioInputFieldNumber = 20; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightAudioInput TwilightAudioInput { + get { return fastTextCase_ == FastTextOneofCase.TwilightAudioInput ? (global::Qwilight.Event.Types.TwilightAudioInput) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightAudioInput; + } + } + + /// Field number for the "qwilightPostItem" field. + public const int QwilightPostItemFieldNumber = 21; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.QwilightPostItem QwilightPostItem { + get { return fastTextCase_ == FastTextOneofCase.QwilightPostItem ? (global::Qwilight.Event.Types.QwilightPostItem) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.QwilightPostItem; + } + } + + /// Field number for the "twilightPostItem" field. + public const int TwilightPostItemFieldNumber = 22; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.TwilightPostItem TwilightPostItem { + get { return fastTextCase_ == FastTextOneofCase.TwilightPostItem ? (global::Qwilight.Event.Types.TwilightPostItem) fastText_ : null; } + set { + fastText_ = value; + fastTextCase_ = value == null ? FastTextOneofCase.None : FastTextOneofCase.TwilightPostItem; + } + } + + private object fastText_; + /// Enum of possible cases for the "fastText" oneof. + public enum FastTextOneofCase { + None = 0, + QwilightCallNet = 6, + TwilightCallNet = 7, + QwilightIOInput = 8, + TwilightIOInput = 9, + QwilightIOJudge = 10, + TwilightIOJudge = 11, + QwilightIOJudgmentMeter = 12, + TwilightIOJudgmentMeter = 13, + QwilightIONoteVisibility = 14, + TwilightIONoteVisibility = 15, + QwilightIOMultiplier = 16, + TwilightIOMultiplier = 17, + QwilightIOAudioMultiplier = 18, + TwilightIOAudioMultiplier = 19, + TwilightAudioInput = 20, + QwilightPostItem = 21, + TwilightPostItem = 22, + } + private FastTextOneofCase fastTextCase_ = FastTextOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FastTextOneofCase FastTextCase { + get { return fastTextCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearFastText() { + fastTextCase_ = FastTextOneofCase.None; + fastText_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Event); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Event other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Millis != other.Millis) return false; + if (AvatarID != other.AvatarID) return false; + if (EventID != other.EventID) return false; + if (Text != other.Text) return false; + if(!data_.Equals(other.data_)) return false; + if (!object.Equals(QwilightCallNet, other.QwilightCallNet)) return false; + if (!object.Equals(TwilightCallNet, other.TwilightCallNet)) return false; + if (!object.Equals(QwilightIOInput, other.QwilightIOInput)) return false; + if (!object.Equals(TwilightIOInput, other.TwilightIOInput)) return false; + if (!object.Equals(QwilightIOJudge, other.QwilightIOJudge)) return false; + if (!object.Equals(TwilightIOJudge, other.TwilightIOJudge)) return false; + if (!object.Equals(QwilightIOJudgmentMeter, other.QwilightIOJudgmentMeter)) return false; + if (!object.Equals(TwilightIOJudgmentMeter, other.TwilightIOJudgmentMeter)) return false; + if (!object.Equals(QwilightIONoteVisibility, other.QwilightIONoteVisibility)) return false; + if (!object.Equals(TwilightIONoteVisibility, other.TwilightIONoteVisibility)) return false; + if (!object.Equals(QwilightIOMultiplier, other.QwilightIOMultiplier)) return false; + if (!object.Equals(TwilightIOMultiplier, other.TwilightIOMultiplier)) return false; + if (!object.Equals(QwilightIOAudioMultiplier, other.QwilightIOAudioMultiplier)) return false; + if (!object.Equals(TwilightIOAudioMultiplier, other.TwilightIOAudioMultiplier)) return false; + if (!object.Equals(TwilightAudioInput, other.TwilightAudioInput)) return false; + if (!object.Equals(QwilightPostItem, other.QwilightPostItem)) return false; + if (!object.Equals(TwilightPostItem, other.TwilightPostItem)) return false; + if (FastTextCase != other.FastTextCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Millis != 0L) hash ^= Millis.GetHashCode(); + if (AvatarID.Length != 0) hash ^= AvatarID.GetHashCode(); + if (EventID != global::Qwilight.Event.Types.EventID.SignIn) hash ^= EventID.GetHashCode(); + if (Text.Length != 0) hash ^= Text.GetHashCode(); + hash ^= data_.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightCallNet) hash ^= QwilightCallNet.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightCallNet) hash ^= TwilightCallNet.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOInput) hash ^= QwilightIOInput.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOInput) hash ^= TwilightIOInput.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudge) hash ^= QwilightIOJudge.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudge) hash ^= TwilightIOJudge.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter) hash ^= QwilightIOJudgmentMeter.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter) hash ^= TwilightIOJudgmentMeter.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility) hash ^= QwilightIONoteVisibility.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility) hash ^= TwilightIONoteVisibility.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier) hash ^= QwilightIOMultiplier.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier) hash ^= TwilightIOMultiplier.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier) hash ^= QwilightIOAudioMultiplier.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier) hash ^= TwilightIOAudioMultiplier.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightAudioInput) hash ^= TwilightAudioInput.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.QwilightPostItem) hash ^= QwilightPostItem.GetHashCode(); + if (fastTextCase_ == FastTextOneofCase.TwilightPostItem) hash ^= TwilightPostItem.GetHashCode(); + hash ^= (int) fastTextCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Millis != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Millis); + } + if (AvatarID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AvatarID); + } + if (EventID != global::Qwilight.Event.Types.EventID.SignIn) { + output.WriteRawTag(24); + output.WriteEnum((int) EventID); + } + if (Text.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Text); + } + data_.WriteTo(output, _repeated_data_codec); + if (fastTextCase_ == FastTextOneofCase.QwilightCallNet) { + output.WriteRawTag(50); + output.WriteMessage(QwilightCallNet); + } + if (fastTextCase_ == FastTextOneofCase.TwilightCallNet) { + output.WriteRawTag(58); + output.WriteMessage(TwilightCallNet); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOInput) { + output.WriteRawTag(66); + output.WriteMessage(QwilightIOInput); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOInput) { + output.WriteRawTag(74); + output.WriteMessage(TwilightIOInput); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudge) { + output.WriteRawTag(82); + output.WriteMessage(QwilightIOJudge); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudge) { + output.WriteRawTag(90); + output.WriteMessage(TwilightIOJudge); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter) { + output.WriteRawTag(98); + output.WriteMessage(QwilightIOJudgmentMeter); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter) { + output.WriteRawTag(106); + output.WriteMessage(TwilightIOJudgmentMeter); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility) { + output.WriteRawTag(114); + output.WriteMessage(QwilightIONoteVisibility); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility) { + output.WriteRawTag(122); + output.WriteMessage(TwilightIONoteVisibility); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier) { + output.WriteRawTag(130, 1); + output.WriteMessage(QwilightIOMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier) { + output.WriteRawTag(138, 1); + output.WriteMessage(TwilightIOMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier) { + output.WriteRawTag(146, 1); + output.WriteMessage(QwilightIOAudioMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier) { + output.WriteRawTag(154, 1); + output.WriteMessage(TwilightIOAudioMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightAudioInput) { + output.WriteRawTag(162, 1); + output.WriteMessage(TwilightAudioInput); + } + if (fastTextCase_ == FastTextOneofCase.QwilightPostItem) { + output.WriteRawTag(170, 1); + output.WriteMessage(QwilightPostItem); + } + if (fastTextCase_ == FastTextOneofCase.TwilightPostItem) { + output.WriteRawTag(178, 1); + output.WriteMessage(TwilightPostItem); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Millis != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Millis); + } + if (AvatarID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AvatarID); + } + if (EventID != global::Qwilight.Event.Types.EventID.SignIn) { + output.WriteRawTag(24); + output.WriteEnum((int) EventID); + } + if (Text.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Text); + } + data_.WriteTo(ref output, _repeated_data_codec); + if (fastTextCase_ == FastTextOneofCase.QwilightCallNet) { + output.WriteRawTag(50); + output.WriteMessage(QwilightCallNet); + } + if (fastTextCase_ == FastTextOneofCase.TwilightCallNet) { + output.WriteRawTag(58); + output.WriteMessage(TwilightCallNet); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOInput) { + output.WriteRawTag(66); + output.WriteMessage(QwilightIOInput); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOInput) { + output.WriteRawTag(74); + output.WriteMessage(TwilightIOInput); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudge) { + output.WriteRawTag(82); + output.WriteMessage(QwilightIOJudge); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudge) { + output.WriteRawTag(90); + output.WriteMessage(TwilightIOJudge); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter) { + output.WriteRawTag(98); + output.WriteMessage(QwilightIOJudgmentMeter); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter) { + output.WriteRawTag(106); + output.WriteMessage(TwilightIOJudgmentMeter); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility) { + output.WriteRawTag(114); + output.WriteMessage(QwilightIONoteVisibility); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility) { + output.WriteRawTag(122); + output.WriteMessage(TwilightIONoteVisibility); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier) { + output.WriteRawTag(130, 1); + output.WriteMessage(QwilightIOMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier) { + output.WriteRawTag(138, 1); + output.WriteMessage(TwilightIOMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier) { + output.WriteRawTag(146, 1); + output.WriteMessage(QwilightIOAudioMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier) { + output.WriteRawTag(154, 1); + output.WriteMessage(TwilightIOAudioMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightAudioInput) { + output.WriteRawTag(162, 1); + output.WriteMessage(TwilightAudioInput); + } + if (fastTextCase_ == FastTextOneofCase.QwilightPostItem) { + output.WriteRawTag(170, 1); + output.WriteMessage(QwilightPostItem); + } + if (fastTextCase_ == FastTextOneofCase.TwilightPostItem) { + output.WriteRawTag(178, 1); + output.WriteMessage(TwilightPostItem); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Millis != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Millis); + } + if (AvatarID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AvatarID); + } + if (EventID != global::Qwilight.Event.Types.EventID.SignIn) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EventID); + } + if (Text.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); + } + size += data_.CalculateSize(_repeated_data_codec); + if (fastTextCase_ == FastTextOneofCase.QwilightCallNet) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(QwilightCallNet); + } + if (fastTextCase_ == FastTextOneofCase.TwilightCallNet) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TwilightCallNet); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOInput) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(QwilightIOInput); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOInput) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TwilightIOInput); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudge) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(QwilightIOJudge); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudge) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TwilightIOJudge); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(QwilightIOJudgmentMeter); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TwilightIOJudgmentMeter); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(QwilightIONoteVisibility); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TwilightIONoteVisibility); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(QwilightIOMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(TwilightIOMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(QwilightIOAudioMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(TwilightIOAudioMultiplier); + } + if (fastTextCase_ == FastTextOneofCase.TwilightAudioInput) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(TwilightAudioInput); + } + if (fastTextCase_ == FastTextOneofCase.QwilightPostItem) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(QwilightPostItem); + } + if (fastTextCase_ == FastTextOneofCase.TwilightPostItem) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(TwilightPostItem); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Event other) { + if (other == null) { + return; + } + if (other.Millis != 0L) { + Millis = other.Millis; + } + if (other.AvatarID.Length != 0) { + AvatarID = other.AvatarID; + } + if (other.EventID != global::Qwilight.Event.Types.EventID.SignIn) { + EventID = other.EventID; + } + if (other.Text.Length != 0) { + Text = other.Text; + } + data_.Add(other.data_); + switch (other.FastTextCase) { + case FastTextOneofCase.QwilightCallNet: + if (QwilightCallNet == null) { + QwilightCallNet = new global::Qwilight.Event.Types.QwilightCallNet(); + } + QwilightCallNet.MergeFrom(other.QwilightCallNet); + break; + case FastTextOneofCase.TwilightCallNet: + if (TwilightCallNet == null) { + TwilightCallNet = new global::Qwilight.Event.Types.TwilightCallNet(); + } + TwilightCallNet.MergeFrom(other.TwilightCallNet); + break; + case FastTextOneofCase.QwilightIOInput: + if (QwilightIOInput == null) { + QwilightIOInput = new global::Qwilight.Event.Types.QwilightIOInput(); + } + QwilightIOInput.MergeFrom(other.QwilightIOInput); + break; + case FastTextOneofCase.TwilightIOInput: + if (TwilightIOInput == null) { + TwilightIOInput = new global::Qwilight.Event.Types.TwilightIOInput(); + } + TwilightIOInput.MergeFrom(other.TwilightIOInput); + break; + case FastTextOneofCase.QwilightIOJudge: + if (QwilightIOJudge == null) { + QwilightIOJudge = new global::Qwilight.Event.Types.QwilightIOJudge(); + } + QwilightIOJudge.MergeFrom(other.QwilightIOJudge); + break; + case FastTextOneofCase.TwilightIOJudge: + if (TwilightIOJudge == null) { + TwilightIOJudge = new global::Qwilight.Event.Types.TwilightIOJudge(); + } + TwilightIOJudge.MergeFrom(other.TwilightIOJudge); + break; + case FastTextOneofCase.QwilightIOJudgmentMeter: + if (QwilightIOJudgmentMeter == null) { + QwilightIOJudgmentMeter = new global::Qwilight.Event.Types.QwilightIOJudgmentMeter(); + } + QwilightIOJudgmentMeter.MergeFrom(other.QwilightIOJudgmentMeter); + break; + case FastTextOneofCase.TwilightIOJudgmentMeter: + if (TwilightIOJudgmentMeter == null) { + TwilightIOJudgmentMeter = new global::Qwilight.Event.Types.TwilightIOJudgmentMeter(); + } + TwilightIOJudgmentMeter.MergeFrom(other.TwilightIOJudgmentMeter); + break; + case FastTextOneofCase.QwilightIONoteVisibility: + if (QwilightIONoteVisibility == null) { + QwilightIONoteVisibility = new global::Qwilight.Event.Types.QwilightIONoteVisibility(); + } + QwilightIONoteVisibility.MergeFrom(other.QwilightIONoteVisibility); + break; + case FastTextOneofCase.TwilightIONoteVisibility: + if (TwilightIONoteVisibility == null) { + TwilightIONoteVisibility = new global::Qwilight.Event.Types.TwilightIONoteVisibility(); + } + TwilightIONoteVisibility.MergeFrom(other.TwilightIONoteVisibility); + break; + case FastTextOneofCase.QwilightIOMultiplier: + if (QwilightIOMultiplier == null) { + QwilightIOMultiplier = new global::Qwilight.Event.Types.QwilightIOMultiplier(); + } + QwilightIOMultiplier.MergeFrom(other.QwilightIOMultiplier); + break; + case FastTextOneofCase.TwilightIOMultiplier: + if (TwilightIOMultiplier == null) { + TwilightIOMultiplier = new global::Qwilight.Event.Types.TwilightIOMultiplier(); + } + TwilightIOMultiplier.MergeFrom(other.TwilightIOMultiplier); + break; + case FastTextOneofCase.QwilightIOAudioMultiplier: + if (QwilightIOAudioMultiplier == null) { + QwilightIOAudioMultiplier = new global::Qwilight.Event.Types.QwilightIOAudioMultiplier(); + } + QwilightIOAudioMultiplier.MergeFrom(other.QwilightIOAudioMultiplier); + break; + case FastTextOneofCase.TwilightIOAudioMultiplier: + if (TwilightIOAudioMultiplier == null) { + TwilightIOAudioMultiplier = new global::Qwilight.Event.Types.TwilightIOAudioMultiplier(); + } + TwilightIOAudioMultiplier.MergeFrom(other.TwilightIOAudioMultiplier); + break; + case FastTextOneofCase.TwilightAudioInput: + if (TwilightAudioInput == null) { + TwilightAudioInput = new global::Qwilight.Event.Types.TwilightAudioInput(); + } + TwilightAudioInput.MergeFrom(other.TwilightAudioInput); + break; + case FastTextOneofCase.QwilightPostItem: + if (QwilightPostItem == null) { + QwilightPostItem = new global::Qwilight.Event.Types.QwilightPostItem(); + } + QwilightPostItem.MergeFrom(other.QwilightPostItem); + break; + case FastTextOneofCase.TwilightPostItem: + if (TwilightPostItem == null) { + TwilightPostItem = new global::Qwilight.Event.Types.TwilightPostItem(); + } + TwilightPostItem.MergeFrom(other.TwilightPostItem); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Millis = input.ReadInt64(); + break; + } + case 18: { + AvatarID = input.ReadString(); + break; + } + case 24: { + EventID = (global::Qwilight.Event.Types.EventID) input.ReadEnum(); + break; + } + case 34: { + Text = input.ReadString(); + break; + } + case 42: { + data_.AddEntriesFrom(input, _repeated_data_codec); + break; + } + case 50: { + global::Qwilight.Event.Types.QwilightCallNet subBuilder = new global::Qwilight.Event.Types.QwilightCallNet(); + if (fastTextCase_ == FastTextOneofCase.QwilightCallNet) { + subBuilder.MergeFrom(QwilightCallNet); + } + input.ReadMessage(subBuilder); + QwilightCallNet = subBuilder; + break; + } + case 58: { + global::Qwilight.Event.Types.TwilightCallNet subBuilder = new global::Qwilight.Event.Types.TwilightCallNet(); + if (fastTextCase_ == FastTextOneofCase.TwilightCallNet) { + subBuilder.MergeFrom(TwilightCallNet); + } + input.ReadMessage(subBuilder); + TwilightCallNet = subBuilder; + break; + } + case 66: { + global::Qwilight.Event.Types.QwilightIOInput subBuilder = new global::Qwilight.Event.Types.QwilightIOInput(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOInput) { + subBuilder.MergeFrom(QwilightIOInput); + } + input.ReadMessage(subBuilder); + QwilightIOInput = subBuilder; + break; + } + case 74: { + global::Qwilight.Event.Types.TwilightIOInput subBuilder = new global::Qwilight.Event.Types.TwilightIOInput(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOInput) { + subBuilder.MergeFrom(TwilightIOInput); + } + input.ReadMessage(subBuilder); + TwilightIOInput = subBuilder; + break; + } + case 82: { + global::Qwilight.Event.Types.QwilightIOJudge subBuilder = new global::Qwilight.Event.Types.QwilightIOJudge(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudge) { + subBuilder.MergeFrom(QwilightIOJudge); + } + input.ReadMessage(subBuilder); + QwilightIOJudge = subBuilder; + break; + } + case 90: { + global::Qwilight.Event.Types.TwilightIOJudge subBuilder = new global::Qwilight.Event.Types.TwilightIOJudge(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudge) { + subBuilder.MergeFrom(TwilightIOJudge); + } + input.ReadMessage(subBuilder); + TwilightIOJudge = subBuilder; + break; + } + case 98: { + global::Qwilight.Event.Types.QwilightIOJudgmentMeter subBuilder = new global::Qwilight.Event.Types.QwilightIOJudgmentMeter(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter) { + subBuilder.MergeFrom(QwilightIOJudgmentMeter); + } + input.ReadMessage(subBuilder); + QwilightIOJudgmentMeter = subBuilder; + break; + } + case 106: { + global::Qwilight.Event.Types.TwilightIOJudgmentMeter subBuilder = new global::Qwilight.Event.Types.TwilightIOJudgmentMeter(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter) { + subBuilder.MergeFrom(TwilightIOJudgmentMeter); + } + input.ReadMessage(subBuilder); + TwilightIOJudgmentMeter = subBuilder; + break; + } + case 114: { + global::Qwilight.Event.Types.QwilightIONoteVisibility subBuilder = new global::Qwilight.Event.Types.QwilightIONoteVisibility(); + if (fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility) { + subBuilder.MergeFrom(QwilightIONoteVisibility); + } + input.ReadMessage(subBuilder); + QwilightIONoteVisibility = subBuilder; + break; + } + case 122: { + global::Qwilight.Event.Types.TwilightIONoteVisibility subBuilder = new global::Qwilight.Event.Types.TwilightIONoteVisibility(); + if (fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility) { + subBuilder.MergeFrom(TwilightIONoteVisibility); + } + input.ReadMessage(subBuilder); + TwilightIONoteVisibility = subBuilder; + break; + } + case 130: { + global::Qwilight.Event.Types.QwilightIOMultiplier subBuilder = new global::Qwilight.Event.Types.QwilightIOMultiplier(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier) { + subBuilder.MergeFrom(QwilightIOMultiplier); + } + input.ReadMessage(subBuilder); + QwilightIOMultiplier = subBuilder; + break; + } + case 138: { + global::Qwilight.Event.Types.TwilightIOMultiplier subBuilder = new global::Qwilight.Event.Types.TwilightIOMultiplier(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier) { + subBuilder.MergeFrom(TwilightIOMultiplier); + } + input.ReadMessage(subBuilder); + TwilightIOMultiplier = subBuilder; + break; + } + case 146: { + global::Qwilight.Event.Types.QwilightIOAudioMultiplier subBuilder = new global::Qwilight.Event.Types.QwilightIOAudioMultiplier(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier) { + subBuilder.MergeFrom(QwilightIOAudioMultiplier); + } + input.ReadMessage(subBuilder); + QwilightIOAudioMultiplier = subBuilder; + break; + } + case 154: { + global::Qwilight.Event.Types.TwilightIOAudioMultiplier subBuilder = new global::Qwilight.Event.Types.TwilightIOAudioMultiplier(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier) { + subBuilder.MergeFrom(TwilightIOAudioMultiplier); + } + input.ReadMessage(subBuilder); + TwilightIOAudioMultiplier = subBuilder; + break; + } + case 162: { + global::Qwilight.Event.Types.TwilightAudioInput subBuilder = new global::Qwilight.Event.Types.TwilightAudioInput(); + if (fastTextCase_ == FastTextOneofCase.TwilightAudioInput) { + subBuilder.MergeFrom(TwilightAudioInput); + } + input.ReadMessage(subBuilder); + TwilightAudioInput = subBuilder; + break; + } + case 170: { + global::Qwilight.Event.Types.QwilightPostItem subBuilder = new global::Qwilight.Event.Types.QwilightPostItem(); + if (fastTextCase_ == FastTextOneofCase.QwilightPostItem) { + subBuilder.MergeFrom(QwilightPostItem); + } + input.ReadMessage(subBuilder); + QwilightPostItem = subBuilder; + break; + } + case 178: { + global::Qwilight.Event.Types.TwilightPostItem subBuilder = new global::Qwilight.Event.Types.TwilightPostItem(); + if (fastTextCase_ == FastTextOneofCase.TwilightPostItem) { + subBuilder.MergeFrom(TwilightPostItem); + } + input.ReadMessage(subBuilder); + TwilightPostItem = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Millis = input.ReadInt64(); + break; + } + case 18: { + AvatarID = input.ReadString(); + break; + } + case 24: { + EventID = (global::Qwilight.Event.Types.EventID) input.ReadEnum(); + break; + } + case 34: { + Text = input.ReadString(); + break; + } + case 42: { + data_.AddEntriesFrom(ref input, _repeated_data_codec); + break; + } + case 50: { + global::Qwilight.Event.Types.QwilightCallNet subBuilder = new global::Qwilight.Event.Types.QwilightCallNet(); + if (fastTextCase_ == FastTextOneofCase.QwilightCallNet) { + subBuilder.MergeFrom(QwilightCallNet); + } + input.ReadMessage(subBuilder); + QwilightCallNet = subBuilder; + break; + } + case 58: { + global::Qwilight.Event.Types.TwilightCallNet subBuilder = new global::Qwilight.Event.Types.TwilightCallNet(); + if (fastTextCase_ == FastTextOneofCase.TwilightCallNet) { + subBuilder.MergeFrom(TwilightCallNet); + } + input.ReadMessage(subBuilder); + TwilightCallNet = subBuilder; + break; + } + case 66: { + global::Qwilight.Event.Types.QwilightIOInput subBuilder = new global::Qwilight.Event.Types.QwilightIOInput(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOInput) { + subBuilder.MergeFrom(QwilightIOInput); + } + input.ReadMessage(subBuilder); + QwilightIOInput = subBuilder; + break; + } + case 74: { + global::Qwilight.Event.Types.TwilightIOInput subBuilder = new global::Qwilight.Event.Types.TwilightIOInput(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOInput) { + subBuilder.MergeFrom(TwilightIOInput); + } + input.ReadMessage(subBuilder); + TwilightIOInput = subBuilder; + break; + } + case 82: { + global::Qwilight.Event.Types.QwilightIOJudge subBuilder = new global::Qwilight.Event.Types.QwilightIOJudge(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudge) { + subBuilder.MergeFrom(QwilightIOJudge); + } + input.ReadMessage(subBuilder); + QwilightIOJudge = subBuilder; + break; + } + case 90: { + global::Qwilight.Event.Types.TwilightIOJudge subBuilder = new global::Qwilight.Event.Types.TwilightIOJudge(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudge) { + subBuilder.MergeFrom(TwilightIOJudge); + } + input.ReadMessage(subBuilder); + TwilightIOJudge = subBuilder; + break; + } + case 98: { + global::Qwilight.Event.Types.QwilightIOJudgmentMeter subBuilder = new global::Qwilight.Event.Types.QwilightIOJudgmentMeter(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOJudgmentMeter) { + subBuilder.MergeFrom(QwilightIOJudgmentMeter); + } + input.ReadMessage(subBuilder); + QwilightIOJudgmentMeter = subBuilder; + break; + } + case 106: { + global::Qwilight.Event.Types.TwilightIOJudgmentMeter subBuilder = new global::Qwilight.Event.Types.TwilightIOJudgmentMeter(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOJudgmentMeter) { + subBuilder.MergeFrom(TwilightIOJudgmentMeter); + } + input.ReadMessage(subBuilder); + TwilightIOJudgmentMeter = subBuilder; + break; + } + case 114: { + global::Qwilight.Event.Types.QwilightIONoteVisibility subBuilder = new global::Qwilight.Event.Types.QwilightIONoteVisibility(); + if (fastTextCase_ == FastTextOneofCase.QwilightIONoteVisibility) { + subBuilder.MergeFrom(QwilightIONoteVisibility); + } + input.ReadMessage(subBuilder); + QwilightIONoteVisibility = subBuilder; + break; + } + case 122: { + global::Qwilight.Event.Types.TwilightIONoteVisibility subBuilder = new global::Qwilight.Event.Types.TwilightIONoteVisibility(); + if (fastTextCase_ == FastTextOneofCase.TwilightIONoteVisibility) { + subBuilder.MergeFrom(TwilightIONoteVisibility); + } + input.ReadMessage(subBuilder); + TwilightIONoteVisibility = subBuilder; + break; + } + case 130: { + global::Qwilight.Event.Types.QwilightIOMultiplier subBuilder = new global::Qwilight.Event.Types.QwilightIOMultiplier(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOMultiplier) { + subBuilder.MergeFrom(QwilightIOMultiplier); + } + input.ReadMessage(subBuilder); + QwilightIOMultiplier = subBuilder; + break; + } + case 138: { + global::Qwilight.Event.Types.TwilightIOMultiplier subBuilder = new global::Qwilight.Event.Types.TwilightIOMultiplier(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOMultiplier) { + subBuilder.MergeFrom(TwilightIOMultiplier); + } + input.ReadMessage(subBuilder); + TwilightIOMultiplier = subBuilder; + break; + } + case 146: { + global::Qwilight.Event.Types.QwilightIOAudioMultiplier subBuilder = new global::Qwilight.Event.Types.QwilightIOAudioMultiplier(); + if (fastTextCase_ == FastTextOneofCase.QwilightIOAudioMultiplier) { + subBuilder.MergeFrom(QwilightIOAudioMultiplier); + } + input.ReadMessage(subBuilder); + QwilightIOAudioMultiplier = subBuilder; + break; + } + case 154: { + global::Qwilight.Event.Types.TwilightIOAudioMultiplier subBuilder = new global::Qwilight.Event.Types.TwilightIOAudioMultiplier(); + if (fastTextCase_ == FastTextOneofCase.TwilightIOAudioMultiplier) { + subBuilder.MergeFrom(TwilightIOAudioMultiplier); + } + input.ReadMessage(subBuilder); + TwilightIOAudioMultiplier = subBuilder; + break; + } + case 162: { + global::Qwilight.Event.Types.TwilightAudioInput subBuilder = new global::Qwilight.Event.Types.TwilightAudioInput(); + if (fastTextCase_ == FastTextOneofCase.TwilightAudioInput) { + subBuilder.MergeFrom(TwilightAudioInput); + } + input.ReadMessage(subBuilder); + TwilightAudioInput = subBuilder; + break; + } + case 170: { + global::Qwilight.Event.Types.QwilightPostItem subBuilder = new global::Qwilight.Event.Types.QwilightPostItem(); + if (fastTextCase_ == FastTextOneofCase.QwilightPostItem) { + subBuilder.MergeFrom(QwilightPostItem); + } + input.ReadMessage(subBuilder); + QwilightPostItem = subBuilder; + break; + } + case 178: { + global::Qwilight.Event.Types.TwilightPostItem subBuilder = new global::Qwilight.Event.Types.TwilightPostItem(); + if (fastTextCase_ == FastTextOneofCase.TwilightPostItem) { + subBuilder.MergeFrom(TwilightPostItem); + } + input.ReadMessage(subBuilder); + TwilightPostItem = subBuilder; + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the Event message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum AvatarNetStatus { + [pbr::OriginalName("Default")] Default = 0, + [pbr::OriginalName("Clear")] Clear = 1, + [pbr::OriginalName("Failed")] Failed = 2, + } + + public enum EventID { + [pbr::OriginalName("SIGN_IN")] SignIn = 0, + [pbr::OriginalName("NOT_SIGN_IN")] NotSignIn = 1, + [pbr::OriginalName("WARNING")] Warning = 2, + [pbr::OriginalName("SITE_YELL")] SiteYell = 3, + [pbr::OriginalName("CALL_BUNDLE")] CallBundle = 4, + [pbr::OriginalName("SAVE_AS_BUNDLE")] SaveAsBundle = 5, + [pbr::OriginalName("SAVING_BUNDLE")] SavingBundle = 6, + [pbr::OriginalName("WIPE_BUNDLE")] WipeBundle = 7, + [pbr::OriginalName("SET_BUNDLE")] SetBundle = 8, + [pbr::OriginalName("CALL_UBUNTU")] CallUbuntu = 9, + [pbr::OriginalName("CALL_SITE_AVATAR")] CallSiteAvatar = 10, + [pbr::OriginalName("COMMENT")] Comment = 11, + [pbr::OriginalName("SET_SITUATION")] SetSituation = 12, + [pbr::OriginalName("NEW_TITLE")] NewTitle = 13, + [pbr::OriginalName("STOP_SAVING_BUNDLE")] StopSavingBundle = 14, + [pbr::OriginalName("SAVED_BUNDLE")] SavedBundle = 15, + [pbr::OriginalName("SAVE_BUNDLE")] SaveBundle = 16, + [pbr::OriginalName("ENTER_SITE")] EnterSite = 17, + [pbr::OriginalName("QUIT_SITE")] QuitSite = 18, + [pbr::OriginalName("WIPE_UBUNTU")] WipeUbuntu = 19, + [pbr::OriginalName("NEW_SITE")] NewSite = 20, + [pbr::OriginalName("NEW_UBUNTU")] NewUbuntu = 21, + [pbr::OriginalName("EXILE_AVATAR")] ExileAvatar = 22, + [pbr::OriginalName("NEW_SILENT_SITE")] NewSilentSite = 23, + [pbr::OriginalName("ESTABLISH")] Establish = 24, + [pbr::OriginalName("CALL_CONFIGURE")] CallConfigure = 25, + [pbr::OriginalName("SET_CONFIGURE")] SetConfigure = 26, + [pbr::OriginalName("NOTIFY_INFO")] NotifyInfo = 27, + [pbr::OriginalName("LEVY_NET")] LevyNet = 28, + [pbr::OriginalName("COMPILED")] Compiled = 29, + [pbr::OriginalName("CALL_NET")] CallNet = 30, + [pbr::OriginalName("SET_MODE_COMPONENT")] SetModeComponent = 31, + [pbr::OriginalName("SET_FAVOR_MODE_COMPONENT")] SetFavorModeComponent = 32, + [pbr::OriginalName("SET_VALID_HUNTER_MODE")] SetValidHunterMode = 33, + [pbr::OriginalName("CALL_NET_SITE_COMMENTS")] CallNetSiteComments = 34, + [pbr::OriginalName("SET_NOTE_FILE")] SetNoteFile = 35, + [pbr::OriginalName("SET_SITE_NAME")] SetSiteName = 36, + [pbr::OriginalName("SET_SITE_HAND")] SetSiteHand = 37, + [pbr::OriginalName("QUIT_NET")] QuitNet = 38, + [pbr::OriginalName("SAVING_AS_BUNDLE")] SavingAsBundle = 39, + [pbr::OriginalName("SAVED_AS_BUNDLE")] SavedAsBundle = 40, + [pbr::OriginalName("STOP_SAVING_AS_BUNDLE")] StopSavingAsBundle = 41, + [pbr::OriginalName("SAVE_DEFAULT_NOTE")] SaveDefaultNote = 42, + [pbr::OriginalName("POST_FILE")] PostFile = 43, + [pbr::OriginalName("SAVE_DEFAULT_UI")] SaveDefaultUi = 44, + [pbr::OriginalName("SET_FAVOR_AUDIO_MULTIPLIER")] SetFavorAudioMultiplier = 45, + [pbr::OriginalName("CALL_SITE_NET")] CallSiteNet = 46, + [pbr::OriginalName("NOTIFY_YES")] NotifyYes = 47, + [pbr::OriginalName("CALL_IO")] CallIo = 48, + [pbr::OriginalName("CALL_IO_COMPONENT")] CallIoComponent = 49, + [pbr::OriginalName("COMPILED_IO")] CompiledIo = 50, + [pbr::OriginalName("LEVY_IO")] LevyIo = 51, + [pbr::OriginalName("IO_INPUT")] IoInput = 52, + [pbr::OriginalName("IO_JUDGE")] IoJudge = 53, + [pbr::OriginalName("IO_NOTE_VISIBILITY")] IoNoteVisibility = 54, + [pbr::OriginalName("IO_JUDGMENT_METER")] IoJudgmentMeter = 56, + [pbr::OriginalName("IO_MULTIPLIER")] IoMultiplier = 57, + [pbr::OriginalName("IO_AUDIO_MULTIPLIER")] IoAudioMultiplier = 58, + [pbr::OriginalName("IO_PAUSE")] IoPause = 59, + [pbr::OriginalName("IO_QUIT")] IoQuit = 60, + [pbr::OriginalName("IO_NOT")] IoNot = 61, + [pbr::OriginalName("AUDIO_INPUT")] AudioInput = 62, + [pbr::OriginalName("CALL_SITE_MODE_COMPONENT")] CallSiteModeComponent = 63, + [pbr::OriginalName("COMMENTARY")] Commentary = 65, + [pbr::OriginalName("WWW_LEVEL")] WwwLevel = 66, + [pbr::OriginalName("AVATAR_TITLE")] AvatarTitle = 67, + [pbr::OriginalName("INVALIDATE_AVATAR_DRAWING")] InvalidateAvatarDrawing = 68, + [pbr::OriginalName("INVALIDATE_AVATAR_TITLE")] InvalidateAvatarTitle = 69, + [pbr::OriginalName("LEVEL_UP")] LevelUp = 70, + [pbr::OriginalName("SET_FAVOR_NOTE_FILE")] SetFavorNoteFile = 71, + [pbr::OriginalName("GET_SITE_YELLS")] GetSiteYells = 72, + [pbr::OriginalName("SET_LANGUAGE")] SetLanguage = 73, + [pbr::OriginalName("VALVE_COMMENT")] ValveComment = 74, + [pbr::OriginalName("ABILITY_UP")] AbilityUp = 75, + [pbr::OriginalName("CLOSE")] Close = 76, + [pbr::OriginalName("UNAVAILABLE_DATE")] UnavailableDate = 77, + [pbr::OriginalName("AVATAR_EDGE")] AvatarEdge = 78, + [pbr::OriginalName("INVALIDATE_AVATAR_EDGE")] InvalidateAvatarEdge = 79, + [pbr::OriginalName("FAILED_VALIDATE_TOTEM")] FailedValidateTotem = 80, + [pbr::OriginalName("MODIFY_SITE_YELL")] ModifySiteYell = 81, + [pbr::OriginalName("WIPE_SITE_YELL")] WipeSiteYell = 82, + [pbr::OriginalName("ALREADY_LOADING_BUNDLE")] AlreadyLoadingBundle = 83, + [pbr::OriginalName("SET_FAVOR")] SetFavor = 84, + [pbr::OriginalName("SET_AUTO_SITE_HAND")] SetAutoSiteHand = 85, + [pbr::OriginalName("SET_AVATAR_GROUP")] SetAvatarGroup = 86, + [pbr::OriginalName("POST_ITEM")] PostItem = 87, + [pbr::OriginalName("SET_VALID_NET_MODE")] SetValidNetMode = 88, + [pbr::OriginalName("SET_ALLOWED_POSTABLE_ITEMS")] SetAllowedPostableItems = 89, + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightCallNet : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightCallNet()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightCallNet() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightCallNet(TwilightCallNet other) : this() { + handlerID_ = other.handlerID_; + data_ = other.data_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightCallNet Clone() { + return new TwilightCallNet(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_data_codec + = pb::FieldCodec.ForMessage(18, global::Qwilight.Event.Types.TwilightCallNet.Types.CallNetItem.Parser); + private readonly pbc::RepeatedField data_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Data { + get { return data_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightCallNet); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightCallNet other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if(!data_.Equals(other.data_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + hash ^= data_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + data_.WriteTo(output, _repeated_data_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + data_.WriteTo(ref output, _repeated_data_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + size += data_.CalculateSize(_repeated_data_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightCallNet other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + data_.Add(other.data_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 18: { + data_.AddEntriesFrom(input, _repeated_data_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 18: { + data_.AddEntriesFrom(ref input, _repeated_data_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the TwilightCallNet message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class CallNetItem : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CallNetItem()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Types.TwilightCallNet.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CallNetItem() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CallNetItem(CallNetItem other) : this() { + avatarNetStatus_ = other.avatarNetStatus_; + avatarID_ = other.avatarID_; + avatarName_ = other.avatarName_; + stand_ = other.stand_; + band_ = other.band_; + point_ = other.point_; + hitPoints_ = other.hitPoints_; + isFailed_ = other.isFailed_; + lastJudged_ = other.lastJudged_; + hitPointsMode_ = other.hitPointsMode_; + targetPosition_ = other.targetPosition_; + drawings_ = other.drawings_.Clone(); + drawingComponent_ = other.drawingComponent_ != null ? other.drawingComponent_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CallNetItem Clone() { + return new CallNetItem(this); + } + + /// Field number for the "avatarNetStatus" field. + public const int AvatarNetStatusFieldNumber = 1; + private global::Qwilight.Event.Types.AvatarNetStatus avatarNetStatus_ = global::Qwilight.Event.Types.AvatarNetStatus.Default; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.AvatarNetStatus AvatarNetStatus { + get { return avatarNetStatus_; } + set { + avatarNetStatus_ = value; + } + } + + /// Field number for the "avatarID" field. + public const int AvatarIDFieldNumber = 2; + private string avatarID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string AvatarID { + get { return avatarID_; } + set { + avatarID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "avatarName" field. + public const int AvatarNameFieldNumber = 3; + private string avatarName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string AvatarName { + get { return avatarName_; } + set { + avatarName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "stand" field. + public const int StandFieldNumber = 4; + private int stand_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Stand { + get { return stand_; } + set { + stand_ = value; + } + } + + /// Field number for the "band" field. + public const int BandFieldNumber = 5; + private int band_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Band { + get { return band_; } + set { + band_ = value; + } + } + + /// Field number for the "point" field. + public const int PointFieldNumber = 6; + private double point_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Point { + get { return point_; } + set { + point_ = value; + } + } + + /// Field number for the "hitPoints" field. + public const int HitPointsFieldNumber = 7; + private double hitPoints_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HitPoints { + get { return hitPoints_; } + set { + hitPoints_ = value; + } + } + + /// Field number for the "isFailed" field. + public const int IsFailedFieldNumber = 8; + private bool isFailed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsFailed { + get { return isFailed_; } + set { + isFailed_ = value; + } + } + + /// Field number for the "lastJudged" field. + public const int LastJudgedFieldNumber = 9; + private int lastJudged_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LastJudged { + get { return lastJudged_; } + set { + lastJudged_ = value; + } + } + + /// Field number for the "hitPointsMode" field. + public const int HitPointsModeFieldNumber = 10; + private int hitPointsMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HitPointsMode { + get { return hitPointsMode_; } + set { + hitPointsMode_ = value; + } + } + + /// Field number for the "targetPosition" field. + public const int TargetPositionFieldNumber = 11; + private int targetPosition_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int TargetPosition { + get { return targetPosition_; } + set { + targetPosition_ = value; + } + } + + /// Field number for the "drawings" field. + public const int DrawingsFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_drawings_codec + = pb::FieldCodec.ForMessage(98, global::Qwilight.Event.Types.NetDrawing.Parser); + private readonly pbc::RepeatedField drawings_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Drawings { + get { return drawings_; } + } + + /// Field number for the "drawingComponent" field. + public const int DrawingComponentFieldNumber = 13; + private global::Qwilight.Event.Types.DrawingComponent drawingComponent_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.DrawingComponent DrawingComponent { + get { return drawingComponent_; } + set { + drawingComponent_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CallNetItem); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CallNetItem other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (AvatarNetStatus != other.AvatarNetStatus) return false; + if (AvatarID != other.AvatarID) return false; + if (AvatarName != other.AvatarName) return false; + if (Stand != other.Stand) return false; + if (Band != other.Band) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Point, other.Point)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HitPoints, other.HitPoints)) return false; + if (IsFailed != other.IsFailed) return false; + if (LastJudged != other.LastJudged) return false; + if (HitPointsMode != other.HitPointsMode) return false; + if (TargetPosition != other.TargetPosition) return false; + if(!drawings_.Equals(other.drawings_)) return false; + if (!object.Equals(DrawingComponent, other.DrawingComponent)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) hash ^= AvatarNetStatus.GetHashCode(); + if (AvatarID.Length != 0) hash ^= AvatarID.GetHashCode(); + if (AvatarName.Length != 0) hash ^= AvatarName.GetHashCode(); + if (Stand != 0) hash ^= Stand.GetHashCode(); + if (Band != 0) hash ^= Band.GetHashCode(); + if (Point != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Point); + if (HitPoints != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HitPoints); + if (IsFailed != false) hash ^= IsFailed.GetHashCode(); + if (LastJudged != 0) hash ^= LastJudged.GetHashCode(); + if (HitPointsMode != 0) hash ^= HitPointsMode.GetHashCode(); + if (TargetPosition != 0) hash ^= TargetPosition.GetHashCode(); + hash ^= drawings_.GetHashCode(); + if (drawingComponent_ != null) hash ^= DrawingComponent.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + output.WriteRawTag(8); + output.WriteEnum((int) AvatarNetStatus); + } + if (AvatarID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AvatarID); + } + if (AvatarName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(AvatarName); + } + if (Stand != 0) { + output.WriteRawTag(32); + output.WriteInt32(Stand); + } + if (Band != 0) { + output.WriteRawTag(40); + output.WriteInt32(Band); + } + if (Point != 0D) { + output.WriteRawTag(49); + output.WriteDouble(Point); + } + if (HitPoints != 0D) { + output.WriteRawTag(57); + output.WriteDouble(HitPoints); + } + if (IsFailed != false) { + output.WriteRawTag(64); + output.WriteBool(IsFailed); + } + if (LastJudged != 0) { + output.WriteRawTag(72); + output.WriteInt32(LastJudged); + } + if (HitPointsMode != 0) { + output.WriteRawTag(80); + output.WriteInt32(HitPointsMode); + } + if (TargetPosition != 0) { + output.WriteRawTag(88); + output.WriteInt32(TargetPosition); + } + drawings_.WriteTo(output, _repeated_drawings_codec); + if (drawingComponent_ != null) { + output.WriteRawTag(106); + output.WriteMessage(DrawingComponent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + output.WriteRawTag(8); + output.WriteEnum((int) AvatarNetStatus); + } + if (AvatarID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AvatarID); + } + if (AvatarName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(AvatarName); + } + if (Stand != 0) { + output.WriteRawTag(32); + output.WriteInt32(Stand); + } + if (Band != 0) { + output.WriteRawTag(40); + output.WriteInt32(Band); + } + if (Point != 0D) { + output.WriteRawTag(49); + output.WriteDouble(Point); + } + if (HitPoints != 0D) { + output.WriteRawTag(57); + output.WriteDouble(HitPoints); + } + if (IsFailed != false) { + output.WriteRawTag(64); + output.WriteBool(IsFailed); + } + if (LastJudged != 0) { + output.WriteRawTag(72); + output.WriteInt32(LastJudged); + } + if (HitPointsMode != 0) { + output.WriteRawTag(80); + output.WriteInt32(HitPointsMode); + } + if (TargetPosition != 0) { + output.WriteRawTag(88); + output.WriteInt32(TargetPosition); + } + drawings_.WriteTo(ref output, _repeated_drawings_codec); + if (drawingComponent_ != null) { + output.WriteRawTag(106); + output.WriteMessage(DrawingComponent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) AvatarNetStatus); + } + if (AvatarID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AvatarID); + } + if (AvatarName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AvatarName); + } + if (Stand != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Stand); + } + if (Band != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Band); + } + if (Point != 0D) { + size += 1 + 8; + } + if (HitPoints != 0D) { + size += 1 + 8; + } + if (IsFailed != false) { + size += 1 + 1; + } + if (LastJudged != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LastJudged); + } + if (HitPointsMode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(HitPointsMode); + } + if (TargetPosition != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(TargetPosition); + } + size += drawings_.CalculateSize(_repeated_drawings_codec); + if (drawingComponent_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DrawingComponent); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CallNetItem other) { + if (other == null) { + return; + } + if (other.AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + AvatarNetStatus = other.AvatarNetStatus; + } + if (other.AvatarID.Length != 0) { + AvatarID = other.AvatarID; + } + if (other.AvatarName.Length != 0) { + AvatarName = other.AvatarName; + } + if (other.Stand != 0) { + Stand = other.Stand; + } + if (other.Band != 0) { + Band = other.Band; + } + if (other.Point != 0D) { + Point = other.Point; + } + if (other.HitPoints != 0D) { + HitPoints = other.HitPoints; + } + if (other.IsFailed != false) { + IsFailed = other.IsFailed; + } + if (other.LastJudged != 0) { + LastJudged = other.LastJudged; + } + if (other.HitPointsMode != 0) { + HitPointsMode = other.HitPointsMode; + } + if (other.TargetPosition != 0) { + TargetPosition = other.TargetPosition; + } + drawings_.Add(other.drawings_); + if (other.drawingComponent_ != null) { + if (drawingComponent_ == null) { + DrawingComponent = new global::Qwilight.Event.Types.DrawingComponent(); + } + DrawingComponent.MergeFrom(other.DrawingComponent); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + AvatarNetStatus = (global::Qwilight.Event.Types.AvatarNetStatus) input.ReadEnum(); + break; + } + case 18: { + AvatarID = input.ReadString(); + break; + } + case 26: { + AvatarName = input.ReadString(); + break; + } + case 32: { + Stand = input.ReadInt32(); + break; + } + case 40: { + Band = input.ReadInt32(); + break; + } + case 49: { + Point = input.ReadDouble(); + break; + } + case 57: { + HitPoints = input.ReadDouble(); + break; + } + case 64: { + IsFailed = input.ReadBool(); + break; + } + case 72: { + LastJudged = input.ReadInt32(); + break; + } + case 80: { + HitPointsMode = input.ReadInt32(); + break; + } + case 88: { + TargetPosition = input.ReadInt32(); + break; + } + case 98: { + drawings_.AddEntriesFrom(input, _repeated_drawings_codec); + break; + } + case 106: { + if (drawingComponent_ == null) { + DrawingComponent = new global::Qwilight.Event.Types.DrawingComponent(); + } + input.ReadMessage(DrawingComponent); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + AvatarNetStatus = (global::Qwilight.Event.Types.AvatarNetStatus) input.ReadEnum(); + break; + } + case 18: { + AvatarID = input.ReadString(); + break; + } + case 26: { + AvatarName = input.ReadString(); + break; + } + case 32: { + Stand = input.ReadInt32(); + break; + } + case 40: { + Band = input.ReadInt32(); + break; + } + case 49: { + Point = input.ReadDouble(); + break; + } + case 57: { + HitPoints = input.ReadDouble(); + break; + } + case 64: { + IsFailed = input.ReadBool(); + break; + } + case 72: { + LastJudged = input.ReadInt32(); + break; + } + case 80: { + HitPointsMode = input.ReadInt32(); + break; + } + case 88: { + TargetPosition = input.ReadInt32(); + break; + } + case 98: { + drawings_.AddEntriesFrom(ref input, _repeated_drawings_codec); + break; + } + case 106: { + if (drawingComponent_ == null) { + DrawingComponent = new global::Qwilight.Event.Types.DrawingComponent(); + } + input.ReadMessage(DrawingComponent); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightCallNet : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightCallNet()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightCallNet() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightCallNet(QwilightCallNet other) : this() { + siteID_ = other.siteID_; + handlerID_ = other.handlerID_; + avatarNetStatus_ = other.avatarNetStatus_; + stand_ = other.stand_; + highestBand_ = other.highestBand_; + point_ = other.point_; + hitPoints_ = other.hitPoints_; + isFailed_ = other.isFailed_; + lastJudged_ = other.lastJudged_; + drawings_ = other.drawings_.Clone(); + drawingComponent_ = other.drawingComponent_ != null ? other.drawingComponent_.Clone() : null; + title_ = other.title_; + artist_ = other.artist_; + genre_ = other.genre_; + level_ = other.level_; + levelText_ = other.levelText_; + wantLevelID_ = other.wantLevelID_; + autoMode_ = other.autoMode_; + noteSaltMode_ = other.noteSaltMode_; + audioMultiplier_ = other.audioMultiplier_; + faintNoteMode_ = other.faintNoteMode_; + judgmentMode_ = other.judgmentMode_; + hitPointsMode_ = other.hitPointsMode_; + noteMobilityMode_ = other.noteMobilityMode_; + longNoteMode_ = other.longNoteMode_; + inputFavorMode_ = other.inputFavorMode_; + noteModifyMode_ = other.noteModifyMode_; + bpmMode_ = other.bpmMode_; + waveMode_ = other.waveMode_; + setNoteMode_ = other.setNoteMode_; + lowestJudgmentConditionMode_ = other.lowestJudgmentConditionMode_; + totalNotes_ = other.totalNotes_; + judgmentStage_ = other.judgmentStage_; + hitPointsValue_ = other.hitPointsValue_; + highestInputCount_ = other.highestInputCount_; + length_ = other.length_; + bpm_ = other.bpm_; + multiplier_ = other.multiplier_; + inputMode_ = other.inputMode_; + highestJudgment0_ = other.highestJudgment0_; + higherJudgment0_ = other.higherJudgment0_; + highJudgment0_ = other.highJudgment0_; + lowJudgment0_ = other.lowJudgment0_; + lowerJudgment0_ = other.lowerJudgment0_; + lowestJudgment0_ = other.lowestJudgment0_; + highestJudgment1_ = other.highestJudgment1_; + higherJudgment1_ = other.higherJudgment1_; + highJudgment1_ = other.highJudgment1_; + lowJudgment1_ = other.lowJudgment1_; + lowerJudgment1_ = other.lowerJudgment1_; + lowestJudgment1_ = other.lowestJudgment1_; + highestJudgment_ = other.highestJudgment_; + higherJudgment_ = other.higherJudgment_; + highJudgment_ = other.highJudgment_; + lowJudgment_ = other.lowJudgment_; + lowerJudgment_ = other.lowerJudgment_; + lowestJudgment_ = other.lowestJudgment_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightCallNet Clone() { + return new QwilightCallNet(this); + } + + /// Field number for the "siteID" field. + public const int SiteIDFieldNumber = 1; + private string siteID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string SiteID { + get { return siteID_; } + set { + siteID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "avatarNetStatus" field. + public const int AvatarNetStatusFieldNumber = 3; + private global::Qwilight.Event.Types.AvatarNetStatus avatarNetStatus_ = global::Qwilight.Event.Types.AvatarNetStatus.Default; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.AvatarNetStatus AvatarNetStatus { + get { return avatarNetStatus_; } + set { + avatarNetStatus_ = value; + } + } + + /// Field number for the "stand" field. + public const int StandFieldNumber = 4; + private int stand_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Stand { + get { return stand_; } + set { + stand_ = value; + } + } + + /// Field number for the "highestBand" field. + public const int HighestBandFieldNumber = 5; + private int highestBand_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HighestBand { + get { return highestBand_; } + set { + highestBand_ = value; + } + } + + /// Field number for the "point" field. + public const int PointFieldNumber = 6; + private double point_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Point { + get { return point_; } + set { + point_ = value; + } + } + + /// Field number for the "hitPoints" field. + public const int HitPointsFieldNumber = 7; + private double hitPoints_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HitPoints { + get { return hitPoints_; } + set { + hitPoints_ = value; + } + } + + /// Field number for the "isFailed" field. + public const int IsFailedFieldNumber = 8; + private bool isFailed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsFailed { + get { return isFailed_; } + set { + isFailed_ = value; + } + } + + /// Field number for the "lastJudged" field. + public const int LastJudgedFieldNumber = 9; + private int lastJudged_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LastJudged { + get { return lastJudged_; } + set { + lastJudged_ = value; + } + } + + /// Field number for the "drawings" field. + public const int DrawingsFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_drawings_codec + = pb::FieldCodec.ForMessage(82, global::Qwilight.Event.Types.NetDrawing.Parser); + private readonly pbc::RepeatedField drawings_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Drawings { + get { return drawings_; } + } + + /// Field number for the "drawingComponent" field. + public const int DrawingComponentFieldNumber = 11; + private global::Qwilight.Event.Types.DrawingComponent drawingComponent_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.DrawingComponent DrawingComponent { + get { return drawingComponent_; } + set { + drawingComponent_ = value; + } + } + + /// Field number for the "title" field. + public const int TitleFieldNumber = 12; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "artist" field. + public const int ArtistFieldNumber = 13; + private string artist_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Artist { + get { return artist_; } + set { + artist_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "genre" field. + public const int GenreFieldNumber = 14; + private string genre_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Genre { + get { return genre_; } + set { + genre_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "level" field. + public const int LevelFieldNumber = 15; + private int level_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Level { + get { return level_; } + set { + level_ = value; + } + } + + /// Field number for the "levelText" field. + public const int LevelTextFieldNumber = 16; + private string levelText_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string LevelText { + get { return levelText_; } + set { + levelText_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "wantLevelID" field. + public const int WantLevelIDFieldNumber = 17; + private string wantLevelID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string WantLevelID { + get { return wantLevelID_; } + set { + wantLevelID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "autoMode" field. + public const int AutoModeFieldNumber = 18; + private int autoMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int AutoMode { + get { return autoMode_; } + set { + autoMode_ = value; + } + } + + /// Field number for the "noteSaltMode" field. + public const int NoteSaltModeFieldNumber = 19; + private int noteSaltMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteSaltMode { + get { return noteSaltMode_; } + set { + noteSaltMode_ = value; + } + } + + /// Field number for the "audioMultiplier" field. + public const int AudioMultiplierFieldNumber = 20; + private double audioMultiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double AudioMultiplier { + get { return audioMultiplier_; } + set { + audioMultiplier_ = value; + } + } + + /// Field number for the "faintNoteMode" field. + public const int FaintNoteModeFieldNumber = 21; + private int faintNoteMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int FaintNoteMode { + get { return faintNoteMode_; } + set { + faintNoteMode_ = value; + } + } + + /// Field number for the "judgmentMode" field. + public const int JudgmentModeFieldNumber = 22; + private int judgmentMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int JudgmentMode { + get { return judgmentMode_; } + set { + judgmentMode_ = value; + } + } + + /// Field number for the "hitPointsMode" field. + public const int HitPointsModeFieldNumber = 23; + private int hitPointsMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HitPointsMode { + get { return hitPointsMode_; } + set { + hitPointsMode_ = value; + } + } + + /// Field number for the "noteMobilityMode" field. + public const int NoteMobilityModeFieldNumber = 24; + private int noteMobilityMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteMobilityMode { + get { return noteMobilityMode_; } + set { + noteMobilityMode_ = value; + } + } + + /// Field number for the "longNoteMode" field. + public const int LongNoteModeFieldNumber = 25; + private int longNoteMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LongNoteMode { + get { return longNoteMode_; } + set { + longNoteMode_ = value; + } + } + + /// Field number for the "inputFavorMode" field. + public const int InputFavorModeFieldNumber = 26; + private int inputFavorMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int InputFavorMode { + get { return inputFavorMode_; } + set { + inputFavorMode_ = value; + } + } + + /// Field number for the "noteModifyMode" field. + public const int NoteModifyModeFieldNumber = 27; + private int noteModifyMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteModifyMode { + get { return noteModifyMode_; } + set { + noteModifyMode_ = value; + } + } + + /// Field number for the "bpmMode" field. + public const int BpmModeFieldNumber = 28; + private int bpmMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int BpmMode { + get { return bpmMode_; } + set { + bpmMode_ = value; + } + } + + /// Field number for the "waveMode" field. + public const int WaveModeFieldNumber = 29; + private int waveMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int WaveMode { + get { return waveMode_; } + set { + waveMode_ = value; + } + } + + /// Field number for the "setNoteMode" field. + public const int SetNoteModeFieldNumber = 30; + private int setNoteMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SetNoteMode { + get { return setNoteMode_; } + set { + setNoteMode_ = value; + } + } + + /// Field number for the "lowestJudgmentConditionMode" field. + public const int LowestJudgmentConditionModeFieldNumber = 31; + private int lowestJudgmentConditionMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowestJudgmentConditionMode { + get { return lowestJudgmentConditionMode_; } + set { + lowestJudgmentConditionMode_ = value; + } + } + + /// Field number for the "totalNotes" field. + public const int TotalNotesFieldNumber = 32; + private int totalNotes_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int TotalNotes { + get { return totalNotes_; } + set { + totalNotes_ = value; + } + } + + /// Field number for the "judgmentStage" field. + public const int JudgmentStageFieldNumber = 33; + private double judgmentStage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double JudgmentStage { + get { return judgmentStage_; } + set { + judgmentStage_ = value; + } + } + + /// Field number for the "hitPointsValue" field. + public const int HitPointsValueFieldNumber = 34; + private double hitPointsValue_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HitPointsValue { + get { return hitPointsValue_; } + set { + hitPointsValue_ = value; + } + } + + /// Field number for the "highestInputCount" field. + public const int HighestInputCountFieldNumber = 35; + private int highestInputCount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HighestInputCount { + get { return highestInputCount_; } + set { + highestInputCount_ = value; + } + } + + /// Field number for the "length" field. + public const int LengthFieldNumber = 36; + private double length_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Length { + get { return length_; } + set { + length_ = value; + } + } + + /// Field number for the "bpm" field. + public const int BpmFieldNumber = 37; + private double bpm_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Bpm { + get { return bpm_; } + set { + bpm_ = value; + } + } + + /// Field number for the "multiplier" field. + public const int MultiplierFieldNumber = 38; + private double multiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Multiplier { + get { return multiplier_; } + set { + multiplier_ = value; + } + } + + /// Field number for the "inputMode" field. + public const int InputModeFieldNumber = 39; + private int inputMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int InputMode { + get { return inputMode_; } + set { + inputMode_ = value; + } + } + + /// Field number for the "highestJudgment0" field. + public const int HighestJudgment0FieldNumber = 40; + private double highestJudgment0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HighestJudgment0 { + get { return highestJudgment0_; } + set { + highestJudgment0_ = value; + } + } + + /// Field number for the "higherJudgment0" field. + public const int HigherJudgment0FieldNumber = 41; + private double higherJudgment0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HigherJudgment0 { + get { return higherJudgment0_; } + set { + higherJudgment0_ = value; + } + } + + /// Field number for the "highJudgment0" field. + public const int HighJudgment0FieldNumber = 42; + private double highJudgment0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HighJudgment0 { + get { return highJudgment0_; } + set { + highJudgment0_ = value; + } + } + + /// Field number for the "lowJudgment0" field. + public const int LowJudgment0FieldNumber = 43; + private double lowJudgment0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowJudgment0 { + get { return lowJudgment0_; } + set { + lowJudgment0_ = value; + } + } + + /// Field number for the "lowerJudgment0" field. + public const int LowerJudgment0FieldNumber = 44; + private double lowerJudgment0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowerJudgment0 { + get { return lowerJudgment0_; } + set { + lowerJudgment0_ = value; + } + } + + /// Field number for the "lowestJudgment0" field. + public const int LowestJudgment0FieldNumber = 45; + private double lowestJudgment0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowestJudgment0 { + get { return lowestJudgment0_; } + set { + lowestJudgment0_ = value; + } + } + + /// Field number for the "highestJudgment1" field. + public const int HighestJudgment1FieldNumber = 46; + private double highestJudgment1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HighestJudgment1 { + get { return highestJudgment1_; } + set { + highestJudgment1_ = value; + } + } + + /// Field number for the "higherJudgment1" field. + public const int HigherJudgment1FieldNumber = 47; + private double higherJudgment1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HigherJudgment1 { + get { return higherJudgment1_; } + set { + higherJudgment1_ = value; + } + } + + /// Field number for the "highJudgment1" field. + public const int HighJudgment1FieldNumber = 48; + private double highJudgment1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HighJudgment1 { + get { return highJudgment1_; } + set { + highJudgment1_ = value; + } + } + + /// Field number for the "lowJudgment1" field. + public const int LowJudgment1FieldNumber = 49; + private double lowJudgment1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowJudgment1 { + get { return lowJudgment1_; } + set { + lowJudgment1_ = value; + } + } + + /// Field number for the "lowerJudgment1" field. + public const int LowerJudgment1FieldNumber = 50; + private double lowerJudgment1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowerJudgment1 { + get { return lowerJudgment1_; } + set { + lowerJudgment1_ = value; + } + } + + /// Field number for the "lowestJudgment1" field. + public const int LowestJudgment1FieldNumber = 51; + private double lowestJudgment1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowestJudgment1 { + get { return lowestJudgment1_; } + set { + lowestJudgment1_ = value; + } + } + + /// Field number for the "highestJudgment" field. + public const int HighestJudgmentFieldNumber = 52; + private int highestJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HighestJudgment { + get { return highestJudgment_; } + set { + highestJudgment_ = value; + } + } + + /// Field number for the "higherJudgment" field. + public const int HigherJudgmentFieldNumber = 53; + private int higherJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HigherJudgment { + get { return higherJudgment_; } + set { + higherJudgment_ = value; + } + } + + /// Field number for the "highJudgment" field. + public const int HighJudgmentFieldNumber = 54; + private int highJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int HighJudgment { + get { return highJudgment_; } + set { + highJudgment_ = value; + } + } + + /// Field number for the "lowJudgment" field. + public const int LowJudgmentFieldNumber = 55; + private int lowJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowJudgment { + get { return lowJudgment_; } + set { + lowJudgment_ = value; + } + } + + /// Field number for the "lowerJudgment" field. + public const int LowerJudgmentFieldNumber = 56; + private int lowerJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowerJudgment { + get { return lowerJudgment_; } + set { + lowerJudgment_ = value; + } + } + + /// Field number for the "lowestJudgment" field. + public const int LowestJudgmentFieldNumber = 57; + private int lowestJudgment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LowestJudgment { + get { return lowestJudgment_; } + set { + lowestJudgment_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightCallNet); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightCallNet other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SiteID != other.SiteID) return false; + if (HandlerID != other.HandlerID) return false; + if (AvatarNetStatus != other.AvatarNetStatus) return false; + if (Stand != other.Stand) return false; + if (HighestBand != other.HighestBand) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Point, other.Point)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HitPoints, other.HitPoints)) return false; + if (IsFailed != other.IsFailed) return false; + if (LastJudged != other.LastJudged) return false; + if(!drawings_.Equals(other.drawings_)) return false; + if (!object.Equals(DrawingComponent, other.DrawingComponent)) return false; + if (Title != other.Title) return false; + if (Artist != other.Artist) return false; + if (Genre != other.Genre) return false; + if (Level != other.Level) return false; + if (LevelText != other.LevelText) return false; + if (WantLevelID != other.WantLevelID) return false; + if (AutoMode != other.AutoMode) return false; + if (NoteSaltMode != other.NoteSaltMode) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(AudioMultiplier, other.AudioMultiplier)) return false; + if (FaintNoteMode != other.FaintNoteMode) return false; + if (JudgmentMode != other.JudgmentMode) return false; + if (HitPointsMode != other.HitPointsMode) return false; + if (NoteMobilityMode != other.NoteMobilityMode) return false; + if (LongNoteMode != other.LongNoteMode) return false; + if (InputFavorMode != other.InputFavorMode) return false; + if (NoteModifyMode != other.NoteModifyMode) return false; + if (BpmMode != other.BpmMode) return false; + if (WaveMode != other.WaveMode) return false; + if (SetNoteMode != other.SetNoteMode) return false; + if (LowestJudgmentConditionMode != other.LowestJudgmentConditionMode) return false; + if (TotalNotes != other.TotalNotes) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(JudgmentStage, other.JudgmentStage)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HitPointsValue, other.HitPointsValue)) return false; + if (HighestInputCount != other.HighestInputCount) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Length, other.Length)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Bpm, other.Bpm)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Multiplier, other.Multiplier)) return false; + if (InputMode != other.InputMode) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HighestJudgment0, other.HighestJudgment0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HigherJudgment0, other.HigherJudgment0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HighJudgment0, other.HighJudgment0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowJudgment0, other.LowJudgment0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowerJudgment0, other.LowerJudgment0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowestJudgment0, other.LowestJudgment0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HighestJudgment1, other.HighestJudgment1)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HigherJudgment1, other.HigherJudgment1)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HighJudgment1, other.HighJudgment1)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowJudgment1, other.LowJudgment1)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowerJudgment1, other.LowerJudgment1)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowestJudgment1, other.LowestJudgment1)) return false; + if (HighestJudgment != other.HighestJudgment) return false; + if (HigherJudgment != other.HigherJudgment) return false; + if (HighJudgment != other.HighJudgment) return false; + if (LowJudgment != other.LowJudgment) return false; + if (LowerJudgment != other.LowerJudgment) return false; + if (LowestJudgment != other.LowestJudgment) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SiteID.Length != 0) hash ^= SiteID.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) hash ^= AvatarNetStatus.GetHashCode(); + if (Stand != 0) hash ^= Stand.GetHashCode(); + if (HighestBand != 0) hash ^= HighestBand.GetHashCode(); + if (Point != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Point); + if (HitPoints != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HitPoints); + if (IsFailed != false) hash ^= IsFailed.GetHashCode(); + if (LastJudged != 0) hash ^= LastJudged.GetHashCode(); + hash ^= drawings_.GetHashCode(); + if (drawingComponent_ != null) hash ^= DrawingComponent.GetHashCode(); + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Artist.Length != 0) hash ^= Artist.GetHashCode(); + if (Genre.Length != 0) hash ^= Genre.GetHashCode(); + if (Level != 0) hash ^= Level.GetHashCode(); + if (LevelText.Length != 0) hash ^= LevelText.GetHashCode(); + if (WantLevelID.Length != 0) hash ^= WantLevelID.GetHashCode(); + if (AutoMode != 0) hash ^= AutoMode.GetHashCode(); + if (NoteSaltMode != 0) hash ^= NoteSaltMode.GetHashCode(); + if (AudioMultiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(AudioMultiplier); + if (FaintNoteMode != 0) hash ^= FaintNoteMode.GetHashCode(); + if (JudgmentMode != 0) hash ^= JudgmentMode.GetHashCode(); + if (HitPointsMode != 0) hash ^= HitPointsMode.GetHashCode(); + if (NoteMobilityMode != 0) hash ^= NoteMobilityMode.GetHashCode(); + if (LongNoteMode != 0) hash ^= LongNoteMode.GetHashCode(); + if (InputFavorMode != 0) hash ^= InputFavorMode.GetHashCode(); + if (NoteModifyMode != 0) hash ^= NoteModifyMode.GetHashCode(); + if (BpmMode != 0) hash ^= BpmMode.GetHashCode(); + if (WaveMode != 0) hash ^= WaveMode.GetHashCode(); + if (SetNoteMode != 0) hash ^= SetNoteMode.GetHashCode(); + if (LowestJudgmentConditionMode != 0) hash ^= LowestJudgmentConditionMode.GetHashCode(); + if (TotalNotes != 0) hash ^= TotalNotes.GetHashCode(); + if (JudgmentStage != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(JudgmentStage); + if (HitPointsValue != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HitPointsValue); + if (HighestInputCount != 0) hash ^= HighestInputCount.GetHashCode(); + if (Length != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Length); + if (Bpm != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Bpm); + if (Multiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Multiplier); + if (InputMode != 0) hash ^= InputMode.GetHashCode(); + if (HighestJudgment0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HighestJudgment0); + if (HigherJudgment0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HigherJudgment0); + if (HighJudgment0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HighJudgment0); + if (LowJudgment0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowJudgment0); + if (LowerJudgment0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowerJudgment0); + if (LowestJudgment0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowestJudgment0); + if (HighestJudgment1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HighestJudgment1); + if (HigherJudgment1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HigherJudgment1); + if (HighJudgment1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HighJudgment1); + if (LowJudgment1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowJudgment1); + if (LowerJudgment1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowerJudgment1); + if (LowestJudgment1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowestJudgment1); + if (HighestJudgment != 0) hash ^= HighestJudgment.GetHashCode(); + if (HigherJudgment != 0) hash ^= HigherJudgment.GetHashCode(); + if (HighJudgment != 0) hash ^= HighJudgment.GetHashCode(); + if (LowJudgment != 0) hash ^= LowJudgment.GetHashCode(); + if (LowerJudgment != 0) hash ^= LowerJudgment.GetHashCode(); + if (LowestJudgment != 0) hash ^= LowestJudgment.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SiteID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SiteID); + } + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + output.WriteRawTag(24); + output.WriteEnum((int) AvatarNetStatus); + } + if (Stand != 0) { + output.WriteRawTag(32); + output.WriteInt32(Stand); + } + if (HighestBand != 0) { + output.WriteRawTag(40); + output.WriteInt32(HighestBand); + } + if (Point != 0D) { + output.WriteRawTag(49); + output.WriteDouble(Point); + } + if (HitPoints != 0D) { + output.WriteRawTag(57); + output.WriteDouble(HitPoints); + } + if (IsFailed != false) { + output.WriteRawTag(64); + output.WriteBool(IsFailed); + } + if (LastJudged != 0) { + output.WriteRawTag(72); + output.WriteInt32(LastJudged); + } + drawings_.WriteTo(output, _repeated_drawings_codec); + if (drawingComponent_ != null) { + output.WriteRawTag(90); + output.WriteMessage(DrawingComponent); + } + if (Title.Length != 0) { + output.WriteRawTag(98); + output.WriteString(Title); + } + if (Artist.Length != 0) { + output.WriteRawTag(106); + output.WriteString(Artist); + } + if (Genre.Length != 0) { + output.WriteRawTag(114); + output.WriteString(Genre); + } + if (Level != 0) { + output.WriteRawTag(120); + output.WriteInt32(Level); + } + if (LevelText.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(LevelText); + } + if (WantLevelID.Length != 0) { + output.WriteRawTag(138, 1); + output.WriteString(WantLevelID); + } + if (AutoMode != 0) { + output.WriteRawTag(144, 1); + output.WriteInt32(AutoMode); + } + if (NoteSaltMode != 0) { + output.WriteRawTag(152, 1); + output.WriteInt32(NoteSaltMode); + } + if (AudioMultiplier != 0D) { + output.WriteRawTag(161, 1); + output.WriteDouble(AudioMultiplier); + } + if (FaintNoteMode != 0) { + output.WriteRawTag(168, 1); + output.WriteInt32(FaintNoteMode); + } + if (JudgmentMode != 0) { + output.WriteRawTag(176, 1); + output.WriteInt32(JudgmentMode); + } + if (HitPointsMode != 0) { + output.WriteRawTag(184, 1); + output.WriteInt32(HitPointsMode); + } + if (NoteMobilityMode != 0) { + output.WriteRawTag(192, 1); + output.WriteInt32(NoteMobilityMode); + } + if (LongNoteMode != 0) { + output.WriteRawTag(200, 1); + output.WriteInt32(LongNoteMode); + } + if (InputFavorMode != 0) { + output.WriteRawTag(208, 1); + output.WriteInt32(InputFavorMode); + } + if (NoteModifyMode != 0) { + output.WriteRawTag(216, 1); + output.WriteInt32(NoteModifyMode); + } + if (BpmMode != 0) { + output.WriteRawTag(224, 1); + output.WriteInt32(BpmMode); + } + if (WaveMode != 0) { + output.WriteRawTag(232, 1); + output.WriteInt32(WaveMode); + } + if (SetNoteMode != 0) { + output.WriteRawTag(240, 1); + output.WriteInt32(SetNoteMode); + } + if (LowestJudgmentConditionMode != 0) { + output.WriteRawTag(248, 1); + output.WriteInt32(LowestJudgmentConditionMode); + } + if (TotalNotes != 0) { + output.WriteRawTag(128, 2); + output.WriteInt32(TotalNotes); + } + if (JudgmentStage != 0D) { + output.WriteRawTag(137, 2); + output.WriteDouble(JudgmentStage); + } + if (HitPointsValue != 0D) { + output.WriteRawTag(145, 2); + output.WriteDouble(HitPointsValue); + } + if (HighestInputCount != 0) { + output.WriteRawTag(152, 2); + output.WriteInt32(HighestInputCount); + } + if (Length != 0D) { + output.WriteRawTag(161, 2); + output.WriteDouble(Length); + } + if (Bpm != 0D) { + output.WriteRawTag(169, 2); + output.WriteDouble(Bpm); + } + if (Multiplier != 0D) { + output.WriteRawTag(177, 2); + output.WriteDouble(Multiplier); + } + if (InputMode != 0) { + output.WriteRawTag(184, 2); + output.WriteInt32(InputMode); + } + if (HighestJudgment0 != 0D) { + output.WriteRawTag(193, 2); + output.WriteDouble(HighestJudgment0); + } + if (HigherJudgment0 != 0D) { + output.WriteRawTag(201, 2); + output.WriteDouble(HigherJudgment0); + } + if (HighJudgment0 != 0D) { + output.WriteRawTag(209, 2); + output.WriteDouble(HighJudgment0); + } + if (LowJudgment0 != 0D) { + output.WriteRawTag(217, 2); + output.WriteDouble(LowJudgment0); + } + if (LowerJudgment0 != 0D) { + output.WriteRawTag(225, 2); + output.WriteDouble(LowerJudgment0); + } + if (LowestJudgment0 != 0D) { + output.WriteRawTag(233, 2); + output.WriteDouble(LowestJudgment0); + } + if (HighestJudgment1 != 0D) { + output.WriteRawTag(241, 2); + output.WriteDouble(HighestJudgment1); + } + if (HigherJudgment1 != 0D) { + output.WriteRawTag(249, 2); + output.WriteDouble(HigherJudgment1); + } + if (HighJudgment1 != 0D) { + output.WriteRawTag(129, 3); + output.WriteDouble(HighJudgment1); + } + if (LowJudgment1 != 0D) { + output.WriteRawTag(137, 3); + output.WriteDouble(LowJudgment1); + } + if (LowerJudgment1 != 0D) { + output.WriteRawTag(145, 3); + output.WriteDouble(LowerJudgment1); + } + if (LowestJudgment1 != 0D) { + output.WriteRawTag(153, 3); + output.WriteDouble(LowestJudgment1); + } + if (HighestJudgment != 0) { + output.WriteRawTag(160, 3); + output.WriteInt32(HighestJudgment); + } + if (HigherJudgment != 0) { + output.WriteRawTag(168, 3); + output.WriteInt32(HigherJudgment); + } + if (HighJudgment != 0) { + output.WriteRawTag(176, 3); + output.WriteInt32(HighJudgment); + } + if (LowJudgment != 0) { + output.WriteRawTag(184, 3); + output.WriteInt32(LowJudgment); + } + if (LowerJudgment != 0) { + output.WriteRawTag(192, 3); + output.WriteInt32(LowerJudgment); + } + if (LowestJudgment != 0) { + output.WriteRawTag(200, 3); + output.WriteInt32(LowestJudgment); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SiteID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SiteID); + } + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + output.WriteRawTag(24); + output.WriteEnum((int) AvatarNetStatus); + } + if (Stand != 0) { + output.WriteRawTag(32); + output.WriteInt32(Stand); + } + if (HighestBand != 0) { + output.WriteRawTag(40); + output.WriteInt32(HighestBand); + } + if (Point != 0D) { + output.WriteRawTag(49); + output.WriteDouble(Point); + } + if (HitPoints != 0D) { + output.WriteRawTag(57); + output.WriteDouble(HitPoints); + } + if (IsFailed != false) { + output.WriteRawTag(64); + output.WriteBool(IsFailed); + } + if (LastJudged != 0) { + output.WriteRawTag(72); + output.WriteInt32(LastJudged); + } + drawings_.WriteTo(ref output, _repeated_drawings_codec); + if (drawingComponent_ != null) { + output.WriteRawTag(90); + output.WriteMessage(DrawingComponent); + } + if (Title.Length != 0) { + output.WriteRawTag(98); + output.WriteString(Title); + } + if (Artist.Length != 0) { + output.WriteRawTag(106); + output.WriteString(Artist); + } + if (Genre.Length != 0) { + output.WriteRawTag(114); + output.WriteString(Genre); + } + if (Level != 0) { + output.WriteRawTag(120); + output.WriteInt32(Level); + } + if (LevelText.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(LevelText); + } + if (WantLevelID.Length != 0) { + output.WriteRawTag(138, 1); + output.WriteString(WantLevelID); + } + if (AutoMode != 0) { + output.WriteRawTag(144, 1); + output.WriteInt32(AutoMode); + } + if (NoteSaltMode != 0) { + output.WriteRawTag(152, 1); + output.WriteInt32(NoteSaltMode); + } + if (AudioMultiplier != 0D) { + output.WriteRawTag(161, 1); + output.WriteDouble(AudioMultiplier); + } + if (FaintNoteMode != 0) { + output.WriteRawTag(168, 1); + output.WriteInt32(FaintNoteMode); + } + if (JudgmentMode != 0) { + output.WriteRawTag(176, 1); + output.WriteInt32(JudgmentMode); + } + if (HitPointsMode != 0) { + output.WriteRawTag(184, 1); + output.WriteInt32(HitPointsMode); + } + if (NoteMobilityMode != 0) { + output.WriteRawTag(192, 1); + output.WriteInt32(NoteMobilityMode); + } + if (LongNoteMode != 0) { + output.WriteRawTag(200, 1); + output.WriteInt32(LongNoteMode); + } + if (InputFavorMode != 0) { + output.WriteRawTag(208, 1); + output.WriteInt32(InputFavorMode); + } + if (NoteModifyMode != 0) { + output.WriteRawTag(216, 1); + output.WriteInt32(NoteModifyMode); + } + if (BpmMode != 0) { + output.WriteRawTag(224, 1); + output.WriteInt32(BpmMode); + } + if (WaveMode != 0) { + output.WriteRawTag(232, 1); + output.WriteInt32(WaveMode); + } + if (SetNoteMode != 0) { + output.WriteRawTag(240, 1); + output.WriteInt32(SetNoteMode); + } + if (LowestJudgmentConditionMode != 0) { + output.WriteRawTag(248, 1); + output.WriteInt32(LowestJudgmentConditionMode); + } + if (TotalNotes != 0) { + output.WriteRawTag(128, 2); + output.WriteInt32(TotalNotes); + } + if (JudgmentStage != 0D) { + output.WriteRawTag(137, 2); + output.WriteDouble(JudgmentStage); + } + if (HitPointsValue != 0D) { + output.WriteRawTag(145, 2); + output.WriteDouble(HitPointsValue); + } + if (HighestInputCount != 0) { + output.WriteRawTag(152, 2); + output.WriteInt32(HighestInputCount); + } + if (Length != 0D) { + output.WriteRawTag(161, 2); + output.WriteDouble(Length); + } + if (Bpm != 0D) { + output.WriteRawTag(169, 2); + output.WriteDouble(Bpm); + } + if (Multiplier != 0D) { + output.WriteRawTag(177, 2); + output.WriteDouble(Multiplier); + } + if (InputMode != 0) { + output.WriteRawTag(184, 2); + output.WriteInt32(InputMode); + } + if (HighestJudgment0 != 0D) { + output.WriteRawTag(193, 2); + output.WriteDouble(HighestJudgment0); + } + if (HigherJudgment0 != 0D) { + output.WriteRawTag(201, 2); + output.WriteDouble(HigherJudgment0); + } + if (HighJudgment0 != 0D) { + output.WriteRawTag(209, 2); + output.WriteDouble(HighJudgment0); + } + if (LowJudgment0 != 0D) { + output.WriteRawTag(217, 2); + output.WriteDouble(LowJudgment0); + } + if (LowerJudgment0 != 0D) { + output.WriteRawTag(225, 2); + output.WriteDouble(LowerJudgment0); + } + if (LowestJudgment0 != 0D) { + output.WriteRawTag(233, 2); + output.WriteDouble(LowestJudgment0); + } + if (HighestJudgment1 != 0D) { + output.WriteRawTag(241, 2); + output.WriteDouble(HighestJudgment1); + } + if (HigherJudgment1 != 0D) { + output.WriteRawTag(249, 2); + output.WriteDouble(HigherJudgment1); + } + if (HighJudgment1 != 0D) { + output.WriteRawTag(129, 3); + output.WriteDouble(HighJudgment1); + } + if (LowJudgment1 != 0D) { + output.WriteRawTag(137, 3); + output.WriteDouble(LowJudgment1); + } + if (LowerJudgment1 != 0D) { + output.WriteRawTag(145, 3); + output.WriteDouble(LowerJudgment1); + } + if (LowestJudgment1 != 0D) { + output.WriteRawTag(153, 3); + output.WriteDouble(LowestJudgment1); + } + if (HighestJudgment != 0) { + output.WriteRawTag(160, 3); + output.WriteInt32(HighestJudgment); + } + if (HigherJudgment != 0) { + output.WriteRawTag(168, 3); + output.WriteInt32(HigherJudgment); + } + if (HighJudgment != 0) { + output.WriteRawTag(176, 3); + output.WriteInt32(HighJudgment); + } + if (LowJudgment != 0) { + output.WriteRawTag(184, 3); + output.WriteInt32(LowJudgment); + } + if (LowerJudgment != 0) { + output.WriteRawTag(192, 3); + output.WriteInt32(LowerJudgment); + } + if (LowestJudgment != 0) { + output.WriteRawTag(200, 3); + output.WriteInt32(LowestJudgment); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SiteID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SiteID); + } + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) AvatarNetStatus); + } + if (Stand != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Stand); + } + if (HighestBand != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(HighestBand); + } + if (Point != 0D) { + size += 1 + 8; + } + if (HitPoints != 0D) { + size += 1 + 8; + } + if (IsFailed != false) { + size += 1 + 1; + } + if (LastJudged != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LastJudged); + } + size += drawings_.CalculateSize(_repeated_drawings_codec); + if (drawingComponent_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DrawingComponent); + } + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Artist.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Artist); + } + if (Genre.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Genre); + } + if (Level != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Level); + } + if (LevelText.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LevelText); + } + if (WantLevelID.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(WantLevelID); + } + if (AutoMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(AutoMode); + } + if (NoteSaltMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(NoteSaltMode); + } + if (AudioMultiplier != 0D) { + size += 2 + 8; + } + if (FaintNoteMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FaintNoteMode); + } + if (JudgmentMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(JudgmentMode); + } + if (HitPointsMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(HitPointsMode); + } + if (NoteMobilityMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(NoteMobilityMode); + } + if (LongNoteMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(LongNoteMode); + } + if (InputFavorMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(InputFavorMode); + } + if (NoteModifyMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(NoteModifyMode); + } + if (BpmMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(BpmMode); + } + if (WaveMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(WaveMode); + } + if (SetNoteMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(SetNoteMode); + } + if (LowestJudgmentConditionMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(LowestJudgmentConditionMode); + } + if (TotalNotes != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(TotalNotes); + } + if (JudgmentStage != 0D) { + size += 2 + 8; + } + if (HitPointsValue != 0D) { + size += 2 + 8; + } + if (HighestInputCount != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(HighestInputCount); + } + if (Length != 0D) { + size += 2 + 8; + } + if (Bpm != 0D) { + size += 2 + 8; + } + if (Multiplier != 0D) { + size += 2 + 8; + } + if (InputMode != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(InputMode); + } + if (HighestJudgment0 != 0D) { + size += 2 + 8; + } + if (HigherJudgment0 != 0D) { + size += 2 + 8; + } + if (HighJudgment0 != 0D) { + size += 2 + 8; + } + if (LowJudgment0 != 0D) { + size += 2 + 8; + } + if (LowerJudgment0 != 0D) { + size += 2 + 8; + } + if (LowestJudgment0 != 0D) { + size += 2 + 8; + } + if (HighestJudgment1 != 0D) { + size += 2 + 8; + } + if (HigherJudgment1 != 0D) { + size += 2 + 8; + } + if (HighJudgment1 != 0D) { + size += 2 + 8; + } + if (LowJudgment1 != 0D) { + size += 2 + 8; + } + if (LowerJudgment1 != 0D) { + size += 2 + 8; + } + if (LowestJudgment1 != 0D) { + size += 2 + 8; + } + if (HighestJudgment != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(HighestJudgment); + } + if (HigherJudgment != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(HigherJudgment); + } + if (HighJudgment != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(HighJudgment); + } + if (LowJudgment != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(LowJudgment); + } + if (LowerJudgment != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(LowerJudgment); + } + if (LowestJudgment != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(LowestJudgment); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightCallNet other) { + if (other == null) { + return; + } + if (other.SiteID.Length != 0) { + SiteID = other.SiteID; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.AvatarNetStatus != global::Qwilight.Event.Types.AvatarNetStatus.Default) { + AvatarNetStatus = other.AvatarNetStatus; + } + if (other.Stand != 0) { + Stand = other.Stand; + } + if (other.HighestBand != 0) { + HighestBand = other.HighestBand; + } + if (other.Point != 0D) { + Point = other.Point; + } + if (other.HitPoints != 0D) { + HitPoints = other.HitPoints; + } + if (other.IsFailed != false) { + IsFailed = other.IsFailed; + } + if (other.LastJudged != 0) { + LastJudged = other.LastJudged; + } + drawings_.Add(other.drawings_); + if (other.drawingComponent_ != null) { + if (drawingComponent_ == null) { + DrawingComponent = new global::Qwilight.Event.Types.DrawingComponent(); + } + DrawingComponent.MergeFrom(other.DrawingComponent); + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Artist.Length != 0) { + Artist = other.Artist; + } + if (other.Genre.Length != 0) { + Genre = other.Genre; + } + if (other.Level != 0) { + Level = other.Level; + } + if (other.LevelText.Length != 0) { + LevelText = other.LevelText; + } + if (other.WantLevelID.Length != 0) { + WantLevelID = other.WantLevelID; + } + if (other.AutoMode != 0) { + AutoMode = other.AutoMode; + } + if (other.NoteSaltMode != 0) { + NoteSaltMode = other.NoteSaltMode; + } + if (other.AudioMultiplier != 0D) { + AudioMultiplier = other.AudioMultiplier; + } + if (other.FaintNoteMode != 0) { + FaintNoteMode = other.FaintNoteMode; + } + if (other.JudgmentMode != 0) { + JudgmentMode = other.JudgmentMode; + } + if (other.HitPointsMode != 0) { + HitPointsMode = other.HitPointsMode; + } + if (other.NoteMobilityMode != 0) { + NoteMobilityMode = other.NoteMobilityMode; + } + if (other.LongNoteMode != 0) { + LongNoteMode = other.LongNoteMode; + } + if (other.InputFavorMode != 0) { + InputFavorMode = other.InputFavorMode; + } + if (other.NoteModifyMode != 0) { + NoteModifyMode = other.NoteModifyMode; + } + if (other.BpmMode != 0) { + BpmMode = other.BpmMode; + } + if (other.WaveMode != 0) { + WaveMode = other.WaveMode; + } + if (other.SetNoteMode != 0) { + SetNoteMode = other.SetNoteMode; + } + if (other.LowestJudgmentConditionMode != 0) { + LowestJudgmentConditionMode = other.LowestJudgmentConditionMode; + } + if (other.TotalNotes != 0) { + TotalNotes = other.TotalNotes; + } + if (other.JudgmentStage != 0D) { + JudgmentStage = other.JudgmentStage; + } + if (other.HitPointsValue != 0D) { + HitPointsValue = other.HitPointsValue; + } + if (other.HighestInputCount != 0) { + HighestInputCount = other.HighestInputCount; + } + if (other.Length != 0D) { + Length = other.Length; + } + if (other.Bpm != 0D) { + Bpm = other.Bpm; + } + if (other.Multiplier != 0D) { + Multiplier = other.Multiplier; + } + if (other.InputMode != 0) { + InputMode = other.InputMode; + } + if (other.HighestJudgment0 != 0D) { + HighestJudgment0 = other.HighestJudgment0; + } + if (other.HigherJudgment0 != 0D) { + HigherJudgment0 = other.HigherJudgment0; + } + if (other.HighJudgment0 != 0D) { + HighJudgment0 = other.HighJudgment0; + } + if (other.LowJudgment0 != 0D) { + LowJudgment0 = other.LowJudgment0; + } + if (other.LowerJudgment0 != 0D) { + LowerJudgment0 = other.LowerJudgment0; + } + if (other.LowestJudgment0 != 0D) { + LowestJudgment0 = other.LowestJudgment0; + } + if (other.HighestJudgment1 != 0D) { + HighestJudgment1 = other.HighestJudgment1; + } + if (other.HigherJudgment1 != 0D) { + HigherJudgment1 = other.HigherJudgment1; + } + if (other.HighJudgment1 != 0D) { + HighJudgment1 = other.HighJudgment1; + } + if (other.LowJudgment1 != 0D) { + LowJudgment1 = other.LowJudgment1; + } + if (other.LowerJudgment1 != 0D) { + LowerJudgment1 = other.LowerJudgment1; + } + if (other.LowestJudgment1 != 0D) { + LowestJudgment1 = other.LowestJudgment1; + } + if (other.HighestJudgment != 0) { + HighestJudgment = other.HighestJudgment; + } + if (other.HigherJudgment != 0) { + HigherJudgment = other.HigherJudgment; + } + if (other.HighJudgment != 0) { + HighJudgment = other.HighJudgment; + } + if (other.LowJudgment != 0) { + LowJudgment = other.LowJudgment; + } + if (other.LowerJudgment != 0) { + LowerJudgment = other.LowerJudgment; + } + if (other.LowestJudgment != 0) { + LowestJudgment = other.LowestJudgment; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + SiteID = input.ReadString(); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + AvatarNetStatus = (global::Qwilight.Event.Types.AvatarNetStatus) input.ReadEnum(); + break; + } + case 32: { + Stand = input.ReadInt32(); + break; + } + case 40: { + HighestBand = input.ReadInt32(); + break; + } + case 49: { + Point = input.ReadDouble(); + break; + } + case 57: { + HitPoints = input.ReadDouble(); + break; + } + case 64: { + IsFailed = input.ReadBool(); + break; + } + case 72: { + LastJudged = input.ReadInt32(); + break; + } + case 82: { + drawings_.AddEntriesFrom(input, _repeated_drawings_codec); + break; + } + case 90: { + if (drawingComponent_ == null) { + DrawingComponent = new global::Qwilight.Event.Types.DrawingComponent(); + } + input.ReadMessage(DrawingComponent); + break; + } + case 98: { + Title = input.ReadString(); + break; + } + case 106: { + Artist = input.ReadString(); + break; + } + case 114: { + Genre = input.ReadString(); + break; + } + case 120: { + Level = input.ReadInt32(); + break; + } + case 130: { + LevelText = input.ReadString(); + break; + } + case 138: { + WantLevelID = input.ReadString(); + break; + } + case 144: { + AutoMode = input.ReadInt32(); + break; + } + case 152: { + NoteSaltMode = input.ReadInt32(); + break; + } + case 161: { + AudioMultiplier = input.ReadDouble(); + break; + } + case 168: { + FaintNoteMode = input.ReadInt32(); + break; + } + case 176: { + JudgmentMode = input.ReadInt32(); + break; + } + case 184: { + HitPointsMode = input.ReadInt32(); + break; + } + case 192: { + NoteMobilityMode = input.ReadInt32(); + break; + } + case 200: { + LongNoteMode = input.ReadInt32(); + break; + } + case 208: { + InputFavorMode = input.ReadInt32(); + break; + } + case 216: { + NoteModifyMode = input.ReadInt32(); + break; + } + case 224: { + BpmMode = input.ReadInt32(); + break; + } + case 232: { + WaveMode = input.ReadInt32(); + break; + } + case 240: { + SetNoteMode = input.ReadInt32(); + break; + } + case 248: { + LowestJudgmentConditionMode = input.ReadInt32(); + break; + } + case 256: { + TotalNotes = input.ReadInt32(); + break; + } + case 265: { + JudgmentStage = input.ReadDouble(); + break; + } + case 273: { + HitPointsValue = input.ReadDouble(); + break; + } + case 280: { + HighestInputCount = input.ReadInt32(); + break; + } + case 289: { + Length = input.ReadDouble(); + break; + } + case 297: { + Bpm = input.ReadDouble(); + break; + } + case 305: { + Multiplier = input.ReadDouble(); + break; + } + case 312: { + InputMode = input.ReadInt32(); + break; + } + case 321: { + HighestJudgment0 = input.ReadDouble(); + break; + } + case 329: { + HigherJudgment0 = input.ReadDouble(); + break; + } + case 337: { + HighJudgment0 = input.ReadDouble(); + break; + } + case 345: { + LowJudgment0 = input.ReadDouble(); + break; + } + case 353: { + LowerJudgment0 = input.ReadDouble(); + break; + } + case 361: { + LowestJudgment0 = input.ReadDouble(); + break; + } + case 369: { + HighestJudgment1 = input.ReadDouble(); + break; + } + case 377: { + HigherJudgment1 = input.ReadDouble(); + break; + } + case 385: { + HighJudgment1 = input.ReadDouble(); + break; + } + case 393: { + LowJudgment1 = input.ReadDouble(); + break; + } + case 401: { + LowerJudgment1 = input.ReadDouble(); + break; + } + case 409: { + LowestJudgment1 = input.ReadDouble(); + break; + } + case 416: { + HighestJudgment = input.ReadInt32(); + break; + } + case 424: { + HigherJudgment = input.ReadInt32(); + break; + } + case 432: { + HighJudgment = input.ReadInt32(); + break; + } + case 440: { + LowJudgment = input.ReadInt32(); + break; + } + case 448: { + LowerJudgment = input.ReadInt32(); + break; + } + case 456: { + LowestJudgment = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + SiteID = input.ReadString(); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + AvatarNetStatus = (global::Qwilight.Event.Types.AvatarNetStatus) input.ReadEnum(); + break; + } + case 32: { + Stand = input.ReadInt32(); + break; + } + case 40: { + HighestBand = input.ReadInt32(); + break; + } + case 49: { + Point = input.ReadDouble(); + break; + } + case 57: { + HitPoints = input.ReadDouble(); + break; + } + case 64: { + IsFailed = input.ReadBool(); + break; + } + case 72: { + LastJudged = input.ReadInt32(); + break; + } + case 82: { + drawings_.AddEntriesFrom(ref input, _repeated_drawings_codec); + break; + } + case 90: { + if (drawingComponent_ == null) { + DrawingComponent = new global::Qwilight.Event.Types.DrawingComponent(); + } + input.ReadMessage(DrawingComponent); + break; + } + case 98: { + Title = input.ReadString(); + break; + } + case 106: { + Artist = input.ReadString(); + break; + } + case 114: { + Genre = input.ReadString(); + break; + } + case 120: { + Level = input.ReadInt32(); + break; + } + case 130: { + LevelText = input.ReadString(); + break; + } + case 138: { + WantLevelID = input.ReadString(); + break; + } + case 144: { + AutoMode = input.ReadInt32(); + break; + } + case 152: { + NoteSaltMode = input.ReadInt32(); + break; + } + case 161: { + AudioMultiplier = input.ReadDouble(); + break; + } + case 168: { + FaintNoteMode = input.ReadInt32(); + break; + } + case 176: { + JudgmentMode = input.ReadInt32(); + break; + } + case 184: { + HitPointsMode = input.ReadInt32(); + break; + } + case 192: { + NoteMobilityMode = input.ReadInt32(); + break; + } + case 200: { + LongNoteMode = input.ReadInt32(); + break; + } + case 208: { + InputFavorMode = input.ReadInt32(); + break; + } + case 216: { + NoteModifyMode = input.ReadInt32(); + break; + } + case 224: { + BpmMode = input.ReadInt32(); + break; + } + case 232: { + WaveMode = input.ReadInt32(); + break; + } + case 240: { + SetNoteMode = input.ReadInt32(); + break; + } + case 248: { + LowestJudgmentConditionMode = input.ReadInt32(); + break; + } + case 256: { + TotalNotes = input.ReadInt32(); + break; + } + case 265: { + JudgmentStage = input.ReadDouble(); + break; + } + case 273: { + HitPointsValue = input.ReadDouble(); + break; + } + case 280: { + HighestInputCount = input.ReadInt32(); + break; + } + case 289: { + Length = input.ReadDouble(); + break; + } + case 297: { + Bpm = input.ReadDouble(); + break; + } + case 305: { + Multiplier = input.ReadDouble(); + break; + } + case 312: { + InputMode = input.ReadInt32(); + break; + } + case 321: { + HighestJudgment0 = input.ReadDouble(); + break; + } + case 329: { + HigherJudgment0 = input.ReadDouble(); + break; + } + case 337: { + HighJudgment0 = input.ReadDouble(); + break; + } + case 345: { + LowJudgment0 = input.ReadDouble(); + break; + } + case 353: { + LowerJudgment0 = input.ReadDouble(); + break; + } + case 361: { + LowestJudgment0 = input.ReadDouble(); + break; + } + case 369: { + HighestJudgment1 = input.ReadDouble(); + break; + } + case 377: { + HigherJudgment1 = input.ReadDouble(); + break; + } + case 385: { + HighJudgment1 = input.ReadDouble(); + break; + } + case 393: { + LowJudgment1 = input.ReadDouble(); + break; + } + case 401: { + LowerJudgment1 = input.ReadDouble(); + break; + } + case 409: { + LowestJudgment1 = input.ReadDouble(); + break; + } + case 416: { + HighestJudgment = input.ReadInt32(); + break; + } + case 424: { + HigherJudgment = input.ReadInt32(); + break; + } + case 432: { + HighJudgment = input.ReadInt32(); + break; + } + case 440: { + LowJudgment = input.ReadInt32(); + break; + } + case 448: { + LowerJudgment = input.ReadInt32(); + break; + } + case 456: { + LowestJudgment = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class NetDrawing : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NetDrawing()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public NetDrawing() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public NetDrawing(NetDrawing other) : this() { + drawingVariety_ = other.drawingVariety_; + param_ = other.param_; + position0_ = other.position0_; + position1_ = other.position1_; + length_ = other.length_; + height_ = other.height_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public NetDrawing Clone() { + return new NetDrawing(this); + } + + /// Field number for the "drawingVariety" field. + public const int DrawingVarietyFieldNumber = 1; + private global::Qwilight.Event.Types.NetDrawing.Types.Variety drawingVariety_ = global::Qwilight.Event.Types.NetDrawing.Types.Variety.Note; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Qwilight.Event.Types.NetDrawing.Types.Variety DrawingVariety { + get { return drawingVariety_; } + set { + drawingVariety_ = value; + } + } + + /// Field number for the "param" field. + public const int ParamFieldNumber = 2; + private uint param_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Param { + get { return param_; } + set { + param_ = value; + } + } + + /// Field number for the "position0" field. + public const int Position0FieldNumber = 3; + private double position0_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Position0 { + get { return position0_; } + set { + position0_ = value; + } + } + + /// Field number for the "position1" field. + public const int Position1FieldNumber = 4; + private double position1_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Position1 { + get { return position1_; } + set { + position1_ = value; + } + } + + /// Field number for the "length" field. + public const int LengthFieldNumber = 5; + private double length_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Length { + get { return length_; } + set { + length_ = value; + } + } + + /// Field number for the "height" field. + public const int HeightFieldNumber = 6; + private double height_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Height { + get { return height_; } + set { + height_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as NetDrawing); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(NetDrawing other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DrawingVariety != other.DrawingVariety) return false; + if (Param != other.Param) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Position0, other.Position0)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Position1, other.Position1)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Length, other.Length)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Height, other.Height)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (DrawingVariety != global::Qwilight.Event.Types.NetDrawing.Types.Variety.Note) hash ^= DrawingVariety.GetHashCode(); + if (Param != 0) hash ^= Param.GetHashCode(); + if (Position0 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Position0); + if (Position1 != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Position1); + if (Length != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Length); + if (Height != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Height); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DrawingVariety != global::Qwilight.Event.Types.NetDrawing.Types.Variety.Note) { + output.WriteRawTag(8); + output.WriteEnum((int) DrawingVariety); + } + if (Param != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Param); + } + if (Position0 != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Position0); + } + if (Position1 != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Position1); + } + if (Length != 0D) { + output.WriteRawTag(41); + output.WriteDouble(Length); + } + if (Height != 0D) { + output.WriteRawTag(49); + output.WriteDouble(Height); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DrawingVariety != global::Qwilight.Event.Types.NetDrawing.Types.Variety.Note) { + output.WriteRawTag(8); + output.WriteEnum((int) DrawingVariety); + } + if (Param != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Param); + } + if (Position0 != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Position0); + } + if (Position1 != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Position1); + } + if (Length != 0D) { + output.WriteRawTag(41); + output.WriteDouble(Length); + } + if (Height != 0D) { + output.WriteRawTag(49); + output.WriteDouble(Height); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DrawingVariety != global::Qwilight.Event.Types.NetDrawing.Types.Variety.Note) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DrawingVariety); + } + if (Param != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Param); + } + if (Position0 != 0D) { + size += 1 + 8; + } + if (Position1 != 0D) { + size += 1 + 8; + } + if (Length != 0D) { + size += 1 + 8; + } + if (Height != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(NetDrawing other) { + if (other == null) { + return; + } + if (other.DrawingVariety != global::Qwilight.Event.Types.NetDrawing.Types.Variety.Note) { + DrawingVariety = other.DrawingVariety; + } + if (other.Param != 0) { + Param = other.Param; + } + if (other.Position0 != 0D) { + Position0 = other.Position0; + } + if (other.Position1 != 0D) { + Position1 = other.Position1; + } + if (other.Length != 0D) { + Length = other.Length; + } + if (other.Height != 0D) { + Height = other.Height; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + DrawingVariety = (global::Qwilight.Event.Types.NetDrawing.Types.Variety) input.ReadEnum(); + break; + } + case 16: { + Param = input.ReadUInt32(); + break; + } + case 25: { + Position0 = input.ReadDouble(); + break; + } + case 33: { + Position1 = input.ReadDouble(); + break; + } + case 41: { + Length = input.ReadDouble(); + break; + } + case 49: { + Height = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + DrawingVariety = (global::Qwilight.Event.Types.NetDrawing.Types.Variety) input.ReadEnum(); + break; + } + case 16: { + Param = input.ReadUInt32(); + break; + } + case 25: { + Position0 = input.ReadDouble(); + break; + } + case 33: { + Position1 = input.ReadDouble(); + break; + } + case 41: { + Length = input.ReadDouble(); + break; + } + case 49: { + Height = input.ReadDouble(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the NetDrawing message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum Variety { + [pbr::OriginalName("Note")] Note = 0, + [pbr::OriginalName("Main")] Main = 1, + [pbr::OriginalName("Meter")] Meter = 2, + } + + } + #endregion + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class DrawingComponent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DrawingComponent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DrawingComponent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DrawingComponent(DrawingComponent other) : this() { + p2BuiltLength_ = other.p2BuiltLength_; + judgmentMainPosition_ = other.judgmentMainPosition_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DrawingComponent Clone() { + return new DrawingComponent(this); + } + + /// Field number for the "p2BuiltLength" field. + public const int P2BuiltLengthFieldNumber = 1; + private float p2BuiltLength_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float P2BuiltLength { + get { return p2BuiltLength_; } + set { + p2BuiltLength_ = value; + } + } + + /// Field number for the "judgmentMainPosition" field. + public const int JudgmentMainPositionFieldNumber = 2; + private float judgmentMainPosition_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float JudgmentMainPosition { + get { return judgmentMainPosition_; } + set { + judgmentMainPosition_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DrawingComponent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DrawingComponent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(P2BuiltLength, other.P2BuiltLength)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(JudgmentMainPosition, other.JudgmentMainPosition)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (P2BuiltLength != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(P2BuiltLength); + if (JudgmentMainPosition != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(JudgmentMainPosition); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (P2BuiltLength != 0F) { + output.WriteRawTag(13); + output.WriteFloat(P2BuiltLength); + } + if (JudgmentMainPosition != 0F) { + output.WriteRawTag(21); + output.WriteFloat(JudgmentMainPosition); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (P2BuiltLength != 0F) { + output.WriteRawTag(13); + output.WriteFloat(P2BuiltLength); + } + if (JudgmentMainPosition != 0F) { + output.WriteRawTag(21); + output.WriteFloat(JudgmentMainPosition); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (P2BuiltLength != 0F) { + size += 1 + 4; + } + if (JudgmentMainPosition != 0F) { + size += 1 + 4; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DrawingComponent other) { + if (other == null) { + return; + } + if (other.P2BuiltLength != 0F) { + P2BuiltLength = other.P2BuiltLength; + } + if (other.JudgmentMainPosition != 0F) { + JudgmentMainPosition = other.JudgmentMainPosition; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 13: { + P2BuiltLength = input.ReadFloat(); + break; + } + case 21: { + JudgmentMainPosition = input.ReadFloat(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 13: { + P2BuiltLength = input.ReadFloat(); + break; + } + case 21: { + JudgmentMainPosition = input.ReadFloat(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightIOInput : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightIOInput()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOInput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOInput(QwilightIOInput other) : this() { + avatarIDs_ = other.avatarIDs_.Clone(); + handlerID_ = other.handlerID_; + input_ = other.input_; + power_ = other.power_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOInput Clone() { + return new QwilightIOInput(this); + } + + /// Field number for the "avatarIDs" field. + public const int AvatarIDsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_avatarIDs_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField avatarIDs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AvatarIDs { + get { return avatarIDs_; } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "input" field. + public const int InputFieldNumber = 3; + private int input_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Input { + get { return input_; } + set { + input_ = value; + } + } + + /// Field number for the "power" field. + public const int PowerFieldNumber = 4; + private int power_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Power { + get { return power_; } + set { + power_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightIOInput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightIOInput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!avatarIDs_.Equals(other.avatarIDs_)) return false; + if (HandlerID != other.HandlerID) return false; + if (Input != other.Input) return false; + if (Power != other.Power) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= avatarIDs_.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (Input != 0) hash ^= Input.GetHashCode(); + if (Power != 0) hash ^= Power.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + avatarIDs_.WriteTo(output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(24); + output.WriteInt32(Input); + } + if (Power != 0) { + output.WriteRawTag(32); + output.WriteInt32(Power); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + avatarIDs_.WriteTo(ref output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(24); + output.WriteInt32(Input); + } + if (Power != 0) { + output.WriteRawTag(32); + output.WriteInt32(Power); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += avatarIDs_.CalculateSize(_repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (Input != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Input); + } + if (Power != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Power); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightIOInput other) { + if (other == null) { + return; + } + avatarIDs_.Add(other.avatarIDs_); + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.Input != 0) { + Input = other.Input; + } + if (other.Power != 0) { + Power = other.Power; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + Input = input.ReadInt32(); + break; + } + case 32: { + Power = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(ref input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + Input = input.ReadInt32(); + break; + } + case 32: { + Power = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightIOInput : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightIOInput()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOInput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOInput(TwilightIOInput other) : this() { + handlerID_ = other.handlerID_; + input_ = other.input_; + power_ = other.power_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOInput Clone() { + return new TwilightIOInput(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "input" field. + public const int InputFieldNumber = 2; + private int input_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Input { + get { return input_; } + set { + input_ = value; + } + } + + /// Field number for the "power" field. + public const int PowerFieldNumber = 3; + private int power_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Power { + get { return power_; } + set { + power_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightIOInput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightIOInput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (Input != other.Input) return false; + if (Power != other.Power) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (Input != 0) hash ^= Input.GetHashCode(); + if (Power != 0) hash ^= Power.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(16); + output.WriteInt32(Input); + } + if (Power != 0) { + output.WriteRawTag(24); + output.WriteInt32(Power); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(16); + output.WriteInt32(Input); + } + if (Power != 0) { + output.WriteRawTag(24); + output.WriteInt32(Power); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (Input != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Input); + } + if (Power != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Power); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightIOInput other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.Input != 0) { + Input = other.Input; + } + if (other.Power != 0) { + Power = other.Power; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + Input = input.ReadInt32(); + break; + } + case 24: { + Power = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + Input = input.ReadInt32(); + break; + } + case 24: { + Power = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightIOJudge : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightIOJudge()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOJudge() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOJudge(QwilightIOJudge other) : this() { + avatarIDs_ = other.avatarIDs_.Clone(); + handlerID_ = other.handlerID_; + noteID_ = other.noteID_; + judged_ = other.judged_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOJudge Clone() { + return new QwilightIOJudge(this); + } + + /// Field number for the "avatarIDs" field. + public const int AvatarIDsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_avatarIDs_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField avatarIDs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AvatarIDs { + get { return avatarIDs_; } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "noteID" field. + public const int NoteIDFieldNumber = 3; + private int noteID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteID { + get { return noteID_; } + set { + noteID_ = value; + } + } + + /// Field number for the "judged" field. + public const int JudgedFieldNumber = 4; + private int judged_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Judged { + get { return judged_; } + set { + judged_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightIOJudge); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightIOJudge other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!avatarIDs_.Equals(other.avatarIDs_)) return false; + if (HandlerID != other.HandlerID) return false; + if (NoteID != other.NoteID) return false; + if (Judged != other.Judged) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= avatarIDs_.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (NoteID != 0) hash ^= NoteID.GetHashCode(); + if (Judged != 0) hash ^= Judged.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + avatarIDs_.WriteTo(output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(24); + output.WriteInt32(NoteID); + } + if (Judged != 0) { + output.WriteRawTag(32); + output.WriteInt32(Judged); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + avatarIDs_.WriteTo(ref output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(24); + output.WriteInt32(NoteID); + } + if (Judged != 0) { + output.WriteRawTag(32); + output.WriteInt32(Judged); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += avatarIDs_.CalculateSize(_repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (NoteID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NoteID); + } + if (Judged != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Judged); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightIOJudge other) { + if (other == null) { + return; + } + avatarIDs_.Add(other.avatarIDs_); + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.NoteID != 0) { + NoteID = other.NoteID; + } + if (other.Judged != 0) { + Judged = other.Judged; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + NoteID = input.ReadInt32(); + break; + } + case 32: { + Judged = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(ref input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + NoteID = input.ReadInt32(); + break; + } + case 32: { + Judged = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightIOJudge : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightIOJudge()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOJudge() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOJudge(TwilightIOJudge other) : this() { + handlerID_ = other.handlerID_; + noteID_ = other.noteID_; + judged_ = other.judged_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOJudge Clone() { + return new TwilightIOJudge(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "noteID" field. + public const int NoteIDFieldNumber = 2; + private int noteID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteID { + get { return noteID_; } + set { + noteID_ = value; + } + } + + /// Field number for the "judged" field. + public const int JudgedFieldNumber = 3; + private int judged_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Judged { + get { return judged_; } + set { + judged_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightIOJudge); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightIOJudge other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (NoteID != other.NoteID) return false; + if (Judged != other.Judged) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (NoteID != 0) hash ^= NoteID.GetHashCode(); + if (Judged != 0) hash ^= Judged.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(16); + output.WriteInt32(NoteID); + } + if (Judged != 0) { + output.WriteRawTag(24); + output.WriteInt32(Judged); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(16); + output.WriteInt32(NoteID); + } + if (Judged != 0) { + output.WriteRawTag(24); + output.WriteInt32(Judged); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (NoteID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NoteID); + } + if (Judged != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Judged); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightIOJudge other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.NoteID != 0) { + NoteID = other.NoteID; + } + if (other.Judged != 0) { + Judged = other.Judged; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + NoteID = input.ReadInt32(); + break; + } + case 24: { + Judged = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + NoteID = input.ReadInt32(); + break; + } + case 24: { + Judged = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightIOJudgmentMeter : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightIOJudgmentMeter()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOJudgmentMeter() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOJudgmentMeter(QwilightIOJudgmentMeter other) : this() { + avatarIDs_ = other.avatarIDs_.Clone(); + handlerID_ = other.handlerID_; + input_ = other.input_; + judgmentMeter_ = other.judgmentMeter_; + assist_ = other.assist_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOJudgmentMeter Clone() { + return new QwilightIOJudgmentMeter(this); + } + + /// Field number for the "avatarIDs" field. + public const int AvatarIDsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_avatarIDs_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField avatarIDs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AvatarIDs { + get { return avatarIDs_; } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "input" field. + public const int InputFieldNumber = 3; + private int input_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Input { + get { return input_; } + set { + input_ = value; + } + } + + /// Field number for the "judgmentMeter" field. + public const int JudgmentMeterFieldNumber = 4; + private double judgmentMeter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double JudgmentMeter { + get { return judgmentMeter_; } + set { + judgmentMeter_ = value; + } + } + + /// Field number for the "assist" field. + public const int AssistFieldNumber = 5; + private int assist_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Assist { + get { return assist_; } + set { + assist_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightIOJudgmentMeter); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightIOJudgmentMeter other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!avatarIDs_.Equals(other.avatarIDs_)) return false; + if (HandlerID != other.HandlerID) return false; + if (Input != other.Input) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(JudgmentMeter, other.JudgmentMeter)) return false; + if (Assist != other.Assist) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= avatarIDs_.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (Input != 0) hash ^= Input.GetHashCode(); + if (JudgmentMeter != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(JudgmentMeter); + if (Assist != 0) hash ^= Assist.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + avatarIDs_.WriteTo(output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(24); + output.WriteInt32(Input); + } + if (JudgmentMeter != 0D) { + output.WriteRawTag(33); + output.WriteDouble(JudgmentMeter); + } + if (Assist != 0) { + output.WriteRawTag(40); + output.WriteInt32(Assist); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + avatarIDs_.WriteTo(ref output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(24); + output.WriteInt32(Input); + } + if (JudgmentMeter != 0D) { + output.WriteRawTag(33); + output.WriteDouble(JudgmentMeter); + } + if (Assist != 0) { + output.WriteRawTag(40); + output.WriteInt32(Assist); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += avatarIDs_.CalculateSize(_repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (Input != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Input); + } + if (JudgmentMeter != 0D) { + size += 1 + 8; + } + if (Assist != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Assist); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightIOJudgmentMeter other) { + if (other == null) { + return; + } + avatarIDs_.Add(other.avatarIDs_); + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.Input != 0) { + Input = other.Input; + } + if (other.JudgmentMeter != 0D) { + JudgmentMeter = other.JudgmentMeter; + } + if (other.Assist != 0) { + Assist = other.Assist; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + Input = input.ReadInt32(); + break; + } + case 33: { + JudgmentMeter = input.ReadDouble(); + break; + } + case 40: { + Assist = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(ref input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + Input = input.ReadInt32(); + break; + } + case 33: { + JudgmentMeter = input.ReadDouble(); + break; + } + case 40: { + Assist = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightIOJudgmentMeter : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightIOJudgmentMeter()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOJudgmentMeter() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOJudgmentMeter(TwilightIOJudgmentMeter other) : this() { + handlerID_ = other.handlerID_; + input_ = other.input_; + judgmentMeter_ = other.judgmentMeter_; + assist_ = other.assist_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOJudgmentMeter Clone() { + return new TwilightIOJudgmentMeter(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "input" field. + public const int InputFieldNumber = 2; + private int input_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Input { + get { return input_; } + set { + input_ = value; + } + } + + /// Field number for the "judgmentMeter" field. + public const int JudgmentMeterFieldNumber = 3; + private double judgmentMeter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double JudgmentMeter { + get { return judgmentMeter_; } + set { + judgmentMeter_ = value; + } + } + + /// Field number for the "assist" field. + public const int AssistFieldNumber = 4; + private int assist_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Assist { + get { return assist_; } + set { + assist_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightIOJudgmentMeter); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightIOJudgmentMeter other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (Input != other.Input) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(JudgmentMeter, other.JudgmentMeter)) return false; + if (Assist != other.Assist) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (Input != 0) hash ^= Input.GetHashCode(); + if (JudgmentMeter != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(JudgmentMeter); + if (Assist != 0) hash ^= Assist.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(16); + output.WriteInt32(Input); + } + if (JudgmentMeter != 0D) { + output.WriteRawTag(25); + output.WriteDouble(JudgmentMeter); + } + if (Assist != 0) { + output.WriteRawTag(32); + output.WriteInt32(Assist); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (Input != 0) { + output.WriteRawTag(16); + output.WriteInt32(Input); + } + if (JudgmentMeter != 0D) { + output.WriteRawTag(25); + output.WriteDouble(JudgmentMeter); + } + if (Assist != 0) { + output.WriteRawTag(32); + output.WriteInt32(Assist); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (Input != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Input); + } + if (JudgmentMeter != 0D) { + size += 1 + 8; + } + if (Assist != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Assist); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightIOJudgmentMeter other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.Input != 0) { + Input = other.Input; + } + if (other.JudgmentMeter != 0D) { + JudgmentMeter = other.JudgmentMeter; + } + if (other.Assist != 0) { + Assist = other.Assist; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + Input = input.ReadInt32(); + break; + } + case 25: { + JudgmentMeter = input.ReadDouble(); + break; + } + case 32: { + Assist = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + Input = input.ReadInt32(); + break; + } + case 25: { + JudgmentMeter = input.ReadDouble(); + break; + } + case 32: { + Assist = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightIONoteVisibility : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightIONoteVisibility()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIONoteVisibility() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIONoteVisibility(QwilightIONoteVisibility other) : this() { + avatarIDs_ = other.avatarIDs_.Clone(); + handlerID_ = other.handlerID_; + noteID_ = other.noteID_; + setValidJudgedNotes_ = other.setValidJudgedNotes_; + setNoteFailed_ = other.setNoteFailed_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIONoteVisibility Clone() { + return new QwilightIONoteVisibility(this); + } + + /// Field number for the "avatarIDs" field. + public const int AvatarIDsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_avatarIDs_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField avatarIDs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AvatarIDs { + get { return avatarIDs_; } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "noteID" field. + public const int NoteIDFieldNumber = 3; + private int noteID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteID { + get { return noteID_; } + set { + noteID_ = value; + } + } + + /// Field number for the "setValidJudgedNotes" field. + public const int SetValidJudgedNotesFieldNumber = 4; + private bool setValidJudgedNotes_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool SetValidJudgedNotes { + get { return setValidJudgedNotes_; } + set { + setValidJudgedNotes_ = value; + } + } + + /// Field number for the "setNoteFailed" field. + public const int SetNoteFailedFieldNumber = 5; + private bool setNoteFailed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool SetNoteFailed { + get { return setNoteFailed_; } + set { + setNoteFailed_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightIONoteVisibility); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightIONoteVisibility other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!avatarIDs_.Equals(other.avatarIDs_)) return false; + if (HandlerID != other.HandlerID) return false; + if (NoteID != other.NoteID) return false; + if (SetValidJudgedNotes != other.SetValidJudgedNotes) return false; + if (SetNoteFailed != other.SetNoteFailed) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= avatarIDs_.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (NoteID != 0) hash ^= NoteID.GetHashCode(); + if (SetValidJudgedNotes != false) hash ^= SetValidJudgedNotes.GetHashCode(); + if (SetNoteFailed != false) hash ^= SetNoteFailed.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + avatarIDs_.WriteTo(output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(24); + output.WriteInt32(NoteID); + } + if (SetValidJudgedNotes != false) { + output.WriteRawTag(32); + output.WriteBool(SetValidJudgedNotes); + } + if (SetNoteFailed != false) { + output.WriteRawTag(40); + output.WriteBool(SetNoteFailed); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + avatarIDs_.WriteTo(ref output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(24); + output.WriteInt32(NoteID); + } + if (SetValidJudgedNotes != false) { + output.WriteRawTag(32); + output.WriteBool(SetValidJudgedNotes); + } + if (SetNoteFailed != false) { + output.WriteRawTag(40); + output.WriteBool(SetNoteFailed); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += avatarIDs_.CalculateSize(_repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (NoteID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NoteID); + } + if (SetValidJudgedNotes != false) { + size += 1 + 1; + } + if (SetNoteFailed != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightIONoteVisibility other) { + if (other == null) { + return; + } + avatarIDs_.Add(other.avatarIDs_); + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.NoteID != 0) { + NoteID = other.NoteID; + } + if (other.SetValidJudgedNotes != false) { + SetValidJudgedNotes = other.SetValidJudgedNotes; + } + if (other.SetNoteFailed != false) { + SetNoteFailed = other.SetNoteFailed; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + NoteID = input.ReadInt32(); + break; + } + case 32: { + SetValidJudgedNotes = input.ReadBool(); + break; + } + case 40: { + SetNoteFailed = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(ref input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + NoteID = input.ReadInt32(); + break; + } + case 32: { + SetValidJudgedNotes = input.ReadBool(); + break; + } + case 40: { + SetNoteFailed = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightIONoteVisibility : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightIONoteVisibility()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIONoteVisibility() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIONoteVisibility(TwilightIONoteVisibility other) : this() { + handlerID_ = other.handlerID_; + noteID_ = other.noteID_; + setValidJudgedNotes_ = other.setValidJudgedNotes_; + setNoteFailed_ = other.setNoteFailed_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIONoteVisibility Clone() { + return new TwilightIONoteVisibility(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "noteID" field. + public const int NoteIDFieldNumber = 2; + private int noteID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NoteID { + get { return noteID_; } + set { + noteID_ = value; + } + } + + /// Field number for the "setValidJudgedNotes" field. + public const int SetValidJudgedNotesFieldNumber = 3; + private bool setValidJudgedNotes_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool SetValidJudgedNotes { + get { return setValidJudgedNotes_; } + set { + setValidJudgedNotes_ = value; + } + } + + /// Field number for the "setNoteFailed" field. + public const int SetNoteFailedFieldNumber = 4; + private bool setNoteFailed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool SetNoteFailed { + get { return setNoteFailed_; } + set { + setNoteFailed_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightIONoteVisibility); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightIONoteVisibility other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (NoteID != other.NoteID) return false; + if (SetValidJudgedNotes != other.SetValidJudgedNotes) return false; + if (SetNoteFailed != other.SetNoteFailed) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (NoteID != 0) hash ^= NoteID.GetHashCode(); + if (SetValidJudgedNotes != false) hash ^= SetValidJudgedNotes.GetHashCode(); + if (SetNoteFailed != false) hash ^= SetNoteFailed.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(16); + output.WriteInt32(NoteID); + } + if (SetValidJudgedNotes != false) { + output.WriteRawTag(24); + output.WriteBool(SetValidJudgedNotes); + } + if (SetNoteFailed != false) { + output.WriteRawTag(32); + output.WriteBool(SetNoteFailed); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (NoteID != 0) { + output.WriteRawTag(16); + output.WriteInt32(NoteID); + } + if (SetValidJudgedNotes != false) { + output.WriteRawTag(24); + output.WriteBool(SetValidJudgedNotes); + } + if (SetNoteFailed != false) { + output.WriteRawTag(32); + output.WriteBool(SetNoteFailed); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (NoteID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NoteID); + } + if (SetValidJudgedNotes != false) { + size += 1 + 1; + } + if (SetNoteFailed != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightIONoteVisibility other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.NoteID != 0) { + NoteID = other.NoteID; + } + if (other.SetValidJudgedNotes != false) { + SetValidJudgedNotes = other.SetValidJudgedNotes; + } + if (other.SetNoteFailed != false) { + SetNoteFailed = other.SetNoteFailed; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + NoteID = input.ReadInt32(); + break; + } + case 24: { + SetValidJudgedNotes = input.ReadBool(); + break; + } + case 32: { + SetNoteFailed = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + NoteID = input.ReadInt32(); + break; + } + case 24: { + SetValidJudgedNotes = input.ReadBool(); + break; + } + case 32: { + SetNoteFailed = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightIOMultiplier : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightIOMultiplier()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOMultiplier() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOMultiplier(QwilightIOMultiplier other) : this() { + avatarIDs_ = other.avatarIDs_.Clone(); + handlerID_ = other.handlerID_; + multiplier_ = other.multiplier_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOMultiplier Clone() { + return new QwilightIOMultiplier(this); + } + + /// Field number for the "avatarIDs" field. + public const int AvatarIDsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_avatarIDs_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField avatarIDs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AvatarIDs { + get { return avatarIDs_; } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "multiplier" field. + public const int MultiplierFieldNumber = 3; + private double multiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Multiplier { + get { return multiplier_; } + set { + multiplier_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightIOMultiplier); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightIOMultiplier other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!avatarIDs_.Equals(other.avatarIDs_)) return false; + if (HandlerID != other.HandlerID) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Multiplier, other.Multiplier)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= avatarIDs_.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (Multiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Multiplier); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + avatarIDs_.WriteTo(output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (Multiplier != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Multiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + avatarIDs_.WriteTo(ref output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (Multiplier != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Multiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += avatarIDs_.CalculateSize(_repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (Multiplier != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightIOMultiplier other) { + if (other == null) { + return; + } + avatarIDs_.Add(other.avatarIDs_); + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.Multiplier != 0D) { + Multiplier = other.Multiplier; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 25: { + Multiplier = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(ref input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 25: { + Multiplier = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightIOMultiplier : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightIOMultiplier()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOMultiplier() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOMultiplier(TwilightIOMultiplier other) : this() { + handlerID_ = other.handlerID_; + multiplier_ = other.multiplier_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOMultiplier Clone() { + return new TwilightIOMultiplier(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "multiplier" field. + public const int MultiplierFieldNumber = 2; + private double multiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Multiplier { + get { return multiplier_; } + set { + multiplier_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightIOMultiplier); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightIOMultiplier other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Multiplier, other.Multiplier)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (Multiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Multiplier); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (Multiplier != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Multiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (Multiplier != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Multiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (Multiplier != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightIOMultiplier other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.Multiplier != 0D) { + Multiplier = other.Multiplier; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 17: { + Multiplier = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 17: { + Multiplier = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightIOAudioMultiplier : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightIOAudioMultiplier()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOAudioMultiplier() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOAudioMultiplier(QwilightIOAudioMultiplier other) : this() { + avatarIDs_ = other.avatarIDs_.Clone(); + handlerID_ = other.handlerID_; + audioMultiplier_ = other.audioMultiplier_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightIOAudioMultiplier Clone() { + return new QwilightIOAudioMultiplier(this); + } + + /// Field number for the "avatarIDs" field. + public const int AvatarIDsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_avatarIDs_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField avatarIDs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AvatarIDs { + get { return avatarIDs_; } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "audioMultiplier" field. + public const int AudioMultiplierFieldNumber = 3; + private double audioMultiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double AudioMultiplier { + get { return audioMultiplier_; } + set { + audioMultiplier_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightIOAudioMultiplier); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightIOAudioMultiplier other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!avatarIDs_.Equals(other.avatarIDs_)) return false; + if (HandlerID != other.HandlerID) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(AudioMultiplier, other.AudioMultiplier)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= avatarIDs_.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (AudioMultiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(AudioMultiplier); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + avatarIDs_.WriteTo(output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (AudioMultiplier != 0D) { + output.WriteRawTag(25); + output.WriteDouble(AudioMultiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + avatarIDs_.WriteTo(ref output, _repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (AudioMultiplier != 0D) { + output.WriteRawTag(25); + output.WriteDouble(AudioMultiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += avatarIDs_.CalculateSize(_repeated_avatarIDs_codec); + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (AudioMultiplier != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightIOAudioMultiplier other) { + if (other == null) { + return; + } + avatarIDs_.Add(other.avatarIDs_); + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.AudioMultiplier != 0D) { + AudioMultiplier = other.AudioMultiplier; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 25: { + AudioMultiplier = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + avatarIDs_.AddEntriesFrom(ref input, _repeated_avatarIDs_codec); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 25: { + AudioMultiplier = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightIOAudioMultiplier : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightIOAudioMultiplier()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOAudioMultiplier() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOAudioMultiplier(TwilightIOAudioMultiplier other) : this() { + handlerID_ = other.handlerID_; + audioMultiplier_ = other.audioMultiplier_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightIOAudioMultiplier Clone() { + return new TwilightIOAudioMultiplier(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "audioMultiplier" field. + public const int AudioMultiplierFieldNumber = 2; + private double audioMultiplier_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double AudioMultiplier { + get { return audioMultiplier_; } + set { + audioMultiplier_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightIOAudioMultiplier); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightIOAudioMultiplier other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(AudioMultiplier, other.AudioMultiplier)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (AudioMultiplier != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(AudioMultiplier); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (AudioMultiplier != 0D) { + output.WriteRawTag(17); + output.WriteDouble(AudioMultiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (AudioMultiplier != 0D) { + output.WriteRawTag(17); + output.WriteDouble(AudioMultiplier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (AudioMultiplier != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightIOAudioMultiplier other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.AudioMultiplier != 0D) { + AudioMultiplier = other.AudioMultiplier; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 17: { + AudioMultiplier = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 17: { + AudioMultiplier = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightAudioInput : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightAudioInput()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightAudioInput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightAudioInput(TwilightAudioInput other) : this() { + siteID_ = other.siteID_; + avatarID_ = other.avatarID_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightAudioInput Clone() { + return new TwilightAudioInput(this); + } + + /// Field number for the "siteID" field. + public const int SiteIDFieldNumber = 1; + private string siteID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string SiteID { + get { return siteID_; } + set { + siteID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "avatarID" field. + public const int AvatarIDFieldNumber = 2; + private string avatarID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string AvatarID { + get { return avatarID_; } + set { + avatarID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightAudioInput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightAudioInput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SiteID != other.SiteID) return false; + if (AvatarID != other.AvatarID) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SiteID.Length != 0) hash ^= SiteID.GetHashCode(); + if (AvatarID.Length != 0) hash ^= AvatarID.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SiteID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SiteID); + } + if (AvatarID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AvatarID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SiteID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SiteID); + } + if (AvatarID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AvatarID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SiteID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SiteID); + } + if (AvatarID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AvatarID); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightAudioInput other) { + if (other == null) { + return; + } + if (other.SiteID.Length != 0) { + SiteID = other.SiteID; + } + if (other.AvatarID.Length != 0) { + AvatarID = other.AvatarID; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + SiteID = input.ReadString(); + break; + } + case 18: { + AvatarID = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + SiteID = input.ReadString(); + break; + } + case 18: { + AvatarID = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class QwilightPostItem : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QwilightPostItem()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightPostItem() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightPostItem(QwilightPostItem other) : this() { + siteID_ = other.siteID_; + handlerID_ = other.handlerID_; + postedItem_ = other.postedItem_; + isPositive_ = other.isPositive_; + lowestWait_ = other.lowestWait_; + highestWait_ = other.highestWait_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public QwilightPostItem Clone() { + return new QwilightPostItem(this); + } + + /// Field number for the "siteID" field. + public const int SiteIDFieldNumber = 1; + private string siteID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string SiteID { + get { return siteID_; } + set { + siteID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 2; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "postedItem" field. + public const int PostedItemFieldNumber = 3; + private int postedItem_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int PostedItem { + get { return postedItem_; } + set { + postedItem_ = value; + } + } + + /// Field number for the "isPositive" field. + public const int IsPositiveFieldNumber = 4; + private int isPositive_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int IsPositive { + get { return isPositive_; } + set { + isPositive_ = value; + } + } + + /// Field number for the "lowestWait" field. + public const int LowestWaitFieldNumber = 5; + private double lowestWait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double LowestWait { + get { return lowestWait_; } + set { + lowestWait_ = value; + } + } + + /// Field number for the "highestWait" field. + public const int HighestWaitFieldNumber = 6; + private double highestWait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double HighestWait { + get { return highestWait_; } + set { + highestWait_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as QwilightPostItem); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(QwilightPostItem other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SiteID != other.SiteID) return false; + if (HandlerID != other.HandlerID) return false; + if (PostedItem != other.PostedItem) return false; + if (IsPositive != other.IsPositive) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(LowestWait, other.LowestWait)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(HighestWait, other.HighestWait)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SiteID.Length != 0) hash ^= SiteID.GetHashCode(); + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (PostedItem != 0) hash ^= PostedItem.GetHashCode(); + if (IsPositive != 0) hash ^= IsPositive.GetHashCode(); + if (LowestWait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LowestWait); + if (HighestWait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(HighestWait); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SiteID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SiteID); + } + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (PostedItem != 0) { + output.WriteRawTag(24); + output.WriteInt32(PostedItem); + } + if (IsPositive != 0) { + output.WriteRawTag(32); + output.WriteInt32(IsPositive); + } + if (LowestWait != 0D) { + output.WriteRawTag(41); + output.WriteDouble(LowestWait); + } + if (HighestWait != 0D) { + output.WriteRawTag(49); + output.WriteDouble(HighestWait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SiteID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SiteID); + } + if (HandlerID.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HandlerID); + } + if (PostedItem != 0) { + output.WriteRawTag(24); + output.WriteInt32(PostedItem); + } + if (IsPositive != 0) { + output.WriteRawTag(32); + output.WriteInt32(IsPositive); + } + if (LowestWait != 0D) { + output.WriteRawTag(41); + output.WriteDouble(LowestWait); + } + if (HighestWait != 0D) { + output.WriteRawTag(49); + output.WriteDouble(HighestWait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SiteID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SiteID); + } + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (PostedItem != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(PostedItem); + } + if (IsPositive != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IsPositive); + } + if (LowestWait != 0D) { + size += 1 + 8; + } + if (HighestWait != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(QwilightPostItem other) { + if (other == null) { + return; + } + if (other.SiteID.Length != 0) { + SiteID = other.SiteID; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.PostedItem != 0) { + PostedItem = other.PostedItem; + } + if (other.IsPositive != 0) { + IsPositive = other.IsPositive; + } + if (other.LowestWait != 0D) { + LowestWait = other.LowestWait; + } + if (other.HighestWait != 0D) { + HighestWait = other.HighestWait; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + SiteID = input.ReadString(); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + PostedItem = input.ReadInt32(); + break; + } + case 32: { + IsPositive = input.ReadInt32(); + break; + } + case 41: { + LowestWait = input.ReadDouble(); + break; + } + case 49: { + HighestWait = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + SiteID = input.ReadString(); + break; + } + case 18: { + HandlerID = input.ReadString(); + break; + } + case 24: { + PostedItem = input.ReadInt32(); + break; + } + case 32: { + IsPositive = input.ReadInt32(); + break; + } + case 41: { + LowestWait = input.ReadDouble(); + break; + } + case 49: { + HighestWait = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TwilightPostItem : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TwilightPostItem()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Qwilight.Event.Descriptor.NestedTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightPostItem() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightPostItem(TwilightPostItem other) : this() { + handlerID_ = other.handlerID_; + postedItem_ = other.postedItem_; + avatarName_ = other.avatarName_; + wait_ = other.wait_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TwilightPostItem Clone() { + return new TwilightPostItem(this); + } + + /// Field number for the "handlerID" field. + public const int HandlerIDFieldNumber = 1; + private string handlerID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HandlerID { + get { return handlerID_; } + set { + handlerID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "postedItem" field. + public const int PostedItemFieldNumber = 2; + private int postedItem_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int PostedItem { + get { return postedItem_; } + set { + postedItem_ = value; + } + } + + /// Field number for the "avatarName" field. + public const int AvatarNameFieldNumber = 3; + private string avatarName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string AvatarName { + get { return avatarName_; } + set { + avatarName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "wait" field. + public const int WaitFieldNumber = 4; + private double wait_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Wait { + get { return wait_; } + set { + wait_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TwilightPostItem); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TwilightPostItem other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HandlerID != other.HandlerID) return false; + if (PostedItem != other.PostedItem) return false; + if (AvatarName != other.AvatarName) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Wait, other.Wait)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HandlerID.Length != 0) hash ^= HandlerID.GetHashCode(); + if (PostedItem != 0) hash ^= PostedItem.GetHashCode(); + if (AvatarName.Length != 0) hash ^= AvatarName.GetHashCode(); + if (Wait != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Wait); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (PostedItem != 0) { + output.WriteRawTag(16); + output.WriteInt32(PostedItem); + } + if (AvatarName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(AvatarName); + } + if (Wait != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Wait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HandlerID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(HandlerID); + } + if (PostedItem != 0) { + output.WriteRawTag(16); + output.WriteInt32(PostedItem); + } + if (AvatarName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(AvatarName); + } + if (Wait != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Wait); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HandlerID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HandlerID); + } + if (PostedItem != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(PostedItem); + } + if (AvatarName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AvatarName); + } + if (Wait != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TwilightPostItem other) { + if (other == null) { + return; + } + if (other.HandlerID.Length != 0) { + HandlerID = other.HandlerID; + } + if (other.PostedItem != 0) { + PostedItem = other.PostedItem; + } + if (other.AvatarName.Length != 0) { + AvatarName = other.AvatarName; + } + if (other.Wait != 0D) { + Wait = other.Wait; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + PostedItem = input.ReadInt32(); + break; + } + case 26: { + AvatarName = input.ReadString(); + break; + } + case 33: { + Wait = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + HandlerID = input.ReadString(); + break; + } + case 16: { + PostedItem = input.ReadInt32(); + break; + } + case 26: { + AvatarName = input.ReadString(); + break; + } + case 33: { + Wait = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Qwilight/Qwilight/ICC.cs b/Qwilight/Qwilight/ICC.cs new file mode 100644 index 0000000..9db7030 --- /dev/null +++ b/Qwilight/Qwilight/ICC.cs @@ -0,0 +1,43 @@ +namespace Qwilight +{ + public sealed class ICC + { + public enum ID + { + ViewAllowWindow, + ViewEntryWindow, + ViewFileWindow, + Quit, + ViewPwWindow, + ViewInputWindow, + MoveEntryView, + PointEntryView, + MoveDefaultEntryView, + MoveFrontEntryView, + PointEventNoteView, + PointZMaxView, + GetSignInCipher, + SetSignInCipher, + GetSignUpCipher, + InitSignUpCipher, + GetPwWindowCipher, + ClearPwWindowCipher, + SetBaseDrawingUIElement, + SetWindowedMode, + SetNoteFileModeWindowInputs, + GetWindowArea, + SetWindowArea, + GetWPFView, + SetD2DView, + SetD2DViewArea, + SetD2DViewVisibility, + GetWindowHandle, + SetVoteWindowEdgeView, + FadingLoadingView + } + + public ID IDValue { get; init; } + + public object Contents { get; init; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/JSON.cs b/Qwilight/Qwilight/JSON.cs new file mode 100644 index 0000000..2da771a --- /dev/null +++ b/Qwilight/Qwilight/JSON.cs @@ -0,0 +1,836 @@ +using Qwilight.NoteFile; +using Qwilight.Utilities; + +namespace Qwilight +{ + public static class JSON + { + public struct AssetClient + { + public uint valve; + public string platform; + } + + public struct BMSTable + { + public string name = string.Empty; + public string symbol = string.Empty; + public string data_url = string.Empty; + public object[] level_order = Array.Empty(); + + public BMSTable() + { + } + } + + public struct BMSTableData + { + public string title = string.Empty; + public string artist = string.Empty; + public string url = string.Empty; + public string url_diff = string.Empty; + public string md5 = string.Empty; + public object level; + public string sha256 = string.Empty; + public string comment = string.Empty; + + public BMSTableData() + { + } + } + + public struct Bmson + { + public BGA bga = new BGA(); + public BpmEvent[] bpm_events = Array.Empty(); + public BmsonInfo info = new BmsonInfo(); + public BarLine[] lines = Array.Empty(); + public SoundChannel[] mine_channels = Array.Empty(); + public SoundChannel[] sound_channels = Array.Empty(); + public StopEvent[] stop_events = Array.Empty(); + + public Bmson() + { + } + + public struct BGA + { + public BGAEvent[] bga_events = Array.Empty(); + public BGAHeader[] bga_header = Array.Empty(); + public BGAEvent[] layer_events = Array.Empty(); + public BGAEvent[] poor_events = Array.Empty(); + + public BGA() + { + } + + public struct BGAEvent + { + public object id; + public long y; + } + + public struct BGAHeader + { + public object id; + public string name = string.Empty; + + public BGAHeader() + { + } + } + } + + public struct BpmEvent + { + public double bpm; + public long y; + } + + public struct BmsonInfo + { + public string artist = string.Empty; + public string back_image = string.Empty; + public string banner_image = string.Empty; + public string chart_name = string.Empty; + public string eyecatch_image = string.Empty; + public string genre = string.Empty; + public double init_bpm = 130.0; + public double judge_rank = 100.0; + public long level; + public long ln_type = 1L; + public string mode_hint = "beat-7k"; + public long resolution = 240L; + public string[] subartists = Array.Empty(); + public string subtitle = string.Empty; + public string title = string.Empty; + public string title_image = string.Empty; + public double total = 100.0; + + public BmsonInfo() + { + } + } + + public struct BarLine + { + public long y; + } + + public struct SoundChannel + { + public string name = string.Empty; + public Note[] notes = Array.Empty(); + + public SoundChannel() + { + } + + public struct Note + { + public bool c; + public double damage; + public long l; + public long x; + public long y; + } + } + + public struct StopEvent + { + public long duration; + public long y; + } + } + + public struct TaehuiQwilight + { + public string date; + public string hash; + public string title; + } + + public struct TwilightWwwComment + { + public bool? favor; + public int totalFavor; + public Comment[] comments; + + public struct Comment + { + public long? date; + public string avatarID; + public string avatarName; + public double multiplier; + public ModeComponent.AutoMode autoMode; + public ModeComponent.NoteSaltMode noteSaltMode; + public double audioMultiplier; + public ModeComponent.FaintNoteMode faintNoteMode; + public ModeComponent.JudgmentMode judgmentMode; + public ModeComponent.HitPointsMode hitPointsMode; + public ModeComponent.NoteMobilityMode noteMobilityMode; + public ModeComponent.LongNoteMode longNoteMode; + public ModeComponent.InputFavorMode inputFavorMode; + public ModeComponent.NoteModifyMode noteModifyMode; + public ModeComponent.LowestJudgmentConditionMode lowestJudgmentConditionMode; + public int stand; + public int band; + public bool isP; + public double point; + public int salt; + public string commentID; + public string commentary; + public bool isPaused; + public int inputFlags; + } + } + + public struct TwilightEstablish + { + public string avatarID; + + public string avatarName; + } + + public struct TwilightSignIn + { + public string totem; + public string avatarID; + public string avatarName; + } + + public struct TwilightNotSignIn + { + public string avatarID; + public string avatarName; + } + + public struct TwilightWwwDefaultDate + { + public long date; + } + + public struct TwilightWwwSite + { + public string siteID; + public string siteName; + public int siteConfigure; + public bool hasCipher; + public int avatarCount; + } + + public struct TwilightSiteYell + { + public string siteID; + public string avatarID; + public string avatarName; + public long date; + public string siteYell; + public int siteYellID; + } + + public struct TwilightModifySiteYell + { + public string siteID; + public int siteYellID; + public string siteYell; + } + + public struct TwilightWipeSiteYell + { + public string siteID; + public int siteYellID; + } + + public struct TwilightCommentSiteYell + { + public string avatarID; + public string avatarName; + public string artist; + public string title; + public string genre; + public string levelText; + public BaseNoteFile.Level level; + public int stand; + public int hitPointsMode; + } + + public struct TwilightInviteSiteYell + { + public string avatarName; + public string siteID; + public string siteName; + } + + public struct TwilightTVSiteYell + { + public string href; + public string title; + public string text; + } + + public struct TwilightGetSiteYells + { + public string siteID; + public TwilightSiteYellItem[] data; + } + + public class TwilightCallSiteNet + { + public string bundleEntryPath; + public string[] noteIDs; + public string bundleName; + public string siteID; + public string noteID; + public string title; + public string artist; + public string levelText; + public BaseNoteFile.Level level; + public string wantLevelID; + public string genre; + public double judgmentStage; + public double hitPointsValue; + public int totalNotes; + public int longNotes; + public int autoableNotes; + public int trapNotes; + public int highestInputCount; + public double length; + public double bpm; + public double lowestBPM; + public double highestBPM; + public Component.InputMode inputMode; + public bool isAutoLongNote; + public bool isFavorNoteFile; + public bool isFavorModeComponent; + public bool isFavorAudioMultiplier; + public bool isAutoSiteHand; + public int validHunterMode; + public int validNetMode; + public int[] allowedPostableItems; + } + + public sealed class TwilightEnterSite : TwilightCallSiteNet + { + public string siteNotify; + public bool isNetSite; + public bool isGetNotify; + public bool isEditable; + public bool isAudioInput; + public TwilightSiteYellItem[] data; + public ModeComponentData modeComponentData; + } + + public struct TwilightSiteYellItem + { + public string avatarID; + public string avatarName; + public long date; + public string siteYell; + public int siteYellID; + + public override string ToString() + { + var ltDate = DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongTimeString(); + switch (avatarName) + { + case "@Enter": + return $"{siteYell} {ltDate} {LanguageSystem.Instance.SiteYellEnter}"; + case "@Quit": + return $"{siteYell} {ltDate} {LanguageSystem.Instance.SiteYellQuit}"; + case "@Site": + return $"{siteYell} {ltDate} {LanguageSystem.Instance.SiteYellNewSite}"; + case "@Net": + return $"{siteYell} {ltDate} {LanguageSystem.Instance.SiteYellNewNetSite}"; + case "@Notify": + return $"{LanguageSystem.Instance.SiteYellTaehui} {ltDate} {siteYell}"; + case "@Invite": + var twilightInviteSiteYell = Utility.GetJSON(siteYell); + return $"{twilightInviteSiteYell.avatarName} {ltDate} {string.Format(LanguageSystem.Instance.NotifySiteYellInvite, twilightInviteSiteYell.siteName)}"; + case "@TV": + var twilightTVSiteYell = Utility.GetJSON(siteYell); + return $"{twilightTVSiteYell.text} {ltDate} {string.Format(LanguageSystem.Instance.NotifySiteYellTV, twilightTVSiteYell.title)}"; + case "@Wiped": + return $"{avatarName} {ltDate} {LanguageSystem.Instance.WipedSiteYell}"; + case "@Comment": + var twilightCommentSiteYell = Utility.GetJSON(siteYell); + return $"{twilightCommentSiteYell.avatarName} {ltDate} {Utility.GetPlatformText(twilightCommentSiteYell.title, twilightCommentSiteYell.artist, Utility.GetGenreText(twilightCommentSiteYell.genre), twilightCommentSiteYell.levelText)} {twilightCommentSiteYell.stand.ToString(LanguageSystem.Instance.StandContents)}"; + case "": + return siteYell; + default: + return $"{avatarName} {ltDate} {siteYell}"; + } + } + } + + public struct TwilightCallBundle + { + public string targetAvatar; + public bool isWindowOpen; + public long targetValue; + public long bundleLength; + public BundleDataItem[] data; + } + + public struct BundleDataItem + { + public int bundleVariety; + public long date; + public string bundleName; + public long bundleLength; + public int bundleCompetence; + } + + public struct TwilightCallConfigure + { + public int silentSiteCompetence; + public int toNotifyUbuntuCompetence; + public int defaultBundleCompetence; + public int ioCompetence; + public int toNotifySaveBundle; + } + + public struct TwilightCallUbuntu + { + public string ubuntuID; + public string ubuntuName; + public int situationValue; + public string situationText; + } + + public struct TwilightCallSiteAvatar + { + public string siteID; + public string siteName; + public string siteHand; + public int situationValue; + public bool setNoteFile; + public CallSiteAvatarItem[] data; + } + + public struct TwilightCallSiteModeComponent + { + public string siteID; + public ModeComponentData modeComponentData; + } + + public sealed class ModeComponentData + { + public int salt; + public ModeComponent.AutoMode autoMode; + public ModeComponent.NoteSaltMode noteSaltMode; + public double audioMultiplier; + public ModeComponent.FaintNoteMode faintNoteMode; + public ModeComponent.JudgmentMode judgmentMode; + public ModeComponent.HitPointsMode hitPointsMode; + public ModeComponent.NoteMobilityMode noteMobilityMode; + public ModeComponent.LongNoteMode longNoteMode; + public ModeComponent.InputFavorMode inputFavorMode; + public ModeComponent.NoteModifyMode noteModifyMode; + public ModeComponent.BPMMode bpmMode; + public ModeComponent.WaveMode waveMode; + public ModeComponent.SetNoteMode setNoteMode; + public ModeComponent.LowestJudgmentConditionMode lowestJudgmentConditionMode; + public ModeComponent.PutCopyNotes putCopyNotes; + public double highestJudgment0; + public double higherJudgment0; + public double highJudgment0; + public double lowJudgment0; + public double lowerJudgment0; + public double lowestJudgment0; + public double highestJudgment1; + public double higherJudgment1; + public double highJudgment1; + public double lowJudgment1; + public double lowerJudgment1; + public double lowestJudgment1; + public double lowestLongNoteModify; + public double highestLongNoteModify; + public double putNoteSet; + public double putNoteSetMillis; + public double highestHitPoints0; + public double higherHitPoints0; + public double highHitPoints0; + public double lowHitPoints0; + public double lowerHitPoints0; + public double lowestHitPoints0; + public double highestHitPoints1; + public double higherHitPoints1; + public double highHitPoints1; + public double lowHitPoints1; + public double lowerHitPoints1; + public double lowestHitPoints1; + } + + public struct CallSiteAvatarItem + { + public string avatarID; + public int avatarConfigure; + public string avatarName; + public int avatarGroup; + public bool isValve; + public bool isAudioInput; + } + + public struct TwilightSaveBundle + { + public string bundleID; + public int bundleVariety; + public int bundleLength; + } + + public struct TwilightSavedBundle + { + public string bundleID; + public int bundleVariety; + public string bundleName; + public string etc; + } + + public struct TwilightLevyNet + { + public string siteID; + public string[] noteIDs; + public string handlerID; + public bool isSiteHand; + public bool isFavorModeComponent; + public bool isFavorAudioMultiplier; + public int validNetMode; + public int avatarsCount; + public int[] allowedPostableItems; + public ModeComponentData modeComponentData; + } + + public struct TwilightQuitNet + { + public string handlerID; + public QuitNetItem[] quitNetItems; + + public struct QuitNetItem + { + public string avatarID; + public string avatarName; + public string title; + public string artist; + public string genre; + public BaseNoteFile.Level level; + public string levelText; + public string wantLevelID; + public ModeComponent.AutoMode autoMode; + public ModeComponent.NoteSaltMode noteSaltMode; + public double audioMultiplier; + public ModeComponent.FaintNoteMode faintNoteMode; + public ModeComponent.HitPointsMode hitPointsMode; + public ModeComponent.JudgmentMode judgmentMode; + public ModeComponent.NoteMobilityMode noteMobilityMode; + public ModeComponent.InputFavorMode inputFavorMode; + public ModeComponent.LongNoteMode longNoteMode; + public ModeComponent.NoteModifyMode noteModifyMode; + public ModeComponent.BPMMode bpmMode; + public ModeComponent.WaveMode waveMode; + public ModeComponent.SetNoteMode setNoteMode; + public ModeComponent.LowestJudgmentConditionMode lowestJudgmentConditionMode; + public int totalNotes; + public double judgmentStage; + public double hitPointsValue; + public int highestInputCount; + public double length; + public double bpm; + public double multiplier; + public Component.InputMode inputMode; + public int stand; + public int highestBand; + public double point; + public double hitPoints; + public bool isF; + public int netPosition; + public double highestJudgment0; + public double higherJudgment0; + public double highJudgment0; + public double lowJudgment0; + public double lowerJudgment0; + public double lowestJudgment0; + public double highestJudgment1; + public double higherJudgment1; + public double highJudgment1; + public double lowJudgment1; + public double lowerJudgment1; + public double lowestJudgment1; + } + } + + public struct TwilightCallNetSiteComments + { + public long date; + public CallNetSIteCommentItem[] data; + + public struct CallNetSIteCommentItem + { + public int avatarNetStatus; + public string avatarID; + public string avatarName; + public int stand; + public int band; + public double point; + public int highestJudgment; + public int higherJudgment; + public int highJudgment; + public int lowJudgment; + public int lowerJudgment; + public int lowestJudgment; + } + } + + public struct TwilightSaveAsBundle + { + public string bundleID; + public int bundleVariety; + public string bundleName; + public string bundleEntryPath; + } + + public struct TwilightCallIO + { + public string avatarID; + public string handlerID; + public double ioMillis; + } + + public struct TwilightCallIOComponent + { + public string noteID; + public string handlerID; + public string avatarID; + public ModeComponentData data; + public string avatarName; + public string ioHandlerID; + public bool isFailMode; + public double ioMillis; + public double targetIOMillis; + } + + public struct TwilightCompiledIO + { + public string avatarID; + public string avatarName; + public string handlerID; + public bool isCompiled; + } + + public struct TwilightLevyIO + { + public string handlerID; + public double levyingWait; + public int lastStand; + public bool isF; + public double multiplier; + public double audioMultiplier; + public double ioMillis; + } + + public struct TwilightIOQuit + { + public string handlerID; + public string avatarID; + } + + public struct TwilightIOPause + { + public string handlerID; + public bool isPaused; + } + + public struct TwilightWwwVote + { + public BaseNoteFile.NoteVariety noteVariety; + public string title; + public string artist; + public string genre; + public string www; + public bool isFavorite; + } + + public struct TwilightWwwTitle + { + public string title; + public string titleColor; + } + + public struct TwilightWwwTitles + { + public string titleID; + public string title; + public string titleColor; + } + + public struct TwilightWwwLevelAvatars + { + public Avatar[] avatars; + public string[] levelIDs; + + public struct Avatar + { + public string avatarID; + public string avatarName; + } + } + + public struct TwilightWwwLevels + { + public string levelID; + public string noteID; + public string title; + public string comment; + public string levelText; + public BaseNoteFile.Level level; + public double avatars; + } + + public struct TwilightWwwLevel + { + public LevelItem[] levelNote; + public int[] stand; + public double[] point; + public int[] band; + public int[][] judgments; + public ModeComponent.AutoMode[] autoMode; + public ModeComponent.NoteSaltMode[] noteSaltMode; + public double[] audioMultiplier; + public ModeComponent.FaintNoteMode[] faintNoteMode; + public ModeComponent.JudgmentMode[] judgmentMode; + public ModeComponent.HitPointsMode[] hitPointsMode; + public ModeComponent.NoteMobilityMode[] noteMobilityMode; + public ModeComponent.LongNoteMode[] longNoteMode; + public ModeComponent.InputFavorMode[] inputFavorMode; + public ModeComponent.NoteModifyMode[] noteModifyMode; + public ModeComponent.BPMMode[] bpmMode; + public ModeComponent.WaveMode[] waveMode; + public ModeComponent.SetNoteMode[] setNoteMode; + public ModeComponent.LowestJudgmentConditionMode[] lowestJudgmentConditionMode; + public bool allowPause; + public Title[] titles; + public string[] edgeIDs; + + public struct LevelItem + { + public string noteID; + public BaseNoteFile.NoteVariety noteVariety; + public string artist; + public string title; + public string genre; + public string levelText; + public BaseNoteFile.Level level; + } + + public struct Title + { + public string titleID; + public string title; + public string titleColor; + } + } + + public struct TwilightWwwAvatar + { + public string avatarID; + public string avatarName; + public string avatarIntro; + public int totalCount; + public double totalLength; + public int highestCount; + public long date; + public int[] avatarLevels; + public double avatarAbility5K; + public double avatarAbility5KClass; + public int avatarAbility5KPlace; + public int avatarAbility5KCount; + public double avatarAbility7K; + public double avatarAbility7KClass; + public int avatarAbility7KPlace; + public int avatarAbility7KCount; + public double avatarAbility9K; + public double avatarAbility9KClass; + public int avatarAbility9KPlace; + public int avatarAbility9KCount; + public AvatarLevel[] levels; + public Last[] lasts; + public AvatarAbility[] abilities5K; + public AvatarAbility[] abilities7K; + public AvatarAbility[] abilities9K; + public Favorite[] favorites; + public long[] dateSet; + public int[] dateValues; + public int[] quitStatusValues; + + public struct AvatarLevel + { + public string levelID; + public string title; + public string comment; + public string levelText; + public BaseNoteFile.Level level; + public long date; + } + + public struct Last + { + public string noteID; + public BaseNoteFile.NoteVariety noteVariety; + public string artist; + public string title; + public string genre; + public string levelText; + public BaseNoteFile.Level level; + public long date; + } + + public struct Favorite + { + public string noteID; + public BaseNoteFile.NoteVariety noteVariety; + public string artist; + public string title; + public string genre; + public string levelText; + public BaseNoteFile.Level level; + public int totalCount; + } + + public struct AvatarAbility + { + public string noteID; + public BaseNoteFile.NoteVariety noteVariety; + public string artist; + public string title; + public string genre; + public string levelText; + public BaseNoteFile.Level level; + public int stand; + public double ability; + } + } + + public struct TwilightWwwWow + { + public Avatar[] totalAvatars; + public Avatar[] totalAvatarsAt; + public Avatar[] highestAvatars; + public Avatar[] highestAvatarsAt; + public Avatar[] standAvatars; + public Avatar[] standAvatarsAt; + public Avatar[] bandAvatars; + public Avatar[] bandAvatarsAt; + public Avatar[] ability5KAvatars; + public Avatar[] ability7KAvatars; + public Avatar[] ability9KAvatars; + public Avatar[] levelAvatars; + + public struct Avatar + { + public string avatarID; + public string avatarName; + public double value; + } + } + } +} diff --git a/Qwilight/Qwilight/Levels.cs b/Qwilight/Qwilight/Levels.cs new file mode 100644 index 0000000..fc4a1e1 --- /dev/null +++ b/Qwilight/Qwilight/Levels.cs @@ -0,0 +1,21 @@ +using System.Windows; + +namespace Qwilight +{ + public static class Levels + { + public const double EdgeMargin = 1.25; + public const double EdgeXY = (1.0 - EdgeMargin) / 2; + + public static readonly double FontLevel0 = QwilightComponent.GetBuiltInData("FontLevel0"); + public static readonly double FontLevel1 = QwilightComponent.GetBuiltInData("FontLevel1"); + public static readonly double StandardEllipse = QwilightComponent.GetBuiltInData("StandardEllipse").BottomLeft; + public static readonly double StandardMargin = QwilightComponent.GetBuiltInData("StandardMargin").Left; + public static readonly double WindowEllipse = QwilightComponent.GetBuiltInData("WindowEllipse").BottomLeft; + public static readonly float FontLevel0Float32 = (float)FontLevel0; + public static readonly float FontLevel1Float32 = (float)FontLevel1; + public static readonly float StandardEllipseFloat32 = (float)StandardEllipse; + public static readonly float StandardMarginFloat32 = (float)StandardMargin; + public static readonly float StandardEdgeFloat32 = (float)QwilightComponent.GetBuiltInData("StandardEdge").Left; + } +} diff --git a/Qwilight/Qwilight/MediaModifier.cs b/Qwilight/Qwilight/MediaModifier.cs new file mode 100644 index 0000000..7a36365 --- /dev/null +++ b/Qwilight/Qwilight/MediaModifier.cs @@ -0,0 +1,56 @@ +using Qwilight.Utilities; +using System.Diagnostics; +using System.IO; + +namespace Qwilight +{ + public sealed class MediaModifier + { + readonly object _exeCSX = new(); + Process _exe; + bool _isAvailable = true; + + public string Text { get; set; } = string.Empty; + + public void ModifyMedia(string mediaFilePath, string hashMediaFilePath, bool isWrongMedia, bool isCounterWave) + { + try + { + lock (_exeCSX) + { + if (_isAvailable) + { + _exe = Process.Start(new ProcessStartInfo(Path.Combine(QwilightComponent.SoftwareEntryPath, "ffmpeg.exe"), $""" + -i "{mediaFilePath}" -y -an {(isWrongMedia || isCounterWave ? string.Empty : "-vcodec copy")} {(isCounterWave ? "-vf reverse" : string.Empty)} -preset ultrafast "{hashMediaFilePath}" + """) + { + CreateNoWindow = true + }); + } + } + if (_isAvailable) + { + Text = LanguageSystem.Instance.MediaModifierContents; + _exe.WaitForExit(); + if (_exe.ExitCode != 0) + { + Utility.WipeFile(hashMediaFilePath); + } + } + } + finally + { + Text = string.Empty; + } + } + + public void StopModifyMedia() + { + lock (_exeCSX) + { + _isAvailable = false; + _exe?.Kill(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ModeComponent.cs b/Qwilight/Qwilight/ModeComponent.cs new file mode 100644 index 0000000..ff9248e --- /dev/null +++ b/Qwilight/Qwilight/ModeComponent.cs @@ -0,0 +1,1225 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Text.Json.Serialization; +using Windows.UI; + +namespace Qwilight +{ + public sealed class ModeComponent : Model + { + public enum AutoMode + { + Default, Autoable + } + + public enum NoteSaltMode + { + Default, Symmetric, Salt, InputSalt = 4, MeterSalt = 11, HalfInputSalt = 13 + } + + public enum FaintNoteMode + { + Default, Faint, Fading, TotalFading + } + + public enum JudgmentMode + { + Lower, Default, Higher, Lowest, Highest, Favor + } + + public enum HitPointsMode + { + Lower, Default, Higher, Failed, Lowest, Highest, Favor, Test + } + + public enum NoteMobilityMode + { + Default, _4DHD, ZipHD = 3, _4D, Zip + } + + public enum LongNoteMode + { + Default, Auto, Input + } + + public enum InputFavorMode + { + Default, Mode4 = 4, Mode5, Mode6, Mode7, Mode8, Mode9, Mode51, Mode71, Mode102, Mode142, Mode10, Mode242, Mode484 + } + + public enum NoteModifyMode + { + Default, InputNote, LongNote + } + + public enum BPMMode + { + Default, Not + } + + public enum WaveMode + { + Default, Counter + } + + public enum SetNoteMode + { + Default, Put, VoidPut = 3 + } + + public enum LowestJudgmentConditionMode + { + Default, Wrong + } + + public enum PutCopyNotes + { + Default, Copy, P1Symmetric, P2Symmetric + } + + int _salt = Environment.TickCount; + bool _valueCanModifyMultiplier = true; + bool _valueCanModifyAudioMultiplier = true; + Computing _valueComputing; + double _multiplierValue = 1000.0; + double _sentMultiplier = 1.0; + AutoMode _autoMode; + NoteSaltMode _noteSaltMode; + double _audioMultiplier = 1.0; + FaintNoteMode _faintNoteMode; + JudgmentMode _judgmentMode = JudgmentMode.Default; + HitPointsMode _hitPointsMode = HitPointsMode.Highest; + NoteMobilityMode _noteMobilityMode; + LongNoteMode _longNoteMode; + InputFavorMode _inputFavorMode; + NoteModifyMode _noteModifyMode; + BPMMode _bpmMode; + WaveMode _waveMode; + SetNoteMode _setNoteMode; + LowestJudgmentConditionMode _lowestJudgmentConditionMode; + PutCopyNotes _putCopyNotes; + double _unitMultiplier = 0.01; + double _lowestLongNoteModify = 100.0; + double _highestLongNoteModify = 100.0; + double _putNoteSet = 25.0; + double _putNoteSetMillis = 100.0; + + public bool IsNoteSaltModeWarning(string date) => Utility.IsLowerDate(Version.Parse(date), 1, 14, 27) && (NoteSaltModeValue == NoteSaltMode.InputSalt || NoteSaltModeValue == NoteSaltMode.MeterSalt || NoteSaltModeValue == NoteSaltMode.HalfInputSalt); + + public bool IsGASWarning => HitPointsModeValue == HitPointsMode.Default || HitPointsModeValue == HitPointsMode.Higher; + + public Component ComponentValue { get; } + + public ModeComponent() + { + ComponentValue = new Component(BPM); + } + + public ModeComponent(Computing valueComputing, JSON.TwilightQuitNet.QuitNetItem quitNetItem) + { + ComponentValue = new Component(quitNetItem.bpm); + ComputingValue = valueComputing; + AutoModeValue = (AutoMode)quitNetItem.autoMode; + NoteSaltModeValue = (NoteSaltMode)quitNetItem.noteSaltMode; + AudioMultiplier = quitNetItem.audioMultiplier; + FaintNoteModeValue = (FaintNoteMode)quitNetItem.faintNoteMode; + JudgmentModeValue = (JudgmentMode)quitNetItem.judgmentMode; + HitPointsModeValue = (HitPointsMode)quitNetItem.hitPointsMode; + NoteMobilityModeValue = (NoteMobilityMode)quitNetItem.noteMobilityMode; + LongNoteModeValue = (LongNoteMode)quitNetItem.longNoteMode; + InputFavorModeValue = (InputFavorMode)quitNetItem.inputFavorMode; + NoteModifyModeValue = (NoteModifyMode)quitNetItem.noteModifyMode; + BPMModeValue = (BPMMode)quitNetItem.bpmMode; + WaveModeValue = (WaveMode)quitNetItem.waveMode; + SetNoteModeValue = (SetNoteMode)quitNetItem.setNoteMode; + LowestJudgmentConditionModeValue = (LowestJudgmentConditionMode)quitNetItem.lowestJudgmentConditionMode; + SentMultiplier = quitNetItem.multiplier; + MultiplierValue = BPM * AudioMultiplier * SentMultiplier; + HighestJudgment0 = quitNetItem.highestJudgment0; + HigherJudgment0 = quitNetItem.higherJudgment0; + HighJudgment0 = quitNetItem.highJudgment0; + LowJudgment0 = quitNetItem.lowJudgment0; + LowerJudgment0 = quitNetItem.lowerJudgment0; + LowestJudgment0 = quitNetItem.lowestJudgment0; + HighestJudgment1 = quitNetItem.highestJudgment1; + HigherJudgment1 = quitNetItem.higherJudgment1; + HighJudgment1 = quitNetItem.highJudgment1; + LowJudgment1 = quitNetItem.lowJudgment1; + LowerJudgment1 = quitNetItem.lowerJudgment1; + LowestJudgment1 = quitNetItem.lowestJudgment1; + } + + public PutCopyNotes PutCopyNotesValueV2 + { + get => _putCopyNotes; + + set + { + if (SetProperty(ref _putCopyNotes, value, nameof(PutCopyNotesValueV2))) + { + OnPropertyChanged(nameof(PutCopyNotesText)); + OnPropertyChanged(nameof(PutCopyNotesAvailable)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public bool PutCopyNotesAvailable => PutCopyNotesValueV2 != PutCopyNotes.Default; + + public string PutCopyNotesText => PutCopyNotesValueV2 switch + { + PutCopyNotes.Default => LanguageSystem.Instance.DefaultPutCopyNotesText, + PutCopyNotes.Copy => LanguageSystem.Instance.CopyPutCopyNotesText, + PutCopyNotes.P1Symmetric => LanguageSystem.Instance.P1SymmetricCopyNotesText, + PutCopyNotes.P2Symmetric => LanguageSystem.Instance.P2SymmetricCopyNotesText, + _ => default + }; + + public bool CanBeTwilightComment => JudgmentModeValue != JudgmentMode.Favor && + HandlingHitPointsModeValue != HitPointsMode.Favor && HandlingHitPointsModeValue != HitPointsMode.Test && + LongNoteModeValue != LongNoteMode.Input && + NoteModifyModeValue != NoteModifyMode.LongNote && + BPMModeValue == BPMMode.Default && + WaveModeValue == WaveMode.Default && + SetNoteModeValue == SetNoteMode.Default && + PutCopyNotesValueV2 == PutCopyNotes.Default; + + public string CanBeTwilightCommentContents => CanBeTwilightComment ? LanguageSystem.Instance.CanBeTwilightCommentContents : LanguageSystem.Instance.CannotBeTwilightCommentContents; + + public bool IsLowerStand => (Component.AutoableInputCounts[(int)InputMode] > 0 && AutoModeValue == AutoMode.Autoable) || + AudioMultiplier < 1.0 || + JudgmentModeValue == JudgmentMode.Lower || JudgmentModeValue == JudgmentMode.Lowest || + HitPointsModeValue == HitPointsMode.Lower || HitPointsModeValue == HitPointsMode.Lowest || + LongNoteModeValue == LongNoteMode.Auto || + (InputFavorModeValue != InputFavorMode.Default && (Component.AutoableInputCounts[(int)InputFavorModeValue] < Component.AutoableInputCounts[(int)InputMode] || Component.InputCounts[(int)InputFavorModeValue] < Component.InputCounts[(int)InputMode])); + + /// + /// 계산된 스크롤 속도 + /// + public double Multiplier => Math.Max(0.0, CanModifyMultiplier ? MultiplierValue / (BPM * AudioMultiplier) : SentMultiplier); + + public string IIDXMultiplierMillisText + { + get + { + var value = ViewModels.Instance.MainValue.GetHandlingComputer()?.GetIIDXMultiplierMillis(this) ?? 0.0; + return $"{value:#,##0.##} ms ({6 * value / 10:#,##0} frame IIDX)"; + } + } + + [JsonIgnore] + public double BPM => ComputingValue?.BPM ?? Component.StandardBPM; + + [JsonIgnore] + public Component.InputMode InputMode => ComputingValue?.InputMode ?? default; + + [JsonIgnore] + public bool IsSalt => ComputingValue?.IsSalt ?? false; + + [JsonIgnore] + public bool CanModifyMultiplier + { + get => _valueCanModifyMultiplier; + + set + { + if (SetProperty(ref _valueCanModifyMultiplier, value, nameof(CanModifyMultiplier))) + { + NotifyIIDXMultiplierMillisText(); + } + } + } + + [JsonIgnore] + public bool CanModifyAudioMultiplier + { + get => _valueCanModifyAudioMultiplier; + + set => SetProperty(ref _valueCanModifyAudioMultiplier, value, nameof(CanModifyAudioMultiplier)); + } + + public double MultiplierValue + { + get => _multiplierValue; + + set + { + if (SetProperty(ref _multiplierValue, value, nameof(MultiplierValue))) + { + OnPropertyChanged(nameof(Multiplier)); + NotifyIIDXMultiplierMillisText(); + } + } + } + + [JsonIgnore] + public Computing ComputingValue + { + get => _valueComputing; + + set + { + if (SetProperty(ref _valueComputing, value, nameof(Multiplier))) + { + ComponentValue.SetBPM(BPM); + NotifyIIDXMultiplierMillisText(); + } + } + } + + /// + /// 고정 스크롤 속도 + /// + [JsonIgnore] + public double SentMultiplier + { + get => _sentMultiplier; + + set + { + if (SetProperty(ref _sentMultiplier, value, nameof(Multiplier))) + { + NotifyIIDXMultiplierMillisText(); + } + } + } + + public void NotifyIIDXMultiplierMillisText() => OnPropertyChanged(nameof(IIDXMultiplierMillisText)); + + public int Salt + { + get => _salt; + + set => SetProperty(ref _salt, value, nameof(Salt)); + } + + public AutoMode AutoModeValue + { + get => _autoMode; + + set + { + if (SetProperty(ref _autoMode, value, nameof(AutoModeValue))) + { + OnPropertyChanged(nameof(AutoModeContents)); + } + } + } + + public string AutoModeContents => LanguageSystem.Instance.AutoModeTexts[(int)AutoModeValue]; + + public NoteSaltMode NoteSaltModeValue + { + get => _noteSaltMode; + + set + { + if (SetProperty(ref _noteSaltMode, value, nameof(NoteSaltModeValue))) + { + OnPropertyChanged(nameof(NoteSaltModeContents)); + } + } + } + + public string NoteSaltModeContents => LanguageSystem.Instance.NoteSaltModeTexts[(int)NoteSaltModeValue]; + + public bool IsAudioMultiplierWarning => AudioMultiplier == 0.98 || AudioMultiplier == 0.99 || AudioMultiplier == 1.01 || AudioMultiplier == 1.02; + + public double AudioMultiplier + { + get => _audioMultiplier; + + set + { + if (SetProperty(ref _audioMultiplier, value, nameof(AudioMultiplier))) + { + OnPropertyChanged(nameof(Multiplier)); + NotifyIIDXMultiplierMillisText(); + } + } + } + + public FaintNoteMode FaintNoteModeValue + { + get => _faintNoteMode; + + set + { + if (SetProperty(ref _faintNoteMode, value, nameof(FaintNoteModeValue))) + { + OnPropertyChanged(nameof(FaintNoteModeContents)); + } + } + } + + public string FaintNoteModeContents => LanguageSystem.Instance.FaintNoteModeTexts[(int)FaintNoteModeValue]; + + public JudgmentMode JudgmentModeValue + { + get => _judgmentMode; + + set + { + if (SetProperty(ref _judgmentMode, value, nameof(JudgmentModeValue))) + { + OnPropertyChanged(nameof(JudgmentModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public string JudgmentModeContents => LanguageSystem.Instance.JudgmentModeTexts[(int)JudgmentModeValue]; + + public HitPointsMode HitPointsModeValue + { + get => _hitPointsMode; + + set + { + if (SetProperty(ref _hitPointsMode, value, nameof(HitPointsModeValue))) + { + OnPropertyChanged(nameof(HitPointsModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + HandlingHitPointsModeValue = value; + } + } + + public string HitPointsModeContents => LanguageSystem.Instance.HitPointsModeTexts[(int)HitPointsModeValue]; + + [JsonIgnore] + public HitPointsMode HandlingHitPointsModeValue { get; set; } + + public Color HandlingHitPointsColor => BaseUI.Instance.HitPointsColor[(int)HandlingHitPointsModeValue]; + + public bool CanGAS => HandlingHitPointsModeValue == HitPointsMode.Highest || HandlingHitPointsModeValue == HitPointsMode.Higher; + + public NoteMobilityMode NoteMobilityModeValue + { + get => _noteMobilityMode; + + set + { + if (SetProperty(ref _noteMobilityMode, value, nameof(NoteMobilityModeValue))) + { + OnPropertyChanged(nameof(NoteMobilityModeContents)); + } + } + } + + public string NoteMobilityModeContents => LanguageSystem.Instance.NoteMobilityModeTexts[(int)NoteMobilityModeValue]; + + public LongNoteMode LongNoteModeValue + { + get => _longNoteMode; + + set + { + if (SetProperty(ref _longNoteMode, value, nameof(LongNoteModeValue))) + { + OnPropertyChanged(nameof(LongNoteModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public string LongNoteModeContents => LanguageSystem.Instance.LongNoteModeTexts[(int)LongNoteModeValue]; + + public InputFavorMode InputFavorModeValue + { + get => _inputFavorMode; + + set + { + if (SetProperty(ref _inputFavorMode, value, nameof(InputFavorModeValue))) + { + OnPropertyChanged(nameof(InputFavorModeContents)); + } + } + } + + public string InputFavorModeContents => LanguageSystem.Instance.InputFavorModeTexts[(int)InputFavorModeValue]; + + public NoteModifyMode NoteModifyModeValue + { + get => _noteModifyMode; + + set + { + if (SetProperty(ref _noteModifyMode, value, nameof(NoteModifyModeValue))) + { + OnPropertyChanged(nameof(NoteModifyModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public string NoteModifyModeContents => LanguageSystem.Instance.NoteModifyModeTexts[(int)NoteModifyModeValue]; + + public BPMMode BPMModeValue + { + get => _bpmMode; + + set + { + if (SetProperty(ref _bpmMode, value, nameof(BPMModeValue))) + { + OnPropertyChanged(nameof(BPMModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public string BPMModeContents => LanguageSystem.Instance.BPMModeTexts[(int)BPMModeValue]; + + public WaveMode WaveModeValue + { + get => _waveMode; + + set + { + if (SetProperty(ref _waveMode, value, nameof(WaveModeValue))) + { + OnPropertyChanged(nameof(WaveModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public string WaveModeContents => LanguageSystem.Instance.WaveModeTexts[(int)WaveModeValue]; + + public SetNoteMode SetNoteModeValue + { + get => _setNoteMode; + + set + { + if (SetProperty(ref _setNoteMode, value, nameof(SetNoteModeValue))) + { + OnPropertyChanged(nameof(SetNoteModeContents)); + OnPropertyChanged(nameof(CanBeTwilightCommentContents)); + } + } + } + + public string SetNoteModeContents => LanguageSystem.Instance.SetNoteModeTexts[(int)SetNoteModeValue]; + + public LowestJudgmentConditionMode LowestJudgmentConditionModeValue + { + get => _lowestJudgmentConditionMode; + + set + { + if (SetProperty(ref _lowestJudgmentConditionMode, value, nameof(LowestJudgmentConditionModeValue))) + { + OnPropertyChanged(nameof(LowestJudgmentConditionModeContents)); + } + } + } + + public string LowestJudgmentConditionModeContents => LanguageSystem.Instance.LowestJudgmentConditionModeTexts[(int)LowestJudgmentConditionModeValue]; + + public double[][] FavorJudgments { get; set; } = new double[6][] + { + new double[] { -1.0, 1.0 }, + new double[] { -1.0, 1.0 }, + new double[] { -1.0, 1.0 }, + new double[] { -1.0, 1.0 }, + new double[] { -1.0, 1.0 }, + new double[] { -1.0, 1.0 } + }; + + [JsonIgnore] + public double HighestJudgment0 + { + get => FavorJudgments[(int)Component.Judged.Highest][0]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Highest][0], value, nameof(HighestJudgment0))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Highest][1], Math.Max(HighestJudgment1, HighestJudgment0), nameof(HighestJudgment1)); + } + } + } + + [JsonIgnore] + public double HigherJudgment0 + { + get => FavorJudgments[(int)Component.Judged.Higher][0]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Higher][0], value, nameof(HigherJudgment0))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Higher][1], Math.Max(HigherJudgment1, HigherJudgment0), nameof(HigherJudgment1)); + } + } + } + + [JsonIgnore] + public double HighJudgment0 + { + get => FavorJudgments[(int)Component.Judged.High][0]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.High][0], value, nameof(HighJudgment0))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.High][1], Math.Max(HighJudgment1, HighJudgment0), nameof(HighJudgment1)); + } + } + } + + [JsonIgnore] + public double LowJudgment0 + { + get => FavorJudgments[(int)Component.Judged.Low][0]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Low][0], value, nameof(LowJudgment0))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Low][1], Math.Max(LowJudgment1, LowJudgment0), nameof(LowJudgment1)); + } + } + } + + [JsonIgnore] + public double LowerJudgment0 + { + get => FavorJudgments[(int)Component.Judged.Lower][0]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Lower][0], value, nameof(LowerJudgment0))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Lower][1], Math.Max(LowerJudgment1, LowerJudgment0), nameof(LowerJudgment1)); + } + } + } + + [JsonIgnore] + public double LowestJudgment0 + { + get => FavorJudgments[(int)Component.Judged.Lowest][0]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Lowest][0], value, nameof(LowestJudgment0))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Lowest][1], Math.Max(LowestJudgment1, LowestJudgment0), nameof(LowestJudgment1)); + } + } + } + + [JsonIgnore] + public double HighestJudgment1 + { + get => FavorJudgments[(int)Component.Judged.Highest][1]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Highest][1], value, nameof(HighestJudgment1))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Highest][0], Math.Min(HighestJudgment0, HighestJudgment1), nameof(HighestJudgment0)); + } + } + } + + [JsonIgnore] + public double HigherJudgment1 + { + get => FavorJudgments[(int)Component.Judged.Higher][1]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Higher][1], value, nameof(HigherJudgment1))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Higher][0], Math.Min(HigherJudgment0, HigherJudgment1), nameof(HigherJudgment0)); + } + } + } + + [JsonIgnore] + public double HighJudgment1 + { + get => FavorJudgments[(int)Component.Judged.High][1]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.High][1], value, nameof(HighJudgment1))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.High][0], Math.Min(HighJudgment0, HighJudgment1), nameof(HighJudgment0)); + } + } + } + + [JsonIgnore] + public double LowJudgment1 + { + get => FavorJudgments[(int)Component.Judged.Low][1]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Low][1], value, nameof(LowJudgment1))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Low][0], Math.Min(LowJudgment0, LowJudgment1), nameof(LowJudgment0)); + } + } + } + + [JsonIgnore] + public double LowerJudgment1 + { + get => FavorJudgments[(int)Component.Judged.Lower][1]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Lower][1], value, nameof(LowerJudgment1))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Lower][0], Math.Min(LowerJudgment0, LowerJudgment1), nameof(LowerJudgment0)); + } + } + } + + [JsonIgnore] + public double LowestJudgment1 + { + get => FavorJudgments[(int)Component.Judged.Lowest][1]; + + set + { + if (SetProperty(ref FavorJudgments[(int)Component.Judged.Lowest][1], value, nameof(LowestJudgment1))) + { + SetProperty(ref FavorJudgments[(int)Component.Judged.Lowest][0], Math.Min(LowestJudgment0, LowestJudgment1), nameof(LowestJudgment0)); + } + } + } + + public double[][] FavorHitPoints { get; set; } = new double[6][] + { + new double[] { 0.0, 0.0 }, + new double[] { 0.0, 0.0 }, + new double[] { 0.0, 0.0 }, + new double[] { 0.0, 0.0 }, + new double[] { 0.0, 0.0 }, + new double[] { 0.0, 0.0 } + }; + + [JsonIgnore] + public double HighestHitPoints0 + { + get => FavorHitPoints[(int)Component.Judged.Highest][0]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Highest][0], value, nameof(HighestHitPoints0)); + } + + [JsonIgnore] + public double HigherHitPoints0 + { + get => FavorHitPoints[(int)Component.Judged.Higher][0]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Higher][0], value, nameof(HigherHitPoints0)); + } + + [JsonIgnore] + public double HighHitPoints0 + { + get => FavorHitPoints[(int)Component.Judged.High][0]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.High][0], value, nameof(HighHitPoints0)); + } + + [JsonIgnore] + public double LowHitPoints0 + { + get => FavorHitPoints[(int)Component.Judged.Low][0]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Low][0], value, nameof(LowHitPoints0)); + } + + [JsonIgnore] + public double LowerHitPoints0 + { + get => FavorHitPoints[(int)Component.Judged.Lower][0]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Lower][0], value, nameof(LowerHitPoints0)); + } + + [JsonIgnore] + public double LowestHitPoints0 + { + get => FavorHitPoints[(int)Component.Judged.Lowest][0]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Lowest][0], value, nameof(LowestHitPoints0)); + } + + [JsonIgnore] + public double HighestHitPoints1 + { + get => FavorHitPoints[(int)Component.Judged.Highest][1]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Highest][1], value, nameof(HighestHitPoints1)); + } + + [JsonIgnore] + public double HigherHitPoints1 + { + get => FavorHitPoints[(int)Component.Judged.Higher][1]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Higher][1], value, nameof(HigherHitPoints1)); + } + + [JsonIgnore] + public double HighHitPoints1 + { + get => FavorHitPoints[(int)Component.Judged.High][1]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.High][1], value, nameof(HighHitPoints1)); + } + + [JsonIgnore] + public double LowHitPoints1 + { + get => FavorHitPoints[(int)Component.Judged.Low][1]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Low][1], value, nameof(LowHitPoints1)); + } + + [JsonIgnore] + public double LowerHitPoints1 + { + get => FavorHitPoints[(int)Component.Judged.Lower][1]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Lower][1], value, nameof(LowerHitPoints1)); + } + + [JsonIgnore] + public double LowestHitPoints1 + { + get => FavorHitPoints[(int)Component.Judged.Lowest][1]; + + set => SetProperty(ref FavorHitPoints[(int)Component.Judged.Lowest][1], value, nameof(LowestHitPoints1)); + } + + public void SetLowestAutoLongNoteModify() + { + if (Configure.Instance.LowestAutoLongNoteModify) + { + LowestLongNoteModify = 1000.0 * 240.0 / (BPM * AudioMultiplier) / Configure.Instance.LowestAutoLongNoteModifyValue; + } + } + + public void SetHighestAutoLongNoteModify() + { + if (Configure.Instance.HighestAutoLongNoteModify) + { + HighestLongNoteModify = 1000.0 * 240.0 / (BPM * AudioMultiplier) / Configure.Instance.HighestAutoLongNoteModifyValue; + } + } + + public void SetAutoPutNoteSetMillis() + { + if (Configure.Instance.AutoPutNoteSetMillis) + { + PutNoteSetMillis = 1000.0 * 240.0 / (BPM * AudioMultiplier) / Configure.Instance.AutoPutNoteSetMillisValue; + } + } + + public double LowestLongNoteModify + { + get => _lowestLongNoteModify; + + set => SetProperty(ref _lowestLongNoteModify, value, nameof(LowestLongNoteModify)); + } + + public double HighestLongNoteModify + { + get => _highestLongNoteModify; + + set => SetProperty(ref _highestLongNoteModify, value, nameof(HighestLongNoteModify)); + } + + public double PutNoteSet + { + get => _putNoteSet; + + set => SetProperty(ref _putNoteSet, value, nameof(PutNoteSet)); + } + + public double PutNoteSetMillis + { + get => _putNoteSetMillis; + + set => SetProperty(ref _putNoteSetMillis, value, nameof(PutNoteSetMillis)); + } + + public object GetJSON() => new + { + salt = Salt, + autoMode = AutoModeValue, + noteSaltMode = NoteSaltModeValue, + audioMultiplier = AudioMultiplier, + faintNoteMode = FaintNoteModeValue, + judgmentMode = JudgmentModeValue, + hitPointsMode = HandlingHitPointsModeValue, + noteMobilityMode = NoteMobilityModeValue, + longNoteMode = LongNoteModeValue, + inputFavorMode = InputFavorModeValue, + noteModifyMode = NoteModifyModeValue, + bpmMode = BPMModeValue, + waveMode = WaveModeValue, + setNoteMode = SetNoteModeValue, + lowestJudgmentConditionMode = LowestJudgmentConditionModeValue, + putCopyNotes = PutCopyNotesValueV2, + highestJudgment0 = HighestJudgment0, + higherJudgment0 = HigherJudgment0, + highJudgment0 = HighJudgment0, + lowJudgment0 = LowJudgment0, + lowerJudgment0 = LowerJudgment0, + lowestJudgment0 = LowestJudgment0, + highestJudgment1 = HighestJudgment1, + higherJudgment1 = HigherJudgment1, + highJudgment1 = HighJudgment1, + lowJudgment1 = LowJudgment1, + lowerJudgment1 = LowerJudgment1, + lowestJudgment1 = LowestJudgment1, + lowestLongNoteModify = LowestLongNoteModify, + highestLongNoteModify = HighestLongNoteModify, + putNoteSet = PutNoteSet, + putNoteSetMillis = PutNoteSetMillis, + highestHitPoints0 = HighestHitPoints0, + higherHitPoints0 = HigherHitPoints0, + highHitPoints0 = HighHitPoints0, + lowHitPoints0 = LowHitPoints0, + lowerHitPoints0 = LowerHitPoints0, + lowestHitPoints0 = LowestHitPoints0, + highestHitPoints1 = HighestHitPoints1, + higherHitPoints1 = HigherHitPoints1, + highHitPoints1 = HighHitPoints1, + lowHitPoints1 = LowHitPoints1, + lowerHitPoints1 = LowerHitPoints1, + lowestHitPoints1 = LowestHitPoints1, + }; + + public void InitModeComponent() + { + AutoModeValue = AutoMode.Default; + NoteSaltModeValue = NoteSaltMode.Default; + SetAudioMultiplier(1.0); + FaintNoteModeValue = FaintNoteMode.Default; + JudgmentModeValue = JudgmentMode.Default; + HitPointsModeValue = HitPointsMode.Highest; + NoteMobilityModeValue = NoteMobilityMode.Default; + LongNoteModeValue = LongNoteMode.Default; + InputFavorModeValue = InputFavorMode.Default; + NoteModifyModeValue = NoteModifyMode.Default; + BPMModeValue = BPMMode.Default; + WaveModeValue = WaveMode.Default; + SetNoteModeValue = SetNoteMode.Default; + LowestJudgmentConditionModeValue = LowestJudgmentConditionMode.Default; + PutCopyNotesValueV2 = PutCopyNotes.Default; + } + + public ModeComponent Clone() + { + var modeComponentValue = new ModeComponent(); + modeComponentValue.CopyAs(this); + return modeComponentValue; + } + + public bool IsCompatible(ModeComponent modeComponentValue) + { + if (NoteSaltModeValue != modeComponentValue.NoteSaltModeValue) + { + return false; + } + if (LongNoteModeValue != modeComponentValue.LongNoteModeValue) + { + return false; + } + if (InputFavorModeValue != modeComponentValue.InputFavorModeValue) + { + return false; + } + if (NoteModifyModeValue != modeComponentValue.NoteModifyModeValue) + { + return false; + } + if (BPMModeValue != modeComponentValue.BPMModeValue) + { + return false; + } + if (WaveModeValue != modeComponentValue.WaveModeValue) + { + return false; + } + if (SetNoteModeValue != modeComponentValue.SetNoteModeValue) + { + return false; + } + if (PutCopyNotesValueV2 != modeComponentValue.PutCopyNotesValueV2) + { + return false; + } + if (NoteModifyModeValue == NoteModifyMode.LongNote) + { + if (modeComponentValue.NoteModifyModeValue == NoteModifyMode.LongNote) + { + if (LowestLongNoteModify != modeComponentValue.LowestLongNoteModify || HighestLongNoteModify != modeComponentValue.HighestLongNoteModify) + { + return false; + } + } + } + if (SetNoteModeValue != SetNoteMode.Default) + { + if (modeComponentValue.SetNoteModeValue != SetNoteMode.Default) + { + if (PutNoteSet != modeComponentValue.PutNoteSet || PutNoteSetMillis != modeComponentValue.PutNoteSetMillis) + { + return false; + } + } + } + if (NoteSaltModeValue != NoteSaltMode.Default && NoteSaltModeValue != NoteSaltMode.Symmetric) + { + if (modeComponentValue.NoteSaltModeValue != NoteSaltMode.Default && modeComponentValue.NoteSaltModeValue != NoteSaltMode.Symmetric) + { + if (Salt != modeComponentValue.Salt) + { + return false; + } + } + } + if (NoteMobilityModeValue == NoteMobilityMode._4DHD || NoteMobilityModeValue == NoteMobilityMode._4D) + { + if (modeComponentValue.NoteMobilityModeValue == NoteMobilityMode._4DHD || modeComponentValue.NoteMobilityModeValue == NoteMobilityMode._4D) + { + if (Salt != modeComponentValue.Salt) + { + return false; + } + } + } + if (SetNoteModeValue != SetNoteMode.Default) + { + if (modeComponentValue.SetNoteModeValue != SetNoteMode.Default) + { + if (Salt != modeComponentValue.Salt) + { + return false; + } + } + } + if (IsSalt) + { + if (modeComponentValue.IsSalt) + { + if (Salt != modeComponentValue.Salt) + { + return false; + } + } + } + return true; + } + + public void CopyAs(ModeComponent modeComponentValue, Computing valueComputing = null, bool? setSalt = null) + { + AutoModeValue = modeComponentValue.AutoModeValue; + NoteSaltModeValue = modeComponentValue.NoteSaltModeValue; + AudioMultiplier = modeComponentValue.AudioMultiplier; + FaintNoteModeValue = modeComponentValue.FaintNoteModeValue; + JudgmentModeValue = modeComponentValue.JudgmentModeValue; + var handlingHitPointsModeValue = modeComponentValue.HandlingHitPointsModeValue; + HitPointsModeValue = modeComponentValue.HitPointsModeValue; + HandlingHitPointsModeValue = handlingHitPointsModeValue; + NoteMobilityModeValue = modeComponentValue.NoteMobilityModeValue; + LongNoteModeValue = modeComponentValue.LongNoteModeValue; + InputFavorModeValue = modeComponentValue.InputFavorModeValue; + NoteModifyModeValue = modeComponentValue.NoteModifyModeValue; + BPMModeValue = modeComponentValue.BPMModeValue; + WaveModeValue = modeComponentValue.WaveModeValue; + SetNoteModeValue = modeComponentValue.SetNoteModeValue; + LowestJudgmentConditionModeValue = modeComponentValue.LowestJudgmentConditionModeValue; + var favorJudgments = modeComponentValue.FavorJudgments; + for (var i = favorJudgments.Length - 1; i >= 0; --i) + { + for (var j = favorJudgments[i].Length - 1; j >= 0; --j) + { + FavorJudgments[i][j] = favorJudgments[i][j]; + } + } + OnPropertyChanged(nameof(HighestJudgment0)); + OnPropertyChanged(nameof(HigherJudgment0)); + OnPropertyChanged(nameof(HighJudgment0)); + OnPropertyChanged(nameof(LowJudgment0)); + OnPropertyChanged(nameof(LowerJudgment0)); + OnPropertyChanged(nameof(LowestJudgment0)); + OnPropertyChanged(nameof(HighestJudgment1)); + OnPropertyChanged(nameof(HigherJudgment1)); + OnPropertyChanged(nameof(HighJudgment1)); + OnPropertyChanged(nameof(LowJudgment1)); + OnPropertyChanged(nameof(LowerJudgment1)); + OnPropertyChanged(nameof(LowestJudgment1)); + var favorHitPoints = modeComponentValue.FavorHitPoints; + for (var i = favorHitPoints.Length - 1; i >= 0; --i) + { + for (var j = favorHitPoints[i].Length - 1; j >= 0; --j) + { + FavorHitPoints[i][j] = favorHitPoints[i][j]; + } + } + OnPropertyChanged(nameof(LowestHitPoints0)); + OnPropertyChanged(nameof(LowestHitPoints1)); + OnPropertyChanged(nameof(LowerHitPoints0)); + OnPropertyChanged(nameof(LowerHitPoints1)); + OnPropertyChanged(nameof(LowHitPoints0)); + OnPropertyChanged(nameof(LowHitPoints1)); + OnPropertyChanged(nameof(HighHitPoints0)); + OnPropertyChanged(nameof(HighHitPoints1)); + OnPropertyChanged(nameof(HigherHitPoints0)); + OnPropertyChanged(nameof(HigherHitPoints1)); + OnPropertyChanged(nameof(HighestHitPoints0)); + OnPropertyChanged(nameof(HighestHitPoints1)); + LowestLongNoteModify = modeComponentValue.LowestLongNoteModify; + HighestLongNoteModify = modeComponentValue.HighestLongNoteModify; + PutNoteSet = modeComponentValue.PutNoteSet; + PutNoteSetMillis = modeComponentValue.PutNoteSetMillis; + PutCopyNotesValueV2 = modeComponentValue.PutCopyNotesValueV2; + CanModifyMultiplier = modeComponentValue.CanModifyMultiplier; + SentMultiplier = modeComponentValue.SentMultiplier; + MultiplierValue = modeComponentValue.MultiplierValue; + CanModifyAudioMultiplier = modeComponentValue.CanModifyAudioMultiplier; + if (!(setSalt ?? Configure.Instance.SetSalt)) + { + Salt = modeComponentValue.Salt; + } + ComputingValue = valueComputing ?? modeComponentValue.ComputingValue; + } + + public bool HigherMultiplier() + { + var wasModified = SetMultiplier(MultiplierValue + BPM * AudioMultiplier * _unitMultiplier); + if (wasModified) + { + _unitMultiplier += 0.01; + } + return wasModified; + } + + public bool LowerMultiplier() + { + var wasModified = SetMultiplier(MultiplierValue - BPM * AudioMultiplier * _unitMultiplier); + if (wasModified) + { + _unitMultiplier += 0.01; + } + return wasModified; + } + + public bool SetMultiplier(double multiplierValue) + { + if (CanModifyMultiplier) + { + multiplierValue = Math.Max(0.0, multiplierValue); + if (multiplierValue != MultiplierValue) + { + MultiplierValue = multiplierValue; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public void CopyAsJSON(JSON.ModeComponentData modeComponentData) + { + Salt = modeComponentData.salt; + AutoModeValue = (AutoMode)modeComponentData.autoMode; + NoteSaltModeValue = (NoteSaltMode)modeComponentData.noteSaltMode; + AudioMultiplier = Math.Round(modeComponentData.audioMultiplier, 2); + FaintNoteModeValue = (FaintNoteMode)modeComponentData.faintNoteMode; + JudgmentModeValue = (JudgmentMode)modeComponentData.judgmentMode; + HitPointsModeValue = (HitPointsMode)modeComponentData.hitPointsMode; + NoteMobilityModeValue = (NoteMobilityMode)modeComponentData.noteMobilityMode; + LongNoteModeValue = (LongNoteMode)modeComponentData.longNoteMode; + InputFavorModeValue = (InputFavorMode)modeComponentData.inputFavorMode; + NoteModifyModeValue = (NoteModifyMode)modeComponentData.noteModifyMode; + BPMModeValue = (BPMMode)modeComponentData.bpmMode; + WaveModeValue = (WaveMode)modeComponentData.waveMode; + SetNoteModeValue = (SetNoteMode)modeComponentData.setNoteMode; + LowestJudgmentConditionModeValue = (LowestJudgmentConditionMode)modeComponentData.lowestJudgmentConditionMode; + PutCopyNotesValueV2 = (PutCopyNotes)modeComponentData.putCopyNotes; + HighestJudgment0 = modeComponentData.highestJudgment0; + HigherJudgment0 = modeComponentData.higherJudgment0; + HighJudgment0 = modeComponentData.highJudgment0; + LowJudgment0 = modeComponentData.lowJudgment0; + LowerJudgment0 = modeComponentData.lowerJudgment0; + LowestJudgment0 = modeComponentData.lowestJudgment0; + HighestJudgment1 = modeComponentData.highestJudgment1; + HigherJudgment1 = modeComponentData.higherJudgment1; + HighJudgment1 = modeComponentData.highJudgment1; + LowJudgment1 = modeComponentData.lowJudgment1; + LowerJudgment1 = modeComponentData.lowerJudgment1; + LowestJudgment1 = modeComponentData.lowestJudgment1; + LowestLongNoteModify = modeComponentData.lowestLongNoteModify; + HighestLongNoteModify = modeComponentData.highestLongNoteModify; + PutNoteSet = modeComponentData.putNoteSet; + PutNoteSetMillis = modeComponentData.putNoteSetMillis; + HighestHitPoints0 = modeComponentData.highestHitPoints0; + HigherHitPoints0 = modeComponentData.higherHitPoints0; + HighHitPoints0 = modeComponentData.highHitPoints0; + LowHitPoints0 = modeComponentData.lowHitPoints0; + LowerHitPoints0 = modeComponentData.lowerHitPoints0; + LowestHitPoints0 = modeComponentData.lowestHitPoints0; + HighestHitPoints1 = modeComponentData.highestHitPoints1; + HigherHitPoints1 = modeComponentData.higherHitPoints1; + HighHitPoints1 = modeComponentData.highHitPoints1; + LowHitPoints1 = modeComponentData.lowHitPoints1; + LowerHitPoints1 = modeComponentData.lowerHitPoints1; + LowestHitPoints1 = modeComponentData.lowestHitPoints1; + } + + public void UndoUnitMultiplier() => _unitMultiplier = 0.1; + + public bool HigherAudioMultiplier() + { + return SetAudioMultiplier(Math.Round(AudioMultiplier + 0.01, 2)); + } + + public bool LowerAudioMultiplier() + { + return SetAudioMultiplier(Math.Round(AudioMultiplier - 0.01, 2)); + } + + public bool SetAudioMultiplier(double audioMultiplier) + { + if (CanModifyAudioMultiplier) + { + audioMultiplier = Math.Clamp(audioMultiplier, 0.5, 2.0); + if (audioMultiplier != AudioMultiplier) + { + AudioMultiplier = audioMultiplier; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Model.cs b/Qwilight/Qwilight/Model.cs new file mode 100644 index 0000000..a789c2a --- /dev/null +++ b/Qwilight/Qwilight/Model.cs @@ -0,0 +1,12 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System.ComponentModel; + +namespace Qwilight +{ + public class Model : ObservableObject + { + protected override void OnPropertyChanged(PropertyChangedEventArgs e) => HandlingUISystem.Instance.HandleParallel(() => base.OnPropertyChanged(e)); + + public virtual void NotifyModel() => OnPropertyChanged(string.Empty); + } +} diff --git a/Qwilight/Qwilight/Modifier/BaseUI/AvatarConfigureDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/AvatarConfigureDrawingModifier.cs new file mode 100644 index 0000000..64aa0ba --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/AvatarConfigureDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class AvatarConfigureDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.AvatarConfigureDrawings[(int)value]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/DefaultEntryDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/DefaultEntryDrawingModifier.cs new file mode 100644 index 0000000..b5ab401 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/DefaultEntryDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class DefaultEntryDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.DefaultEntryDrawings[(int)value]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/HeavyModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/HeavyModifier.cs new file mode 100644 index 0000000..a227b32 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/HeavyModifier.cs @@ -0,0 +1,13 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class HeavyModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => (bool)value ? FontWeights.Bold : FontWeights.Normal; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/InputModeDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/InputModeDrawingModifier.cs new file mode 100644 index 0000000..013a3a5 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/InputModeDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class InputModeDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.InputModeDrawings[(int)value]?.DefaultDrawing; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/LevelPaintModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/LevelPaintModifier.cs new file mode 100644 index 0000000..08471c6 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/LevelPaintModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class LevelPaintModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.LevelPaints[(int)value]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentDrawingModifier.cs new file mode 100644 index 0000000..2f92408 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class ModeComponentDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.ModeComponentDrawings[(int)parameter][(int)value]?.DefaultDrawing; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentInputModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentInputModifier.cs new file mode 100644 index 0000000..309c6ce --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentInputModifier.cs @@ -0,0 +1,13 @@ +using Qwilight.ViewModel; +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class ModeComponentInputModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => ViewModels.Instance.ModifyModeComponentValue.ModeComponentValues[(int)parameter]?.Single(modeComponentItem => modeComponentItem.Value == (int)value)?.OnConfigure; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentInputVisibilityModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentInputVisibilityModifier.cs new file mode 100644 index 0000000..7043900 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/ModeComponentInputVisibilityModifier.cs @@ -0,0 +1,15 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class ModeComponentInputVisibilityModifier : IValueConverter + { + readonly IValueConverter _modeComponentInputModifier = QwilightComponent.GetBuiltInData("ModeComponentInputModifier"); + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => _modeComponentInputModifier.Convert(value, targetType, parameter, culture) != null ? Visibility.Visible : Visibility.Collapsed; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/NotifyDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/NotifyDrawingModifier.cs new file mode 100644 index 0000000..910cda6 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/NotifyDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class NotifyDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.NotifyDrawings[(int)value]?.DefaultDrawing; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SaltAutoDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SaltAutoDrawingModifier.cs new file mode 100644 index 0000000..bec57e4 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SaltAutoDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SaltAutoDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.SaltAutoDrawings[(bool)value ? 1 : 0]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SiteAudioDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SiteAudioDrawingModifier.cs new file mode 100644 index 0000000..cca2e6b --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SiteAudioDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SiteAudioDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.SiteAudioDrawings[(bool)value ? 1 : 0]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SiteCipherDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SiteCipherDrawingModifier.cs new file mode 100644 index 0000000..2397dae --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SiteCipherDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SiteCipherDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.SiteCipherDrawings[(bool)value ? 1 : 0]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SiteConfigureDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SiteConfigureDrawingModifier.cs new file mode 100644 index 0000000..1cf36c6 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SiteConfigureDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SiteConfigureDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.SiteConfigureDrawings[(int)value]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SiteHandDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SiteHandDrawingModifier.cs new file mode 100644 index 0000000..133c1b1 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SiteHandDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SiteHandDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => (bool)value ? BaseUI.Instance.AvatarConfigureDrawings[1] : null; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SiteMediaDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SiteMediaDrawingModifier.cs new file mode 100644 index 0000000..89906c2 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SiteMediaDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SiteMediaDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.SiteMediaDrawings[(bool)value ? 1 : 0]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/SiteSituationDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/SiteSituationDrawingModifier.cs new file mode 100644 index 0000000..78bdf16 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/SiteSituationDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class SiteSituationDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.SiteSituationDrawings[(int)value]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BaseUI/StopAutoDrawingModifier.cs b/Qwilight/Qwilight/Modifier/BaseUI/StopAutoDrawingModifier.cs new file mode 100644 index 0000000..06a298b --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BaseUI/StopAutoDrawingModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class StopAutoDrawingModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => BaseUI.Instance.StopAutoDrawings[(bool)value ? 1 : 0]; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/BoolModifier.cs b/Qwilight/Qwilight/Modifier/BoolModifier.cs new file mode 100644 index 0000000..4448216 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/BoolModifier.cs @@ -0,0 +1,41 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class BoolModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + switch (parameter) + { + case int valueInt: + switch (value) + { + case int valueIntValue when valueIntValue != valueInt: + return false; + } + break; + case bool valueBool: + switch (value) + { + case bool valueBoolValue when !valueBoolValue || !valueBool: + return false; + } + break; + case null: + switch (value) + { + case string textValue when string.IsNullOrEmpty(textValue): + case bool valueBoolValue when !valueBoolValue: + case null: + return false; + } + break; + } + return true; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/FaintModeComponentModifier.cs b/Qwilight/Qwilight/Modifier/FaintModeComponentModifier.cs new file mode 100644 index 0000000..5223444 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/FaintModeComponentModifier.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class FaintModeComponentModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => (int)value == (int)parameter ? 0.125 : 1.0; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/FormatModifier.cs b/Qwilight/Qwilight/Modifier/FormatModifier.cs new file mode 100644 index 0000000..57ab06c --- /dev/null +++ b/Qwilight/Qwilight/Modifier/FormatModifier.cs @@ -0,0 +1,39 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class FormatModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var format = parameter as string; + switch (value) + { + case uint valueUInt: + return valueUInt.ToString(format); + case int valueInt: + return valueInt.ToString(format); + case float valueFloat32: + if (format.Contains("%")) + { + valueFloat32 *= 100; + } + return valueFloat32.ToString(format); + case double valueFloat64: + if (format.Contains("%")) + { + valueFloat64 *= 100; + } + return valueFloat64.ToString(format); + case DateTime date: + return date.ToString(format); + case string text: + return string.Format(format, text); + } + return default; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/LowerStandPaintModifier.cs b/Qwilight/Qwilight/Modifier/LowerStandPaintModifier.cs new file mode 100644 index 0000000..500548e --- /dev/null +++ b/Qwilight/Qwilight/Modifier/LowerStandPaintModifier.cs @@ -0,0 +1,13 @@ +using Qwilight.ViewModel; +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class LowerStandPaintModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => ViewModels.Instance.ModifyModeComponentValue.ModeComponentValues[(int)parameter]?.Single(modeComponentItem => modeComponentItem.Value == (int)value)?.PointedPaint; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/LowerStandTextModifier.cs b/Qwilight/Qwilight/Modifier/LowerStandTextModifier.cs new file mode 100644 index 0000000..b475b67 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/LowerStandTextModifier.cs @@ -0,0 +1,13 @@ +using Qwilight.ViewModel; +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class LowerStandTextModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => ViewModels.Instance.ModifyModeComponentValue.ModeComponentValues[(int)parameter]?.Single(modeComponentItem => modeComponentItem.Value == (int)value)?.LowerStandText; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/MultiplyModifier.cs b/Qwilight/Qwilight/Modifier/MultiplyModifier.cs new file mode 100644 index 0000000..2c78f50 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/MultiplyModifier.cs @@ -0,0 +1,17 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class MultiplyModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value switch + { + double valueFloat64 => valueFloat64 * (double)parameter, + int valueInt => valueInt * (double)parameter, + _ => default, + }; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => null; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/NotModifier.cs b/Qwilight/Qwilight/Modifier/NotModifier.cs new file mode 100644 index 0000000..4638609 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/NotModifier.cs @@ -0,0 +1,14 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class NotModifier : IValueConverter + { + static readonly IValueConverter _boolModifier = QwilightComponent.GetBuiltInData("BoolModifier"); + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => !(bool)_boolModifier.Convert(value, targetType, parameter, culture); + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/UnitModifier.cs b/Qwilight/Qwilight/Modifier/UnitModifier.cs new file mode 100644 index 0000000..f56b926 --- /dev/null +++ b/Qwilight/Qwilight/Modifier/UnitModifier.cs @@ -0,0 +1,13 @@ +using Qwilight.Utilities; +using System.Globalization; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class UnitModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => Utility.FormatUnit((long)value); + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/VisibilityModifier.cs b/Qwilight/Qwilight/Modifier/VisibilityModifier.cs new file mode 100644 index 0000000..a7c779e --- /dev/null +++ b/Qwilight/Qwilight/Modifier/VisibilityModifier.cs @@ -0,0 +1,34 @@ +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; + +namespace Qwilight.Modifier +{ + public sealed class VisibilityModifier : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + switch (value) + { + case bool valueBool when valueBool: + case DefaultEntryItem defaultEntryItem when defaultEntryItem != null: + case BaseNoteFile.NoteVariety noteVariety when noteVariety.Equals(parameter): + case WwwLevelItem wwwLevelItemValue: + case int valueInt when valueInt == (int)parameter: + case string text when !string.IsNullOrEmpty(text): + case AutoCompute autoComputer when autoComputer != null: + case ImageSource drawing when drawing != null: + case byte[] data when data != null: + case string[] texts when texts != null: + return Visibility.Visible; + } + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Modifier/VisibilityNotModifier.cs b/Qwilight/Qwilight/Modifier/VisibilityNotModifier.cs new file mode 100644 index 0000000..77ec17e --- /dev/null +++ b/Qwilight/Qwilight/Modifier/VisibilityNotModifier.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Qwilight.Modifier +{ + public sealed class VisibilityNotModifier : IValueConverter + { + static readonly IValueConverter _visibilityModifier = QwilightComponent.GetBuiltInData("VisibilityModifier"); + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return _visibilityModifier.Convert(value, targetType, parameter, culture).Equals(Visibility.Visible) ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/MoveValue.cs b/Qwilight/Qwilight/MoveValue.cs new file mode 100644 index 0000000..d7fba48 --- /dev/null +++ b/Qwilight/Qwilight/MoveValue.cs @@ -0,0 +1,15 @@ +namespace Qwilight +{ + public sealed class MoveValue + { + public T TargetValue { get; set; } + + public T Value { get; set; } + + public MoveValue(T defaultValue = default) + { + TargetValue = defaultValue; + Value = defaultValue; + } + } +} diff --git a/Qwilight/Qwilight/Note/BaseNote.cs b/Qwilight/Qwilight/Note/BaseNote.cs new file mode 100644 index 0000000..228a3fe --- /dev/null +++ b/Qwilight/Qwilight/Note/BaseNote.cs @@ -0,0 +1,150 @@ +using FMOD; +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; + +namespace Qwilight.Note +{ + public abstract class BaseNote : IComparable + { + public const int LowestLayer = 0; + public const int HighestLayer = 4; + + int _levyingInput; + + public PostableItem PostableItemValue { get; set; } + + public bool IsWiped { get; set; } + + public double LogicalY { get; set; } + + public int ID { get; set; } + + public double Wait { get; set; } + + public List AudioNotes { get; } = new(); + + public List AudioChannels { get; } = new(); + + public double Y { get; set; } + + public int Salt { get; set; } + + public int InputSalt { get; set; } + + public bool IsFailed { get; set; } + + public double LongWait { get; set; } + + public double LongHeight { get; set; } + + public Component.Judged Judged { get; set; } = Component.Judged.Not; + + public int LevyingInput + { + get => _levyingInput; + + set + { + _levyingInput = value; + TargetInput = value; + } + } + + public int TargetInput { get; set; } + + public abstract bool HasContents { get; } + + public abstract bool HasStand { get; } + + public abstract bool HasInput { get; } + + public abstract int Layer { get; set; } + + public abstract int LogicalLayer { get; } + + public BaseNote(double logicalY, double wait) + { + LogicalY = logicalY; + Wait = wait; + Init(); + } + + public abstract bool IsVisible(DefaultCompute defaultComputer); + + public abstract bool IsVisibleHalf(DefaultCompute defaultComputer); + + public virtual void Init() + { + Y = double.NegativeInfinity; + Judged = Component.Judged.Not; + IsFailed = false; + AudioChannels.Clear(); + IsWiped = false; + TargetInput = LevyingInput; + } + + public void SetItem(int salt, PostableItem[] allowedPostableItems) => PostableItemValue = allowedPostableItems[salt % allowedPostableItems.Length]; + + public double GetY(DefaultCompute defaultComputer, double multiplier) => (Y - Component.StandardHeight) * multiplier + defaultComputer.DrawingComponentValue.judgmentMainPosition + Configure.Instance.UIConfigureValue.NoteWait; + + public float GetFaint(ModeComponent modeComponentValue, double judgmentMainPosition, double faintCosine) => modeComponentValue.FaintNoteModeValue switch + { + ModeComponent.FaintNoteMode.Fading => (float)faintCosine, + _ => 1F, + }; + + public bool IsClose(double wait) => Wait - wait <= Component.LevyingWait; + + public double GetMultiplierAsNoteMobility(ModeComponent modeComponentValue, double noteMobilityCosine, double noteMobilityValue) => modeComponentValue.NoteMobilityModeValue switch + { + ModeComponent.NoteMobilityMode._4D => modeComponentValue.Multiplier + modeComponentValue.Multiplier * ((InputSalt % 11 + 5) / 10 - 1) * noteMobilityValue, + ModeComponent.NoteMobilityMode._4DHD => modeComponentValue.Multiplier + modeComponentValue.Multiplier * ((Salt % 11 + 5) / 10 - 1) * noteMobilityValue, + ModeComponent.NoteMobilityMode.Zip => Math.Max(1.0, modeComponentValue.Multiplier * noteMobilityCosine), + ModeComponent.NoteMobilityMode.ZipHD => modeComponentValue.Multiplier * noteMobilityCosine, + _ => modeComponentValue.Multiplier + }; + + public void InitY(double logicalY) => Y = LogicalY - logicalY; + + public void Move(double distance) => Y += distance; + + public int CompareTo(BaseNote other) + { + var value = Wait.CompareTo(other.Wait); + if (value != 0) + { + return value; + } + + value = LogicalLayer.CompareTo(other.LogicalLayer); + if (value != 0) + { + return value; + } + + value = TargetInput.CompareTo(other.TargetInput); + if (value != 0) + { + return value; + } + + return 0; + } + + public virtual bool IsFailedAsTooLate(double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate) => false; + + public virtual bool IsTooLong(double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate) => false; + + public abstract void MoveInputMillis(double millisLoopUnit, DefaultCompute defaultComputer); + + public abstract void SetLayer(DefaultCompute defaultComputer); + + public abstract JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote); + + public abstract JudgedNoteData? AutoJudge(double wait); + + public abstract void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r); + + public bool IsCollided(BaseNote note) => (Wait <= note.Wait && note.Wait <= Wait + LongWait) || (note.Wait <= Wait && Wait <= note.Wait + note.LongWait); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/CommentNote.cs b/Qwilight/Qwilight/Note/CommentNote.cs new file mode 100644 index 0000000..c1bec22 --- /dev/null +++ b/Qwilight/Qwilight/Note/CommentNote.cs @@ -0,0 +1,49 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.Note +{ + public sealed class CommentNote : InputNote + { + public const int CommentNoteContents = 9; + + public override bool HasStand => false; + + public override int LogicalLayer => 6; + + public CommentNote(double logicalY, double wait, int input) : base(logicalY, wait, Array.Empty(), input) + { + } + + public override void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r) + { + if (Configure.Instance.UICommentNote) + { + var modeComponentValue = defaultComputer.ModeComponentValue; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var noteHeight = GetNoteHeight(defaultComputer); + r.Set(GetPosition(defaultComputer), GetY(defaultComputer, GetMultiplierAsNoteMobility(modeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) - noteHeight + drawingComponentValue.noteHeightJudgments[TargetInput], GetNoteLength(defaultComputer), noteHeight); + if (r.Position1 + r.Height > 0.0) + { + targetSession.PaintDrawing(ref r, UI.Instance.NoteDrawings[(int)defaultComputer.InputMode][TargetInput][defaultComputer.NoteFrame][CommentNoteContents][LongNote.LongNoteBefore], GetFaint(modeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + } + } + } + + public override JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote) => default; + + public override JudgedNoteData? AutoJudge(double wait) + { + if (Wait <= wait) + { + Judged = Component.Judged.Highest; + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.Not + }; + } + return default; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/InputNote.cs b/Qwilight/Qwilight/Note/InputNote.cs new file mode 100644 index 0000000..9047f72 --- /dev/null +++ b/Qwilight/Qwilight/Note/InputNote.cs @@ -0,0 +1,140 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.Note +{ + public class InputNote : BaseNote + { + public const int InputNoteContents = 0; + public const int PositivePostableItemNoteContents = 15; + public const int NegativePostableItemNoteContents = 16; + public const int NeutralPostableItemNoteContents = 17; + const double InputMillis = 1000.0; + + double _inputMillis; + + public override bool IsFailedAsTooLate(double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate) => (wait - Wait) / modeComponentValue.AudioMultiplier >= Component.GetJudgmentMillis(Component.Judged.Lowest, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, 1); + + public override bool HasContents => true; + + public override bool HasStand => true; + + public override bool HasInput => true; + + public override int Layer { get; set; } + + public override int LogicalLayer => 1; + + public InputNote(double logicalY, double wait, ICollection audioNotes, int input) : base(logicalY, wait) + { + LevyingInput = input; + AudioNotes.AddRange(audioNotes); + } + + public override bool IsVisible(DefaultCompute defaultComputer) + { + return GetY(defaultComputer, GetMultiplierAsNoteMobility(defaultComputer.ModeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) + defaultComputer.DrawingComponentValue.noteHeightJudgments[TargetInput] >= 0.0; + } + + public override bool IsVisibleHalf(DefaultCompute defaultComputer) + { + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var yHeight = GetY(defaultComputer, GetMultiplierAsNoteMobility(defaultComputer.ModeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) + drawingComponentValue.noteHeightJudgments[TargetInput]; + return yHeight >= 0.0 && yHeight <= drawingComponentValue.judgmentMainPosition / 2; + } + + public override void Init() + { + base.Init(); + _inputMillis = 0.0; + } + + public double GetPosition(DefaultCompute defaultComputer) + { + return defaultComputer.GetPosition(LevyingInput) + (defaultComputer.GetPosition(TargetInput) - defaultComputer.GetPosition(LevyingInput)) * _inputMillis / InputMillis; + } + + public double GetNoteLength(DefaultCompute defaultComputer) + { + return defaultComputer.DrawingComponentValue.DrawingNoteLengthMap[LevyingInput] + (defaultComputer.DrawingComponentValue.DrawingNoteLengthMap[TargetInput] - defaultComputer.DrawingComponentValue.DrawingNoteLengthMap[LevyingInput]) * _inputMillis / InputMillis; + } + + public double GetNoteHeight(DefaultCompute defaultComputer) + { + return defaultComputer.DrawingComponentValue.noteHeights[LevyingInput] + (defaultComputer.DrawingComponentValue.noteHeights[TargetInput] - defaultComputer.DrawingComponentValue.noteHeights[LevyingInput]) * _inputMillis / InputMillis; + } + + public override void MoveInputMillis(double millisLoopUnit, DefaultCompute defaultComputer) + { + if (TargetInput != LevyingInput) + { + _inputMillis = Math.Min(_inputMillis + millisLoopUnit * InputMillis / (defaultComputer.GetIIDXMultiplierMillis(defaultComputer.ModeComponentValue) / 2), InputMillis); + } + } + + public override void SetLayer(DefaultCompute defaultComputer) + { + if (defaultComputer.DrawingComponentValue.MainNoteLengthMap[TargetInput] > 0.0) + { + Layer = LongWait > 0.0 ? 3 : 4; + } + else + { + Layer = LongWait > 0.0 ? 1 : 2; + } + } + + public override JudgedNoteData? AutoJudge(double wait) => null; + + public override JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote) + { + if (input > 0) + { + var judgmentMeter = (wait - Wait) / modeComponentValue.AudioMultiplier; + var judged = Component.GetJudged(judgmentMeter, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, Component.JudgmentAssist.Default); + if (judged != Component.Judged.Not) + { + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.NoteJudgment, + JudgmentMeter = judgmentMeter, + Judged = judged + }; + } + } + return null; + } + + public override void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r) + { + var modeComponentValue = defaultComputer.ModeComponentValue; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var noteHeight = GetNoteHeight(defaultComputer); + r.Set(GetPosition(defaultComputer), GetY(defaultComputer, GetMultiplierAsNoteMobility(modeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) - noteHeight + drawingComponentValue.noteHeightJudgments[TargetInput], GetNoteLength(defaultComputer), noteHeight); + if (r.Position1 + r.Height > 0.0) + { + var inputNoteDrawings = UI.Instance.NoteDrawings[(int)defaultComputer.InputMode][TargetInput][defaultComputer.NoteFrame]; + var inputNoteDrawing = inputNoteDrawings[InputNoteContents][LongNote.LongNoteBefore]; + if (inputNoteDrawing.HasValue) + { + targetSession.PaintDrawing(ref r, inputNoteDrawing, GetFaint(modeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + defaultComputer.NewNetDrawing(isValidNetDrawings, Event.Types.NetDrawing.Types.Variety.Note, inputNoteDrawing.Value.AverageColor, r.Position0 - drawingComponentValue.mainPosition, r.Position1, r.Length, r.Height * inputNoteDrawing.Value.StandardHeight); + } + if (PostableItemValue != null) + { + var postableItemNoteDrawing = inputNoteDrawings[PostableItemValue.IsPositive switch + { + true => PositivePostableItemNoteContents, + false => NegativePostableItemNoteContents, + null => NeutralPostableItemNoteContents + }]?[LongNote.LongNoteBefore]; + if (postableItemNoteDrawing.HasValue) + { + targetSession.PaintDrawing(ref r, postableItemNoteDrawing, GetFaint(modeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/JudgedNoteData.cs b/Qwilight/Qwilight/Note/JudgedNoteData.cs new file mode 100644 index 0000000..2cfc5c4 --- /dev/null +++ b/Qwilight/Qwilight/Note/JudgedNoteData.cs @@ -0,0 +1,24 @@ +namespace Qwilight.Note +{ + public struct JudgedNoteData + { + public enum ID + { + Not, + NoteJudgment, + TrapNoteJudgment, + LevyLongNoteJudgment, + QuitLongNoteJudgment, + AutoLongNoteJudgment, + FailedLongNoteJudgment, + HandleVoid, + HandleMeter + } + + public ID IDValue { get; set; } + + public double JudgmentMeter { get; set; } + + public Component.Judged Judged { get; set; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/LongNote.cs b/Qwilight/Qwilight/Note/LongNote.cs new file mode 100644 index 0000000..817f0dd --- /dev/null +++ b/Qwilight/Qwilight/Note/LongNote.cs @@ -0,0 +1,194 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.Note +{ + public sealed class LongNote : InputNote + { + /// + /// 위 + /// + public const int LongNoteTail = 1; + public const int LongNoteContents = 2; + /// + /// 아래 + /// + public const int LongNoteFront = 3; + + public const int LongNoteBefore = 0; + public const int LongNoteHandling = 1; + public const int LongNoteFailed = 2; + + public override int LogicalLayer => 2; + + public LongNote(double logicalY, double wait, ICollection audioNotes, int input, double longWait, double longHeight) : base(logicalY, wait, audioNotes, input) + { + LongWait = longWait; + LongHeight = longHeight; + } + + public override JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote) + { + if (input > 0) + { + if (Judged == Component.Judged.Not) + { + var judgmentMeter = (wait - Wait) / modeComponentValue.AudioMultiplier; + var judged = Component.GetJudged(judgmentMeter, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate); + if (judged != Component.Judged.Not) + { + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.LevyLongNoteJudgment, + JudgmentMeter = judgmentMeter, + Judged = judged + }; + } + } + } + else if (Judged != Component.Judged.Not) + { + var longJudgmentMeter = (wait - (Wait + LongWait)) / modeComponentValue.AudioMultiplier; + if ((isAutoLongNote && modeComponentValue.LongNoteModeValue != ModeComponent.LongNoteMode.Input) || modeComponentValue.LongNoteModeValue == ModeComponent.LongNoteMode.Auto) + { + if (Component.GetIsJudgment(longJudgmentMeter, Component.Judged.Lower, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, Component.JudgmentAssist.LongNoteUp)) + { + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.AutoLongNoteJudgment, + JudgmentMeter = longJudgmentMeter, + Judged = Judged + }; + } + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.FailedLongNoteJudgment + }; + } + else + { + var judged = Component.GetJudged(longJudgmentMeter, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, Component.JudgmentAssist.LongNoteUp); + if (judged != Component.Judged.Not) + { + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.QuitLongNoteJudgment, + JudgmentMeter = longJudgmentMeter, + Judged = judged + }; + } + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.FailedLongNoteJudgment, + Judged = judged + }; + } + } + return null; + } + + public override bool IsTooLong(double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate) => (wait - (Wait + LongWait)) / modeComponentValue.AudioMultiplier > Component.GetJudgmentMillis(Component.Judged.Lower, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, 1, Component.JudgmentAssist.LongNoteUp); + + public override void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r) + { + var modeComponentValue = defaultComputer.ModeComponentValue; + var multiplier = GetMultiplierAsNoteMobility(modeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue); + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var judgmentMainPosition = drawingComponentValue.judgmentMainPosition; + var y = GetY(defaultComputer, multiplier); + var pointHeight = LongHeight * multiplier; + var longNoteFrontEdgeHeight = drawingComponentValue.longNoteFrontEdgeHeights[TargetInput]; + var longNoteTailEdgeHeight = drawingComponentValue.longNoteTailEdgeHeights[TargetInput]; + var longNoteFrontEdgePosition = drawingComponentValue.longNoteFrontEdgePositions[TargetInput]; + var longNoteTailEdgePosition = drawingComponentValue.longNoteTailEdgePositions[TargetInput]; + var noteLength = GetNoteLength(defaultComputer); + var notePosition = GetPosition(defaultComputer); + var faint = GetFaint(modeComponentValue, judgmentMainPosition, defaultComputer.FaintCosine); + var longNoteTailContentsHeight = drawingComponentValue.longNoteTailContentsHeights[TargetInput]; + var longNoteFrontContentsHeight = drawingComponentValue.longNoteFrontContentsHeights[TargetInput]; + var longNoteContentsHeight = pointHeight + longNoteTailContentsHeight + longNoteFrontContentsHeight; + var longNoteDrawings = UI.Instance.NoteDrawings[(int)defaultComputer.InputMode][TargetInput][defaultComputer.NoteFrame]; + if (!IsFailed && Judged != Component.Judged.Not) + { + var noteWait = Configure.Instance.UIConfigureValue.NoteWait; + var longHeight = longNoteContentsHeight + judgmentMainPosition + noteWait - y; + if (longHeight > 0.0) + { + r.Set(notePosition, y - pointHeight - longNoteTailContentsHeight, noteLength, longHeight); + PaintLongNoteContents(ref r); + + r.Set(notePosition, y - pointHeight - Math.Max(0.0, longNoteTailEdgeHeight) - longNoteTailEdgePosition, noteLength, Math.Abs(longNoteTailEdgeHeight)); + PaintLongNoteTail(ref r); + } + if (UI.Instance.MaintainLongNoteFrontEdge) + { + r.Set(notePosition, judgmentMainPosition - Math.Max(0.0, -longNoteFrontEdgeHeight) + longNoteFrontEdgePosition + noteWait, noteLength, Math.Abs(longNoteFrontEdgeHeight)); + PaintLongNoteFront(ref r); + } + } + else + { + if (IsFailed) + { + faint /= 2; + } + if (longNoteContentsHeight > 0.0) + { + r.Set(notePosition, y - pointHeight - longNoteTailContentsHeight, noteLength, longNoteContentsHeight); + PaintLongNoteContents(ref r); + + r.Set(notePosition, y - pointHeight - Math.Max(0.0, longNoteTailEdgeHeight) - longNoteTailEdgePosition, noteLength, Math.Abs(longNoteTailEdgeHeight)); + PaintLongNoteTail(ref r); + } + r.Set(notePosition, y - Math.Max(0.0, -longNoteFrontEdgeHeight) + longNoteFrontEdgePosition, noteLength, Math.Abs(longNoteFrontEdgeHeight)); + PaintLongNoteFront(ref r); + } + + void PaintLongNoteContents(ref Bound r) + { + if (r.Position1 + r.Height > 0.0) + { + var longNoteDrawing = longNoteDrawings?[LongNoteContents]?[IsFailed ? LongNoteFailed : LongNoteBefore]; + if (longNoteDrawing.HasValue) + { + targetSession.PaintDrawing(ref r, longNoteDrawing, faint); + defaultComputer.NewNetDrawing(isValidNetDrawings, Event.Types.NetDrawing.Types.Variety.Note, longNoteDrawing.Value.AverageColor, r.Position0 - drawingComponentValue.mainPosition, r.Position1, r.Length, r.Height * longNoteDrawing.Value.StandardHeight); + } + if (PostableItemValue != null) + { + var postableItemNoteDrawing = longNoteDrawings?[PostableItemValue.IsPositive switch + { + true => PositivePostableItemNoteContents, + false => NegativePostableItemNoteContents, + null => NeutralPostableItemNoteContents + }]?[IsFailed ? LongNoteFailed : LongNoteBefore]; + if (postableItemNoteDrawing.HasValue) + { + var postableItemNoteDrawingValue = postableItemNoteDrawing.Value; + var postableItemNoteDrawingBound = postableItemNoteDrawingValue.DrawingBound; + r.Height = r.Length * postableItemNoteDrawingBound.Height / postableItemNoteDrawingBound.Length; + targetSession.PaintDrawing(ref r, postableItemNoteDrawingValue, GetFaint(modeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + } + } + } + } + + void PaintLongNoteTail(ref Bound r) + { + if (r.Position1 + r.Height > 0.0) + { + targetSession.PaintDrawing(ref r, longNoteDrawings?[LongNoteTail]?[IsFailed ? LongNoteFailed : LongNoteBefore], faint); + } + } + + void PaintLongNoteFront(ref Bound r) + { + if (r.Position1 + r.Height > 0.0) + { + targetSession.PaintDrawing(ref r, longNoteDrawings?[LongNoteFront]?[IsFailed ? LongNoteFailed : LongNoteBefore], faint); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/MeterNote.cs b/Qwilight/Qwilight/Note/MeterNote.cs new file mode 100644 index 0000000..453559e --- /dev/null +++ b/Qwilight/Qwilight/Note/MeterNote.cs @@ -0,0 +1,101 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.Note +{ + public sealed class MeterNote : BaseNote + { + const double MeterNoteHeight = 1.0; + + readonly string _meter; + + public override bool HasContents => false; + + public override bool HasStand => false; + + public override bool HasInput => false; + + public override int Layer { get; set; } + + public override int LogicalLayer => 3; + + public MeterNote(double logicalY, double wait, int meter) : base(logicalY, wait) + { + _meter = meter.ToString(); + } + + public override bool IsVisible(DefaultCompute defaultComputer) + { + return GetY(defaultComputer, GetMultiplierAsNoteMobility(defaultComputer.ModeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) + MeterNoteHeight >= 0.0; + } + + public override bool IsVisibleHalf(DefaultCompute defaultComputer) + { + var yHeight = GetY(defaultComputer, GetMultiplierAsNoteMobility(defaultComputer.ModeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) + MeterNoteHeight; + return yHeight >= 0.0 && yHeight <= defaultComputer.DrawingComponentValue.judgmentMainPosition / 2; + } + + public override void MoveInputMillis(double millisLoopUnit, DefaultCompute defaultComputer) + { + } + + public override void SetLayer(DefaultCompute defaultComputer) + { + } + + public override JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote) => default; + + public override JudgedNoteData? AutoJudge(double wait) + { + if (Wait <= wait) + { + Judged = Component.Judged.Highest; + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.HandleMeter + }; + } + return default; + } + + public override void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r) + { + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var p1BuiltLength = (float)drawingComponentValue.p1BuiltLength; + r.Set(drawingComponentValue.mainPosition, GetY(defaultComputer, GetMultiplierAsNoteMobility(defaultComputer.ModeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) - MeterNoteHeight / 2, p1BuiltLength, MeterNoteHeight); + if (r.Position1 + r.Height > 0.0) + { + var faint = (int)(100 * GetFaint(defaultComputer.ModeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + var meterNotePaint = DrawingSystem.Instance.MeterNotePaints[faint]; + var has2P = defaultComputer.Has2P; + p1BuiltLength += drawingComponentValue.p2Position; + defaultComputer.NewNetDrawing(isValidNetDrawings, Event.Types.NetDrawing.Types.Variety.Meter, DrawingSystem.Instance.MeterNoteAverageColor, 0.0, r.Position1, 0.0, 0.0); + targetSession.FillRectangle(r, meterNotePaint); + if (has2P) + { + r.Position0 += p1BuiltLength; + targetSession.FillRectangle(r, meterNotePaint); + } + + var isMeterVisible = defaultComputer.IsMeterVisible; + if (isMeterVisible) + { + r.Position0 -= p1BuiltLength; + + var faintClearPaint = DrawingSystem.Instance.FaintClearedPaints[faint]; + var textItem = PoolSystem.Instance.GetTextItem(_meter, DrawingSystem.Instance.MeterFont); + r.Position0 += Levels.StandardMargin; + r.Position1 -= Levels.StandardMargin + textItem.LayoutBounds.Height; + targetSession.PaintText(textItem, ref r, faintClearPaint); + + if (has2P) + { + r.Position0 += p1BuiltLength; + targetSession.PaintText(textItem, ref r, faintClearPaint); + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/TrapNote.cs b/Qwilight/Qwilight/Note/TrapNote.cs new file mode 100644 index 0000000..3309ba4 --- /dev/null +++ b/Qwilight/Qwilight/Note/TrapNote.cs @@ -0,0 +1,75 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.Note +{ + public class TrapNote : InputNote + { + public const int TrapNoteContents = 4; + + readonly bool _isPowered; + + public override bool HasStand => false; + + public override int LogicalLayer => 4; + + public TrapNote(double logicalY, double wait, ICollection audioNotes, int input, bool isPowered = true) : base(logicalY, wait, audioNotes, input) + { + _isPowered = isPowered; + } + + public override JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote) + { + switch (trapNoteJudgmentDate) + { + case Component.TrapNoteJudgmentDate1146: + if (_isPowered && input > 0) + { + var judgmentMeter = (wait - Wait) / modeComponentValue.AudioMultiplier; + var judged = Component.GetJudged(judgmentMeter, modeComponentValue, judgmentStage, judgmentModeDate, judgmentMapDate, longNoteAssistDate, Component.JudgmentAssist.Default); + if (Component.Judged.Highest <= judged && judged <= Component.Judged.Lower) + { + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.TrapNoteJudgment, + JudgmentMeter = judgmentMeter, + Judged = Component.Judged.Lowest + }; + } + } + break; + } + return null; + } + + public override JudgedNoteData? AutoJudge(double wait) + { + if (Wait <= wait) + { + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.Not + }; + } + return null; + } + + public override void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r) + { + var modeComponentValue = defaultComputer.ModeComponentValue; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var noteHeight = GetNoteHeight(defaultComputer); + r.Set(GetPosition(defaultComputer), GetY(defaultComputer, GetMultiplierAsNoteMobility(modeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) - noteHeight + drawingComponentValue.noteHeightJudgments[TargetInput], GetNoteLength(defaultComputer), noteHeight); + if (r.Position1 + r.Height > 0.0) + { + var trapNoteDrawing = UI.Instance.NoteDrawings[(int)defaultComputer.InputMode]?.ElementAt(TargetInput)?.ElementAt(defaultComputer.NoteFrame)?.ElementAt(TrapNoteContents)?.ElementAt(LongNote.LongNoteBefore); + if (trapNoteDrawing.HasValue) + { + targetSession.PaintDrawing(ref r, trapNoteDrawing, GetFaint(modeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + defaultComputer.NewNetDrawing(isValidNetDrawings, Event.Types.NetDrawing.Types.Variety.Note, trapNoteDrawing.Value.AverageColor, r.Position0 - drawingComponentValue.mainPosition, r.Position1, r.Length, r.Height * trapNoteDrawing.Value.StandardHeight); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Note/VoidNote.cs b/Qwilight/Qwilight/Note/VoidNote.cs new file mode 100644 index 0000000..7ad86e6 --- /dev/null +++ b/Qwilight/Qwilight/Note/VoidNote.cs @@ -0,0 +1,55 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.Note +{ + public sealed class VoidNote : InputNote + { + public const int VoidNoteContents = 14; + + public override bool HasStand => false; + + public override bool HasContents => false; + + public override int LogicalLayer => 5; + + public VoidNote(double logicalY, double wait, ICollection audioNotes, int input) : base(logicalY, wait, audioNotes, input) + { + } + + public override void Paint(CanvasDrawingSession targetSession, bool isValidNetDrawings, DefaultCompute defaultComputer, ref Bound r) + { + if (defaultComputer.IsHellBPM) + { + var modeComponentValue = defaultComputer.ModeComponentValue; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var noteHeight = GetNoteHeight(defaultComputer); + r.Set(GetPosition(defaultComputer), GetY(defaultComputer, GetMultiplierAsNoteMobility(modeComponentValue, defaultComputer.NoteMobilityCosine, defaultComputer.NoteMobilityValue)) - noteHeight + drawingComponentValue.noteHeightJudgments[TargetInput], GetNoteLength(defaultComputer), noteHeight); + if (r.Position1 + r.Height > 0.0) + { + var voidNoteDrawing = UI.Instance.NoteDrawings[(int)defaultComputer.InputMode]?.ElementAt(TargetInput)?.ElementAt(defaultComputer.NoteFrame)?.ElementAt(VoidNoteContents)?.ElementAt(LongNote.LongNoteBefore); + if (voidNoteDrawing.HasValue) + { + targetSession.PaintDrawing(ref r, voidNoteDrawing, GetFaint(modeComponentValue, drawingComponentValue.judgmentMainPosition, defaultComputer.FaintCosine)); + } + } + } + } + + public override JudgedNoteData? Judge(int input, double wait, ModeComponent modeComponentValue, double judgmentStage, int judgmentModeDate, int judgmentMapDate, int longNoteAssistDate, int trapNoteJudgmentDate, bool isAutoLongNote) => null; + + public override JudgedNoteData? AutoJudge(double wait) + { + if (Wait <= wait) + { + Judged = Component.Judged.Highest; + return new JudgedNoteData + { + IDValue = JudgedNoteData.ID.HandleVoid + }; + } + return null; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/BMSFile.cs b/Qwilight/Qwilight/NoteFile/BMSFile.cs new file mode 100644 index 0000000..9f5dfe7 --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/BMSFile.cs @@ -0,0 +1,13 @@ +using Qwilight.UIComponent; + +namespace Qwilight.NoteFile +{ + public class BMSFile : BaseNoteFile + { + public override NoteVariety NoteVarietyValue { get; } = NoteVariety.BMS; + + public BMSFile(string noteFilePath, DefaultEntryItem defaultEntryItem, EntryItem entryItem) : base(noteFilePath, defaultEntryItem, entryItem) + { + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/BMSONFile.cs b/Qwilight/Qwilight/NoteFile/BMSONFile.cs new file mode 100644 index 0000000..55fdeb1 --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/BMSONFile.cs @@ -0,0 +1,13 @@ +using Qwilight.UIComponent; + +namespace Qwilight.NoteFile +{ + public sealed class BMSONFile : BaseNoteFile + { + public override NoteVariety NoteVarietyValue { get; } = NoteVariety.BMSON; + + public BMSONFile(string noteFilePath, DefaultEntryItem defaultEntryItem, EntryItem entryItem) : base(noteFilePath, defaultEntryItem, entryItem) + { + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/BaseNoteFile.cs b/Qwilight/Qwilight/NoteFile/BaseNoteFile.cs new file mode 100644 index 0000000..223529a --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/BaseNoteFile.cs @@ -0,0 +1,341 @@ +using Qwilight.Compiler; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.IO; +using System.Windows.Media; + +namespace Qwilight.NoteFile +{ + public abstract class BaseNoteFile : Computing + { + public enum Handled + { + Not, Clear, Band1, Total, F, HigherClear, HighestClear + } + + public enum NoteVariety + { + Total, BMS, BMSON = 3, EventNote = 5 + } + + public enum Level + { + Level0, Level1, Level2, Level3, Level4, Level5 + } + + public static IEnumerable GetNoteFiles(string noteFilePath, DefaultEntryItem defaultEntryItem, EntryItem entryItem, int dataID) + { + if (noteFilePath.IsTailCaselsss(".bmson")) + { + return new[] { new BMSONFile(noteFilePath, defaultEntryItem, entryItem) }; + } + else if (noteFilePath.IsTailCaselsss(".pms")) + { + return new[] { new PMSFile(noteFilePath, defaultEntryItem, entryItem) }; + } + else + { + return new[] { new BMSFile(noteFilePath, defaultEntryItem, entryItem) }; + } + } + + readonly string[] _judgmentMillisText = new string[6]; + string _fittedText; + ImageSource _noteDrawing; + ImageSource _bannerDrawing; + bool _wantNoteDrawing = true; + bool _wantBannerDrawing = true; + Handled _handledValue; + string _save128; + string _save256; + string _save512; + + public string FittedText + { + get => _fittedText; + + set => SetProperty(ref _fittedText, value, nameof(FittedText)); + } + + public virtual bool IsLogical { get; } + + public bool IsAltDrawing => LogicalDrawing != null || EssentialDrawing != null; + + public virtual ImageSource LogicalDrawing { get; } + + public virtual ImageSource EssentialDrawing { get; } + + public virtual string LogicalAudioFileName => "Default"; + + public Color LevelColor => BaseUI.Instance.LevelColors[(int)LevelValue]; + + public virtual ImageSource HandledWallDrawing => BaseUI.Instance.HandledWallDrawings[(int)HandledValue]; + + public ImageSource NoteDrawing + { + get + { + if (_wantNoteDrawing && !string.IsNullOrEmpty(NoteDrawingPath)) + { + _wantNoteDrawing = false; + var noteDrawingPath = Utility.GetAvailable(NoteDrawingPath, Utility.AvailableFlag.Drawing); + if (!string.IsNullOrEmpty(noteDrawingPath)) + { + Task.Run(() => + { + try + { + SetProperty(ref _noteDrawing, DrawingSystem.Instance.LoadDefault(noteDrawingPath, null), nameof(NoteDrawing)); + } + catch + { + } + }); + } + } + return _noteDrawing ?? DrawingSystem.Instance.DefaultDrawing.DefaultDrawing; + } + } + + public ImageSource BannerDrawing + { + get + { + if (_wantBannerDrawing && !string.IsNullOrEmpty(BannerDrawingPath)) + { + _wantBannerDrawing = false; + var bannerDrawingPath = Utility.GetAvailable(BannerDrawingPath, Utility.AvailableFlag.Drawing); + if (!string.IsNullOrEmpty(bannerDrawingPath)) + { + Task.Run(() => + { + try + { + SetProperty(ref _bannerDrawing, DrawingSystem.Instance.LoadDefault(bannerDrawingPath, null), nameof(BannerDrawing)); + } + catch + { + } + }); + } + } + return _bannerDrawing; + } + } + + public string WantLevelID { get; set; } = string.Empty; + + public string HighestJudgmentMillisText + { + get => _judgmentMillisText[(int)Component.Judged.Highest]; + + set => SetProperty(ref _judgmentMillisText[(int)Component.Judged.Highest], value, nameof(HighestJudgmentMillisText)); + } + + public string HigherJudgmentMillisText + { + get => _judgmentMillisText[(int)Component.Judged.Higher]; + + set => SetProperty(ref _judgmentMillisText[(int)Component.Judged.Higher], value, nameof(HigherJudgmentMillisText)); + } + + public string HighJudgmentMillisText + { + get => _judgmentMillisText[(int)Component.Judged.High]; + + set => SetProperty(ref _judgmentMillisText[(int)Component.Judged.High], value, nameof(HighJudgmentMillisText)); + } + + public string LowJudgmentMillisText + { + get => _judgmentMillisText[(int)Component.Judged.Low]; + + set => SetProperty(ref _judgmentMillisText[(int)Component.Judged.Low], value, nameof(LowJudgmentMillisText)); + } + + public string LowerJudgmentMillisText + { + get => _judgmentMillisText[(int)Component.Judged.Lower]; + + set => SetProperty(ref _judgmentMillisText[(int)Component.Judged.Lower], value, nameof(LowerJudgmentMillisText)); + } + + public string LowestJudgmentMillisText + { + get => _judgmentMillisText[(int)Component.Judged.Lowest]; + + set => SetProperty(ref _judgmentMillisText[(int)Component.Judged.Lowest], value, nameof(LowestJudgmentMillisText)); + } + + public int DataID { get; set; } + + public DateTime? LatestDate { get; set; } + + public int HandledCount { get; set; } + + public string FileName { get; set; } + + public bool HasNoteDrawing => _noteDrawing != null; + + public HashSet FavoriteEntryItems { get; } = new(); + + public DefaultEntryItem DefaultEntryItem { get; } + + public string NoteFilePath { get; } + + public EntryItem EntryItem { get; } + + public Handled HandledValue + { + get => _handledValue; + + set => SetProperty(ref _handledValue, value, nameof(HandledValue)); + } + + public Action OnLevyNoteFile { get; init; } + + public BaseNoteFile(string noteFilePath, DefaultEntryItem defaultEntryItem, EntryItem entryItem) + { + NoteFilePath = noteFilePath; + FileName = Path.GetFileName(NoteFilePath); + DefaultEntryItem = defaultEntryItem; + EntryItem = entryItem; + LongNoteModeDate = Component.LatestLongNoteMode; + } + + public override bool Equals(object obj) => obj is BaseNoteFile noteFile && GetNoteID512() == noteFile.GetNoteID512(); + + public override int GetHashCode() => GetNoteID512().GetHashCode(); + + public void SetJudgmentMillisTexts(ModeComponent modeComponentValue) + { + HighestJudgmentMillisText = GetMillisText(Component.Judged.Highest); + HigherJudgmentMillisText = GetMillisText(Component.Judged.Higher); + HighJudgmentMillisText = GetMillisText(Component.Judged.High); + LowJudgmentMillisText = GetMillisText(Component.Judged.Low); + LowerJudgmentMillisText = GetMillisText(Component.Judged.Lower); + LowestJudgmentMillisText = GetMillisText(Component.Judged.Lowest); + + string GetMillisText(Component.Judged judged) + { + var judgment0 = Math.Round(Component.GetJudgmentMillis(judged, modeComponentValue, JudgmentStage, Component.LatestJudgmentMode, Component.LatestJudgmentMap, Component.LatestLongNoteAssist, 0), 3); + var judgment1 = Math.Round(Component.GetJudgmentMillis(judged, modeComponentValue, JudgmentStage, Component.LatestJudgmentMode, Component.LatestJudgmentMap, Component.LatestLongNoteAssist, 1), 3); + return Math.Abs(judgment0) != Math.Abs(judgment1) ? $"{judgment0} ~ {judgment1} ms" : $"{judgment1} ms"; + } + } + + public void SetConfigure() + { + var (audioWait, mediaWait, media) = DB.Instance.GetWait(this); + Configure.Instance.AudioWait = audioWait; + Configure.Instance.MediaWait = mediaWait; + Configure.Instance.Media = media != false; + Configure.Instance.NoteFormatID = DB.Instance.GetFormat(this); + } + + public virtual string GetNoteID128(byte[] data = null) + { + if (_save128 == null) + { + try + { + _save128 = $"{Utility.GetID128s(data ?? GetContents())}:{DataID}"; + } + catch + { + _save128 = string.Empty; + } + } + return _save128; + } + + public virtual string GetNoteID256(byte[] data = null) + { + if (_save256 == null) + { + try + { + _save256 = $"{Utility.GetID256s(data ?? GetContents())}:{DataID}"; + } + catch + { + _save256 = string.Empty; + } + } + return _save256; + } + + public string GetNoteID512(byte[] data = null) + { + if (_save512 == null) + { + SetNoteID512(null, data); + } + return _save512; + } + + void SetNoteID512(string noteID512 = null, byte[] data = null) + { + _save512 = noteID512 ?? $"{GetNoteID512Impl(data)}:{DataID}"; + FavoriteEntryItems.Clear(); + foreach (var favoriteEntryItem in DB.Instance.GetFavoriteEntryItems(this)) + { + FavoriteEntryItems.Add(favoriteEntryItem); + } + HandledValue = DB.Instance.GetHandled(this); + (LatestDate, HandledCount) = DB.Instance.GetDate(this, default); + } + + string GetNoteID512Impl(byte[] data = null) + { + try + { + return Utility.GetID512s(data ?? GetContents()); + } + catch + { + return string.Empty; + } + } + + public byte[] GetContents() + { + try + { + return File.Exists(NoteFilePath) ? File.ReadAllBytes(NoteFilePath) : Array.Empty(); + } + catch + { + return Array.Empty(); + } + } + + public void SetNoteIDs(string noteID128, string noteID256, string noteID512) + { + _save128 = noteID128; + _save256 = noteID256; + SetNoteID512(noteID512); + } + + public void SetData(int salt, CancellationTokenSource setCancelCompiler = null) + { + if (!IsLogical) + { + var data = GetContents(); + GetNoteID128(data); + GetNoteID256(data); + GetNoteID512(data); + InitCompiled(); + BaseCompiler.GetCompiler(this, setCancelCompiler).Compile(this, data, salt); + } + } + + public bool IsValid() => GetNoteID512() == $"{GetNoteID512Impl()}:{DataID}"; + + public bool IsContinuous(BaseNoteFile noteFile) => noteFile != null && (EntryItem == noteFile.EntryItem || Utility.GetTitle(Title) == Utility.GetTitle(noteFile.Title)); + + public override void OnFault(Exception e) => throw e; + + public override void OnCompiled() => FastDB.Instance.SetNoteFile(this); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/DefaultEntryItemNoteFile.cs b/Qwilight/Qwilight/NoteFile/DefaultEntryItemNoteFile.cs new file mode 100644 index 0000000..50afd7e --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/DefaultEntryItemNoteFile.cs @@ -0,0 +1,29 @@ +using Qwilight.UIComponent; +using Qwilight.ViewModel; +using System.Windows.Media; + +namespace Qwilight.NoteFile +{ + public sealed class DefaultEntryItemNoteFile : BaseNoteFile + { + public override NoteVariety NoteVarietyValue => default; + + public override bool IsLogical => true; + + public override bool Equals(object obj) => obj is DefaultEntryItemNoteFile defaultEntryItemNoteFile && defaultEntryItemNoteFile.DefaultEntryItem == DefaultEntryItem; + + public override int GetHashCode() => DefaultEntryItem.GetHashCode(); + + public override ImageSource EssentialDrawing => BaseUI.Instance.DefaultEntryDrawings[(int)DefaultEntryItem.DefaultEntryVarietyValue]; + + public DefaultEntryItemNoteFile(DefaultEntryItem defaultEntryItem, EntryItem entryItem, bool isEnter) : base(default, defaultEntryItem, entryItem) + { + Title = entryItem.Title; + Artist = entryItem.Artist; + OnLevyNoteFile = new(() => + { + ViewModels.Instance.MainValue.SetLastDefaultEntryItem(isEnter ? DefaultEntryItem : null); + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/LevelNoteFile.cs b/Qwilight/Qwilight/NoteFile/LevelNoteFile.cs new file mode 100644 index 0000000..dfdc653 --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/LevelNoteFile.cs @@ -0,0 +1,72 @@ +using Qwilight.ViewModel; +using System.Windows.Media; + +namespace Qwilight.NoteFile +{ + public sealed class LevelNoteFile : BaseNoteFile + { + readonly string _save128 = string.Empty; + readonly string _save256 = string.Empty; + + public override NoteVariety NoteVarietyValue { get; } = NoteVariety.BMS; + + public override ImageSource HandledWallDrawing => null; + + public override ImageSource EssentialDrawing => DrawingSystem.Instance.ClearedDrawing.DefaultDrawing; + + public override bool IsLogical => true; + + public override bool Equals(object obj) => obj is LevelNoteFile levelNoteFile && _save128 == levelNoteFile._save128 && _save256 == levelNoteFile._save256; + + public override int GetHashCode() => HashCode.Combine(_save128, _save256); + + public LevelNoteFile(JSON.BMSTableData levelTableData, string wantLevelID) : base(default, default, default) + { + Title = levelTableData.title ?? string.Empty; + Artist = levelTableData.artist ?? string.Empty; + WantLevelID = wantLevelID; + Tag = levelTableData.comment ?? string.Empty; + if (!string.IsNullOrEmpty(levelTableData.md5)) + { + _save128 = $"{levelTableData.md5}:{DataID}"; + } + if (!string.IsNullOrEmpty(levelTableData.sha256)) + { + _save256 = $"{levelTableData.sha256}:{DataID}"; + } + OnLevyNoteFile = new(() => + { + try + { + ViewModels.Instance.LevelVoteValue.Www0 = new Uri(levelTableData.url_diff); + ViewModels.Instance.LevelVoteValue.IsWww0Visible = true; + } + catch + { + ViewModels.Instance.LevelVoteValue.IsWww0Visible = false; + } + try + { + ViewModels.Instance.LevelVoteValue.Www1 = new Uri(levelTableData.url_diff); + ViewModels.Instance.LevelVoteValue.IsWww1Visible = true; + } + catch + { + ViewModels.Instance.LevelVoteValue.IsWww1Visible = false; + } + if (ViewModels.Instance.LevelVoteValue.IsWww0Visible || ViewModels.Instance.LevelVoteValue.IsWww1Visible) + { + ViewModels.Instance.LevelVoteValue.Open(); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAvailableLevelWww); + } + }); + } + + public override string GetNoteID128(byte[] data = null) => _save128; + + public override string GetNoteID256(byte[] data = null) => _save256; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/ModifyDefaultEntryNoteFile.cs b/Qwilight/Qwilight/NoteFile/ModifyDefaultEntryNoteFile.cs new file mode 100644 index 0000000..3e1ac4d --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/ModifyDefaultEntryNoteFile.cs @@ -0,0 +1,22 @@ +using Qwilight.ViewModel; +using System.Windows.Media; + +namespace Qwilight.NoteFile +{ + public sealed class ModifyDefaultEntryNoteFile : BaseNoteFile + { + public static readonly ModifyDefaultEntryNoteFile Instance = new(); + + public override NoteVariety NoteVarietyValue => default; + + public override bool IsLogical => true; + + public override ImageSource LogicalDrawing => BaseUI.Instance.DefaultEntryConfigureDrawing; + + public override bool Equals(object obj) => obj is ModifyDefaultEntryNoteFile; + + public override int GetHashCode() => 0; + + ModifyDefaultEntryNoteFile() : base(default, default, default) => OnLevyNoteFile = new(() => ViewModels.Instance.ModifyDefaultEntryValue.Open()); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/NetNoteFile.cs b/Qwilight/Qwilight/NoteFile/NetNoteFile.cs new file mode 100644 index 0000000..f1946fb --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/NetNoteFile.cs @@ -0,0 +1,24 @@ +namespace Qwilight.NoteFile +{ + public sealed class NetNoteFile : BaseNoteFile + { + public override NoteVariety NoteVarietyValue => default; + + public NetNoteFile(JSON.TwilightQuitNet.QuitNetItem quitNetItem) : base(default, default, default) + { + Title = quitNetItem.title; + Artist = quitNetItem.artist; + Genre = quitNetItem.genre; + LevelValue = quitNetItem.level; + LevelText = quitNetItem.levelText; + WantLevelID = quitNetItem.wantLevelID; + TotalNotes = quitNetItem.totalNotes; + JudgmentStage = quitNetItem.judgmentStage; + HitPointsValue = quitNetItem.hitPointsValue; + HighestInputCount = quitNetItem.highestInputCount; + Length = quitNetItem.length; + BPM = quitNetItem.bpm; + InputMode = quitNetItem.inputMode; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/NotAvailableNoteFile.cs b/Qwilight/Qwilight/NoteFile/NotAvailableNoteFile.cs new file mode 100644 index 0000000..7f2d9d2 --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/NotAvailableNoteFile.cs @@ -0,0 +1,26 @@ +using Qwilight.UIComponent; + +namespace Qwilight.NoteFile +{ + public sealed class NotAvailableNoteFile : BaseNoteFile + { + readonly string _noteID; + + public override NoteVariety NoteVarietyValue => NotAvailableNoteVarietyValue; + + public NoteVariety NotAvailableNoteVarietyValue { get; set; } + + public override bool IsLogical => true; + + public override bool Equals(object obj) => obj is NotAvailableNoteFile notAvailableNoteFile && _noteID == notAvailableNoteFile._noteID; + + public override int GetHashCode() => _noteID.GetHashCode(); + + public NotAvailableNoteFile(string noteID, DefaultEntryItem defaultEntryItem, EntryItem entryItem) : base(default, defaultEntryItem, entryItem) + { + _noteID = noteID; + IsBanned = true; + DB.Instance.GetEventNoteData(noteID, this); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/PMSFile.cs b/Qwilight/Qwilight/NoteFile/PMSFile.cs new file mode 100644 index 0000000..16debfc --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/PMSFile.cs @@ -0,0 +1,11 @@ +using Qwilight.UIComponent; + +namespace Qwilight.NoteFile +{ + public sealed class PMSFile : BMSFile + { + public PMSFile(string noteFilePath, DefaultEntryItem defaultEntryItem, EntryItem entryItem) : base(noteFilePath, defaultEntryItem, entryItem) + { + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/NoteFile/SaltNoteFile.cs b/Qwilight/Qwilight/NoteFile/SaltNoteFile.cs new file mode 100644 index 0000000..4811c77 --- /dev/null +++ b/Qwilight/Qwilight/NoteFile/SaltNoteFile.cs @@ -0,0 +1,25 @@ +using System.Windows.Media; + +namespace Qwilight.NoteFile +{ + public sealed class SaltNoteFile : BaseNoteFile + { + public static readonly SaltNoteFile Instance = new(); + + public override NoteVariety NoteVarietyValue => default; + + public override bool IsLogical => true; + + public override ImageSource LogicalDrawing => BaseUI.Instance.SaltDrawing; + + public override string LogicalAudioFileName => "Salt"; + + public override bool Equals(object obj) => obj is SaltNoteFile; + + public override int GetHashCode() => 0; + + SaltNoteFile() : base(default, default, default) + { + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/PaintComponent/BasePaintComponent.cs b/Qwilight/Qwilight/PaintComponent/BasePaintComponent.cs new file mode 100644 index 0000000..ccf5726 --- /dev/null +++ b/Qwilight/Qwilight/PaintComponent/BasePaintComponent.cs @@ -0,0 +1,49 @@ +using Microsoft.Graphics.Canvas; + +namespace Qwilight.PaintComponent +{ + public abstract class BasePaintComponent + { + double _framerate; + double _millis; + + public int DrawingPaintFrame { get; set; } + + public int PaintFrame { get; set; } + + public double PaintPosition0 { get; set; } + + public double PaintPosition1 { get; set; } + + public double PaintLength { get; set; } + + public double PaintHeight { get; set; } + + public BasePaintComponent(int frame, double framerate) + { + DrawingPaintFrame = 0; + PaintFrame = frame; + _framerate = 1000.0 / framerate; + } + + public bool IsPaintAsToo(double millisLoopUnit) + { + _millis += millisLoopUnit; + while (_millis >= _framerate) + { + _millis -= _framerate; + if (DrawingPaintFrame + 1 < PaintFrame) + { + ++DrawingPaintFrame; + } + else + { + return true; + } + } + return false; + } + + public abstract void Paint(ref Bound r, CanvasDrawingSession targetSession, float faint, CanvasComposite drawingComposition); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/PaintComponent/HitLongNotePaint.cs b/Qwilight/Qwilight/PaintComponent/HitLongNotePaint.cs new file mode 100644 index 0000000..8b00818 --- /dev/null +++ b/Qwilight/Qwilight/PaintComponent/HitLongNotePaint.cs @@ -0,0 +1,29 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.PaintComponent +{ + public sealed class HitLongNotePaint : BasePaintComponent + { + readonly Component.InputMode _inputMode; + readonly int _input; + + public HitLongNotePaint(DefaultCompute defaultComputer, int input, int frame, double framerate) : base(frame, framerate) + { + _inputMode = defaultComputer.InputMode; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + PaintPosition0 = defaultComputer.GetPosition(input) + drawingComponentValue.DrawingNoteLengthMap[input] / 2 + drawingComponentValue.hitLongNotePaintPosition0s[input]; + PaintPosition1 = defaultComputer.DrawingComponentValue.judgmentMainPosition + drawingComponentValue.hitLongNotePaintPosition1s[input]; + PaintLength = drawingComponentValue.hitLongNotePaintLengths[input]; + PaintHeight = drawingComponentValue.hitLongNotePaintHeights[input]; + _input = input; + } + + public override void Paint(ref Bound r, CanvasDrawingSession targetSession, float faint, CanvasComposite drawingComposition) + { + r.Set(PaintPosition0, PaintPosition1, PaintLength, PaintHeight); + targetSession.PaintDrawing(ref r, UI.Instance.LongNoteHitDrawings[(int)_inputMode][_input][DrawingPaintFrame], faint, drawingComposition); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/PaintComponent/HitNotePaint.cs b/Qwilight/Qwilight/PaintComponent/HitNotePaint.cs new file mode 100644 index 0000000..7be53d8 --- /dev/null +++ b/Qwilight/Qwilight/PaintComponent/HitNotePaint.cs @@ -0,0 +1,29 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.PaintComponent +{ + public sealed class HitNotePaint : BasePaintComponent + { + readonly Component.InputMode _inputMode; + readonly int _input; + + public HitNotePaint(DefaultCompute defaultComputer, int input, int frame, double framerate) : base(frame, framerate) + { + _inputMode = defaultComputer.InputMode; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + PaintPosition0 = defaultComputer.GetPosition(input) + drawingComponentValue.DrawingNoteLengthMap[input] / 2 + drawingComponentValue.hitNotePaintPosition0s[input]; + PaintPosition1 = defaultComputer.DrawingComponentValue.judgmentMainPosition + drawingComponentValue.hitNotePaintPosition1s[input]; + PaintLength = drawingComponentValue.hitNotePaintLengths[input]; + PaintHeight = drawingComponentValue.hitNotePaintHeights[input]; + _input = input; + } + + public override void Paint(ref Bound r, CanvasDrawingSession targetSession, float faint, CanvasComposite drawingComposition) + { + r.Set(PaintPosition0, PaintPosition1, PaintLength, PaintHeight); + targetSession.PaintDrawing(ref r, UI.Instance.NoteHitDrawings[(int)_inputMode][_input][DrawingPaintFrame], faint, drawingComposition); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/PaintComponent/JudgmentPaint.cs b/Qwilight/Qwilight/PaintComponent/JudgmentPaint.cs new file mode 100644 index 0000000..664e6d0 --- /dev/null +++ b/Qwilight/Qwilight/PaintComponent/JudgmentPaint.cs @@ -0,0 +1,43 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.PaintComponent +{ + public sealed class JudgmentPaint : BasePaintComponent + { + public const int Band1 = 9; + public const int Last = 10; + + readonly Component.Judged _judged; + readonly int _judgmentSystem; + + public JudgmentPaint(DefaultCompute defaultComputer, Component.Judged judged, bool isIn2P, int judgmentSystem, double judgmentPosition0, double judgmentPosition1, int frame, double framerate, double paintLength, double paintHeight) : base(frame, framerate) + { + var drawingComponentValue = defaultComputer.DrawingComponentValue; + PaintPosition0 = judgmentPosition0 + (isIn2P ? drawingComponentValue.p1BuiltLength + drawingComponentValue.p2Position : 0.0); + PaintPosition1 = judgmentPosition1; + PaintLength = paintLength; + PaintHeight = paintHeight; + _judged = judged; + _judgmentSystem = judgmentSystem; + } + + public override void Paint(ref Bound r, CanvasDrawingSession targetSession, float faint, CanvasComposite drawingComposition) + { + switch (_judgmentSystem) + { + case 0: + r.Set(PaintPosition0, PaintPosition1, PaintLength, PaintHeight); + break; + case 1: + r.Set(PaintPosition0 - PaintLength / 2, PaintPosition1, PaintLength, PaintHeight); + break; + case 2: + r.Set(PaintPosition0 - PaintLength, PaintPosition1, PaintLength, PaintHeight); + break; + } + targetSession.PaintDrawing(ref r, UI.Instance.JudgmentDrawings[(int)_judged][DrawingPaintFrame], faint, drawingComposition); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Paints.cs b/Qwilight/Qwilight/Paints.cs new file mode 100644 index 0000000..1b863a7 --- /dev/null +++ b/Qwilight/Qwilight/Paints.cs @@ -0,0 +1,55 @@ +using Microsoft.UI; +using Qwilight.Utilities; +using Windows.UI; +using Brush = System.Windows.Media.Brush; +using Pen = System.Windows.Media.Pen; + +namespace Qwilight +{ + public static class Paints + { + public static readonly Brush[] NetSiteCommentPaints = new Brush[] + { + null, + DrawingSystem.Instance.GetDefaultPaint(Colors.Green), + DrawingSystem.Instance.GetDefaultPaint(Colors.Red) + }; + public static readonly Brush[] LowerStandPaints = new Brush[] + { + DrawingSystem.Instance.GetDefaultPaint(Colors.Green), + DrawingSystem.Instance.GetDefaultPaint(Colors.Yellow), + DrawingSystem.Instance.GetDefaultPaint(Colors.Red) + }; + public static readonly Brush ModalPaint = DrawingSystem.Instance.GetDefaultPaint(Colors.Black, 50); + public static readonly Brush[] PointPaints = new Brush[] + { + QwilightComponent.GetBuiltInData("NotPointedPaint"), + QwilightComponent.GetBuiltInData("PointedPaint") + }; + public static readonly Color[] PointColors = new Color[] + { + Utility.ModifyColor(QwilightComponent.GetBuiltInData("NotPointedColor")), + Utility.ModifyColor(QwilightComponent.GetBuiltInData("PointedColor")) + }; + public static readonly Brush PaintFaint = DrawingSystem.Instance.GetDefaultPaint(Colors.Transparent); + public static readonly Brush Paint0 = DrawingSystem.Instance.GetDefaultPaint(Colors.Black); + public static readonly Brush Paint1 = DrawingSystem.Instance.GetDefaultPaint(Colors.Red); + public static readonly Brush Paint2 = DrawingSystem.Instance.GetDefaultPaint(Colors.Yellow); + public static readonly Brush Paint3 = DrawingSystem.Instance.GetDefaultPaint(Colors.Green); + public static readonly Brush Paint4 = DrawingSystem.Instance.GetDefaultPaint(Colors.White); + public static readonly Brush InputPaint1 = DrawingSystem.Instance.GetDefaultPaint(Colors.Red); + public static readonly Brush InputPaint2 = DrawingSystem.Instance.GetDefaultPaint(Colors.White); + public static readonly Brush InputPaint3 = DrawingSystem.Instance.GetDefaultPaint(Colors.Cyan); + public static readonly Color ColorOK = Colors.DarkGreen; + public static readonly Color ColorInfo = Colors.DarkBlue; + public static readonly Color ColorFault = Colors.DarkRed; + public static readonly Color ColorWarning = Colors.DarkGoldenrod; + public static readonly Brush PaintOK = DrawingSystem.Instance.GetDefaultPaint(Colors.DarkGreen); + public static readonly Brush PaintInfo = DrawingSystem.Instance.GetDefaultPaint(Colors.DarkBlue); + public static readonly Brush PaintFault = DrawingSystem.Instance.GetDefaultPaint(Colors.DarkRed); + public static readonly Brush PaintWarning = DrawingSystem.Instance.GetDefaultPaint(Colors.DarkGoldenrod); + public static readonly Pen Pen0 = DrawingSystem.Instance.GetPen(Paint0); + public static readonly Pen Pen4 = DrawingSystem.Instance.GetPen(Paint4); + public static Brush DefaultPointedPaint = DrawingSystem.Instance.GetDefaultPaint(Utility.ModifyColor(QwilightComponent.GetBuiltInData("PointedColor"))); + } +} diff --git a/Qwilight/Qwilight/PostableItem.cs b/Qwilight/Qwilight/PostableItem.cs new file mode 100644 index 0000000..5f919c7 --- /dev/null +++ b/Qwilight/Qwilight/PostableItem.cs @@ -0,0 +1,197 @@ +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.UI; +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight +{ + public sealed class PostableItem + { + public enum Variety + { + PositiveJudgment, + PositiveHitPoints, + PositiveHitPointsLevel, + PositiveAegis, + NegativeFaint, + NegativeFading, + NegativeJudgment, + NegativeHitPoints, + NegativeHitPointsLevel, + Negative4D, + NegativeZip, + NegativeTrapNotes, + NegativeAutoableNotes, + NegativeSalt, + LowerAudioMultiplier, + HigherAudioMultiplier, + Pause + } + + public static readonly PostableItem[] Values = new[] + { + new PostableItem + { + VarietyValue = Variety.PositiveJudgment, + IsPositive = true, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.PositiveHitPoints, + IsPositive = true, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.PositiveHitPointsLevel, + IsPositive = true, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.PositiveAegis, + IsPositive = true, + LowestWait = double.MaxValue, + HighestWait = double.MaxValue + }, + new PostableItem + { + VarietyValue = Variety.NegativeFaint, + IsPositive = false, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeFading, + IsPositive = false, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeJudgment, + IsPositive = false, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeHitPoints, + IsPositive = false, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeHitPointsLevel, + IsPositive = false, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.Negative4D, + IsPositive = false, + LowestWait = 500.0, + HighestWait = 2000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeZip, + IsPositive = false, + LowestWait = 500.0, + HighestWait = 2000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeTrapNotes, + IsPositive = false, + LowestWait = 500.0, + HighestWait = 2000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeAutoableNotes, + IsPositive = false, + LowestWait = 500.0, + HighestWait = 2000.0 + }, + new PostableItem + { + VarietyValue = Variety.NegativeSalt, + IsPositive = false, + LowestWait = 500.0, + HighestWait = 2000.0 + }, + new PostableItem + { + VarietyValue = Variety.LowerAudioMultiplier, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.HigherAudioMultiplier, + LowestWait = 2000.0, + HighestWait = 8000.0 + }, + new PostableItem + { + VarietyValue = Variety.Pause, + LowestWait = 125.0, + HighestWait = 500.0 + } + }; + + public Variety VarietyValue { get; set; } + + public bool? IsPositive { get; set; } + + public double LowestWait { get; set; } + + public double HighestWait { get; set; } + + public Color ItemColor => IsPositive switch + { + true => Colors.DeepSkyBlue, + false => Colors.DeepPink, + null => Colors.Gray + }; + + public Brush ItemPaint => DrawingSystem.Instance.GetDefaultPaint(ItemColor); + + public ICanvasBrush[] ItemPaints => IsPositive switch + { + true => DrawingSystem.Instance.FaintPositiveItemPaints, + false => DrawingSystem.Instance.FaintNegativeItemPaints, + null => DrawingSystem.Instance.FaintNeutralItemPaints + }; + + public override string ToString() => VarietyValue switch + { + Variety.PositiveJudgment => "💊 EASY JUDGMENT", + Variety.PositiveHitPoints => "💊 REGENERATION", + Variety.PositiveHitPointsLevel => "💊 EASY GAUGE", + Variety.PositiveAegis => "💊 SHIELD", + Variety.NegativeJudgment => "💣 HARD JUDGMENT", + Variety.NegativeHitPoints => "💣 BLEEDING", + Variety.NegativeHitPointsLevel => "💣 HARD GAUGE", + Variety.NegativeFaint => "💣 FADE OUT", + Variety.NegativeFading => "💣 BLINK", + Variety.Negative4D => "💣 4D", + Variety.NegativeZip => "💣 COMPRESSION", + Variety.NegativeTrapNotes => "💣 MINEFIELD", + Variety.NegativeAutoableNotes => "💣 SCRATCH", + Variety.NegativeSalt => "💣 RANDOM", + Variety.LowerAudioMultiplier => "🌐 SLOWER", + Variety.HigherAudioMultiplier => "🌐 FASTER", + Variety.Pause => "🌐 PAUSE", + _ => default + }; + } +} diff --git a/Qwilight/Qwilight/Primitive.cs b/Qwilight/Qwilight/Primitive.cs new file mode 100644 index 0000000..edc9449 --- /dev/null +++ b/Qwilight/Qwilight/Primitive.cs @@ -0,0 +1,22 @@ +namespace Qwilight +{ + public sealed class Primitive + { + T _value; + + public Primitive(T value) + { + SetValue(value); + } + + public void SetValue(T value) + { + _value = value; + } + + public static implicit operator T(Primitive value) + { + return value._value; + } + } +} diff --git a/Qwilight/Qwilight/QwilightComponent.cs b/Qwilight/Qwilight/QwilightComponent.cs new file mode 100644 index 0000000..614f416 --- /dev/null +++ b/Qwilight/Qwilight/QwilightComponent.cs @@ -0,0 +1,226 @@ +using CommandLine; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Globalization; +using System.IO; +using System.Management; +using System.Reflection; +using System.Text.RegularExpressions; +using Windows.Win32; +using Windows.Win32.Graphics.Gdi; + +namespace Qwilight +{ + public static partial class QwilightComponent + { + [GeneratedRegex("^(Lower Entry)|(Higher Entry)|(Lower Note File)|(Higher Note File)$")] + public static partial Regex GetStopLastAudioComputer(); + + [GeneratedRegex("^(Default)|(Salt)$")] + public static partial Regex GetLoopingAudioComputer(); + + [GeneratedRegex("[a-zA-Z\\d]+\\([\\d.+\\-, ]*\\)")] + public static partial Regex GetCallComputer(); + + public sealed class QwilightParams + { + [Option("valve")] + public bool IsValve { get; set; } + + [Option("vs")] + public bool IsVS { get; set; } + + [Option("language")] + public int Language { get; set; } + + [Option("test")] + public bool IsTest { get; set; } + } + + public const int SendUnit = 1024 * 1024; + + public static readonly int CPUCount = Environment.ProcessorCount; + public static readonly string[] BundleFileFormats = new[] { ".rar", ".zip", ".7z" }; + public static readonly string[] BMSNoteFileFormats = new[] { ".bms", ".bme", ".bml", ".pms" }; + public static readonly string[] BMSONNoteFileFormats = new[] { ".bmson" }; + public static readonly string[] NoteFileFormats = BMSNoteFileFormats.Concat(BMSONNoteFileFormats).ToArray(); + public static readonly string[] AudioFileFormatItems = new[] { ".aif", ".aiff", ".asf", ".flac", ".m4a", ".mid", ".midi", ".mp2", ".mp3", ".ogg", ".opus", ".raw", ".wav", ".wma" }; + public static readonly string[] DrawingFileFormats = new[] { ".bmp", ".gif", ".jpeg", ".jpg", ".png" }; + public static readonly string[] MediaFileFormats = new[] { ".avi", ".flv", ".m1v", ".mkv", ".mov", ".mp4", ".mpeg", ".mpg", ".wmv" }; + public static readonly string HashText = Utility.GetID512s(File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Qwilight.dll"))); + public static readonly Version Date = Assembly.GetEntryAssembly().GetName().Version; + public static readonly string DateText = $"{Date.Major}.{Date.Minor}.{Date.Build}"; + public static readonly JSON.AssetClient AssetsClientJSON; + public static readonly double StandardUILoopMillis = 125.0; + public static readonly double StandardLoopMillis = 1000.0 / 31; + public static readonly TimeSpan StandardFrametime = TimeSpan.FromMilliseconds(1000.0 / 60); + public static readonly double StandardWaitMillis = 500.0; + public static readonly int HeapCount = GC.MaxGeneration + 1; + public static readonly HwMode DefaultHwMode; + public static readonly string AssetsEntryPath; + public static readonly string CPUAssetsEntryPath; + public static readonly string QwilightEntryPath; + public static readonly string EdgeEntryPath; + public static readonly string UIEntryPath; + public static readonly string BundleEntryPath; + public static readonly string CommentEntryPath; + public static readonly string FaultEntryPath; + public static readonly string MediaEntryPath; + public static readonly string SoftwareEntryPath; + public static readonly string AMD64Name = string.Empty; + public static readonly string OSName = string.Empty; + public static readonly string RAMName = string.Empty; + public static readonly string GPUName = string.Empty; + public static readonly string M2Name = string.Empty; + public static readonly string AudioName = string.Empty; + public static readonly string TVName = string.Empty; + public static readonly string LANName = string.Empty; + + public static string TaehuiNetHost { get; set; } + + public static string TaehuiNetFE { get; set; } + + public static string TaehuiNetAPI { get; set; } + + public static string QwilightAPI { get; set; } + + public static bool IsValve { get; set; } + + public static string TestLanguage { get; set; } + + public static bool IsTest { get; set; } + + public static bool IsVS { get; set; } + + public static int GetDigit(int value) + { + return value > 0 ? (int)(Math.Log10(value) + 1) : 1; + } + + public static Func OnGetBuiltInData { get; set; } + + public static T GetBuiltInData(string data) + { + var value = OnGetBuiltInData(data); + return value != null ? (T)value : default; + } + + public static string GetBuiltInFloat64As(string data) => GetBuiltInData(data).ToString(CultureInfo.InvariantCulture); + + static QwilightComponent() + { + AssetsClientJSON = Utility.GetJSON(File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Assets", "Client.json"))); + Parser.Default.ParseArguments(Environment.GetCommandLineArgs()).WithParsed(o => + { + IsValve = o.IsValve; + if (o.Language > 0) + { + TestLanguage = Utility.GetLanguage(o.Language); + } + IsTest = o.IsTest; + IsVS = o.IsVS; + }); + +#if DEBUG + TaehuiNetHost = "localhost"; + TaehuiNetFE = "http://localhost"; + TaehuiNetAPI = "http://localhost:10100/www"; + QwilightAPI = "http://localhost:7301/qwilight/www"; +#else + TaehuiNetHost = IsVS ? "taehui" : "taehui.ddns.net"; + TaehuiNetFE = IsVS ? "http://taehui" : "https://taehui.ddns.net"; + TaehuiNetAPI = IsVS ? "http://taehui:10100/www" : "https://taehui.ddns.net/www"; + QwilightAPI = IsVS ? "http://taehui:7301/qwilight/www" : "https://taehui.ddns.net/qwilight/www"; +#endif + + AssetsEntryPath = Path.Combine(AppContext.BaseDirectory, "Assets"); +#if X64 + CPUAssetsEntryPath = Path.Combine(AssetsEntryPath, "x64"); +#else + CPUAssetsEntryPath = Path.Combine(AssetsEntryPath, "ARM64"); +#endif + QwilightEntryPath = Path.Combine(AppContext.BaseDirectory, IsValve ? "SavesDir" : Environment.UserName); + EdgeEntryPath = Path.Combine(QwilightEntryPath, "Edge"); + UIEntryPath = Path.Combine(QwilightEntryPath, "UI"); + BundleEntryPath = Path.Combine(QwilightEntryPath, "Bundle"); + CommentEntryPath = Path.Combine(QwilightEntryPath, "Comment"); + FaultEntryPath = Path.Combine(QwilightEntryPath, "Fault"); + MediaEntryPath = Path.Combine(QwilightEntryPath, "Media"); + SoftwareEntryPath = Path.Combine(QwilightEntryPath, "Software"); + + var rawHwMode = new DEVMODEW(); + PInvoke.EnumDisplaySettings(null, ENUM_DISPLAY_SETTINGS_MODE.ENUM_CURRENT_SETTINGS, ref rawHwMode); + DefaultHwMode = new HwMode(rawHwMode.dmPelsWidth, rawHwMode.dmPelsHeight, rawHwMode.dmDisplayFrequency); + + try + { + using var mos = new ManagementObjectSearcher("SELECT Name FROM Win32_Processor"); + using var moc = mos.Get(); + AMD64Name = string.Join(", ", moc.Cast().Select(o => o["Name"])); + } + catch + { + } + + try + { + OSName = Environment.OSVersion.ToString(); + } + catch + { + } + + try + { + using var mos = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem"); + using var moc = mos.Get(); + RAMName = Utility.FormatUnit((long)moc.Cast().Select(o => (ulong)o["TotalPhysicalMemory"]).Single()); + } + catch + { + } + + try + { + using var mos = new ManagementObjectSearcher("SELECT Name FROM Win32_VideoController"); + using var moc = mos.Get(); + GPUName = string.Join(", ", moc.Cast().Select(o => o["Name"])); + } + catch + { + } + + try + { + using var mos = new ManagementObjectSearcher("SELECT Model FROM Win32_DiskDrive"); + using var moc = mos.Get(); + M2Name = string.Join(", ", moc.Cast().Select(o => o["Model"])); + } + catch + { + } + + try + { + using var mos = new ManagementObjectSearcher("SELECT ProductName FROM Win32_SoundDevice"); + using var moc = mos.Get(); + AudioName = string.Join(", ", moc.Cast().Select(o => o["ProductName"])); + } + catch + { + } + + TVName = DefaultHwMode.ToString(); + + try + { + using var mos = new ManagementObjectSearcher("SELECT ProductName FROM Win32_NetworkAdapter"); + using var moc = mos.Get(); + LANName = string.Join(", ", moc.Cast().Select(o => o["ProductName"])); + } + catch + { + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioInputSystem.cs b/Qwilight/Qwilight/System/AudioInputSystem.cs new file mode 100644 index 0000000..f8ca8c1 --- /dev/null +++ b/Qwilight/Qwilight/System/AudioInputSystem.cs @@ -0,0 +1,312 @@ +using NAudio.CoreAudioApi; +using NAudio.Wave; +using OpusDotNet; +using Qwilight.UIComponent; +using Qwilight.ViewModel; +using System.Buffers; +using System.Collections.ObjectModel; +using System.IO; +using System.Windows.Media; + +namespace Qwilight +{ + public sealed class AudioInputSystem : Model, IDisposable + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(AudioInputSystem)); + + public static readonly string LoopWaveInID = Guid.NewGuid().ToString(); + + public static readonly AudioInputSystem Instance = QwilightComponent.GetBuiltInData(nameof(AudioInputSystem)); + + readonly WaveFormat _waveFormat = new(48000, 2); + readonly Dictionary _waveData = new(); + readonly MixingWaveProvider32 _m = new(); + readonly OpusEncoder _zipComputer; + readonly OpusDecoder _rawComputer; + readonly byte[] _zippingData = new byte[11520]; + int _zippingPosition; + WasapiOut _wave; + WasapiCapture _waveIn; + bool _loopWaveIn; + WaveValue? _waveInValue; + WaveValue? _waveValue; + + public AudioInputSystem() + { + _zipComputer = new(Application.VoIP, _waveFormat.SampleRate, _waveFormat.Channels); + _rawComputer = new(_waveFormat.SampleRate, _waveFormat.Channels); + GetWaveInValues(); + GetWaveValues(); + } + + public double AudioInputValue { get; set; } + + public ObservableCollection WaveInValues { get; } = new(); + + public ObservableCollection WaveValues { get; } = new(); + + public bool LoopWaveIn + { + get => _loopWaveIn; + + set + { + if (SetProperty(ref _loopWaveIn, value, nameof(LoopWaveIn))) + { + OnPropertyChanged(nameof(LoopWaveInText)); + OnPropertyChanged(nameof(LoopWaveInPaint)); + } + } + } + + public string LoopWaveInText => LoopWaveIn ? LanguageSystem.Instance.LoopWaveInText : LanguageSystem.Instance.NotLoopWaveInText; + + public Brush LoopWaveInPaint => Paints.PointPaints[LoopWaveIn ? 1 : 0]; + + public WaveValue? WaveInValue + { + get => _waveInValue; + + set + { + if (SetProperty(ref _waveInValue, value, nameof(WaveInValue)) && Configure.Instance.AudioInput && value.HasValue) + { + SetWaveIn(); + } + } + } + + public WaveValue? WaveValue + { + get => _waveValue; + + set + { + if (SetProperty(ref _waveValue, value, nameof(WaveValue)) && Configure.Instance.AudioInput && value.HasValue) + { + SetWave(); + } + } + } + + public void SetWaveIn() + { + var waveInSystem = WaveInValue?.System; + if (waveInSystem != null) + { + HandlingUISystem.Instance.HandleParallel(() => + { + try + { + _waveIn = new(waveInSystem, false, 60) + { + WaveFormat = _waveFormat + }; + _waveIn.DataAvailable += OnWaveIn; + _waveIn.StartRecording(); + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.WaveInFault, e.Message)); + } + }); + } + } + + public void CloseWaveIn() + { + if (_waveIn != null) + { + using (_waveIn) + { + _waveIn.DataAvailable -= OnWaveIn; + _waveIn.StopRecording(); + } + } + } + + byte[] ZipData(byte[] rawData, int length, out int zippedLength) + { + var zippedData = Array.Empty(); + zippedLength = 0; + + for (var i = 0; i < length; ++i) + { + _zippingData[_zippingPosition++] = rawData[i]; + if (_zippingPosition == _zippingData.Length) + { + zippedData = ArrayPool.Shared.Rent(_zippingPosition); + zippedLength = _zipComputer.Encode(_zippingData, _zippingPosition, zippedData, zippedData.Length); + _zippingPosition = 0; + } + } + + return zippedData; + } + + byte[] NotZipData(byte[] zippedData, int zippedLength, out int rawLength) + { + var rawData = ArrayPool.Shared.Rent(8 * zippedLength); + rawLength = _rawComputer.Decode(zippedData, zippedLength, rawData, rawData.Length); + return rawData; + } + + void OnWaveIn(object sender, WaveInEventArgs e) + { + var rawData = e.Buffer; + var rawDataLength = rawData.Length; + if (rawDataLength > 0) + { + var audioInputValue = 0; + for (var i = 0; i < rawDataLength; ++i) + { + audioInputValue += rawData[i]; + } + AudioInputValue = audioInputValue / rawDataLength; + } + else + { + AudioInputValue = 0; + } + if (AudioInputValue >= Configure.Instance.AudioInputValue) + { + var zippedData = ZipData(e.Buffer, e.BytesRecorded, out var zippedLength); + try + { + if (zippedLength > 0) + { + ViewModels.Instance.SiteContainerValue.AudioInput(zippedData, zippedLength); + if (LoopWaveIn) + { + Handle(LoopWaveInID, zippedData, zippedLength); + } + } + } + finally + { + ArrayPool.Shared.Return(zippedData); + } + } + } + + public void SetWave() + { + var waveSystem = WaveValue?.System; + if (waveSystem != null) + { + HandlingUISystem.Instance.HandleParallel(() => + { + try + { + _wave = new(waveSystem, AudioClientShareMode.Shared, true, 200); + _wave.Init(_m); + _wave.Play(); + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.WaveFault, e.Message)); + } + }); + } + } + + public void CloseWave() + { + if (_wave != null) + { + using (_wave) + { + _wave.Stop(); + } + _wave = null; + } + } + + public void GetWaveInValues() + { + if (Configure.Instance.AudioInput && Configure.Instance.WaveIn) + { + HandlingUISystem.Instance.HandleParallel(() => + { + var waveInValues = new List(); + foreach (var targetSystem in new MMDeviceEnumerator().EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active)) + { + waveInValues.Add(new WaveValue + { + System = targetSystem, + Name = targetSystem.FriendlyName + }); + } + WaveInValues.Clear(); + foreach (var waveInValue in waveInValues) + { + WaveInValues.Add(waveInValue); + } + WaveInValue = WaveInValues.Count > 0 ? WaveInValues.First() : null; + }); + } + } + + public void GetWaveValues() + { + if (Configure.Instance.AudioInput && Configure.Instance.Wave) + { + HandlingUISystem.Instance.HandleParallel(() => + { + var waveValues = new List(); + foreach (var targetSystem in new MMDeviceEnumerator().EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active)) + { + waveValues.Add(new WaveValue + { + System = targetSystem, + Name = targetSystem.FriendlyName + }); + } + WaveValues.Clear(); + foreach (var waveValue in waveValues) + { + WaveValues.Add(waveValue); + } + WaveValue = WaveValues.Count > 0 ? WaveValues.First() as WaveValue? : null; + }); + } + } + + public void Handle(string avatarID, byte[] zippedData, int zippedLength) + { + if (Configure.Instance.AudioInput && Configure.Instance.Wave) + { + if (_wave != null) + { + AudioSystem.Instance.LastHandledAudioInputMillis = Environment.TickCount64; + var rawData = NotZipData(zippedData, zippedLength, out var rawLength); + try + { + if (!_waveData.TryGetValue(avatarID, out var waveData)) + { + waveData = new(_waveFormat) + { + DiscardOnBufferOverflow = true + }; + _m.AddInputStream(new Wave16ToFloatProvider(waveData)); + CloseWave(); + SetWave(); + _waveData[avatarID] = waveData; + } + waveData.AddSamples(rawData, 0, rawLength); + } + finally + { + ArrayPool.Shared.Return(rawData); + } + } + } + } + + public void Dispose() + { + CloseWave(); + CloseWaveIn(); + } + } +} diff --git a/Qwilight/Qwilight/System/AudioSystem/AudioHandler.cs b/Qwilight/Qwilight/System/AudioSystem/AudioHandler.cs new file mode 100644 index 0000000..5afc77e --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/AudioHandler.cs @@ -0,0 +1,6 @@ +namespace Qwilight +{ + public sealed class AudioHandler : IAudioHandler + { + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioSystem/AudioHandlerItem.cs b/Qwilight/Qwilight/System/AudioSystem/AudioHandlerItem.cs new file mode 100644 index 0000000..c305dcf --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/AudioHandlerItem.cs @@ -0,0 +1,17 @@ +using FMOD; + +namespace Qwilight +{ + public sealed class AudioHandlerItem + { + public Channel Channel { get; set; } + + public uint? LevyingPosition { get; set; } + + public uint Position { get; set; } + + public uint? Length { get; set; } + + public ulong AudioStandardUnit { get; set; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioSystem/AudioItem.cs b/Qwilight/Qwilight/System/AudioSystem/AudioItem.cs new file mode 100644 index 0000000..608236e --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/AudioItem.cs @@ -0,0 +1,19 @@ +using FMOD; + +namespace Qwilight +{ + public struct AudioItem : IDisposable + { + public nint System { get; set; } + + public Sound AudioData { get; set; } + + public string BMSID { get; set; } + + public float AudioVolume { get; set; } + + public uint Length { get; set; } + + public void Dispose() => AudioData.release(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioSystem/AudioNote.cs b/Qwilight/Qwilight/System/AudioSystem/AudioNote.cs new file mode 100644 index 0000000..43316e6 --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/AudioNote.cs @@ -0,0 +1,13 @@ +namespace Qwilight +{ + public struct AudioNote + { + public AudioItem? AudioItem { get; set; } + + public uint? Length { get; set; } + + public uint AudioLevyingPosition { get; set; } + + public int Salt { get; set; } + } +} diff --git a/Qwilight/Qwilight/System/AudioSystem/AudioSystem.cs b/Qwilight/Qwilight/System/AudioSystem/AudioSystem.cs new file mode 100644 index 0000000..f4f18d8 --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/AudioSystem.cs @@ -0,0 +1,1360 @@ +using FMOD; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.IO; +using System.Runtime.InteropServices; + +namespace Qwilight +{ + public class AudioSystem : Model + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(AudioSystem)); + + static readonly Dictionary _audioConfigureValues = new() + { + { + "Beats Flex", + new AudioConfigure + { + AudioWait = -173.0, + HandleInputAudio = false + } + }, + { + "Buds2 Pro", + new AudioConfigure + { + AudioWait = -250.0, + HandleInputAudio = false + } + }, + { + "Buds2 Stereo", + new AudioConfigure + { + AudioWait = -250.0, + HandleInputAudio = false + } + }, + { + "direm W1", + new AudioConfigure + { + AudioWait = -48.0, + HandleInputAudio = false + } + }, + { + "Galaxy Buds Pro", + new AudioConfigure + { + AudioWait = -337.0, + HandleInputAudio = false + } + }, + { + "MOMENTUM 4", + new AudioConfigure + { + AudioWait = -249.0, + HandleInputAudio = false + } + }, + { + "Razer Hammerhead TWS (2nd Gen)", + new AudioConfigure + { + AudioWait = -275.0, + HandleInputAudio = false + } + }, + { + "Razer Hammerhead TWS Pro", + new AudioConfigure + { + AudioWait = -259.0, + HandleInputAudio = false + } + }, + { + "WF-1000XM5", + new AudioConfigure + { + AudioWait = -216.0, + HandleInputAudio = false + } + }, + { + "WH-1000XM5", + new AudioConfigure + { + AudioWait = -216.0, + HandleInputAudio = false + } + } + }; + + public static readonly AudioSystem Instance = QwilightComponent.GetBuiltInData(nameof(AudioSystem)); + + const int Channel = 4093; + const MODE LoadingAudioModes = MODE.DEFAULT | MODE._2D | MODE._3D_WORLDRELATIVE | MODE._3D_INVERSEROLLOFF | MODE.OPENMEMORY | MODE.ACCURATETIME | MODE.MPEGSEARCH | MODE.IGNORETAGS | MODE.LOWMEM; + const MODE LoadingImmediatelyAudioModes = LoadingAudioModes | MODE.LOOP_NORMAL; + + public const int MainAudio = 0; + public const int InputAudio = 1; + public const int SEAudio = 2; + public const int TotalAudio = 3; + + readonly ReaderWriterLockSlim _audioCSX = new(); + readonly SYSTEM_CALLBACK _onModified; + readonly float[] _audioVolumes = new float[4]; + readonly ChannelGroup[] _audioGroups = new ChannelGroup[3]; + readonly ConcurrentDictionary> _audioMap = new(); + readonly ConcurrentDictionary> _audioHandlerMap = new(); + readonly DSP[] _audioVisualizerComputers = new DSP[2]; + readonly DSP[] _equalizerComputers = new DSP[2]; + readonly DSP[] _tubeComputers = new DSP[2]; + readonly DSP[] _valueSFXComputers = new DSP[2]; + readonly DSP[] _flangeComputers = new DSP[2]; + readonly DSP[] _averagerComputers = new DSP[2]; + readonly DSP[] _audioMultiplierAtoneComputers = new DSP[2]; + readonly double[][] _audioVisualizerValue = new double[2][]; + FMOD.System _targetSystem; + int _rate; + Timer _audioSystemHandler; + bool _isAvailable; + float _audioInputVolume = 1F; + AudioValue? _audioValue; + + public AudioItem? BanalAudio { get; set; } + + public void LoadBanalAudio() + { + BanalAudio?.Dispose(); + try + { + var filePath = Configure.Instance.BanalAudioFilePath; + if (File.Exists(filePath)) + { + BanalAudio = Load(filePath, null, 1F); + } + else + { + BanalAudio = null; + } + } + catch + { + BanalAudio = null; + } + } + + public AudioItem? DefaultAudio { get; set; } + + public void LoadDefaultAudio() + { + DefaultAudio?.Dispose(); + try + { + var filePath = Configure.Instance.DefaultAudioFilePath; + if (File.Exists(filePath)) + { + DefaultAudio = Load(filePath, null, 1F, null, true); + } + else + { + DefaultAudio = null; + } + } + catch + { + DefaultAudio = null; + } + } + + public Dictionary PostableItemAudioMap { get; } = new(); + + public AudioItem PostableItemAudio { get; set; } + + public AudioItem PostedItemAudio { get; set; } + + public long LastHandledAudioInputMillis { get; set; } + + public string AudioDate { get; set; } + + public string AudioDateHTML { get; set; } + + public ObservableCollection AudioValues { get; } = new(); + + public int AudioItemCount => _audioMap.Values.Sum(audioItems => audioItems.Count); + + public int AudioHandlerItemCount => _audioHandlerMap.Values.Sum(audioHandlerItems => audioHandlerItems.Count); + + public AudioValue? AudioValue + { + get => _audioValue; + + set + { + if (SetProperty(ref _audioValue, value, nameof(AudioValue)) && value.HasValue) + { + var audioValue = value.Value; + var audioValueID = audioValue.ID; + _targetSystem.setDriver(audioValueID); + switch (Configure.Instance.AudioVariety) + { + case OUTPUTTYPE.WASAPI: + Configure.Instance.LastWASAPIAudioValueID = audioValueID; + break; + case OUTPUTTYPE.ASIO: + Configure.Instance.LastASIOAudioValueID = audioValueID; + break; + } + var audioValueName = audioValue.Name; + if (Configure.Instance.AudioConfigureValues.TryGetValue(audioValueName, out var audioConfigureValue)) + { + Configure.Instance.BanalAudioWait = audioConfigureValue.AudioWait; + Configure.Instance.HandleInputAudio = audioConfigureValue.HandleInputAudio; + } + else + { + Configure.Instance.AudioConfigureValues[audioValueName] = _audioConfigureValues.FirstOrDefault(audioConfigureValue => audioValueName.Contains(audioConfigureValue.Key)).Value ?? new AudioConfigure + { + HandleInputAudio = true + }; + } + } + } + } + + public AudioSystem() + { + _onModified = (system, type, commanddata1, commanddata2, userdata) => + { + _targetSystem.getNumDrivers(out var audioValueCount); + var audioValues = Enumerable.Range(0, audioValueCount).Select(i => + { + _targetSystem.getDriverInfo(i, out var audioValueName, 128, out _, out _, out _, out _); + return new AudioValue + { + ID = i, + Name = audioValueName + }; + }).ToArray(); + HandlingUISystem.Instance.HandleParallel(() => + { + AudioValues.Clear(); + foreach (var audioValue in audioValues) + { + AudioValues.Add(audioValue); + } + var lastAudioValueID = Configure.Instance.AudioVariety switch + { + OUTPUTTYPE.WASAPI => Configure.Instance.LastWASAPIAudioValueID, + OUTPUTTYPE.ASIO => Configure.Instance.LastASIOAudioValueID, + _ => default + }; + AudioValue = lastAudioValueID < AudioValues.Count ? AudioValues[lastAudioValueID] : null; + }); + return RESULT.OK; + }; + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + _audioVisualizerValue[audioVariety] = new double[256]; + } + } + + public virtual void Init() + { + try + { + _audioCSX.EnterWriteLock(); + if (!_isAvailable) + { + Factory.System_Create(out _targetSystem); + _targetSystem.getVersion(out var audioDate); + AudioDate = $"v{(audioDate >> 16)}.{((audioDate >> 8) & 255).ToString("00")}.{Convert.ToString(audioDate & 255, 16)}"; + AudioDateHTML = $"https://fmod.com/resources/documentation-api?version={(audioDate >> 16)}.{((audioDate >> 8) & 255)}&page=welcome-revision-history.html"; + _targetSystem.setSoftwareChannels(Channel); + _targetSystem.getSoftwareFormat(out var rate, out _, out _); + _rate = (int)(rate / 1000.0); + _targetSystem.setDSPBufferSize(Configure.Instance.AudioDataLength, 4); + _targetSystem.init(Channel, INITFLAGS.NORMAL, nint.Zero); + + for (var audioVariety = SEAudio; audioVariety >= MainAudio; --audioVariety) + { + _targetSystem.createChannelGroup(null, out _audioGroups[audioVariety]); + _audioGroups[audioVariety].setVolumeRamp(false); + } + + _targetSystem.setCallback(_onModified, SYSTEM_CALLBACK_TYPE.DEVICELISTCHANGED | SYSTEM_CALLBACK_TYPE.DEVICELOST); + _isAvailable = true; + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + + var targetAudioVisualizerValues = new double[2][]; + var targetAudioHeights = new double[2][]; + float[][] audioVisualizerItems = null; + var lastLength = 0; + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + targetAudioVisualizerValues[audioVariety] = new double[256]; + targetAudioHeights[audioVariety] = new double[256]; + } + _audioSystemHandler = new(state => + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + if (Configure.Instance.AudioVisualizer) + { + var audioVisualizerCount = Configure.Instance.AudioVisualizerCount; + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + Array.Clear(targetAudioHeights[audioVariety], 0, audioVisualizerCount); + if (_audioGroups[audioVariety].getNumChannels(out var available) == RESULT.OK && available > 0) + { + if (_audioVisualizerComputers[audioVariety].getParameterData((int)DSP_FFT.SPECTRUMDATA, out var data, out _) == RESULT.OK) + { + var dataFFT = Marshal.PtrToStructure(data); + if (audioVisualizerItems == null || audioVisualizerItems.GetLength(0) != dataFFT.numchannels || lastLength != dataFFT.length) + { + audioVisualizerItems = new float[dataFFT.numchannels][]; + lastLength = dataFFT.length; + for (var i = audioVisualizerItems.Length - 1; i >= 0; --i) + { + audioVisualizerItems[i] = new float[lastLength]; + } + } + dataFFT.getSpectrum(ref audioVisualizerItems); + if (audioVisualizerItems.Length > 0) + { + foreach (var audioVisualizerItem in audioVisualizerItems) + { + for (var j = audioVisualizerItem.Length - 1; j >= 0; --j) + { + var m = (int)(j / ((double)audioVisualizerItem.Length / audioVisualizerCount)); + targetAudioHeights[audioVariety][m] += audioVisualizerItem[m]; + } + } + for (var i = audioVisualizerCount - 1; i >= 0; --i) + { + targetAudioHeights[audioVariety][i] = Math.Clamp(targetAudioHeights[audioVariety][i], 0.0, 1.0); + } + targetAudioVisualizerValues[audioVariety] = targetAudioHeights[audioVariety]; + } + } + } + Array.Copy(targetAudioHeights[audioVariety], 0, targetAudioVisualizerValues[audioVariety], 0, audioVisualizerCount); + for (var i = audioVisualizerCount - 1; i >= 0; --i) + { + _audioVisualizerValue[audioVariety][i] += Utility.GetMove(targetAudioVisualizerValues[audioVariety][i], _audioVisualizerValue[audioVariety][i], 1000 / 60); + } + } + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + + _audioInputVolume += Utility.GetMove(LastHandledAudioInputMillis + QwilightComponent.StandardWaitMillis >= Environment.TickCount64 ? (float)(Configure.Instance.WaveFadeVolume / 100.0) : 1F, _audioInputVolume); + var totalAudioVolume = _audioVolumes[TotalAudio] * _audioInputVolume * (!Configure.Instance.LostPointAudio && !ViewModels.Instance.MainValue.HasPoint ? 0F : 1F); + + for (var audioVariety = SEAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + var targetAudioVolume = (float)(1 - Math.Sqrt(1 - Math.Pow(totalAudioVolume * _audioVolumes[audioVariety], 2))); + if (_audioGroups[audioVariety].getVolume(out var audioVolume) == RESULT.OK && audioVolume != targetAudioVolume) + { + _audioGroups[audioVariety].setVolume(targetAudioVolume); + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.update(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + }, null, TimeSpan.Zero, QwilightComponent.StandardFrametime); + + for (var i = PostableItem.Values.Length - 1; i >= 0; --i) + { + var postableItem = PostableItem.Values[i]; + PostableItemAudioMap.GetValueOrDefault(postableItem).Dispose(); + var audioFilePath = Utility.GetAvailable(Path.Combine(QwilightComponent.AssetsEntryPath, "Audio", "Postable Item", postableItem.VarietyValue.ToString()), Utility.AvailableFlag.Audio); + if (File.Exists(audioFilePath)) + { + PostableItemAudioMap[postableItem] = Load(audioFilePath, null, 1F); + } + } + PostableItemAudio = Load(Utility.GetAvailable(Path.Combine(QwilightComponent.AssetsEntryPath, "Audio", "Postable Item", "Postable"), Utility.AvailableFlag.Audio), null, 1F); + PostedItemAudio = Load(Utility.GetAvailable(Path.Combine(QwilightComponent.AssetsEntryPath, "Audio", "Postable Item", "Posted"), Utility.AvailableFlag.Audio), null, 1F); + + SetAudioVariety(Configure.Instance.AudioVariety); + SetVolume(MainAudio, (float)Configure.Instance.MainAudioVolume); + SetVolume(InputAudio, (float)Configure.Instance.InputAudioVolume); + SetVolume(SEAudio, (float)Configure.Instance.SEAudioVolume); + SetVolume(TotalAudio, (float)Configure.Instance.TotalAudioVolume); + + if (Configure.Instance.AudioVisualizer) + { + SetAudioVisualizer(true); + } + if (Configure.Instance.Equalizer) + { + SetEqualizer(true); + } + if (Configure.Instance.Tube) + { + SetTube(true); + } + if (Configure.Instance.SFX) + { + SetSFX(true); + } + if (Configure.Instance.Flange) + { + SetFlange(true); + } + if (Configure.Instance.Averager) + { + SetAverager(true); + } + } + + public void SetAudioVariety(OUTPUTTYPE audioValueVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.setOutput(audioValueVariety); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _onModified(_targetSystem.handle, SYSTEM_CALLBACK_TYPE.DEVICELISTCHANGED, nint.Zero, nint.Zero, nint.Zero); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + + public void SetVolume(int audioVariety, float audioVolume) => _audioVolumes[audioVariety] = audioVolume; + + public double GetAudioVisualizerValue(int audioVariety, int audioPosition) => _audioVisualizerValue[audioVariety][audioPosition]; + + public void SetAudioMultiplierAtone(bool isAudioMultiplierAtoneSet, double audioMultiplier) + { + if (isAudioMultiplierAtoneSet) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + _targetSystem.createDSPByType(DSP_TYPE.PITCHSHIFT, out _audioMultiplierAtoneComputers[audioVariety]); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _audioMultiplierAtoneComputers[audioVariety]); + _audioMultiplierAtoneComputers[audioVariety].setParameterFloat((int)DSP_PITCHSHIFT.PITCH, (float)(1 / audioMultiplier)); + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_audioMultiplierAtoneComputers[audioVariety]); + _audioMultiplierAtoneComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public int GetHandlingAudioCount() + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.getChannelsPlaying(out _, out var handlingAudioCount); + return handlingAudioCount; + } + return default; + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + + public float GetAudioUnitStatus() + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.getCPUUsage(out var audioUnitStatus); + return audioUnitStatus.dsp; + } + return default; + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + + public void SetEqualizer(bool isEqualizerSet) + { + if (isEqualizerSet) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.createDSPByType(DSP_TYPE.MULTIBAND_EQ, out _equalizerComputers[audioVariety]); + _equalizerComputers[audioVariety].setParameterInt((int)DSP_MULTIBAND_EQ.A_FILTER, (int)DSP_MULTIBAND_EQ_FILTER_TYPE.PEAKING); + _equalizerComputers[audioVariety].setParameterInt((int)DSP_MULTIBAND_EQ.B_FILTER, (int)DSP_MULTIBAND_EQ_FILTER_TYPE.PEAKING); + _equalizerComputers[audioVariety].setParameterInt((int)DSP_MULTIBAND_EQ.C_FILTER, (int)DSP_MULTIBAND_EQ_FILTER_TYPE.PEAKING); + _equalizerComputers[audioVariety].setParameterInt((int)DSP_MULTIBAND_EQ.D_FILTER, (int)DSP_MULTIBAND_EQ_FILTER_TYPE.PEAKING); + _equalizerComputers[audioVariety].setParameterInt((int)DSP_MULTIBAND_EQ.E_FILTER, (int)DSP_MULTIBAND_EQ_FILTER_TYPE.PEAKING); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _equalizerComputers[audioVariety]); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + SetEqualizerHz(0, (float)Configure.Instance.EqualizerHz0); + SetEqualizerHz(1, (float)Configure.Instance.EqualizerHz1); + SetEqualizerHz(2, (float)Configure.Instance.EqualizerHz2); + SetEqualizerHz(3, (float)Configure.Instance.EqualizerHz3); + SetEqualizerHz(4, (float)Configure.Instance.EqualizerHz4); + SetEqualizer(0, (float)Configure.Instance.Equalizer0); + SetEqualizer(1, (float)Configure.Instance.Equalizer1); + SetEqualizer(2, (float)Configure.Instance.Equalizer2); + SetEqualizer(3, (float)Configure.Instance.Equalizer3); + SetEqualizer(4, (float)Configure.Instance.Equalizer4); + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_equalizerComputers[audioVariety]); + _equalizerComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void SetEqualizerHz(int equalizerHzPosition, float equalizerHzValue) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + switch (equalizerHzPosition) + { + case 0: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.A_FREQUENCY, equalizerHzValue); + break; + case 1: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.B_FREQUENCY, equalizerHzValue); + break; + case 2: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.C_FREQUENCY, equalizerHzValue); + break; + case 3: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.D_FREQUENCY, equalizerHzValue); + break; + case 4: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.E_FREQUENCY, equalizerHzValue); + break; + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + + public void SetEqualizer(int equalizerPosition, float equalizerValue) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + switch (equalizerPosition) + { + case 0: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.A_GAIN, equalizerValue); + break; + case 1: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.B_GAIN, equalizerValue); + break; + case 2: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.C_GAIN, equalizerValue); + break; + case 3: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.D_GAIN, equalizerValue); + break; + case 4: + _equalizerComputers[audioVariety].setParameterFloat((int)DSP_MULTIBAND_EQ.E_GAIN, equalizerValue); + break; + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + + public void SetTube(bool isTubeSet) + { + if (isTubeSet) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.createDSPByType(DSP_TYPE.COMPRESSOR, out _tubeComputers[audioVariety]); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _tubeComputers[audioVariety]); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_tubeComputers[audioVariety]); + _tubeComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void SetAudioVisualizer(bool isAudioVisualizerSet) + { + if (isAudioVisualizerSet) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.createDSPByType(DSP_TYPE.FFT, out _audioVisualizerComputers[audioVariety]); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _audioVisualizerComputers[audioVariety]); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_audioVisualizerComputers[audioVariety]); + _audioVisualizerComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void SetSFX(bool isSFX) + { + if (isSFX) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.createDSPByType(DSP_TYPE.SFXREVERB, out _valueSFXComputers[audioVariety]); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _valueSFXComputers[audioVariety]); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_valueSFXComputers[audioVariety]); + _valueSFXComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void SetFlange(bool isFlange) + { + if (isFlange) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.createDSPByType(DSP_TYPE.FLANGE, out _flangeComputers[audioVariety]); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _flangeComputers[audioVariety]); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_flangeComputers[audioVariety]); + _flangeComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void SetAverager(bool isAverager) + { + if (isAverager) + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _targetSystem.createDSPByType(DSP_TYPE.NORMALIZE, out _averagerComputers[audioVariety]); + _audioGroups[audioVariety].addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, _averagerComputers[audioVariety]); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + else + { + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioGroups[audioVariety].removeDSP(_averagerComputers[audioVariety]); + _averagerComputers[audioVariety].release(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public AudioItem Load(string audioFilePath, IAudioContainer audioContainer, float audioVolume, string bmsID = null, bool isLooping = false) + { + using var rms = PoolSystem.Instance.GetDataFlow(File.ReadAllBytes(audioFilePath)); + return Load(rms, audioContainer, audioVolume, bmsID, isLooping); + } + + public AudioItem Load(Stream s, IAudioContainer audioContainer, float audioVolume, string bmsID = null, bool isLooping = false) + { + var hash = Utility.GetID128s(s); + var audioItem = new AudioItem(); + if (audioContainer != null && _audioMap.TryGetValue(audioContainer, out var audioItems) && audioItems.TryGetValue(hash, out audioItem)) + { + return audioItem; + } + s.Position = 0; + var audioInfo = new CREATESOUNDEXINFO + { + length = (uint)s.Length, + cbsize = Marshal.SizeOf() + }; + var ms = s as MemoryStream; + using var rms = ms == null ? PoolSystem.Instance.GetDataFlow((int)audioInfo.length) : null; + if (ms == null) + { + s.CopyTo(rms); + ms = rms; + } + try + { + _audioCSX.EnterReadLock(); + if (_isAvailable) + { + if (_targetSystem.createSound(ms.GetBuffer(), LoadingAudioModes | (isLooping ? MODE.LOOP_NORMAL : MODE.LOOP_OFF), ref audioInfo, out var audioData) == RESULT.OK) + { + audioItem.BMSID = bmsID; + audioItem.System = _targetSystem.handle; + audioItem.AudioData = audioData; + audioItem.AudioVolume = audioVolume; + } + } + } + finally + { + _audioCSX.ExitReadLock(); + } + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioItem.AudioData.getLength(out var audioLength, TIMEUNIT.MS); + audioItem.Length = audioLength; + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + if (audioContainer != null) + { + _audioMap.AddOrUpdate(audioContainer, (audioContainer, audioItem) => new(new[] { KeyValuePair.Create(hash, audioItem) }), (audioContainer, audioItems, audioItem) => + { + audioItems[hash] = audioItem; + return audioItems; + }, audioItem); + } + return audioItem; + } + + public void Stop(IAudioHandler audioHandler) + { + if (_audioHandlerMap.TryRemove(audioHandler, out var audioHandlerItems)) + { + foreach (var audioHandlerItem in audioHandlerItems) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioHandlerItem.Channel.stop(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void Stop(Channel audioChannel) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioChannel.stop(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + + public void Fade(PausableAudioHandler pausableAudioHandler, double fadeMillis) + { + if (_audioHandlerMap.TryRemove(pausableAudioHandler, out var audioHandlerItems)) + { + foreach (var audioHandlerItem in audioHandlerItems) + { + var audioChannel = audioHandlerItem.Channel; + audioChannel.getDSPClock(out _, out var audioStandardUnit); + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioChannel.getPosition(out var audioPosition, TIMEUNIT.MS); + pausableAudioHandler.SetAudioPosition((uint)(audioPosition + fadeMillis)); + audioChannel.addFadePoint(audioStandardUnit, 1F); + audioChannel.addFadePoint(audioStandardUnit + (ulong)(_rate * fadeMillis), 0F); + audioChannel.setDelay(0UL, audioStandardUnit + (ulong)(_rate * fadeMillis)); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + + public void Close(IAudioContainer audioContainer, IAudioHandler audioHandler = null) + { + if (_audioMap.TryRemove(audioContainer, out var audioItems)) + { + foreach (var audioItem in audioItems.Values) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioItem.Dispose(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + if (audioHandler != null) + { + _audioHandlerMap.TryRemove(audioHandler, out var audioHandlerItems); + } + } + + public void Migrate(IAudioContainer src, IAudioContainer target) + { + if (_audioMap.TryRemove(src, out var audioItems)) + { + _audioMap[target] = audioItems; + } + } + + public void Pause(IAudioHandler audioHandler, bool isPaused) + { + if (_audioHandlerMap.TryGetValue(audioHandler, out var audioHandlerItems)) + { + if (isPaused) + { + foreach (var audioHandlerItem in audioHandlerItems) + { + var audioChannel = audioHandlerItem.Channel; + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioChannel.isPlaying(out var isHandling); + if (isHandling) + { + audioChannel.getPosition(out var audioPosition, TIMEUNIT.MS); + audioChannel.setPaused(true); + if (audioHandlerItem.LevyingPosition.HasValue) + { + audioHandlerItem.Position = audioPosition - audioHandlerItem.LevyingPosition.Value; + } + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + else + { + foreach (var audioHandlerItem in audioHandlerItems) + { + var audioChannel = audioHandlerItem.Channel; + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + if (audioHandlerItem.Length.HasValue) + { + audioChannel.setDelay(0UL, audioHandlerItem.AudioStandardUnit + (ulong)(_rate * (audioHandlerItem.Length.Value - audioHandlerItem.Position))); + } + audioChannel.setPaused(false); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + } + + public void SetAudioMultiplier(IAudioHandler audioHandler, double audioMultiplier) + { + if (_audioHandlerMap.TryGetValue(audioHandler, out var audioHandlerItems)) + { + foreach (var audioHandlerItem in audioHandlerItems) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + audioHandlerItem.Channel.setPitch((float)audioMultiplier); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _audioMultiplierAtoneComputers[audioVariety].setParameterFloat((int)DSP_PITCHSHIFT.PITCH, (float)(1 / audioMultiplier)); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + + public Channel Handle(AudioNote? audioNote, int audioVariety, double audioMultiplier = 1.0, bool isCounterWave = false, IAudioHandler audioHandler = null, double fadeInLength = 0.0, byte inputPower = byte.MaxValue) + { + if (audioNote.HasValue) + { + var audioNoteValue = audioNote.Value; + var audioItem = audioNoteValue.AudioItem; + if (audioItem.HasValue) + { + var audioItemValue = audioItem.Value; + var audioLevyingPosition = audioNoteValue.AudioLevyingPosition; + if (audioItemValue.Length > audioLevyingPosition) + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + if (audioItemValue.System == _targetSystem.handle) + { + _targetSystem.playSound(audioItemValue.AudioData, _audioGroups[audioVariety], false, out var audioChannel); + audioChannel.getDSPClock(out _, out var audioStandardUnit); + var targetVolume = audioItemValue.AudioVolume * inputPower / byte.MaxValue; + if (fadeInLength > 0.0) + { + audioChannel.addFadePoint(audioStandardUnit, 0F); + audioChannel.addFadePoint(audioStandardUnit + (ulong)(_rate * fadeInLength), targetVolume); + } + else + { + audioChannel.setVolume(targetVolume); + } + if (audioMultiplier != 1.0) + { + audioChannel.setPitch((float)audioMultiplier); + } + if (isCounterWave) + { + audioChannel.setPosition(audioItemValue.Length - audioLevyingPosition - 1, TIMEUNIT.MS); + audioChannel.getFrequency(out var audioWave); + audioChannel.setFrequency((float)-audioWave); + } + else + { + audioChannel.setPosition(audioLevyingPosition, TIMEUNIT.MS); + } + var audioLength = audioNoteValue.Length; + if (audioLength.HasValue) + { + audioChannel.getDSPClock(out _, out audioStandardUnit); + audioChannel.setDelay(0UL, audioStandardUnit + (ulong)(_rate * audioLength.Value)); + } + if (audioHandler != null) + { + var audioHandlerItem = new AudioHandlerItem + { + Channel = audioChannel, + LevyingPosition = audioLevyingPosition, + Length = audioLength, + AudioStandardUnit = audioStandardUnit + }; + _audioHandlerMap.AddOrUpdate(audioHandler, (audioHandler, audioHandlerItem) => new() + { + audioHandlerItem + }, (audioHandler, audioHandlerItems, audioHandlerItem) => + { + audioHandlerItems.Add(audioHandlerItem); + return audioHandlerItems; + }, audioHandlerItem); + } + return audioChannel; + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } + } + return default; + } + + public bool HandleImmediately(string audioFilePath, IAudioContainer audioContainer, IAudioHandler audioHandler) + { + if (!string.IsNullOrEmpty(audioFilePath)) + { + var rms = PoolSystem.Instance.GetDataFlow(File.ReadAllBytes(audioFilePath)); + var hash = Utility.GetID128s(rms); + rms.Position = 0; + var audioInfo = new CREATESOUNDEXINFO + { + length = (uint)rms.Length, + cbsize = Marshal.SizeOf() + }; + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + if (_targetSystem.createSound(rms.GetBuffer(), LoadingImmediatelyAudioModes, ref audioInfo, out var audioData) == RESULT.OK && audioData.getLength(out var audioLength, TIMEUNIT.MS) == RESULT.OK) + { + _audioMap.AddOrUpdate(audioContainer, (audioContainer, audioItem) => new(new[] { KeyValuePair.Create(hash, audioItem) }), (audioContainer, audioItems, audioItem) => + { + audioItems[hash] = audioItem; + return audioItems; + }, new AudioItem + { + System = _targetSystem.handle, + AudioData = audioData, + AudioVolume = 1F, + Length = audioLength + }); + _targetSystem.playSound(audioData, _audioGroups[MainAudio], false, out var audioChannel); + audioChannel.getDSPClock(out _, out var audioStandardUnit); + var audioHandlerItem = new AudioHandlerItem + { + Channel = audioChannel, + AudioStandardUnit = audioStandardUnit + }; + _audioHandlerMap.AddOrUpdate(audioHandler, (audioHandler, audioHandlerItem) => new() + { + audioHandlerItem + }, (audioHandler, audioHandlerItems, audioHandlerItem) => + { + audioHandlerItems.Add(audioHandlerItem); + return audioHandlerItems; + }, audioHandlerItem); + return true; + } + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + return false; + } + + public void Dispose() + { + try + { + _audioCSX.EnterWriteLock(); + if (_isAvailable) + { + _isAvailable = false; + foreach (var audioVisualizerComputer in _audioVisualizerComputers) + { + audioVisualizerComputer.release(); + } + for (var audioVariety = InputAudio; audioVariety >= MainAudio; --audioVariety) + { + _audioGroups[audioVariety].removeDSP(_equalizerComputers[audioVariety]); + _equalizerComputers[audioVariety].release(); + _audioGroups[audioVariety].removeDSP(_tubeComputers[audioVariety]); + _tubeComputers[audioVariety].release(); + _audioGroups[audioVariety].removeDSP(_audioMultiplierAtoneComputers[audioVariety]); + _audioMultiplierAtoneComputers[audioVariety].release(); + _audioGroups[audioVariety].removeDSP(_valueSFXComputers[audioVariety]); + _valueSFXComputers[audioVariety].release(); + _audioGroups[audioVariety].removeDSP(_flangeComputers[audioVariety]); + _flangeComputers[audioVariety].release(); + _audioGroups[audioVariety].removeDSP(_averagerComputers[audioVariety]); + _averagerComputers[audioVariety].release(); + } + foreach (var audioContainer in _audioMap.Keys) + { + if (_audioMap.TryRemove(audioContainer, out var audioItems)) + { + foreach (var audioItem in audioItems.Values) + { + audioItem.Dispose(); + } + } + } + _audioHandlerMap.Clear(); + foreach (var audioGroup in _audioGroups) + { + audioGroup.release(); + } + _audioSystemHandler.Dispose(); + _targetSystem.release(); + _targetSystem.close(); + } + } + finally + { + _audioCSX.ExitWriteLock(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioSystem/IAudioContainer.cs b/Qwilight/Qwilight/System/AudioSystem/IAudioContainer.cs new file mode 100644 index 0000000..401305a --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/IAudioContainer.cs @@ -0,0 +1,6 @@ +namespace Qwilight +{ + public interface IAudioContainer + { + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioSystem/IAudioHandler.cs b/Qwilight/Qwilight/System/AudioSystem/IAudioHandler.cs new file mode 100644 index 0000000..29d6f3a --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/IAudioHandler.cs @@ -0,0 +1,6 @@ +namespace Qwilight +{ + public interface IAudioHandler + { + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AudioSystem/PausableAudioHandler.cs b/Qwilight/Qwilight/System/AudioSystem/PausableAudioHandler.cs new file mode 100644 index 0000000..3516334 --- /dev/null +++ b/Qwilight/Qwilight/System/AudioSystem/PausableAudioHandler.cs @@ -0,0 +1,38 @@ +using Qwilight.ViewModel; +using System.Collections.Concurrent; + +namespace Qwilight +{ + public sealed class PausableAudioHandler : IAudioHandler + { + readonly ConcurrentDictionary _audioPositions = new(); + bool _isPausing; + + public string AudioFileName { get; set; } + + public bool IsPausing + { + get => _isPausing; + + set + { + _isPausing = value; + AudioSystem.Instance.Pause(this, value); + ViewModels.Instance.MainValue.NotifyIsPausing(); + } + } + + public void SetAudioPosition(uint audioPosition) + { + if (!string.IsNullOrEmpty(AudioFileName)) + { + _audioPositions[AudioFileName] = audioPosition; + } + } + + public uint GetAudioPosition() + { + return _audioPositions.GetValueOrDefault(AudioFileName, 0U); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/AvatarDrawingSystem.cs b/Qwilight/Qwilight/System/AvatarDrawingSystem.cs new file mode 100644 index 0000000..cfb3a40 --- /dev/null +++ b/Qwilight/Qwilight/System/AvatarDrawingSystem.cs @@ -0,0 +1,86 @@ +using System.Collections.Concurrent; +using System.Net; + +namespace Qwilight +{ + public sealed class AvatarDrawingSystem + { + public static readonly AvatarDrawingSystem Instance = new(); + + readonly ConcurrentDictionary _avatarDrawings = new(); + readonly ConcurrentDictionary _avatarCSXs = new(); + readonly ConcurrentQueue _pendingAvatarDrawings = new(); + + public void WipeAvatarDrawing(string avatarID) + { + if (_avatarDrawings.TryRemove(avatarID, out var avatarDrawing)) + { + _pendingAvatarDrawings.Enqueue(avatarDrawing); + } + } + + public void WipeAvatarDrawings() + { + foreach (var avatarID in _avatarDrawings.Keys) + { + WipeAvatarDrawing(avatarID); + } + } + + public void ClosePendingAvatarDrawings() + { + while (_pendingAvatarDrawings.TryDequeue(out var pendingAvatarDrawing)) + { + pendingAvatarDrawing.Dispose(); + } + } + + SemaphoreSlim GetCSX(string avatarID) => new(1); + + public bool CanCallAPI(string avatarID) + { + avatarID ??= string.Empty; + return _avatarCSXs.GetOrAdd(avatarID, GetCSX).CurrentCount > 0; + } + + public async ValueTask GetAvatarDrawing(string avatarID) + { + avatarID ??= string.Empty; + var avatarCSX = _avatarCSXs.GetOrAdd(avatarID, GetCSX); + try + { + await avatarCSX.WaitAsync(); + if (!_avatarDrawings.TryGetValue(avatarID, out var avatarDrawing)) + { + if (string.IsNullOrEmpty(avatarID)) + { + avatarDrawing = new(); + } + else + { + try + { + using var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/drawing?avatarID={WebUtility.UrlEncode(avatarID)}&drawingVariety=0"); + avatarDrawing = new() + { + Drawing = DrawingSystem.Instance.Load(s, null), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(s, null) + }; + } + catch + { + } + } + } + _avatarDrawings[avatarID] = avatarDrawing; + return avatarDrawing; + } + finally + { + avatarCSX.Release(); + } + } + + public HandledDrawingItem? JustGetAvatarDrawing(string avatarID) => !_avatarDrawings.TryGetValue(avatarID ?? string.Empty, out var avatarDrawing) ? null : avatarDrawing; + } +} diff --git a/Qwilight/Qwilight/System/AvatarEdgeSystem.cs b/Qwilight/Qwilight/System/AvatarEdgeSystem.cs new file mode 100644 index 0000000..a79d5fd --- /dev/null +++ b/Qwilight/Qwilight/System/AvatarEdgeSystem.cs @@ -0,0 +1,86 @@ +using System.Collections.Concurrent; +using System.Net; + +namespace Qwilight +{ + public sealed class AvatarEdgeSystem + { + public static readonly AvatarEdgeSystem Instance = new(); + + readonly ConcurrentDictionary _avatarEdges = new(); + readonly ConcurrentDictionary _avatarCSXs = new(); + readonly ConcurrentQueue _pendingAvatarEdges = new(); + + public void WipeAvatarEdge(string avatarID) + { + if (_avatarEdges.TryRemove(avatarID, out var avatarEdge)) + { + _pendingAvatarEdges.Enqueue(avatarEdge); + } + } + + public void WipeAvatarEdges() + { + foreach (var avatarID in _avatarEdges.Keys) + { + WipeAvatarEdge(avatarID); + } + } + + public void ClosePendingAvatarEdges() + { + while (_pendingAvatarEdges.TryDequeue(out var pendingAvatarEdge)) + { + pendingAvatarEdge.Dispose(); + } + } + + SemaphoreSlim GetCSX(string avatarID) => new(1); + + public bool CanCallAPI(string avatarID) + { + avatarID ??= string.Empty; + return _avatarCSXs.GetOrAdd(avatarID, GetCSX).CurrentCount > 0; + } + + public async ValueTask GetAvatarEdge(string avatarID) + { + avatarID ??= string.Empty; + var avatarCSX = _avatarCSXs.GetOrAdd(avatarID, GetCSX); + try + { + await avatarCSX.WaitAsync(); + if (!_avatarEdges.TryGetValue(avatarID, out var avatarEdge)) + { + if (string.IsNullOrEmpty(avatarID)) + { + avatarEdge = new(); + } + else + { + try + { + using var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/drawing?avatarID={WebUtility.UrlEncode(avatarID)}&drawingVariety=2"); + avatarEdge = new() + { + Drawing = DrawingSystem.Instance.Load(s, null), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(s, null) + }; + } + catch + { + } + } + _avatarEdges[avatarID] = avatarEdge; + } + return avatarEdge; + } + finally + { + avatarCSX.Release(); + } + } + + public HandledDrawingItem? JustGetAvatarEdge(string avatarID) => !_avatarEdges.TryGetValue(avatarID ?? string.Empty, out var avatarEdge) ? null : avatarEdge; + } +} diff --git a/Qwilight/Qwilight/System/AvatarTitleSystem.cs b/Qwilight/Qwilight/System/AvatarTitleSystem.cs new file mode 100644 index 0000000..78e0879 --- /dev/null +++ b/Qwilight/Qwilight/System/AvatarTitleSystem.cs @@ -0,0 +1,66 @@ +using Microsoft.UI; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.Concurrent; +using System.Net; + +namespace Qwilight +{ + public sealed class AvatarTitleSystem + { + public static readonly AvatarTitleSystem Instance = new(); + + static readonly AvatarTitle NotAvatarTitle = new(LanguageSystem.Instance.NotAvatarTitle, Paints.Paint4, Colors.White); + + readonly ConcurrentDictionary _avatarTitles = new(); + readonly ConcurrentDictionary _avatarCSXs = new(); + + public void WipeAvatarTitle(string avatarID) => _avatarTitles.TryRemove(avatarID, out _); + + public void WipeAvatarTitles() => _avatarTitles.Clear(); + + SemaphoreSlim GetCSX(string avatarID) => new(1); + + public bool CanCallAPI(string avatarID) + { + avatarID ??= string.Empty; + return _avatarCSXs.GetOrAdd(avatarID, GetCSX).CurrentCount > 0; + } + + public async ValueTask GetAvatarTitle(string avatarID, bool allowNotAvatarTitle = false) + { + avatarID ??= string.Empty; + var avatarCSX = _avatarCSXs.GetOrAdd(avatarID, GetCSX); + try + { + await avatarCSX.WaitAsync(); + if (!_avatarTitles.TryGetValue(avatarID, out var avatarTitle)) + { + if (string.IsNullOrEmpty(avatarID)) + { + avatarTitle = new(string.Empty, default, default); + } + else + { + try + { + var twilightWwwTitle = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/title?avatarID={WebUtility.UrlEncode(avatarID)}&language={Configure.Instance.Language}"); + avatarTitle = twilightWwwTitle.HasValue ? new AvatarTitle(twilightWwwTitle.Value.title, Utility.GetTitlePaint(twilightWwwTitle.Value.titleColor), Utility.GetTitleColor(twilightWwwTitle.Value.titleColor)) : new AvatarTitle(string.Empty, default, default); + } + catch + { + } + } + _avatarTitles[avatarID] = avatarTitle; + } + return allowNotAvatarTitle && string.IsNullOrEmpty(avatarTitle?.Title) ? NotAvatarTitle : avatarTitle; + } + finally + { + avatarCSX.Release(); + } + } + + public AvatarTitle? JustGetAvatarTitle(string avatarID, bool allowNotAvatarTitle = false) => !_avatarTitles.TryGetValue(avatarID ?? string.Empty, out var avatarTitle) ? null as AvatarTitle? : allowNotAvatarTitle && string.IsNullOrEmpty(avatarTitle?.Title) ? NotAvatarTitle : avatarTitle; + } +} diff --git a/Qwilight/Qwilight/System/BaseUI/BasePaintProperty.cs b/Qwilight/Qwilight/System/BaseUI/BasePaintProperty.cs new file mode 100644 index 0000000..2d0f963 --- /dev/null +++ b/Qwilight/Qwilight/System/BaseUI/BasePaintProperty.cs @@ -0,0 +1,297 @@ +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Text; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using Windows.UI; +using Brush = System.Windows.Media.Brush; +using DrawingContext = System.Windows.Media.DrawingContext; + +namespace Qwilight +{ + public sealed class BasePaintProperty : IDisposable + { + public Brush EtcPaint { get; set; } + + public Color EtcColor { get; set; } + + public CanvasTextFormat Font { get; set; } + + public double DrawingMillis { get; set; } + + public int DrawingFrame { get; set; } + + public Bound PaintBound { get; set; } + + public int Frame { get; set; } + + public double Framerate { get; set; } + + public int Layer { get; set; } + + public HandledDrawingItem?[] HandledDrawingItems { get; set; } + + public MediaHandlerItem MediaHandlerItemValue { get; set; } + + public int DrawingVariety { get; set; } + + public int Mode { get; set; } + + public string Etc { get; set; } + + public void Dispose() + { + Font?.Dispose(); + } + + public void Paint(DrawingContext targetSession, BaseNoteFile noteFile, AutoCompute autoComputer, double millis) + { + if (Mode == 0) + { + var r = PaintBound; + var defaultMediaFaint = (int)(100 * Configure.Instance.BaseUIConfigureValue.DefaultMediaFaint); + if (DrawingVariety < 100) + { + switch (DrawingVariety) + { + case 0: + if (Frame > 0) + { + var framerate = 1000.0 / Framerate; + DrawingMillis += millis; + DrawingFrame = (int)(DrawingMillis / framerate) % Frame; + targetSession.PaintDrawing(ref r, HandledDrawingItems[DrawingFrame]?.DefaultDrawing); + } + break; + case 1: + if (noteFile != null && defaultMediaFaint > 0) + { + targetSession.PushOpacity(defaultMediaFaint / 100.0); + targetSession.DrawRectangle(Paints.Paint0, null, r); + var defaultDrawing = noteFile.NoteDrawing; + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, defaultDrawing.Width, defaultDrawing.Height, PaintBound.Position0, PaintBound.Position1, PaintBound.Length, PaintBound.Height); + targetSession.PaintDrawing(ref r, defaultDrawing); + targetSession.Pop(); + } + break; + case 2: + if (autoComputer != null) + { + autoComputer.PaintDefaultMedia(targetSession, ref r, defaultMediaFaint); + } + break; + case 3: + if (noteFile != null && Framerate > 0.0) + { + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(noteFile.Title, Framerate, EtcPaint, r.Length), PoolSystem.Instance.GetDefaultTextItem(noteFile.Title, Framerate, Paints.Paint0, r.Length), ref r); + } + break; + case 4: + if (noteFile != null && Framerate > 0.0) + { + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(noteFile.Artist, Framerate, EtcPaint, r.Length), PoolSystem.Instance.GetDefaultTextItem(noteFile.Artist, Framerate, Paints.Paint0, r.Length), ref r); + } + break; + case 5: + if (noteFile != null && Framerate > 0.0) + { + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(noteFile.GenreText, Framerate, EtcPaint, r.Length), PoolSystem.Instance.GetDefaultTextItem(noteFile.GenreText, Framerate, Paints.Paint0, r.Length), ref r); + } + break; + case 6: + if (noteFile != null && Framerate > 0.0) + { + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(noteFile.LevelText, Framerate, BaseUI.Instance.LevelPaints[(int)noteFile.LevelValue], r.Length), PoolSystem.Instance.GetDefaultTextItem(noteFile.LevelText, Framerate, Paints.Paint0, r.Length), ref r); + } + break; + case 7: + if (TwilightSystem.Instance.IsSignedIn && Framerate > 0.0) + { + var avatarName = TwilightSystem.Instance.GetAvatarName(); + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(avatarName, Framerate, EtcPaint, r.Length), PoolSystem.Instance.GetDefaultTextItem(avatarName, Framerate, Paints.Paint0, r.Length), ref r); + } + break; + case 10: + Utility.PaintAudioVisualizer(targetSession, ref r, (int)(100 * Configure.Instance.BaseUIConfigureValue.DefaultAudioVisualizerFaint), PaintBound.Position0, PaintBound.Position1, PaintBound.Length, PaintBound.Height); + break; + case 11: + targetSession.DrawVideo(MediaHandlerItemValue?.HandledMediaItem.DefaultMedia, r); + break; + case 12: + if (TwilightSystem.Instance.IsSignedIn && Framerate > 0.0) + { + var avatarID = TwilightSystem.Instance.AvatarID; + var avatarTitle = AvatarTitleSystem.Instance.JustGetAvatarTitle(avatarID); + var hasAvatarTitle = avatarTitle.HasValue; + if (!hasAvatarTitle && AvatarTitleSystem.Instance.CanCallAPI(avatarID)) + { + Task.Run(async () => await AvatarTitleSystem.Instance.GetAvatarTitle(avatarID)); + } + if (hasAvatarTitle) + { + var avatarTitleValue = avatarTitle.Value; + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(avatarTitleValue.Title, Framerate, avatarTitleValue.TitlePaint, r.Length), PoolSystem.Instance.GetDefaultTextItem(avatarTitleValue.Title, Framerate, Paints.Paint0, r.Length), ref r); + } + } + break; + case 13: + if (noteFile != null && Framerate > 0.0) + { + targetSession.PaintVisibleText(PoolSystem.Instance.GetDefaultTextItem(noteFile.WantLevelID, Framerate, EtcPaint, r.Length), PoolSystem.Instance.GetDefaultTextItem(noteFile.WantLevelID, Framerate, Paints.Paint0, r.Length), ref r); + } + break; + } + } + else if (DrawingFrame >= 0) + { + DrawingMillis += millis; + DrawingFrame = (int)(DrawingMillis / (1000.0 / Framerate)); + if (DrawingFrame < Frame) + { + targetSession.PaintDrawing(ref r, HandledDrawingItems[DrawingFrame]?.DefaultDrawing); + } + } + } + } + + public void Paint(CanvasDrawingSession targetSession, double millis, DefaultCompute defaultComputer, DefaultCompute handlingComputer) + { + if (Mode == 1) + { + var r = PaintBound; + if (DrawingVariety < 100) + { + var defaultMediaFaint = (float)Configure.Instance.BaseUIConfigureValue.DefaultMediaFaint; + switch (DrawingVariety) + { + case 0: + if (Frame > 0) + { + var framerate = 1000.0 / Framerate; + DrawingMillis += millis; + DrawingFrame = (int)(DrawingMillis / framerate) % Frame; + targetSession.PaintDrawing(ref r, HandledDrawingItems[DrawingFrame]?.Drawing); + } + break; + case 1: + if (defaultMediaFaint > 0) + { + targetSession.FillRectangle(r, DrawingSystem.Instance.FaintFilledPaints[(int)(100 * defaultMediaFaint)]); + lock (handlingComputer.ContentsCSX) + { + if (handlingComputer.HasContents) + { + targetSession.PaintDrawing(ref r, (handlingComputer.NoteHandledDrawingItem ?? DrawingSystem.Instance.DefaultDrawing).Drawing, defaultMediaFaint); + } + } + } + break; + case 2: + handlingComputer.PaintMedia(targetSession, ref r, defaultMediaFaint); + break; + case 7: + if (Framerate > 0.0) + { + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.AvatarName, Font), ref r, EtcColor); + } + break; + case 8: + var avatarID = defaultComputer.AvatarID; + var avatarDrawing = AvatarDrawingSystem.Instance.JustGetAvatarDrawing(avatarID); + var hasAvatarDrawing = avatarDrawing.HasValue; + if (!hasAvatarDrawing && AvatarDrawingSystem.Instance.CanCallAPI(avatarID)) + { + Task.Run(async () => await AvatarDrawingSystem.Instance.GetAvatarDrawing(avatarID)); + } + if (hasAvatarDrawing) + { + targetSession.PaintDrawing(ref r, avatarDrawing.Value.Drawing); + } + + var avatarEdge = AvatarEdgeSystem.Instance.JustGetAvatarEdge(avatarID); + var hasAvatarEdge = avatarEdge.HasValue; + if (!avatarEdge.HasValue && AvatarEdgeSystem.Instance.CanCallAPI(avatarID)) + { + Task.Run(async () => await AvatarEdgeSystem.Instance.GetAvatarEdge(avatarID)); + } + if (hasAvatarEdge) + { + r.Set(r.Position0 + r.Length * Levels.EdgeXY, r.Position1 + r.Height * Levels.EdgeXY, r.Length * Levels.EdgeMargin, r.Height * Levels.EdgeMargin); + targetSession.PaintDrawing(ref r, avatarEdge.Value.Drawing); + } + break; + case 9: + if (Frame > 0) + { + var framerate = 1000.0 / Framerate; + DrawingMillis += millis; + DrawingFrame = (int)(DrawingMillis / framerate) % Frame; + switch (Etc) + { + case "S+" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.SPlus: + case "S FC" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.S && defaultComputer.IsP: + case "S" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.S && !defaultComputer.IsP: + case "A+ FC" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.APlus && defaultComputer.IsP: + case "A+" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.APlus && !defaultComputer.IsP: + case "A FC" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.A && defaultComputer.IsP: + case "A" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.A && !defaultComputer.IsP: + case "B FC" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.B && defaultComputer.IsP: + case "B" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.B && !defaultComputer.IsP: + case "C FC" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.C && defaultComputer.IsP: + case "C" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.C && !defaultComputer.IsP: + case "D FC" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.D && defaultComputer.IsP: + case "D" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.D && !defaultComputer.IsP: + case "F" when defaultComputer.QuitStatusValue == DefaultCompute.QuitStatus.F: + targetSession.PaintDrawing(ref r, HandledDrawingItems[DrawingFrame]?.Drawing); + break; + } + } + break; + case 10: + Utility.PaintAudioVisualizer(targetSession, ref r, (int)(100 * Configure.Instance.BaseUIConfigureValue.DefaultAudioVisualizerFaint), r.Position0, r.Position1, r.Length, r.Height); + break; + case 11: + var mediaFrame = MediaHandlerItemValue?.MediaFrame; + if (mediaFrame != null) + { + var mediaFrameBound = mediaFrame.Bounds; + var mediaFrameLength = mediaFrameBound.Width; + var mediaFrameHeight = mediaFrameBound.Height; + if (mediaFrameLength * mediaFrameHeight > 0.0) + { + targetSession.PaintDrawing(ref r, mediaFrame); + } + } + break; + case 12: + if (Framerate > 0.0) + { + avatarID = defaultComputer.AvatarID; + var avatarTitle = AvatarTitleSystem.Instance.JustGetAvatarTitle(avatarID); + var hasAvatarTitle = avatarTitle.HasValue; + if (!hasAvatarTitle && AvatarTitleSystem.Instance.CanCallAPI(avatarID)) + { + Task.Run(async () => await AvatarTitleSystem.Instance.GetAvatarTitle(avatarID)); + } + if (hasAvatarTitle) + { + var avatarTitleValue = avatarTitle.Value; + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(avatarTitleValue.Title, Font), ref r, avatarTitleValue.TitleColor); + } + } + break; + } + } + else if (DrawingFrame >= 0) + { + DrawingMillis += millis; + DrawingFrame = (int)(DrawingMillis / (1000.0 / Framerate)); + if (DrawingFrame < Frame) + { + targetSession.PaintDrawing(ref r, HandledDrawingItems[DrawingFrame]?.Drawing); + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/BaseUI/BaseUI.cs b/Qwilight/Qwilight/System/BaseUI/BaseUI.cs new file mode 100644 index 0000000..728d6da --- /dev/null +++ b/Qwilight/Qwilight/System/BaseUI/BaseUI.cs @@ -0,0 +1,2120 @@ +using FMOD; +using Ionic.Zip; +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI; +using MoonSharp.Interpreter; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.IO; +using System.Text; +using System.Windows; +using Windows.UI; +using YamlDotNet.Core; +using YamlDotNet.RepresentationModel; +using Brush = System.Windows.Media.Brush; +using ImageSource = System.Windows.Media.ImageSource; +using Stretch = System.Windows.Media.Stretch; + +namespace Qwilight +{ + public sealed class BaseUI : Model, IAudioContainer, IDrawingContainer, IMediaContainer, IMediaHandler + { + public const int HighestBaseUIConfigure = 16; + public const int HighestPaintPropertyID = 256; + + public static readonly BaseUI Instance = QwilightComponent.GetBuiltInData(nameof(BaseUI)); + + public enum EventItem + { + LevelUp = 100, LevelClear, SignIn, NotSignIn, ModifyEntryItem, ModifyNoteFile, NewTitle, AbilityUp + } + + public static void ZipUIFile(ZipFile zipFile, UIItem value, string entryPath) + { + var yamlFilePath = value.GetYamlFilePath(); + if (File.Exists(yamlFilePath)) + { + zipFile.AddFile(yamlFilePath, Path.Combine(entryPath, Path.GetRelativePath(QwilightComponent.UIEntryPath, Path.GetDirectoryName(yamlFilePath)))); + var ys = new YamlStream(); + using (var sr = File.OpenText(yamlFilePath)) + { + ys.Load(sr); + } + var formatNode = ys.Documents[0].RootNode[new YamlScalarNode("format")]; + var zipFilePath = Path.Combine(QwilightComponent.UIEntryPath, value.UIEntry, Path.ChangeExtension($"@{Utility.GetText(formatNode, "zip")}", "zip")); + if (File.Exists(zipFilePath)) + { + zipFile.AddFile(zipFilePath, Path.Combine(entryPath, Path.GetRelativePath(QwilightComponent.UIEntryPath, Path.GetDirectoryName(zipFilePath)))); + } + var luaFilePath = Path.Combine(QwilightComponent.UIEntryPath, value.UIEntry, Path.ChangeExtension($"@{Utility.GetText(formatNode, "lua")}", "lua")); + if (File.Exists(luaFilePath)) + { + zipFile.AddFile(luaFilePath, Path.Combine(entryPath, Path.GetRelativePath(QwilightComponent.UIEntryPath, Path.GetDirectoryName(luaFilePath)))); + } + } + } + + readonly ConcurrentDictionary _audioItemMap = new(); + readonly ConcurrentDictionary _audioChannelMap = new(); + + public bool HandleAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0) + { + lock (UI.Instance.ContentsCSX) + { + if (!_audioItemMap.TryGetValue(audioFileName, out var audioItem) && defaultFileName != null) + { + _audioItemMap.TryGetValue(defaultFileName, out audioItem); + } + if (audioItem != null) + { + if (QwilightComponent.GetStopLastAudioComputer().IsMatch(audioFileName) && _audioChannelMap.TryGetValue(audioFileName, out var audioChannel)) + { + AudioSystem.Instance.Stop(audioChannel); + } + _audioChannelMap[audioFileName] = AudioSystem.Instance.Handle(new AudioNote + { + AudioLevyingPosition = pausableAudioHandler?.GetAudioPosition() ?? 0U, + AudioItem = audioItem + }, AudioSystem.SEAudio, 1.0, false, pausableAudioHandler, fadeInLength); + return true; + } + return false; + } + } + + public XamlBaseUIConfigure[] XamlBaseUIConfigures { get; set; } = Array.Empty(); + + public string[] LoadedConfigures { get; } = new string[HighestBaseUIConfigure]; + + public string FaultText { get; set; } + + public ObservableCollection UIItems { get; } = new(); + + public double DefaultLength { get; set; } + + public double DefaultHeight { get; set; } + + public HandledDrawingItem? DefaultDrawing { get; set; } + + public HandledDrawingItem?[][] QuitDrawings { get; } = new HandledDrawingItem?[8][]; + + public HandledDrawingItem?[] InputModeDrawings { get; } = new HandledDrawingItem?[17]; + + public ImageSource[] InputModeWindowDrawings { get; } = new ImageSource[17]; + + public ImageSource[] HandledWallDrawings { get; } = new ImageSource[7]; + + public ImageSource[] DefaultEntryDrawings { get; } = new ImageSource[5]; + + public ImageSource[] SaltAutoDrawings { get; } = new ImageSource[2]; + + public ImageSource[] AvatarConfigureDrawings { get; } = new ImageSource[6]; + + public ImageSource[] SiteSituationDrawings { get; } = new ImageSource[3]; + + public ImageSource[] SignInDrawings { get; } = new ImageSource[2]; + + public ImageSource[] SiteCipherDrawings { get; } = new ImageSource[2]; + + public ImageSource[] SiteConfigureDrawings { get; } = new ImageSource[3]; + + public ImageSource[] StopAutoDrawings { get; } = new ImageSource[2]; + + public ImageSource[] SiteMediaDrawings { get; } = new ImageSource[3]; + + public ImageSource[] SiteAudioDrawings { get; } = new ImageSource[3]; + + public ImageSource FileDrawing { get; set; } + + public ImageSource TotalNotesDrawing { get; set; } + + public ImageSource TotalNotesFitDrawing { get; set; } + + public ImageSource TotalNotesNetSiteDrawing { get; set; } + + public HandledDrawingItem? JudgmentStageDrawing { get; set; } + + public ImageSource JudgmentStageNetSiteDrawing { get; set; } + + public HandledDrawingItem? HighestInputCountDrawing { get; set; } + + public ImageSource HighestInputCountFitDrawing { get; set; } + + public ImageSource AverageInputCountFitDrawing { get; set; } + + public ImageSource HighestInputCountNetSiteDrawing { get; set; } + + public HandledDrawingItem? LengthDrawing { get; set; } + + public ImageSource LengthFitDrawing { get; set; } + + public ImageSource LengthNetSiteDrawing { get; set; } + + public HandledDrawingItem? BPMDrawing { get; set; } + + public ImageSource BPM1Drawing { get; set; } + + public ImageSource BPMFitDrawing { get; set; } + + public ImageSource BPMNetSiteDrawing { get; set; } + + public ImageSource BPM1NetSiteDrawing { get; set; } + + public HandledDrawingItem? InputModeDrawing { get; set; } + + public ImageSource FileViewerDrawing { get; set; } + + public ImageSource AssistFileViewerDrawing { get; set; } + + public ImageSource LevelTextValueFitDrawing { get; set; } + + public ImageSource TitleFitDrawing { get; set; } + + public ImageSource ArtistFitDrawing { get; set; } + + public ImageSource ModifiedDateFitDrawing { get; set; } + + public ImageSource HandledCountFitDrawing { get; set; } + + public ImageSource LatestDateFitDrawing { get; set; } + + public ImageSource CommentDrawing { get; set; } + + public ImageSource ConfigureDrawing { get; set; } + + public ImageSource AudioInputDrawing { get; set; } + + public ImageSource SaltDrawing { get; set; } + + public ImageSource DefaultEntryConfigureDrawing { get; set; } + + public DrawingItem? TotalNotesJudgmentDrawing { get; set; } + + public HandledDrawingItem?[] JudgmentDrawings { get; } = new HandledDrawingItem?[6]; + + public HandledDrawingItem?[] NotifyDrawings { get; } = new HandledDrawingItem?[7]; + + public Brush[] JudgmentPaints { get; } = new Brush[6]; + + public ICanvasBrush[][] D2DJudgmentPaints { get; } = new ICanvasBrush[6][]; + + public System.Windows.Media.Color SiteDateColor { get; set; } + + public System.Windows.Media.Color SiteEnterColor { get; set; } + + public System.Windows.Media.Color SiteQuitColor { get; set; } + + public System.Windows.Media.Color SiteHrefColor { get; set; } + + public System.Windows.Media.Color SiteTitleColor { get; set; } + + public System.Windows.Media.Color SiteArtistColor { get; set; } + + public System.Windows.Media.Color SiteGenreColor { get; set; } + + public System.Windows.Media.Color SiteStandColor { get; set; } + + public System.Windows.Media.Color FileColor { get; set; } + + public System.Windows.Media.Color EventNoteNameColor { get; set; } + + public System.Windows.Media.Color TitleColor { get; set; } + + public System.Windows.Media.Color ArtistColor { get; set; } + + public System.Windows.Media.Color FittedTextColor { get; set; } + + public System.Windows.Media.Color GenreColor { get; set; } + + public System.Windows.Media.Color WantLevelIDColor { get; set; } + + public System.Windows.Media.Color JudgmentStageColor { get; set; } + + public System.Windows.Media.Color TotalNotesColor { get; set; } + + public System.Windows.Media.Color HighestInputCountColor { get; set; } + + public System.Windows.Media.Color LengthColor { get; set; } + + public System.Windows.Media.Color BPMColor { get; set; } + + public System.Windows.Media.Color CommentDateColor { get; set; } + + public System.Windows.Media.Color CommentNameColor { get; set; } + + public System.Windows.Media.Color CommentPointColor { get; set; } + + public System.Windows.Media.Color CommentStandColor { get; set; } + + public System.Windows.Media.Color[] LevelColors { get; } = new System.Windows.Media.Color[6]; + + public Brush[] LevelPaints { get; } = new Brush[6]; + + public Color[] D2DLevelColors { get; } = new Color[6]; + + public ICanvasBrush[][] D2DHitPointsPaints { get; } = new ICanvasBrush[8][]; + + public Color[] HitPointsColor { get; } = new Color[8]; + + public Brush[] HitPointsPaints { get; } = new Brush[8]; + + public Color StatusHandlingColor { get; set; } + + public Brush StatusHandlingPaint { get; set; } + + public Color StatusPausedColor { get; set; } + + public Brush StatusPausedPaint { get; set; } + + public Color StatusLoadingNoteFileColor { get; set; } + + public Brush StatusLoadingNoteFilePaint { get; set; } + + public Color StatusLoadingDefaultEntryColor { get; set; } + + public Brush StatusLoadingDefaultEntryPaint { get; set; } + + public System.Windows.Media.Color[] QuitColors { get; } = new System.Windows.Media.Color[7]; + + public Brush[] CommentViewerPaints { get; } = new Brush[7]; + + public Thickness NoteFileMargin { get; set; } + + public Thickness EntryViewTitleMargin { get; set; } + + public object[] SignInPoint { get; set; } + + public object[] ConfigurePoint { get; set; } + + public object[] CommentPoint { get; set; } + + public bool HasCommentPoint { get; set; } + + public object[] StopAutoPoint { get; set; } + + public object[] SaltAutoPoint { get; set; } + + public double[] CommentViewPoint { get; set; } + + public double[] EntryViewPoint { get; set; } + + public double[] InputNoteCountViewPoint { get; set; } + + public object[] AssistViewPoint { get; set; } + + public double HandledWallLength { get; set; } + + public double EntryItemHeight { get; set; } + + public double CommentItemHeight { get; set; } + + public double CommentItemAvatarHeight { get; set; } + + public object[] AutoModePoint { get; set; } + + public object[] NoteSaltModePoint { get; set; } + + public object[] FaintNoteModePoint { get; set; } + + public object[] JudgmentModePoint { get; set; } + + public object[] HitPointsModePoint { get; set; } + + public object[] NoteMobilityModePoint { get; set; } + + public object[] InputFavorModePoint { get; set; } + + public object[] LongNoteModePoint { get; set; } + + public object[] NoteModifyModePoint { get; set; } + + public object[] BPMModePoint { get; set; } + + public object[] WaveModePoint { get; set; } + + public object[] SetNoteModePoint { get; set; } + + public object[] LowestJudgmentConditionModePoint { get; set; } + + public object[] FilePoint { get; set; } + + public object[] FileContentsPoint { get; set; } + + public object[] FileViewerPoint { get; set; } + + public object[] AssistFileViewerPoint { get; set; } + + public object[] JudgmentStagePoint { get; set; } + + public object[] JudgmentStageContentsPoint { get; set; } + + public object[] TotalNotesPoint { get; set; } + + public object[] TotalNotesContentsPoint { get; set; } + + public object[] HighestInputCountPoint { get; set; } + + public object[] HighestInputCountContentsPoint { get; set; } + + public object[] LengthPoint { get; set; } + + public object[] LengthContentsPoint { get; set; } + + public object[] BPMPoint { get; set; } + + public object[] BPMContentsPoint { get; set; } + + public object[] InputModePoint { get; set; } + + public object[] InputModeContentsPoint { get; set; } + + public double[] StatusPoint { get; set; } + + public double[] StatusDefaultEntryPoint { get; set; } + + public double EventNoteNameFontLevel { get; set; } + + public double TitleFontLevel { get; set; } + + public double ArtistFontLevel { get; set; } + + public double FittedTextFontLevel { get; set; } + + public double GenreFontLevel { get; set; } + + public double LevelFontLevel { get; set; } + + public double WantLevelIDFontLevel { get; set; } + + public double EntryItemPositionFontLevel { get; set; } + + public double CommentDateFontLevel { get; set; } + + public double CommentViewPointFontLevel { get; set; } + + public double CommentAvatarNameFontLevel { get; set; } + + public double CommentStandFontLevel { get; set; } + + public float[] TitleQuitPoint { get; set; } + + public float[] ArtistQuitPoint { get; set; } + + public float[] GenreQuitPoint { get; set; } + + public float[] LevelQuitPoint { get; set; } + + public float[] WantLevelIDQuitPoint { get; set; } + + public float[] TotalNotesJudgmentQuitPoint { get; set; } + + public float[] TotalNotesJudgmentContentsQuitPoint { get; set; } + + public float[] HighestJudgmentQuitPoint { get; set; } + + public float[] HighestJudgmentContentsQuitPoint { get; set; } + + public float[] HigherJudgmentQuitPoint { get; set; } + + public float[] HigherJudgmentContentsQuitPoint { get; set; } + + public float[] HighJudgmentQuitPoint { get; set; } + + public float[] HighJudgmentContentsQuitPoint { get; set; } + + public float[] LowJudgmentQuitPoint { get; set; } + + public float[] LowJudgmentContentsQuitPoint { get; set; } + + public float[] LowerJudgmentQuitPoint { get; set; } + + public float[] LowerJudgmentContentsQuitPoint { get; set; } + + public float[] LowestJudgmentQuitPoint { get; set; } + + public float[] LowestJudgmentContentsQuitPoint { get; set; } + + public float[] AutoModeQuitPoint { get; set; } + + public float[] NoteSaltModeQuitPoint { get; set; } + + public float[] FaintNoteModeQuitPoint { get; set; } + + public float[] JudgmentModeQuitPoint { get; set; } + + public float[] HitPointsModeQuitPoint { get; set; } + + public float[] NoteMobilityModeQuitPoint { get; set; } + + public float[] InputFavorModeQuitPoint { get; set; } + + public float[] LongNoteModeQuitPoint { get; set; } + + public float[] NoteModifyModeQuitPoint { get; set; } + + public float[] BPMModeQuitPoint { get; set; } + + public float[] WaveModeQuitPoint { get; set; } + + public float[] SetNoteModeQuitPoint { get; set; } + + public float[] LowestJudgmentConditionModeQuitPoint { get; set; } + + public float[] JudgmentStageQuitPoint { get; set; } + + public float[] JudgmentStageContentsQuitPoint { get; set; } + + public float[] HighestInputCountQuitPoint { get; set; } + + public float[] HighestInputCountContentsQuitPoint { get; set; } + + public float[] LengthQuitPoint { get; set; } + + public float[] LengthContentsQuitPoint { get; set; } + + public float[] BPMQuitPoint { get; set; } + + public float[] BPMContentsQuitPoint { get; set; } + + public float[] InputModeQuitPoint { get; set; } + + public float[] InputModeContentsQuitPoint { get; set; } + + public float[] QuitDrawingPoint { get; set; } + + public float[] JudgmentMeterViewPoint { get; set; } + + public float[] StatusViewPoint { get; set; } + + public float[] ViewCommentPoint { get; set; } + + public float[] HandleUndoPoint { get; set; } + + public float[] QuitMove0Point { get; set; } + + public float[] QuitMove1Point { get; set; } + + public float[] StandQuitPoint { get; set; } + + public float[] PointQuitPoint { get; set; } + + public float[] BandQuitPoint { get; set; } + + public float[] StandContentsQuitPoint { get; set; } + + public float[] PointContentsQuitPoint { get; set; } + + public float[] BandContentsQuitPoint { get; set; } + + public float[] CommentPlace0Point { get; } = new float[4]; + + public float[] CommentPlace1Point { get; } = new float[4]; + + public HandledDrawingItem?[][] ModeComponentDrawings { get; } = new HandledDrawingItem?[13][]; + + public DrawingItem? ViewCommentDrawing { get; set; } + + public DrawingItem? HandleUndoDrawing { get; set; } + + public DrawingItem? QuitMove0Drawing { get; set; } + + public DrawingItem? QuitMove1Drawing { get; set; } + + public DrawingItem? StandDrawing { get; set; } + + public DrawingItem? HighestBandDrawing { get; set; } + + public DrawingItem? PointDrawing { get; set; } + + public DrawingItem? NewStandDrawing { get; set; } + + public DrawingItem?[] NetPositionDrawings { get; } = new DrawingItem?[8]; + + public Color TitleQuitColor { get; set; } + + public Color ArtistQuitColor { get; set; } + + public Color GenreQuitColor { get; set; } + + public Color WantLevelIDQuitColor { get; set; } + + public Color JudgmentStageQuitColor { get; set; } + + public Color HighestInputCountQuitColor { get; set; } + + public Color LengthQuitColor { get; set; } + + public Color BPMQuitColor { get; set; } + + public Color TotalNotesJudgmentQuitColor { get; set; } + + public Color[] JudgmentQuitColors { get; } = new Color[6]; + + public Color[] JudgmentColors { get; } = new Color[6]; + + public Color StandQuitColor { get; set; } + + public Color PointQuitColor { get; set; } + + public Color BandQuitColor { get; set; } + + public Color CommentPlaceColor { get; set; } + + public Color StandStatusViewColor { get; set; } + + public Color PointStatusViewColor { get; set; } + + public Color BandStatusViewColor { get; set; } + + public Color HitPointsStatusViewColor { get; set; } + + public CanvasTextFormat TitleQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat ArtistQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat GenreQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat LevelQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat WantLevelIDQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat TotalNotesQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat HighestJudgmentQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat HigherJudgmentQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat HighJudgmentQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat LowJudgmentQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat LowerJudgmentQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat LowestJudgmentQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat JudgmentStageQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat HighestInputCountQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat LengthQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat BPMQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat StandQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat PointQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat BandQuitFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat CommentPlace0Font { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat CommentPlace1Font { get; } = DrawingSystem.Instance.GetFont(); + + public BasePaintProperty[] PaintPropertyValues { get; } = new BasePaintProperty[HighestPaintPropertyID]; + + public ConcurrentDictionary> EventItems { get; } = new(); + + public FadingProperty[][] FadingPropertyValues { get; } = new FadingProperty[4][]; + + public MediaModifier MediaModifierValue { get; } + + public bool IsCounterWave => false; + + public double LoopingCounter { get; } + + public bool IsPausing => false; + + public double AudioMultiplier => 1.0; + + public BaseUI() + { + Init(); + } + + public void InitEvents() + { + foreach (var eventItem in EventItems) + { + foreach (var paintPropertyValue in eventItem.Value) + { + paintPropertyValue.DrawingFrame = -1; + } + } + } + + public void HandleEvent(EventItem eventItem) + { + if (EventItems.TryGetValue(eventItem, out var paintPropertyValues)) + { + foreach (var paintPropertyValue in paintPropertyValues) + { + paintPropertyValue.DrawingMillis = 0.0; + paintPropertyValue.DrawingFrame = 0; + } + } + } + + public void SetFontFamily() + { + DrawingSystem.Instance.SetFontFamily(TitleQuitFont); + DrawingSystem.Instance.SetFontFamily(ArtistQuitFont); + DrawingSystem.Instance.SetFontFamily(GenreQuitFont); + DrawingSystem.Instance.SetFontFamily(LevelQuitFont); + DrawingSystem.Instance.SetFontFamily(WantLevelIDQuitFont); + DrawingSystem.Instance.SetFontFamily(TotalNotesQuitFont); + DrawingSystem.Instance.SetFontFamily(HighestJudgmentQuitFont); + DrawingSystem.Instance.SetFontFamily(HigherJudgmentQuitFont); + DrawingSystem.Instance.SetFontFamily(HighJudgmentQuitFont); + DrawingSystem.Instance.SetFontFamily(LowJudgmentQuitFont); + DrawingSystem.Instance.SetFontFamily(LowerJudgmentQuitFont); + DrawingSystem.Instance.SetFontFamily(LowestJudgmentQuitFont); + DrawingSystem.Instance.SetFontFamily(JudgmentStageQuitFont); + DrawingSystem.Instance.SetFontFamily(HighestInputCountQuitFont); + DrawingSystem.Instance.SetFontFamily(LengthQuitFont); + DrawingSystem.Instance.SetFontFamily(BPMQuitFont); + DrawingSystem.Instance.SetFontFamily(StandQuitFont); + DrawingSystem.Instance.SetFontFamily(PointQuitFont); + DrawingSystem.Instance.SetFontFamily(BandQuitFont); + DrawingSystem.Instance.SetFontFamily(CommentPlace0Font); + DrawingSystem.Instance.SetFontFamily(CommentPlace1Font); + } + + void LoadBaseUIImpl(UIItem src, UIItem target) + { + #region COMPATIBLE + Compatible.Compatible.BaseUI(QwilightComponent.UIEntryPath, target.GetYamlFilePath(), target.YamlName, target.UIEntry); + #endregion + + var mainViewModel = ViewModels.Instance.MainValue; + try + { + Init(); + string zipName; + + var lsCaller = new Script(); + + var parallelItems = new ConcurrentBag(); + + var ys = new YamlStream(); + using (var sr = File.OpenText(target.GetYamlFilePath())) + { + ys.Load(sr); + + var valueNode = ys.Documents[0].RootNode; + var formatNode = valueNode[new YamlScalarNode("format")]; + var paintNode = valueNode[new YamlScalarNode("paint")]; + var pointNode = valueNode[new YamlScalarNode("point")]; + var fontNode = valueNode[new YamlScalarNode("font")]; + (valueNode as YamlMappingNode).Children.TryGetValue(new YamlScalarNode("func"), out var funcNode); + + zipName = $"@{Utility.GetText(formatNode, "zip")}"; + + XamlBaseUIConfigures = Enumerable.Range(0, HighestBaseUIConfigure).Select(i => + { + var configures = (Utility.GetText(funcNode, $"configure-{i}-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(funcNode, $"configure-{i}"))?.Split(',')?.Select(configure => configure.Trim())?.ToArray(); + if (configures != null) + { + LoadedConfigures[i] = Configure.Instance.BaseUIConfigureValue.UIConfigures[i] ??= configures.FirstOrDefault(); + return new XamlBaseUIConfigure + { + Position = i, + Configures = configures, + ConfigureComment = Utility.GetText(funcNode, $"configure-comment-{i}-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(funcNode, $"configure-comment-{i}") + }; + } + else + { + return null; + } + }).Where(value => value != null).ToArray(); + SetConfigures(lsCaller); + + var luaFilePath = Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, Path.ChangeExtension($"@{Utility.GetText(formatNode, "lua")}", "lua")); + if (File.Exists(luaFilePath)) + { + lsCaller.DoString(File.ReadAllText(luaFilePath, Encoding.UTF8)); + } + + DefaultLength = GetCalledValue(formatNode, "defaultLength", "1280"); + DefaultHeight = GetCalledValue(formatNode, "defaultHeight", "720"); + + SiteDateColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteDate")).GetColor()); + SiteEnterColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteEnter")).GetColor()); + SiteQuitColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteQuit")).GetColor()); + SiteHrefColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteHref")).GetColor()); + SiteTitleColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteTitle", nameof(Colors.White))).GetColor()); + SiteArtistColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteArtist", nameof(Colors.DeepSkyBlue))).GetColor()); + SiteGenreColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteGenre", nameof(Colors.LightGreen))).GetColor()); + SiteStandColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteStand", nameof(Colors.White))).GetColor()); + + EventNoteNameColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "eventNoteName")).GetColor()); + TitleColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "title")).GetColor()); + ArtistColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "artist")).GetColor()); + GenreColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "genre")).GetColor()); + WantLevelIDColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "wantLevelID")).GetColor()); + FittedTextColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "fittedText", Colors.ForestGreen.ToString())).GetColor()); + + FileColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "file")).GetColor()); + JudgmentStageColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "judgmentStage")).GetColor()); + TotalNotesColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "totalNotes")).GetColor()); + HighestInputCountColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "highestInputCount")).GetColor()); + LengthColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "length")).GetColor()); + BPMColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "bpm")).GetColor()); + + CommentDateColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "commentDate")).GetColor()); + CommentNameColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "commentName")).GetColor()); + CommentPointColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "commentPoint")).GetColor()); + CommentStandColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "commentStand")).GetColor()); + + foreach (var pair in new[] { + ("level0", (int)BaseNoteFile.Level.Level0, nameof(Colors.Gray)), + ("level1", (int)BaseNoteFile.Level.Level1, nameof(Colors.MediumSpringGreen)), + ("level2", (int)BaseNoteFile.Level.Level2, nameof(Colors.MediumTurquoise)), + ("level3", (int)BaseNoteFile.Level.Level3, nameof(Colors.Yellow)), + ("level4", (int)BaseNoteFile.Level.Level4, nameof(Colors.MediumVioletRed)), + ("level5", (int)BaseNoteFile.Level.Level5,nameof(Colors.MediumPurple)) + }) + { + LevelColors[pair.Item2] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, pair.Item1, pair.Item3)).GetColor()); + LevelPaints[pair.Item2] = DrawingSystem.Instance.GetDefaultPaint(Utility.ModifyColor(LevelColors[pair.Item2])); + D2DLevelColors[pair.Item2] = Utility.ModifyColor(LevelColors[pair.Item2]); + } + + TitleQuitColor = GetCalledText(Utility.GetText(paintNode, "titleQuit", nameof(Colors.White))).GetColor(); + ArtistQuitColor = GetCalledText(Utility.GetText(paintNode, "artistQuit", nameof(Colors.DeepSkyBlue))).GetColor(); + GenreQuitColor = GetCalledText(Utility.GetText(paintNode, "genreQuit", nameof(Colors.LightGreen))).GetColor(); + WantLevelIDQuitColor = GetCalledText(Utility.GetText(paintNode, "wantLevelIDQuit", nameof(Colors.DodgerBlue))).GetColor(); + JudgmentStageQuitColor = GetCalledText(Utility.GetText(paintNode, "judgmentStageQuit", nameof(Colors.Orchid))).GetColor(); + HighestInputCountQuitColor = GetCalledText(Utility.GetText(paintNode, "highestInputCountQuit", nameof(Colors.LightGreen))).GetColor(); + LengthQuitColor = GetCalledText(Utility.GetText(paintNode, "lengthQuit", nameof(Colors.Yellow))).GetColor(); + BPMQuitColor = GetCalledText(Utility.GetText(paintNode, "bpmQuit", nameof(Colors.LightPink))).GetColor(); + StandQuitColor = GetCalledText(Utility.GetText(paintNode, "standQuit", nameof(Colors.Yellow))).GetColor(); + PointQuitColor = GetCalledText(Utility.GetText(paintNode, "pointQuit", nameof(Colors.MediumPurple))).GetColor(); + BandQuitColor = GetCalledText(Utility.GetText(paintNode, "bandQuit", nameof(Colors.MediumSpringGreen))).GetColor(); + CommentPlaceColor = GetCalledText(Utility.GetText(paintNode, "commentPlace", nameof(Colors.White))).GetColor(); + + foreach (var pair in new[] { + ("lowestHitPoints", ModeComponent.HitPointsMode.Lowest, nameof(Colors.DarkGreen)), + ("lowerHitPoints", ModeComponent.HitPointsMode.Lower, nameof(Colors.DarkTurquoise)), + ("defaultHitPoints", ModeComponent.HitPointsMode.Default, nameof(Colors.DarkGoldenrod)), + ("higherHitPoints", ModeComponent.HitPointsMode.Higher, nameof(Colors.DarkRed)), + ("highestHitPoints", ModeComponent.HitPointsMode.Highest, nameof(Colors.DarkViolet)), + ("failedHitPoints", ModeComponent.HitPointsMode.Failed,nameof( Colors.DarkViolet)), + ("favorHitPoints", ModeComponent.HitPointsMode.Favor,nameof( Colors.DarkGoldenrod)), + ("testHitPoints", ModeComponent.HitPointsMode.Test, nameof(Colors.DarkGoldenrod)) + }) + { + parallelItems.Add(() => + { + HitPointsColor[(int)pair.Item2] = GetCalledText(Utility.GetText(paintNode, pair.Item1, pair.Item3)).GetColor(); + HitPointsPaints[(int)pair.Item2] = DrawingSystem.Instance.GetDefaultPaint(HitPointsColor[(int)pair.Item2]); + DrawingSystem.Instance.SetFaintPaints(this, D2DHitPointsPaints[(int)pair.Item2], HitPointsColor[(int)pair.Item2]); + }); + } + + StandStatusViewColor = GetCalledText(Utility.GetText(paintNode, "standStatusView", nameof(Colors.DeepSkyBlue))).GetColor(); + PointStatusViewColor = GetCalledText(Utility.GetText(paintNode, "pointStatusView", nameof(Colors.LightGreen))).GetColor(); + BandStatusViewColor = GetCalledText(Utility.GetText(paintNode, "bandStatusView", nameof(Colors.Orange))).GetColor(); + HitPointsStatusViewColor = GetCalledText(Utility.GetText(paintNode, "hitPointsStatusView", nameof(Colors.Red))).GetColor(); + + foreach (var pair in new[] { + ("highestJudgmentV2", Component.Judged.Highest, nameof(Colors.Cyan)), + ("higherJudgmentV2", Component.Judged.Higher, nameof(Colors.DeepSkyBlue)), + ("highJudgmentV2", Component.Judged.High, nameof(Colors.LightGreen)), + ("lowJudgmentV2", Component.Judged.Low, nameof(Colors.Yellow)), + ("lowerJudgmentV2", Component.Judged.Lower, nameof(Colors.Violet)), + ("lowestJudgmentV2", Component.Judged.Lowest,nameof( Colors.Red)) + }) + { + var inputMode = (int)(Component.InputMode)pair.Item2; + JudgmentColors[(int)inputMode] = GetCalledText(Utility.GetText(paintNode, pair.Item1, pair.Item3)).GetColor(); + JudgmentPaints[(int)inputMode] = DrawingSystem.Instance.GetDefaultPaint(JudgmentColors[(int)inputMode]); + parallelItems.Add(() => DrawingSystem.Instance.SetFaintPaints(this, D2DJudgmentPaints[(int)inputMode], JudgmentColors[(int)inputMode])); + } + + TotalNotesJudgmentQuitColor = GetCalledText(Utility.GetText(paintNode, "totalNotesJudgmentQuit", nameof(Colors.White))).GetColor(); + foreach (var pair in new[] { + ("highestJudgmentQuit", Component.Judged.Highest, nameof(Colors.Cyan)), + ("higherJudgmentQuit", Component.Judged.Higher, nameof(Colors.DeepSkyBlue)), + ("highJudgmentQuit", Component.Judged.High, nameof(Colors.LightGreen)), + ("lowJudgmentQuit", Component.Judged.Low, nameof(Colors.Yellow)), + ("lowerJudgmentQuit", Component.Judged.Lower, nameof(Colors.Violet)), + ("lowestJudgmentQuit", Component.Judged.Lowest,nameof( Colors.Red)) + }) + { + JudgmentQuitColors[(int)pair.Item2] = GetCalledText(Utility.GetText(paintNode, pair.Item1, pair.Item3)).GetColor(); + } + + StatusHandlingColor = GetCalledText(Utility.GetText(paintNode, "statusHandling", "#7F008000")).GetColor(); + StatusHandlingPaint = DrawingSystem.Instance.GetDefaultPaint(StatusHandlingColor); + + StatusPausedColor = GetCalledText(Utility.GetText(paintNode, "statusPaused", "#7FFFFF00")).GetColor(); + StatusPausedPaint = DrawingSystem.Instance.GetDefaultPaint(StatusPausedColor); + + StatusLoadingNoteFileColor = GetCalledText(Utility.GetText(paintNode, "statusLoadingNoteFile", "#7FFF0000")).GetColor(); + StatusLoadingNoteFilePaint = DrawingSystem.Instance.GetDefaultPaint(StatusLoadingNoteFileColor); + + StatusLoadingDefaultEntryColor = GetCalledText(Utility.GetText(paintNode, "statusLoadingDefaultEntry", "#7F0000FF")).GetColor(); + StatusLoadingDefaultEntryPaint = DrawingSystem.Instance.GetDefaultPaint(StatusLoadingDefaultEntryColor); + + QuitColors[(int)DefaultCompute.QuitStatus.SPlus] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit0", nameof(Colors.Red))).GetColor()); + QuitColors[(int)DefaultCompute.QuitStatus.S] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit1", nameof(Colors.Silver))).GetColor()); + QuitColors[(int)DefaultCompute.QuitStatus.APlus] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit2", nameof(Colors.Gold))).GetColor()); + QuitColors[(int)DefaultCompute.QuitStatus.A] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit3", nameof(Colors.Turquoise))).GetColor()); + QuitColors[(int)DefaultCompute.QuitStatus.B] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit4", nameof(Colors.Blue))).GetColor()); + QuitColors[(int)DefaultCompute.QuitStatus.C] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit5", nameof(Colors.Magenta))).GetColor()); + QuitColors[(int)DefaultCompute.QuitStatus.D] = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "quit6", nameof(Colors.Crimson))).GetColor()); + + for (var i = (int)DefaultCompute.QuitStatus.D; i >= (int)DefaultCompute.QuitStatus.SPlus; --i) + { + CommentViewerPaints[i] = DrawingSystem.Instance.GetDefaultPaint(Utility.ModifyColor(QuitColors[i])); + } + + NoteFileMargin = new(GetCalledValue(pointNode, "noteFileMargin", "31.5"), 1.0, 0.0, 1.0); + var entryViewTitleMargin = GetLayerPoint(pointNode, "entryViewTitleMargin", new[] { 58.0, 0.0, 0.0, 0.0 }); + EntryViewTitleMargin = new(entryViewTitleMargin[0], entryViewTitleMargin[1], entryViewTitleMargin[2], entryViewTitleMargin[3]); + + SignInPoint = GetDrawingPoint(pointNode, "signIn"); + ConfigurePoint = GetDrawingPoint(pointNode, "configure"); + CommentPoint = GetDrawingPoint(pointNode, "comment", new object[] { 0.0, 0.0, 0.0, 0.0, HorizontalAlignment.Center, VerticalAlignment.Center, Stretch.Uniform }); + HasCommentPoint = (double)CommentPoint[2] > 0.0 && (double)CommentPoint[3] > 0.0; + + SaltAutoPoint = GetDrawingPoint(pointNode, "saltAuto"); + StopAutoPoint = GetDrawingPoint(pointNode, "stopAuto"); + + HandledWallLength = GetCalledValue(pointNode, "handledWallLength", "10"); + EntryItemHeight = GetCalledValue(pointNode, "entryItemHeight", "60"); + CommentItemHeight = GetCalledValue(pointNode, "commentItemHeight", "48"); + CommentItemAvatarHeight = CommentItemHeight + 2 * CommentItemHeight * Levels.EdgeXY + 2 * 1.0; + + CommentViewPoint = GetLayerPoint(pointNode, "commentView"); + EntryViewPoint = GetLayerPoint(pointNode, "entryView"); + InputNoteCountViewPoint = GetLayerPoint(pointNode, "inputNoteCountView", new double[] { 0.0, 0.0, 0.0, 0.0 }); + AssistViewPoint = GetPanelPoint(pointNode, "assistView", new object[] { 0.0, 0.0, 0.0, 0.0, HorizontalAlignment.Stretch, VerticalAlignment.Stretch, Colors.Transparent, Colors.Transparent }); + + AutoModePoint = GetDrawingPoint(pointNode, "autoMode"); + NoteSaltModePoint = GetDrawingPoint(pointNode, "noteSaltMode"); + FaintNoteModePoint = GetDrawingPoint(pointNode, "faintNoteMode"); + JudgmentModePoint = GetDrawingPoint(pointNode, "judgmentMode"); + HitPointsModePoint = GetDrawingPoint(pointNode, "hitPointsMode"); + NoteMobilityModePoint = GetDrawingPoint(pointNode, "noteMobilityMode"); + InputFavorModePoint = GetDrawingPoint(pointNode, "inputFavorMode"); + LongNoteModePoint = GetDrawingPoint(pointNode, "longNoteMode"); + NoteModifyModePoint = GetDrawingPoint(pointNode, "noteModifyMode"); + BPMModePoint = GetDrawingPoint(pointNode, "bpmMode"); + WaveModePoint = GetDrawingPoint(pointNode, "waveMode"); + SetNoteModePoint = GetDrawingPoint(pointNode, "setNoteMode"); + LowestJudgmentConditionModePoint = GetDrawingPoint(pointNode, "lowestJudgmentConditionMode"); + + FilePoint = GetDrawingPoint(pointNode, "file"); + FileContentsPoint = GetTextPoint(pointNode, "fileContents"); + FileViewerPoint = GetDrawingPoint(pointNode, "fileViewer"); + AssistFileViewerPoint = GetDrawingPoint(pointNode, "assistFileViewer"); + JudgmentStagePoint = GetDrawingPoint(pointNode, "judgmentStage"); + JudgmentStageContentsPoint = GetTextPoint(pointNode, "judgmentStageContents"); + JudgmentStagePoint = GetDrawingPoint(pointNode, "judgmentStage"); + JudgmentStageContentsPoint = GetTextPoint(pointNode, "judgmentStageContents"); + TotalNotesPoint = GetDrawingPoint(pointNode, "totalNotes"); + TotalNotesContentsPoint = GetTextPoint(pointNode, "totalNotesContents"); + HighestInputCountPoint = GetDrawingPoint(pointNode, "highestInputCount"); + HighestInputCountContentsPoint = GetTextPoint(pointNode, "highestInputCountContents"); + LengthPoint = GetDrawingPoint(pointNode, "length"); + LengthContentsPoint = GetTextPoint(pointNode, "lengthContents"); + BPMPoint = GetDrawingPoint(pointNode, "bpm"); + BPMContentsPoint = GetTextPoint(pointNode, "bpmContents"); + InputModePoint = GetDrawingPoint(pointNode, "inputMode"); + InputModeContentsPoint = GetDrawingPoint(pointNode, "inputModeContents"); + StatusPoint = GetLayerPoint(pointNode, "status"); + StatusDefaultEntryPoint = GetLayerPoint(pointNode, "statusDefaultEntry"); + + EventNoteNameFontLevel = GetCalledValue(fontNode, "eventNoteNameLevel", Levels.FontLevel1.ToString()); + TitleFontLevel = GetCalledValue(fontNode, "titleLevel", Levels.FontLevel1.ToString()); + ArtistFontLevel = GetCalledValue(fontNode, "artistLevel", Levels.FontLevel0.ToString()); + FittedTextFontLevel = GetCalledValue(fontNode, "fittedTextLevel", Levels.FontLevel0.ToString()); + GenreFontLevel = GetCalledValue(fontNode, "genreLevel", Levels.FontLevel0.ToString()); + LevelFontLevel = GetCalledValue(fontNode, "levelLevel", Levels.FontLevel1.ToString()); + WantLevelIDFontLevel = GetCalledValue(fontNode, "wantLevelIDLevel", Levels.FontLevel1.ToString()); + EntryItemPositionFontLevel = GetCalledValue(fontNode, "entryItemPositionLevel", Levels.FontLevel0.ToString()); + + CommentDateFontLevel = GetCalledValue(fontNode, "commentDateLevel", Levels.FontLevel0.ToString()); + CommentViewPointFontLevel = GetCalledValue(fontNode, "commentPointLevel", Levels.FontLevel0.ToString()); + CommentAvatarNameFontLevel = GetCalledValue(fontNode, "commentAvatarNameLevel", Levels.FontLevel1.ToString()); + CommentStandFontLevel = GetCalledValue(fontNode, "commentStandLevel", Levels.FontLevel1.ToString()); + + TitleQuitPoint = GetQuitPoint(pointNode, "titleQuit"); + ArtistQuitPoint = GetQuitPoint(pointNode, "artistQuit"); + GenreQuitPoint = GetQuitPoint(pointNode, "genreQuit"); + LevelQuitPoint = GetQuitPoint(pointNode, "levelQuit"); + WantLevelIDQuitPoint = GetQuitPoint(pointNode, "wantLevelIDQuit"); + + TotalNotesJudgmentQuitPoint = GetQuitPoint(pointNode, "totalNotesJudgmentQuit"); + TotalNotesJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "totalNotesJudgmentContentsQuit"); + HighestJudgmentQuitPoint = GetQuitPoint(pointNode, "highestJudgmentQuit"); + HighestJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "highestJudgmentContentsQuit"); + HigherJudgmentQuitPoint = GetQuitPoint(pointNode, "higherJudgmentQuit"); + HigherJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "higherJudgmentContentsQuit"); + HighJudgmentQuitPoint = GetQuitPoint(pointNode, "highJudgmentQuit"); + HighJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "highJudgmentContentsQuit"); + LowJudgmentQuitPoint = GetQuitPoint(pointNode, "lowJudgmentQuit"); + LowJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "lowJudgmentContentsQuit"); + LowerJudgmentQuitPoint = GetQuitPoint(pointNode, "lowerJudgmentQuit"); + LowerJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "lowerJudgmentContentsQuit"); + LowestJudgmentQuitPoint = GetQuitPoint(pointNode, "lowestJudgmentQuit"); + LowestJudgmentContentsQuitPoint = GetQuitPoint(pointNode, "lowestJudgmentContentsQuit"); + + AutoModeQuitPoint = GetQuitPoint(pointNode, "autoModeQuit"); + NoteSaltModeQuitPoint = GetQuitPoint(pointNode, "noteSaltModeQuit"); + FaintNoteModeQuitPoint = GetQuitPoint(pointNode, "faintNoteModeQuit"); + JudgmentModeQuitPoint = GetQuitPoint(pointNode, "judgmentModeQuit"); + HitPointsModeQuitPoint = GetQuitPoint(pointNode, "hitPointsModeQuit"); + NoteMobilityModeQuitPoint = GetQuitPoint(pointNode, "noteMobilityModeQuit"); + InputFavorModeQuitPoint = GetQuitPoint(pointNode, "inputFavorModeQuit"); + LongNoteModeQuitPoint = GetQuitPoint(pointNode, "longNoteModeQuit"); + NoteModifyModeQuitPoint = GetQuitPoint(pointNode, "noteModifyModeQuit"); + BPMModeQuitPoint = GetQuitPoint(pointNode, "bpmModeQuit"); + WaveModeQuitPoint = GetQuitPoint(pointNode, "waveModeQuit"); + SetNoteModeQuitPoint = GetQuitPoint(pointNode, "setNoteModeQuit"); + LowestJudgmentConditionModeQuitPoint = GetQuitPoint(pointNode, "lowestJudgmentConditionModeQuit"); + + JudgmentStageQuitPoint = GetQuitPoint(pointNode, "judgmentStageQuit"); + JudgmentStageContentsQuitPoint = GetQuitPoint(pointNode, "judgmentStageContentsQuit"); + HighestInputCountQuitPoint = GetQuitPoint(pointNode, "highestInputCountQuit"); + HighestInputCountContentsQuitPoint = GetQuitPoint(pointNode, "highestInputCountContentsQuit"); + LengthQuitPoint = GetQuitPoint(pointNode, "lengthQuit"); + LengthContentsQuitPoint = GetQuitPoint(pointNode, "lengthContentsQuit"); + BPMQuitPoint = GetQuitPoint(pointNode, "bpmQuit"); + BPMContentsQuitPoint = GetQuitPoint(pointNode, "bpmContentsQuit"); + InputModeQuitPoint = GetQuitPoint(pointNode, "inputModeQuit"); + InputModeContentsQuitPoint = GetQuitPoint(pointNode, "inputModeContentsQuit"); + + QuitDrawingPoint = GetQuitPoint(pointNode, "quitDrawingV2"); + JudgmentMeterViewPoint = GetQuitPoint(pointNode, "judgmentMeterView"); + StatusViewPoint = GetQuitPoint(pointNode, "statusView"); + + ViewCommentPoint = GetQuitPoint(pointNode, "viewComment"); + HandleUndoPoint = GetQuitPoint(pointNode, "handleUndo"); + + QuitMove0Point = GetQuitPoint(pointNode, "quitMove0"); + QuitMove1Point = GetQuitPoint(pointNode, "quitMove1"); + + StandQuitPoint = GetQuitPoint(pointNode, "standQuit"); + PointQuitPoint = GetQuitPoint(pointNode, "pointQuit"); + BandQuitPoint = GetQuitPoint(pointNode, "bandQuit"); + StandContentsQuitPoint = GetQuitPoint(pointNode, "standContentsQuit"); + PointContentsQuitPoint = GetQuitPoint(pointNode, "pointContentsQuit"); + BandContentsQuitPoint = GetQuitPoint(pointNode, "bandContentsQuit"); + + var commentPlacePoint = GetQuitPoint(pointNode, "commentPlace", new float[] { 0F, 0F, 0F, 0F, Levels.FontLevel1Float32 }); + CommentPlace0Point[0] = commentPlacePoint[0]; + CommentPlace0Point[1] = commentPlacePoint[1]; + CommentPlace0Point[2] = commentPlacePoint[2] / 2; + CommentPlace0Point[3] = commentPlacePoint[3]; + DrawingSystem.Instance.SetFontLevel(CommentPlace0Font, (float)commentPlacePoint[4]); + DrawingSystem.Instance.SetFontSystem(CommentPlace0Font, (int)CanvasHorizontalAlignment.Left, (int)CanvasVerticalAlignment.Bottom); + CommentPlace1Point[0] = CommentPlace0Point[0] + CommentPlace0Point[2]; + CommentPlace1Point[1] = CommentPlace0Point[1]; + CommentPlace1Point[2] = CommentPlace0Point[2]; + CommentPlace1Point[3] = CommentPlace0Point[3]; + DrawingSystem.Instance.SetFontLevel(CommentPlace1Font, (float)commentPlacePoint[4] / 2); + DrawingSystem.Instance.SetFontSystem(CommentPlace1Font, (int)CanvasHorizontalAlignment.Right, (int)CanvasVerticalAlignment.Bottom); + + SetFontSystem(TitleQuitPoint, TitleQuitFont); + SetFontSystem(ArtistQuitPoint, ArtistQuitFont); + SetFontSystem(GenreQuitPoint, GenreQuitFont); + SetFontSystem(LevelQuitPoint, LevelQuitFont); + SetFontSystem(WantLevelIDQuitPoint, WantLevelIDQuitFont); + + SetFontSystem(JudgmentStageContentsQuitPoint, JudgmentStageQuitFont); + SetFontSystem(HighestInputCountContentsQuitPoint, HighestInputCountQuitFont); + SetFontSystem(LengthContentsQuitPoint, LengthQuitFont); + SetFontSystem(BPMContentsQuitPoint, BPMQuitFont); + + SetFontSystem(TotalNotesJudgmentContentsQuitPoint, TotalNotesQuitFont); + SetFontSystem(HighestJudgmentContentsQuitPoint, HighestJudgmentQuitFont); + SetFontSystem(HigherJudgmentContentsQuitPoint, HigherJudgmentQuitFont); + SetFontSystem(HighJudgmentContentsQuitPoint, HighJudgmentQuitFont); + SetFontSystem(LowJudgmentContentsQuitPoint, LowJudgmentQuitFont); + SetFontSystem(LowerJudgmentContentsQuitPoint, LowerJudgmentQuitFont); + SetFontSystem(LowestJudgmentContentsQuitPoint, LowestJudgmentQuitFont); + + SetFontSystem(StandContentsQuitPoint, StandQuitFont); + SetFontSystem(PointContentsQuitPoint, PointQuitFont); + SetFontSystem(BandContentsQuitPoint, BandQuitFont); + + void SetFontSystem(float[] point, CanvasTextFormat font) + { + DrawingSystem.Instance.SetFontLevel(font, (float)point[4]); + DrawingSystem.Instance.SetFontSystem(font, (int)point[5], (int)point[6]); + } + + for (var i = PaintPropertyValues.Length - 1; i >= 0; --i) + { + PaintPropertyValues[i]?.Dispose(); + var text = Utility.GetText(pointNode, $"paintProperty{i}"); + if (!string.IsNullOrEmpty(text)) + { + var data = text.Split(",").Select(value => GetCalledText(value.Trim())).ToArray(); + var frame = Utility.ToInt32(data[4]); + var drawingVariety = Utility.ToInt32(data[7]); + var paintPropertyValue = new BasePaintProperty + { + PaintBound = new(Utility.ToFloat64(data[0]), Utility.ToFloat64(data[1]), Utility.ToFloat64(data[2]), Utility.ToFloat64(data[3])), + HandledDrawingItems = new HandledDrawingItem?[frame], + Frame = frame, + Framerate = Utility.ToFloat64(data[5]), + Layer = Utility.ToInt32(data[6]), + DrawingVariety = drawingVariety, + Etc = data.ElementAtOrDefault(8), + Mode = Utility.ToInt32(data.ElementAtOrDefault(9) ?? "0") + }; + switch (paintPropertyValue.DrawingVariety) + { + case 3: + case 4: + case 5: + case 7: + case 13: + var etcColor = paintPropertyValue.Etc.GetColor(); + paintPropertyValue.EtcPaint = DrawingSystem.Instance.GetDefaultPaint(etcColor); + paintPropertyValue.EtcColor = etcColor; + break; + } + switch (paintPropertyValue.DrawingVariety) + { + case 7: + case 12: + paintPropertyValue.Font = DrawingSystem.Instance.GetFont(); + DrawingSystem.Instance.SetFontFamily(paintPropertyValue.Font); + DrawingSystem.Instance.SetFontLevel(paintPropertyValue.Font, (float)paintPropertyValue.Framerate); + break; + } + if (drawingVariety >= 100) + { + paintPropertyValue.DrawingFrame = -1; + EventItems.Into((EventItem)drawingVariety, paintPropertyValue); + } + PaintPropertyValues[i] = paintPropertyValue; + } + } + + for (var i = FadingPropertyValues.Length - 1; i >= 0; --i) + { + for (var j = FadingPropertyValues[i].Length - 1; j >= 0; --j) + { + var text = Utility.GetText(pointNode, $"fadingProperty{i}{j}"); + if (!string.IsNullOrEmpty(text)) + { + var data = text.Split(",").Select(value => GetCalledText(value.Trim())).ToArray(); + var frame = Utility.ToInt32(data[0]); + var framerate = Utility.ToFloat64(data[1]); + FadingPropertyValues[i][j] = new() + { + HandledDrawingItems = new HandledDrawingItem?[frame], + Frame = frame, + Framerate = framerate, + Millis = 1000.0 * frame / framerate, + DrawingStatus = Utility.ToFloat64(data[2]) + }; + } + } + } + + object[] GetDrawingPoint(YamlNode yamlNode, string target, object[] defaultValues = null) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + return defaultValues; + } + else + { + return text.Split(",").Select(value => GetCalledText(value.Trim())).Select((data, i) => i switch + { + 4 => Utility.ToInt32(data) switch + { + 0 => HorizontalAlignment.Left, + 1 => HorizontalAlignment.Center, + 2 => HorizontalAlignment.Right, + _ => throw new ArgumentException(target), + }, + 5 => Utility.ToInt32(data) switch + { + 0 => VerticalAlignment.Top, + 1 => VerticalAlignment.Center, + 2 => VerticalAlignment.Bottom, + _ => throw new ArgumentException(target), + }, + 6 => Utility.ToInt32(data) switch + { + 0 => Stretch.Uniform, + 1 => Stretch.Fill, + _ => throw new ArgumentException(target), + }, + _ => Utility.ToFloat64(data) as object, + }).ToArray(); + } + } + + object[] GetPanelPoint(YamlNode yamlNode, string target, object[] defaultValues = null) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + return defaultValues; + } + else + { + return text.Split(",").Select(value => GetCalledText(value.Trim())).Select((data, i) => i switch + { + 4 => Utility.ToInt32(data) switch + { + 0 => HorizontalAlignment.Left, + 1 => HorizontalAlignment.Center, + 2 => HorizontalAlignment.Right, + _ => throw new ArgumentException(target), + }, + 5 => Utility.ToInt32(data) switch + { + 0 => VerticalAlignment.Top, + 1 => VerticalAlignment.Center, + 2 => VerticalAlignment.Bottom, + _ => throw new ArgumentException(target), + }, + 6 => DrawingSystem.Instance.GetDefaultPaint(data.GetColor(), 100), + 7 => DrawingSystem.Instance.GetDefaultPaint(data.GetColor(), 100), + _ => Utility.ToFloat64(data) as object, + }).ToArray(); + } + } + + double[] GetLayerPoint(YamlNode yamlNode, string target, double[] defaultValues = null) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + return defaultValues; + } + else + { + return text.Split(",").Select(value => GetCalledText(value.Trim())).Select(data => Utility.ToFloat64(data)).ToArray(); + } + } + + float[] GetQuitPoint(YamlNode yamlNode, string target, float[] defaultValues = null) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + return defaultValues; + } + else + { + return text.Split(",").Select(value => GetCalledText(value.Trim())).Select(data => Utility.ToFloat32(data)).ToArray(); + } + } + + object[] GetTextPoint(YamlNode yamlNode, string target, object[] defaultValues = null) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + return defaultValues; + } + else + { + return text.Split(",").Select(value => GetCalledText(value.Trim())).Select((data, i) => i switch + { + 4 => Utility.ToInt32(data) switch + { + 0 => HorizontalAlignment.Left, + 1 => HorizontalAlignment.Center, + 2 => HorizontalAlignment.Right, + _ => throw new ArgumentException(target), + }, + 5 => Utility.ToInt32(data) switch + { + 0 => VerticalAlignment.Top, + 1 => VerticalAlignment.Center, + 2 => VerticalAlignment.Bottom, + _ => throw new ArgumentException(target), + }, + _ => Utility.ToFloat64(data) as object, + }).ToArray(); + } + } + + double GetCalledValue(YamlNode yamlNode, string target, string defaultValue = null) + { + var text = Utility.GetText(yamlNode, target, defaultValue); + if (Utility.ToFloat64(text, out var r)) + { + return r; + } + else if (QwilightComponent.GetCallComputer().IsMatch(text)) + { + var values = text.Split("(").Select(value => value.Trim()).ToArray(); + return lsCaller.Call(lsCaller.Globals[values[0]], values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + else + { + throw new ArgumentException(target.ToString()); + } + } + + string GetCalledText(string text) + { + if (!string.IsNullOrEmpty(text) && QwilightComponent.GetCallComputer().IsMatch(text)) + { + var values = text.Split("(").Select(value => value.Trim()).ToArray(); + return lsCaller.Call(lsCaller.Globals[values[0]], values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => Utility.ToFloat64(value) as object).ToArray()).ToObject().ToString(); + } + else + { + return text; + } + } + } + + var getPaintProperty = new Func(args => "P"); + var getTransition = new Func(args => "T"); + + SetFunc("_GetPaintProperty", ref getPaintProperty); + SetFunc("_GetTransition", ref getTransition); + + void SetFunc(string funcName, ref Func value) + { + var funcValue = lsCaller.Globals[funcName]; + if (funcValue != null) + { + value = new Func(args => + { + try + { + return lsCaller.Call(funcValue, args).String; + } + catch + { + throw new ArgumentException($"{funcName}([{string.Join(", ", args)}])"); + } + }); + } + } + + var handledMediaValues = new ConcurrentDictionary(); + var defaultDrawingValues = new ConcurrentDictionary(); + var drawingValues = new ConcurrentDictionary(); + var handledDrawingValues = new ConcurrentDictionary(); + var zipFilePath = Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, Path.ChangeExtension(zipName, "zip")); + if (File.Exists(zipFilePath)) + { + using var zipFile = ZipFile.Read(zipFilePath); + foreach (var zipEntry in zipFile) + { + if (!zipEntry.IsDirectory) + { + var rms = PoolSystem.Instance.GetDataFlow((int)zipEntry.UncompressedSize); + zipEntry.Extract(rms); + var fileName = zipEntry.FileName; + var justFileName = Path.GetFileNameWithoutExtension(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Audio": + parallelItems.Add(() => + { + try + { + using (rms) + { + _audioItemMap[justFileName] = AudioSystem.Instance.Load(rms, this, 1F, null, QwilightComponent.GetLoopingAudioComputer().IsMatch(justFileName)); + } + } + catch + { + } + }); + break; + case "Media": + parallelItems.Add(() => + { + try + { + using (rms) + { + var hash = Utility.GetID128s(rms); + var hashMediaFilePath = Path.Combine(QwilightComponent.MediaEntryPath, $"{hash}{Path.GetExtension(fileName)}"); + if (!File.Exists(hashMediaFilePath)) + { + using var fs = File.OpenWrite(hashMediaFilePath); + rms.WriteTo(fs); + } + handledMediaValues[Path.GetFileName(fileName)] = MediaSystem.Instance.Load(hashMediaFilePath, this); + } + } + catch + { + } + }); + break; + case "Drawing": + var fileNameContents = justFileName.Split(' '); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var value1); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var value2); + if (fileNameContents[0] == getPaintProperty(new[] { value1, value2 })) + { + NewHandledDrawing(rms); + } + else if (fileNameContents[0] == getTransition(new[] { value1, value2 })) + { + NewHandledDrawing(rms); + } + break; + case "Input": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "I") + { + NewHandledDrawing(rms); + } + break; + case "Judgment": + if (justFileName == "Total Notes") + { + NewDrawing(rms); + } + else + { + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "J") + { + NewHandledDrawing(rms); + } + } + break; + case "Mode": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "M") + { + NewHandledDrawing(rms); + } + break; + case "Net Position": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "NP") + { + NewDrawing(rms); + } + break; + case "Notify": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "N") + { + NewHandledDrawing(rms); + } + break; + case "Quit v2": + switch (justFileName) + { + case "S+": + case "S": + case "S FC": + case "A+": + case "A+ FC": + case "A": + case "A FC": + case "B": + case "B FC": + case "C": + case "C FC": + case "D": + case "D FC": + case "F": + NewHandledDrawing(rms); + break; + } + break; + case "Quit Mode": + NewDrawing(rms); + break; + case "": + switch (justFileName) + { + case "File": + case "Total Notes": + case "BPM!": + case "File Viewer": + case "Assist File Viewer": + case "Configure": + case "Comment": + case "Audio Input": + case "Want": + case "Salt": + case "Default Entry Configure": + NewDefaultDrawing(rms); + break; + case "Default": + case "Judgment Stage": + case "Highest Input Count": + case "Length": + case "BPM": + case "Input Mode": + NewHandledDrawing(rms); + break; + } + break; + default: + NewDefaultDrawing(rms); + break; + } + void NewDrawing(Stream s) => parallelItems.Add(() => + { + try + { + using (s) + { + drawingValues[fileName] = DrawingSystem.Instance.Load(s, this); + } + } + catch + { + } + }); + void NewDefaultDrawing(Stream s) => parallelItems.Add(() => + { + try + { + using (s) + { + defaultDrawingValues[fileName] = DrawingSystem.Instance.LoadDefault(s, this); + } + } + catch + { + } + }); + void NewHandledDrawing(Stream s) + { + parallelItems.Add(() => + { + using (s) + { + try + { + handledDrawingValues[fileName] = new() + { + Drawing = DrawingSystem.Instance.Load(s, this), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(s, this) + }; + } + catch + { + } + } + }); + } + } + } + } + + if (src != target) + { + AudioSystem.Instance.Close(this); + DrawingSystem.Instance.Close(this); + MediaSystem.Instance.Close(this, this); + } + else + { + MediaSystem.Instance.Stop(this); + } + Utility.HandleHMP(parallelItems, Configure.Instance.UIBin, parallelItem => parallelItem()); + + foreach (var paintPropertyValue in PaintPropertyValues) + { + if (paintPropertyValue?.DrawingVariety == 11) + { + var mode = paintPropertyValue.Mode; + var isAvailable = mode == 1; + var isDefaultAvailable = mode == 0; + if (handledMediaValues.TryGetValue(paintPropertyValue.Etc, out var handledMediaItem)) + { + paintPropertyValue.MediaHandlerItemValue = MediaSystem.Instance.Handle(handledMediaItem, this, isAvailable, isDefaultAvailable); + } + else + { + try + { + paintPropertyValue.MediaHandlerItemValue = MediaSystem.Instance.Handle(MediaSystem.Instance.Load(Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, paintPropertyValue.Etc), this), this, isAvailable, isDefaultAvailable); + } + catch + { + } + } + } + } + foreach (var (fileName, drawingItem) in drawingValues) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Judgment": + if (justFileName == "Total Notes") + { + TotalNotesJudgmentDrawing = drawingItem; + } + break; + case "Net Position": + var fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "NP") + { + NetPositionDrawings[Utility.ToInt32(fileNameContents[1])] = drawingItem; + } + break; + case "Quit Mode": + switch (justFileName) + { + case "Stand": + StandDrawing = drawingItem; + break; + case "Highest Band": + HighestBandDrawing = drawingItem; + break; + case "Point": + PointDrawing = drawingItem; + break; + case "New Stand": + NewStandDrawing = drawingItem; + break; + case "View Comment": + ViewCommentDrawing = drawingItem; + break; + case "Handle Undo": + HandleUndoDrawing = drawingItem; + break; + case "Move 0": + QuitMove0Drawing = drawingItem; + break; + case "Move 1": + QuitMove1Drawing = drawingItem; + break; + } + break; + } + } + foreach (var (fileName, defaultDrawing) in defaultDrawingValues) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Default Entry": + var fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "DE") + { + DefaultEntryDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Salt Auto": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SA") + { + SaltAutoDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Site Situation": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SS") + { + SiteSituationDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Input Window": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "IW") + { + InputModeWindowDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Handled": + fileNameContents = justFileName.Split(" "); + switch (fileNameContents[0]) + { + case "W": + HandledWallDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + break; + } + break; + case "Avatar Configure": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "AC") + { + AvatarConfigureDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Net Site": + switch (justFileName) + { + case "BPM": + BPMNetSiteDrawing = defaultDrawing; + break; + case "BPM!": + BPM1NetSiteDrawing = defaultDrawing; + break; + case "Total Notes": + TotalNotesNetSiteDrawing = defaultDrawing; + break; + case "Highest Input Count": + HighestInputCountNetSiteDrawing = defaultDrawing; + break; + case "Length": + LengthNetSiteDrawing = defaultDrawing; + break; + case "Judgment Stage": + JudgmentStageNetSiteDrawing = defaultDrawing; + break; + } + break; + case "Sign in": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "S") + { + SignInDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Site Cipher": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SC") + { + SiteCipherDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Site Configure": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SC") + { + SiteConfigureDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Stop Auto": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SA") + { + StopAutoDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Site Media": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SM") + { + SiteMediaDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Site Audio": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "SA") + { + SiteAudioDrawings[Utility.ToInt32(fileNameContents[1])] = defaultDrawing; + } + break; + case "Fit": + switch (justFileName) + { + case "Title": + TitleFitDrawing = defaultDrawing; + break; + case "Artist": + ArtistFitDrawing = defaultDrawing; + break; + case "Level Text Value": + LevelTextValueFitDrawing = defaultDrawing; + break; + case "Modified Date": + ModifiedDateFitDrawing = defaultDrawing; + break; + case "Handled Count": + HandledCountFitDrawing = defaultDrawing; + break; + case "Latest Date": + LatestDateFitDrawing = defaultDrawing; + break; + case "BPM": + BPMFitDrawing = defaultDrawing; + break; + case "Total Notes": + TotalNotesFitDrawing = defaultDrawing; + break; + case "Highest Input Count": + HighestInputCountFitDrawing = defaultDrawing; + break; + case "Average Input Count": + AverageInputCountFitDrawing = defaultDrawing; + break; + case "Length": + LengthFitDrawing = defaultDrawing; + break; + } + break; + case "": + switch (justFileName) + { + case "File": + FileDrawing = defaultDrawing; + break; + case "Total Notes": + TotalNotesDrawing = defaultDrawing; + break; + case "BPM!": + BPM1Drawing = defaultDrawing; + break; + case "File Viewer": + FileViewerDrawing = defaultDrawing; + break; + case "Assist File Viewer": + AssistFileViewerDrawing = defaultDrawing; + break; + case "Comment": + CommentDrawing = defaultDrawing; + break; + case "Configure": + ConfigureDrawing = defaultDrawing; + break; + case "Audio Input": + AudioInputDrawing = defaultDrawing; + break; + case "Salt": + SaltDrawing = defaultDrawing; + break; + case "Default Entry Configure": + DefaultEntryConfigureDrawing = defaultDrawing; + break; + } + break; + } + } + foreach (var (fileName, handledDrawingItem) in handledDrawingValues) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Drawing": + var fileNameContents = justFileName.Split(' '); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var value1); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var value2); + if (fileNameContents[0] == getPaintProperty(new[] { value1, value2 })) + { + PaintPropertyValues[value1].HandledDrawingItems.SetValue(value2, handledDrawingItem); + } + else if (fileNameContents[0] == getTransition(new[] { value1, value2 })) + { + FadingPropertyValues[value1][value2].HandledDrawingItems.SetValue(Utility.ToInt32(fileNameContents[3]), handledDrawingItem); + } + break; + case "Input": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "I") + { + InputModeDrawings[Utility.ToInt32(fileNameContents[1])] = handledDrawingItem; + } + break; + case "Judgment": + if (justFileName != "Total Notes") + { + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "J") + { + JudgmentDrawings[Utility.ToInt32(justFileName.Split(" ")[1])] = handledDrawingItem; + } + } + break; + case "Mode": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "M") + { + ModeComponentDrawings[Utility.ToInt32(fileNameContents[1])][Utility.ToInt32(fileNameContents[2])] = handledDrawingItem; + } + break; + case "Notify": + fileNameContents = justFileName.Split(" "); + if (fileNameContents[0] == "N") + { + NotifyDrawings[Utility.ToInt32(fileNameContents[1])] = handledDrawingItem; + } + break; + case "Quit v2": + switch (justFileName) + { + case "S+": + QuitDrawings[(int)DefaultCompute.QuitStatus.SPlus][0] = handledDrawingItem; + break; + case "S": + QuitDrawings[(int)DefaultCompute.QuitStatus.S][0] = handledDrawingItem; + break; + case "S FC": + QuitDrawings[(int)DefaultCompute.QuitStatus.S][1] = handledDrawingItem; + break; + case "A+": + QuitDrawings[(int)DefaultCompute.QuitStatus.APlus][0] = handledDrawingItem; + break; + case "A+ FC": + QuitDrawings[(int)DefaultCompute.QuitStatus.APlus][1] = handledDrawingItem; + break; + case "A": + QuitDrawings[(int)DefaultCompute.QuitStatus.A][0] = handledDrawingItem; + break; + case "A FC": + QuitDrawings[(int)DefaultCompute.QuitStatus.A][1] = handledDrawingItem; + break; + case "B": + QuitDrawings[(int)DefaultCompute.QuitStatus.B][0] = handledDrawingItem; + break; + case "B FC": + QuitDrawings[(int)DefaultCompute.QuitStatus.B][1] = handledDrawingItem; + break; + case "C": + QuitDrawings[(int)DefaultCompute.QuitStatus.C][0] = handledDrawingItem; + break; + case "C FC": + QuitDrawings[(int)DefaultCompute.QuitStatus.C][1] = handledDrawingItem; + break; + case "D": + QuitDrawings[(int)DefaultCompute.QuitStatus.D][0] = handledDrawingItem; + break; + case "D FC": + QuitDrawings[(int)DefaultCompute.QuitStatus.D][1] = handledDrawingItem; + break; + case "F": + QuitDrawings[(int)DefaultCompute.QuitStatus.F][0] = handledDrawingItem; + break; + } + break; + case "": + switch (justFileName) + { + case "Default": + DefaultDrawing = handledDrawingItem; + break; + case "Judgment Stage": + JudgmentStageDrawing = handledDrawingItem; + break; + case "Highest Input Count": + HighestInputCountDrawing = handledDrawingItem; + break; + case "Length": + LengthDrawing = handledDrawingItem; + break; + case "BPM": + BPMDrawing = handledDrawingItem; + break; + case "Input Mode": + InputModeDrawing = handledDrawingItem; + break; + } + break; + } + } + + for (var i = (int)Component.InputMode.InputMode484; i >= (int)Component.InputMode.InputMode4; --i) + { + InputModeWindowDrawings[i] ??= InputModeDrawings[i]?.DefaultDrawing; + } + + for (var i = (int)DefaultCompute.QuitStatus.F; i >= (int)DefaultCompute.QuitStatus.SPlus; --i) + { + QuitDrawings[i][1] ??= QuitDrawings[i][0]; + } + + for (var i = PaintPropertyValues.Length - 1; i >= 0; --i) + { + var frame = PaintPropertyValues[i]?.Frame ?? 0; + for (var j = 1; j < frame; ++j) + { + PaintPropertyValues[i].HandledDrawingItems[j] ??= PaintPropertyValues[i].HandledDrawingItems[j - 1]; + } + } + + for (var i = FadingPropertyValues.Length - 1; i >= 0; --i) + { + for (var j = FadingPropertyValues[i].Length - 1; j >= 0; --j) + { + var frame = FadingPropertyValues[i][j]?.Frame ?? 0; + for (var m = 1; m < frame; ++m) + { + FadingPropertyValues[i][j].HandledDrawingItems[m] ??= FadingPropertyValues[i][j].HandledDrawingItems[m - 1]; + } + } + for (var j = FadingPropertyValues[i].Length - 1; j >= 2; --j) + { + FadingPropertyValues[i][j] ??= FadingPropertyValues[i][1]; + } + for (var m = (FadingPropertyValues[i][1]?.Frame ?? 0) - 1; m >= 0; --m) + { + FadingPropertyValues[i][1].HandledDrawingItems[m] ??= FadingPropertyValues[i][0].HandledDrawingItems.ElementAtOrDefault(m); + } + for (var j = FadingPropertyValues[i].Length - 1; j >= 2; --j) + { + for (var m = (FadingPropertyValues[i][j]?.Frame ?? 0) - 1; m >= 1; --m) + { + FadingPropertyValues[i][j].HandledDrawingItems[m] ??= FadingPropertyValues[i][1].HandledDrawingItems.ElementAtOrDefault(m); + } + } + } + + FaultText = null; + } + finally + { + DrawingSystem.Instance.LoadDefaultDrawing(); + DrawingSystem.Instance.LoadVeilDrawing(); + ViewModels.Instance.NotifyWindowViewModels(); + mainViewModel.NotifyModel(); + mainViewModel.IsUILoading = false; + } + } + + void SetConfigures(Script lsCaller) + { + lsCaller.Globals["configures"] = Enumerable.Range(0, HighestBaseUIConfigure).Select(i => + { + return Math.Max(0, Array.IndexOf(XamlBaseUIConfigures.SingleOrDefault(value => value.Position == i)?.Configures ?? Array.Empty(), Configure.Instance.BaseUIConfigureValue.UIConfigures[i])); + }).ToArray(); + } + + public void LoadUIFiles() => Utility.SetUICollection(UIItems, Utility.GetEntry(QwilightComponent.UIEntryPath).Prepend(QwilightComponent.UIEntryPath).SelectMany(targetEntryPath => Utility.GetFiles(targetEntryPath).Where(targetFilePath => Path.GetFileName(targetFilePath).StartsWith('@') && targetFilePath.IsTailCaselsss(".yaml")).Select(yamlFilePath => new UIItem + { + UIEntry = Path.GetRelativePath(QwilightComponent.UIEntryPath, targetEntryPath), + YamlName = Path.GetFileNameWithoutExtension(yamlFilePath) + })).ToArray()); + + void Init() + { + foreach (var value in typeof(BaseUI).GetProperties()) + { + if (value.CanWrite) + { + value.SetValue(this, default); + } + else if (value.PropertyType.IsArray) + { + var data = value.GetValue(this) as Array; + Array.Clear(data, 0, data.Length); + } + } + for (var i = D2DHitPointsPaints.Length - 1; i >= 0; --i) + { + D2DHitPointsPaints[i] = new ICanvasBrush[101]; + } + for (var i = D2DJudgmentPaints.Length - 1; i >= 0; --i) + { + D2DJudgmentPaints[i] = new ICanvasBrush[101]; + } + _audioItemMap.Clear(); + EventItems.Clear(); + FadingPropertyValues[(int)MainViewModel.Mode.NoteFile] = new FadingProperty[4]; + FadingPropertyValues[1] = new FadingProperty[2]; + FadingPropertyValues[(int)MainViewModel.Mode.Computing] = new FadingProperty[4]; + FadingPropertyValues[(int)MainViewModel.Mode.Quit] = new FadingProperty[2]; + for (var i = (int)DefaultCompute.QuitStatus.F; i >= (int)DefaultCompute.QuitStatus.SPlus; --i) + { + QuitDrawings[i] = new HandledDrawingItem?[2]; + } + ModeComponentDrawings[ModifyModeComponentViewModel.AutoModeVariety] = new HandledDrawingItem?[2]; + ModeComponentDrawings[ModifyModeComponentViewModel.NoteSaltModeVariety] = new HandledDrawingItem?[15]; + ModeComponentDrawings[ModifyModeComponentViewModel.FaintNoteModeVariety] = new HandledDrawingItem?[4]; + ModeComponentDrawings[ModifyModeComponentViewModel.JudgmentModeVariety] = new HandledDrawingItem?[6]; + ModeComponentDrawings[ModifyModeComponentViewModel.HitPointsModeVariety] = new HandledDrawingItem?[8]; + ModeComponentDrawings[ModifyModeComponentViewModel.NoteMobilityModeVariety] = new HandledDrawingItem?[6]; + ModeComponentDrawings[ModifyModeComponentViewModel.LongNoteModeVariety] = new HandledDrawingItem?[4]; + ModeComponentDrawings[ModifyModeComponentViewModel.InputFavorModeVariety] = new HandledDrawingItem?[17]; + ModeComponentDrawings[ModifyModeComponentViewModel.NoteModifyModeVariety] = new HandledDrawingItem?[3]; + ModeComponentDrawings[ModifyModeComponentViewModel.BPMModeVariety] = new HandledDrawingItem?[2]; + ModeComponentDrawings[ModifyModeComponentViewModel.WaveModeVariety] = new HandledDrawingItem?[2]; + ModeComponentDrawings[ModifyModeComponentViewModel.SetNoteModeVariety] = new HandledDrawingItem?[4]; + ModeComponentDrawings[ModifyModeComponentViewModel.LowestJudgmentConditionModeVariety] = new HandledDrawingItem?[2]; + DefaultLength = 1280.0; + DefaultHeight = 720.0; + EventNoteNameFontLevel = Levels.FontLevel0; + TitleFontLevel = Levels.FontLevel0; + ArtistFontLevel = Levels.FontLevel0; + FittedTextFontLevel = Levels.FontLevel0; + GenreFontLevel = Levels.FontLevel0; + LevelFontLevel = Levels.FontLevel0; + WantLevelIDFontLevel = Levels.FontLevel0; + EntryItemPositionFontLevel = Levels.FontLevel0; + CommentDateFontLevel = Levels.FontLevel0; + CommentViewPointFontLevel = Levels.FontLevel0; + CommentAvatarNameFontLevel = Levels.FontLevel0; + CommentStandFontLevel = Levels.FontLevel0; + } + + public void LoadUI(UIItem src, UIItem target, bool isParallel = true) + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsUILoading) + { + mainViewModel.IsUILoading = true; + if (isParallel) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.OpeningUIFileContents); + Task.Run(() => + { + lock (UI.Instance.ContentsCSX) + { + try + { + LoadBaseUIImpl(src, target); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.OpenedUIFileContents); + } + catch (YamlException e) + { + FaultText = string.Format(LanguageSystem.Instance.YAMLCompileFault, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, FaultText); + LoadDefaultBaseUI(); + } + catch (Exception e) + { + FaultText = string.Format(LanguageSystem.Instance.UIFaultText, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, FaultText); + LoadDefaultBaseUI(); + } + } + }); + } + else + { + lock (UI.Instance.ContentsCSX) + { + try + { + LoadBaseUIImpl(src, target); + } + catch (YamlException e) + { + FaultText = string.Format(LanguageSystem.Instance.YAMLCompileFault, e.Message, true); + LoadDefaultBaseUI(); + } + catch (Exception e) + { + FaultText = string.Format(LanguageSystem.Instance.UIFaultText, e.Message, true); + LoadDefaultBaseUI(); + } + } + } + + void LoadDefaultBaseUI() + { + var defaultUIItem = new UIItem + { + UIEntry = "@Default", + YamlName = "@Default" + }; + if (target != defaultUIItem) + { + LoadUI(null, defaultUIItem, isParallel); + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/BaseUI/FadingProperty.cs b/Qwilight/Qwilight/System/BaseUI/FadingProperty.cs new file mode 100644 index 0000000..074dc94 --- /dev/null +++ b/Qwilight/Qwilight/System/BaseUI/FadingProperty.cs @@ -0,0 +1,15 @@ +namespace Qwilight +{ + public sealed class FadingProperty + { + public int Frame { get; set; } + + public double Framerate { get; set; } + + public double Millis { get; set; } + + public double DrawingStatus { get; set; } + + public HandledDrawingItem?[] HandledDrawingItems { get; set; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/BaseUI/XamlBaseUIConfigure.cs b/Qwilight/Qwilight/System/BaseUI/XamlBaseUIConfigure.cs new file mode 100644 index 0000000..49be126 --- /dev/null +++ b/Qwilight/Qwilight/System/BaseUI/XamlBaseUIConfigure.cs @@ -0,0 +1,18 @@ +namespace Qwilight +{ + public sealed class XamlBaseUIConfigure + { + public int Position { get; set; } + + public string[] Configures { get; set; } + + public string ConfigureComment { get; set; } + + public string UIConfigure + { + get => Configure.Instance.BaseUIConfigureValue.UIConfigures[Position]; + + set => Configure.Instance.BaseUIConfigureValue.UIConfigures[Position] = value; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/Configure/AudioConfigure.cs b/Qwilight/Qwilight/System/Configure/AudioConfigure.cs new file mode 100644 index 0000000..af6e850 --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/AudioConfigure.cs @@ -0,0 +1,9 @@ +namespace Qwilight +{ + public sealed class AudioConfigure + { + public double AudioWait { get; set; } + + public bool HandleInputAudio { get; set; } + } +} diff --git a/Qwilight/Qwilight/System/Configure/BaseUIConfigure.cs b/Qwilight/Qwilight/System/Configure/BaseUIConfigure.cs new file mode 100644 index 0000000..25c6283 --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/BaseUIConfigure.cs @@ -0,0 +1,24 @@ +namespace Qwilight +{ + public sealed class BaseUIConfigure : Model + { + double _defaultMediaFaint = 0.25; + double _defaultAudioVisualizerFaint = 0.1; + + public string[] UIConfigures { get; set; } = new string[BaseUI.HighestBaseUIConfigure]; + + public double DefaultMediaFaint + { + get => _defaultMediaFaint; + + set => SetProperty(ref _defaultMediaFaint, value, nameof(DefaultMediaFaint)); + } + + public double DefaultAudioVisualizerFaint + { + get => _defaultAudioVisualizerFaint; + + set => SetProperty(ref _defaultAudioVisualizerFaint, value, nameof(DefaultAudioVisualizerFaint)); + } + } +} diff --git a/Qwilight/Qwilight/System/Configure/ColorConfigure.cs b/Qwilight/Qwilight/System/Configure/ColorConfigure.cs new file mode 100644 index 0000000..cebaa3c --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/ColorConfigure.cs @@ -0,0 +1,213 @@ +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.UI; +using System.Text.Json.Serialization; +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight +{ + public partial class Configure + { + Color _meterNoteColor; + Color _limiterColor; + Color _audioVisualizerMainColor; + Color _audioVisualizerInputColor; + Color _inputNoteCountViewColor; + Color _autoableInputNoteCountViewColor; + + public Color InputNoteCountViewColor + { + get => _inputNoteCountViewColor; + + set + { + if (SetProperty(ref _inputNoteCountViewColor, value, nameof(InputNoteCountViewColor))) + { + OnSetInputNoteCountViewColor(); + } + } + } + + void OnSetInputNoteCountViewColor() + { + if (_isLoaded) + { + InputNoteCountViewPaint = DrawingSystem.Instance.GetDefaultPaint(InputNoteCountViewColor); + OnPropertyChanged(nameof(InputNoteCountViewPaint)); + } + } + + [JsonIgnore] + public Brush InputNoteCountViewPaint { get; set; } + + public Color AutoableInputNoteCountViewColor + { + get => _autoableInputNoteCountViewColor; + + set + { + if (SetProperty(ref _autoableInputNoteCountViewColor, value, nameof(AutoableInputNoteCountViewColor))) + { + OnSetAutoableInputNoteCountViewColor(); + } + } + } + + public void OnSetAutoableInputNoteCountViewColor() + { + if (_isLoaded) + { + AutoableInputNoteCountViewPaint = DrawingSystem.Instance.GetDefaultPaint(AutoableInputNoteCountViewColor); + OnPropertyChanged(nameof(AutoableInputNoteCountViewPaint)); + } + } + + [JsonIgnore] + public Brush AutoableInputNoteCountViewPaint { get; set; } + + public Color AudioVisualizerMainColor + { + get => _audioVisualizerMainColor; + + set + { + if (SetProperty(ref _audioVisualizerMainColor, value, nameof(AudioVisualizerMainColor))) + { + OnSetAudioVisualizerMainColor(); + } + } + } + + void OnSetAudioVisualizerMainColor() + { + if (_isLoaded) + { + for (var i = AudioVisualizerMainPaints.Length - 1; i >= 0; --i) + { + AudioVisualizerMainPaints[i] = DrawingSystem.Instance.GetDefaultPaint(AudioVisualizerMainColor, i); + } + OnPropertyChanged(nameof(AudioVisualizerMainPaints)); + SetFaintPaints(AudioVisualizerMainColor, DrawingSystem.Instance.AudioVisualizerMainPaints); + } + } + + [JsonIgnore] + public Brush[] AudioVisualizerMainPaints { get; } = new Brush[101]; + + public Color AudioVisualizerInputColor + { + get => _audioVisualizerInputColor; + + set + { + if (SetProperty(ref _audioVisualizerInputColor, value, nameof(AudioVisualizerInputColor))) + { + OnSetAudioVisualizerInputColor(); + } + } + } + + void OnSetAudioVisualizerInputColor() + { + if (_isLoaded) + { + for (var i = AudioVisualizerInputPaints.Length - 1; i >= 0; --i) + { + AudioVisualizerInputPaints[i] = DrawingSystem.Instance.GetDefaultPaint(AudioVisualizerInputColor, i); + } + OnPropertyChanged(nameof(AudioVisualizerInputPaints)); + SetFaintPaints(AudioVisualizerInputColor, DrawingSystem.Instance.AudioVisualizerInputPaints); + } + } + + [JsonIgnore] + public Brush[] AudioVisualizerInputPaints { get; } = new Brush[101]; + + public Color MeterNoteColor + { + get => _meterNoteColor; + + set + { + if (SetProperty(ref _meterNoteColor, value, nameof(MeterNoteColor))) + { + OnSetMeterNoteColor(); + } + } + } + + void OnSetMeterNoteColor() + { + if (_isLoaded) + { + MeterNotePaint = DrawingSystem.Instance.GetDefaultPaint(MeterNoteColor); + OnPropertyChanged(nameof(MeterNotePaint)); + SetFaintPaints(MeterNoteColor, DrawingSystem.Instance.MeterNotePaints); + DrawingSystem.Instance.MeterNoteAverageColor = (uint)(16777216 * MeterNoteColor.B + 65536 * MeterNoteColor.G + 256 * MeterNoteColor.R + MeterNoteColor.A); + } + } + + [JsonIgnore] + public Brush MeterNotePaint { get; set; } + + public Color LimiterColor + { + get => _limiterColor; + + set + { + if (SetProperty(ref _limiterColor, value, nameof(LimiterColor))) + { + OnSetLimiterColor(); + } + } + } + + public void OnSetLimiterColor() + { + if (_isLoaded) + { + LimiterPaint = DrawingSystem.Instance.GetDefaultPaint(LimiterColor); + OnPropertyChanged(nameof(LimiterPaint)); + } + } + + [JsonIgnore] + public Brush LimiterPaint { get; set; } + + void SetFaintPaints(Color valueColor, ICanvasBrush[] d2dPaints) + { + foreach (var d2dPaint in d2dPaints) + { + d2dPaint?.Dispose(); + } + DrawingSystem.Instance.SetFaintPaints(null, d2dPaints, valueColor); + } + + public void InitColors(int level) + { + if ((level & 1) == 1) + { + MeterNoteColor = Colors.White; + LimiterColor = Colors.White; + AudioVisualizerMainColor = Colors.LightGray; + AudioVisualizerInputColor = Colors.DarkGray; + } + if ((level & 2) == 2) + { + InputNoteCountViewColor = new Color + { + R = 255, + G = 255, + B = 255, + A = 127 + }; + AutoableInputNoteCountViewColor = new Color + { + R = 255, + A = 127 + }; + } + } + } +} diff --git a/Qwilight/Qwilight/System/Configure/Configure.cs b/Qwilight/Qwilight/System/Configure/Configure.cs new file mode 100644 index 0000000..595b8b3 --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/Configure.cs @@ -0,0 +1,3317 @@ +using CommunityToolkit.Mvvm.Messaging; +using FMOD; +using Microsoft.Win32; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Globalization; +using System.IO; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using System.Text.Encodings.Web; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Windows; +using System.Windows.Media; +using Windows.Gaming.Input; +using Windows.System; +using Windows.Win32; +using Windows.Win32.Graphics.Gdi; + +namespace Qwilight +{ + public sealed partial class Configure : Model + { + enum ReflexMode + { + eOff, + eLowLatency, + eLowLatencyWithBoost, + } + + [LibraryImport("NVIDIA")] + private static partial void SetNVLLConfigure(ReflexMode mode, uint frameLimitUs); + + public sealed class FontFamilyModifier : JsonConverter + { + public override FontFamily Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => new FontFamily(reader.GetString()); + + public override void Write(Utf8JsonWriter writer, FontFamily value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + + public enum TutorialID + { + NetQuitMode, + F1Assist, + ModifyAutoMode + } + + public enum NVLLMode + { + Not, Standard, Unlimited + } + + public enum InputAudioVariety + { + DJMAX, IIDX + } + + public enum AudioVisualizerMode + { + AudioVisualizerMode0, AudioVisualizerMode1, AudioVisualizerMode2 + } + + public enum WantBanned + { + Total, NotBanned + } + + public enum DefaultSpinningMode + { + Unpause, Configure, Undo, Stop + } + + public enum DefaultAudioVariety + { + Not, UI, Favor + } + + public static readonly Configure Instance = QwilightComponent.GetBuiltInData(nameof(Configure)); + + static readonly string _fileName = Path.Combine(QwilightComponent.QwilightEntryPath, "Configure.json"); + static readonly string _faultFileName = Path.ChangeExtension(_fileName, ".json.$"); + static readonly string _tmp0FileName = Path.ChangeExtension(_fileName, ".json.tmp.0"); + static readonly string _tmp1FileName = Path.ChangeExtension(_fileName, ".json.tmp.1"); + + public Configure() + { + using (var hashComputer = SHA256.Create()) + { + _aesCipher = Utility.GetID256(Encoding.UTF8.GetBytes(Environment.MachineName)); + } + SystemEvents.DisplaySettingsChanged += (sender, e) => OnSetAutoNVLLFramerate(); + } + + public void NotifyTutorial(TutorialID tutorialID) + { + if (PassedTutorialIDs.Add(tutorialID)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, typeof(LanguageSystem).GetProperties().Single(property => property.Name == $"TutorialID{(int)tutorialID}").GetValue(LanguageSystem.Instance) as string); + } + } + + public void Load() + { + Utility.WipeFile(_tmp0FileName); + Utility.MoveFile(_tmp1FileName, _fileName); + try + { + if (File.Exists(_fileName)) + { + var textConfigure = Utility.GetJSON(File.ReadAllText(_fileName, Encoding.UTF8), new JsonSerializerOptions + { + Converters = + { + new FontFamilyModifier() + }, + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + IncludeFields = true, + }); + foreach (var value in typeof(Configure).GetProperties().Where(value => value.GetCustomAttributes(typeof(JsonIgnoreAttribute), false).Length == 0 && value.CanWrite)) + { + value.SetValue(this, value.GetValue(textConfigure)); + } + Validate(false); + } + else + { + Validate(true); + } + } + catch (Exception e) + { + ConfigureFault = $"Failed to Validate Configure ({e.Message})"; + Validate(true); + Utility.MoveFile(_fileName, _faultFileName); + } + finally + { + _isLoaded = true; + OnSetQwilightFill(); + OnSetMeterNoteColor(); + OnSetLimiterColor(); + OnSetAudioVisualizerMainColor(); + OnSetAudioVisualizerInputColor(); + OnSetInputNoteCountViewColor(); + OnSetAutoableInputNoteCountViewColor(); + var hwModeCollection = new List(); + var rawHwMode = new DEVMODEW(); + var i = 0U; + while (PInvoke.EnumDisplaySettings(null, (ENUM_DISPLAY_SETTINGS_MODE)i++, ref rawHwMode)) + { + if (rawHwMode.Anonymous1.Anonymous2.dmDisplayFixedOutput == 0) + { + hwModeCollection.Add(new(rawHwMode.dmPelsWidth, rawHwMode.dmPelsHeight, rawHwMode.dmDisplayFrequency)); + } + } + if (hwModeCollection.Contains(HwModeV2Value)) + { + OnSetHwModeV2Value(); + } + else + { + PInvoke.EnumDisplaySettings(null, ENUM_DISPLAY_SETTINGS_MODE.ENUM_CURRENT_SETTINGS, ref rawHwMode); + HwModeV2Value = new HwMode(rawHwMode.dmPelsWidth, rawHwMode.dmPelsHeight, rawHwMode.dmDisplayFrequency); + } + OnSetAutoNVLLFramerate(); + OnSetIsXwindow(); + } + } + + readonly byte[] _aesCipher; + readonly byte[] _aesIV = new byte[16]; + readonly double[] _vibrations = new double[4]; + readonly double[] _audioVolumes = new double[4]; + readonly double[] _equalizers = new double[5]; + bool _detailedConfigure; + bool _isLoaded; + double _veilDrawingHeight; + bool _totalLimiterVariety; + bool _autoCompute; + bool _windowedMode; + bool _isXwindow; + bool _bw; + bool _ls; + bool _aura; + bool _valueK70; + bool _mediaInput; + bool _loadedMedia; + bool _media; + bool _handleInputAudio; + bool _banalAudio; + bool _banalMedia; + bool _banalFailedMedia; + bool _waveIn; + bool _wave; + bool _audioInput; + bool _valueUIPipelineLimiter; + bool _valueUIPipelineMainDrawingPaint; + bool _valueUIPipelineJudgmentMain; + bool _valueUIPipelineJudgmentCount; + bool _valueUIPipelineJudgmentMeter; + bool _valueUIPipelineJudgmentVisualizer; + bool _valueUIPipelineJudgmentPaint; + bool _valueUIPipelineHitNotePaint; + bool _valueUIPipelineBPM; + bool _valueUIPipelineNet; + bool _valueUIPipelineHunter; + bool _valueUICommentNote; + bool _valueUIPipelineMainJudgmentMeter; + bool _valueUIPipelineJudgmentInputVisualizer; + bool _lowHitPointsFaintUI; + bool _audioVisualizer; + bool _lostPointAudio; + bool _isMediaFill; + bool _isQwilightFill; + string _wantInput; + bool _saltAuto; + bool _isFailMode; + WantBanned _wantBanned; + bool _wantLevelSystem; + bool _wantLevelTextValue; + bool _wantBPM; + bool _wantAverageInputCount; + bool _wantHighestInputCount; + ControllerSystem.InputAPI _valueControllerInputAPI; + DefaultControllerSystem.InputAPI _defaultControllerInputAPI; + bool _autoHighlight; + string _wantLevelName; + bool _autoGetQwilight; + bool _equalizer; + bool _tube; + bool _valueSFX; + bool _flange; + bool _averager; + bool _audioMultiplierAtone; + DefaultEntryItem _lastDefaultEntryItem; + bool _autoSignIn; + int _lowestWantLevelTextValue; + int _highestWantLevelContensValue; + int _lowestWantBPM; + int _highestWantBPM; + int _lowestWantAverageInputCount; + int _highestWantAverageInputCount; + int _lowestWantHighestInputCount; + int _highestWantHighestInputCount; + double _audioWait; + double _banalAudioWait; + double _mediaWait; + ControllerSystem.VibrationMode _vibrationMode; + UIItem _valueUIItem; + UIItem _valueBaseUIItemValue; + bool _alwaysNotP2Position; + HunterVariety _hunterVariety; + bool _netCommentFollow; + bool _wantHellBPM; + int _noteFormatID; + int _commentViewTabPosition; + bool _lowestAutoLongNoteModify; + bool _highestAutoLongNoteModify; + bool _autoPutNoteSetMillis; + double _lowestAutoLongNoteModifyValue; + double _highestAutoLongNoteModifyValue; + double _autoPutNoteSetMillisValue; + string _language; + bool _setHwMode; + HwMode _hwModeValue; + ControllerSystem.DInputControllerVariety _dInputControllerVariety; + int _windowLength; + int _windowHeight; + bool _vesa; + bool _dataCount3; + NVLLMode _valueNVLLMode; + double _valueNVLLFramerate; + bool _autoNVLLFramerate; + bool _favorMediaInput; + double _mainAreaFaint; + uint _audioDataLength; + bool _autoNoteWait; + bool _stopLastEqualAudio; + bool _autoJudgmentMeterMillis; + double _judgmentMeterMillis; + AutoJudgmentMeterMillisItem _autoJudgmentMeterMillisItem; + bool _handleMeter; + bool _flowNetItem; + bool _ubuntuNetItemTarget; + DefaultAudioVariety _defaultAudioVariety; + + public bool TVAssistConfigure { get; set; } + + public bool UbuntuNetItemTarget + { + get => _ubuntuNetItemTarget; + + set + { + if (SetProperty(ref _ubuntuNetItemTarget, value, nameof(UbuntuNetItemTarget)) & _isLoaded) + { + ViewModels.Instance.MainValue.LoadTwilightCommentCollection(); + } + } + } + + public bool HandleMeter + { + get => _handleMeter; + + set + { + if (SetProperty(ref _handleMeter, value)) + { + OnPropertyChanged(nameof(HandleMeterText)); + OnPropertyChanged(nameof(HandleMeterPaint)); + } + } + } + + public string HandleMeterText => HandleMeter ? LanguageSystem.Instance.HandleMeterText : LanguageSystem.Instance.NotHandleMeterText; + + public Brush HandleMeterPaint => Paints.PointPaints[HandleMeter ? 1 : 0]; + + public bool FlowNetItem + { + get => _flowNetItem; + + set + { + if (SetProperty(ref _flowNetItem, value)) + { + OnPropertyChanged(nameof(FlowNetItemText)); + OnPropertyChanged(nameof(FlowNetItemPaint)); + } + } + } + + public string FlowNetItemText => FlowNetItem ? LanguageSystem.Instance.FlowNetItemText : LanguageSystem.Instance.NotFlowNetItemText; + + public Brush FlowNetItemPaint => Paints.PointPaints[FlowNetItem ? 1 : 0]; + + public Dictionary LevelTargetMap { get; set; } + + public Dictionary AudioConfigureValues { get; set; } + + public bool AllowTwilightComment { get; set; } + + public bool IsQwilightFill + { + get => _isQwilightFill; + + set + { + if (SetProperty(ref _isQwilightFill, value)) + { + OnPropertyChanged(nameof(IsQwilightFillText)); + OnPropertyChanged(nameof(IsQwilightFillContents)); + OnPropertyChanged(nameof(QwilightFillMode)); + OnSetQwilightFill(); + } + } + } + + void OnSetQwilightFill() + { + if (_isLoaded) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetD2DViewArea + }); + } + } + + public string IsQwilightFillText => IsQwilightFill ? LanguageSystem.Instance.QwilightFillText : LanguageSystem.Instance.NotQwilightFillText; + + public string IsQwilightFillContents => IsQwilightFill ? LanguageSystem.Instance.QwilightFillContents : LanguageSystem.Instance.NotQwilightFillContents; + + public Stretch QwilightFillMode => IsQwilightFill ? Stretch.Fill : Stretch.Uniform; + + public double JudgmentMeterMillis + { + get => _judgmentMeterMillis; + + set => SetProperty(ref _judgmentMeterMillis, value, nameof(JudgmentMeterMillis)); + } + + public bool AutoJudgmentMeterMillis + { + get => _autoJudgmentMeterMillis; + + set => SetProperty(ref _autoJudgmentMeterMillis, value, nameof(AutoJudgmentMeterMillis)); + } + + public AutoJudgmentMeterMillisItem AutoJudgmentMeterMillisItemValue + { + get => _autoJudgmentMeterMillisItem; + + set + { + if (SetProperty(ref _autoJudgmentMeterMillisItem, value) && _isLoaded) + { + ViewModels.Instance.MainValue.OnJudgmentMeterMillisModified(); + } + } + } + + public bool DetailedConfigure + { + get => _detailedConfigure; + + set + { + if (SetProperty(ref _detailedConfigure, value, nameof(DetailedConfigure))) + { + OnPropertyChanged(nameof(IsDInputXyzSensitivityVisible)); + OnPropertyChanged(nameof(IsDInputIIDXSensitivityVisible)); + OnPropertyChanged(nameof(IsBanalAudioVisible)); + if (_isLoaded) + { + ViewModels.Instance.ConfigureValue.NotifyCanGetDefaultText(); + } + } + } + } + + public bool FavorMediaInput + { + get => _favorMediaInput; + + set => SetProperty(ref _favorMediaInput, value, nameof(FavorMediaInput)); + } + + public double MediaInputPosition0 { get; set; } + + public double MediaInputPosition1 { get; set; } + + public double MediaInputLength { get; set; } + + public double MediaInputHeight { get; set; } + + public double MediaInputFaint { get; set; } + + public void InitMediaInputArea() + { + MediaInputPosition0 = 0.0; + MediaInputPosition1 = 0.0; + MediaInputLength = 0.0; + MediaInputHeight = 0.0; + } + + public bool AutoNoteWait + { + get => _autoNoteWait; + + set => SetProperty(ref _autoNoteWait, value, nameof(AutoNoteWait)); + } + + public bool StopLastEqualAudio + { + get => _stopLastEqualAudio; + + set + { + if (SetProperty(ref _stopLastEqualAudio, value)) + { + OnPropertyChanged(nameof(StopLastEqualAudioText)); + OnPropertyChanged(nameof(StopLastEqualAudioPaint)); + } + } + } + + public string StopLastEqualAudioText => StopLastEqualAudio ? LanguageSystem.Instance.StopLastEqualAudioText : LanguageSystem.Instance.NotStopLastEqualAudioText; + + public Brush StopLastEqualAudioPaint => Paints.PointPaints[StopLastEqualAudio ? 1 : 0]; + + public bool VESAV2 + { + get => _vesa; + + set + { + if (SetProperty(ref _vesa, value)) + { + OnPropertyChanged(nameof(VESAPaint)); + OnPropertyChanged(nameof(VESAText)); + } + } + } + + public Brush VESAPaint => Paints.PointPaints[VESAV2 ? 1 : 0]; + + public string VESAText => VESAV2 ? LanguageSystem.Instance.VESAText : LanguageSystem.Instance.NotVESAText; + + public bool DataCount3 + { + get => _dataCount3; + + set + { + if (SetProperty(ref _dataCount3, value)) + { + OnPropertyChanged(nameof(DataCount3Paint)); + OnPropertyChanged(nameof(DataCount3Text)); + } + } + } + + public Brush DataCount3Paint => Paints.PointPaints[DataCount3 ? 1 : 0]; + + public string DataCount3Text => DataCount3 ? LanguageSystem.Instance.DataCount3Text : LanguageSystem.Instance.NotDataCount3Text; + + public int DataCount => DataCount3 ? 3 : 2; + + public NVLLMode NVLLModeValue + { + get => _valueNVLLMode; + + set + { + if (SetProperty(ref _valueNVLLMode, value, nameof(NVLLModeValue))) + { + OnPropertyChanged(nameof(NVLLModePaint)); + OnPropertyChanged(nameof(NVLLModeText)); + SetNVLLConfigureImpl(); + } + } + } + + public bool IsNVLL => NVLLModeValue != NVLLMode.Not; + + public Brush NVLLModePaint => Paints.PointPaints[IsNVLL ? 1 : 0]; + + public string NVLLModeText => NVLLModeValue switch + { + NVLLMode.Not => LanguageSystem.Instance.NVLLModeNotText, + NVLLMode.Standard => LanguageSystem.Instance.NVLLModeOKText, + NVLLMode.Unlimited => LanguageSystem.Instance.NVLLModeUnlimitedText, + _ => default, + }; + + public double NVLLFramerate + { + get => _valueNVLLFramerate; + + set + { + if (SetProperty(ref _valueNVLLFramerate, value, nameof(NVLLFramerate))) + { + SetNVLLConfigureImpl(); + OnSetAutoNVLLFramerate(); + } + } + } + + public void SetNVLLConfigureImpl() + { + if (_isLoaded) + { + SetNVLLConfigure((ReflexMode)NVLLModeValue, NVLLFramerate > 0 ? (uint)(1000 * 1000 / NVLLFramerate) : 0); + } + } + + public bool AutoNVLLFramerate + { + get => _autoNVLLFramerate; + + set + { + if (SetProperty(ref _autoNVLLFramerate, value, nameof(AutoNVLLFramerate))) + { + OnSetAutoNVLLFramerate(); + } + } + } + + void OnSetAutoNVLLFramerate() + { + if (_isLoaded && AutoNVLLFramerate) + { + var rawHwMode = new DEVMODEW(); + PInvoke.EnumDisplaySettings(null, ENUM_DISPLAY_SETTINGS_MODE.ENUM_CURRENT_SETTINGS, ref rawHwMode); + NVLLFramerate = rawHwMode.dmDisplayFrequency; + } + } + + public string DefaultDrawingFilePath { get; set; } + + public string VeilDrawingFilePath { get; set; } + + public double VeilDrawingHeight + { + get => _veilDrawingHeight; + + set + { + if (SetProperty(ref _veilDrawingHeight, value, nameof(VeilDrawingHeightContents)) && _isLoaded) + { + ViewModels.Instance.MainValue.ModeComponentValue.NotifyIIDXMultiplierMillisText(); + } + } + } + + public string VeilDrawingHeightContents => VeilDrawingHeight.ToString(LanguageSystem.Instance.PointLevelContents); + + public int NoteFormatID + { + get => _noteFormatID; + + set => SetProperty(ref _noteFormatID, value, nameof(NoteFormatID)); + } + + public Dictionary UIConfigureValuesV2 { get; set; } + + [JsonIgnore] + public UIConfigure UIConfigureValue => UIConfigureValuesV2[UIItemValue.Title]; + + public Dictionary BaseUIConfigureValues { get; set; } + + [JsonIgnore] + public BaseUIConfigure BaseUIConfigureValue => BaseUIConfigureValues[BaseUIItemValue.Title]; + + [JsonIgnore] + public string ConfigureFault { get; set; } + + public bool LowestAutoLongNoteModify + { + get => _lowestAutoLongNoteModify; + + set + { + if (SetProperty(ref _lowestAutoLongNoteModify, value, nameof(LowestAutoLongNoteModify)) && _isLoaded) + { + ViewModels.Instance.MainValue.ModeComponentValue.SetLowestAutoLongNoteModify(); + } + } + } + + public bool HighestAutoLongNoteModify + { + get => _highestAutoLongNoteModify; + + set + { + if (SetProperty(ref _highestAutoLongNoteModify, value, nameof(HighestAutoLongNoteModify)) && _isLoaded) + { + ViewModels.Instance.MainValue.ModeComponentValue.SetHighestAutoLongNoteModify(); + } + } + } + + public double LowestAutoLongNoteModifyValue + { + get => _lowestAutoLongNoteModifyValue; + + set + { + if (SetProperty(ref _lowestAutoLongNoteModifyValue, value, nameof(LowestAutoLongNoteModifyValue)) && _isLoaded) + { + ViewModels.Instance.MainValue.ModeComponentValue.SetLowestAutoLongNoteModify(); + } + } + } + + public double HighestAutoLongNoteModifyValue + { + get => _highestAutoLongNoteModifyValue; + + set + { + if (SetProperty(ref _highestAutoLongNoteModifyValue, value, nameof(HighestAutoLongNoteModifyValue)) && _isLoaded) + { + ViewModels.Instance.MainValue.ModeComponentValue.SetHighestAutoLongNoteModify(); + } + } + } + + public bool AutoPutNoteSetMillis + { + get => _autoPutNoteSetMillis; + + set => SetProperty(ref _autoPutNoteSetMillis, value, nameof(AutoPutNoteSetMillis)); + } + + public double AutoPutNoteSetMillisValue + { + get => _autoPutNoteSetMillisValue; + + set => SetProperty(ref _autoPutNoteSetMillisValue, value, nameof(AutoPutNoteSetMillisValue)); + } + + public string Language + { + get => _language; + + set + { + if (SetProperty(ref _language, value) && _isLoaded) + { + LanguageSystem.Instance.Init(value); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetLanguage, value); + } + } + } + + public int FavorHunterStand { get; set; } + + public Version Date { get; set; } + + public long DefaultNoteDate { get; set; } + + public long DefaultUIDate { get; set; } + + public bool AutoGetDefaultNote { get; set; } + + public bool AutoGetDefaultUI { get; set; } + + public byte[] Cipher { get; set; } + + public ModeComponent ModeComponentValue { get; set; } + + public ModeComponentBundle[] ModeComponentBundles { get; set; } + + public double FastInputMillis { get; set; } + + public List FavorJudgments { get; set; } + + public List FavorHitPoints { get; set; } + + public OUTPUTTYPE AudioVariety { get; set; } + + public int LastASIOAudioValueID { get; set; } + + public int LastWASAPIAudioValueID { get; set; } + + public HashSet DefaultEntryItems { get; set; } + + public HashSet PassedTutorialIDs { get; set; } + + public bool IsLoaded { get; set; } + + public Dictionary LastEntryItemPositions { get; set; } + + public InputBundle DefaultInputBundlesV6 { get; set; } + + public InputBundle DInputBundlesV4 { get; set; } + + public InputBundle XInputBundlesV4 { get; set; } + + public InputBundle WGIBundlesV3 { get; set; } + + public InputBundle MIDIBundlesV4 { get; set; } + + public double MIDIPBCSensitivity { get; set; } + + public int DInputXyzSensitivityV2 { get; set; } + + public bool IsDInputXyzSensitivityVisible => DetailedConfigure && DInputControllerVarietyValue == ControllerSystem.DInputControllerVariety.BMS; + + public double DInputIIDXSensitivity { get; set; } + + public bool IsDInputIIDXSensitivityVisible => DetailedConfigure && DInputControllerVarietyValue == ControllerSystem.DInputControllerVariety.IIDX; + + public bool SetHwMode + { + get => _setHwMode; + + set + { + if (SetProperty(ref _setHwMode, value, nameof(SetHwMode)) && _isLoaded) + { + Utility.ModifyHwMode(HwModeV2Value); + } + } + } + + public HwMode HwModeV2Value + { + get => _hwModeValue; + + set + { + if (SetProperty(ref _hwModeValue, value)) + { + OnSetHwModeV2Value(); + } + } + } + + public void OnSetHwModeV2Value() + { + if (_isLoaded) + { + Utility.ModifyHwMode(HwModeV2Value); + } + } + + public ControllerSystem.DInputControllerVariety DInputControllerVarietyValue + { + get => _dInputControllerVariety; + + set + { + if (SetProperty(ref _dInputControllerVariety, value)) + { + OnPropertyChanged(nameof(IsDInputXyzSensitivityVisible)); + OnPropertyChanged(nameof(IsDInputIIDXSensitivityVisible)); + } + } + } + + public bool SetSalt { get; set; } + + public int LoopUnit { get; set; } + + public Component.InputMapping InputMappingValue { get; set; } + + public AudioVisualizerMode AudioVisualizerModeValue { get; set; } + + public ViewItem HandleFailedAudio { get; set; } + + public ViewItem ViewFailedDrawing { get; set; } + + public ViewItem ViewLowestJudgment { get; set; } + + public int HandleFailedAudioCount { get; set; } + + public double FailedDrawingMillis { get; set; } + + public bool[] InputWantMode { get; set; } + + public bool[] InputWantNoteVariety { get; set; } + + public bool IsTotalWantNoteVariety => InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.BMS] && InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.BMSON] && InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.EventNote]; + + public bool[] InputWantHandled { get; set; } + + public bool[] InputWantLevel { get; set; } + + public Brush InputWantWindowPaint => WantHellBPM || + !IsTotalWantNoteVariety || + InputWantHandled.Any(inputWantHandled => !inputWantHandled) || + InputWantMode.Skip(1).Any(inputWantMode => !inputWantMode) || + InputWantLevel.Any(inputWantLevel => !inputWantLevel) || + WantLevelTextValue || + WantBPM || + WantHighestInputCount ? Paints.Paint1 : Paints.Paint4; + + public void NotifyInputWantWindowPaint() => OnPropertyChanged(nameof(InputWantWindowPaint)); + + public InputAudioVariety InputAudioVarietyValue { get; set; } + + public DefaultSpinningMode DefaultSpinningModeValue { get; set; } + + public AutoEnterSite AutoEnterDefaultSite { get; set; } + + public AutoEnterSite AutoEnterNotifySite { get; set; } + + public AutoEnterSite AutoEnterPlatformSite { get; set; } + + public double AudioInputValue { get; set; } + + public double Vibration0 + { + get => _vibrations[0]; + + set => SetProperty(ref _vibrations[0], value, nameof(Vibration0)); + } + + public double Vibration1 + { + get => _vibrations[1]; + + set => SetProperty(ref _vibrations[1], value, nameof(Vibration1)); + } + + public double Vibration2 + { + get => _vibrations[2]; + + set => SetProperty(ref _vibrations[2], value, nameof(Vibration2)); + } + + public double Vibration3 + { + get => _vibrations[3]; + + set => SetProperty(ref _vibrations[3], value, nameof(Vibration3)); + } + + public double TotalAudioVolume + { + get => _audioVolumes[AudioSystem.TotalAudio]; + + set => SetProperty(ref _audioVolumes[AudioSystem.TotalAudio], value, nameof(TotalAudioVolume)); + } + + public double MainAudioVolume + { + get => _audioVolumes[AudioSystem.MainAudio]; + + set => SetProperty(ref _audioVolumes[AudioSystem.MainAudio], value, nameof(MainAudioVolume)); + } + + public double InputAudioVolume + { + get => _audioVolumes[AudioSystem.InputAudio]; + + set => SetProperty(ref _audioVolumes[AudioSystem.InputAudio], value, nameof(InputAudioVolume)); + } + + public double SEAudioVolume + { + get => _audioVolumes[AudioSystem.SEAudio]; + + set => SetProperty(ref _audioVolumes[AudioSystem.SEAudio], value, nameof(SEAudioVolume)); + } + + public double WaveFadeVolume { get; set; } + + public double MainAreaFaint + { + get => _mainAreaFaint; + + set => SetProperty(ref _mainAreaFaint, value, nameof(MainAreaFaint)); + } + + public int CompilingBin { get; set; } + + public int LoadingBin { get; set; } + + public int UIBin { get; set; } + + public int AudioVisualizerCount { get; set; } + + public double JudgmentVisualizerMillis { get; set; } + + public bool AutoCompute + { + get => _autoCompute; + + set + { + if (SetProperty(ref _autoCompute, value, nameof(AutoCompute))) + { + OnPropertyChanged(nameof(AutoComputePaint)); + OnPropertyChanged(nameof(AutoComputeText)); + OnPropertyChanged(nameof(AutoComputeContents)); + } + } + } + + public Brush AutoComputePaint => Paints.PointPaints[AutoCompute ? 1 : 0]; + + public string AutoComputeText => AutoCompute ? LanguageSystem.Instance.AutoComputeText : LanguageSystem.Instance.NotAutoComputeText; + + public string AutoComputeContents => AutoCompute ? LanguageSystem.Instance.AutoComputeContents : LanguageSystem.Instance.NotAutoComputeContents; + + public bool WindowedMode + { + get => _windowedMode; + + set + { + if (SetProperty(ref _windowedMode, value, nameof(WindowedMode))) + { + OnPropertyChanged(nameof(WindowedModeText)); + OnPropertyChanged(nameof(WindowedModeContents)); + OnPropertyChanged(nameof(WindowEllipse)); + } + } + } + + public string WindowedModeText => WindowedMode ? LanguageSystem.Instance.WindowedModeText : LanguageSystem.Instance.NotWindowedModeText; + + public string WindowedModeContents => WindowedMode ? LanguageSystem.Instance.WindowedModeContents : LanguageSystem.Instance.NotWindowedModeContents; + + public double WindowEllipse => WindowedMode && Environment.OSVersion.Version.Build >= 22000 ? Levels.WindowEllipse : 0.0; + + public string AvatarID { get; set; } + + public string BanalAudioFilePath { get; set; } + + public string DefaultAudioFilePath { get; set; } + + public DefaultAudioVariety DefaultAudioVarietyValue + { + get => _defaultAudioVariety; + + set + { + if (SetProperty(ref _defaultAudioVariety, value, nameof(DefaultAudioVarietyValue))) + { + OnPropertyChanged(nameof(DefaultAudioVarietyText)); + OnPropertyChanged(nameof(DefaultAudioVarietyPaint)); + } + } + } + + public string DefaultAudioVarietyText => DefaultAudioVarietyValue switch + { + DefaultAudioVariety.Not => LanguageSystem.Instance.NotDefaultAudioVarietyText, + DefaultAudioVariety.UI => LanguageSystem.Instance.UIDefaultAudioVarietyText, + DefaultAudioVariety.Favor => LanguageSystem.Instance.FavorDefaultAudioVarietyText, + _ => default + }; + + public Brush DefaultAudioVarietyPaint => Paints.PointPaints[DefaultAudioVarietyValue != DefaultAudioVariety.Not ? 1 : 0]; + + public string BanalMediaFilePath { get; set; } + + public string BanalFailedMediaFilePath { get; set; } + + public string BMSEditorFilePath { get; set; } + + public string BMSONEditorFilePath { get; set; } + + public BPMVariety BPMVarietyValue { get; set; } + + public FontFamily[] FontFamilyValues { get; set; } + + public void SetFontFamily() + { + FontFamilyValue = new(string.Join(',', FontFamilyValues.Select(fontFamily => fontFamily?.ToString() ?? string.Empty))); + OnPropertyChanged(nameof(FontFamilyValue)); + OnPropertyChanged(nameof(FontFamilyValues)); + FontFace = new(FontFamilyValue, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); + DrawingSystem.Instance.SetFontFamily(); + BaseUI.Instance.SetFontFamily(); + UI.Instance.SetFontFamily(); + } + + public string GetAFontFamily() => (FontFamilyValues.FirstOrDefault() ?? QwilightComponent.GetBuiltInData("DefaultFontFamily")).ToString(); + + public int CommentViewTabPosition + { + get => _commentViewTabPosition; + + set + { + if (SetProperty(ref _commentViewTabPosition, value, nameof(CommentViewTabPosition)) && _isLoaded) + { + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.Computer?.InitNetComments(); + switch (value) + { + case 0: + mainViewModel.LoadDefaultCommentCollection(); + break; + case 1: + mainViewModel.LoadTwilightCommentCollection(); + break; + case 2: + mainViewModel.LoadWowItemCollection(); + break; + } + } + } + } + + [JsonIgnore] + public FontFamily FontFamilyValue { get; set; } = new(); + + [JsonIgnore] + public Typeface FontFace { get; set; } + + public FitMode FitModeValue { get; set; } + + public bool Tube + { + get => _tube; + + set + { + if (SetProperty(ref _tube, value, nameof(Tube))) + { + OnPropertyChanged(nameof(TubePaint)); + OnPropertyChanged(nameof(TubeText)); + if (_isLoaded) + { + AudioSystem.Instance.SetTube(value); + } + } + } + } + + public Brush TubePaint => Paints.PointPaints[Tube ? 1 : 0]; + + public string TubeText => Tube ? LanguageSystem.Instance.TubeText : LanguageSystem.Instance.NotTubeText; + + public bool AutoGetQwilight + { + get => !QwilightComponent.IsValve && _autoGetQwilight; + + set => _autoGetQwilight = value; + } + + public bool SFX + { + get => _valueSFX; + + set + { + if (SetProperty(ref _valueSFX, value, nameof(SFX))) + { + OnPropertyChanged(nameof(SFXPaint)); + OnPropertyChanged(nameof(SFXText)); + if (_isLoaded) + { + AudioSystem.Instance.SetSFX(value); + } + } + } + } + + public Brush SFXPaint => Paints.PointPaints[SFX ? 1 : 0]; + + public string SFXText => SFX ? LanguageSystem.Instance.SFXText : LanguageSystem.Instance.NotSFXText; + + public bool Flange + { + get => _flange; + + set + { + if (SetProperty(ref _flange, value, nameof(Flange))) + { + OnPropertyChanged(nameof(FlangePaint)); + OnPropertyChanged(nameof(FlangeText)); + if (_isLoaded) + { + AudioSystem.Instance.SetFlange(value); + } + } + } + } + + public Brush FlangePaint => Paints.PointPaints[Flange ? 1 : 0]; + + public string FlangeText => Flange ? LanguageSystem.Instance.FlangeText : LanguageSystem.Instance.NotFlangeText; + + public bool Averager + { + get => _averager; + + set + { + if (SetProperty(ref _averager, value, nameof(Averager))) + { + OnPropertyChanged(nameof(AveragerPaint)); + OnPropertyChanged(nameof(AveragerText)); + if (_isLoaded) + { + AudioSystem.Instance.SetAverager(value); + } + } + } + } + + public Brush AveragerPaint => Paints.PointPaints[Averager ? 1 : 0]; + + public string AveragerText => Averager ? LanguageSystem.Instance.AveragerText : LanguageSystem.Instance.NotAveragerText; + + public bool AudioMultiplierAtone + { + get => _audioMultiplierAtone; + + set + { + if (SetProperty(ref _audioMultiplierAtone, value, nameof(AudioMultiplierAtone)) && _isLoaded) + { + AudioSystem.Instance.SetAudioMultiplierAtone(value, ViewModels.Instance.MainValue.ModeComponentValue.AudioMultiplier); + } + } + } + + public double EqualizerHz0 { get; set; } + + public double EqualizerHz1 { get; set; } + + public double EqualizerHz2 { get; set; } + + public double EqualizerHz3 { get; set; } + + public double EqualizerHz4 { get; set; } + + public double Equalizer0 + { + get => _equalizers[0]; + + set => SetProperty(ref _equalizers[0], value, nameof(Equalizer0)); + } + + public double Equalizer1 + { + get => _equalizers[1]; + + set => SetProperty(ref _equalizers[1], value, nameof(Equalizer1)); + } + + public double Equalizer2 + { + get => _equalizers[2]; + + set => SetProperty(ref _equalizers[2], value, nameof(Equalizer2)); + } + + public double Equalizer3 + { + get => _equalizers[3]; + + set => SetProperty(ref _equalizers[3], value, nameof(Equalizer3)); + } + + public double Equalizer4 + { + get => _equalizers[4]; + + set => SetProperty(ref _equalizers[4], value, nameof(Equalizer4)); + } + + public ControllerSystem.VibrationMode VibrationModeValue + { + get => _vibrationMode; + + set + { + if (SetProperty(ref _vibrationMode, value)) + { + OnPropertyChanged(nameof(VibrationModeText)); + OnPropertyChanged(nameof(IsVibrationMode)); + } + } + } + + public bool IsVibrationMode => VibrationModeValue != ControllerSystem.VibrationMode.Not; + + public string VibrationModeText => VibrationModeValue switch + { + ControllerSystem.VibrationMode.Not => LanguageSystem.Instance.NotVibrationModeText, + ControllerSystem.VibrationMode.Input => LanguageSystem.Instance.InputVibrationModeText, + ControllerSystem.VibrationMode.Failed => LanguageSystem.Instance.FailedVibrationModeText, + _ => default, + }; + + public string GetCipher() + { + try + { + using var aes = Aes.Create(); + aes.KeySize = 256; + return Encoding.UTF8.GetString(aes.CreateDecryptor(_aesCipher, _aesIV).TransformFinalBlock(Cipher, 0, Cipher.Length)); + } + catch + { + return string.Empty; + } + } + + public void SetCipher(string valueCipher) + { + using var aes = Aes.Create(); + aes.KeySize = 256; + var data = Encoding.UTF8.GetBytes(valueCipher); + Cipher = aes.CreateEncryptor(_aesCipher, _aesIV).TransformFinalBlock(data, 0, data.Length); + } + + public ControllerSystem.InputAPI ControllerInputAPI + { + get => _valueControllerInputAPI; + + set + { + if (SetProperty(ref _valueControllerInputAPI, value)) + { + OnPropertyChanged(nameof(ControllerInputAPIText)); + OnPropertyChanged(nameof(ControllerInputAPIContents)); + OnPropertyChanged(nameof(IsControllerInputAPIDInput)); + OnPropertyChanged(nameof(IsControllerInputAPIWGI)); + } + } + } + + public string ControllerInputAPIText => ControllerInputAPI switch + { + ControllerSystem.InputAPI.DInput => LanguageSystem.Instance.DInputText, + ControllerSystem.InputAPI.XInput => LanguageSystem.Instance.XInputText, + ControllerSystem.InputAPI.WGI => LanguageSystem.Instance.WGIText, + _ => null + }; + + public string ControllerInputAPIContents => ControllerInputAPI switch + { + ControllerSystem.InputAPI.DInput => LanguageSystem.Instance.DInputContents, + ControllerSystem.InputAPI.XInput => LanguageSystem.Instance.XInputContents, + ControllerSystem.InputAPI.WGI => LanguageSystem.Instance.WGIContents, + _ => null + }; + + public bool IsControllerInputAPIDInput => ControllerInputAPI == ControllerSystem.InputAPI.DInput; + + public bool IsControllerInputAPIWGI => ControllerInputAPI == ControllerSystem.InputAPI.WGI; + + public DefaultControllerSystem.InputAPI DefaultControllerInputAPI + { + get => _defaultControllerInputAPI; + + set + { + if (SetProperty(ref _defaultControllerInputAPI, value)) + { + OnPropertyChanged(nameof(DefaultControllerInputAPIText)); + OnPropertyChanged(nameof(DefaultControllerInputAPIContents)); + } + } + } + + public string DefaultControllerInputAPIText => DefaultControllerInputAPI switch + { + DefaultControllerSystem.InputAPI.DefaultInput => LanguageSystem.Instance.DefaultControllerDefaultInputText, + DefaultControllerSystem.InputAPI.DInput => LanguageSystem.Instance.DefaultControllerDInputText, + _ => null + }; + + public string DefaultControllerInputAPIContents => DefaultControllerInputAPI switch + { + DefaultControllerSystem.InputAPI.DefaultInput => LanguageSystem.Instance.DefaultControllerDefaultInputContents, + DefaultControllerSystem.InputAPI.DInput => LanguageSystem.Instance.DefaultControllerDInputContents, + _ => null + }; + + public WantBanned WantBannedValue + { + get => _wantBanned; + + set => SetProperty(ref _wantBanned, value, nameof(WantBannedText)); + } + + public string WantBannedText => WantBannedValue switch + { + WantBanned.Total => LanguageSystem.Instance.WantTotalBannedText, + WantBanned.NotBanned => LanguageSystem.Instance.WantNotBannedText, + _ => default, + }; + + public bool AutoHighlight + { + get => _autoHighlight; + + set + { + if (SetProperty(ref _autoHighlight, value)) + { + OnPropertyChanged(nameof(AutoHighlightText)); + OnPropertyChanged(nameof(AutoHighlightContents)); + } + } + } + + public string AutoHighlightText => AutoHighlight ? LanguageSystem.Instance.AutoHighlightText : LanguageSystem.Instance.AutoLevyingText; + + public string AutoHighlightContents => AutoHighlight ? LanguageSystem.Instance.AutoHighlightContents : LanguageSystem.Instance.AutoLevyingContents; + + public bool IsXwindow + { + get => _isXwindow; + + set + { + if (SetProperty(ref _isXwindow, value)) + { + OnPropertyChanged(nameof(IsXwindowPaint)); + OnPropertyChanged(nameof(IsXwindowText)); + OnSetIsXwindow(); + } + } + } + + public Brush IsXwindowPaint => Paints.PointPaints[IsXwindow ? 1 : 0]; + + public string IsXwindowText => IsXwindow ? LanguageSystem.Instance.XwindowText : LanguageSystem.Instance.NotXwindowText; + + void OnSetIsXwindow() + { + if (_isLoaded) + { + if (IsXwindow) + { + XwindowSystem.Instance.HandleSystem(); + } + else + { + XwindowSystem.Instance.Stop(); + } + } + } + + public bool BW + { + get => _bw; + + set + { + if (SetProperty(ref _bw, value)) + { + OnPropertyChanged(nameof(BWPaint)); + OnPropertyChanged(nameof(BWText)); + } + } + } + + public Brush BWPaint => Paints.PointPaints[BW ? 1 : 0]; + + public string BWText => BW ? LanguageSystem.Instance.BWText : LanguageSystem.Instance.NotBWText; + + public bool LS + { + get => _ls; + + set + { + if (SetProperty(ref _ls, value)) + { + OnPropertyChanged(nameof(LSPaint)); + OnPropertyChanged(nameof(LSText)); + } + } + } + + public Brush LSPaint => Paints.PointPaints[LS ? 1 : 0]; + + public string LSText => LS ? LanguageSystem.Instance.LSText : LanguageSystem.Instance.NotLSText; + + public bool Aura + { + get => _aura; + + set + { + if (SetProperty(ref _aura, value)) + { + OnPropertyChanged(nameof(AuraPaint)); + OnPropertyChanged(nameof(AuraText)); + } + } + } + + public Brush AuraPaint => Paints.PointPaints[Aura ? 1 : 0]; + + public string AuraText => Aura ? LanguageSystem.Instance.AuraText : LanguageSystem.Instance.NotAuraText; + + public bool K70 + { + get => _valueK70; + + set + { + if (SetProperty(ref _valueK70, value)) + { + OnPropertyChanged(nameof(K70Paint)); + OnPropertyChanged(nameof(K70Text)); + } + } + } + + public Brush K70Paint => Paints.PointPaints[K70 ? 1 : 0]; + + public string K70Text => K70 ? LanguageSystem.Instance.K70Text : LanguageSystem.Instance.NotK70Text; + + public bool MediaInput + { + get => _mediaInput; + + set => SetProperty(ref _mediaInput, value, nameof(MediaInput)); + } + + public bool LoadedMedia + { + get => _loadedMedia; + + set => SetProperty(ref _loadedMedia, value, nameof(LoadedMedia)); + } + + public bool Media + { + get => _media; + + set + { + if (SetProperty(ref _media, value)) + { + OnPropertyChanged(nameof(MediaPaint)); + OnPropertyChanged(nameof(MediaText)); + } + } + } + + public Brush MediaPaint => Paints.PointPaints[Media ? 1 : 0]; + + public string MediaText => Media ? LanguageSystem.Instance.MediaText : LanguageSystem.Instance.NotMediaText; + + public bool HandleInputAudio + { + get => _handleInputAudio; + + set + { + if (SetProperty(ref _handleInputAudio, value)) + { + OnPropertyChanged(nameof(HandleInputAudioPaint)); + OnPropertyChanged(nameof(HandleInputAudioText)); + OnPropertyChanged(nameof(IsBanalAudioVisible)); + if (_isLoaded) + { + var audioValueName = AudioSystem.Instance.AudioValue?.Name; + if (!string.IsNullOrEmpty(audioValueName)) + { + AudioConfigureValues[audioValueName].HandleInputAudio = value; + } + } + } + } + } + + public Brush HandleInputAudioPaint => Paints.PointPaints[HandleInputAudio ? 1 : 0]; + + public string HandleInputAudioText => HandleInputAudio ? LanguageSystem.Instance.HandleInputAudioText : LanguageSystem.Instance.NotHandleInputAudioText; + + public bool BanalAudio + { + get => _banalAudio; + + set + { + if (SetProperty(ref _banalAudio, value)) + { + OnPropertyChanged(nameof(BanalAudioPaint)); + OnPropertyChanged(nameof(BanalAudioText)); + } + } + } + + public Brush BanalAudioPaint => Paints.PointPaints[BanalAudio ? 1 : 0]; + + public string BanalAudioText => BanalAudio ? LanguageSystem.Instance.BanalAudioText : LanguageSystem.Instance.NotBanalAudioText; + + public bool IsBanalAudioVisible => DetailedConfigure && HandleInputAudio; + + public bool BanalMedia + { + get => _banalMedia; + + set + { + if (SetProperty(ref _banalMedia, value, nameof(BanalMedia))) + { + OnPropertyChanged(nameof(BanalMediaPaint)); + OnPropertyChanged(nameof(BanalMediaText)); + } + } + } + + public Brush BanalMediaPaint => Paints.PointPaints[BanalMedia ? 1 : 0]; + + public string BanalMediaText => BanalMedia ? LanguageSystem.Instance.BanalMediaText : LanguageSystem.Instance.NotBanalMediaText; + + public bool AlwaysBanalMedia { get; set; } + + public bool BanalFailedMedia + { + get => _banalFailedMedia; + + set + { + if (SetProperty(ref _banalFailedMedia, value, nameof(BanalFailedMedia))) + { + OnPropertyChanged(nameof(BanalFailedMediaPaint)); + OnPropertyChanged(nameof(BanalFailedMediaText)); + } + } + } + + public Brush BanalFailedMediaPaint => Paints.PointPaints[BanalFailedMedia ? 1 : 0]; + + public string BanalFailedMediaText => BanalFailedMedia ? LanguageSystem.Instance.BanalFailedMediaText : LanguageSystem.Instance.NotBanalFailedMediaText; + + public bool AlwaysBanalFailedMedia { get; set; } + + public bool WaveIn + { + get => _waveIn; + + set => SetProperty(ref _waveIn, value, nameof(WaveIn)); + } + + public bool Wave + { + get => _wave; + + set => SetProperty(ref _wave, value, nameof(Wave)); + } + + public bool AudioInput + { + get => _audioInput; + + set + { + if (SetProperty(ref _audioInput, value, nameof(AudioInput)) && _isLoaded) + { + ViewModels.Instance.HandleSiteViewModels(siteViewModel => siteViewModel.NotifyIsSendingAudioInput()); + } + } + } + + public bool UIPipelineLimiter + { + get => _valueUIPipelineLimiter; + + set + { + if (SetProperty(ref _valueUIPipelineLimiter, value, nameof(UIPipelineLimiter))) + { + OnPropertyChanged(nameof(UIPipelineLimiterPaint)); + } + } + } + + public Thickness UIPipelineLimiterPaint => new Thickness(UIPipelineLimiter ? 1.0 : 0.0); + + public bool UIPipelineMainDrawingPaint + { + get => _valueUIPipelineMainDrawingPaint; + + set => SetProperty(ref _valueUIPipelineMainDrawingPaint, value, nameof(UIPipelineMainDrawingPaintPaint)); + } + + public Thickness UIPipelineMainDrawingPaintPaint => new Thickness(UIPipelineMainDrawingPaint ? 1.0 : 0.0); + + public bool UIPipelineJudgmentMain + { + get => _valueUIPipelineJudgmentMain; + + set => SetProperty(ref _valueUIPipelineJudgmentMain, value, nameof(UIPipelineJudgmentMainPaint)); + } + + public Thickness UIPipelineJudgmentMainPaint => new Thickness(UIPipelineJudgmentMain ? 1.0 : 0.0); + + public bool UIPipelineJudgmentCount + { + get => _valueUIPipelineJudgmentCount; + + set => SetProperty(ref _valueUIPipelineJudgmentCount, value, nameof(UIPipelineJudgmentCountPaint)); + } + + public Thickness UIPipelineJudgmentCountPaint => new Thickness(UIPipelineJudgmentCount ? 1.0 : 0.0); + + public bool UIPipelineJudgmentMeter + { + get => _valueUIPipelineJudgmentMeter; + + set + { + if (SetProperty(ref _valueUIPipelineJudgmentMeter, value, nameof(UIPipelineJudgmentMeter))) + { + OnPropertyChanged(nameof(UIPipelineJudgmentMeterPaint)); + } + } + } + + public Thickness UIPipelineJudgmentMeterPaint => new Thickness(UIPipelineJudgmentMeter ? 1.0 : 0.0); + + public bool UIPipelineNet + { + get => _valueUIPipelineNet; + + set + { + if (SetProperty(ref _valueUIPipelineNet, value, nameof(UIPipelineNet))) + { + OnPropertyChanged(nameof(UIPipelineNetPaint)); + } + } + } + + public Thickness UIPipelineNetPaint => new Thickness(UIPipelineNet ? 1.0 : 0.0); + + public bool UIPipelineHunter + { + get => _valueUIPipelineHunter; + + set + { + if (SetProperty(ref _valueUIPipelineHunter, value, nameof(UIPipelineHunter))) + { + OnPropertyChanged(nameof(UIPipelineHunterPaint)); + } + } + } + + public Thickness UIPipelineHunterPaint => new Thickness(UIPipelineHunter ? 1.0 : 0.0); + + public bool UIPipelineJudgmentVisualizer + { + get => _valueUIPipelineJudgmentVisualizer; + + set + { + if (SetProperty(ref _valueUIPipelineJudgmentVisualizer, value, nameof(UIPipelineJudgmentVisualizer))) + { + OnPropertyChanged(nameof(UIPipelineJudgmentVisualizerPaint)); + } + } + } + + public Thickness UIPipelineJudgmentVisualizerPaint => new Thickness(UIPipelineJudgmentVisualizer ? 1.0 : 0.0); + + public bool UIPipelineJudgmentPaint + { + get => _valueUIPipelineJudgmentPaint; + + set => SetProperty(ref _valueUIPipelineJudgmentPaint, value, nameof(UIPipelineJudgmentPaint)); + } + + public Thickness UIPipelineJudgmentPaintPaint => new Thickness(UIPipelineJudgmentPaint ? 1.0 : 0.0); + + public bool UIPipelineHitNotePaint + { + get => _valueUIPipelineHitNotePaint; + + set => SetProperty(ref _valueUIPipelineHitNotePaint, value, nameof(UIPipelineHitNotePaintPaint)); + } + + public Thickness UIPipelineHitNotePaintPaint => new Thickness(UIPipelineHitNotePaint ? 1.0 : 0.0); + + public bool UIPipelineBPM + { + get => _valueUIPipelineBPM; + + set + { + if (SetProperty(ref _valueUIPipelineBPM, value, nameof(UIPipelineBPM))) + { + OnPropertyChanged(nameof(UIPipelineBPMPaint)); + } + } + } + + public Thickness UIPipelineBPMPaint => new Thickness(UIPipelineBPM ? 1.0 : 0.0); + + public bool UICommentNote + { + get => _valueUICommentNote; + + set => SetProperty(ref _valueUICommentNote, value, nameof(UICommentNotePaint)); + } + + public Thickness UICommentNotePaint => new Thickness(UICommentNote ? 1.0 : 0.0); + + public bool UIPipelineMainJudgmentMeter + { + get => _valueUIPipelineMainJudgmentMeter; + + set => SetProperty(ref _valueUIPipelineMainJudgmentMeter, value, nameof(UIPipelineMainJudgmentMeterPaint)); + } + + public Thickness UIPipelineMainJudgmentMeterPaint => new Thickness(UIPipelineMainJudgmentMeter ? 1.0 : 0.0); + + public bool UIPipelineJudgmentInputVisualizer + { + get => _valueUIPipelineJudgmentInputVisualizer; + + set + { + if (SetProperty(ref _valueUIPipelineJudgmentInputVisualizer, value, nameof(UIPipelineJudgmentInputVisualizer))) + { + OnPropertyChanged(nameof(UIPipelineJudgmentInputVisualizerPaint)); + } + } + } + + public Thickness UIPipelineJudgmentInputVisualizerPaint => new Thickness(UIPipelineJudgmentInputVisualizer ? 1.0 : 0.0); + + public bool LowHitPointsFaintUI + { + get => _lowHitPointsFaintUI; + + set + { + if (SetProperty(ref _lowHitPointsFaintUI, value)) + { + OnPropertyChanged(nameof(LowHitPointsFaintUIPaint)); + OnPropertyChanged(nameof(LowHitPointsFaintUIText)); + } + } + } + + public Brush LowHitPointsFaintUIPaint => LowHitPointsFaintUI ? Paints.Paint1 : Paints.Paint4; + + public string LowHitPointsFaintUIText => LowHitPointsFaintUI ? LanguageSystem.Instance.LowHitPointsFaintUIText : LanguageSystem.Instance.NotLowHitPointsFaintUIText; + + public bool AudioVisualizer + { + get => _audioVisualizer; + + set + { + if (SetProperty(ref _audioVisualizer, value, nameof(AudioVisualizer)) && _isLoaded) + { + AudioSystem.Instance.SetAudioVisualizer(value); + } + } + } + + public bool Equalizer + { + get => _equalizer; + + set + { + if (SetProperty(ref _equalizer, value, nameof(Equalizer))) + { + OnPropertyChanged(nameof(EqualizerPaint)); + if (_isLoaded) + { + AudioSystem.Instance.SetEqualizer(value); + } + } + } + } + + public Brush EqualizerPaint => Paints.PointPaints[Equalizer ? 1 : 0]; + + public bool TotalLimiterVariety + { + get => _totalLimiterVariety; + + set => SetProperty(ref _totalLimiterVariety, value, nameof(TotalLimiterVariety)); + } + + public bool AutoableLimiterVariety { get; set; } + + public bool CenterLimiterVariety { get; set; } + + public bool Limiter57Variety { get; set; } + + public bool IsMediaFill + { + get => _isMediaFill; + + set + { + if (SetProperty(ref _isMediaFill, value)) + { + OnPropertyChanged(nameof(IsMediaFillText)); + OnPropertyChanged(nameof(IsMediaFillContents)); + } + } + } + + public string IsMediaFillText => IsMediaFill ? LanguageSystem.Instance.MediaFillText : LanguageSystem.Instance.NotMediaFillText; + + public string IsMediaFillContents => IsMediaFill ? LanguageSystem.Instance.MediaFillContents : LanguageSystem.Instance.NotMediaFillContents; + + public bool LostPointAudio + { + get => _lostPointAudio; + + set + { + if (SetProperty(ref _lostPointAudio, value)) + { + OnPropertyChanged(nameof(LostPointAudioPaint)); + OnPropertyChanged(nameof(LostPointAudioText)); + } + } + } + + public Brush LostPointAudioPaint => Paints.PointPaints[LostPointAudio ? 1 : 0]; + + public string LostPointAudioText => LostPointAudio ? LanguageSystem.Instance.LostPointAudioText : LanguageSystem.Instance.NotLostPointAudioText; + + public string WantInput + { + get => _wantInput; + + set => SetProperty(ref _wantInput, value, nameof(WantInput)); + } + + public bool SaltAuto + { + get => _saltAuto; + + set => SetProperty(ref _saltAuto, value, nameof(SaltAuto)); + } + + public bool IsFailMode + { + get => _isFailMode; + + set + { + if (SetProperty(ref _isFailMode, value)) + { + OnPropertyChanged(nameof(IsFailModeText)); + OnPropertyChanged(nameof(IsFailModeContents)); + } + } + } + + public string IsFailModeText => IsFailMode ? LanguageSystem.Instance.IsFailModeText : LanguageSystem.Instance.NotIsFailModeText; + + public string IsFailModeContents => IsFailMode ? LanguageSystem.Instance.IsFailModeContents : LanguageSystem.Instance.NotIsFailModeContents; + + public bool WantLevelSystem + { + get => _wantLevelSystem; + + set + { + if (SetProperty(ref _wantLevelSystem, value, nameof(WantLevelSystem))) + { + OnPropertyChanged(nameof(WantLevelNameText)); + } + } + } + + public string WantLevelName + { + get => _wantLevelName; + + set + { + if (SetProperty(ref _wantLevelName, value, nameof(WantLevelName))) + { + OnPropertyChanged(nameof(WantLevelNameText)); + } + } + } + + public string WantLevelNameText => !WantLevelSystem || string.IsNullOrEmpty(WantLevelName) ? "✔️" : WantLevelName; + + public string[] WantLevelIDs { get; set; } + + public bool AutoSignIn + { + get => _autoSignIn; + + set => SetProperty(ref _autoSignIn, value, nameof(AutoSignIn)); + } + + public uint AudioDataLength + { + get => _audioDataLength; + + set => SetProperty(ref _audioDataLength, value, nameof(AudioDataLength)); + } + + public int LowestWantLevelTextValue + { + get => _lowestWantLevelTextValue; + + set => SetProperty(ref _lowestWantLevelTextValue, value, nameof(LowestWantLevelTextValue)); + } + + public int HighestWantLevelTextValue + { + get => _highestWantLevelContensValue; + + set => SetProperty(ref _highestWantLevelContensValue, value, nameof(HighestWantLevelTextValue)); + } + + public bool WantLevelTextValue + { + get => _wantLevelTextValue; + + set => SetProperty(ref _wantLevelTextValue, value, nameof(WantLevelTextValue)); + } + + public int LowestWantBPM + { + get => _lowestWantBPM; + + set => SetProperty(ref _lowestWantBPM, value, nameof(LowestWantBPM)); + } + + public int HighestWantBPM + { + get => _highestWantBPM; + + set => SetProperty(ref _highestWantBPM, value, nameof(HighestWantBPM)); + } + + public bool WantBPM + { + get => _wantBPM; + + set => SetProperty(ref _wantBPM, value, nameof(WantBPM)); + } + + public int LowestWantAverageInputCount + { + get => _lowestWantAverageInputCount; + + set => SetProperty(ref _lowestWantAverageInputCount, value, nameof(LowestWantAverageInputCount)); + } + + public int HighestWantAverageInputCount + { + get => _highestWantAverageInputCount; + + set => SetProperty(ref _highestWantAverageInputCount, value, nameof(HighestWantAverageInputCount)); + } + public bool WantAverageInputCount + { + get => _wantAverageInputCount; + + set => SetProperty(ref _wantAverageInputCount, value, nameof(WantAverageInputCount)); + } + + public int LowestWantHighestInputCount + { + get => _lowestWantHighestInputCount; + + set => SetProperty(ref _lowestWantHighestInputCount, value, nameof(LowestWantHighestInputCount)); + } + + public int HighestWantHighestInputCount + { + get => _highestWantHighestInputCount; + + set => SetProperty(ref _highestWantHighestInputCount, value, nameof(HighestWantHighestInputCount)); + } + + public bool WantHighestInputCount + { + get => _wantHighestInputCount; + + set => SetProperty(ref _wantHighestInputCount, value, nameof(WantHighestInputCount)); + } + + public int WindowPosition0V2 { get; set; } + + public int WindowPosition1V2 { get; set; } + + public int WindowLengthV2 + { + get => _windowLength; + + set => SetProperty(ref _windowLength, value, nameof(WindowLengthV2)); + } + + public int WindowHeightV2 + { + get => _windowHeight; + + set => SetProperty(ref _windowHeight, value, nameof(WindowHeightV2)); + } + + public double AudioWait + { + get => _audioWait; + + set => SetProperty(ref _audioWait, value, nameof(AudioWait)); + } + + public double BanalAudioWait + { + get => _banalAudioWait; + + set + { + if (SetProperty(ref _banalAudioWait, value, nameof(BanalAudioWait)) && _isLoaded) + { + var audioValueName = AudioSystem.Instance.AudioValue?.Name; + if (audioValueName != null) + { + AudioConfigureValues[audioValueName].AudioWait = value; + } + } + } + } + + public double MediaWait + { + get => _mediaWait; + + set => SetProperty(ref _mediaWait, value, nameof(MediaWait)); + } + + public double BanalMediaWait { get; set; } + + public DefaultEntryItem LastDefaultEntryItem + { + get => _lastDefaultEntryItem; + + set => SetProperty(ref _lastDefaultEntryItem, value, nameof(LastDefaultEntryItem)); + } + + public UIItem UIItemValue + { + get => _valueUIItem; + + set + { + if (SetProperty(ref _valueUIItem, value, nameof(UIItemValue))) + { + OnPropertyChanged(nameof(UIConfigureValue)); + } + } + } + + public UIItem BaseUIItemValue + { + get => _valueBaseUIItemValue; + + set => SetProperty(ref _valueBaseUIItemValue, value, nameof(BaseUIItemValue)); + } + + public bool AlwaysNotP2Position + { + get => _alwaysNotP2Position; + + set + { + if (SetProperty(ref _alwaysNotP2Position, value)) + { + OnPropertyChanged(nameof(AlwaysNotP2PositionText)); + OnPropertyChanged(nameof(AlwaysNotP2PositionContents)); + } + } + } + + public string AlwaysNotP2PositionText => AlwaysNotP2Position ? LanguageSystem.Instance.AlwaysNotP2PositionText : LanguageSystem.Instance.AlwaysP2PositionText; + + public string AlwaysNotP2PositionContents => AlwaysNotP2Position ? LanguageSystem.Instance.AlwaysNotP2PositionContents : LanguageSystem.Instance.AlwaysP2PositionContents; + + public bool GroupEntry { get; set; } + + public HunterVariety HunterVarietyV2Value + { + get => _hunterVariety; + + set => SetProperty(ref _hunterVariety, value, nameof(IsFavorHunterVariety)); + } + + public bool IsFavorHunterVariety => HunterVarietyV2Value.Mode == HunterVariety.HunterVarietyFavor; + + public bool NetCommentFollow + { + get => _netCommentFollow; + + set + { + if (SetProperty(ref _netCommentFollow, value)) + { + OnPropertyChanged(nameof(NetCommentFollowText)); + OnPropertyChanged(nameof(NetCommentFollowContents)); + } + } + } + + public string NetCommentFollowText => NetCommentFollow ? LanguageSystem.Instance.NetCommentFollowText : LanguageSystem.Instance.NetCommentNotFollowText; + + public string NetCommentFollowContents => NetCommentFollow ? LanguageSystem.Instance.NetCommentFollowContents : LanguageSystem.Instance.NetCommentNotFollowContents; + + public bool WantHellBPM + { + get => _wantHellBPM; + + set => SetProperty(ref _wantHellBPM, value, nameof(WantHellBPMText)); + } + + public string WantHellBPMText => WantHellBPM ? LanguageSystem.Instance.HellBPMText : LanguageSystem.Instance.NotHellBPMText; + + public int NetItemCount { get; set; } + + public void Save() + { + ModeComponentValue = ViewModels.Instance.MainValue.ModeComponentValue; + + Utility.CopyFile(_fileName, _tmp0FileName); + Utility.MoveFile(_tmp0FileName, _tmp1FileName); + Utility.SaveText(_fileName, Utility.SetJSON(this, new JsonSerializerOptions + { + Converters = + { + new FontFamilyModifier() + }, + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + IgnoreReadOnlyProperties = true, + IncludeFields = true, + WriteIndented = QwilightComponent.IsVS + })); + Utility.WipeFile(_tmp1FileName); + } + + public void Validate(bool isInit) + { + if (isInit || LoadingBin == default) + { + LoadingBin = QwilightComponent.CPUCount; + } + if (isInit || CompilingBin == default) + { + CompilingBin = QwilightComponent.CPUCount; + } + if (isInit || AvatarID == default) + { + AvatarID = string.Empty; + } + if (isInit || Cipher == default) + { + Cipher = Array.Empty(); + } + if (isInit) + { + ControllerInputAPI = ControllerSystem.InputAPI.DInput; + AutoSignIn = false; + IsFailMode = true; + LowHitPointsFaintUI = true; + IsLoaded = false; + AutoHighlight = true; + InputMappingValue = Component.InputMapping.Mapping1; + IsMediaFill = true; + AudioWait = 0.0; + SaltAuto = false; + Equalizer = false; + UndoEqualizers(1); + Vibration0 = 1.0; + Vibration1 = 1.0; + Vibration2 = 1.0; + Vibration3 = 1.0; + VibrationModeValue = ControllerSystem.VibrationMode.Input; + NoteFormatID = -1; + AlwaysNotP2Position = false; + IsXwindow = false; + } + if (isInit || AudioVariety == default) + { + AudioVariety = OUTPUTTYPE.WASAPI; + } + if (isInit || Utility.IsLowerDate(Date, 1, 5, 8)) + { + DefaultEntryItems = new(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 5, 16)) + { + WantInput = string.Empty; + } + if (isInit || Utility.IsLowerDate(Date, 1, 8, 7)) + { + UIBin = QwilightComponent.CPUCount; + } + if (isInit || Utility.IsLowerDate(Date, 1, 8, 12)) + { + AudioVisualizerCount = 80; + AudioVisualizerModeValue = AudioVisualizerMode.AudioVisualizerMode2; + JudgmentVisualizerMillis = 1000.0; + UIPipelineJudgmentCount = true; + UIPipelineJudgmentMeter = true; + UIPipelineJudgmentVisualizer = true; + UIPipelineJudgmentPaint = true; + UIPipelineHitNotePaint = true; + UIPipelineBPM = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 9, 0)) + { + UIPipelineMainDrawingPaint = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 0)) + { + HandleInputAudio = true; + AudioInput = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 2)) + { + WaveIn = true; + Wave = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 9)) + { + MediaWait = 0.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 14)) + { + DefaultEntryItems.Add(new DefaultEntryItem + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Favorite, + DefaultEntryPath = Guid.NewGuid().ToString(), + FavoriteEntryName = "Favorites ⭐", + Layer = DefaultEntryItems.Count + }); + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 19)) + { + CommentViewTabPosition = 0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 20)) + { + MainAudioVolume = 1.0; + InputAudioVolume = 1.0; + TotalAudioVolume = 1.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 23)) + { + WantBPM = false; + LowestWantBPM = 60; + HighestWantBPM = 240; + WantHighestInputCount = false; + LowestWantHighestInputCount = 8; + HighestWantHighestInputCount = 16; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 30)) + { + AudioMultiplierAtone = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 10, 32)) + { + AutoCompute = true; + UIPipelineLimiter = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 11, 1)) + { + WindowedMode = true; + } + if (Utility.IsLowerDate(Date, 1, 11, 4)) + { + UIItemValue = new() + { + UIEntry = "Default", + YamlName = "Default" + }; + } + if (isInit || Utility.IsLowerDate(Date, 1, 11, 5)) + { + NetItemCount = 8; + UIPipelineNet = true; + UIPipelineHunter = true; + NetCommentFollow = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 11, 6)) + { + TotalLimiterVariety = true; + AutoableLimiterVariety = false; + CenterLimiterVariety = false; + } + if (Utility.IsLowerDate(Date, 1, 11, 9)) + { + BaseUIItemValue = new() + { + UIEntry = "@Default", + YamlName = "@Default" + }; + } + if (isInit || Utility.IsLowerDate(Date, 1, 11, 9)) + { + WantLevelTextValue = false; + LowestWantLevelTextValue = 1; + HighestWantLevelTextValue = 12; + } + if (isInit || Utility.IsLowerDate(Date, 1, 11, 10)) + { + FontFamilyValues = new FontFamily[3]; + Array.Fill(FontFamilyValues, QwilightComponent.GetBuiltInData("DefaultFontFamily")); + } + if (isInit || Utility.IsLowerDate(Date, 1, 11, 36)) + { + GroupEntry = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 12, 0)) + { + MediaInput = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 25)) + { + InitColors(1); + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 32)) + { + UndoEqualizers(2); + SFX = false; + Flange = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 33)) + { + AutoPutNoteSetMillisValue = 16.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 38)) + { + Limiter57Variety = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 51)) + { + HandleFailedAudio = new() + { + Data = ViewItem.Always + }; + ViewFailedDrawing = new() + { + Data = ViewItem.Always + }; + ViewLowestJudgment = new() + { + Data = ViewItem.Always + }; + HandleFailedAudioCount = 5; + FailedDrawingMillis = 500.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 54)) + { + AudioVisualizer = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 61)) + { + BPMVarietyValue = new() + { + Data = BPMVariety.AudioMultiplier + }; + HunterVarietyV2Value = new() + { + Mode = HunterVariety.HunterVarietyHigher + }; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 65)) + { + LoopUnit = 1000; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 94)) + { + AutoEnterNotifySite = new() + { + Data = AutoEnterSite.AutoEnter + }; + AutoEnterDefaultSite = new() + { + Data = AutoEnterSite.AutoEnter + }; + AutoEnterPlatformSite = new() + { + Data = AutoEnterSite.AutoEnter + }; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 101)) + { + Aura = false; + K70 = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 110)) + { + MIDIPBCSensitivity = 100; + BW = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 128)) + { + WindowPosition0V2 = 0; + WindowPosition1V2 = 0; + WindowLengthV2 = 1280; + WindowHeightV2 = 720; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 133)) + { + SEAudioVolume = 1.0; + AudioInputValue = 0.0; + WaveFadeVolume = 50.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 13, 138)) + { + VESAV2 = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 0)) + { + FavorMediaInput = false; + InitMediaInputArea(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 5)) + { + DInputXyzSensitivityV2 = 100; + LostPointAudio = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 6)) + { + InputAudioVarietyValue = InputAudioVariety.IIDX; + FavorJudgments = new() + { + new() + { + Name = "LR2 EZ", + Value = new double[6][] + { + new double[] { -21.0, 21.0 }, + new double[] { -40.5, 40.5 }, + new double[] { -60.0, 60.0 }, + new double[] { -120.0, 120.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + IsDefault = true + }, + new() + { + Name = "LR2 NM", + Value = new double[6][] + { + new double[] { -18.0, 18.0 }, + new double[] { -29.0, 29.0 }, + new double[] { -40.0, 40.0 }, + new double[] { -100.0, 100.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + IsDefault = true + }, + new() + { + Name = "LR2 HD", + Value = new double[6][] + { + new double[] { -15.0, 15.0 }, + new double[] { -22.5, 22.5 }, + new double[] { -30.0, 30.0 }, + new double[] { -60.0, 60.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + IsDefault = true + }, + new() + { + Name = "LR2 VHD", + Value = new double[6][] + { + new double[] { -8.0, 8.0 }, + new double[] { -16.0, 16.0 }, + new double[] { -24.0, 24.0 }, + new double[] { -40.0, 40.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA EZ", + Value = new double[6][] + { + new double[] { -20.0, 20.0 }, + new double[] { -40.0, 40.0 }, + new double[] { -60.0, 60.0 }, + new double[] { -150.0, 150.0 }, + new double[] { -220.0, 280.0 }, + new double[] { -500.0, 280.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA NM", + Value = new double[6][] + { + new double[] { -15.0, 15.0 }, + new double[] { -30.0, 30.0 }, + new double[] { -45.0, 45.0 }, + new double[] { -112.5, 112.5 }, + new double[] { -275.0, 350.0 }, + new double[] { -500.0, 350.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA HD", + Value = new double[6][] + { + new double[] { -10.0, 10.0 }, + new double[] { -20.0, 20.0 }, + new double[] { -30.0, 30.0 }, + new double[] { -75.0, 75.0 }, + new double[] { -330.0, 420.0 }, + new double[] { -500.0, 420.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA VHD", + Value = new double[6][] + { + new double[] { -5.0, 5.0 }, + new double[] { -10.0, 10.0 }, + new double[] { -15.0, 15.0 }, + new double[] { -37.5, 37.5 }, + new double[] { -385.0, 490.0 }, + new double[] { -500.0, 490.0 } + }, + IsDefault = true + } + }; + FavorHitPoints = new() + { + new() + { + Name = "LR2 EZ", + Value = new double[6][] + { + new double[] { 120.0, 0.0 }, + new double[] { 120.0, 0.0 }, + new double[] { 120.0, 0.0 }, + new double[] { 60.0, 0.0 }, + new double[] { 0.0, -4.8 }, + new double[] { 0.0, -3.2 } + }, + IsDefault = true + }, + new() + { + Name = "LR2 NM", + Value = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -6.0 }, + new double[] { 0.0, -4.0 } + }, + IsDefault = true + }, + new() + { + Name = "LR2 HD", + Value = new double[6][] + { + new double[] { 0.0, 0.1 }, + new double[] { 0.0, 0.1 }, + new double[] { 0.0, 0.1 }, + new double[] { 0.0, 0.05 }, + new double[] { 0.0, -10.0 }, + new double[] { 0.0, -6.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA EZ", + Value = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -1.0 }, + new double[] { 0.0, -2.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA NM", + Value = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -1.0 }, + new double[] { 0.0, -3.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA HD", + Value = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -2.0 }, + new double[] { 0.0, -6.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA VHD", + Value = new double[6][] + { + new double[] { 0.0, 0.15 }, + new double[] { 0.0, 0.135 }, + new double[] { 0.0, 0.12 }, + new double[] { 0, 0.03 }, + new double[] { 0.0, -5.0 }, + new double[] { 0.0, -10.0 } + }, + IsDefault = true + }, + new() + { + Name = "BEATORAJA UHD", + Value = new double[6][] + { + new double[] { 0.0, 0.15 }, + new double[] { 0.0, 0.105 }, + new double[] { 0.0, 0.06 }, + new double[] { 0, 0.0 }, + new double[] { 0.0, -10.0 }, + new double[] { 0.0, -15.0 } + }, + IsDefault = true + } + }; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 7)) + { + WantLevelName = null; + WantLevelIDs = Array.Empty(); + InputWantMode = new bool[17]; + Array.Fill(InputWantMode, true); + InputWantLevel = new bool[6]; + Array.Fill(InputWantLevel, true); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 13)) + { + AudioDataLength = 256; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 20)) + { + DInputControllerVarietyValue = ControllerSystem.DInputControllerVariety.BMS; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 26)) + { + SetSalt = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 32)) + { + DInputBundlesV4 = new(); + DInputBundlesV4.SetInputs(); + DInputBundlesV4.SetStandardInputs(); + XInputBundlesV4 = new(); + XInputBundlesV4.SetInputs(); + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode4][1][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadLeft }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode4][2][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadUp }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode4][3][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.Y }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode4][4][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.B }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode5][1][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadLeft }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode5][2][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadUp }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode5][3][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadRight }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode5][3][1].Data = new() { Buttons = Vortice.XInput.GamepadButtons.X }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode5][4][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.Y }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode5][5][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.B }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode6][1][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadLeft }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode6][2][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadUp }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode6][3][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadRight }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode6][4][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.X }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode6][5][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.Y }; + XInputBundlesV4.Inputs[(int)Component.InputMode.InputMode6][6][0].Data = new() { Buttons = Vortice.XInput.GamepadButtons.B }; + XInputBundlesV4.SetStandardInputs(); + XInputBundlesV4.StandardInputs[InputStandardControllerViewModel.LowerEntry].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadUp }; + XInputBundlesV4.StandardInputs[InputStandardControllerViewModel.HigherEntry].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadDown }; + XInputBundlesV4.StandardInputs[InputStandardControllerViewModel.LowerNoteFile].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadLeft }; + XInputBundlesV4.StandardInputs[InputStandardControllerViewModel.HigherNoteFile].Data = new() { Buttons = Vortice.XInput.GamepadButtons.DPadRight }; + XInputBundlesV4.StandardInputs[InputStandardControllerViewModel.LevyNoteFile].Data = new() { Buttons = Vortice.XInput.GamepadButtons.Start }; + XInputBundlesV4.StandardInputs[InputStandardControllerViewModel.Wait].Data = new() { Buttons = Vortice.XInput.GamepadButtons.Back }; + WGIBundlesV3 = new(); + WGIBundlesV3.SetInputs(); + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode4][1][0].Data = new() { Buttons = GamepadButtons.DPadLeft }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode4][2][0].Data = new() { Buttons = GamepadButtons.DPadUp }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode4][3][0].Data = new() { Buttons = GamepadButtons.Y }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode4][4][0].Data = new() { Buttons = GamepadButtons.B }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode5][1][0].Data = new() { Buttons = GamepadButtons.DPadLeft }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode5][2][0].Data = new() { Buttons = GamepadButtons.DPadUp }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode5][3][0].Data = new() { Buttons = GamepadButtons.DPadRight }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode5][3][1].Data = new() { Buttons = GamepadButtons.X }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode5][4][0].Data = new() { Buttons = GamepadButtons.Y }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode5][5][0].Data = new() { Buttons = GamepadButtons.B }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode6][1][0].Data = new() { Buttons = GamepadButtons.DPadLeft }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode6][2][0].Data = new() { Buttons = GamepadButtons.DPadUp }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode6][3][0].Data = new() { Buttons = GamepadButtons.DPadRight }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode6][4][0].Data = new() { Buttons = GamepadButtons.X }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode6][5][0].Data = new() { Buttons = GamepadButtons.Y }; + WGIBundlesV3.Inputs[(int)Component.InputMode.InputMode6][6][0].Data = new() { Buttons = GamepadButtons.B }; + WGIBundlesV3.SetStandardInputs(); + WGIBundlesV3.StandardInputs[InputStandardControllerViewModel.LowerEntry].Data = new() { Buttons = GamepadButtons.DPadUp }; + WGIBundlesV3.StandardInputs[InputStandardControllerViewModel.HigherEntry].Data = new() { Buttons = GamepadButtons.DPadDown }; + WGIBundlesV3.StandardInputs[InputStandardControllerViewModel.LowerNoteFile].Data = new() { Buttons = GamepadButtons.DPadLeft }; + WGIBundlesV3.StandardInputs[InputStandardControllerViewModel.HigherNoteFile].Data = new() { Buttons = GamepadButtons.DPadRight }; + WGIBundlesV3.StandardInputs[InputStandardControllerViewModel.LevyNoteFile].Data = new() { Buttons = GamepadButtons.View }; + WGIBundlesV3.StandardInputs[InputStandardControllerViewModel.Wait].Data = new() { Buttons = GamepadButtons.Menu }; + MIDIBundlesV4 = new(); + MIDIBundlesV4.SetInputs(); + MIDIBundlesV4.SetStandardInputs(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 47)) + { + AudioConfigureValues = new(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 49)) + { + UICommentNote = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 63)) + { + AutoNoteWait = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 64)) + { + StopLastEqualAudio = true; + LevelTargetMap = new(); + Language = Utility.GetLanguage(CultureInfo.CurrentUICulture.LCID); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 66)) + { + AutoGetQwilight = !QwilightComponent.IsVS; + NVLLModeValue = NVLLMode.Not; + NVLLFramerate = 0U; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 67)) + { + DefaultInputBundlesV6 = new(); + DefaultInputBundlesV6.SetInputs(); + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode4][1][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode4][2][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode4][3][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode4][4][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode5][1][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode5][2][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode5][3][0].Data = VirtualKey.Space; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode5][4][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode5][5][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode6][1][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode6][2][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode6][3][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode6][4][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode6][5][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode6][6][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][1][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][2][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][3][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][4][0].Data = VirtualKey.Space; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][5][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][6][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode7][7][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][1][0].Data = VirtualKey.A; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][2][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][3][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][4][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][5][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][6][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][7][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode8][8][0].Data = (VirtualKey)186; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][1][0].Data = VirtualKey.A; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][2][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][3][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][4][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][5][0].Data = VirtualKey.Space; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][6][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][7][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][8][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][9][0].Data = (VirtualKey)186; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][1][1].Data = VirtualKey.NumberPad7; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][2][1].Data = VirtualKey.NumberPad8; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][3][1].Data = VirtualKey.NumberPad9; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][4][1].Data = VirtualKey.NumberPad4; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][5][1].Data = VirtualKey.NumberPad5; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][6][1].Data = VirtualKey.NumberPad6; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][7][1].Data = VirtualKey.NumberPad1; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][8][1].Data = VirtualKey.NumberPad2; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode9][9][1].Data = VirtualKey.NumberPad3; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][1][0].Data = VirtualKey.LeftShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][1][1].Data = VirtualKey.RightShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][2][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][3][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][4][0].Data = VirtualKey.Space; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][5][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode51][6][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][1][0].Data = VirtualKey.LeftShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][1][1].Data = VirtualKey.RightShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][2][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][3][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][4][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][5][0].Data = VirtualKey.Space; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][6][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][7][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode71][8][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][1][0].Data = VirtualKey.LeftShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][2][0].Data = VirtualKey.Z; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][3][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][4][0].Data = VirtualKey.X; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][5][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][6][0].Data = VirtualKey.C; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][7][0].Data = (VirtualKey)188; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][8][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][9][0].Data = (VirtualKey)190; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][10][0].Data = (VirtualKey)186; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][11][0].Data = (VirtualKey)191; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode102][12][0].Data = VirtualKey.RightShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][1][0].Data = VirtualKey.LeftShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][2][0].Data = VirtualKey.Z; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][3][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][4][0].Data = VirtualKey.X; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][5][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][6][0].Data = VirtualKey.C; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][7][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][8][0].Data = VirtualKey.V; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][9][0].Data = VirtualKey.M; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][10][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][11][0].Data = (VirtualKey)188; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][12][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][13][0].Data = (VirtualKey)190; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][14][0].Data = (VirtualKey)186; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][15][0].Data = (VirtualKey)191; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode142][16][0].Data = VirtualKey.RightShift; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][1][0].Data = VirtualKey.A; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][2][0].Data = VirtualKey.S; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][3][0].Data = VirtualKey.D; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][4][0].Data = VirtualKey.F; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][5][0].Data = VirtualKey.G; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][6][0].Data = VirtualKey.H; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][7][0].Data = VirtualKey.J; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][8][0].Data = VirtualKey.K; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][9][0].Data = VirtualKey.L; + DefaultInputBundlesV6.Inputs[(int)Component.InputMode.InputMode10][10][0].Data = (VirtualKey)186; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 68)) + { + WantLevelSystem = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 69)) + { + DataCount3 = false; + DetailedConfigure = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 72)) + { + UIPipelineJudgmentMain = true; + UIPipelineMainJudgmentMeter = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 73)) + { + AutoJudgmentMeterMillis = true; + AutoJudgmentMeterMillisItemValue = new() + { + Judged = Component.Judged.Highest + }; + JudgmentMeterMillis = 0.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 75)) + { + AllowTwilightComment = !QwilightComponent.IsVS; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 78)) + { + IsQwilightFill = false; + DefaultControllerInputAPI = DefaultControllerSystem.InputAPI.DefaultInput; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 96)) + { + InputWantNoteVariety = new bool[7]; + Array.Fill(InputWantNoteVariety, true); + InputWantHandled = new bool[7]; + Array.Fill(InputWantHandled, true); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 97)) + { + LastDefaultEntryItem = DefaultEntryItem.Total; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 101)) + { + LastEntryItemPositions = new(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 103)) + { + PassedTutorialIDs = new(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 104)) + { + Tube = false; + FitModeValue = new() + { + Mode = FitMode.Title + }; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 105)) + { + LowestAutoLongNoteModify = false; + HighestAutoLongNoteModify = false; + LowestAutoLongNoteModifyValue = 16.0; + HighestAutoLongNoteModifyValue = 16.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 107)) + { + LastWASAPIAudioValueID = 0; + LastASIOAudioValueID = 0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 109)) + { + ModeComponentBundles = new ModeComponentBundle[] + { + new(), + new(), + new() + { + Name = "LR2 EZ", + Value = new() + { + JudgmentModeValue = ModeComponent.JudgmentMode.Favor, + HitPointsModeValue = ModeComponent.HitPointsMode.Favor, + FavorJudgments = new double[6][] + { + new double[] { -21.0, 21.0 }, + new double[] { -40.5, 40.5 }, + new double[] { -60.0, 60.0 }, + new double[] { -120.0, 120.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + FavorHitPoints = new double[6][] + { + new double[] { 120.0, 0.0 }, + new double[] { 120.0, 0.0 }, + new double[] { 120.0, 0.0 }, + new double[] { 60.0, 0.0 }, + new double[] { 0.0, -4.8 }, + new double[] { 0.0, -3.2 } + } + } + }, + new() + { + Name = "LR2 NM", + Value = new() + { + JudgmentModeValue = ModeComponent.JudgmentMode.Favor, + HitPointsModeValue = ModeComponent.HitPointsMode.Favor, + FavorJudgments = new double[6][] + { + new double[] { -18.0, 18.0 }, + new double[] { -29.0, 29.0 }, + new double[] { -40.0, 40.0 }, + new double[] { -100.0, 100.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + FavorHitPoints = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -6.0 }, + new double[] { 0.0, -4.0 } + } + } + }, + new() + { + Name = "LR2 HD", + Value = new() + { + JudgmentModeValue = ModeComponent.JudgmentMode.Favor, + HitPointsModeValue = ModeComponent.HitPointsMode.Favor, + FavorJudgments = new double[6][] + { + new double[] { -15.0, 15.0 }, + new double[] { -22.5, 22.5 }, + new double[] { -30.0, 30.0 }, + new double[] { -60.0, 60.0 }, + new double[] { -200.0, 200.0 }, + new double[] { -1000.0, 200.0 } + }, + FavorHitPoints = new double[6][] + { + new double[] { 0.0, 0.1 }, + new double[] { 0.0, 0.1 }, + new double[] { 0.0, 0.1 }, + new double[] { 0.0, 0.05 }, + new double[] { 0.0, -10.0 }, + new double[] { 0.0, -6.0 } + } + } + }, + new() + { + Name = "BEATORAJA EZ", + Value = new() + { + JudgmentModeValue = ModeComponent.JudgmentMode.Favor, + HitPointsModeValue = ModeComponent.HitPointsMode.Favor, + FavorJudgments = new double[6][] + { + new double[] { -20.0, 20.0 }, + new double[] { -40.0, 40.0 }, + new double[] { -60.0, 60.0 }, + new double[] { -150.0, 150.0 }, + new double[] { -220.0, 280.0 }, + new double[] { -500.0, 280.0 } + }, + FavorHitPoints = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -1.0 }, + new double[] { 0.0, -2.0 } + } + } + }, + new() + { + Name = "BEATORAJA NM", + Value = new() + { + JudgmentModeValue = ModeComponent.JudgmentMode.Favor, + HitPointsModeValue = ModeComponent.HitPointsMode.Favor, + FavorJudgments = new double[6][] + { + new double[] { -15.0, 15.0 }, + new double[] { -30.0, 30.0 }, + new double[] { -45.0, 45.0 }, + new double[] { -112.5, 112.5 }, + new double[] { -275.0, 350.0 }, + new double[] { -500.0, 350.0 } + }, + FavorHitPoints = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -1.0 }, + new double[] { 0.0, -3.0 } + } + } + }, + new() + { + Name = "BEATORAJA HD", + Value = new() + { + JudgmentModeValue = ModeComponent.JudgmentMode.Favor, + HitPointsModeValue = ModeComponent.HitPointsMode.Favor, + FavorJudgments = new double[6][] + { + new double[] { -10.0, 10.0 }, + new double[] { -20.0, 20.0 }, + new double[] { -30.0, 30.0 }, + new double[] { -75.0, 75.0 }, + new double[] { -330.0, 420.0 }, + new double[] { -500.0, 420.0 } + }, + FavorHitPoints = new double[6][] + { + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 100.0, 0.0 }, + new double[] { 50.0, 0.0 }, + new double[] { 0.0, -2.0 }, + new double[] { 0.0, -6.0 } + } + } + }, + }; + FastInputMillis = 0.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 112)) + { + HandleMeter = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 115)) + { + SetHwMode = false; + LS = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 116)) + { + BaseUIConfigureValues = new() + { + { BaseUIItemValue.Title, new BaseUIConfigure() } + }; + UIConfigureValuesV2 = new() + { + { UIItemValue.Title, new UIConfigure() } + }; + DInputIIDXSensitivity = 1000.0 / 7; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 117)) + { + WantBannedValue = WantBanned.NotBanned; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 119)) + { + var rawHwMode = new DEVMODEW(); + PInvoke.EnumDisplaySettings(null, ENUM_DISPLAY_SETTINGS_MODE.ENUM_CURRENT_SETTINGS, ref rawHwMode); + HwModeV2Value = new(rawHwMode.dmPelsWidth, rawHwMode.dmPelsHeight, rawHwMode.dmDisplayFrequency); + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 120)) + { + TVAssistConfigure = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 126)) + { + Averager = false; + UbuntuNetItemTarget = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 14, 127)) + { + FlowNetItem = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 15, 3)) + { + ModeComponentValue = new(); + } + if (isInit || Utility.IsLowerDate(Date, 1, 15, 5)) + { + DefaultAudioVarietyValue = DefaultAudioVariety.UI; + DefaultAudioFilePath = string.Empty; + DefaultDrawingFilePath = string.Empty; + VeilDrawingFilePath = string.Empty; + VeilDrawingHeight = 0.0; + } + if (isInit || Utility.IsLowerDate(Date, 1, 15, 6)) + { + DefaultInputBundlesV6.SetStandardInputs(); + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.LowerMultiplier].Data = VirtualKey.F3; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.HigherMultiplier].Data = VirtualKey.F4; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.ModifyAutoMode].Data = VirtualKey.F1; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.Undo].Data = VirtualKey.Tab; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.Media].Data = VirtualKey.F2; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.LowerAudioMultiplier].Data = (VirtualKey)189; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.HigherAudioMultiplier].Data = (VirtualKey)187; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.PostItem0].Data = VirtualKey.V; + DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.PostItem1].Data = VirtualKey.N; + } + if (isInit || Utility.IsLowerDate(Date, 1, 16, 0)) + { + AutoNVLLFramerate = false; + } + if (isInit || Utility.IsLowerDate(Date, 1, 16, 3)) + { + MainAreaFaint = 1.0; + MediaInputFaint = 1.0; + UIPipelineJudgmentInputVisualizer = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 16, 5)) + { + InitColors(2); + BanalFailedMedia = false; + AlwaysBanalFailedMedia = false; + BanalFailedMediaFilePath = string.Empty; + BanalAudioWait = 0.0; + BanalAudio = false; + BanalMedia = false; + AlwaysBanalMedia = false; + BanalMediaFilePath = string.Empty; + BanalAudioFilePath = Path.Combine(QwilightComponent.UIEntryPath, "Default.wav"); + BanalMediaWait = 0.0; + AutoGetDefaultNote = true; + AutoGetDefaultUI = true; + } + if (isInit || Utility.IsLowerDate(Date, 1, 16, 6)) + { + LoadedMedia = true; + } + if (!UIConfigureValuesV2.ContainsKey(UIItemValue.Title)) + { + UIConfigureValuesV2[UIItemValue.Title] = new(); + } + if (!BaseUIConfigureValues.ContainsKey(BaseUIItemValue.Title)) + { + BaseUIConfigureValues[BaseUIItemValue.Title] = new(); + } + SetFontFamily(); + Date = QwilightComponent.Date; + if (isInit) + { + NotifyModel(); + } + } + + public void UndoEqualizers(int level) + { + if ((level & 1) == 1) + { + Equalizer0 = 0F; + Equalizer1 = 0F; + Equalizer2 = 0F; + Equalizer3 = 0F; + Equalizer4 = 0F; + } + if ((level & 2) == 2) + { + EqualizerHz0 = 90F; + EqualizerHz1 = 500F; + EqualizerHz2 = 3000F; + EqualizerHz3 = 5000F; + EqualizerHz4 = 8000F; + } + } + + public double GetAudioVisualizerModifier(double audioVisualizerHeight, double value) => AudioVisualizerModeValue switch + { + AudioVisualizerMode.AudioVisualizerMode0 => 0.0, + AudioVisualizerMode.AudioVisualizerMode1 => (audioVisualizerHeight - value) / 2, + AudioVisualizerMode.AudioVisualizerMode2 => audioVisualizerHeight - value, + _ => default + }; + + public override void NotifyModel() + { + base.NotifyModel(); + UIConfigureValue.NotifyModel(); + BaseUIConfigureValue.NotifyModel(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/Configure/GPUConfigure.cs b/Qwilight/Qwilight/System/Configure/GPUConfigure.cs new file mode 100644 index 0000000..ad6b046 --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/GPUConfigure.cs @@ -0,0 +1,83 @@ +using Qwilight.Utilities; +using System.IO; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Qwilight +{ + public class GPUConfigure : Model + { + public enum GPUMode + { + Default, NVIDIA + } + + public static readonly GPUConfigure Instance = new(); + + static readonly string _fileName = Path.Combine(QwilightComponent.QwilightEntryPath, "GPU Configure.json"); + static readonly string _faultFileName = Path.ChangeExtension(_fileName, ".json.$"); + static readonly string _tmp0FileName = Path.ChangeExtension(_fileName, ".json.tmp.0"); + static readonly string _tmp1FileName = Path.ChangeExtension(_fileName, ".json.tmp.1"); + + public void Load() + { + Utility.WipeFile(_tmp0FileName); + Utility.MoveFile(_tmp1FileName, _fileName); + try + { + if (File.Exists(_fileName)) + { + LoadImpl(); + Validate(false); + } + else + { + Validate(true); + } + } + catch (Exception e) + { + GPUConfigureFault = $"Failed to Validate GPU Configure ({e.Message})"; + Validate(true); + Utility.MoveFile(_fileName, _faultFileName); + } + + void LoadImpl() + { + var textConfigure = Utility.GetJSON(File.ReadAllText(_fileName, Encoding.UTF8)); + foreach (var value in typeof(GPUConfigure).GetProperties().Where(value => value.GetCustomAttributes(typeof(JsonIgnoreAttribute), false).Length == 0 && value.CanWrite)) + { + value.SetValue(this, value.GetValue(textConfigure)); + } + } + } + + public Version Date { get; set; } + + public GPUMode GPUModeValue { get; set; } + + [JsonIgnore] + public string GPUConfigureFault { get; set; } + + public void Save() + { + Utility.CopyFile(_fileName, _tmp0FileName); + Utility.MoveFile(_tmp0FileName, _tmp1FileName); + Utility.SaveText(_fileName, Utility.SetJSON(this, new JsonSerializerOptions + { + WriteIndented = QwilightComponent.IsVS + })); + Utility.WipeFile(_tmp1FileName); + } + + public void Validate(bool isUndo) + { + if (isUndo || Utility.IsLowerDate(Date, 1, 16, 2)) + { + GPUModeValue = GPUMode.Default; + } + Date = QwilightComponent.Date; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/Configure/InputBundle.cs b/Qwilight/Qwilight/System/Configure/InputBundle.cs new file mode 100644 index 0000000..087c2e4 --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/InputBundle.cs @@ -0,0 +1,41 @@ +namespace Qwilight +{ + public sealed class InputBundle where T : new() + { + public T[][][] Inputs { get; set; } + + public T[] StandardInputs { get; set; } + + public InputBundle() + { + SetInputs(); + SetStandardInputs(); + } + + public void SetInputs() + { + Inputs = new T[17][][]; + for (var i = Inputs.Length - 1; i >= 0; --i) + { + Inputs[i] = new T[Component.InputCounts[i] + 1][]; + for (var j = Inputs[i].Length - 1; j >= 0; --j) + { + Inputs[i][j] = new T[5]; + for (var m = Inputs[i][j].Length - 1; m >= 0; --m) + { + Inputs[i][j][m] = new T(); + } + } + } + } + + public void SetStandardInputs() + { + StandardInputs = new T[typeof(T) != typeof(DefaultInput) ? 10 : 9]; + for (var i = StandardInputs.Length - 1; i >= 0; --i) + { + StandardInputs[i] = new T(); + } + } + } +} diff --git a/Qwilight/Qwilight/System/Configure/ModeComponentBundle.cs b/Qwilight/Qwilight/System/Configure/ModeComponentBundle.cs new file mode 100644 index 0000000..3e4b1dd --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/ModeComponentBundle.cs @@ -0,0 +1,16 @@ +namespace Qwilight +{ + public sealed class ModeComponentBundle : Model + { + string _valueName; + + public string Name + { + get => _valueName; + + set => SetProperty(ref _valueName, value, nameof(Name)); + } + + public ModeComponent Value { get; set; } = new ModeComponent(); + } +} diff --git a/Qwilight/Qwilight/System/Configure/UIConfigure.cs b/Qwilight/Qwilight/System/Configure/UIConfigure.cs new file mode 100644 index 0000000..c6e9b56 --- /dev/null +++ b/Qwilight/Qwilight/System/Configure/UIConfigure.cs @@ -0,0 +1,155 @@ +using Qwilight.ViewModel; +using System.Text.Json.Serialization; + +namespace Qwilight +{ + public sealed class UIConfigure : Model + { + double _mainFaint = 1.0; + double _mediaFaint = 1.0; + double _netItemFaint = 1.0; + double _audioVisualizerFaint = 0.1; + double _judgmentMainPosition1; + double _noteWait; + double _bandPosition; + + public string[] UIConfiguresV2 { get; set; } = new string[UI.HighestUIConfigure]; + + public double MainFaintV2 + { + get => _mainFaint; + + set => SetProperty(ref _mainFaint, value, nameof(MainFaintV2)); + } + + public double MediaFaintV2 + { + get => _mediaFaint; + + set => SetProperty(ref _mediaFaint, value, nameof(MediaFaintV2)); + } + + public double NetItemFaintV2 + { + get => _netItemFaint; + + set => SetProperty(ref _netItemFaint, value, nameof(NetItemFaintV2)); + } + + public double AudioVisualizerFaintV2 + { + get => _audioVisualizerFaint; + + set => SetProperty(ref _audioVisualizerFaint, value, nameof(AudioVisualizerFaintV2)); + } + + public double JudgmentMainPosition1V2 + { + get => _judgmentMainPosition1; + + set + { + if (SetProperty(ref _judgmentMainPosition1, value, nameof(JudgmentMainPosition1V2))) + { + OnPropertyChanged(nameof(JudgmentMainPosition1Contents)); + } + } + } + + public string JudgmentMainPosition1Contents => JudgmentMainPosition1V2.ToString(LanguageSystem.Instance.PointLevelContents); + + public double NoteWait + { + get => _noteWait; + + set + { + if (SetProperty(ref _noteWait, value, nameof(NoteWait))) + { + OnPropertyChanged(nameof(NoteWaitContents)); + } + } + } + + public string NoteWaitContents => NoteWait.ToString(LanguageSystem.Instance.PointLevelContents); + + public Dictionary MainPositionValues { get; set; } = new(); + + [JsonIgnore] + public double MainPosition + { + get => MainPositionValues.TryGetValue((int)InputMode, out var mainPosition) ? mainPosition : 0.0; + + set + { + MainPositionValues[(int)InputMode] = value; + OnPropertyChanged(nameof(MainPosition)); + OnPropertyChanged(nameof(MainPositionContents)); + } + } + + public string MainPositionContents => MainPosition.ToString(LanguageSystem.Instance.PointLevelContents); + + public Dictionary NoteLengthText { get; set; } = new(); + + [JsonIgnore] + public double NoteLength + { + get => NoteLengthText.TryGetValue((int)InputMode, out var noteLength) ? noteLength : 0.0; + + set + { + NoteLengthText[(int)InputMode] = value; + OnPropertyChanged(nameof(NoteLength)); + OnPropertyChanged(nameof(NoteLengthContents)); + } + } + + public string NoteLengthContents => NoteLength.ToString(LanguageSystem.Instance.PointLevelContents); + + public Dictionary NoteHeightValue { get; set; } = new(); + + [JsonIgnore] + public double NoteHeight + { + get => NoteHeightValue.TryGetValue((int)InputMode, out var noteHeight) ? noteHeight : 0.0; + + set + { + NoteHeightValue[(int)InputMode] = value; + OnPropertyChanged(nameof(NoteHeight)); + OnPropertyChanged(nameof(NoteHeightContents)); + } + } + + public string NoteHeightContents => NoteHeight.ToString(LanguageSystem.Instance.PointLevelContents); + + public Component.InputMode InputMode => ViewModels.Instance.MainValue.GetHandlingComputing()?.InputMode ?? default; + + public double BandPositionV2 + { + get => _bandPosition; + + set + { + if (SetProperty(ref _bandPosition, value, nameof(BandPositionV2))) + { + OnPropertyChanged(nameof(BandPositionContents)); + } + } + } + + public string BandPositionContents => BandPositionV2.ToString(LanguageSystem.Instance.PointLevelContents); + + public void NotifyInputMode() + { + OnPropertyChanged(nameof(MainPosition)); + OnPropertyChanged(nameof(MainPositionContents)); + OnPropertyChanged(nameof(NoteLength)); + OnPropertyChanged(nameof(NoteLengthContents)); + OnPropertyChanged(nameof(NoteHeight)); + OnPropertyChanged(nameof(NoteHeightContents)); + OnPropertyChanged(nameof(InputMode)); + } + } +} diff --git a/Qwilight/Qwilight/System/ControllerSystem/ControllerSystem.cs b/Qwilight/Qwilight/System/ControllerSystem/ControllerSystem.cs new file mode 100644 index 0000000..1914e6e --- /dev/null +++ b/Qwilight/Qwilight/System/ControllerSystem/ControllerSystem.cs @@ -0,0 +1,1320 @@ +using Qwilight.Compute; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.IO; +using Vortice.DirectInput; +using Vortice.XInput; +using Windows.System.Power; +using GamepadButtons = Windows.Gaming.Input.GamepadButtons; +using GamepadReading = Windows.Gaming.Input.GamepadReading; +using GamepadVibration = Windows.Gaming.Input.GamepadVibration; +using RawGameController = Windows.Gaming.Input.RawGameController; + +namespace Qwilight +{ + public sealed class ControllerSystem : Model + { + public enum DInputControllerVariety + { + BMS, IIDX + } + + public enum VibrationMode + { + Not, Input, Failed + } + + public enum InputAPI + { + DInput, XInput, WGI + } + + sealed class DInputIDEquality : IEqualityComparer + { + public static readonly IEqualityComparer Default = new DInputIDEquality(); + + public bool Equals(DeviceInstance x, DeviceInstance y) => x.InstanceGuid == y.InstanceGuid; + + public int GetHashCode(DeviceInstance obj) => obj.InstanceGuid.GetHashCode(); + } + + sealed class DInputEquality : IEqualityComparer + { + public static readonly IEqualityComparer Default = new DInputEquality(); + + public bool Equals(IDirectInputDevice8 x, IDirectInputDevice8 y) => x.DeviceInfo.InstanceGuid == y.DeviceInfo.InstanceGuid; + + public int GetHashCode(IDirectInputDevice8 obj) => obj.DeviceInfo.InstanceGuid.GetHashCode(); + } + + public static readonly ControllerSystem Instance = QwilightComponent.GetBuiltInData(nameof(ControllerSystem)); + + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(ControllerSystem)); + + readonly HandlingController _handlingControllerDInput = new HandlingController(rawInput => ViewModels.Instance.InputValue.OnDInputLower(rawInput), rawInput => ViewModels.Instance.InputStandardControllerValue.OnDInputLower(rawInput), DefaultCompute.InputFlag.Controller); + readonly HandlingController _handlingControllerXInput = new HandlingController(rawInput => ViewModels.Instance.InputValue.OnXInputLower(rawInput), rawInput => ViewModels.Instance.InputStandardControllerValue.OnXInputLower(rawInput), DefaultCompute.InputFlag.Controller); + readonly HandlingController _handlingControllerWGI = new HandlingController(rawInput => ViewModels.Instance.InputValue.OnWGILower(rawInput), rawInput => ViewModels.Instance.InputStandardControllerValue.OnWGILower(rawInput), DefaultCompute.InputFlag.Controller); + double _failedVibration; + + public string[] Controllers { get; set; } = Array.Empty(); + + public string MainControllerPower { get; set; } + + public string LastControllerInput { get; set; } + + public void Vibrate() => _failedVibration = 125.0; + + public string ControllerContents => string.Join(", ", Controllers); + + public string ControllerCountContents => string.Format(LanguageSystem.Instance.ControllerCountContents, Controllers.Length); + + public void Init() + { + _handlingControllerDInput.Init(); + _handlingControllerXInput.Init(); + _handlingControllerWGI.Init(); + } + + public void HandleSystem(nint handle) + { + var mainViewModel = ViewModels.Instance.MainValue; + + #region DInput + IDirectInput8 dInputSystem = null; + + var lastDInputControllerIDs = new List(); + var lastValues = new Dictionary>(); + var lastXyzHwDInputs = new Dictionary>(); + var hwIDs = new Dictionary(); + var dInputControllers = new List(); + var dInputXyzHandler = Stopwatch.StartNew(); + var lastDInputXyzMillis = new Dictionary(); + var onHandleDInput1000 = new Action(() => + { + var dInputs = dInputSystem.GetDevices(DeviceClass.GameControl, DeviceEnumerationFlags.AttachedOnly); + if (Utility.IsItemsEqual(dInputs, lastDInputControllerIDs, DInputIDEquality.Default) == false) + { + lock (dInputControllers) + { + Utility.SetUICollection(dInputControllers, dInputs.Select(dInputControllerID => + { + var dInputController = dInputSystem.CreateDevice(dInputControllerID.InstanceGuid); + dInputController.SetCooperativeLevel(handle, CooperativeLevel.NonExclusive | CooperativeLevel.Foreground); + dInputController.SetDataFormat(); + dInputController.Properties.BufferSize = 16; + lastValues[dInputController] = new(); + lastXyzHwDInputs[dInputController] = new(); + hwIDs[dInputController] = dInputControllerID.InstanceGuid.ToString(); + return dInputController; + }).ToArray(), dInputController => dInputController.Dispose(), null, null, DInputEquality.Default); + Controllers = dInputs.Select(dInput => dInput.InstanceName).ToArray(); + OnPropertyChanged(nameof(Controllers)); + OnPropertyChanged(nameof(ControllerContents)); + OnPropertyChanged(nameof(ControllerCountContents)); + lastDInputControllerIDs.Clear(); + lastDInputControllerIDs.AddRange(dInputs); + } + } + }); + var onHandleDInput = new Action(() => + { + lock (dInputControllers) + { + foreach (var dInputController in dInputControllers) + { + if (Configure.Instance.DInputControllerVarietyValue == DInputControllerVariety.IIDX) + { + if (dInputXyzHandler.GetMillis() - lastDInputXyzMillis.GetValueOrDefault(dInputController, 0.0) > Configure.Instance.DInputIIDXSensitivity) + { + foreach (var lastHwDInput in lastXyzHwDInputs[dInputController].Values) + { + _handlingControllerDInput.Input(lastHwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + } + lastXyzHwDInputs[dInputController].Clear(); + } + } + foreach (var data in Utility.GetInputData(dInputController)) + { + if (ViewModels.Instance.ConfigureValue.IsOpened) + { + LastControllerInput = $"{nameof(data.Offset)}: {data.Offset}, {nameof(data.RawOffset)}: {data.RawOffset}, {nameof(data.Value)}: {data.Value}"; + OnPropertyChanged(nameof(LastControllerInput)); + } + var o = data.Offset; + var value = data.Value; + var hwID = hwIDs[dInputController]; + switch (o) + { + case JoystickOffset.X: + case JoystickOffset.RotationX: + case JoystickOffset.VelocityX: + case JoystickOffset.AngularVelocityX: + case JoystickOffset.AccelerationX: + case JoystickOffset.AngularAccelerationX: + case JoystickOffset.ForceX: + case JoystickOffset.TorqueX: + case JoystickOffset.Y: + case JoystickOffset.RotationY: + case JoystickOffset.VelocityY: + case JoystickOffset.AngularVelocityY: + case JoystickOffset.AccelerationY: + case JoystickOffset.AngularAccelerationY: + case JoystickOffset.ForceY: + case JoystickOffset.TorqueY: + case JoystickOffset.Z: + case JoystickOffset.RotationZ: + case JoystickOffset.VelocityZ: + case JoystickOffset.AngularVelocityZ: + case JoystickOffset.AccelerationZ: + case JoystickOffset.AngularAccelerationZ: + case JoystickOffset.ForceZ: + case JoystickOffset.TorqueZ: + lastValues[dInputController].TryGetValue(o, out var lastValue); + switch (Configure.Instance.DInputControllerVarietyValue) + { + case DInputControllerVariety.BMS: + var targetValue = 16383 * Configure.Instance.DInputXyzSensitivityV2 / 100; + if (0 <= value && value <= targetValue && lastValue > value) + { + var hwDInput = new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }; + if (!lastXyzHwDInputs[dInputController].TryGetValue(o, out var lastHwDInput) || hwDInput != lastHwDInput) + { + if (lastHwDInput.Data != default) + { + _handlingControllerDInput.Input(lastHwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + } + _handlingControllerDInput.Input(hwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + lastXyzHwDInputs[dInputController][o] = hwDInput; + } + } + else if (65535 - targetValue <= value && value <= 65535 && lastValue < value) + { + var hwDInput = new HwDInput + { + Data = o, + Value = 65535, + HwID = hwID + }; + if (!lastXyzHwDInputs[dInputController].TryGetValue(o, out var lastHwDInput) || hwDInput != lastHwDInput) + { + if (lastHwDInput.Data != default) + { + _handlingControllerDInput.Input(lastHwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + } + _handlingControllerDInput.Input(hwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + lastXyzHwDInputs[dInputController][o] = hwDInput; + } + } + else + { + if (lastValue < value) + { + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + lastXyzHwDInputs[dInputController].Remove(o); + } + else if (lastValue > value) + { + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 65535, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + lastXyzHwDInputs[dInputController].Remove(o); + } + } + break; + case DInputControllerVariety.IIDX: + if ((lastValue > value && lastValue != 65535) || (lastValue == 0 && value == 65535)) + { + var hwDInput = new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }; + if (!lastXyzHwDInputs[dInputController].TryGetValue(o, out var lastHwDInput) || hwDInput != lastHwDInput) + { + if (lastHwDInput.Data != default) + { + _handlingControllerDInput.Input(lastHwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + } + _handlingControllerDInput.Input(hwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + lastXyzHwDInputs[dInputController][o] = hwDInput; + } + lastDInputXyzMillis[dInputController] = dInputXyzHandler.GetMillis(); + } + else if ((lastValue < value && lastValue != 0) || (lastValue == 65535 && value == 0)) + { + var hwDInput = new HwDInput + { + Data = o, + Value = 65535, + HwID = hwID + }; + if (!lastXyzHwDInputs[dInputController].TryGetValue(o, out var lastHwDInput) || hwDInput != lastHwDInput) + { + if (lastHwDInput.Data != default) + { + _handlingControllerDInput.Input(lastHwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + } + _handlingControllerDInput.Input(hwDInput, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + lastXyzHwDInputs[dInputController][o] = hwDInput; + } + lastDInputXyzMillis[dInputController] = dInputXyzHandler.GetMillis(); + } + break; + } + lastValues[dInputController][o] = value; + break; + case JoystickOffset.PointOfViewControllers0: + case JoystickOffset.PointOfViewControllers1: + case JoystickOffset.PointOfViewControllers2: + case JoystickOffset.PointOfViewControllers3: + switch (value) + { + case 0: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 4500: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 9000: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 13500: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 18000: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 22500: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 27000: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case 31500: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, true); + break; + case -1: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 0, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 9000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 18000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 27000, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, false); + break; + } + break; + default: + _handlingControllerDInput.Input(new HwDInput + { + Data = o, + Value = 128, + HwID = hwID + }, Configure.Instance.DInputBundlesV4.StandardInputs, Configure.Instance.DInputBundlesV4.Inputs, value == 128); + break; + } + } + } + } + }); + #endregion + + #region XInput + var lastXInputs = new List(); + var mainXInputLower0 = new[] { Vortice.XInput.GamepadButtons.DPadDown.ToString(), Vortice.XInput.GamepadButtons.DPadLeft.ToString(), Vortice.XInput.GamepadButtons.DPadRight.ToString(), Vortice.XInput.GamepadButtons.DPadUp.ToString(), Vortice.XInput.GamepadButtons.LeftShoulder.ToString(), Vortice.XInput.GamepadButtons.LeftThumb.ToString(), Vortice.XInput.GamepadButtons.Back.ToString(), "+LT", "-LTX", "-LTY", "+LTX", "+LTY" }; + var mainXInputLower1 = new[] { Vortice.XInput.GamepadButtons.A.ToString(), Vortice.XInput.GamepadButtons.B.ToString(), Vortice.XInput.GamepadButtons.X.ToString(), Vortice.XInput.GamepadButtons.Y.ToString(), Vortice.XInput.GamepadButtons.RightShoulder.ToString(), Vortice.XInput.GamepadButtons.RightThumb.ToString(), Vortice.XInput.GamepadButtons.Start.ToString(), "+RT", "-RTX", "-RTY", "+RTX", "+RTY" }; + var targetXInputControllers = new List(); + var mainXInputLowerValues = new Dictionary>(); + var lastXInputInputs = new Dictionary(); + var lastXInputVibrations = new Dictionary(); + var onHandleXInput1000 = new Action(() => + { + var targetXInputs = Enumerable.Range(0, 4).Where(targetXInput => XInput.GetCapabilities(targetXInput, DeviceQueryType.Gamepad, out _)).ToArray(); + if (Utility.IsItemsEqual(targetXInputs, lastXInputs) == false) + { + lock (targetXInputControllers) + { + Utility.SetUICollection(targetXInputControllers, targetXInputs, null, targetXInput => + { + mainXInputLowerValues[targetXInput] = new(); + lastXInputInputs[targetXInput] = default; + lastXInputVibrations[targetXInput] = default; + }); + Controllers = targetXInputs.Select(targetXInput => XInput.GetCapabilities(0, DeviceQueryType.Gamepad, out var targetXInputCapabilities) ? targetXInputCapabilities.SubType.ToString() : string.Empty).ToArray(); + OnPropertyChanged(nameof(Controllers)); + OnPropertyChanged(nameof(ControllerContents)); + OnPropertyChanged(nameof(ControllerCountContents)); + lastXInputs.Clear(); + lastXInputs.AddRange(targetXInputs); + } + } + }); + var onHandleXInput = new Action(() => + { + lock (targetXInputControllers) + { + foreach (var targetXInputController in targetXInputControllers) + { + var mainXInputLower = mainXInputLowerValues[targetXInputController]; + var lastInput = lastXInputInputs[targetXInputController]; + var lastVibration = lastXInputVibrations[targetXInputController]; + XInput.GetState(targetXInputController, out var data); + if (ViewModels.Instance.ConfigureValue.IsOpened) + { + LastControllerInput = $"{nameof(data.Gamepad.Buttons)}: {data.Gamepad.Buttons}, LT: {data.Gamepad.LeftTrigger}, RT: {data.Gamepad.RightTrigger}, LTX: {data.Gamepad.LeftThumbX}, LTY: {data.Gamepad.LeftThumbY}, RTX: {data.Gamepad.RightThumbX}, RTY: {data.Gamepad.RightThumbY}"; + OnPropertyChanged(nameof(LastControllerInput)); + } + if (lastInput.PacketNumber < data.PacketNumber) + { + for (var i = 1; i < 65535; i <<= 1) + { + var distance = ((ushort)lastInput.Gamepad.Buttons & i) - ((ushort)data.Gamepad.Buttons & i); + if (distance == i) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + Buttons = (Vortice.XInput.GamepadButtons)i + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + mainXInputLower.Remove(((Vortice.XInput.GamepadButtons)i).ToString()); + } + else if (distance == -i) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + Buttons = (Vortice.XInput.GamepadButtons)i + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + mainXInputLower.Add(((Vortice.XInput.GamepadButtons)i).ToString()); + } + } + if (data.Gamepad.LeftTrigger == 0 && lastInput.Gamepad.LeftTrigger > data.Gamepad.LeftTrigger && mainXInputLower.Remove("+LT")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftTrigger = byte.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + else if (data.Gamepad.LeftTrigger == byte.MaxValue && lastInput.Gamepad.LeftTrigger < data.Gamepad.LeftTrigger && mainXInputLower.Add("+LT")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftTrigger = byte.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + if (data.Gamepad.RightTrigger == 0 && lastInput.Gamepad.RightTrigger > data.Gamepad.RightTrigger && mainXInputLower.Remove("+RT")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightTrigger = byte.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + else if (data.Gamepad.RightTrigger == byte.MaxValue && lastInput.Gamepad.RightTrigger < data.Gamepad.RightTrigger && mainXInputLower.Add("+RT")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightTrigger = byte.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + if (data.Gamepad.LeftThumbX == short.MinValue) + { + if (lastInput.Gamepad.LeftThumbX > data.Gamepad.LeftThumbX && mainXInputLower.Add("-LTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbX = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else if (data.Gamepad.LeftThumbX == short.MaxValue) + { + if (lastInput.Gamepad.LeftThumbX < data.Gamepad.LeftThumbX && mainXInputLower.Add("+LTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbX = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else + { + if (lastInput.Gamepad.LeftThumbX < data.Gamepad.LeftThumbX && mainXInputLower.Remove("-LTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbX = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + else if (lastInput.Gamepad.LeftThumbX > data.Gamepad.LeftThumbX && mainXInputLower.Remove("+LTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbX = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + } + if (data.Gamepad.LeftThumbY == short.MinValue) + { + if (lastInput.Gamepad.LeftThumbY > data.Gamepad.LeftThumbY && mainXInputLower.Add("-LTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbY = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else if (data.Gamepad.LeftThumbY == short.MaxValue) + { + if (lastInput.Gamepad.LeftThumbY < data.Gamepad.LeftThumbY && mainXInputLower.Add("+LTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbY = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else + { + if (lastInput.Gamepad.LeftThumbY < data.Gamepad.LeftThumbY && mainXInputLower.Remove("-LTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbY = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + else if (lastInput.Gamepad.LeftThumbY > data.Gamepad.LeftThumbY && mainXInputLower.Remove("+LTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + LeftThumbY = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + } + if (data.Gamepad.RightThumbX == short.MinValue) + { + if (lastInput.Gamepad.RightThumbX > data.Gamepad.RightThumbX && mainXInputLower.Add("-RTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbX = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else if (data.Gamepad.RightThumbX == short.MaxValue) + { + if (lastInput.Gamepad.RightThumbX < data.Gamepad.RightThumbX && mainXInputLower.Add("+RTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbX = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else + { + if (lastInput.Gamepad.RightThumbX < data.Gamepad.RightThumbX && mainXInputLower.Remove("-RTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbX = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + else if (lastInput.Gamepad.RightThumbX > data.Gamepad.RightThumbX && mainXInputLower.Remove("+RTX")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbX = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + } + if (data.Gamepad.RightThumbY == short.MinValue) + { + if (lastInput.Gamepad.RightThumbY > data.Gamepad.RightThumbY && mainXInputLower.Add("-RTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbY = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else if (data.Gamepad.RightThumbY == short.MaxValue) + { + if (lastInput.Gamepad.RightThumbY < data.Gamepad.RightThumbY && mainXInputLower.Add("+RTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbY = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, true); + } + } + else + { + if (lastInput.Gamepad.RightThumbY < data.Gamepad.RightThumbY && mainXInputLower.Remove("-RTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbY = short.MinValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + else if (lastInput.Gamepad.RightThumbY > data.Gamepad.RightThumbY && mainXInputLower.Remove("+RTY")) + { + _handlingControllerXInput.Input(new HwXInput + { + Data = new Gamepad + { + RightThumbY = short.MaxValue + } + }, Configure.Instance.XInputBundlesV4.StandardInputs, Configure.Instance.XInputBundlesV4.Inputs, false); + } + } + lastXInputInputs[targetXInputController] = data; + } + Vibration vibration = default; + switch (Configure.Instance.VibrationModeValue) + { + case VibrationMode.Input: + foreach (var mainXInput in mainXInputLower) + { + vibration = new Vibration(mainXInputLower0.Contains(mainXInput) ? (ushort)(ushort.MaxValue * Configure.Instance.Vibration0) : (ushort)0, mainXInputLower1.Contains(mainXInput) ? (ushort)(ushort.MaxValue * Configure.Instance.Vibration1) : (ushort)0); + } + break; + case VibrationMode.Failed: + if (_failedVibration > 0) + { + vibration = new Vibration((ushort)(ushort.MaxValue * Configure.Instance.Vibration0), (ushort)(ushort.MaxValue * Configure.Instance.Vibration1)); + } + break; + } + if (vibration.LeftMotorSpeed != lastVibration.LeftMotorSpeed || vibration.RightMotorSpeed != lastVibration.RightMotorSpeed) + { + XInput.SetVibration(targetXInputController, vibration); + lastXInputVibrations[targetXInputController] = vibration; + } + if (MainControllerPower == null) + { + var mainControllerPower = XInput.GetBatteryInformation(targetXInputController, BatteryDeviceType.Gamepad); + MainControllerPower = string.Format(mainControllerPower.BatteryType switch + { + BatteryType.Alkaline => LanguageSystem.Instance.Power00, + BatteryType.Disconnected => LanguageSystem.Instance.Power01, + BatteryType.Nimh => LanguageSystem.Instance.Power02, + BatteryType.Unknown => LanguageSystem.Instance.Power03, + BatteryType.Wired => LanguageSystem.Instance.Power04, + _ => default + }, mainControllerPower.BatteryLevel switch + { + BatteryLevel.Low => (200.0 / 3), + BatteryLevel.Medium => (100.0 / 3), + BatteryLevel.Full => 100.0, + BatteryLevel.Empty => 0.0, + _ => default + }); + } + } + if (_failedVibration > 0.0) + { + _failedVibration -= 1000.0 / Configure.Instance.LoopUnit; + } + } + }); + #endregion + + #region WGI + var lastWGIs = new List<(string, Windows.Gaming.Input.Gamepad)>(); + var mainWGILower0 = new[] { GamepadButtons.DPadDown.ToString(), GamepadButtons.DPadLeft.ToString(), GamepadButtons.DPadRight.ToString(), GamepadButtons.DPadUp.ToString(), GamepadButtons.LeftShoulder.ToString(), GamepadButtons.LeftThumbstick.ToString(), GamepadButtons.Menu.ToString(), "-LTX", "-LTY", "+LTX", "+LTY" }; + var mainWGILower1 = new[] { GamepadButtons.A.ToString(), GamepadButtons.B.ToString(), GamepadButtons.X.ToString(), GamepadButtons.Y.ToString(), GamepadButtons.RightShoulder.ToString(), GamepadButtons.RightThumbstick.ToString(), GamepadButtons.View.ToString(), "-RTX", "-RTY", "+RTX", "+RTY" }; + const string mainWGILower2 = "+LT"; + const string mainWGILower3 = "+RT"; + var mainWGILowerValues = new Dictionary>(); + var lastWGIInputs = new Dictionary(); + var lastWGIVibrations = new Dictionary(); + var targetWGIControllers = new List(); + var onHandleWGI1000 = new Action(() => + { + var targetWGIs = RawGameController.RawGameControllers.Select(targetWGI => (targetWGI.DisplayName, Windows.Gaming.Input.Gamepad.FromGameController(targetWGI))).Where(targetWGI => targetWGI.Item2 != null).ToList(); + if (Utility.IsItemsEqual(targetWGIs, lastWGIs) == false) + { + lock (targetWGIControllers) + { + Utility.SetUICollection(targetWGIControllers, targetWGIs.Select(targetWGI => targetWGI.Item2).ToArray(), null, targetWGI => + { + mainWGILowerValues[targetWGI] = new(); + lastWGIInputs[targetWGI] = default; + lastWGIVibrations[targetWGI] = default; + }); + Controllers = targetWGIs.Select(targetWGI => targetWGI.DisplayName).ToArray(); + OnPropertyChanged(nameof(Controllers)); + OnPropertyChanged(nameof(ControllerContents)); + OnPropertyChanged(nameof(ControllerCountContents)); + lastWGIs.Clear(); + lastWGIs.AddRange(targetWGIs); + } + } + }); + var onHandleWGI = new Action(() => + { + lock (targetWGIControllers) + { + foreach (var targetWGIController in targetWGIControllers) + { + var mainWGILower = mainWGILowerValues[targetWGIController]; + var lastInput = lastWGIInputs[targetWGIController]; + var lastVibration = lastWGIVibrations[targetWGIController]; + var data = targetWGIController.GetCurrentReading(); + if (ViewModels.Instance.ConfigureValue.IsOpened) + { + LastControllerInput = $"{nameof(data.Buttons)}: {data.Buttons}, LT: {Math.Round(data.LeftTrigger, 3)}, RT: {Math.Round(data.RightTrigger, 3)}, LTX: {Math.Round(data.LeftThumbstickX, 3)}, LTY: {Math.Round(data.LeftThumbstickY, 3)}, RTX: {Math.Round(data.RightThumbstickX, 3)}, RTY: {Math.Round(data.RightThumbstickY, 3)}"; + OnPropertyChanged(nameof(LastControllerInput)); + } + for (var i = 1; i < 262143; i <<= 1) + { + var d = ((ushort)lastInput.Buttons & i) - ((ushort)data.Buttons & i); + if (d == i) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + Buttons = (GamepadButtons)i + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + mainWGILower.Remove(((GamepadButtons)i).ToString()); + } + else if (d == -i) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + Buttons = (GamepadButtons)i + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + mainWGILower.Add(((GamepadButtons)i).ToString()); + } + } + if (data.LeftTrigger == 0.0 && lastInput.LeftTrigger > data.LeftTrigger && mainWGILower.Remove("+LT")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftTrigger = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + else if (data.LeftTrigger == 1.0 && lastInput.LeftTrigger < data.LeftTrigger && mainWGILower.Add("+LT")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftTrigger = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + if (data.RightTrigger == 0.0 && lastInput.RightTrigger > data.RightTrigger && mainWGILower.Remove("+RT")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightTrigger = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + else if (data.RightTrigger == 1.0 && lastInput.RightTrigger < data.RightTrigger && mainWGILower.Add("+RT")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightTrigger = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + if (data.LeftThumbstickX == -1.0) + { + if (lastInput.LeftThumbstickX > data.LeftThumbstickX && mainWGILower.Add("-LTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickX = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else if (data.LeftThumbstickX == 1.0) + { + if (lastInput.LeftThumbstickX < data.LeftThumbstickX && mainWGILower.Add("+LTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickX = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else + { + if (lastInput.LeftThumbstickX < data.LeftThumbstickX && mainWGILower.Remove("-LTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickX = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + else if (lastInput.LeftThumbstickX > data.LeftThumbstickX && mainWGILower.Remove("+LTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickX = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + } + if (data.LeftThumbstickY == -1.0) + { + if (lastInput.LeftThumbstickY > data.LeftThumbstickY && mainWGILower.Add("-LTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickY = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else if (data.LeftThumbstickY == 1.0) + { + if (lastInput.LeftThumbstickY < data.LeftThumbstickY && mainWGILower.Add("+LTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickY = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else + { + if (lastInput.LeftThumbstickY < data.LeftThumbstickY && mainWGILower.Remove("-LTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickY = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + else if (lastInput.LeftThumbstickY > data.LeftThumbstickY && mainWGILower.Remove("+LTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + LeftThumbstickY = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + } + if (data.RightThumbstickX == -1.0) + { + if (lastInput.RightThumbstickX > data.RightThumbstickX && mainWGILower.Add("-RTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickX = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else if (data.RightThumbstickX == 1.0) + { + if (lastInput.RightThumbstickX < data.RightThumbstickX && mainWGILower.Add("+RTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickX = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else + { + if (lastInput.RightThumbstickX < data.RightThumbstickX && mainWGILower.Remove("-RTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickX = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + else if (lastInput.RightThumbstickX > data.RightThumbstickX && mainWGILower.Remove("+RTX")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickX = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + } + if (data.RightThumbstickY == -1.0) + { + if (lastInput.RightThumbstickY > data.RightThumbstickY && mainWGILower.Add("-RTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickY = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else if (data.RightThumbstickY == 1.0) + { + if (lastInput.RightThumbstickY < data.RightThumbstickY && mainWGILower.Add("+RTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickY = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, true); + } + } + else + { + if (lastInput.RightThumbstickY < data.RightThumbstickY && mainWGILower.Remove("-RTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickY = -1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + else if (lastInput.RightThumbstickY > data.RightThumbstickY && mainWGILower.Remove("+RTY")) + { + _handlingControllerWGI.Input(new WGI + { + Data = new GamepadReading + { + RightThumbstickY = 1.0 + } + }, Configure.Instance.WGIBundlesV3.StandardInputs, Configure.Instance.WGIBundlesV3.Inputs, false); + } + } + lastWGIInputs[targetWGIController] = data; + GamepadVibration vibration = default; + switch (Configure.Instance.VibrationModeValue) + { + case VibrationMode.Input: + foreach (var mainWGI in mainWGILower) + { + if (mainWGILower0.Contains(mainWGI)) + { + vibration.LeftMotor = Configure.Instance.Vibration0; + } + if (mainWGILower1.Contains(mainWGI)) + { + vibration.RightMotor = Configure.Instance.Vibration1; + } + switch (mainWGI) + { + case mainWGILower2: + vibration.LeftTrigger = Configure.Instance.Vibration2; + break; + case mainWGILower3: + vibration.RightTrigger = Configure.Instance.Vibration3; + break; + } + } + break; + case VibrationMode.Failed: + if (_failedVibration > 0) + { + vibration.LeftMotor = Configure.Instance.Vibration0; + vibration.RightMotor = Configure.Instance.Vibration1; + vibration.LeftTrigger = Configure.Instance.Vibration2; + vibration.RightTrigger = Configure.Instance.Vibration3; + } + break; + } + if (vibration.LeftMotor != lastVibration.LeftMotor || vibration.RightMotor != lastVibration.RightMotor || vibration.LeftTrigger != lastVibration.LeftTrigger || vibration.RightTrigger != lastVibration.RightTrigger) + { + targetWGIController.Vibration = vibration; + lastWGIVibrations[targetWGIController] = vibration; + } + if (MainControllerPower == null) + { + var mainControllerPower = targetWGIController.TryGetBatteryReport(); + if (mainControllerPower != null) + { + MainControllerPower = string.Format(mainControllerPower.Status switch + { + BatteryStatus.Charging => LanguageSystem.Instance.Power10, + BatteryStatus.Discharging => LanguageSystem.Instance.Power11, + BatteryStatus.Idle => LanguageSystem.Instance.Power12, + BatteryStatus.NotPresent => LanguageSystem.Instance.Power13, + _ => default + }, 100.0 * mainControllerPower.RemainingCapacityInMilliwattHours / mainControllerPower.FullChargeCapacityInMilliwattHours); + } + } + } + if (_failedVibration > 0.0) + { + _failedVibration -= 1000.0 / Configure.Instance.LoopUnit; + } + } + }); + #endregion + + while (true) + { + try + { + switch (Configure.Instance.ControllerInputAPI) + { + case InputAPI.DInput: + try + { + using (dInputSystem = DInput.DirectInput8Create()) + { + while (Configure.Instance.ControllerInputAPI == InputAPI.DInput) + { + _handlingControllerDInput.HandleLooping(dInputControllers.Count > 0, onHandleDInput1000, onHandleDInput); + } + } + } + finally + { + lock (dInputControllers) + { + lastDInputControllerIDs.Clear(); + lastValues.Clear(); + lastXyzHwDInputs.Clear(); + hwIDs.Clear(); + dInputControllers.Clear(); + } + } + break; + case InputAPI.XInput: + try + { + while (Configure.Instance.ControllerInputAPI == InputAPI.XInput) + { + _handlingControllerXInput.HandleLooping(targetXInputControllers.Count > 0, onHandleXInput1000, onHandleXInput); + } + } + finally + { + lock (targetXInputControllers) + { + foreach (var targetXInputController in targetXInputControllers) + { + XInput.SetVibration(targetXInputController, new Vibration()); + } + lastXInputs.Clear(); + targetXInputControllers.Clear(); + mainXInputLowerValues.Clear(); + lastXInputInputs.Clear(); + lastXInputVibrations.Clear(); + } + } + break; + case InputAPI.WGI: + try + { + while (Configure.Instance.ControllerInputAPI == InputAPI.WGI) + { + _handlingControllerWGI.HandleLooping(targetWGIControllers.Count > 0, onHandleWGI1000, onHandleWGI); + } + } + finally + { + lock (targetWGIControllers) + { + foreach (var targetWGIController in targetWGIControllers) + { + targetWGIController.Vibration = new GamepadVibration(); + } + lastWGIs.Clear(); + mainWGILowerValues.Clear(); + lastWGIInputs.Clear(); + lastWGIVibrations.Clear(); + targetWGIControllers.Clear(); + } + } + break; + } + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + finally + { + Controllers = Array.Empty(); + OnPropertyChanged(nameof(Controllers)); + OnPropertyChanged(nameof(ControllerContents)); + OnPropertyChanged(nameof(ControllerCountContents)); + + Init(); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/ControllerSystem/HwDInput.cs b/Qwilight/Qwilight/System/ControllerSystem/HwDInput.cs new file mode 100644 index 0000000..c432ba8 --- /dev/null +++ b/Qwilight/Qwilight/System/ControllerSystem/HwDInput.cs @@ -0,0 +1,134 @@ +using Vortice.DirectInput; + +namespace Qwilight +{ + public struct HwDInput : IEquatable + { + public JoystickOffset? Data { get; set; } + + public int Value { get; set; } + + public string HwID { get; set; } + + public override bool Equals(object obj) => obj is HwDInput hwDInput && Equals(hwDInput); + + public bool Equals(HwDInput other) => Data == other.Data && Value == other.Value && HwID == other.HwID; + + public override int GetHashCode() => HashCode.Combine(Data, Value, HwID); + + public override string ToString() + { + switch (Data) + { + case JoystickOffset.X: + case JoystickOffset.RotationX: + case JoystickOffset.VelocityX: + case JoystickOffset.AngularVelocityX: + case JoystickOffset.AccelerationX: + case JoystickOffset.AngularAccelerationX: + case JoystickOffset.ForceX: + case JoystickOffset.TorqueX: + case JoystickOffset.Y: + case JoystickOffset.RotationY: + case JoystickOffset.VelocityY: + case JoystickOffset.AngularVelocityY: + case JoystickOffset.AccelerationY: + case JoystickOffset.AngularAccelerationY: + case JoystickOffset.ForceY: + case JoystickOffset.TorqueY: + case JoystickOffset.Z: + case JoystickOffset.RotationZ: + case JoystickOffset.VelocityZ: + case JoystickOffset.AngularVelocityZ: + case JoystickOffset.AccelerationZ: + case JoystickOffset.AngularAccelerationZ: + case JoystickOffset.ForceZ: + case JoystickOffset.TorqueZ: + var sign = this.Value > 32767 ? "+" : this.Value < 32511 ? "-" : null; + if (sign != null) + { + switch (Data) + { + case JoystickOffset.X: + case JoystickOffset.Y: + case JoystickOffset.Z: + return $"{sign}{Data}"; + case JoystickOffset.RotationX: + return $"{sign}RX"; + case JoystickOffset.VelocityX: + return $"{sign}VX"; + case JoystickOffset.AngularVelocityX: + return $"{sign}AVX"; + case JoystickOffset.AccelerationX: + return $"{sign}AX"; + case JoystickOffset.AngularAccelerationX: + return $"{sign}AAX"; + case JoystickOffset.ForceX: + return $"{sign}FX"; + case JoystickOffset.TorqueX: + return $"{sign}TX"; + case JoystickOffset.RotationY: + return $"{sign}RY"; + case JoystickOffset.VelocityY: + return $"{sign}VY"; + case JoystickOffset.AngularVelocityY: + return $"{sign}AVY"; + case JoystickOffset.AccelerationY: + return $"{sign}AY"; + case JoystickOffset.AngularAccelerationY: + return $"{sign}AAY"; + case JoystickOffset.ForceY: + return $"{sign}FY"; + case JoystickOffset.TorqueY: + return $"{sign}TY"; + case JoystickOffset.RotationZ: + return $"{sign}RZ"; + case JoystickOffset.VelocityZ: + return $"{sign}VZ"; + case JoystickOffset.AngularVelocityZ: + return $"{sign}AVZ"; + case JoystickOffset.AccelerationZ: + return $"{sign}AZ"; + case JoystickOffset.AngularAccelerationZ: + return $"{sign}AAZ"; + case JoystickOffset.ForceZ: + return $"{sign}FZ"; + case JoystickOffset.TorqueZ: + return $"{sign}TZ"; + } + } + break; + case JoystickOffset.PointOfViewControllers0: + case JoystickOffset.PointOfViewControllers1: + case JoystickOffset.PointOfViewControllers2: + case JoystickOffset.PointOfViewControllers3: + var value = this.Value / 9000; + switch (Data) + { + case JoystickOffset.PointOfViewControllers0: + return $"P0{value}"; + case JoystickOffset.PointOfViewControllers1: + return $"P1{value}"; + case JoystickOffset.PointOfViewControllers2: + return $"P2{value}"; + case JoystickOffset.PointOfViewControllers3: + return $"P3{value}"; + } + break; + case JoystickOffset.Sliders0: + case JoystickOffset.Sliders1: + case JoystickOffset.ForceSliders0: + case JoystickOffset.ForceSliders1: + case null: + break; + default: + return $"B{Data - JoystickOffset.Buttons0}"; + } + return string.Empty; + } + + public static bool operator ==(HwDInput left, HwDInput right) => left.Equals(right); + + public static bool operator !=(HwDInput left, HwDInput right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/ControllerSystem/HwXInput.cs b/Qwilight/Qwilight/System/ControllerSystem/HwXInput.cs new file mode 100644 index 0000000..2b8c5de --- /dev/null +++ b/Qwilight/Qwilight/System/ControllerSystem/HwXInput.cs @@ -0,0 +1,99 @@ +using Vortice.XInput; + +namespace Qwilight +{ + public struct HwXInput : IEquatable + { + public Gamepad Data { get; set; } + + public override bool Equals(object obj) => obj is HwXInput hwXInput && Equals(hwXInput); + + public bool Equals(HwXInput other) + { + return Data.Buttons == other.Data.Buttons && + Data.LeftTrigger == other.Data.LeftTrigger && + Data.RightTrigger == other.Data.RightTrigger && + Data.LeftThumbX == other.Data.LeftThumbX && + Data.LeftThumbY == other.Data.LeftThumbY && + Data.RightThumbX == other.Data.RightThumbX && + Data.RightThumbY == other.Data.RightThumbY; + } + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() + { + switch (Data.Buttons) + { + case GamepadButtons.A: + case GamepadButtons.B: + case GamepadButtons.Back: + case GamepadButtons.Start: + case GamepadButtons.X: + case GamepadButtons.Y: + return Data.Buttons.ToString(); + case GamepadButtons.DPadDown: + return "DPD"; + case GamepadButtons.DPadLeft: + return "DPL"; + case GamepadButtons.DPadRight: + return "DPR"; + case GamepadButtons.DPadUp: + return "DPU"; + case GamepadButtons.LeftShoulder: + return "LS"; + case GamepadButtons.LeftThumb: + return "LT"; + case GamepadButtons.RightShoulder: + return "RS"; + case GamepadButtons.RightThumb: + return "RT"; + } + if (Data.LeftTrigger > 0) + { + return "+LT"; + } + if (Data.RightTrigger > 0) + { + return "+RT"; + } + if (Data.LeftThumbX > 0) + { + return "+LTX"; + } + if (Data.LeftThumbX < 0) + { + return "-LTX"; + } + if (Data.LeftThumbY > 0) + { + return "+LTY"; + } + if (Data.LeftThumbY < 0) + { + return "-LTY"; + } + if (Data.RightThumbX > 0) + { + return "+RTX"; + } + if (Data.RightThumbX < 0) + { + return "-RTX"; + } + if (Data.RightThumbY > 0) + { + return "+RTY"; + } + if (Data.RightThumbY < 0) + { + return "-RTY"; + } + return default; + } + + public static bool operator ==(HwXInput left, HwXInput right) => left.Equals(right); + + public static bool operator !=(HwXInput left, HwXInput right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/ControllerSystem/WGI.cs b/Qwilight/Qwilight/System/ControllerSystem/WGI.cs new file mode 100644 index 0000000..38c51b1 --- /dev/null +++ b/Qwilight/Qwilight/System/ControllerSystem/WGI.cs @@ -0,0 +1,99 @@ +using Windows.Gaming.Input; + +namespace Qwilight +{ + public struct WGI : IEquatable + { + public GamepadReading Data { get; set; } + + public override bool Equals(object obj) => obj is WGI mWGI && Equals(mWGI); + + public bool Equals(WGI other) + { + return Data.Buttons == other.Data.Buttons && + Data.LeftTrigger == other.Data.LeftTrigger && + Data.RightTrigger == other.Data.RightTrigger && + Data.LeftThumbstickX == other.Data.LeftThumbstickX && + Data.LeftThumbstickY == other.Data.LeftThumbstickY && + Data.RightThumbstickX == other.Data.RightThumbstickX && + Data.RightThumbstickY == other.Data.RightThumbstickY; + } + + public override int GetHashCode() => HashCode.Combine(Data.Buttons, Data.LeftTrigger, Data.RightTrigger, Data.LeftThumbstickX, Data.LeftThumbstickY, Data.RightThumbstickX, Data.RightThumbstickY); + + public override string ToString() + { + switch (Data.Buttons) + { + case GamepadButtons.A: + case GamepadButtons.B: + case GamepadButtons.Menu: + case GamepadButtons.View: + case GamepadButtons.X: + case GamepadButtons.Y: + return Data.Buttons.ToString(); + case GamepadButtons.DPadDown: + return "DPD"; + case GamepadButtons.DPadLeft: + return "DPL"; + case GamepadButtons.DPadRight: + return "DPR"; + case GamepadButtons.DPadUp: + return "DPU"; + case GamepadButtons.LeftShoulder: + return "LS"; + case GamepadButtons.LeftThumbstick: + return "LT"; + case GamepadButtons.RightShoulder: + return "RS"; + case GamepadButtons.RightThumbstick: + return "RT"; + } + if (Data.LeftTrigger > 0) + { + return "+LT"; + } + if (Data.RightTrigger > 0) + { + return "+RT"; + } + if (Data.LeftThumbstickX > 0) + { + return "+LTX"; + } + if (Data.LeftThumbstickX < 0) + { + return "-LTX"; + } + if (Data.LeftThumbstickY > 0) + { + return "+LTY"; + } + if (Data.LeftThumbstickY < 0) + { + return "-LTY"; + } + if (Data.RightThumbstickX > 0) + { + return "+RTX"; + } + if (Data.RightThumbstickX < 0) + { + return "-RTX"; + } + if (Data.RightThumbstickY > 0) + { + return "+RTY"; + } + if (Data.RightThumbstickY < 0) + { + return "-RTY"; + } + return default; + } + + public static bool operator ==(WGI left, WGI right) => left.Equals(right); + + public static bool operator !=(WGI left, WGI right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DB.cs b/Qwilight/Qwilight/System/DB.cs new file mode 100644 index 0000000..e614894 --- /dev/null +++ b/Qwilight/Qwilight/System/DB.cs @@ -0,0 +1,1100 @@ +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Data.SQLite; +using System.IO; +using System.Security.Cryptography; + +namespace Qwilight +{ + public sealed class DB + { + public enum EventNoteVariety + { + Qwilight, MD5 + } + + static readonly string _fileName = Path.Combine(QwilightComponent.QwilightEntryPath, "DB.db"); + static readonly string _faultFileName = Path.ChangeExtension(_fileName, ".db.$"); + + public static readonly DB Instance = QwilightComponent.GetBuiltInData(nameof(DB)); + + SQLiteConnection _db; + + public string DBFault { get; set; } + + public void Load() + { + _db = new(new SQLiteConnectionStringBuilder + { + DataSource = _fileName + }.ToString()); + try + { + LoadImpl(); + } + catch (SQLiteException e) + { + DBFault = $"Failed to Validate DB ({e.Message})"; + _db.Close(); + Utility.MoveFile(_fileName, _faultFileName); + LoadImpl(); + } + + void LoadImpl() + { + _db.Open(); + + #region COMPATIBLE + Compatible.Compatible.DB(_db); + #endregion + + #region 데이터베이스 정보 + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS db_file ( + ID VARCHAR(137), + Value TEXT, + PRIMARY KEY (ID) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + #endregion + + var date = new Version(1, 0, 0); + using (var dbStatement = new SQLiteCommand(""" + SELECT Value + FROM db_file + WHERE ID = "date" + """, _db)) + { + using var rows = dbStatement.ExecuteReader(); + if (rows.Read()) + { + date = Version.Parse(rows["Value"] as string); + } + } + + #region 오프라인 기록 + if (Utility.IsLowerDate(date, 1, 16, 6)) + { + Ta(() => + { + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS tmp_comment ( + Date DATE, + Event_Note_ID TEXT, + Comment TEXT, + Name TEXT, + Multiplier REAL, + Auto_Mode INTEGER, + Note_Salt_Mode INTEGER, + Audio_Multiplier REAL, + Faint_Note_Mode INTEGER, + Judgment_Mode INTEGER, + Hit_Points_Mode INTEGER DEFAULT 1, + Note_Mobility_Mode INTEGER, + Long_Note_Mode INTEGER DEFAULT 0, + Input_Favor_Mode INTEGER DEFAULT 0, + Note_Modify_Mode INTEGER DEFAULT 0, + BPM_Mode INTEGER DEFAULT 0, + Wave_Mode INTEGER DEFAULT 0, + Set_Note_Mode INTEGER DEFAULT 0, + Lowest_Judgment_Condition_Mode INTEGER DEFAULT 0, + Stand INTEGER, + Band INTEGER, + Is_P INTEGER DEFAULT 0, + Point REAL, + Salt INTEGER, + Highest_Judgment_0 REAL DEFAULT 0.0, + Higher_Judgment_0 REAL DEFAULT 0.0, + High_Judgment_0 REAL DEFAULT 0.0, + Low_Judgment_0 REAL DEFAULT 0.0, + Lower_Judgment_0 REAL DEFAULT 0.0, + Lowest_Judgment_0 REAL DEFAULT 0.0, + Highest_Judgment_1 REAL DEFAULT 0.0, + Higher_Judgment_1 REAL DEFAULT 0.0, + High_Judgment_1 REAL DEFAULT 0.0, + Low_Judgment_1 REAL DEFAULT 0.0, + Lower_Judgment_1 REAL DEFAULT 0.0, + Lowest_Judgment_1 REAL DEFAULT 0.0, + Lowest_Long_Note_Modify REAL DEFAULT 100.0, + Highest_Long_Note_Modify REAL DEFAULT 100.0, + Put_Note_Set INTEGER DEFAULT 25, + Put_Note_Set_Millis REAL DEFAULT 0.0, + Highest_Hit_Points_0 REAL DEFAULT 0.0, + Higher_Hit_Points_0 REAL DEFAULT 0.0, + High_Hit_Points_0 REAL DEFAULT 0.0, + Low_Hit_Points_0 REAL DEFAULT 0.0, + Lower_Hit_Points_0 REAL DEFAULT 0.0, + Lowest_Hit_Points_0 REAL DEFAULT 0.0, + Highest_Hit_Points_1 REAL DEFAULT 0.0, + Higher_Hit_Points_1 REAL DEFAULT 0.0, + High_Hit_Points_1 REAL DEFAULT 0.0, + Low_Hit_Points_1 REAL DEFAULT 0.0, + Lower_Hit_Points_1 REAL DEFAULT 0.0, + Lowest_Hit_Points_1 REAL DEFAULT 0.0, + Note_ID VARCHAR(139), + Is_Paused INTEGER DEFAULT 0, + Input_Flags INTEGER DEFAULT 0, + CHECK (Multiplier >= 0.0) + CHECK (Auto_Mode IN(0, 1)) + CHECK (Note_Salt_Mode IN (0, 1, 2, 4, 11, 13)) + CHECK (Audio_Multiplier >= 0.5 AND Audio_Multiplier <= 2.0) + CHECK (Faint_Note_Mode IN (0, 1, 2, 3)) + CHECK (Judgment_Mode IN (0, 1, 2, 3, 4, 5, 6)) + CHECK (Hit_Points_Mode IN (0, 1, 2, 3, 4, 5, 6, 7)) + CHECK (Note_Mobility_Mode IN (0, 1, 3, 4, 5)) + CHECK (Long_Note_Mode IN (0, 1, 2, 3)) + CHECK (Input_Favor_Mode IN (0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) + CHECK (Note_Modify_Mode IN (0, 1, 2)) + CHECK (BPM_Mode IN (0, 1)) + CHECK (Lowest_Judgment_Condition_Mode IN (0, 1)) + CHECK (Wave_Mode IN (0, 1)) + CHECK (Set_Note_Mode IN (0, 1, 3)) + CHECK (Stand >= 0) + CHECK (Band >= 0) + CHECK (Is_P IN (0, 1)) + CHECK (Point >= 0.0 AND Point <= 1.0) + CHECK (Lowest_Long_Note_Modify >= 1.0 AND Lowest_Long_Note_Modify <= 1000.0) + CHECK (Highest_Long_Note_Modify >= 1.0 AND Highest_Long_Note_Modify <= 1000.0) + CHECK (Put_Note_Set >= 1 AND Put_Note_Set <= 100) + CHECK (Put_Note_Set_Millis >= 0.0 AND Put_Note_Set_Millis <= 1000.0) + CHECK (Is_Paused IN (0, 1)) + CHECK (Input_Flags >= 0 AND Input_Flags <= 15) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + if (Utility.IsLowerDate(date, 1, 14, 65)) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + else if (Utility.IsLowerDate(date, 1, 14, 105)) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment(Date, Event_Note_ID, Comment, Name, Multiplier, Auto_Mode, Note_Salt_Mode, Audio_Multiplier, Faint_Note_Mode, Judgment_Mode, Hit_Points_Mode, Note_Mobility_Mode, Long_Note_Mode, Input_Favor_Mode, Note_Modify_Mode, BPM_Mode, Wave_Mode, Set_Note_Mode, Lowest_Judgment_Condition_Mode, Stand, Band, Is_P, Point, Salt, Highest_Judgment_0, Higher_Judgment_0, High_Judgment_0, Low_Judgment_0, Lower_Judgment_0, Lowest_Judgment_0, Highest_Judgment_1, Higher_Judgment_1, High_Judgment_1, Low_Judgment_1, Lower_Judgment_1, Lowest_Judgment_1, Lowest_Long_Note_Modify, Put_Note_Set, Put_Note_Set_Millis, Highest_Hit_Points_0, Higher_Hit_Points_0, High_Hit_Points_0, Low_Hit_Points_0, Lower_Hit_Points_0, Lowest_Hit_Points_0, Highest_Hit_Points_1, Higher_Hit_Points_1, High_Hit_Points_1, Low_Hit_Points_1, Lower_Hit_Points_1, Lowest_Hit_Points_1, Note_ID) + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(@"UPDATE tmp_comment SET Highest_Long_Note_Modify = Lowest_Long_Note_Modify", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + else if (Utility.IsLowerDate(date, 1, 14, 115)) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + else if (Utility.IsLowerDate(date, 1, 14, 117)) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"DELETE + FROM comment + WHERE Note_Salt_Mode = 3 OR Note_Salt_Mode = 5 OR Note_Salt_Mode = 9 OR Note_Salt_Mode = 10 OR Note_Mobility_Mode = 2 OR Set_Note_Mode = 4 OR Set_Note_Mode = 5 OR Input_Favor_Mode = 1 OR Input_Favor_Mode = 2 OR Input_Favor_Mode = 3 OR Input_Favor_Mode = 17 OR Input_Favor_Mode = 18 OR Input_Favor_Mode = 19", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + else if (Utility.IsLowerDate(date, 1, 14, 123)) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment(Date, Event_Note_ID, Comment, Name, Multiplier, Auto_Mode, Note_Salt_Mode, Audio_Multiplier, Faint_Note_Mode, Judgment_Mode, Hit_Points_Mode, Note_Mobility_Mode, Long_Note_Mode, Input_Favor_Mode, Note_Modify_Mode, BPM_Mode, Wave_Mode, Set_Note_Mode, Lowest_Judgment_Condition_Mode, Stand, Band, Is_P, Point, Salt, Highest_Judgment_0, Higher_Judgment_0, High_Judgment_0, Low_Judgment_0, Lower_Judgment_0, Lowest_Judgment_0, Highest_Judgment_1, Higher_Judgment_1, High_Judgment_1, Low_Judgment_1, Lower_Judgment_1, Lowest_Judgment_1, Lowest_Long_Note_Modify, Highest_Long_Note_Modify, Put_Note_Set, Put_Note_Set_Millis, Highest_Hit_Points_0, Higher_Hit_Points_0, High_Hit_Points_0, Low_Hit_Points_0, Lower_Hit_Points_0, Lowest_Hit_Points_0, Highest_Hit_Points_1, Higher_Hit_Points_1, High_Hit_Points_1, Low_Hit_Points_1, Lower_Hit_Points_1, Lowest_Hit_Points_1, Note_ID) + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + else if (Utility.IsLowerDate(date, 1, 14, 124)) + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment(Date, Event_Note_ID, Comment, Name, Multiplier, Auto_Mode, Note_Salt_Mode, Audio_Multiplier, Faint_Note_Mode, Judgment_Mode, Hit_Points_Mode, Note_Mobility_Mode, Long_Note_Mode, Input_Favor_Mode, Note_Modify_Mode, BPM_Mode, Wave_Mode, Set_Note_Mode, Lowest_Judgment_Condition_Mode, Stand, Band, Is_P, Point, Salt, Highest_Judgment_0, Higher_Judgment_0, High_Judgment_0, Low_Judgment_0, Lower_Judgment_0, Lowest_Judgment_0, Highest_Judgment_1, Higher_Judgment_1, High_Judgment_1, Low_Judgment_1, Lower_Judgment_1, Lowest_Judgment_1, Lowest_Long_Note_Modify, Highest_Long_Note_Modify, Put_Note_Set, Put_Note_Set_Millis, Highest_Hit_Points_0, Higher_Hit_Points_0, High_Hit_Points_0, Low_Hit_Points_0, Lower_Hit_Points_0, Lowest_Hit_Points_0, Highest_Hit_Points_1, Higher_Hit_Points_1, High_Hit_Points_1, Low_Hit_Points_1, Lower_Hit_Points_1, Lowest_Hit_Points_1, Note_ID, Is_Paused) + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + else + { + if (HasTable("comment")) + { + using (var dbStatement = new SQLiteCommand(@"DELETE + FROM comment + WHERE Note_Salt_Mode = 6 OR Note_Salt_Mode = 7 OR Note_Salt_Mode = 8 OR Note_Salt_Mode = 12 OR Note_Salt_Mode = 14 OR Set_Note_Mode = 2", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO tmp_comment + SELECT * + FROM comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand("DROP TABLE comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + } + using (var dbStatement = new SQLiteCommand(@"ALTER TABLE tmp_comment + RENAME TO comment", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(@"CREATE INDEX IF NOT EXISTS _comment ON comment ( + Note_ID, + Event_Note_ID + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + }); + } + #endregion + + #region 디렉토리 내 노트 파일 번호 + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS entry ( + Entry_Path VARCHAR(260), + Note_Position INTEGER, + PRIMARY KEY (Entry_Path) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + #endregion + + #region 컬렉션 + if (Utility.IsLowerDate(date, 1, 14, 58)) + { + Ta(() => + { + if (HasTable("note")) + { + using (var dbStatement = new SQLiteCommand("DROP TABLE note", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS note ( + Note_ID VARCHAR(139), + Favorite_Entry TEXT + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(@"CREATE INDEX IF NOT EXISTS _note ON note ( + Note_ID + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + }); + } + #endregion + + #region 클리어 램프 + if (Utility.IsLowerDate(date, 1, 14, 58)) + { + Ta(() => + { + if (HasTable("handle")) + { + using (var dbStatement = new SQLiteCommand("DROP TABLE handle", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS handle ( + Note_ID VARCHAR(137), + Handled INTEGER, + PRIMARY KEY (Note_ID) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + }); + } + #endregion + + if (Utility.IsLowerDate(date, 1, 14, 63)) + { + var comments = new Dictionary(); + using (var dbStatement = new SQLiteCommand(@"SELECT Note_ID, Is_P, Hit_Points_Mode + FROM comment", _db)) + { + using var rows = dbStatement.ExecuteReader(); + while (rows.Read()) + { + var handledValue = comments.GetValueOrDefault(rows["Note_ID"] as string, BaseNoteFile.Handled.Not); + if (handledValue != BaseNoteFile.Handled.Band1) + { + if ((long)rows["Is_P"] > 0) + { + handledValue = BaseNoteFile.Handled.Band1; + } + else if ((ModeComponent.HitPointsMode)(int)(long)rows["Hit_Points_Mode"] == ModeComponent.HitPointsMode.Highest) + { + handledValue = BaseNoteFile.Handled.HighestClear; + } + else if ((ModeComponent.HitPointsMode)(int)(long)rows["Hit_Points_Mode"] == ModeComponent.HitPointsMode.Higher && handledValue != BaseNoteFile.Handled.HighestClear) + { + handledValue = BaseNoteFile.Handled.HigherClear; + } + else if (handledValue != BaseNoteFile.Handled.HigherClear && handledValue != BaseNoteFile.Handled.HighestClear) + { + handledValue = BaseNoteFile.Handled.Clear; + } + } + comments[rows["Note_ID"] as string] = handledValue; + } + } + foreach (var comment in comments) + { + using (var dbStatement = new SQLiteCommand(@"REPLACE + INTO handle + VALUES(@noteID, @handled)", _db)) + { + dbStatement.Parameters.AddWithValue("noteID", comment.Key); + dbStatement.Parameters.AddWithValue("handled", comment.Value); + dbStatement.ExecuteNonQuery(); + } + } + } + + #region 클리어 시간들 (플레이 카운트, 마지막 플레이 정렬) + if (Utility.IsLowerDate(date, 1, 14, 58)) + { + Ta(() => + { + if (HasTable("date")) + { + using (var dbStatement = new SQLiteCommand("DROP TABLE date", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS date ( + Note_ID VARCHAR(139), + Event_Note_ID TEXT, + Date DATE + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + using (var dbStatement = new SQLiteCommand(@"CREATE INDEX IF NOT EXISTS _date ON date ( + Note_ID, + Event_Note_ID + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + }); + } + #endregion + + if (Utility.IsLowerDate(date, 1, 14, 60)) + { + var comments = new List<(string, string, DateTime)>(); + using (var dbStatement = new SQLiteCommand(@"SELECT Note_ID, Event_Note_ID, Date + FROM comment", _db)) + { + using var rows = dbStatement.ExecuteReader(); + while (rows.Read()) + { + comments.Add((rows["Note_ID"] as string, rows["Event_Note_ID"] as string, (DateTime)rows["Date"])); + } + } + foreach (var comment in comments) + { + using (var dbStatement = new SQLiteCommand(@"INSERT + INTO date + VALUES(@noteID, @eventNoteID, @date)", _db)) + { + dbStatement.Parameters.AddWithValue("noteID", comment.Item1); + dbStatement.Parameters.AddWithValue("eventNoteID", comment.Item2); + dbStatement.Parameters.AddWithValue("date", comment.Item3); + dbStatement.ExecuteNonQuery(); + } + } + } + + #region 레이턴시, 동영상 + if (Utility.IsLowerDate(date, 1, 14, 58)) + { + Ta(() => + { + if (HasTable("wait")) + { + using (var dbStatement = new SQLiteCommand("DROP TABLE wait", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS wait ( + Note_ID VARCHAR(139), + Audio_Wait REAL, + Media_Wait REAL DEFAULT 0, + Media LONG DEFAULT 1, + CHECK (Audio_Wait >= -1000.0 AND Audio_Wait <= 1000.0) + CHECK (Media_Wait >= -1000.0 AND Media_Wait <= 1000.0) + CHECK (Media IN (0, 1)) + PRIMARY KEY (Note_ID) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + }); + } + #endregion + + #region 텍스트 인코딩 + if (Utility.IsLowerDate(date, 1, 14, 58)) + { + Ta(() => + { + if (HasTable("format")) + { + using (var dbStatement = new SQLiteCommand("DROP TABLE format", _db)) + { + dbStatement.ExecuteNonQuery(); + } + } + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS format ( + Note_ID VARCHAR(139), + Format LONG DEFAULT -1, + PRIMARY KEY (Note_ID) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + }); + } + #endregion + + #region 코스 + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS event_note ( + Event_Note_ID TEXT, + Name TEXT, + Date DATE, + Variety INTEGER DEFAULT 0, + PRIMARY KEY (Event_Note_ID, Variety) + CHECK (length(Event_Note_ID) > 0) + CHECK (Variety IN (0, 1)) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + #endregion + + #region 코스에 사용되는 임시 데이터 + using (var dbStatement = new SQLiteCommand(@"CREATE TABLE IF NOT EXISTS event_note_data ( + Note_ID VARCHAR(139), + Note_Variety INTEGER, + Title TEXT, + Artist TEXT, + Level INTEGER, + Level_Text TEXT, + Genre TEXT, + PRIMARY KEY (Note_ID) + )", _db)) + { + dbStatement.ExecuteNonQuery(); + } + #endregion + + using (var dbStatement = new SQLiteCommand(""" + REPLACE + INTO db_file + VALUES("date", @value) + """, _db)) + { + dbStatement.Parameters.AddWithValue("value", QwilightComponent.DateText); + dbStatement.ExecuteNonQuery(); + } + + bool HasTable(string tableName) + { + using var dbStatement = new SQLiteCommand(@"SELECT name + FROM sqlite_master + WHERE type = 'table' AND name = @tableName", _db); + dbStatement.Parameters.AddWithValue("tableName", tableName); + using var rows = dbStatement.ExecuteReader(); + return rows.Read(); + } + + void Ta(Action onHandle) + { + using var t = _db.BeginTransaction(); + try + { + onHandle(); + t.Commit(); + } + catch + { + t.Rollback(); + throw; + } + } + } + } + + public async ValueTask> GetCommentItems(BaseNoteFile noteFile, string eventNoteID, int noteFileCount) + { + var data = new List(); + using var dbStatement = new SQLiteCommand($""" + SELECT Date, Comment, Name, Multiplier, Auto_Mode, Note_Salt_Mode, Audio_Multiplier, Faint_Note_Mode, Judgment_Mode, Hit_Points_Mode, Note_Mobility_Mode, Long_Note_Mode, Input_Favor_Mode, Note_Modify_Mode, BPM_Mode, Wave_Mode, Set_Note_Mode, Lowest_Judgment_Condition_Mode, Stand, Band, Is_P, Point, Salt, Highest_Judgment_0, Higher_Judgment_0, High_Judgment_0, Low_Judgment_0, Lower_Judgment_0, Lowest_Judgment_0, Highest_Judgment_1, Higher_Judgment_1, High_Judgment_1, Low_Judgment_1, Lower_Judgment_1, Lowest_Judgment_1, Lowest_Long_Note_Modify, Highest_Long_Note_Modify, Put_Note_Set, Put_Note_Set_Millis, Highest_Hit_Points_0, Higher_Hit_Points_0, High_Hit_Points_0, Low_Hit_Points_0, Lower_Hit_Points_0, Lowest_Hit_Points_0, Highest_Hit_Points_1, Higher_Hit_Points_1, High_Hit_Points_1, Low_Hit_Points_1, Lower_Hit_Points_1, Lowest_Hit_Points_1, Is_Paused, Input_Flags + FROM comment + WHERE {(string.IsNullOrEmpty(eventNoteID) ? "Note_ID = @noteID" : "Event_Note_ID = @eventNoteID")} + ORDER BY Stand DESC + """, _db); + if (string.IsNullOrEmpty(eventNoteID)) + { + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + } + else + { + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + } + using var rows = await dbStatement.ExecuteReaderAsync(); + while (await rows.ReadAsync()) + { + var date = (DateTime)rows["Date"]; + var sentMultiplier = (double)rows["Multiplier"]; + var audioMultiplier = Math.Round((double)rows["Audio_Multiplier"], 2); + data.Add(new(string.Empty, (DefaultCompute.InputFlag)(long)rows["Input_Flags"]) + { + NoteFileCount = noteFileCount, + Date = date, + DateText = date.ToString("yyyy-MM-dd HH:mm:ss"), + CommentID = rows["Comment"] as string, + AvatarName = rows["Name"] as string, + ModeComponentValue = new() + { + CanModifyMultiplier = false, + CanModifyAudioMultiplier = false, + ComputingValue = noteFile, + SentMultiplier = sentMultiplier, + MultiplierValue = noteFile.BPM * audioMultiplier * sentMultiplier, + AutoModeValue = (ModeComponent.AutoMode)(long)rows["Auto_Mode"], + NoteSaltModeValue = (ModeComponent.NoteSaltMode)(long)rows["Note_Salt_Mode"], + AudioMultiplier = audioMultiplier, + FaintNoteModeValue = (ModeComponent.FaintNoteMode)(long)rows["Faint_Note_Mode"], + JudgmentModeValue = (ModeComponent.JudgmentMode)(long)rows["Judgment_Mode"], + HitPointsModeValue = (ModeComponent.HitPointsMode)(long)rows["Hit_Points_Mode"], + NoteMobilityModeValue = (ModeComponent.NoteMobilityMode)(long)rows["Note_Mobility_Mode"], + LongNoteModeValue = (ModeComponent.LongNoteMode)(long)rows["Long_Note_Mode"], + InputFavorModeValue = (ModeComponent.InputFavorMode)(long)rows["Input_Favor_Mode"], + NoteModifyModeValue = (ModeComponent.NoteModifyMode)(long)rows["Note_Modify_Mode"], + BPMModeValue = (ModeComponent.BPMMode)(long)rows["BPM_Mode"], + WaveModeValue = (ModeComponent.WaveMode)(long)rows["Wave_Mode"], + SetNoteModeValue = (ModeComponent.SetNoteMode)(long)rows["Set_Note_Mode"], + LowestJudgmentConditionModeValue = (ModeComponent.LowestJudgmentConditionMode)(long)rows["Lowest_Judgment_Condition_Mode"], + Salt = (int)(long)rows["Salt"], + HighestJudgment0 = (double)rows["Highest_Judgment_0"], + HigherJudgment0 = (double)rows["Higher_Judgment_0"], + HighJudgment0 = (double)rows["High_Judgment_0"], + LowJudgment0 = (double)rows["Low_Judgment_0"], + LowerJudgment0 = (double)rows["Lower_Judgment_0"], + LowestJudgment0 = (double)rows["Lowest_Judgment_0"], + HighestJudgment1 = (double)rows["Highest_Judgment_1"], + HigherJudgment1 = (double)rows["Higher_Judgment_1"], + HighJudgment1 = (double)rows["High_Judgment_1"], + LowJudgment1 = (double)rows["Low_Judgment_1"], + LowerJudgment1 = (double)rows["Lower_Judgment_1"], + LowestJudgment1 = (double)rows["Lowest_Judgment_1"], + LowestLongNoteModify = (double)rows["Lowest_Long_Note_Modify"], + HighestLongNoteModify = (double)rows["Highest_Long_Note_Modify"], + PutNoteSet = (int)(long)rows["Put_Note_Set"], + PutNoteSetMillis = (double)rows["Put_Note_Set_Millis"], + HighestHitPoints0 = 100.0 * (double)rows["Highest_Hit_Points_0"], + HigherHitPoints0 = 100.0 * (double)rows["Higher_Hit_Points_0"], + HighHitPoints0 = 100.0 * (double)rows["High_Hit_Points_0"], + LowHitPoints0 = 100.0 * (double)rows["Low_Hit_Points_0"], + LowerHitPoints0 = 100.0 * (double)rows["Lower_Hit_Points_0"], + LowestHitPoints0 = 100.0 * (double)rows["Lowest_Hit_Points_0"], + HighestHitPoints1 = 100.0 * (double)rows["Highest_Hit_Points_1"], + HigherHitPoints1 = 100.0 * (double)rows["Higher_Hit_Points_1"], + HighHitPoints1 = 100.0 * (double)rows["High_Hit_Points_1"], + LowHitPoints1 = 100.0 * (double)rows["Low_Hit_Points_1"], + LowerHitPoints1 = 100.0 * (double)rows["Lower_Hit_Points_1"], + LowestHitPoints1 = 100.0 * (double)rows["Lowest_Hit_Points_1"], + }, + Stand = (int)(long)rows["Stand"], + Band = (int)(long)rows["Band"], + IsP = (long)rows["Is_P"] > 0, + Point = (double)rows["Point"], + IsPaused = (long)rows["Is_Paused"] > 0 + }); + } + for (var i = data.Count - 1; i >= 0; --i) + { + data[i].CommentPlace0Text = $"#{i + 1}"; + data[i].CommentPlace1Text = $"/{data.Count}"; + } + return data; + } + + public async void SetEventNoteData(ICollection wwwLevelComputingValues) + { + foreach (var wwwLevelComputingValue in wwwLevelComputingValues) + { + var noteVariety = (BaseNoteFile.NoteVariety)wwwLevelComputingValue.NoteVarietyValue; + if (noteVariety != BaseNoteFile.NoteVariety.EventNote) + { + using var dbStatement = new SQLiteCommand(@"REPLACE + INTO event_note_data + VALUES(@noteID, @noteVariety, @title, @artist, @level, @levelText, @genre)", _db); + dbStatement.Parameters.AddWithValue("noteID", wwwLevelComputingValue.NoteID); + dbStatement.Parameters.AddWithValue("noteVariety", noteVariety); + dbStatement.Parameters.AddWithValue("title", wwwLevelComputingValue.Title); + dbStatement.Parameters.AddWithValue("artist", wwwLevelComputingValue.Artist); + dbStatement.Parameters.AddWithValue("level", wwwLevelComputingValue.LevelValue); + dbStatement.Parameters.AddWithValue("levelText", wwwLevelComputingValue.LevelText); + dbStatement.Parameters.AddWithValue("genre", wwwLevelComputingValue.Genre); + await dbStatement.ExecuteNonQueryAsync(); + } + } + } + + public void GetEventNoteData(string noteID, NotAvailableNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"SELECT Note_Variety, Title, Artist, Level, Level_Text, Genre + FROM event_note_data + WHERE Note_ID = @noteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteID); + using var rows = dbStatement.ExecuteReader(); + if (rows.Read()) + { + noteFile.NotAvailableNoteVarietyValue = (BaseNoteFile.NoteVariety)(long)rows["Note_Variety"]; + if (rows["Title"] != DBNull.Value) + { + noteFile.Title = rows["Title"] as string; + } + if (rows["Artist"] != DBNull.Value) + { + noteFile.Artist = rows["Artist"] as string; + } + noteFile.LevelValue = (BaseNoteFile.Level)(long)rows["Level"]; + if (rows["Level_Text"] != DBNull.Value) + { + noteFile.LevelText = rows["Level_Text"] as string; + } + if (rows["Genre"] != DBNull.Value) + { + noteFile.Genre = rows["Genre"] as string; + } + } + else + { + noteFile.NotAvailableNoteVarietyValue = BaseNoteFile.NoteVariety.EventNote; + noteFile.Title = new('❌', 1 + RandomNumberGenerator.GetInt32(10)); + noteFile.Artist = new('❌', 1 + RandomNumberGenerator.GetInt32(10)); + noteFile.LevelText = "❌"; + noteFile.Genre = new('❌', 1 + RandomNumberGenerator.GetInt32(10)); + } + } + + public ICollection GetFavoriteEntryItems(BaseNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"SELECT Favorite_Entry + FROM note + WHERE Note_ID = @noteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + using var rows = dbStatement.ExecuteReader(); + var favoriteEntryItems = new List(); + while (rows.Read()) + { + favoriteEntryItems.Add(new DefaultEntryItem + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Favorite, + DefaultEntryPath = rows["Favorite_Entry"] as string + }); + } + return favoriteEntryItems; + } + + public ICollection<(string, string, DateTime, EventNoteVariety)> GetEventNote() + { + using var dbStatement = new SQLiteCommand(@"SELECT Event_Note_ID, Name, Date, Variety + FROM event_note", _db); + using var rows = dbStatement.ExecuteReader(); + var eventNote = new List<(string, string, DateTime, EventNoteVariety)>(); + while (rows.Read()) + { + eventNote.Add((rows["Event_Note_ID"] as string, rows["Name"] as string, (DateTime)rows["Date"], (EventNoteVariety)(long)rows["Variety"])); + } + return eventNote; + } + + public BaseNoteFile.Handled GetHandled(BaseNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"SELECT Handled + FROM handle + WHERE Note_ID = @noteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + using var rows = dbStatement.ExecuteReader(); + return rows.Read() ? (BaseNoteFile.Handled)(long)rows["Handled"] : BaseNoteFile.Handled.Not; + } + + public async void SetHandled(BaseNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"REPLACE + INTO handle + VALUES(@noteID, @handled)", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + dbStatement.Parameters.AddWithValue("handled", noteFile.HandledValue); + await dbStatement.ExecuteNonQueryAsync(); + } + + public (DateTime?, int) GetDate(BaseNoteFile noteFile, string eventNoteID) + { + using var dbStatement = new SQLiteCommand(@"SELECT MAX(Date) AS Latest, COUNT(Date) AS Count + FROM date + WHERE Note_ID = @noteID OR Event_Note_ID = @eventNoteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile?.GetNoteID512()); + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + using var rows = dbStatement.ExecuteReader(); + rows.Read(); + var date = (null as DateTime?, 0); + if (rows["Latest"] != DBNull.Value) + { + date.Item1 = DateTime.Parse((string)rows["Latest"]); + } + if (rows["Count"] != DBNull.Value) + { + date.Item2 = (int)(long)rows["Count"]; + } + return date; + } + + public async void NewDate(BaseNoteFile noteFile, string eventNoteID, DateTime date) + { + using var dbStatement = new SQLiteCommand(@"INSERT + INTO date + VALUES(@noteID, @eventNoteID, @date)", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile?.GetNoteID512()); + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + dbStatement.Parameters.AddWithValue("date", date); + await dbStatement.ExecuteNonQueryAsync(); + } + + public int GetNotePosition(string entryPath) + { + using var dbStatement = new SQLiteCommand(@"SELECT Note_Position + FROM entry + WHERE Entry_Path = @entryPath", _db); + dbStatement.Parameters.AddWithValue("entryPath", entryPath); + using var rows = dbStatement.ExecuteReader(); + return rows.Read() ? (int)(long)rows["Note_Position"] : 0; + } + + public (double, double, bool?) GetWait(BaseNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"SELECT Audio_Wait, Media_Wait, Media + FROM wait + WHERE Note_ID = @noteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + using var rows = dbStatement.ExecuteReader(); + (double, double, bool?) data = (0.0, 0.0, default); + if (rows.Read()) + { + if (rows["Audio_Wait"] != DBNull.Value) + { + data.Item1 = (double)rows["Audio_Wait"]; + } + data.Item2 = (double)rows["Media_Wait"]; + if (rows["Media"] != DBNull.Value) + { + data.Item3 = (long)rows["Media"] > 0; + } + } + return data; + } + + public int GetFormat(BaseNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"SELECT Format + FROM format + WHERE Note_ID = @noteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + using var rows = dbStatement.ExecuteReader(); + return rows.Read() ? (int)(long)rows["Format"] : -1; + } + + public async void SetNotePosition(EntryItem entryItem) + { + using var dbStatement = new SQLiteCommand(@"REPLACE + INTO entry + VALUES(@entryPath, @notePosition)", _db); + dbStatement.Parameters.AddWithValue("entryPath", entryItem.EntryPath); + dbStatement.Parameters.AddWithValue("notePosition", entryItem.NotePosition); + await dbStatement.ExecuteNonQueryAsync(); + } + + public void SetFavoriteEntry(BaseNoteFile noteFile) + { + Ta(async () => + { + using (var dbStatement = new SQLiteCommand(@"DELETE + FROM note + WHERE Note_ID = @noteID", _db)) + { + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + await dbStatement.ExecuteNonQueryAsync(); + } + using (var dbStatement = new SQLiteCommand(@"REPLACE + INTO note + VALUES(@noteID, @favoriteEntry)", _db)) + { + foreach (var favoriteEntryItem in noteFile.FavoriteEntryItems) + { + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + dbStatement.Parameters.AddWithValue("favoriteEntry", favoriteEntryItem.DefaultEntryPath); + await dbStatement.ExecuteNonQueryAsync(); + } + } + }); + } + + public async void SetEventNote(string eventNoteID, string eventNoteName, DateTime date, EventNoteVariety eventNoteVariety) + { + using var dbStatement = new SQLiteCommand(@"INSERT INTO event_note + VALUES(@eventNoteID, @eventNoteName, @date, @eventNoteVariety)", _db); + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + dbStatement.Parameters.AddWithValue("eventNoteName", eventNoteName); + dbStatement.Parameters.AddWithValue("date", date); + dbStatement.Parameters.AddWithValue("eventNoteVariety", eventNoteVariety); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async ValueTask WipeEventNote(string eventNoteID) + { + using var dbStatement = new SQLiteCommand(@"DELETE + FROM event_note + WHERE Event_Note_ID = @eventNoteID", _db); + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void ModifyEventNoteName(string eventNoteID, string eventNoteName) + { + using var dbStatement = new SQLiteCommand(@"UPDATE event_note + SET Name = @eventNoteName + WHERE Event_Note_ID = @eventNoteID", _db); + dbStatement.Parameters.AddWithValue("eventNoteName", eventNoteName); + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void SaveComment(DateTime date, BaseNoteFile noteFile, string eventNoteID, string comment, string avatar, double multiplier, double audioMultiplier, ModeComponent modeComponentValue, int stand, int band, bool isP, double point, bool isPaused, DefaultCompute.InputFlag inputFlags) + { + using var dbStatement = new SQLiteCommand(@"INSERT + INTO comment + VALUES(@date, @eventNoteID, @comment, @avatar, @multiplier, @autoMode, @noteSaltMode, @audioMultiplier, @faintNoteMode, @judgmentMode, @hitPointsMode, @noteMobilityMode, @longNoteMode, @inputFavorMode, @noteModifyMode, @bpmMode, @waveMode, @setNoteMode, @lowestJudgmentConditionMode, @stand, @band, @isP, @point, @salt, @highestJudgment0, @higherJudgment0, @highJudgment0, @lowJudgment0, @lowerJudgment0, @lowestJudgment0, @highestJudgment1, @higherJudgment1, @highJudgment1, @lowJudgment1, @lowerJudgment1, @lowestJudgment1, @lowestLongNoteModify, @highestLongNoteModify, @putNoteSet, @putNoteSetMillis, @highestHitPoints0, @higherHitPoints0, @highHitPoints0, @lowHitPoints0, @lowerHitPoints0, @lowestHitPoints0, @highestHitPoints1, @higherHitPoints1, @highHitPoints1, @lowHitPoints1, @lowerHitPoints1, @lowestHitPoints1, @noteID, @isPaused, @inputFlags)", _db); + dbStatement.Parameters.AddWithValue("date", date); + dbStatement.Parameters.AddWithValue("eventNoteID", eventNoteID); + dbStatement.Parameters.AddWithValue("comment", comment); + dbStatement.Parameters.AddWithValue("avatar", avatar); + dbStatement.Parameters.AddWithValue("multiplier", multiplier); + dbStatement.Parameters.AddWithValue("autoMode", modeComponentValue.AutoModeValue); + dbStatement.Parameters.AddWithValue("noteSaltMode", modeComponentValue.NoteSaltModeValue); + dbStatement.Parameters.AddWithValue("audioMultiplier", audioMultiplier); + dbStatement.Parameters.AddWithValue("faintNoteMode", modeComponentValue.FaintNoteModeValue); + dbStatement.Parameters.AddWithValue("judgmentMode", modeComponentValue.JudgmentModeValue); + dbStatement.Parameters.AddWithValue("hitPointsMode", modeComponentValue.HandlingHitPointsModeValue); + dbStatement.Parameters.AddWithValue("noteMobilityMode", modeComponentValue.NoteMobilityModeValue); + dbStatement.Parameters.AddWithValue("longNoteMode", modeComponentValue.LongNoteModeValue); + dbStatement.Parameters.AddWithValue("inputFavorMode", modeComponentValue.InputFavorModeValue); + dbStatement.Parameters.AddWithValue("noteModifyMode", modeComponentValue.NoteModifyModeValue); + dbStatement.Parameters.AddWithValue("bpmMode", modeComponentValue.BPMModeValue); + dbStatement.Parameters.AddWithValue("waveMode", modeComponentValue.WaveModeValue); + dbStatement.Parameters.AddWithValue("setNoteMode", modeComponentValue.SetNoteModeValue); + dbStatement.Parameters.AddWithValue("lowestJudgmentConditionMode", modeComponentValue.LowestJudgmentConditionModeValue); + dbStatement.Parameters.AddWithValue("stand", stand); + dbStatement.Parameters.AddWithValue("band", band); + dbStatement.Parameters.AddWithValue("isP", isP); + dbStatement.Parameters.AddWithValue("point", point); + dbStatement.Parameters.AddWithValue("salt", modeComponentValue.Salt); + dbStatement.Parameters.AddWithValue("highestJudgment0", modeComponentValue.HighestJudgment0); + dbStatement.Parameters.AddWithValue("higherJudgment0", modeComponentValue.HigherJudgment0); + dbStatement.Parameters.AddWithValue("highJudgment0", modeComponentValue.HighJudgment0); + dbStatement.Parameters.AddWithValue("lowJudgment0", modeComponentValue.LowJudgment0); + dbStatement.Parameters.AddWithValue("lowerJudgment0", modeComponentValue.LowerJudgment0); + dbStatement.Parameters.AddWithValue("lowestJudgment0", modeComponentValue.LowestJudgment0); + dbStatement.Parameters.AddWithValue("highestJudgment1", modeComponentValue.HighestJudgment1); + dbStatement.Parameters.AddWithValue("higherJudgment1", modeComponentValue.HigherJudgment1); + dbStatement.Parameters.AddWithValue("highJudgment1", modeComponentValue.HighJudgment1); + dbStatement.Parameters.AddWithValue("lowJudgment1", modeComponentValue.LowJudgment1); + dbStatement.Parameters.AddWithValue("lowerJudgment1", modeComponentValue.LowerJudgment1); + dbStatement.Parameters.AddWithValue("lowestJudgment1", modeComponentValue.LowestJudgment1); + dbStatement.Parameters.AddWithValue("lowestLongNoteModify", modeComponentValue.LowestLongNoteModify); + dbStatement.Parameters.AddWithValue("highestLongNoteModify", modeComponentValue.HighestLongNoteModify); + dbStatement.Parameters.AddWithValue("putNoteSet", modeComponentValue.PutNoteSet); + dbStatement.Parameters.AddWithValue("putNoteSetMillis", modeComponentValue.PutNoteSetMillis); + dbStatement.Parameters.AddWithValue("highestHitPoints0", modeComponentValue.HighestHitPoints0 / 100.0); + dbStatement.Parameters.AddWithValue("higherHitPoints0", modeComponentValue.HigherHitPoints0 / 100.0); + dbStatement.Parameters.AddWithValue("highHitPoints0", modeComponentValue.HighHitPoints0 / 100.0); + dbStatement.Parameters.AddWithValue("lowHitPoints0", modeComponentValue.LowHitPoints0 / 100.0); + dbStatement.Parameters.AddWithValue("lowerHitPoints0", modeComponentValue.LowerHitPoints0 / 100.0); + dbStatement.Parameters.AddWithValue("lowestHitPoints0", modeComponentValue.LowestHitPoints0 / 100.0); + dbStatement.Parameters.AddWithValue("highestHitPoints1", modeComponentValue.HighestHitPoints1 / 100.0); + dbStatement.Parameters.AddWithValue("higherHitPoints1", modeComponentValue.HigherHitPoints1 / 100.0); + dbStatement.Parameters.AddWithValue("highHitPoints1", modeComponentValue.HighHitPoints1 / 100.0); + dbStatement.Parameters.AddWithValue("lowHitPoints1", modeComponentValue.LowHitPoints1 / 100.0); + dbStatement.Parameters.AddWithValue("lowerHitPoints1", modeComponentValue.LowerHitPoints1 / 100.0); + dbStatement.Parameters.AddWithValue("lowestHitPoints1", modeComponentValue.LowestHitPoints1 / 100.0); + dbStatement.Parameters.AddWithValue("noteID", noteFile?.GetNoteID512()); + dbStatement.Parameters.AddWithValue("isPaused", isPaused); + dbStatement.Parameters.AddWithValue("inputFlags", inputFlags); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void SetWait(BaseNoteFile noteFile, double audioWait, double mediaWait, bool media) + { + using var dbStatement = new SQLiteCommand(@"REPLACE + INTO wait + VALUES(@noteID, @audioWait, @mediaWait, @media)", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + dbStatement.Parameters.AddWithValue("audioWait", audioWait); + dbStatement.Parameters.AddWithValue("mediaWait", mediaWait); + dbStatement.Parameters.AddWithValue("media", media); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void SetNoteFormat(BaseNoteFile noteFile, int format) + { + using var dbStatement = new SQLiteCommand(@"REPLACE + INTO format + VALUES(@noteID, @format)", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + dbStatement.Parameters.AddWithValue("format", format); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void WipeFavoriteEntry() + { + using var dbStatement = new SQLiteCommand(@"DELETE + FROM note", _db); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void WipeHandled(BaseNoteFile noteFile) + { + using var dbStatement = new SQLiteCommand(@"DELETE + FROM handle + WHERE Note_ID = @noteID", _db); + dbStatement.Parameters.AddWithValue("noteID", noteFile.GetNoteID512()); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void InitWait() + { + using var dbStatement = new SQLiteCommand(@"UPDATE wait + SET Audio_Wait = NULL, Media_Wait = 0.0", _db); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void InitMedia() + { + using var dbStatement = new SQLiteCommand(@"UPDATE wait + SET Media = NULL", _db); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void WipeComment(string comment) + { + using var dbStatement = new SQLiteCommand(@"DELETE + FROM comment + WHERE Comment = @comment", _db); + dbStatement.Parameters.AddWithValue("comment", comment); + await dbStatement.ExecuteNonQueryAsync(); + } + + public async void WipeComment() + { + using var dbStatement = new SQLiteCommand(@"DELETE + FROM comment", _db); + await dbStatement.ExecuteNonQueryAsync(); + } + + async void Ta(Action onHandle) + { + using var t = await _db.BeginTransactionAsync(); + try + { + onHandle(); + await t.CommitAsync(); + } + catch + { + await t.RollbackAsync(); + throw; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DefaultControllerSystem/DInputSystem.cs b/Qwilight/Qwilight/System/DefaultControllerSystem/DInputSystem.cs new file mode 100644 index 0000000..9510b1a --- /dev/null +++ b/Qwilight/Qwilight/System/DefaultControllerSystem/DInputSystem.cs @@ -0,0 +1,187 @@ +using Qwilight.Utilities; +using System.Diagnostics; +using System.IO; +using Vortice.DirectInput; +using Windows.System; + +namespace Qwilight +{ + public sealed class DInputSystem : IDisposable + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(DInputSystem)); + + readonly IHandleInput _handleInput; + bool _isAvailable = true; + + public DInputSystem(IHandleInput handleInput) => _handleInput = handleInput; + + public void HandleSystem(nint handle) => Utility.HandleLongParallel(() => + { + while (_isAvailable) + { + try + { + var loopingCounter = 0.0; + var loopingHandler = Stopwatch.StartNew(); + using var dInputSystem = DInput.DirectInput8Create(); + var defaultController = dInputSystem.CreateDevice(PredefinedDevice.SysKeyboard); + defaultController.SetCooperativeLevel(handle, CooperativeLevel.NonExclusive | CooperativeLevel.Foreground); + defaultController.SetDataFormat(); + defaultController.Properties.BufferSize = 16; + while (_isAvailable) + { + foreach (var data in Utility.GetInputData(defaultController)) + { + _handleInput.HandleInput(data.Key switch + { + Vortice.DirectInput.Key.Escape => VirtualKey.Escape, + Vortice.DirectInput.Key.D0 => VirtualKey.Number0, + Vortice.DirectInput.Key.D1 => VirtualKey.Number1, + Vortice.DirectInput.Key.D2 => VirtualKey.Number2, + Vortice.DirectInput.Key.D3 => VirtualKey.Number3, + Vortice.DirectInput.Key.D4 => VirtualKey.Number4, + Vortice.DirectInput.Key.D5 => VirtualKey.Number5, + Vortice.DirectInput.Key.D6 => VirtualKey.Number6, + Vortice.DirectInput.Key.D7 => VirtualKey.Number7, + Vortice.DirectInput.Key.D8 => VirtualKey.Number8, + Vortice.DirectInput.Key.D9 => VirtualKey.Number9, + Vortice.DirectInput.Key.Minus => (VirtualKey)189, + Vortice.DirectInput.Key.Equals => (VirtualKey)187, + Vortice.DirectInput.Key.Back => VirtualKey.Back, + Vortice.DirectInput.Key.Tab => VirtualKey.Tab, + Vortice.DirectInput.Key.A => VirtualKey.A, + Vortice.DirectInput.Key.B => VirtualKey.B, + Vortice.DirectInput.Key.C => VirtualKey.C, + Vortice.DirectInput.Key.D => VirtualKey.D, + Vortice.DirectInput.Key.E => VirtualKey.E, + Vortice.DirectInput.Key.F => VirtualKey.F, + Vortice.DirectInput.Key.G => VirtualKey.G, + Vortice.DirectInput.Key.H => VirtualKey.H, + Vortice.DirectInput.Key.I => VirtualKey.I, + Vortice.DirectInput.Key.J => VirtualKey.J, + Vortice.DirectInput.Key.K => VirtualKey.K, + Vortice.DirectInput.Key.L => VirtualKey.L, + Vortice.DirectInput.Key.M => VirtualKey.M, + Vortice.DirectInput.Key.N => VirtualKey.N, + Vortice.DirectInput.Key.O => VirtualKey.O, + Vortice.DirectInput.Key.P => VirtualKey.P, + Vortice.DirectInput.Key.Q => VirtualKey.Q, + Vortice.DirectInput.Key.R => VirtualKey.R, + Vortice.DirectInput.Key.S => VirtualKey.S, + Vortice.DirectInput.Key.T => VirtualKey.T, + Vortice.DirectInput.Key.U => VirtualKey.U, + Vortice.DirectInput.Key.V => VirtualKey.V, + Vortice.DirectInput.Key.W => VirtualKey.W, + Vortice.DirectInput.Key.X => VirtualKey.X, + Vortice.DirectInput.Key.Y => VirtualKey.Y, + Vortice.DirectInput.Key.Z => VirtualKey.Z, + Vortice.DirectInput.Key.LeftBracket => (VirtualKey)219, + Vortice.DirectInput.Key.RightBracket => (VirtualKey)221, + Vortice.DirectInput.Key.Return => VirtualKey.Enter, + Vortice.DirectInput.Key.LeftControl => VirtualKey.LeftControl, + Vortice.DirectInput.Key.Semicolon => (VirtualKey)186, + Vortice.DirectInput.Key.Apostrophe => (VirtualKey)222, + Vortice.DirectInput.Key.Grave => (VirtualKey)192, + Vortice.DirectInput.Key.LeftShift => VirtualKey.LeftShift, + Vortice.DirectInput.Key.Backslash => (VirtualKey)220, + Vortice.DirectInput.Key.Comma => (VirtualKey)188, + Vortice.DirectInput.Key.Period => (VirtualKey)190, + Vortice.DirectInput.Key.Slash => (VirtualKey)191, + Vortice.DirectInput.Key.RightShift => VirtualKey.RightShift, + Vortice.DirectInput.Key.Multiply => VirtualKey.Multiply, + Vortice.DirectInput.Key.LeftAlt => VirtualKey.LeftMenu, + Vortice.DirectInput.Key.Space => VirtualKey.Space, + Vortice.DirectInput.Key.Capital => VirtualKey.CapitalLock, + Vortice.DirectInput.Key.F1 => VirtualKey.F1, + Vortice.DirectInput.Key.F2 => VirtualKey.F2, + Vortice.DirectInput.Key.F3 => VirtualKey.F3, + Vortice.DirectInput.Key.F4 => VirtualKey.F4, + Vortice.DirectInput.Key.F5 => VirtualKey.F5, + Vortice.DirectInput.Key.F6 => VirtualKey.F6, + Vortice.DirectInput.Key.F7 => VirtualKey.F7, + Vortice.DirectInput.Key.F8 => VirtualKey.F8, + Vortice.DirectInput.Key.F9 => VirtualKey.F9, + Vortice.DirectInput.Key.F10 => VirtualKey.F10, + Vortice.DirectInput.Key.F11 => VirtualKey.F11, + Vortice.DirectInput.Key.F12 => VirtualKey.F12, + Vortice.DirectInput.Key.F13 => VirtualKey.F13, + Vortice.DirectInput.Key.F14 => VirtualKey.F14, + Vortice.DirectInput.Key.F15 => VirtualKey.F15, + Vortice.DirectInput.Key.NumberLock => VirtualKey.NumberKeyLock, + Vortice.DirectInput.Key.ScrollLock => VirtualKey.Scroll, + Vortice.DirectInput.Key.NumberPad0 => VirtualKey.NumberPad0, + Vortice.DirectInput.Key.NumberPad1 => VirtualKey.NumberPad1, + Vortice.DirectInput.Key.NumberPad2 => VirtualKey.NumberPad2, + Vortice.DirectInput.Key.NumberPad3 => VirtualKey.NumberPad3, + Vortice.DirectInput.Key.NumberPad4 => VirtualKey.NumberPad4, + Vortice.DirectInput.Key.NumberPad5 => VirtualKey.NumberPad5, + Vortice.DirectInput.Key.NumberPad6 => VirtualKey.NumberPad6, + Vortice.DirectInput.Key.NumberPad7 => VirtualKey.NumberPad7, + Vortice.DirectInput.Key.NumberPad8 => VirtualKey.NumberPad8, + Vortice.DirectInput.Key.NumberPad9 => VirtualKey.NumberPad9, + Vortice.DirectInput.Key.NumberPadEnter => VirtualKey.Enter, + Vortice.DirectInput.Key.Subtract => VirtualKey.Subtract, + Vortice.DirectInput.Key.Add => VirtualKey.Add, + Vortice.DirectInput.Key.Decimal => VirtualKey.Decimal, + Vortice.DirectInput.Key.Kana => VirtualKey.Kana, + Vortice.DirectInput.Key.Convert => VirtualKey.Convert, + Vortice.DirectInput.Key.NoConvert => VirtualKey.NonConvert, + Vortice.DirectInput.Key.PreviousTrack => (VirtualKey)177, + Vortice.DirectInput.Key.Kanji => VirtualKey.Kanji, + Vortice.DirectInput.Key.Stop => VirtualKey.Stop, + Vortice.DirectInput.Key.NextTrack => (VirtualKey)176, + Vortice.DirectInput.Key.RightControl => VirtualKey.RightControl, + Vortice.DirectInput.Key.PlayPause => (VirtualKey)179, + Vortice.DirectInput.Key.VolumeDown => (VirtualKey)174, + Vortice.DirectInput.Key.VolumeUp => (VirtualKey)175, + Vortice.DirectInput.Key.WebHome => VirtualKey.GoHome, + Vortice.DirectInput.Key.Divide => VirtualKey.Divide, + Vortice.DirectInput.Key.PrintScreen => VirtualKey.Snapshot, + Vortice.DirectInput.Key.RightAlt => VirtualKey.RightMenu, + Vortice.DirectInput.Key.Pause => VirtualKey.Pause, + Vortice.DirectInput.Key.Home => VirtualKey.Home, + Vortice.DirectInput.Key.Up => VirtualKey.Up, + Vortice.DirectInput.Key.PageUp => VirtualKey.PageUp, + Vortice.DirectInput.Key.Left => VirtualKey.Left, + Vortice.DirectInput.Key.Right => VirtualKey.Right, + Vortice.DirectInput.Key.End => VirtualKey.End, + Vortice.DirectInput.Key.Down => VirtualKey.Down, + Vortice.DirectInput.Key.PageDown => VirtualKey.PageDown, + Vortice.DirectInput.Key.Insert => VirtualKey.Insert, + Vortice.DirectInput.Key.Delete => VirtualKey.Delete, + Vortice.DirectInput.Key.LeftWindowsKey => VirtualKey.LeftWindows, + Vortice.DirectInput.Key.RightWindowsKey => VirtualKey.RightWindows, + Vortice.DirectInput.Key.Applications => VirtualKey.Application, + Vortice.DirectInput.Key.Sleep => VirtualKey.Sleep, + Vortice.DirectInput.Key.WebSearch => VirtualKey.Search, + Vortice.DirectInput.Key.WebFavorites => VirtualKey.Favorites, + Vortice.DirectInput.Key.WebRefresh => VirtualKey.Refresh, + Vortice.DirectInput.Key.WebForward => VirtualKey.GoForward, + Vortice.DirectInput.Key.WebBack => VirtualKey.GoBack, + Vortice.DirectInput.Key.MediaSelect => VirtualKey.Select, + _ => VirtualKey.None + }, + data.IsPressed); + } + + loopingCounter += 1000.0 / Configure.Instance.LoopUnit; + var toWait = loopingCounter - loopingHandler.GetMillis(); + if (toWait > 0.0) + { + Thread.Sleep(TimeSpan.FromMilliseconds(toWait)); + } + } + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + } + }); + + public void Dispose() + { + _isAvailable = false; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultControllerSystem.cs b/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultControllerSystem.cs new file mode 100644 index 0000000..781a03b --- /dev/null +++ b/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultControllerSystem.cs @@ -0,0 +1,363 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.Compute; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.IO; +using Vortice.DirectInput; +using Windows.System; +using Windows.Win32.Foundation; + +namespace Qwilight +{ + public sealed class DefaultControllerSystem : Model, IHandleInput + { + public enum InputAPI + { + DefaultInput, DInput + } + + public static readonly DefaultControllerSystem Instance = QwilightComponent.GetBuiltInData(nameof(DefaultControllerSystem)); + + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(DefaultControllerSystem)); + + readonly HashSet _defaultInputs = new(); + readonly Stopwatch _loopingHandler = Stopwatch.StartNew(); + readonly TimerCallback _onLowerMultiplier = new(state => ViewModels.Instance.MainValue.LowerMultiplier()); + readonly TimerCallback _onHigherMultiplier = new(state => ViewModels.Instance.MainValue.HigherMultiplier()); + readonly TimerCallback _onLowerAudioMultiplier = new(state => ViewModels.Instance.MainValue.LowerAudioMultiplier()); + readonly TimerCallback _onHigherAudioMultiplier = new(state => ViewModels.Instance.MainValue.HigherAudioMultiplier()); + readonly Dictionary _fastInputMillis = new(); + DefaultSystem _defaultSystem; + DInputSystem _dInputSystem; + string _lastDefaultControllerInput; + Timer _lowerMultiplierHandler; + Timer _higherMultiplierHandler; + Timer _lowerAudioMultiplierHandler; + Timer _higherAudioMultiplierHandler; + Timer _lowerSpinningValueHandler; + Timer _higherSpinningValueHandler; + + public void Init() + { + _lowerMultiplierHandler?.Dispose(); + _lowerMultiplierHandler = null; + _higherMultiplierHandler?.Dispose(); + _higherMultiplierHandler = null; + _lowerAudioMultiplierHandler?.Dispose(); + _lowerAudioMultiplierHandler = null; + _higherAudioMultiplierHandler?.Dispose(); + _higherAudioMultiplierHandler = null; + _lowerSpinningValueHandler?.Dispose(); + _lowerSpinningValueHandler = null; + _higherSpinningValueHandler?.Dispose(); + _higherSpinningValueHandler = null; + } + + public string LastDefaultControllerInput + { + get => _lastDefaultControllerInput; + + set => SetProperty(ref _lastDefaultControllerInput, value, nameof(LastDefaultControllerInput)); + } + + public void HandleSystem() + { + if (_defaultSystem != null) + { + _defaultSystem.Dispose(); + _defaultSystem = null; + } + if (_dInputSystem != null) + { + _dInputSystem.Dispose(); + _dInputSystem = null; + } + switch (Configure.Instance.DefaultControllerInputAPI) + { + case InputAPI.DefaultInput: + _defaultSystem = new DefaultSystem(this); + _defaultSystem.HandleSystem(); + break; + case InputAPI.DInput: + _dInputSystem = new DInputSystem(this); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetWindowHandle, + Contents = new Action(handle => _dInputSystem.HandleSystem(handle)) + }); + break; + } + } + + public void HandleInput(VirtualKey rawInput, bool isInput) + { + if (rawInput != VirtualKey.None) + { + var millis = _loopingHandler.GetMillis(); + if (millis - _fastInputMillis.GetValueOrDefault(rawInput) >= Configure.Instance.FastInputMillis) + { + _fastInputMillis[rawInput] = millis; + var isAlt = Utility.HasInput(VirtualKey.LeftMenu); + if (rawInput != VirtualKey.F4 || !isAlt) + { + var mainViewModel = ViewModels.Instance.MainValue; + var inputViewModel = ViewModels.Instance.InputValue; + var inputStandardViewModel = ViewModels.Instance.InputStandardValue; + var inputStandardControllerViewModel = ViewModels.Instance.InputStandardControllerValue; + var valueConfigureViewModel = ViewModels.Instance.ConfigureValue; + var defaultInput = new DefaultInput + { + Data = rawInput + }; + var input = Array.IndexOf(Configure.Instance.DefaultInputBundlesV6.StandardInputs, defaultInput); + if (ViewModels.Instance.ConfigureValue.IsOpened) + { + LastDefaultControllerInput = $"{(isInput ? "+" : "-")} {nameof(Key)}: {rawInput}"; + } + if (isInput) + { + if (inputViewModel.IsOpened) + { + inputViewModel.OnDefaultInputLower(rawInput); + } + if (inputStandardViewModel.IsOpened) + { + inputStandardViewModel.OnDefaultInputLower(rawInput); + } + if (inputStandardControllerViewModel.IsOpened) + { + inputStandardControllerViewModel.OnDefaultInputLower(rawInput); + } + var atModeComponentWindow = valueConfigureViewModel.IsOpened && valueConfigureViewModel.TabPosition == 0 && valueConfigureViewModel.TabPositionComputing == 0; + switch (rawInput) + { + case VirtualKey.F1 when atModeComponentWindow: + case VirtualKey.F2 when atModeComponentWindow: + case VirtualKey.F3 when atModeComponentWindow: + case VirtualKey.F4 when atModeComponentWindow: + case VirtualKey.F5 when atModeComponentWindow: + case VirtualKey.F6 when atModeComponentWindow: + case VirtualKey.F7 when atModeComponentWindow: + case VirtualKey.F8 when atModeComponentWindow: + var modeComponentValue = mainViewModel.ModeComponentValue; + var i = rawInput - VirtualKey.F1; + var modeComponentBundle = Configure.Instance.ModeComponentBundles[i]; + var modeComponentBundleValue = modeComponentBundle.Value; + if (mainViewModel.CanModifyModeComponent) + { + modeComponentValue.CopyAs(modeComponentBundleValue); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.LoadedModeComponent, i + 1, modeComponentBundle.Name), true, null, null, NotifySystem.ModeComponentID); + } + else if (modeComponentValue.CanModifyMultiplier || modeComponentValue.CanModifyAudioMultiplier) + { + if (modeComponentValue.CanModifyMultiplier) + { + modeComponentValue.MultiplierValue = modeComponentBundleValue.MultiplierValue; + } + if (modeComponentValue.CanModifyAudioMultiplier) + { + modeComponentValue.AudioMultiplier = modeComponentBundleValue.AudioMultiplier; + } + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.LoadedMultiplier, i + 1, modeComponentBundle.Name), true, null, null, NotifySystem.ModeComponentID); + } + break; + case VirtualKey.F6: + mainViewModel.HandleF6(); + break; + case VirtualKey.F7: + mainViewModel.HandleF7(); + break; + case VirtualKey.F8: + mainViewModel.HandleF8(); + break; + case VirtualKey.F9: + mainViewModel.HandleF9(); + break; + case VirtualKey.F10: + mainViewModel.HandleF10(); + break; + case VirtualKey.F11: + mainViewModel.HandleF11(); + break; + case VirtualKey.F12 when !QwilightComponent.IsValve: + mainViewModel.HandleF12(); + break; + case VirtualKey.Escape when !isAlt: + mainViewModel.HandleESC(); + break; + case VirtualKey.Space: + mainViewModel.HandleSpace(); + break; + case VirtualKey.Pause: + mainViewModel.Pause(); + break; + case VirtualKey.Enter when isAlt: + Configure.Instance.WindowedMode = !Configure.Instance.WindowedMode; + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetWindowedMode + }); + break; + } + switch (input) + { + case InputStandardViewModel.LowerMultiplier when _lowerMultiplierHandler == null: + _lowerMultiplierHandler = new(_onLowerMultiplier, null, 0, (int)QwilightComponent.StandardLoopMillis); + break; + case InputStandardViewModel.HigherMultiplier when _higherMultiplierHandler == null: + _higherMultiplierHandler = new(_onHigherMultiplier, null, 0, (int)QwilightComponent.StandardLoopMillis); + break; + case InputStandardViewModel.LowerAudioMultiplier when _lowerAudioMultiplierHandler == null: + _onLowerAudioMultiplier(null); + _lowerAudioMultiplierHandler = new(_onLowerAudioMultiplier, null, (int)QwilightComponent.StandardWaitMillis, (int)QwilightComponent.StandardLoopMillis); + break; + case InputStandardViewModel.HigherAudioMultiplier when _higherAudioMultiplierHandler == null: + _onHigherAudioMultiplier(null); + _higherAudioMultiplierHandler = new(_onHigherAudioMultiplier, null, (int)QwilightComponent.StandardWaitMillis, (int)QwilightComponent.StandardLoopMillis); + break; + case InputStandardViewModel.Media: + mainViewModel.HandleMediaMode(); + break; + case InputStandardViewModel.Undo: + mainViewModel.HandleUndo(); + break; + } + } + else + { + switch (rawInput) + { + case VirtualKey.Left: + _lowerSpinningValueHandler?.Dispose(); + _lowerSpinningValueHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case VirtualKey.Right: + _higherSpinningValueHandler?.Dispose(); + _higherSpinningValueHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case (VirtualKey)179: + mainViewModel.Pause(); + break; + } + switch (input) + { + case InputStandardViewModel.LowerMultiplier: + _lowerMultiplierHandler?.Dispose(); + _lowerMultiplierHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case InputStandardViewModel.HigherMultiplier: + _higherMultiplierHandler?.Dispose(); + _higherMultiplierHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case InputStandardViewModel.LowerAudioMultiplier: + _lowerAudioMultiplierHandler?.Dispose(); + _lowerAudioMultiplierHandler = null; + break; + case InputStandardViewModel.HigherAudioMultiplier: + _higherAudioMultiplierHandler?.Dispose(); + _higherAudioMultiplierHandler = null; + break; + } + } + switch (mainViewModel.ModeValue) + { + case MainViewModel.Mode.NoteFile: + switch (rawInput) + { + case VirtualKey.LeftShift: + mainViewModel.HandleShift(isInput); + break; + case VirtualKey.F1 when isInput: + mainViewModel.HandleF1(); + break; + case VirtualKey.F5 when isInput: + mainViewModel.HandleF5(); + break; + case (VirtualKey)177: + mainViewModel.LowerEntryItem(); + break; + case (VirtualKey)176: + mainViewModel.HigherEntryItem(); + break; + } + break; + case MainViewModel.Mode.Computing: + var defaultComputer = mainViewModel.Computer; + if (isInput) + { + switch (rawInput) + { + case VirtualKey.Up: + if (defaultComputer.IsPausingWindowOpened) + { + mainViewModel.HigherDefaultSpinningMode(); + } + break; + case VirtualKey.Down: + if (defaultComputer.IsPausingWindowOpened) + { + mainViewModel.LowerDefaultSpinningMode(); + } + break; + case VirtualKey.Enter when !isAlt: + mainViewModel.HandleEnter(); + break; + } + switch (input) + { + case InputStandardViewModel.ModifyAutoMode: + mainViewModel.HandleModifyAutoMode(); + break; + case InputStandardViewModel.PostItem0: + mainViewModel.PostItem(0); + break; + case InputStandardViewModel.PostItem1: + mainViewModel.PostItem(1); + break; + } + } + if (isInput) + { + if (_defaultInputs.Add(defaultInput)) + { + mainViewModel.Input(Configure.Instance.DefaultInputBundlesV6.Inputs, defaultInput, true, DefaultCompute.InputFlag.DefaultController); + } + } + else + { + if (_defaultInputs.Remove(defaultInput)) + { + mainViewModel.Input(Configure.Instance.DefaultInputBundlesV6.Inputs, defaultInput, false, DefaultCompute.InputFlag.DefaultController); + } + } + break; + case MainViewModel.Mode.Quit: + if (isInput) + { + defaultComputer = mainViewModel.Computer; + switch (rawInput) + { + case VirtualKey.Left when defaultComputer.LevyingComputingPosition > 0: + defaultComputer.NotifyCompute(-1); + break; + case VirtualKey.Right when defaultComputer.LevyingComputingPosition < defaultComputer.HighestComputingPosition: + defaultComputer.NotifyCompute(1); + break; + case VirtualKey.Enter when !isAlt: + mainViewModel.HandleEnter(); + break; + } + } + break; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultInput.cs b/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultInput.cs new file mode 100644 index 0000000..4aa1538 --- /dev/null +++ b/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultInput.cs @@ -0,0 +1,78 @@ +using Windows.System; + +namespace Qwilight +{ + public struct DefaultInput : IEquatable + { + public VirtualKey Data { get; set; } + + public override bool Equals(object obj) => obj is DefaultInput defaultInput && Equals(defaultInput); + + public bool Equals(DefaultInput other) + { + return Data == other.Data; + } + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + VirtualKey.None => string.Empty, + VirtualKey.Number0 => "0", + VirtualKey.Number1 => "1", + VirtualKey.Number2 => "2", + VirtualKey.Number3 => "3", + VirtualKey.Number4 => "4", + VirtualKey.Number5 => "5", + VirtualKey.Number6 => "6", + VirtualKey.Number7 => "7", + VirtualKey.Number8 => "8", + VirtualKey.Number9 => "9", + (VirtualKey)192 => "`", + (VirtualKey)186 => ";", + (VirtualKey)222 => @"'", + (VirtualKey)220 => @"\", + (VirtualKey)219 => "[", + (VirtualKey)221 => "]", + (VirtualKey)191 => "/", + (VirtualKey)188 => ",", + (VirtualKey)190 => ".", + VirtualKey.LeftMenu => "LM", + VirtualKey.LeftControl => "LC", + VirtualKey.LeftShift => "LS", + VirtualKey.RightMenu => "RM", + VirtualKey.RightControl => "RC", + VirtualKey.RightShift => "RS", + (VirtualKey)189 => "-", + (VirtualKey)187 => "=", + VirtualKey.Add => "NP+", + VirtualKey.Subtract => "NP-", + VirtualKey.Multiply => "NP*", + VirtualKey.Divide => "NP/", + VirtualKey.Decimal => "NP.", + VirtualKey.PageUp => "PU", + VirtualKey.PageDown => "PD", + VirtualKey.NumberKeyLock => "NKL", + VirtualKey.NumberPad0 => "NP0", + VirtualKey.NumberPad1 => "NP1", + VirtualKey.NumberPad2 => "NP2", + VirtualKey.NumberPad3 => "NP3", + VirtualKey.NumberPad4 => "NP4", + VirtualKey.NumberPad5 => "NP5", + VirtualKey.NumberPad6 => "NP6", + VirtualKey.NumberPad7 => "NP7", + VirtualKey.NumberPad8 => "NP8", + VirtualKey.NumberPad9 => "NP9", + VirtualKey.Up => "▲", + VirtualKey.Down => "▼", + VirtualKey.Right => "▶", + VirtualKey.Left => "◀", + VirtualKey.Back => "←", + _ => Data.ToString(), + }; + + public static bool operator ==(DefaultInput left, DefaultInput right) => left.Equals(right); + + public static bool operator !=(DefaultInput left, DefaultInput right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultSystem.cs b/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultSystem.cs new file mode 100644 index 0000000..aeae6c7 --- /dev/null +++ b/Qwilight/Qwilight/System/DefaultControllerSystem/DefaultSystem.cs @@ -0,0 +1,124 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using Windows.System; +using Windows.Win32; +using Windows.Win32.Foundation; +using Windows.Win32.UI.Input; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight +{ + public sealed class DefaultSystem : IDisposable + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(DefaultSystem)); + + readonly IHandleInput _handleInput; + readonly byte[] _rawData = new byte[40]; + readonly object _handlerCSX = new(); + HWND _handle; + + public DefaultSystem(IHandleInput handleInput) => _handleInput = handleInput; + + public void HandleSystem() => Utility.HandleLongParallel(() => + { + unsafe + { + fixed (char* lpszClassName = "Qwilight") + { + var wcx = new WNDCLASSEXW + { + cbSize = (uint)Marshal.SizeOf(), + hInstance = (HINSTANCE)Process.GetCurrentProcess().Handle, + lpszClassName = lpszClassName, + lpfnWndProc = OnWMInput + }; + PInvoke.RegisterClassEx(wcx); + _handle = PInvoke.CreateWindowEx(WINDOW_EX_STYLE.WS_EX_OVERLAPPEDWINDOW, lpszClassName, null, WINDOW_STYLE.WS_OVERLAPPEDWINDOW, PInvoke.CW_USEDEFAULT, PInvoke.CW_USEDEFAULT, PInvoke.CW_USEDEFAULT, PInvoke.CW_USEDEFAULT, HWND.Null, HMENU.Null, wcx.hInstance); + } + } + + PInvoke.RegisterRawInputDevices(stackalloc RAWINPUTDEVICE[] + { + new() + { + usUsagePage = 1, + usUsage = 6, + dwFlags = RAWINPUTDEVICE_FLAGS.RIDEV_INPUTSINK, + hwndTarget = _handle + } + }, (uint)Marshal.SizeOf()); + + while (PInvoke.GetMessage(out var lpMsg, _handle, PInvoke.WM_INPUT, PInvoke.WM_INPUT) != 0) + { + try + { + PInvoke.TranslateMessage(lpMsg); + PInvoke.DispatchMessage(lpMsg); + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + } + }); + + LRESULT OnWMInput(HWND hWnd, uint Msg, WPARAM wParam, LPARAM lParam) + { + switch (Msg) + { + case PInvoke.WM_INPUT: + if (ViewModels.Instance.MainValue.HasPoint) + { + var dataLength = (uint)_rawData.Length; + unsafe + { + fixed (byte* pData = _rawData) + { + PInvoke.GetRawInputData((HRAWINPUT)lParam.Value, RAW_INPUT_DATA_COMMAND_FLAGS.RID_INPUT, pData, &dataLength, 24); + } + } + var rawInput = (VirtualKey)_rawData[30]; + var isInput = (_rawData[26] & 1) != 1; + switch (rawInput) + { + case VirtualKey.Shift: + switch ((uint)_rawData[24]) + { + case PInvoke.SCANCODE_LSHIFT: + _handleInput.HandleInput(VirtualKey.LeftShift, isInput); + return (LRESULT)0; + case PInvoke.SCANCODE_RSHIFT: + _handleInput.HandleInput(VirtualKey.RightShift, isInput); + return (LRESULT)0; + } + break; + } + _handleInput.HandleInput(rawInput, isInput); + } + return (LRESULT)0; + } + return PInvoke.DefWindowProc(hWnd, Msg, wParam, lParam); + } + + public void Dispose() + { + if (_handle != nint.Zero) + { + PInvoke.RegisterRawInputDevices(stackalloc RAWINPUTDEVICE[] + { + new() + { + usUsagePage = 1, + usUsage = 6, + dwFlags = RAWINPUTDEVICE_FLAGS.RIDEV_REMOVE, + hwndTarget = _handle + } + }, (uint)Marshal.SizeOf()); + PInvoke.PostMessage(_handle, PInvoke.WM_CLOSE, (WPARAM)0, (LPARAM)0); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DefaultControllerSystem/IHandleInput.cs b/Qwilight/Qwilight/System/DefaultControllerSystem/IHandleInput.cs new file mode 100644 index 0000000..f73f467 --- /dev/null +++ b/Qwilight/Qwilight/System/DefaultControllerSystem/IHandleInput.cs @@ -0,0 +1,9 @@ +using Windows.System; + +namespace Qwilight +{ + public interface IHandleInput + { + public void HandleInput(VirtualKey rawInput, bool isInput); + } +} diff --git a/Qwilight/Qwilight/System/DrawingSystem/DrawingHandlerItem.cs b/Qwilight/Qwilight/System/DrawingSystem/DrawingHandlerItem.cs new file mode 100644 index 0000000..8264393 --- /dev/null +++ b/Qwilight/Qwilight/System/DrawingSystem/DrawingHandlerItem.cs @@ -0,0 +1,11 @@ +namespace Qwilight +{ + public struct DrawingHandlerItem : IHandlerItem + { + public HandledDrawingItem DrawingComputingValue { get; set; } + + public bool WasDefaultMediaHandled { get; set; } + + public IHandledItem Value => DrawingComputingValue; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DrawingSystem/DrawingItem.cs b/Qwilight/Qwilight/System/DrawingSystem/DrawingItem.cs new file mode 100644 index 0000000..272f22b --- /dev/null +++ b/Qwilight/Qwilight/System/DrawingSystem/DrawingItem.cs @@ -0,0 +1,30 @@ +using Microsoft.Graphics.Canvas; + +namespace Qwilight +{ + public struct DrawingItem : IDisposable + { + readonly bool _disposable; + + public DrawingItem(bool disposable = true) + { + _disposable = disposable; + } + + public ICanvasImage Drawing { get; set; } + + public Bound DrawingBound { get; set; } + + public uint AverageColor { get; set; } + + public double StandardHeight { get; set; } + + public void Dispose() + { + if (_disposable) + { + Drawing.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DrawingSystem/DrawingSystem.cs b/Qwilight/Qwilight/System/DrawingSystem/DrawingSystem.cs new file mode 100644 index 0000000..81458c3 --- /dev/null +++ b/Qwilight/Qwilight/System/DrawingSystem/DrawingSystem.cs @@ -0,0 +1,3556 @@ +using CommunityToolkit.Mvvm.Messaging; +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Effects; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI; +using Qwilight.Compute; +using Qwilight.Note; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Buffers; +using System.Collections.Concurrent; +using System.Diagnostics; +using System.IO; +using System.Numerics; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.WindowsRuntime; +using System.Windows.Media.Imaging; +using Windows.Foundation; +using Windows.Graphics.DirectX; +using Windows.Storage.Streams; +using Windows.UI; +using Windows.Win32; +using Windows.Win32.System.WinRT.Direct3D11; +using WinRT; +using Brush = System.Windows.Media.Brush; +using GradientStop = System.Windows.Media.GradientStop; +using ImageSource = System.Windows.Media.ImageSource; +using LinearGradientBrush = System.Windows.Media.LinearGradientBrush; +using Pen = System.Windows.Media.Pen; +using PixelFormats = System.Windows.Media.PixelFormats; +using SolidColorBrush = System.Windows.Media.SolidColorBrush; + +namespace Qwilight +{ + public partial class DrawingSystem : Model, IDrawingContainer + { + public enum MediaInputAreaStatus + { + Not, Position, Area + } + + enum ReflexMarker + { + eSimulationStart, + eSimulationEnd, + eRenderSubmitStart, + eRenderSubmitEnd, + ePresentStart, + ePresentEnd + } + + [LibraryImport("NVIDIA")] + private static partial void InitNVLL(nint d3dDevice); + + [LibraryImport("NVIDIA")] + [return: MarshalAs(UnmanagedType.Bool)] + private static partial bool IsNVLLAvailable(); + + [LibraryImport("NVIDIA")] + private static partial void GetNVLLFrame(); + + [LibraryImport("NVIDIA")] + private static partial void SetNVLLFlag(ReflexMarker marker); + + [LibraryImport("NVIDIA")] + private static partial void WaitNVLL(); + + public static readonly DrawingSystem Instance = QwilightComponent.GetBuiltInData(nameof(DrawingSystem)); + + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(DrawingSystem)); + + readonly ConcurrentDictionary> _drawingMap = new(); + readonly ConcurrentDictionary> _defaultDrawingMap = new(); + readonly ConcurrentDictionary> _toCloseValues = new(); + readonly ICanvasBrush[] _lowHitPointsPaints = new ICanvasBrush[101]; + readonly ICanvasBrush[][] _avatarNetStatusPaints = new ICanvasBrush[][] + { + new ICanvasBrush[101], + new ICanvasBrush[101], + new ICanvasBrush[101], + }; + Vector2 _drawingQuality; + CanvasSwapChain _rawTargetSystem; + CanvasRenderTarget _targetSystem; + byte[] _rawTargetSystemData; + IBuffer _targetSystemData; + DrawingItem _faintNoteDrawing; + Action _eventHandler; + NetItem _netItemParam; + Action _netItemHandler; + NotifyXamlItem _toNotifyXamlItemParam; + Action _toNotifyXamlItemHandler; + MediaInputAreaStatus _mediaInputAreaStatus; + double _mediaInputPosition0; + double _mediaInputPosition1; + + public bool CanNVLL { get; set; } + + public WriteableBitmap D3D9Drawing { get; set; } + + public HandledDrawingItem ClearedDrawing { get; set; } + + /// + /// 다이렉트 2D 싱글 스레드 제어용 락 + /// + public object D2D1CSX { get; } = new(); + + public ICanvasBrush[] FaintFilledPaints { get; } = new ICanvasBrush[101]; + + public ICanvasBrush[] FaintClearedPaints { get; } = new ICanvasBrush[101]; + + public ICanvasBrush[] FaintPositiveItemPaints { get; } = new ICanvasBrush[101]; + + public ICanvasBrush[] FaintNegativeItemPaints { get; } = new ICanvasBrush[101]; + + public ICanvasBrush[] FaintNeutralItemPaints { get; } = new ICanvasBrush[101]; + + public Dictionary FaintItemPaints { get; set; } = new(); + + public DrawingSystem() + { + MeterFont = GetFont(); + UtilityFont = GetFont(); + NotifyXamlFont = GetFont(); + NoteItemFont = GetFont(); + InputAssistFont = GetFont(); + PauseNotifyFont = GetFont(); + NetFont = GetFont(); + JudgmentMeterViewFont = GetFont(); + StatusViewFont = GetFont(); + + SetFaintPaints(null, FaintFilledPaints, Colors.Black); + SetFaintPaints(null, FaintClearedPaints, Colors.White); + SetFaintPaints(null, FaintPositiveItemPaints, Colors.DeepSkyBlue); + SetFaintPaints(null, FaintNegativeItemPaints, Colors.DeepPink); + SetFaintPaints(null, FaintNeutralItemPaints, Colors.Gray); + FaintItemPaints[1] = FaintPositiveItemPaints; + FaintItemPaints[0] = FaintNegativeItemPaints; + FaintItemPaints[-1] = FaintNeutralItemPaints; + SetFaintPaints(null, _lowHitPointsPaints, Colors.Red); + SetFaintPaints(null, _avatarNetStatusPaints[(int)Event.Types.AvatarNetStatus.Default], Colors.White); + SetFaintPaints(null, _avatarNetStatusPaints[(int)Event.Types.AvatarNetStatus.Clear], Colors.Green); + SetFaintPaints(null, _avatarNetStatusPaints[(int)Event.Types.AvatarNetStatus.Failed], Colors.Red); + + Init(); + + DefaultDrawing = ClearedDrawing; + VeilDrawing = ClearedDrawing; + } + + public virtual void Init() + { + CanvasDevice.GetSharedDevice().As().GetInterface(new Guid("6007896C-3244-4AFD-BF18-A6D3BEDA5023"), out var rawSystem); + InitNVLL(Marshal.GetIUnknownForObject(rawSystem)); + if (!(CanNVLL = IsNVLLAvailable())) + { + Configure.Instance.NVLLModeValue = Configure.NVLLMode.Not; + Configure.Instance.NVLLFramerate = 0; + Configure.Instance.AutoNVLLFramerate = false; + } + Configure.Instance.SetNVLLConfigureImpl(); + + var faintNoteDrawing = new CanvasRenderTarget(CanvasDevice.GetSharedDevice(), 1F, 200F, 96F, DirectXPixelFormat.B8G8R8A8UIntNormalized, CanvasAlphaMode.Premultiplied); + using (var targetSession = faintNoteDrawing.CreateDrawingSession()) + { + targetSession.Clear(Colors.Transparent); + for (var i = (int)faintNoteDrawing.SizeInPixels.Height - 1; i >= 0; --i) + { + targetSession.FillRectangle(0F, i, 1F, 1F, FaintFilledPaints[Math.Min(i, 100)]); + } + } + _faintNoteDrawing = new(false) + { + Drawing = faintNoteDrawing, + DrawingBound = faintNoteDrawing.Bounds + }; + + var d2DClearedDrawing = new CanvasRenderTarget(CanvasDevice.GetSharedDevice(), 1F, 1F, 96F, DirectXPixelFormat.B8G8R8A8UIntNormalized, CanvasAlphaMode.Premultiplied); + using (var targetSession = d2DClearedDrawing.CreateDrawingSession()) + { + targetSession.Clear(Colors.Transparent); + } + var defaultClearedDrawing = BitmapSource.Create(1, 1, 96.0, 96.0, PixelFormats.Pbgra32, null, new byte[] { 0, 0, 0, 0 }, 4); + defaultClearedDrawing.Freeze(); + ClearedDrawing = new() + { + Drawing = new(false) + { + Drawing = d2DClearedDrawing, + DrawingBound = d2DClearedDrawing.Bounds + }, + DefaultDrawing = defaultClearedDrawing + }; + } + + public ConcurrentQueue<(Point, bool)> LastPointedQueue { get; } = new(); + + public ConcurrentQueue LastMovedQueue { get; } = new(); + + public ConcurrentQueue LastNotPointedQueue { get; } = new(); + + public ICanvasBrush[] MeterNotePaints { get; } = new ICanvasBrush[101]; + + public uint MeterNoteAverageColor { get; set; } + + public ICanvasBrush[] AudioVisualizerMainPaints { get; } = new ICanvasBrush[101]; + + public ICanvasBrush[] AudioVisualizerInputPaints { get; } = new ICanvasBrush[101]; + + public HandledDrawingItem DefaultDrawing { get; set; } + + public HandledDrawingItem VeilDrawing { get; set; } + + public CanvasTextFormat MeterFont { get; } + + public CanvasTextFormat UtilityFont { get; } + + public CanvasTextFormat NotifyXamlFont { get; } + + public CanvasTextFormat NoteItemFont { get; } + + public CanvasTextFormat InputAssistFont { get; } + + public CanvasTextFormat PauseNotifyFont { get; } + + public CanvasTextFormat NetFont { get; } + + public CanvasTextFormat JudgmentMeterViewFont { get; } + + public CanvasTextFormat StatusViewFont { get; } + + public int DrawingItemCount + { + get + { + var drawingItemCount = 0; + foreach (var drawingItems in _drawingMap.Values) + { + drawingItemCount += drawingItems.Count; + } + foreach (var defaultDrawing in _defaultDrawingMap.Values) + { + drawingItemCount += defaultDrawing.Count; + } + return drawingItemCount; + } + } + + public void InitMediaInputArea() + { + _mediaInputPosition0 = 0.0; + _mediaInputPosition1 = 0.0; + _mediaInputAreaStatus = MediaInputAreaStatus.Position; + } + + public void LoadDefaultDrawing() + { + DefaultDrawing.Dispose(); + try + { + var filePath = Configure.Instance.DefaultDrawingFilePath; + if (File.Exists(filePath)) + { + DefaultDrawing = new() + { + Drawing = Load(filePath, null), + DefaultDrawing = LoadDefault(filePath, null) + }; + } + else + { + DefaultDrawing = BaseUI.Instance.DefaultDrawing ?? ClearedDrawing; + } + } + catch + { + DefaultDrawing = ClearedDrawing; + } + OnPropertyChanged(nameof(DefaultDrawing)); + } + + public void LoadVeilDrawing() + { + VeilDrawing.Dispose(); + try + { + var filePath = Configure.Instance.VeilDrawingFilePath; + if (File.Exists(filePath)) + { + VeilDrawing = new() + { + Drawing = Load(filePath, null), + DefaultDrawing = LoadDefault(filePath, null) + }; + } + else + { + VeilDrawing = UI.Instance.VeilDrawing ?? ClearedDrawing; + } + } + catch + { + VeilDrawing = ClearedDrawing; + } + OnPropertyChanged(nameof(VeilDrawing)); + } + + public void HandleSystem() + { + Span judgments = stackalloc int[6]; + var mainViewModel = ViewModels.Instance.MainValue; + var r = new Bound(); + var s = new Bound(); + var v0 = new Vector2(); + var v1 = new Vector2(); + var pauseNotify0Position0 = 0F; + var pauseNotify0Position1 = 0F; + var pauseNotify1Position0 = 0F; + var pauseNotify1Position1 = 0F; + DefaultCompute defaultComputer = null; + CanvasDrawingSession targetSession = null; + + var handleNotifyXamlItemImpl = new Action(toNotifyXamlItem => + { + toNotifyXamlItem.OnHandle?.Invoke(); + ViewModels.Instance.NotifyXamlValue.WipeNotify(toNotifyXamlItem); + }); + + var handleCommentNetItemImpl = new Action(mainViewModel.HandleViewComment); + + var handleIONetItemImpl = new Action(netItem => TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallIo, new + { + avatarID = netItem.AvatarID, + ioMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + })); + + var setDefaultSpinningModeUnpause = new Action(() => + { + Configure.Instance.DefaultSpinningModeValue = Configure.DefaultSpinningMode.Unpause; + defaultComputer.Unpause(); + }); + var setDefaultSpinningModeConfigure = new Action(() => + { + Configure.Instance.DefaultSpinningModeValue = Configure.DefaultSpinningMode.Configure; + ViewModels.Instance.ConfigureValue.Open(); + }); + var setDefaultSpinningModeUndo = new Action(() => + { + Configure.Instance.DefaultSpinningModeValue = Configure.DefaultSpinningMode.Undo; + if (defaultComputer.CanUndo) + { + defaultComputer.SetUndo = true; + } + }); + var setDefaultSpinningModeStop = new Action(() => + { + Configure.Instance.DefaultSpinningModeValue = Configure.DefaultSpinningMode.Stop; + defaultComputer.Unpause(); + defaultComputer.SetNoteFileMode(); + }); + var handleViewCommentImpl = new Action(mainViewModel.HandleViewComment); + var handleUndoImpl = new Action(mainViewModel.HandleInitComment); + var handleQuitMove0Impl = new Action(() => defaultComputer.NotifyCompute(-1)); + var handleQuitMove1Impl = new Action(() => defaultComputer.NotifyCompute(1)); + var getAvatarDrawing = new Action(async avatarID => await AvatarDrawingSystem.Instance.GetAvatarDrawing(avatarID as string)); + var getAvatarTitle = new Action(async avatarID => await AvatarTitleSystem.Instance.GetAvatarTitle(avatarID as string)); + var getAvatarEdge = new Action(async avatarID => await AvatarEdgeSystem.Instance.GetAvatarEdge(avatarID as string)); + + var distanceMillisMax = double.MinValue; + var frametime = 0.0; + var frameCount = 0; + var framerate = string.Empty; + var framerateLowest = string.Empty; + var textGCs = new string[QwilightComponent.HeapCount]; + Array.Fill(textGCs, string.Empty); + var textHeap = string.Empty; + var lastMillis = 0.0; + var lastHeap = 0L; + var distanceMillis = 0.0; + var loopingHandler = Stopwatch.StartNew(); + while (true) + { + try + { + var wasLastPointed = LastPointedQueue.TryDequeue(out var lastPointed); + var wasLastMoved = LastMovedQueue.TryDequeue(out var lastMoved); + var wasLastNotPointed = LastNotPointedQueue.TryDequeue(out var lastNotPointed); + + var isWPFViewVisible = mainViewModel.IsWPFViewVisible; + var isNVLL = Configure.Instance.IsNVLL; + var allowFramerate = TelnetSystem.Instance.IsAvailable; + var mode = mainViewModel.ModeValue; + var defaultLength = (float)_rawTargetSystem.Size.Width; + var defaultHeight = (float)_rawTargetSystem.Size.Height; + var fadingValue = mainViewModel.FadingValue; + var fadingStatus = fadingValue.Status; + pauseNotify0Position0 = Levels.StandardMarginFloat32; + pauseNotify0Position1 = Levels.StandardMarginFloat32; + pauseNotify1Position0 = defaultLength - Levels.StandardMarginFloat32; + pauseNotify1Position1 = Levels.StandardMarginFloat32; + if (fadingStatus < 1.0) + { + ModeComponent modeComponentValue; + switch (mode) + { + case MainViewModel.Mode.NoteFile: + lock (D2D1CSX) + { + using (targetSession = _rawTargetSystem.CreateDrawingSession(Colors.Black)) + { + lock (UI.Instance.ContentsCSX) + { + PaintFading(); + PaintNotifyXamlItems(); + } + PaintFramerate(); + } + } + + _rawTargetSystem.Present(); + break; + case MainViewModel.Mode.Computing: + defaultComputer = mainViewModel.Computer; + modeComponentValue = defaultComputer.ModeComponentValue; + lock (D2D1CSX) + { + using (targetSession = _targetSystem.CreateDrawingSession()) + { + targetSession.Clear(Colors.Black); + + lock (UI.Instance.ContentsCSX) + { + var faultText = UI.Instance.FaultText; + if (string.IsNullOrEmpty(faultText)) + { + var isItemMode = defaultComputer.IsPostableItemMode; + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var loopingCounter = defaultComputer.LoopingCounter; + var faintNoteModeValue = modeComponentValue.FaintNoteModeValue; + var inputMode = defaultComputer.InputMode; + var isIn2P = defaultComputer.IsIn2P; + var has2P = defaultComputer.Has2P; + var inputCount = Component.InputCounts[(int)inputMode]; + var input1PCount = defaultComputer.Input1PCount; + var mainPosition = drawingComponentValue.mainPosition; + var p2Position = drawingComponentValue.p2Position; + var p1Length = drawingComponentValue.p1BuiltLength; + var distance2P = p1Length + p2Position; + var isHandling = defaultComputer.IsHandling; + var hitPoints = defaultComputer.HitPoints.Value; + var status = defaultComputer.Status; + var comment = defaultComputer.Comment; + var setStop = defaultComputer.SetStop; + var isAutoMode = defaultComputer.IsAutoMode; + var d2dJudgmentPaints = BaseUI.Instance.D2DJudgmentPaints; + var isValidNetDrawings = defaultComputer.IsValidNetDrawings; + judgments[(int)Component.Judged.Highest] = defaultComputer.InheritedHighestJudgment + (setStop ? 0 : comment.HighestJudgment); + judgments[(int)Component.Judged.Higher] = defaultComputer.InheritedHigherJudgment + (setStop ? 0 : comment.HigherJudgment); + judgments[(int)Component.Judged.High] = defaultComputer.InheritedHighJudgment + (setStop ? 0 : comment.HighJudgment); + judgments[(int)Component.Judged.Low] = defaultComputer.InheritedLowJudgment + (setStop ? 0 : comment.LowJudgment); + judgments[(int)Component.Judged.Lower] = defaultComputer.InheritedLowerJudgment + (setStop ? 0 : comment.LowerJudgment); + judgments[(int)Component.Judged.Lowest] = defaultComputer.InheritedLowestJudgment + (setStop ? 0 : comment.LowestJudgment); + var drawingNoteLengthMap = drawingComponentValue.DrawingNoteLengthMap; + var mainPosition1 = drawingComponentValue.mainPosition1; + var mainHeight = drawingComponentValue.mainHeight; + var binJudgmentValueMap = UI.Instance.BinJudgmentValueMap; + var drawingInputModeMap = UI.Instance.DrawingInputModeMap[(int)inputMode]; + var drawingPipelines = UI.Instance.DrawingPipeline; + + var paintPipelines = UI.Instance.PaintPipelineValues; + foreach (var paintPipeline in paintPipelines) + { + if (CanPaint(paintPipeline)) + { + if (paintPipeline >= PaintPipelineID.PaintProperty0 && paintPipeline <= PaintPipelineID.PaintProperty255) + { + var paintPropertyID = (int)paintPipeline - (int)PaintPipelineID.PaintProperty0; + lock (drawingComponentValue.PaintPropertyCSX) + { + if (drawingComponentValue.PaintPropertyIDs.Contains(paintPropertyID)) + { + var paintPropertyIntMap = drawingComponentValue.PaintPropertyIntMap[paintPropertyID]; + var paintPropertyPipeline = (PaintPipelineID)paintPropertyIntMap[PaintProperty.ID.Pipeline]; + if ((int)paintPropertyPipeline == -1 || paintPipelines.Contains(paintPropertyPipeline) && CanPaint(paintPropertyPipeline)) + { + if (paintPropertyIntMap[PaintProperty.ID.Frame] > 0) + { + var paintPropertyAlt = paintPropertyIntMap[PaintProperty.ID.Alt]; + var paintPropertyValueMap = drawingComponentValue.PaintPropertyValueMap[paintPropertyID]; + var paintPropertyPosition0 = paintPropertyValueMap[PaintProperty.ID.Position0]; + var paintPropertyPosition1 = paintPropertyValueMap[PaintProperty.ID.Position1]; + var paintPropertyLength = paintPropertyValueMap[PaintProperty.ID.Length]; + var paintPropertyHeight = paintPropertyValueMap[PaintProperty.ID.Height]; + var paintPropertyDrawing = UI.Instance.PaintPropertyValues[paintPropertyID].Drawings[defaultComputer.PaintPropertyFrames[paintPropertyID]]; + for (var i = paintPropertyAlt >> 1; i >= paintPropertyAlt % 2; --i) + { + var distancePaint = i == 1 && has2P ? distance2P : 0F; + r.Set(paintPropertyPosition0 + distancePaint, paintPropertyPosition1, paintPropertyLength, paintPropertyHeight); + targetSession.PaintDrawing(ref r, paintPropertyDrawing, 1F, (CanvasComposite)paintPropertyIntMap[PaintProperty.ID.Composition]); + } + } + } + } + } + } + else + { + switch (paintPipeline) + { + case PaintPipelineID.Media: + var mediaFaint = (float)Configure.Instance.UIConfigureValue.MediaFaintV2; + var mediaPosition0 = drawingComponentValue.mediaPosition0; + var mediaPosition1 = drawingComponentValue.mediaPosition1; + var mediaLength = drawingComponentValue.mediaLength; + var mediaHeight = drawingComponentValue.mediaHeight; + var altMedia = drawingComponentValue.altMedia; + for (var i = altMedia >> 1; i >= altMedia % 2; --i) + { + var distanceMedia = i == 1 && has2P ? distance2P : 0F; + r.Set(mediaPosition0 + distanceMedia, mediaPosition1, mediaLength, mediaHeight); + defaultComputer.PaintMedia(targetSession, ref r, mediaFaint); + } + break; + case PaintPipelineID.AudioVisualizer: + Utility.PaintAudioVisualizer(targetSession, ref r, (int)(100 * Configure.Instance.UIConfigureValue.AudioVisualizerFaintV2), drawingComponentValue.audioVisualizerPosition0, drawingComponentValue.audioVisualizerPosition1, drawingComponentValue.audioVisualizerLength, drawingComponentValue.audioVisualizerHeight); + break; + case PaintPipelineID.MainWall: + var mainWalls = UI.Instance.MainWalls; + var mainWall0Position1 = drawingComponentValue.mainWall0Position1; + var mainWall0Length = drawingComponentValue.mainWall0Length; + var mainWall0Height = drawingComponentValue.mainWall0Height; + var altWall0 = drawingComponentValue.altWall0; + var mainWallDrawing0 = mainWalls[0]; + for (var i = altWall0 >> 1; i >= altWall0 % 2; --i) + { + var distanceMainWall0 = i == 1 && has2P ? distance2P : 0F; + r.Set(mainPosition + distanceMainWall0 - mainWall0Length, mainWall0Position1, mainWall0Length, mainWall0Height); + targetSession.PaintDrawing(ref r, mainWallDrawing0); + } + var mainWall1Position1 = drawingComponentValue.mainWall1Position1; + var mainWall1Length = drawingComponentValue.mainWall1Length; + var mainWall1Height = drawingComponentValue.mainWall1Height; + var altWall1 = drawingComponentValue.altWall1; + var mainWallDrawing1 = mainWalls[1]; + for (var i = altWall1 >> 1; i >= altWall1 % 2; --i) + { + var distanceMainWall1 = i == 1 && has2P ? distance2P : 0F; + r.Set(mainPosition + p1Length + distanceMainWall1, mainWall1Position1, mainWall1Length, mainWall1Height); + targetSession.PaintDrawing(ref r, mainWallDrawing1); + } + break; + case PaintPipelineID.Main: + var mainDrawings = UI.Instance.MainDrawings[(int)inputMode]; + var mainFaint = (float)Configure.Instance.UIConfigureValue.MainFaintV2; + foreach (var drawingPipeline in drawingPipelines) + { + for (var i = inputCount; i > 0; --i) + { + if (drawingPipeline == drawingInputModeMap[i]) + { + var mainDrawing = mainDrawings?[i]?[Configure.Instance.UIPipelineMainDrawingPaint ? defaultComputer.MainFrames[i] : 0]; + if (mainDrawing.HasValue) + { + r.Set(defaultComputer.GetPosition(i), mainPosition1, drawingNoteLengthMap[i], mainHeight); + targetSession.PaintDrawing(ref r, mainDrawing, mainFaint); + defaultComputer.NewNetDrawing(isValidNetDrawings, Event.Types.NetDrawing.Types.Variety.Main, mainDrawing.Value.AverageColor, r.Position0 - drawingComponentValue.mainPosition, r.Position1, r.Length, r.Height); + } + } + } + } + + if (isItemMode) + { + for (var i = 1; i >= -1; --i) + { + var postedItemFaint = defaultComputer.PostedItemFaints[i] / 5; + var faintItemPaint = FaintItemPaints[i][(int)(100 * postedItemFaint)]; + r.Set(mainPosition, 0.0, p1Length, mainHeight); + targetSession.FillRectangle(r, faintItemPaint); + if (has2P) + { + r.Position0 += distance2P; + targetSession.FillRectangle(r, faintItemPaint); + } + } + } + break; + case PaintPipelineID.AutoInput: + if (!isAutoMode || UI.Instance.MaintainAutoInput) + { + var autoInputDrawings = UI.Instance.AutoInputDrawings[(int)inputMode]; + var autoInputPosition1s = drawingComponentValue.autoInputPosition1s; + var autoInputHeights = drawingComponentValue.autoInputHeights; + foreach (var drawingPipeline in drawingPipelines) + { + for (var i = inputCount; i > 0; --i) + { + if (drawingPipeline == drawingInputModeMap[i]) + { + if (defaultComputer.IsSuitableAsAutoJudge(i)) + { + r.Set(defaultComputer.GetPosition(i), autoInputPosition1s[i], drawingNoteLengthMap[i], autoInputHeights[i]); + targetSession.PaintDrawing(ref r, autoInputDrawings[i]); + } + } + } + } + } + break; + case PaintPipelineID.HitPoints: + var hitPointsPosition0 = drawingComponentValue.hitPointsPosition0; + var hitPointsPosition1 = drawingComponentValue.hitPointsPosition1; + var hitPointsLength = drawingComponentValue.hitPointsLength; + var hitPointsHeight = drawingComponentValue.hitPointsHeight; + var hitPointsDrawing = UI.Instance.HitPointsDrawings[(int)modeComponentValue.HandlingHitPointsModeValue]; + var altHitPoints = drawingComponentValue.altHitPoints; + var hitPointsSystem = drawingComponentValue.hitPointsSystem; + for (var i = altHitPoints >> 1; i >= altHitPoints % 2; --i) + { + var distanceHitPoints = i == 1 && has2P ? distance2P : 0F; + if (hitPointsDrawing.HasValue) + { + var hitPointsDrawingValue = hitPointsDrawing.Value; + var hitPointsDrawingBound = hitPointsDrawingValue.DrawingBound; + var hitPointsDrawingLength = hitPointsDrawingBound.Length; + var hitPointsDrawingHeight = hitPointsDrawingBound.Height; + switch (hitPointsSystem) + { + case 0: + r.Set(hitPointsPosition0 + distanceHitPoints, hitPointsPosition1 + hitPointsHeight * (1 - hitPoints), hitPointsLength, hitPointsHeight * hitPoints); + s.Set(0.0, (1 - hitPoints) * hitPointsDrawingHeight, hitPointsDrawingLength, hitPointsDrawingHeight * hitPoints); + break; + case 1: + r.Set(hitPointsPosition0 + distanceHitPoints, hitPointsPosition1, hitPointsLength, hitPointsHeight * hitPoints); + s.SetArea(hitPointsDrawingLength, hitPointsDrawingHeight * hitPoints); + break; + case 2: + r.Set(hitPointsPosition0 + distanceHitPoints + hitPointsLength * (1 - hitPoints), hitPointsPosition1, hitPointsLength * hitPoints, hitPointsHeight); + s.Set((1 - hitPoints) * hitPointsDrawingLength, 0.0, hitPointsDrawingLength * hitPoints, hitPointsDrawingHeight); + break; + case 3: + r.Set(hitPointsPosition0 + distanceHitPoints, hitPointsPosition1, hitPointsLength * hitPoints, hitPointsHeight); + s.SetArea(hitPointsDrawingLength * hitPoints, hitPointsDrawingHeight); + break; + } + targetSession.PaintDrawing(ref r, ref s, hitPointsDrawingValue); + } + } + break; + case PaintPipelineID.Note: + for (var i = BaseNote.LowestLayer; i <= BaseNote.HighestLayer; ++i) + { + foreach (var drawingPipeline in drawingPipelines) + { + var paintedNotes = defaultComputer.PaintedNotes; + lock (paintedNotes) + { + foreach (var paintedNote in paintedNotes) + { + if (paintedNote.Layer == i) + { + if (drawingPipeline == drawingInputModeMap[paintedNote.TargetInput]) + { + paintedNote.Paint(targetSession, isValidNetDrawings, defaultComputer, ref r); + } + } + } + } + } + } + + if (faintNoteModeValue == ModeComponent.FaintNoteMode.Faint) + { + r.Set(mainPosition, 0.0, p1Length, mainHeight); + targetSession.PaintDrawing(ref r, _faintNoteDrawing); + if (has2P) + { + r.Position0 += distance2P; + targetSession.PaintDrawing(ref r, _faintNoteDrawing); + } + } + break; + case PaintPipelineID.Input: + var inputDrawings = UI.Instance.InputDrawings[(int)inputMode]; + var inputPosition0s = drawingComponentValue.inputPosition0s; + var inputPosition1s = drawingComponentValue.inputPosition1s; + var inputLengths = drawingComponentValue.inputLengths; + var inputHeights = drawingComponentValue.inputHeights; + var inputFrames = defaultComputer.InputFrames; + foreach (var drawingPipeline in drawingPipelines) + { + for (var i = inputCount; i > 0; --i) + { + if (drawingPipeline == drawingInputModeMap[i]) + { + var inputLength = inputLengths[i]; + r.Set(defaultComputer.GetPosition(i) + inputPosition0s[i] - inputLength / 2, inputPosition1s[i], drawingNoteLengthMap[i] + inputLength, inputHeights[i]); + targetSession.PaintDrawing(ref r, inputDrawings?[i]?[defaultComputer.InputFrames[i]]); + } + } + } + break; + case PaintPipelineID.Band: + var binBandMap = UI.Instance.BinBandMap; + var band = defaultComputer.Band.Value; + if (band > 0) + { + var bandPosition0 = drawingComponentValue.bandPosition0; + var bandPosition1 = drawingComponentValue.bandPosition1; + var binBandLength = drawingComponentValue.binBandLength; + var binBandHeight = drawingComponentValue.binBandHeight; + var bandSystem = drawingComponentValue.bandSystem; + var altBand = drawingComponentValue.altBand; + var bandDrawingMap = defaultComputer.BandEnlargedMap; + var bandDrawingFrames = defaultComputer.BandDrawingFrames; + var bandDigit = QwilightComponent.GetDigit(band); + for (var i = altBand >> 1; i >= altBand % 2; --i) + { + var distanceBand = i == 1 && has2P ? distance2P : 0F; + for (var j = bandDigit - 1; j >= 0; --j) + { + var m = (int)(band / Math.Pow(10, j) % 10); + var enlarge = bandDrawingMap.TryGetValue(j, out var unlarge) ? 2 * unlarge : 0.0; + var binBandDrawing = binBandMap[m, bandDrawingFrames.TryGetValue(j, out var frame) ? frame : 0]; + switch (bandSystem) + { + case 0: + r.Set(bandPosition0 + binBandLength * (bandDigit - j - 1) + distanceBand - unlarge, bandPosition1 - unlarge, binBandLength + enlarge, binBandHeight + enlarge); + break; + case 1: + r.Set(bandPosition0 + binBandLength * (0.5 * bandDigit - j - 1) + distanceBand - unlarge, bandPosition1 - unlarge, binBandLength + enlarge, binBandHeight + enlarge); + break; + case 2: + r.Set(bandPosition0 - binBandLength * (j + 1) + distanceBand - unlarge, bandPosition1 - unlarge, binBandLength + enlarge, binBandHeight + enlarge); + break; + } + targetSession.PaintDrawing(ref r, binBandDrawing); + } + } + } + break; + case PaintPipelineID.JudgmentMeter: + var judgmentMeterPosition0 = drawingComponentValue.judgmentMeterPosition0; + var judgmentMeterPosition1 = drawingComponentValue.judgmentMeterPosition1; + var binJudgmentMeterLength = drawingComponentValue.binJudgmentMeterLength; + var binJudgmentMeterHeight = drawingComponentValue.binJudgmentMeterHeight; + var judgmentMeterFrontDrawingLength = drawingComponentValue.judgmentMeterFrontDrawingLength; + var judgmentMeterUnitDrawingLength = drawingComponentValue.judgmentMeterUnitDrawingLength; + var judgmentMeters = defaultComputer.JudgmentMeters; + var judgmentMeterSystem = drawingComponentValue.judgmentMeterSystem; + var altJudgmentMeter = drawingComponentValue.altJudgmentMeter; + var binJudgmentMeterMap = UI.Instance.BinJudgmentMeterMap; + var drawingJudgmentMeterHigher = UI.Instance.JudgmentMererHigherDrawing; + var drawingJudgmentMeterLower = UI.Instance.JudgmentMeterLowerDrawing; + var drawingJudgmentMeterUnit = UI.Instance.JudgmentMeterUnitDrawing; + for (var i = altJudgmentMeter >> 1; i >= altJudgmentMeter % 2; --i) + { + var judgmentMeter = judgmentMeters[i]; + var judgmentMeterValue = (int)Math.Round(judgmentMeter); + var absJudgmentMeter = Math.Abs(judgmentMeterValue); + if (absJudgmentMeter >= Configure.Instance.JudgmentMeterMillis) + { + var distanceJudgmentMeter = i == 1 && has2P ? distance2P : 0F; + var judgmentMeterDigit = QwilightComponent.GetDigit(absJudgmentMeter); + switch (judgmentMeterSystem) + { + case 0: + r.Set(judgmentMeterPosition0 - binJudgmentMeterLength + distanceJudgmentMeter, judgmentMeterPosition1, judgmentMeterFrontDrawingLength, binJudgmentMeterHeight); + break; + case 1: + r.Set(judgmentMeterPosition0 - 0.5 * (binJudgmentMeterLength * judgmentMeterDigit + judgmentMeterFrontDrawingLength) + distanceJudgmentMeter, judgmentMeterPosition1, judgmentMeterFrontDrawingLength, binJudgmentMeterHeight); + break; + case 2: + r.Set(judgmentMeterPosition0 - binJudgmentMeterLength * judgmentMeterDigit - judgmentMeterFrontDrawingLength + distanceJudgmentMeter, judgmentMeterPosition1, judgmentMeterFrontDrawingLength, binJudgmentMeterHeight); + break; + } + if (absJudgmentMeter > 0) + { + targetSession.PaintDrawing(ref r, judgmentMeter > 0 ? drawingJudgmentMeterHigher : drawingJudgmentMeterLower); + } + r.Position0 += judgmentMeterFrontDrawingLength; + r.Length = binJudgmentMeterLength; + for (var j = judgmentMeterDigit - 1; j >= 0; --j) + { + targetSession.PaintDrawing(ref r, binJudgmentMeterMap[(int)(absJudgmentMeter / Math.Pow(10, j) % 10)]); + r.Position0 += binJudgmentMeterLength; + } + r.Length = judgmentMeterUnitDrawingLength; + targetSession.PaintDrawing(ref r, drawingJudgmentMeterUnit); + } + } + break; + case PaintPipelineID.Stand: + var stand = defaultComputer.Stand.Value; + var standDigit = QwilightComponent.GetDigit(stand); + var standCommaDrawing = UI.Instance.CommaDrawing; + var standCommaDrawingLength = drawingComponentValue.standCommaDrawingLength; + var standCommaCount = (standDigit - 1) / 3; + var standPosition0 = drawingComponentValue.standPosition0; + var standPosition1 = drawingComponentValue.standPosition1; + var binStandLength = drawingComponentValue.binStandLength; + var binStandHeight = drawingComponentValue.binStandHeight; + var standSystem = drawingComponentValue.standSystem; + var binStandMap = UI.Instance.BinStandMap; + var altStand = drawingComponentValue.altStand; + for (var i = altStand >> 1; i >= altStand % 2; --i) + { + var distanceStand = i == 1 && has2P ? distance2P : 0F; + switch (standSystem) + { + case 0: + r.Set(standPosition0 + (standDigit - 1) * binStandLength + standCommaCount * standCommaDrawingLength + distanceStand, standPosition1, binStandLength, binStandHeight); + break; + case 1: + r.Set(standPosition0 + (standDigit / 2 - 1) * binStandLength + (standCommaCount * standCommaDrawingLength) / 2 + distanceStand, standPosition1, binStandLength, binStandHeight); + break; + case 2: + r.Set(standPosition0 - binStandLength + distanceStand, standPosition1, binStandLength, binStandHeight); + break; + } + targetSession.PaintDrawing(ref r, binStandMap[stand % 10]); + if (standDigit >= 2) + { + r.Position0 -= binStandLength; + targetSession.PaintDrawing(ref r, binStandMap[stand / 10 % 10]); + } + if (standDigit >= 3) + { + r.Position0 -= binStandLength; + targetSession.PaintDrawing(ref r, binStandMap[stand / 100 % 10]); + } + if (standDigit >= 4) + { + r.Position0 -= standCommaDrawingLength; + r.Length = standCommaDrawingLength; + targetSession.PaintDrawing(ref r, standCommaDrawing); + r.Position0 -= binStandLength; + r.Length = binStandLength; + targetSession.PaintDrawing(ref r, binStandMap[stand / 1000 % 10]); + } + if (standDigit >= 5) + { + r.Position0 -= binStandLength; + targetSession.PaintDrawing(ref r, binStandMap[stand / 10000 % 10]); + } + if (standDigit >= 6) + { + r.Position0 -= binStandLength; + targetSession.PaintDrawing(ref r, binStandMap[stand / 100000 % 10]); + } + if (standDigit >= 7) + { + r.Position0 -= standCommaDrawingLength; + r.Length = standCommaDrawingLength; + targetSession.PaintDrawing(ref r, standCommaDrawing); + r.Position0 -= binStandLength; + r.Length = binStandLength; + targetSession.PaintDrawing(ref r, binStandMap[stand / 1000000 % 10]); + } + } + break; + case PaintPipelineID.Point: + var pointInt = (int)(10000 * defaultComputer.Point.Value); + var pointStopPointDrawingLength = drawingComponentValue.pointStopPointDrawingLength; + var pointPosition0 = drawingComponentValue.pointPosition0; + var pointPosition1 = drawingComponentValue.pointPosition1; + var binPointLength = drawingComponentValue.binPointLength; + var binPointHeight = drawingComponentValue.binPointHeight; + var pointUnitDrawingLength = drawingComponentValue.pointUnitDrawingLength; + var pointSystem = drawingComponentValue.pointSystem; + var altPoint = drawingComponentValue.altPoint; + var binPointMap = UI.Instance.BinPointMap; + var pointUnitDrawing = UI.Instance.PointUnitDrawing; + var pointStopPointDrawing = UI.Instance.PointStopPointDrawing; + var pointDigit = pointInt < 100 ? 3 : QwilightComponent.GetDigit(pointInt); + for (var i = altPoint >> 1; i >= altPoint % 2; --i) + { + var distancePoint = i == 1 && has2P ? distance2P : 0F; + for (var j = pointDigit - 1; j >= 2; --j) + { + switch (pointSystem) + { + case 0: + r.Set(pointPosition0 + binPointLength * (pointDigit - j - 1) + distancePoint, pointPosition1, binPointLength, binPointHeight); + break; + case 1: + r.Set(pointPosition0 + binPointLength * (0.5 * pointDigit - j - 1) - pointStopPointDrawingLength * 0.5 - pointUnitDrawingLength * 0.5 + distancePoint, pointPosition1, binPointLength, binPointHeight); + break; + case 2: + r.Set(pointPosition0 - binPointLength * (j + 1) - pointStopPointDrawingLength - pointUnitDrawingLength + distancePoint, pointPosition1, binPointLength, binPointHeight); + break; + } + targetSession.PaintDrawing(ref r, binPointMap[(int)(pointInt / Math.Pow(10, j) % 10)]); + } + r.Position0 += binPointLength; + r.Length = pointStopPointDrawingLength; + targetSession.PaintDrawing(ref r, pointStopPointDrawing); + for (var j = 1; j >= 0; --j) + { + switch (pointSystem) + { + case 0: + r.Set(pointPosition0 + binPointLength * (pointDigit - j - 1) + pointStopPointDrawingLength + distancePoint, pointPosition1, binPointLength, binPointHeight); + break; + case 1: + r.Set(pointPosition0 + binPointLength * (0.5 * pointDigit - j - 1) + 0.5 * pointStopPointDrawingLength - 0.5 * pointUnitDrawingLength + distancePoint, pointPosition1, binPointLength, binPointHeight); + break; + case 2: + r.Set(pointPosition0 - binPointLength * (j + 1) - pointUnitDrawingLength + distancePoint, pointPosition1, binPointLength, binPointHeight); + break; + } + targetSession.PaintDrawing(ref r, binPointMap[(int)(pointInt / Math.Pow(10, j) % 10)]); + } + r.Position0 += binPointLength; + r.Length = pointUnitDrawingLength; + targetSession.PaintDrawing(ref r, pointUnitDrawing); + } + break; + case PaintPipelineID.BPM: + var bpmInt = (int)(Math.Min(Math.Round(Math.Abs(Configure.Instance.BPMVarietyValue.Data switch + { + BPMVariety.BPM => defaultComputer.HandlingBPM, + BPMVariety.AudioMultiplier => defaultComputer.HandlingBPM * defaultComputer.AudioMultiplier, + BPMVariety.Multiplier => defaultComputer.HandlingBPM * defaultComputer.AudioMultiplier * defaultComputer.ModeComponentValue.Multiplier, + _ => default + })), int.MaxValue)); + var bpmPosition0 = drawingComponentValue.bpmPosition0; + var bpmPosition1 = drawingComponentValue.bpmPosition1; + var binBPMLength = drawingComponentValue.binBPMLength; + var binBPMHeight = drawingComponentValue.binBPMHeight; + var bpmUnitDrawingLength = drawingComponentValue.bpmUnitDrawingLength; + var bpmSystem = drawingComponentValue.bpmSystem; + var bpmDigit = QwilightComponent.GetDigit(bpmInt); + var altBPM = drawingComponentValue.altBPM; + var binBPMMap = UI.Instance.BinBPMMap; + var bpmUnitDrawing = UI.Instance.BPMUnitDrawing; + for (var i = altBPM >> 1; i >= altBPM % 2; --i) + { + var distanceBPM = i == 1 && has2P ? distance2P : 0F; + for (var j = bpmDigit - 1; j >= 0; --j) + { + switch (bpmSystem) + { + case 0: + r.Set(bpmPosition0 + binBPMLength * (bpmDigit - j - 1) + distanceBPM, bpmPosition1, binBPMLength, binBPMHeight); + break; + case 1: + r.Set(bpmPosition0 + binBPMLength * (0.5 * bpmDigit - j - 1) + distanceBPM, bpmPosition1, binBPMLength, binBPMHeight); + break; + case 2: + r.Set(bpmPosition0 - binBPMLength * (j + 1) + distanceBPM, bpmPosition1, binBPMLength, binBPMHeight); + break; + } + targetSession.PaintDrawing(ref r, binBPMMap[(int)(bpmInt / Math.Pow(10, j) % 10)]); + } + r.Position0 += binBPMLength; + r.Length = bpmUnitDrawingLength; + targetSession.PaintDrawing(ref r, bpmUnitDrawing); + } + break; + case PaintPipelineID.Multiplier: + var multiplierInt = (int)Math.Round(10 * defaultComputer.ModeComponentValue.Multiplier); + var multiplierPosition0 = drawingComponentValue.multiplierPosition0; + var multiplierPosition1 = drawingComponentValue.multiplierPosition1; + var binMultiplierLength = drawingComponentValue.binMultiplierLength; + var binMultiplierHeight = drawingComponentValue.binMultiplierHeight; + var multiplierStopPointDrawingLength = drawingComponentValue.multiplierStopPointDrawingLength; + var multiplierUnitDrawingLength = drawingComponentValue.multiplierUnitDrawingLength; + var multiplierDigit = multiplierInt < 10 ? 2 : QwilightComponent.GetDigit(multiplierInt); + var multiplierSystem = drawingComponentValue.multiplierSystem; + var altMultiplier = drawingComponentValue.altMultiplier; + var binMultiplierMap = UI.Instance.BinMultiplierMap; + var multiplierUnitDrawing = UI.Instance.MultiplierUnitDrawing; + var multiplierStopPointDrawing = UI.Instance.MultiplierStopPointDrawing; + for (var i = altMultiplier >> 1; i >= altMultiplier % 2; --i) + { + var distanceMultiplier = i == 1 && has2P ? distance2P : 0F; + switch (multiplierSystem) + { + case 0: + r.Set(multiplierPosition0 + multiplierStopPointDrawingLength + (multiplierDigit - 1) * binMultiplierLength + distanceMultiplier, multiplierPosition1, binMultiplierLength, binMultiplierHeight); + break; + case 1: + r.Set(multiplierPosition0 + ((multiplierDigit / 2.0) - 1) * binMultiplierLength + multiplierStopPointDrawingLength / 2 + distanceMultiplier, multiplierPosition1, binMultiplierLength, binMultiplierHeight); + break; + case 2: + r.Set(multiplierPosition0 - binMultiplierLength + distanceMultiplier, multiplierPosition1, binMultiplierLength, binMultiplierHeight); + break; + } + targetSession.PaintDrawing(ref r, binMultiplierMap[multiplierInt % 10]); + r.Position0 -= multiplierStopPointDrawingLength; + r.Length = multiplierStopPointDrawingLength; + targetSession.PaintDrawing(ref r, multiplierStopPointDrawing); + r.Position0 -= binMultiplierLength; + r.Length = binMultiplierLength; + targetSession.PaintDrawing(ref r, binMultiplierMap[multiplierInt / 10 % 10]); + for (var j = 2; j < multiplierDigit; ++j) + { + r.Position0 -= binMultiplierLength; + targetSession.PaintDrawing(ref r, binMultiplierMap[multiplierInt / (int)Math.Pow(10, j) % 10]); + } + r.Position0 -= multiplierUnitDrawingLength; + r.Length = multiplierUnitDrawingLength; + targetSession.PaintDrawing(ref r, multiplierUnitDrawing); + } + break; + case PaintPipelineID.JudgmentPaint: + var judgmentPaintComposition = (CanvasComposite)drawingComponentValue.judgmentPaintComposition; + var judgmentPaints = defaultComputer.JudgmentPaints; + lock (judgmentPaints) + { + foreach (var judgmentPaint in judgmentPaints.Values) + { + judgmentPaint.Paint(ref r, targetSession, 1F, judgmentPaintComposition); + } + } + break; + case PaintPipelineID.HitNotePaint: + var hitNotePaintComposition = (CanvasComposite)drawingComponentValue.hitNotePaintComposition; + var hitNotePaints = defaultComputer.HitNotePaints; + lock (hitNotePaints) + { + foreach (var hitNotePaint in hitNotePaints.Values) + { + hitNotePaint.Paint(ref r, targetSession, 1F, hitNotePaintComposition); + } + } + var hitLongNotePaints = defaultComputer.HitLongNotePaints; + lock (hitLongNotePaints) + { + foreach (var hitLongNotePaint in hitLongNotePaints.Values) + { + hitLongNotePaint.Paint(ref r, targetSession, 1F, hitNotePaintComposition); + } + } + break; + case PaintPipelineID.Net: + var netItemFaint = (float)Configure.Instance.UIConfigureValue.NetItemFaintV2; + if (netItemFaint > 0F) + { + var netItems = defaultComputer.NetItems; + if (netItems.Count > 0) + { + var netItemFaintInt = (int)(100 * netItemFaint); + var levyingNetPosition = defaultComputer.LevyingNetPosition; + var quitNetPosition = defaultComputer.QuitNetPosition; + var netSystem = drawingComponentValue.netSystem; + var netPosition0 = drawingComponentValue.netPosition0; + var netPosition1 = drawingComponentValue.netPosition1; + var altNet = drawingComponentValue.altNet; + var netPaint = UI.Instance.NetPaints[netItemFaintInt]; + var netInPaint = UI.Instance.NetInPaints[netItemFaintInt]; + for (var i = quitNetPosition; i >= levyingNetPosition; --i) + { + foreach (var netItem in netItems) + { + if (netItem.TargetPosition == i) + { + var drawings = netItem.Drawings; + var drawingPosition = netItem.DrawingPosition - levyingNetPosition; + var d2dHitPointsPaint = BaseUI.Instance.D2DHitPointsPaints[(int)netItem.HitPointsModeValue][netItem.IsMyNetItem ? netItemFaintInt : netItemFaintInt / 2]; + var netItemValue = Math.Min(netItem.HitPoints, 1.0); + var avatarNetStatusPaint = _avatarNetStatusPaints[(int)netItem.AvatarNetStatus][netItemFaintInt]; + var avatarID = netItem.AvatarID; + var avatarDrawing = AvatarDrawingSystem.Instance.JustGetAvatarDrawing(avatarID); + if (!avatarDrawing.HasValue && AvatarDrawingSystem.Instance.CanCallAPI(avatarID)) + { + Task.Factory.StartNew(getAvatarDrawing, avatarID); + } + var lowHitPointsPaint = _lowHitPointsPaints[(int)(netItem.IsFailedStatus * netItemFaintInt)]; + var avatarTitle = AvatarTitleSystem.Instance.JustGetAvatarTitle(avatarID); + if (!avatarTitle.HasValue && AvatarTitleSystem.Instance.CanCallAPI(avatarID)) + { + Task.Factory.StartNew(getAvatarTitle, avatarID); + } + var avatarEdge = AvatarEdgeSystem.Instance.JustGetAvatarEdge(avatarID); + if (!avatarEdge.HasValue && AvatarEdgeSystem.Instance.CanCallAPI(avatarID)) + { + Task.Factory.StartNew(getAvatarEdge, avatarID); + } + var hasAvatarTitle = !string.IsNullOrEmpty(avatarTitle?.Title); + var textItem0 = hasAvatarTitle ? PoolSystem.Instance.GetTextItem(avatarTitle.Value.Title, NetFont) : null; + var textBound0 = textItem0?.LayoutBounds ?? default; + var textBound0Length = textBound0.Width; + var textBound0Height = textBound0.Height; + var textItem1 = PoolSystem.Instance.GetTextItem(netItem.AvatarName, NetFont); + var textBound1 = textItem1.LayoutBounds; + var textBound1Length = textBound1.Width; + var textBound1Height = textBound1.Height; + var textItem2 = PoolSystem.Instance.GetTextItem(netItem.Stand, NetFont); + var textBound2 = textItem2.LayoutBounds; + var textBound2Length = textBound2.Width; + var textBound2Height = textBound2.Height; + var textItem3 = PoolSystem.Instance.GetTextItem(netItem.Point, NetFont); + var textBound3 = textItem3.LayoutBounds; + var textBound3Length = textBound3.Width; + var textBound3Height = textBound3.Height; + var textItem4 = PoolSystem.Instance.GetTextItem(netItem.Band, NetFont); + var textBound4 = textItem4.LayoutBounds; + var textBound4Length = textBound4.Width; + var textBound4Height = textBound4.Height; + + defaultComputer.HighestNetHeight = (float)Math.Max(defaultComputer.HighestNetHeight, Levels.StandardMargin + Math.Max(textBound0Height, textBound1Height) + Levels.StandardMargin + Utility.Max(textBound2Height, textBound3Height, textBound4Height) + Levels.StandardMarginFloat32); + var highestNetHeight = defaultComputer.HighestNetHeight; + + defaultComputer.HighestNetLength = (float)Utility.Max(defaultComputer.HighestNetLength, highestNetHeight + Levels.StandardMargin + textBound0Length + Levels.StandardMargin + textBound1Length + Levels.StandardMargin + highestNetHeight, highestNetHeight + Levels.StandardMargin + textBound2Length + Levels.StandardMargin + textBound3Length + Levels.StandardMargin + textBound4Length + Levels.StandardMargin + highestNetHeight); + var highestNetLength = defaultComputer.HighestNetLength; + + var lastJudged = netItem.LastJudged; + var hasLastJudged = lastJudged != Component.Judged.Not; + var drawingPosition1 = netPosition1 + (Levels.StandardEdgeFloat32 + highestNetHeight + Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32) * drawingPosition; + + var targetPosition0 = netPosition0; + if (netSystem == 2) + { + targetPosition0 -= Levels.StandardEdgeFloat32 + highestNetLength + Levels.StandardEdgeFloat32; + if (drawings != null) + { + targetPosition0 -= Levels.StandardMarginFloat32 + Levels.StandardEdgeFloat32 + highestNetHeight + Levels.StandardEdgeFloat32; + } + } + + for (var j = altNet >> 1; j >= altNet % 2; --j) + { + var distanceNet = j == 1 && has2P ? distance2P : 0F; + r.Set(targetPosition0 + distanceNet, drawingPosition1, Levels.StandardEdgeFloat32 + highestNetLength + Levels.StandardEdgeFloat32, Levels.StandardEdgeFloat32 + highestNetHeight + Levels.StandardEdgeFloat32); + targetSession.DrawRectangle(r, avatarNetStatusPaint); + if (!defaultComputer.IsPausingWindowOpened && defaultComputer.CanSetPosition) + { + SetNetItemHandler(ref r, handleCommentNetItemImpl, netItem); + } + + r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, r.Length - 2 * Levels.StandardEdgeFloat32, r.Height - 2 * Levels.StandardEdgeFloat32); + targetSession.FillRectangle(r, netInPaint); + + r.Position0 += highestNetHeight; + r.Length = (highestNetLength - 2 * highestNetHeight) * netItemValue; + r.Height = highestNetHeight; + targetSession.FillRectangle(r, d2dHitPointsPaint); + + r.Position0 += highestNetLength - 2 * highestNetHeight; + r.Length = highestNetHeight; + targetSession.PaintDrawing(ref r, BaseUI.Instance.QuitDrawings[(int)netItem.QuitValue][0]?.Drawing, netItemFaint); + + r.SetPosition(targetPosition0 + highestNetHeight + Levels.StandardMargin + distanceNet, drawingPosition1 + Levels.StandardMarginFloat32); + if (hasAvatarTitle) + { + var position0 = Levels.StandardMargin + textBound0Length; + targetSession.PaintText(textItem0, ref r, avatarTitle.Value.TitleColor); + r.Position0 += position0; + targetSession.PaintText(textItem1, ref r, netPaint); + r.Position0 -= position0; + } + else + { + targetSession.PaintText(textItem1, ref r, netPaint); + } + r.Position1 += Levels.StandardMargin + textBound1Height; + targetSession.PaintText(textItem2, ref r, netPaint); + r.Position0 += Levels.StandardMargin + textBound2Length; + targetSession.PaintText(textItem3, ref r, netPaint); + r.Position0 += Levels.StandardMargin + textBound3Length; + targetSession.PaintText(textItem4, ref r, netPaint); + + r.Set(targetPosition0 + distanceNet + Levels.StandardEdgeFloat32, drawingPosition1 + Levels.StandardEdgeFloat32, highestNetHeight, highestNetHeight); + targetSession.PaintDrawing(ref r, avatarDrawing?.Drawing, netItemFaint); + + s.Set(r.Position0 + r.Length * Levels.EdgeXY, r.Position1 + r.Height * Levels.EdgeXY, r.Length * Levels.EdgeMargin, r.Height * Levels.EdgeMargin); + targetSession.PaintDrawing(ref s, avatarEdge?.Drawing, netItemFaint); + + targetSession.FillRectangle(r, lowHitPointsPaint); + + if (drawings != null && netItem.AvatarNetStatus == Event.Types.AvatarNetStatus.Default) + { + var valueLength = highestNetHeight / netItem.P2BuiltLength; + var valueHeight = highestNetHeight / netItem.JudgmentMainPosition; + var target = PoolSystem.Instance.GetTargetItem(highestNetHeight, highestNetHeight); + using (var session = target.CreateDrawingSession()) + { + session.Clear(Colors.Black); + foreach (var drawing in drawings) + { + var averageColor = drawing.Param; + var valueColor = Color.FromArgb((byte)(averageColor & 255), (byte)((averageColor & 65280) >> 8), (byte)((averageColor & 16711680) >> 16), (byte)((averageColor & 4278190080) >> 24)); + switch (drawing.DrawingVariety) + { + case Event.Types.NetDrawing.Types.Variety.Note: + s.Set(drawing.Position0 * valueLength, drawing.Position1 * valueHeight, drawing.Length * valueLength, drawing.Height * valueHeight); + var ellipse = (float)Math.Min(s.Length / 2, s.Height / 2); + session.FillRoundedRectangle(s, ellipse, ellipse, valueColor); + break; + case Event.Types.NetDrawing.Types.Variety.Main: + s.Set(drawing.Position0 * valueLength, drawing.Position1 * valueHeight, drawing.Length * valueLength, drawing.Height * valueHeight); + session.FillRectangle(s, valueColor); + break; + case Event.Types.NetDrawing.Types.Variety.Meter: + s.Set(0F, drawing.Position1 * valueHeight, highestNetHeight, valueHeight); + session.FillRectangle(s, valueColor); + break; + } + } + } + + r.Set(targetPosition0 + distanceNet + Levels.StandardEdgeFloat32 + highestNetLength + Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32, drawingPosition1, Levels.StandardEdgeFloat32 + highestNetHeight + Levels.StandardEdgeFloat32, Levels.StandardEdgeFloat32 + highestNetHeight + Levels.StandardEdgeFloat32); + targetSession.DrawRectangle(r, (hasLastJudged ? d2dJudgmentPaints[(int)lastJudged] : FaintClearedPaints)[netItemFaintInt]); + if (!isItemMode && !defaultComputer.IsPausingWindowOpened && 0.0 <= loopingCounter) + { + SetNetItemHandler(ref r, handleIONetItemImpl, netItem); + } + + r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, r.Length - 2 * Levels.StandardEdgeFloat32, r.Height - 2 * Levels.StandardEdgeFloat32); + targetSession.PaintDrawing(ref r, target, netItemFaint); + } + } + break; + } + } + } + } + } + break; + case PaintPipelineID.Unpause: + var pauseCount = defaultComputer.PauseCount; + if (pauseCount > 0) + { + var pausePosition0 = drawingComponentValue.pausePosition0; + var pausePosition1 = drawingComponentValue.pausePosition1; + var pauseLength = drawingComponentValue.pauseLength; + var pauseHeight = drawingComponentValue.pauseHeight; + var pauseSystem = drawingComponentValue.pauseSystem; + var altPause = drawingComponentValue.altPause; + var pauseDrawings = UI.Instance.PauseDrawings; + for (var i = altPause >> 1; i >= altPause % 2; --i) + { + var distancePause = i == 1 && has2P ? distance2P : 0F; + switch (pauseSystem) + { + case 0: + r.Set(pausePosition0 + distancePause, pausePosition1, pauseLength, pauseHeight); + break; + case 1: + r.Set(pausePosition0 - pauseLength / 2 + distancePause, pausePosition1, pauseLength, pauseHeight); + break; + case 2: + r.Set(pausePosition0 - pauseLength + distancePause, pausePosition1, pauseLength, pauseHeight); + break; + } + targetSession.PaintDrawing(ref r, pauseDrawings[pauseCount - 1][defaultComputer.PauseFrames[pauseCount - 1]]); + } + } + break; + case PaintPipelineID.Status: + var statusPosition0 = drawingComponentValue.statusPosition0; + var statusPosition1 = drawingComponentValue.statusPosition1; + var statusLength = drawingComponentValue.statusLength; + var statusHeight = drawingComponentValue.statusHeight; + var statusSystem = drawingComponentValue.statusSystem; + var altStatus = drawingComponentValue.altStatus; + var statusDrawing = UI.Instance.StatusDrawing; + if (statusDrawing.HasValue) + { + var statusDrawingValue = statusDrawing.Value; + var statusDrawingBound = statusDrawingValue.DrawingBound; + var statusDrawingLength = statusDrawingBound.Length; + var statusDrawingHeight = statusDrawingBound.Height; + for (var i = altStatus >> 1; i >= altStatus % 2; --i) + { + var distanceStatus = i == 1 && has2P ? distance2P : 0F; + switch (statusSystem) + { + case 0: + r.Set(statusPosition0 + distanceStatus, statusPosition1 + statusHeight * (1 - status), statusLength, statusHeight * status); + s.Set(0.0, (1 - status) * statusDrawingHeight, statusDrawingLength, statusDrawingHeight * status); + break; + case 1: + r.Set(statusPosition0 + distanceStatus, statusPosition1, statusLength, statusHeight * status); + s.SetArea(statusDrawingLength, statusDrawingHeight * status); + break; + case 2: + r.Set(statusPosition0 + distanceStatus + statusLength * (1 - status), statusPosition1, statusLength * status, statusHeight); + s.Set((1 - status) * statusDrawingLength, 0.0, statusDrawingLength * status, statusDrawingHeight); + break; + case 3: + r.Set(statusPosition0 + distanceStatus, statusPosition1, statusLength * status, statusHeight); + s.SetArea(statusDrawingLength * status, statusDrawingHeight); + break; + } + targetSession.PaintDrawing(ref r, ref s, statusDrawingValue); + } + } + break; + case PaintPipelineID.Hms: + var length = (int)(defaultComputer.Length / 1000.0); + var mLength = length / 60; + var sLength = length % 60; + var wait = Math.Clamp((int)(loopingCounter / 1000.0), 0, length); + var mWait = wait / 60; + var sWait = wait % 60; + var hmsColonDrawingLength = drawingComponentValue.hmsColonDrawingLength; + var hmsSlashDrawingLength = drawingComponentValue.hmsSlashDrawingLength; + var hmsPosition0 = drawingComponentValue.hmsPosition0; + var hmsPosition1 = drawingComponentValue.hmsPosition1; + var binHmsLength = drawingComponentValue.binHmsLength; + var binHmsHeight = drawingComponentValue.binHmsHeight; + var mWaitDigit = QwilightComponent.GetDigit(mWait); + var mLengthDigit = QwilightComponent.GetDigit(mLength); + var hmsSystem = drawingComponentValue.hmsSystem; + var binHmsMap = UI.Instance.BinHmsMap; + var altHms = drawingComponentValue.altHms; + var hmsColonDrawimg = UI.Instance.ColonDrawing; + var hmsSlashDrawing = UI.Instance.SlashDrawing; + for (var i = altHms >> 1; i >= altHms % 2; --i) + { + var distanceHms = i == 1 && has2P ? distance2P : 0F; + switch (hmsSystem) + { + case 0: + r.Set(hmsPosition0 + 2 * hmsColonDrawingLength + hmsSlashDrawingLength + (mWaitDigit + mLengthDigit + 3) * binHmsLength + distanceHms, hmsPosition1, binHmsLength, binHmsHeight); + break; + case 1: + r.Set(hmsPosition0 + (mWaitDigit / 2.0 + mLengthDigit / 2.0 + 1) * binHmsLength + hmsColonDrawingLength / 2 + hmsSlashDrawingLength / 2 + distanceHms, hmsPosition1, binHmsLength, binHmsHeight); + break; + case 2: + r.Set(hmsPosition0 - binHmsLength + distanceHms, hmsPosition1, binHmsLength, binHmsHeight); + break; + } + targetSession.PaintDrawing(ref r, binHmsMap[sLength / 1 % 10]); + r.Position0 -= binHmsLength; + r.Length = binHmsLength; + targetSession.PaintDrawing(ref r, binHmsMap[sLength / 10 % 10]); + r.Position0 -= hmsColonDrawingLength; + r.Length = hmsColonDrawingLength; + targetSession.PaintDrawing(ref r, hmsColonDrawimg); + for (var j = 0; j < mLengthDigit; ++j) + { + r.Position0 -= binHmsLength; + r.Length = binHmsLength; + targetSession.PaintDrawing(ref r, binHmsMap[(int)(mLength / Math.Pow(10, j) % 10)]); + } + r.Position0 -= hmsSlashDrawingLength; + r.Length = hmsSlashDrawingLength; + targetSession.PaintDrawing(ref r, hmsSlashDrawing); + r.Length = binHmsLength; + for (var j = 1; j <= 10; j *= 10) + { + r.Position0 -= binHmsLength; + targetSession.PaintDrawing(ref r, binHmsMap[sWait / j % 10]); + } + r.Position0 -= hmsColonDrawingLength; + r.Length = hmsColonDrawingLength; + targetSession.PaintDrawing(ref r, hmsColonDrawimg); + for (var j = 0; j < mWaitDigit; ++j) + { + r.Position0 -= binHmsLength; + r.Length = binHmsLength; + targetSession.PaintDrawing(ref r, binHmsMap[(int)(mWait / Math.Pow(10, j) % 10)]); + } + } + break; + case PaintPipelineID.JudgmentPoints: + var totalJudgmentPoints = 0.0; + foreach (var judgment in judgments) + { + totalJudgmentPoints += judgment; + } + var judgmentPointsPosition0 = drawingComponentValue.judgmentPointsPosition0; + var judgmentPointsPosition1 = drawingComponentValue.judgmentPointsPosition1; + var judgmentPointsLength = drawingComponentValue.judgmentPointsLength; + var judgmentPointsHeight = drawingComponentValue.judgmentPointsHeight; + var judgmentPointsDrawings = UI.Instance.JudgmentPointsDrawings; + var altJudgmentPoints = drawingComponentValue.altJudgmentPoints; + var judgmentPointsSystem = drawingComponentValue.judgmentPointsSystem; + var lastPosition = 0.0; + for (var i = (int)Component.Judged.Highest; i <= (int)Component.Judged.Lowest; ++i) + { + var judgmentPoint = judgments[i] / totalJudgmentPoints; + var judgmentPointDrawing = judgmentPointsDrawings[i]; + if (judgmentPointDrawing.HasValue) + { + var judgmentPointDrawingValue = judgmentPointDrawing.Value; + var judgmentPointDrawingBound = judgmentPointDrawingValue.DrawingBound; + var judgmentPointDrawingLength = judgmentPointDrawingBound.Length; + var judgmentPointDrawingHeight = judgmentPointDrawingBound.Height; + for (var j = altJudgmentPoints >> 1; j >= altJudgmentPoints % 2; --j) + { + var distanceJudgmentPoints = j == 1 && has2P ? distance2P : 0F; + switch (judgmentPointsSystem) + { + case 0: + r.Set(judgmentPointsPosition0 + distanceJudgmentPoints, judgmentPointsPosition1 + judgmentPointsHeight * lastPosition, judgmentPointsLength, judgmentPointsHeight * judgmentPoint); + s.Set(0.0, lastPosition * judgmentPointDrawingHeight, judgmentPointDrawingLength, judgmentPointDrawingHeight * judgmentPoint); + break; + case 1: + r.Set(judgmentPointsPosition0 + distanceJudgmentPoints, judgmentPointsPosition1 + judgmentPointsHeight * (1 - lastPosition - judgmentPoint), judgmentPointsLength, judgmentPointsHeight * judgmentPoint); + s.Set(0.0, judgmentPointDrawingHeight * (1 - lastPosition - judgmentPoint), judgmentPointDrawingLength, judgmentPointDrawingHeight * judgmentPoint); + break; + case 2: + r.Set(judgmentPointsPosition0 + distanceJudgmentPoints + judgmentPointsLength * lastPosition, judgmentPointsPosition1, judgmentPointsLength * judgmentPoint, judgmentPointsHeight); + s.Set(judgmentPointDrawingLength * lastPosition, 0.0, judgmentPointDrawingLength * judgmentPoint, judgmentPointDrawingHeight); + break; + case 3: + r.Set(judgmentPointsPosition0 + distanceJudgmentPoints + judgmentPointsLength * (1 - lastPosition - judgmentPoint), judgmentPointsPosition1, judgmentPointsLength * judgmentPoint, judgmentPointsHeight); + s.Set(judgmentPointDrawingLength * (1 - lastPosition - judgmentPoint), 0.0, judgmentPointDrawingLength * judgmentPoint, judgmentPointDrawingHeight); + break; + } + targetSession.PaintDrawing(ref r, ref s, judgmentPointDrawingValue); + } + lastPosition += judgmentPoint; + } + } + break; + case PaintPipelineID.JudgmentMain: + var judgmentMainDrawings = UI.Instance.JudgmentMainDrawings[(int)inputMode]; + var judgmentMainFrames = defaultComputer.JudgmentMainFrames; + var judgmentMainPosition1s = drawingComponentValue.judgmentMainPosition1s; + var judgmentMainHeights = drawingComponentValue.judgmentMainHeights; + foreach (var drawingPipeline in drawingPipelines) + { + for (var i = inputCount; i > 0; --i) + { + if (drawingPipeline == drawingInputModeMap[i]) + { + r.Set(defaultComputer.GetPosition(i), judgmentMainPosition1s[i], drawingNoteLengthMap[i], judgmentMainHeights[i]); + targetSession.PaintDrawing(ref r, judgmentMainDrawings[i][judgmentMainFrames[i]]); + } + } + } + break; + case PaintPipelineID.MainAreaFaint: + var mainAreaFaint = Configure.Instance.MainAreaFaint; + if (mainAreaFaint > 0.0) + { + var mainAreaFaintPaint = FaintFilledPaints[(int)(100 * mainAreaFaint)]; + r.Set(mainPosition, mainPosition1, p1Length, mainHeight); + targetSession.FillRectangle(r, mainAreaFaintPaint); + if (has2P) + { + r.Position0 += distance2P; + targetSession.FillRectangle(r, mainAreaFaintPaint); + } + } + break; + case PaintPipelineID.AudioMultiplier: + var audioMultiplierInt = (int)Math.Round(100 * defaultComputer.AudioMultiplier); + var audioMultiplierSystem = drawingComponentValue.audioMultiplierSystem; + var audioMultiplierPosition0 = drawingComponentValue.audioMultiplierPosition0; + var audioMultiplierPosition1 = drawingComponentValue.audioMultiplierPosition1; + var binAudioMultiplierLength = drawingComponentValue.binAudioMultiplierLength; + var binAudioMultiplierHeight = drawingComponentValue.binAudioMultiplierHeight; + var altAudioMultiplier = drawingComponentValue.altAudioMultiplier; + var audioMultiplierStopPointDrawingLength = drawingComponentValue.audioMultiplierStopPointDrawingLength; + var audioMultiplierUnitDrawingLength = drawingComponentValue.audioMultiplierUnitDrawingLength; + var binAudioMultiplierMap = UI.Instance.BinAudioMultiplierMap; + var audioMultiplierUnitDrawing = UI.Instance.AudioMultiplierUnitDrawing; + var audioMultiplierStopPointDrawing = UI.Instance.AudioMultiplierStopPointDrawing; + for (var i = altAudioMultiplier >> 1; i >= altAudioMultiplier % 2; --i) + { + var distanceAudioMultiplier = i == 1 && has2P ? distance2P : 0F; + switch (audioMultiplierSystem) + { + case 0: + r.Set(audioMultiplierPosition0 + audioMultiplierStopPointDrawingLength + 2 * binAudioMultiplierLength + distanceAudioMultiplier, audioMultiplierPosition1, binAudioMultiplierLength, binAudioMultiplierHeight); + break; + case 1: + r.Set(audioMultiplierPosition0 + 0.5 * binAudioMultiplierLength + audioMultiplierStopPointDrawingLength / 2 + distanceAudioMultiplier, audioMultiplierPosition1, binAudioMultiplierLength, binAudioMultiplierHeight); + break; + case 2: + r.Set(audioMultiplierPosition0 - binAudioMultiplierLength + distanceAudioMultiplier, audioMultiplierPosition1, binAudioMultiplierLength, binAudioMultiplierHeight); + break; + } + targetSession.PaintDrawing(ref r, binAudioMultiplierMap[audioMultiplierInt / 1 % 10]); + r.Position0 -= binAudioMultiplierLength; + r.Length = binAudioMultiplierLength; + targetSession.PaintDrawing(ref r, binAudioMultiplierMap[audioMultiplierInt / 10 % 10]); + r.Position0 -= audioMultiplierStopPointDrawingLength; + r.Length = audioMultiplierStopPointDrawingLength; + targetSession.PaintDrawing(ref r, audioMultiplierStopPointDrawing); + r.Position0 -= binAudioMultiplierLength; + r.Length = binAudioMultiplierLength; + targetSession.PaintDrawing(ref r, binAudioMultiplierMap[audioMultiplierInt / 100 % 10]); + r.Position0 -= audioMultiplierUnitDrawingLength; + r.Length = audioMultiplierUnitDrawingLength; + targetSession.PaintDrawing(ref r, audioMultiplierUnitDrawing); + } + break; + case PaintPipelineID.HitPointsVisualizer: + var hitPointsInt = (int)(100 * hitPoints); + var hitPointsVisualizerPosition0 = drawingComponentValue.hitPointsVisualizerPosition0; + var hitPointsVisualizerPosition1 = drawingComponentValue.hitPointsVisualizerPosition1; + var binHitPointsVisualizerLength = drawingComponentValue.binHitPointsVisualizerLength; + var binHitPointsVisualizerHeight = drawingComponentValue.binHitPointsVisualizerHeight; + var hitPointsVisualizerUnitDrawingLength = drawingComponentValue.hitPointsVisualizerUnitDrawingLength; + var hitPointsVisualizerSystem = drawingComponentValue.hitPointsVisualizerSystem; + var altHitPointsVisualizer = drawingComponentValue.altHitPointsVisualizer; + var binHitPointsVisualizerMap = UI.Instance.BinHitPointsVisualizerMap; + var hitPointsVisualizerUnitDrawing = UI.Instance.HitPointsVisualizerUnitDrawing; + var hitPointsDigit = QwilightComponent.GetDigit(hitPointsInt); + for (var i = altHitPointsVisualizer >> 1; i >= altHitPointsVisualizer % 2; --i) + { + var distanceHitPointsVisualizer = i == 1 && has2P ? distance2P : 0F; + for (var j = hitPointsDigit - 1; j >= 0; --j) + { + switch (hitPointsVisualizerSystem) + { + case 0: + r.Set(hitPointsVisualizerPosition0 + binHitPointsVisualizerLength * (hitPointsDigit - j - 1) + distanceHitPointsVisualizer, hitPointsVisualizerPosition1, binHitPointsVisualizerLength, binHitPointsVisualizerHeight); + break; + case 1: + r.Set(hitPointsVisualizerPosition0 + binHitPointsVisualizerLength * (0.5 * hitPointsDigit - j - 1) + distanceHitPointsVisualizer, hitPointsVisualizerPosition1, binHitPointsVisualizerLength, binHitPointsVisualizerHeight); + break; + case 2: + r.Set(hitPointsVisualizerPosition0 - binHitPointsVisualizerLength * (j + 1) + distanceHitPointsVisualizer, hitPointsVisualizerPosition1, binHitPointsVisualizerLength, binHitPointsVisualizerHeight); + break; + } + targetSession.PaintDrawing(ref r, binHitPointsVisualizerMap[(int)(hitPointsInt / Math.Pow(10, j) % 10)]); + } + r.Position0 += binHitPointsVisualizerLength; + r.Length = hitPointsVisualizerUnitDrawingLength; + targetSession.PaintDrawing(ref r, hitPointsVisualizerUnitDrawing); + } + break; + case PaintPipelineID.HighestJudgment: + PaintInt(judgments[(int)Component.Judged.Highest], drawingComponentValue.highestJudgmentValueSystem, drawingComponentValue.highestJudgmentValuePosition0, drawingComponentValue.highestJudgmentValuePosition1, drawingComponentValue.binHighestJudgmentValueLength, drawingComponentValue.binHighestJudgmentValueHeight, drawingComponentValue.altHighestJudgmentValue, binJudgmentValueMap[(int)Component.Judged.Highest]); + break; + case PaintPipelineID.HigherJudgment: + PaintInt(judgments[(int)Component.Judged.Higher], drawingComponentValue.higherJudgmentValueSystem, drawingComponentValue.higherJudgmentValuePosition0, drawingComponentValue.higherJudgmentValuePosition1, drawingComponentValue.binHigherJudgmentValueLength, drawingComponentValue.binHigherJudgmentValueHeight, drawingComponentValue.altHigherJudgmentValue, binJudgmentValueMap[(int)Component.Judged.Higher]); + break; + case PaintPipelineID.HighJudgment: + PaintInt(judgments[(int)Component.Judged.High], drawingComponentValue.highJudgmentValueSystem, drawingComponentValue.highJudgmentValuePosition0, drawingComponentValue.highJudgmentValuePosition1, drawingComponentValue.binHighJudgmentValueLength, drawingComponentValue.binHighJudgmentValueHeight, drawingComponentValue.altHighJudgmentValue, binJudgmentValueMap[(int)Component.Judged.High]); + break; + case PaintPipelineID.LowJudgment: + PaintInt(judgments[(int)Component.Judged.Low], drawingComponentValue.lowJudgmentValueSystem, drawingComponentValue.lowerJudgmentValuePosition0, drawingComponentValue.lowJudgmentValuePosition1, drawingComponentValue.binLowJudgmentValueLength, drawingComponentValue.binLowJudgmentValueHeight, drawingComponentValue.altLowJudgmentValue, binJudgmentValueMap[(int)Component.Judged.Low]); + break; + case PaintPipelineID.LowerJudgment: + PaintInt(judgments[(int)Component.Judged.Lower], drawingComponentValue.lowerJudgmentValueSystem, drawingComponentValue.lowerJudgmentValuePosition0, drawingComponentValue.lowerJudgmentValuePosition1, drawingComponentValue.binLowerJudgmentValueLength, drawingComponentValue.binLowerJudgmentValueHeight, drawingComponentValue.altLowerJudgmentValue, binJudgmentValueMap[(int)Component.Judged.Lower]); + break; + case PaintPipelineID.LowestJudgment: + PaintInt(judgments[(int)Component.Judged.Lowest], drawingComponentValue.lowestJudgmentValueSystem, drawingComponentValue.lowestJudgmentValuePosition0, drawingComponentValue.lowestJudgmentValuePosition1, drawingComponentValue.binLowestJudgmentValueLength, drawingComponentValue.binLowestJudgmentValueHeight, drawingComponentValue.altLowestJudgmentValue, binJudgmentValueMap[(int)Component.Judged.Lowest]); + break; + case PaintPipelineID.HighestBand: + PaintInt(defaultComputer.HighestBand, drawingComponentValue.highestBandSystem, drawingComponentValue.highestBandPosition0, drawingComponentValue.highestBandPosition1, drawingComponentValue.binHighestBandLength, drawingComponentValue.binHighestBandHeight, drawingComponentValue.altHighestBand, UI.Instance.BinHighestBandMap); + break; + case PaintPipelineID.Limiter: + var limiterPosition1 = drawingComponentValue.limiterPosition1; + var limiterLength = drawingComponentValue.limiterLength; + var limiterHeight = drawingComponentValue.limiterHeight; + var limiterColor = Configure.Instance.LimiterColor; + var inputMappingValue = (int)defaultComputer.InputMappingValue; + if (Configure.Instance.TotalLimiterVariety) + { + var defaultPaintValues = Component.BasePaintMap[inputMappingValue, (int)inputMode]; + for (var i = inputCount; i > 1; --i) + { + var limiterPosition0 = defaultComputer.GetPosition(defaultPaintValues[i]); + targetSession.DrawLine(limiterPosition0, limiterPosition1, limiterPosition0, limiterHeight, limiterColor, limiterLength); + } + } + else + { + if (Configure.Instance.AutoableLimiterVariety) + { + var autoableInputs = Component.AutoableInputs[(int)inputMode]; + for (var i = inputCount; i > 0; --i) + { + if (Array.IndexOf(autoableInputs, i) != -1) + { + var limiterPosition0 = defaultComputer.GetPosition(i); + targetSession.DrawLine(limiterPosition0, limiterPosition1, limiterPosition0, limiterHeight, limiterColor, limiterLength); + limiterPosition0 += drawingNoteLengthMap[i]; + targetSession.DrawLine(limiterPosition0, limiterPosition1, limiterPosition0, limiterHeight, limiterColor, limiterLength); + } + } + } + if (Configure.Instance.CenterLimiterVariety) + { + var limiterCenterValues = Component.LimiterCenterMap[inputMappingValue, (int)inputMode, has2P ? 1 : 0]; + for (var i = inputCount; i > 0; --i) + { + for (var j = limiterCenterValues[i] - 1; j >= 0; --j) + { + var limiterPosition0 = defaultComputer.GetPosition(i) + j * drawingNoteLengthMap[i]; + targetSession.DrawLine(limiterPosition0, limiterPosition1, limiterPosition0, limiterHeight, limiterColor, limiterLength); + } + } + } + if (Configure.Instance.Limiter57Variety && (inputMode == Component.InputMode.InputMode242 || inputMode == Component.InputMode.InputMode484)) + { + var limiter57Values = Component.Limiter57Map[(int)inputMode]; + for (var i = inputCount; i > 0; --i) + { + if (limiter57Values[i]) + { + var limiterPosition0 = defaultComputer.GetPosition(i); + targetSession.DrawLine(limiterPosition0, limiterPosition1, limiterPosition0, limiterHeight, limiterColor, limiterLength); + } + } + } + } + break; + case PaintPipelineID.JudgmentVisualizer: + var judgmentVisualizerPosition0 = drawingComponentValue.judgmentVisualizerPosition0; + var judgmentVisualizerPosition1 = drawingComponentValue.judgmentVisualizerPosition1; + var judgmentVisualizerLength = drawingComponentValue.judgmentVisualizerLength; + var judgmentVisualizerHeight = drawingComponentValue.judgmentVisualizerHeight; + var judgmentVisualizerContentsLength = drawingComponentValue.judgmentVisualizerContentsLength; + var judgmentVisualizerContentsHeight = drawingComponentValue.judgmentVisualizerContentsHeight; + var judgmentVisualizerSystem = drawingComponentValue.judgmentVisualizerSystem; + var altJudgmentVisualizer = drawingComponentValue.altJudgmentVisualizer; + var targetJudgmentVisualizerValues = defaultComputer.JudgmentVisualizerValues; + for (var i = altJudgmentVisualizer >> 1; i >= altJudgmentVisualizer % 2; --i) + { + var distanceJudgmentVisualizer = i == 1 && has2P ? distance2P : 0F; + var judgmentVisualizerPosition0Float = judgmentVisualizerPosition0 + distanceJudgmentVisualizer; + var judgmentVisualizerValues = targetJudgmentVisualizerValues[i]; + lock (judgmentVisualizerValues) + { + foreach (var judgmentVisualizerValue in judgmentVisualizerValues) + { + var judgmentColorPaint = d2dJudgmentPaints[(int)judgmentVisualizerValue.Judged][(int)(100 * judgmentVisualizerValue.Status)]; + switch (judgmentVisualizerSystem) + { + case 0: + var judgmentVisualizerPosition1Value = (float)(judgmentVisualizerPosition1 + judgmentVisualizerHeight * (1 - judgmentVisualizerValue.Judgment)); + targetSession.DrawLine(judgmentVisualizerPosition0Float, judgmentVisualizerPosition1Value, judgmentVisualizerPosition0Float + judgmentVisualizerContentsLength, judgmentVisualizerPosition1Value, judgmentColorPaint, judgmentVisualizerContentsHeight); + break; + case 1: + judgmentVisualizerPosition1Value = (float)(judgmentVisualizerPosition1 + judgmentVisualizerHeight * judgmentVisualizerValue.Judgment); + targetSession.DrawLine(judgmentVisualizerPosition0Float, judgmentVisualizerPosition1Value, judgmentVisualizerPosition0Float + judgmentVisualizerContentsLength, judgmentVisualizerPosition1Value, judgmentColorPaint, judgmentVisualizerContentsHeight); + break; + case 2: + var judgmentVisualizerPosition0Value = (float)(judgmentVisualizerPosition0Float + judgmentVisualizerLength * (1 - judgmentVisualizerValue.Judgment)); + targetSession.DrawLine(judgmentVisualizerPosition0Value, judgmentVisualizerPosition1, judgmentVisualizerPosition0Value, judgmentVisualizerPosition1 + judgmentVisualizerContentsHeight, judgmentColorPaint, judgmentVisualizerContentsLength); + break; + case 3: + judgmentVisualizerPosition0Value = (float)(judgmentVisualizerPosition0Float + judgmentVisualizerLength * judgmentVisualizerValue.Judgment); + targetSession.DrawLine(judgmentVisualizerPosition0Value, judgmentVisualizerPosition1, judgmentVisualizerPosition0Value, judgmentVisualizerPosition1 + judgmentVisualizerContentsHeight, judgmentColorPaint, judgmentVisualizerContentsLength); + break; + } + } + } + } + break; + case PaintPipelineID.InputVisualizer: + PaintInt(defaultComputer.InputCountQueue.Count, drawingComponentValue.inputVisualizerSystem, drawingComponentValue.inputVisualizerPosition0, drawingComponentValue.inputVisualizerPosition1, drawingComponentValue.binInputVisualizerLength, drawingComponentValue.binInputVisualizerHeight, drawingComponentValue.altInputVisualizer, UI.Instance.BinInputVisualizerMap); + break; + case PaintPipelineID.Hunter: + var hunter = defaultComputer.Hunter.Value; + if (hunter.HasValue) + { + var hunterPosition0 = drawingComponentValue.hunterPosition0; + var hunterPosition1 = drawingComponentValue.hunterPosition1; + var binHunterLength = drawingComponentValue.binHunterLength; + var binHunterHeight = drawingComponentValue.binHunterHeight; + var hunterFrontDrawingLength = drawingComponentValue.hunterFrontDrawingLength; + var hunterSystem = drawingComponentValue.hunterSystem; + var altHunter = drawingComponentValue.altHunter; + var binHunterMap = UI.Instance.BinHunterMap; + var drawingHunterHigher = UI.Instance.HunterHigherDrawing; + var drawingHunterLower = UI.Instance.HunterLowerDrawing; + var hunterValue = hunter.Value; + var absHunter = Math.Abs(hunterValue); + var hunterDigit = QwilightComponent.GetDigit(absHunter); + for (var i = altHunter >> 1; i >= altHunter % 2; --i) + { + var distanceHunter = i == 1 && has2P ? distance2P : 0F; + switch (hunterSystem) + { + case 0: + r.Set(hunterPosition0 - binHunterLength + distanceHunter, hunterPosition1, hunterFrontDrawingLength, binHunterHeight); + break; + case 1: + r.Set(hunterPosition0 - 0.5 * (binHunterLength * hunterDigit + hunterFrontDrawingLength) + distanceHunter, hunterPosition1, hunterFrontDrawingLength, binHunterHeight); + break; + case 2: + r.Set(hunterPosition0 - binHunterLength * hunterDigit - hunterFrontDrawingLength + distanceHunter, hunterPosition1, hunterFrontDrawingLength, binHunterHeight); + break; + } + if (absHunter > 0) + { + targetSession.PaintDrawing(ref r, hunterValue > 0 ? drawingHunterHigher : drawingHunterLower); + } + r.Position0 += hunterFrontDrawingLength; + r.Length = binHunterLength; + for (var j = hunterDigit - 1; j >= 0; --j) + { + targetSession.PaintDrawing(ref r, binHunterMap[(int)(absHunter / Math.Pow(10, j) % 10)]); + r.Position0 += binHunterLength; + } + } + } + break; + case PaintPipelineID.Title: + var title = defaultComputer.Title; + var titleFont = UI.Instance.TitleFont; + var titleColor = UI.Instance.TitleColor; + var titlePosition0 = drawingComponentValue.titlePosition0; + var titlePosition1 = drawingComponentValue.titlePosition1; + var titleLength = drawingComponentValue.titleLength; + var titleHeight = drawingComponentValue.titleHeight; + var altTitle = drawingComponentValue.altTitle; + for (var i = altTitle >> 1; i >= altTitle % 2; --i) + { + var distanceTitle = i == 1 && has2P ? distance2P : 0F; + r.Set(titlePosition0 + distanceTitle, titlePosition1, titleLength, titleHeight); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(title, titleFont, (float)r.Length, (float)r.Height), ref r, titleColor); + } + break; + case PaintPipelineID.Artist: + var artist = defaultComputer.Artist; + var artistFont = UI.Instance.ArtistFont; + var artistColor = UI.Instance.ArtistColor; + var artistPosition0 = drawingComponentValue.artistPosition0; + var artistPosition1 = drawingComponentValue.artistPosition1; + var artistLength = drawingComponentValue.artistLength; + var artistHeight = drawingComponentValue.artistHeight; + var altArtist = drawingComponentValue.altArtist; + for (var i = altArtist >> 1; i >= altArtist % 2; --i) + { + var distanceArtist = i == 1 && has2P ? distance2P : 0F; + r.Set(artistPosition0 + distanceArtist, artistPosition1, artistLength, artistHeight); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(artist, artistFont, (float)r.Length, (float)r.Height), ref r, artistColor); + } + break; + case PaintPipelineID.MediaInput: + var mediaInputFaint = Configure.Instance.MediaInputFaint; + if (mediaInputFaint > 0.0) + { + r.Set(Configure.Instance.MediaInputPosition0, Configure.Instance.MediaInputPosition1, Configure.Instance.MediaInputLength, Configure.Instance.MediaInputHeight); + MediaInputSystem.Instance.PaintMediaInput(targetSession, ref r, (float)mediaInputFaint); + } + break; + case PaintPipelineID.VeilDrawing: + var veilDrawing = VeilDrawing.Drawing; + if (veilDrawing != null) + { + var veilDrawingValue = veilDrawing.Value; + var veilDrawingBound = veilDrawingValue.DrawingBound; + var veilDrawingHeight = veilDrawingBound.Height * p1Length / veilDrawingBound.Length; + r.Set(mainPosition, Configure.Instance.VeilDrawingHeight - veilDrawingHeight, p1Length, veilDrawingHeight); + targetSession.PaintDrawing(ref r, veilDrawing); + if (has2P) + { + r.Position0 += distance2P; + targetSession.PaintDrawing(ref r, veilDrawing); + } + } + break; + case PaintPipelineID.Genre: + var genre = defaultComputer.GenreText; + var genreFont = UI.Instance.GenreFont; + var genreColor = UI.Instance.GenreColor; + var genrePosition0 = drawingComponentValue.genrePosition0; + var genrePosition1 = drawingComponentValue.genrePosition1; + var genreLength = drawingComponentValue.genreLength; + var genreHeight = drawingComponentValue.genreHeight; + var altGenre = drawingComponentValue.altGenre; + for (var i = altGenre >> 1; i >= altGenre % 2; --i) + { + var distanceGenre = i == 1 && has2P ? distance2P : 0F; + r.Set(genrePosition0 + distanceGenre, genrePosition1, genreLength, genreHeight); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(genre, genreFont, (float)r.Length, (float)r.Height), ref r, genreColor); + } + break; + case PaintPipelineID.LevelText: + var levelText = defaultComputer.LevelText; + var levelTextFont = UI.Instance.LevelTextFont; + var levelTextColor = BaseUI.Instance.D2DLevelColors[(int)defaultComputer.LevelValue]; + var levelTextPosition0 = drawingComponentValue.levelTextPosition0; + var levelTextPosition1 = drawingComponentValue.levelTextPosition1; + var levelTextLength = drawingComponentValue.levelTextLength; + var levelTextHeight = drawingComponentValue.levelTextHeight; + var altLevelText = drawingComponentValue.altLevelText; + for (var i = altLevelText >> 1; i >= altLevelText % 2; --i) + { + var distanceLevelText = i == 1 && has2P ? distance2P : 0F; + r.Set(levelTextPosition0 + distanceLevelText, levelTextPosition1, levelTextLength, levelTextHeight); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(levelText, levelTextFont, (float)r.Length, (float)r.Height), ref r, levelTextColor); + } + break; + case PaintPipelineID.WantLevel: + var wantLevelID = defaultComputer.NoteFile.WantLevelID; + var wantLevelFont = UI.Instance.WantLevelFont; + var wantLevelIDColor = UI.Instance.WantLevelIDColor; + var wantLevelPosition0 = drawingComponentValue.wantLevelPosition0; + var wantLevelPosition1 = drawingComponentValue.wantLevelPosition1; + var wantLevelLength = drawingComponentValue.wantLevelLength; + var wantLevelHeight = drawingComponentValue.wantLevelHeight; + var altWantLevel = drawingComponentValue.altWantLevel; + for (var i = altWantLevel >> 1; i >= altWantLevel % 2; --i) + { + var distanceWantLevel = i == 1 && has2P ? distance2P : 0F; + r.Set(wantLevelPosition0 + distanceWantLevel, wantLevelPosition1, wantLevelLength, wantLevelHeight); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(wantLevelID, wantLevelFont, (float)r.Length, (float)r.Height), ref r, wantLevelIDColor); + } + break; + case PaintPipelineID.Level: + var levelDrawings = UI.Instance.LevelDrawings[(int)defaultComputer.LevelValue]; + var levelPosition0 = drawingComponentValue.levelPosition0; + var levelPosition1 = drawingComponentValue.levelPosition1; + var levelLength = drawingComponentValue.levelLength; + var levelHeight = drawingComponentValue.levelHeight; + var altLevel = drawingComponentValue.altLevel; + var levelFrame = defaultComputer.LevelFrame; + for (var i = altLevel >> 1; i >= altLevel % 2; --i) + { + var distanceLevel = i == 1 && has2P ? distance2P : 0F; + r.Set(levelPosition0 + distanceLevel, levelPosition1, levelLength, levelHeight); + targetSession.PaintDrawing(ref r, levelDrawings[levelFrame]); + } + break; + case PaintPipelineID.AutoMain: + if (isAutoMode) + { + var autoMainDrawings = UI.Instance.AutoMainDrawings; + var autoMainPosition0 = drawingComponentValue.autoMainPosition0; + var autoMainPosition1 = drawingComponentValue.autoMainPosition1; + var autoMainLength = drawingComponentValue.autoMainLength; + var autoMainHeight = drawingComponentValue.autoMainHeight; + var autoMainSystem = drawingComponentValue.autoMainSystem; + var altAutoMain = drawingComponentValue.altAutoMain; + var autoMainFrame = defaultComputer.AutoMainFrame; + for (var i = altAutoMain >> 1; i >= altAutoMain % 2; --i) + { + var distanceAutoMain = i == 1 && has2P ? distance2P : 0F; + switch (autoMainSystem) + { + case 0: + r.Set(autoMainPosition0 + distanceAutoMain, autoMainPosition1, autoMainLength, autoMainHeight); + break; + case 1: + r.Set(autoMainPosition0 - autoMainLength / 2 + distanceAutoMain, autoMainPosition1, autoMainLength, autoMainHeight); + break; + case 2: + r.Set(autoMainPosition0 - autoMainLength + distanceAutoMain, autoMainPosition1, autoMainLength, autoMainHeight); + break; + } + targetSession.PaintDrawing(ref r, autoMainDrawings[autoMainFrame]); + } + } + break; + case PaintPipelineID.EarlyValue: + PaintInt(defaultComputer.EarlyValue, drawingComponentValue.earlyValueSystem, drawingComponentValue.earlyValuePosition0, drawingComponentValue.earlyValuePosition1, drawingComponentValue.binEarlyValueLength, drawingComponentValue.binEarlyValueHeight, drawingComponentValue.altEarlyValue, UI.Instance.BinEarlyValueMap); + break; + case PaintPipelineID.LateValue: + PaintInt(defaultComputer.LateValue, drawingComponentValue.lateValueSystem, drawingComponentValue.lateValuePosition0, drawingComponentValue.lateValuePosition1, drawingComponentValue.binLateValueLength, drawingComponentValue.binLateValueHeight, drawingComponentValue.altLateValue, UI.Instance.BinLateValueMap); + break; + case PaintPipelineID.JudgmentVSVisualizer: + var vsJudgment = judgments[(int)Component.Judged.Higher] + judgments[(int)Component.Judged.High] + judgments[(int)Component.Judged.Low] + judgments[(int)Component.Judged.Lower] + judgments[(int)Component.Judged.Lowest]; + if (vsJudgment > 0) + { + var judgmentVSVisualizerInt = (int)(100 * judgments[(int)Component.Judged.Highest] / vsJudgment); + var judgmentVSVisualizerStopPointDrawingLength = drawingComponentValue.judgmentVSVisualizerStopPointDrawingLength; + var judgmentVSVisualizerPosition0 = drawingComponentValue.judgmentVSVisualizerPosition0; + var judgmentVSVisualizerPosition1 = drawingComponentValue.judgmentVSVisualizerPosition1; + var binJudgmentVSVisualizerLength = drawingComponentValue.binJudgmentVSVisualizerLength; + var binJudgmentVSVisualizerHeight = drawingComponentValue.binJudgmentVSVisualizerHeight; + var judgmentVSVisualizerSystem = drawingComponentValue.judgmentVSVisualizerSystem; + var altJudgmentVSVisualizer = drawingComponentValue.altJudgmentVSVisualizer; + var binJudgmentVSVisualizerMap = UI.Instance.BinJudgmentVSVisualizerMap; + var judgmentVSVisualizerStopPointDrawing = UI.Instance.JudgmentVSVisualizerStopPointDrawing; + var judgmentVSVisualizerDigit = judgmentVSVisualizerInt < 100 ? 3 : QwilightComponent.GetDigit(judgmentVSVisualizerInt); + for (var i = altJudgmentVSVisualizer >> 1; i >= altJudgmentVSVisualizer % 2; --i) + { + var distancePoint = i == 1 && has2P ? distance2P : 0F; + for (var j = judgmentVSVisualizerDigit - 1; j >= 2; --j) + { + switch (judgmentVSVisualizerSystem) + { + case 0: + r.Set(judgmentVSVisualizerPosition0 + binJudgmentVSVisualizerLength * (judgmentVSVisualizerDigit - j - 1) + distancePoint, judgmentVSVisualizerPosition1, binJudgmentVSVisualizerLength, binJudgmentVSVisualizerHeight); + break; + case 1: + r.Set(judgmentVSVisualizerPosition0 + binJudgmentVSVisualizerLength * (0.5 * judgmentVSVisualizerDigit - j - 1) - judgmentVSVisualizerStopPointDrawingLength * 0.5 + distancePoint, judgmentVSVisualizerPosition1, binJudgmentVSVisualizerLength, binJudgmentVSVisualizerHeight); + break; + case 2: + r.Set(judgmentVSVisualizerPosition0 - binJudgmentVSVisualizerLength * (j + 1) - judgmentVSVisualizerStopPointDrawingLength + distancePoint, judgmentVSVisualizerPosition1, binJudgmentVSVisualizerLength, binJudgmentVSVisualizerHeight); + break; + } + targetSession.PaintDrawing(ref r, binJudgmentVSVisualizerMap[(int)(judgmentVSVisualizerInt / Math.Pow(10, j) % 10)]); + } + r.Position0 += binJudgmentVSVisualizerLength; + r.Length = judgmentVSVisualizerStopPointDrawingLength; + targetSession.PaintDrawing(ref r, judgmentVSVisualizerStopPointDrawing); + for (var j = 1; j >= 0; --j) + { + switch (judgmentVSVisualizerSystem) + { + case 0: + r.Set(judgmentVSVisualizerPosition0 + binJudgmentVSVisualizerLength * (judgmentVSVisualizerDigit - j - 1) + judgmentVSVisualizerStopPointDrawingLength + distancePoint, judgmentVSVisualizerPosition1, binJudgmentVSVisualizerLength, binJudgmentVSVisualizerHeight); + break; + case 1: + r.Set(judgmentVSVisualizerPosition0 + binJudgmentVSVisualizerLength * (0.5 * judgmentVSVisualizerDigit - j - 1) + 0.5 * judgmentVSVisualizerStopPointDrawingLength + distancePoint, judgmentVSVisualizerPosition1, binJudgmentVSVisualizerLength, binJudgmentVSVisualizerHeight); + break; + case 2: + r.Set(judgmentVSVisualizerPosition0 - binJudgmentVSVisualizerLength * (j + 1) + distancePoint, judgmentVSVisualizerPosition1, binJudgmentVSVisualizerLength, binJudgmentVSVisualizerHeight); + break; + } + targetSession.PaintDrawing(ref r, binJudgmentVSVisualizerMap[(int)(judgmentVSVisualizerInt / Math.Pow(10, j) % 10)]); + } + } + } + break; + case PaintPipelineID.MainJudgmentMeter: + var mainJudgmentMeterDrawings = UI.Instance.MainJudgmentMeterDrawings[(int)inputMode]; + var mainJudgmentMeterFrames = defaultComputer.MainJudgmentMeterFrames; + var mainJudgmentMeterPosition1s = drawingComponentValue.mainJudgmentMeterPosition1s; + var mainJudgmentMeterHeights = drawingComponentValue.mainJudgmentMeterHeights; + foreach (var drawingPipeline in drawingPipelines) + { + for (var i = inputCount; i > 0; --i) + { + if (drawingPipeline == drawingInputModeMap[i]) + { + r.Set(defaultComputer.GetPosition(i), mainJudgmentMeterPosition1s[i], drawingNoteLengthMap[i], mainJudgmentMeterHeights[i]); + targetSession.PaintDrawing(ref r, mainJudgmentMeterDrawings[i].GetValueOrDefault(mainJudgmentMeterFrames[i])); + } + } + } + break; + case PaintPipelineID.StatusSlider: + var statusSliderPosition0 = drawingComponentValue.statusSliderPosition0; + var statusSliderPosition1 = drawingComponentValue.statusSliderPosition1; + var statusSliderLength = drawingComponentValue.statusSliderLength; + var statusSliderHeight = drawingComponentValue.statusSliderHeight; + var statusSliderContentsLength = drawingComponentValue.statusSliderContentsLength; + var statusSliderContentsHeight = drawingComponentValue.statusSliderContentsHeight; + var statusSliderSystem = drawingComponentValue.statusSystem; + var altStatusSlider = drawingComponentValue.altStatusSlider; + var statusSliderDrawing = UI.Instance.StatusSliderDrawing; + if (statusSliderDrawing.HasValue) + { + var statusSliderDrawingValue = statusSliderDrawing.Value; + var statusSliderDrawingBound = statusSliderDrawingValue.DrawingBound; + var statusSliderDrawingLength = statusSliderDrawingBound.Length; + var statusSliderDrawingHeight = statusSliderDrawingBound.Height; + for (var i = altStatusSlider >> 1; i >= altStatusSlider % 2; --i) + { + var distanceStatusSlider = i == 1 && has2P ? distance2P : 0F; + switch (statusSliderSystem) + { + case 0: + r.Set(statusSliderPosition0 + distanceStatusSlider, statusSliderPosition1 + statusSliderHeight * (1 - status) - statusSliderContentsHeight / 2, statusSliderContentsLength, statusSliderContentsHeight); + break; + case 1: + r.Set(statusSliderPosition0 + distanceStatusSlider, statusSliderPosition1 + statusSliderHeight * status - statusSliderContentsHeight / 2, statusSliderContentsLength, statusSliderContentsHeight); + break; + case 2: + r.Set(statusSliderPosition0 + distanceStatusSlider + statusSliderLength * (1 - status) - statusSliderContentsLength / 2, statusSliderPosition1, statusSliderContentsLength, statusSliderContentsHeight); + break; + case 3: + r.Set(statusSliderPosition0 + distanceStatusSlider + statusSliderLength * status - statusSliderContentsLength / 2, statusSliderPosition1, statusSliderContentsLength, statusSliderContentsHeight); + break; + } + targetSession.PaintDrawing(ref r, statusSliderDrawingValue); + } + } + break; + case PaintPipelineID.JudgmentInputVisualizer: + var judgmentInputVisualizerPosition0 = drawingComponentValue.judgmentInputVisualizerPosition0; + var judgmentInputVisualizerPosition1 = drawingComponentValue.judgmentInputVisualizerPosition1; + var judgmentInputVisualizerLength = drawingComponentValue.judgmentInputVisualizerLength; + var judgmentInputVisualizerHeight = drawingComponentValue.judgmentInputVisualizerHeight; + var altJudgmentInputVisualizer = drawingComponentValue.altJudgmentInputVisualizer; + var judgmentInputValues = defaultComputer.JudgmentInputValues; + var targetJudgmentInputVisualizerLength = judgmentInputVisualizerLength / 100; + var judgmentInputDrawings = UI.Instance.JudgmentInputDrawings; + for (var i = altJudgmentInputVisualizer >> 1; i >= altJudgmentInputVisualizer % 2; --i) + { + var distanceJudgmentInputVisualizer = i == 1 && has2P ? distance2P : 0F; + var judgmentInputVisualizerPosition0Float = judgmentInputVisualizerPosition0 + distanceJudgmentInputVisualizer; + var judgmentInputValuesLength = judgmentInputValues.Length; + for (var j = 0; j < judgmentInputValuesLength; ++j) + { + var lastJudgmentInputValue = 1.0; + var judgmentInputValue = judgmentInputValues[j]; + r.Set(judgmentInputVisualizerPosition0 + j * targetJudgmentInputVisualizerLength, judgmentInputVisualizerPosition1 + judgmentInputVisualizerHeight, targetJudgmentInputVisualizerLength, 0.0); + for (var m = judgmentInputValue.Length - 1; m >= 0; --m) + { + var value = judgmentInputValue[m]; + lastJudgmentInputValue -= value; + r.Height = judgmentInputVisualizerHeight * value; + if (r.Height > 0.0) + { + var judgmentInputDrawing = judgmentInputDrawings[m]; + if (judgmentInputDrawing.HasValue) + { + var judgmentInputDrawingBound = judgmentInputDrawing.Value.DrawingBound; + var judgmentInputDrawingHeight = judgmentInputDrawingBound.Height; + r.Position1 -= r.Height; + s.Set(0.0, lastJudgmentInputValue * judgmentInputDrawingHeight, judgmentInputDrawingBound.Length, judgmentInputDrawingHeight * value); + targetSession.PaintDrawing(ref r, ref s, judgmentInputDrawing); + } + } + } + } + } + break; + } + + void PaintInt(int value, int system, double position0, double position1, double length, double height, int alt, DrawingItem?[] drawingItems) + { + var digit = QwilightComponent.GetDigit(value); + for (var i = alt >> 1; i >= alt % 2; --i) + { + var distance = i == 1 && has2P ? distance2P : 0F; + for (var j = digit - 1; j >= 0; --j) + { + var drawingItem = drawingItems[(int)(value / Math.Pow(10, j) % 10)]; + switch (system) + { + case 0: + r.Set(position0 + length * (digit - j - 1) + distance, position1, length, height); + break; + case 1: + r.Set(position0 + length * (0.5 * digit - j - 1) + distance, position1, length, height); + break; + case 2: + r.Set(position0 - length * (j + 1) + distance, position1, length, height); + break; + } + targetSession.PaintDrawing(ref r, drawingItem); + } + } + } + } + } + } + + if (!isValidNetDrawings) + { + defaultComputer.IsValidNetDrawings = true; + } + + var assistTextPosition1 = drawingComponentValue.assistTextPosition1; + if (defaultComputer.CanUndo && defaultComputer.IsPausingWindowOpened) + { + assistTextPosition1 += PaintAssistText(assistTextPosition1, PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.StandardInputs[3].ToString(), InputAssistFont), 100, FaintClearedPaints, FaintFilledPaints, null, 0, null, null, PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.UndoContents, InputAssistFont), 100); + } + else if (defaultComputer.IsPassable) + { + assistTextPosition1 += PaintAssistText(assistTextPosition1, PoolSystem.Instance.GetTextItem("ENTER", InputAssistFont), 100, FaintClearedPaints, FaintFilledPaints, null, 0, null, null, PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.PassContents, InputAssistFont), 100); + } + + var assistTextFaint = loopingCounter < 0.0 ? (int)(100 * Math.Sqrt(-loopingCounter / Component.LevyingWait)) : 0; + if (assistTextFaint > 0) + { + assistTextPosition1 += PaintAssistText(assistTextPosition1, PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.LowerMultiplier].ToString(), InputAssistFont), assistTextFaint, FaintClearedPaints, FaintFilledPaints, PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.HigherMultiplier].ToString(), InputAssistFont), assistTextFaint, FaintClearedPaints, FaintFilledPaints, PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.MultiplierContents, InputAssistFont), assistTextFaint); + + if (defaultComputer.LoadedMedia) + { + assistTextPosition1 += PaintAssistText(assistTextPosition1, PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.Media].ToString(), InputAssistFont), assistTextFaint, FaintClearedPaints, FaintFilledPaints, null, assistTextFaint, FaintClearedPaints, FaintFilledPaints, PoolSystem.Instance.GetTextItem(Configure.Instance.Media ? "BGA ON" : "BGA OFF", InputAssistFont), assistTextFaint); + } + + if (isItemMode) + { + assistTextPosition1 += PaintAssistText(assistTextPosition1, PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.PostItem0].ToString(), InputAssistFont), assistTextFaint, FaintClearedPaints, FaintFilledPaints, PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.PostItem1].ToString(), InputAssistFont), assistTextFaint, FaintClearedPaints, FaintFilledPaints, PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.PostItemContents, InputAssistFont), assistTextFaint); + } + } + + if (defaultComputer.IsPostableItemMode) + { + var lastPostableItems = defaultComputer.LastPostableItems; + if (lastPostableItems != null) + { + var assistFaint0 = (int)(100 * defaultComputer.PostableItemFaints[0].Value); + var assistFaint1 = (int)(100 * defaultComputer.PostableItemFaints[1].Value); + var assistTextItem0 = assistFaint0 > 0.0 ? PoolSystem.Instance.GetTextItem(lastPostableItems[0]?.ToString(), InputAssistFont) : null; + var assistTextItem1 = assistFaint1 > 0.0 ? PoolSystem.Instance.GetTextItem(lastPostableItems[1]?.ToString(), InputAssistFont) : null; + assistTextPosition1 += PaintAssistText(assistTextPosition1, assistTextItem0, assistFaint0, lastPostableItems[0]?.ItemPaints, FaintClearedPaints, assistTextItem1, assistFaint1, lastPostableItems[1]?.ItemPaints, FaintClearedPaints, null, 0); + } + + var postedItemVariety = defaultComputer.PostedItemVariety; + var postedItemFaint = (int)(100 * defaultComputer.PostedItemFaints[postedItemVariety]); + if (postedItemFaint > 0.0) + { + var postedItemTextItem = PoolSystem.Instance.GetTextItem(defaultComputer.PostedItemText, InputAssistFont); + var postedItemTextBound = postedItemTextItem.LayoutBounds; + var postedItemTextBoundLength = postedItemTextBound.Width; + var postedItemTextBoundHeight = postedItemTextBound.Height; + r.Set(mainPosition + (p1Length - postedItemTextBoundLength) / 2, assistTextPosition1 - postedItemTextBoundHeight / 2, postedItemTextBoundLength, postedItemTextBoundHeight); + targetSession.PaintVisibleText(postedItemTextItem, ref r, FaintItemPaints[postedItemVariety][postedItemFaint], FaintFilledPaints[postedItemFaint]); + assistTextPosition1 += (float)(Levels.StandardMargin + Utility.Max(postedItemTextBoundHeight, postedItemTextBoundLength, postedItemTextBoundHeight)); + } + + var valueItemPosition0 = 0F; + foreach (var (valueItem, valueItemStatus) in defaultComputer.PostableItemStatusMap) + { + if (valueItemStatus.IsHandling) + { + var valueItemTextBoundHeight = 24F; + var valueItemTextItem = PoolSystem.Instance.GetTextItem(PoolSystem.Instance.GetFormattedText("{0} ({1})", valueItem.ToString(), valueItemStatus.AvatarName), NotifyXamlFont, 0F, valueItemTextBoundHeight); + var valueItemTextBound = valueItemTextItem.LayoutBounds; + var valueItemHeight = Levels.StandardMarginFloat32 + valueItemTextBoundHeight + Levels.StandardMarginFloat32; + + valueItemPosition0 += Levels.StandardMarginFloat32; + var valueItemLength = Levels.StandardMarginFloat32 + valueItemTextBound.Width + Levels.StandardMarginFloat32; + r.Set(valueItemPosition0, Levels.StandardMarginFloat32, Levels.StandardEdgeFloat32 + valueItemLength + Levels.StandardEdgeFloat32, Levels.StandardEdgeFloat32 + valueItemHeight + Levels.StandardEdgeFloat32); + targetSession.DrawRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, Colors.White); + + r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, valueItemLength, r.Height - 2 * Levels.StandardEdgeFloat32); + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, FaintFilledPaints[50]); + + r.Length *= valueItemStatus.Wait / valueItemStatus.TotalWait; + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, valueItem.ItemColor); + + r.SetPosition(r.Position0 + Levels.StandardMarginFloat32, r.Position1 + Levels.StandardMarginFloat32); + targetSession.PaintText(valueItemTextItem, ref r, Colors.White); + valueItemPosition0 += (float)(Levels.StandardEdgeFloat32 + valueItemLength + Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32); + } + } + } + + float PaintAssistText(float assistTextPosition1, CanvasTextLayout assistTextItem0, int assistFaint0, ICanvasBrush[] assistTextItem0Paints, ICanvasBrush[] assistTextItem0TextPaints, CanvasTextLayout assistTextItem1, int assistFaint1, ICanvasBrush[] assistTextItem1Paints, ICanvasBrush[] assistTextItem1TextPaints, CanvasTextLayout assistTextItem2, int assistFaint2) + { + var assistTextBound0 = assistTextItem0?.LayoutBounds; + var assistTextBound0Length = assistTextBound0.HasValue ? Levels.StandardMargin + assistTextBound0.Value.Width + Levels.StandardMargin : 0F; + var assistTextBound0Height = assistTextBound0.HasValue ? Levels.StandardMargin + assistTextBound0.Value.Height + Levels.StandardMargin : 0F; + var assistTextBound1 = assistTextItem1?.LayoutBounds; + var assistTextBound1Length = assistTextBound1.HasValue ? Levels.StandardMargin + assistTextBound1.Value.Width + Levels.StandardMargin : 0F; + var assistTextBound1Height = assistTextBound1.HasValue ? Levels.StandardMargin + assistTextBound1.Value.Height + Levels.StandardMargin : 0F; + var assistTextBound2 = assistTextItem2?.LayoutBounds; + var assistTextBound2Length = assistTextBound2.HasValue ? assistTextBound2.Value.Width : 0.0; + var assistTextBound2Height = assistTextBound2.HasValue ? assistTextBound2.Value.Height : 0.0; + + var assistTextPosition0 = mainPosition + (p1Length - assistTextBound0Length - Levels.StandardMarginFloat32 - assistTextBound1Length - Levels.StandardMarginFloat32 - assistTextBound2Length) / 2; + if (assistTextItem0 != null) + { + r.Set(assistTextPosition0, assistTextPosition1 - assistTextBound0Height / 2, assistTextBound0Length, assistTextBound0Height); + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, assistTextItem0Paints[assistFaint0]); + r.Position0 += Levels.StandardMargin; + r.Position1 += Levels.StandardMargin; + targetSession.PaintText(assistTextItem0, ref r, assistTextItem0TextPaints[assistFaint0]); + + assistTextPosition0 += Levels.StandardMarginFloat32 + assistTextBound0Length; + } + + if (assistTextItem1 != null) + { + r.Set(assistTextPosition0, assistTextPosition1 - assistTextBound1Height / 2, assistTextBound1Length, assistTextBound1Height); + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, assistTextItem1Paints[assistFaint1]); + r.Position0 += Levels.StandardMargin; + r.Position1 += Levels.StandardMargin; + targetSession.PaintText(assistTextItem1, ref r, assistTextItem1TextPaints[assistFaint1]); + + assistTextPosition0 += Levels.StandardMarginFloat32 + assistTextBound1Length; + } + + if (assistTextItem2 != null) + { + r.Set(assistTextPosition0, assistTextPosition1 - assistTextBound2Height / 2, assistTextBound2Length, assistTextBound2Height); + targetSession.PaintVisibleText(assistTextItem2, ref r, FaintClearedPaints[assistFaint2], FaintFilledPaints[assistFaint2]); + } + + return (float)(Levels.StandardMargin + Utility.Max(assistTextBound0Height, assistTextBound1Height, assistTextBound2Height)); + } + + var inputAssistTextFaint = assistTextFaint; + if (inputAssistTextFaint > 0) + { + var inputAssistTextPosition1 = drawingComponentValue.inputAssistTextPosition1; + var mainNoteLengthLevyingMap = drawingComponentValue.MainNoteLengthLevyingMap; + for (var i = inputCount; i > 0; --i) + { + var inputAssistTextItem = PoolSystem.Instance.GetTextItem(Configure.Instance.DefaultInputBundlesV6.Inputs[(int)inputMode][i][0].ToString(), InputAssistFont); + var inputAssistTextBound = inputAssistTextItem.LayoutBounds; + var inputAssistTextLength = inputAssistTextBound.Width; + var inputAssistTextHeight = inputAssistTextBound.Height; + r.Set(mainPosition + (isIn2P[i] ? p2Position : 0.0) + mainNoteLengthLevyingMap[i] + (drawingNoteLengthMap[i] - inputAssistTextLength) / 2, inputAssistTextPosition1 - inputAssistTextHeight / 2, inputAssistTextLength, inputAssistTextHeight); + targetSession.PaintVisibleText(inputAssistTextItem, ref r, FaintClearedPaints[inputAssistTextFaint], FaintFilledPaints[inputAssistTextFaint]); + } + } + + var defaultHitPoints = defaultComputer.DefaultHitPoints; + if (Configure.Instance.LowHitPointsFaintUI && defaultHitPoints < 0.5 && isHandling && defaultComputer.IsFailMode) + { + targetSession.FillRectangle(0F, 0F, defaultLength, defaultHeight, _lowHitPointsPaints[(int)(50 * (0.5 - defaultHitPoints))]); + } + + if (faintNoteModeValue == ModeComponent.FaintNoteMode.TotalFading) + { + targetSession.FillRectangle(0F, 0F, defaultLength, defaultHeight, FaintFilledPaints[(int)(100 * defaultComputer.FaintCosine)]); + } + + if (defaultComputer.IsPausingWindowOpened) + { + targetSession.FillRectangle(0F, 0F, defaultLength, defaultHeight, FaintFilledPaints[50]); + } + + var mediaModifierContents = defaultComputer.MediaModifierValue.Text; + if (!string.IsNullOrEmpty(mediaModifierContents)) + { + pauseNotify0Position1 += PaintNotify0Contents(mediaModifierContents, pauseNotify0Position0, pauseNotify0Position1, PauseNotifyFont, Colors.White) + Levels.StandardMarginFloat32; + } + + var wwwLevelDataValue = defaultComputer.WwwLevelDataValue; + if (wwwLevelDataValue != null) + { + if (!string.IsNullOrWhiteSpace(wwwLevelDataValue.StandContents)) + { + pauseNotify1Position1 += PaintNotify1Contents(wwwLevelDataValue.StandContents, pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, wwwLevelDataValue.IsStandSatisify ? Colors.Green : Colors.Red) + Levels.StandardMarginFloat32; + } + if (!string.IsNullOrWhiteSpace(wwwLevelDataValue.PointContents)) + { + pauseNotify1Position1 += PaintNotify1Contents(wwwLevelDataValue.PointContents, pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, wwwLevelDataValue.IsPointSatisify ? Colors.Green : Colors.Red) + Levels.StandardMarginFloat32; + } + if (!string.IsNullOrWhiteSpace(wwwLevelDataValue.BandContents)) + { + pauseNotify1Position1 += PaintNotify1Contents(wwwLevelDataValue.BandContents, pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, wwwLevelDataValue.IsBandSatisify ? Colors.Green : Colors.Red) + Levels.StandardMarginFloat32; + } + if (!defaultComputer.CanPause) + { + pauseNotify1Position1 += PaintNotify1Contents(LanguageSystem.Instance.NotAllowPauseText, pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, Colors.Red) + Levels.StandardMarginFloat32; + } + for (var i = wwwLevelDataValue.JudgmentContents.Length - 1; i >= 0; --i) + { + var judgmentContents = wwwLevelDataValue.JudgmentContents[i]; + if (!string.IsNullOrWhiteSpace(judgmentContents)) + { + pauseNotify1Position1 += PaintNotify1Contents(judgmentContents, pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, wwwLevelDataValue.IsJudgmentsSatisify[i] ? Colors.Green : Colors.Red) + Levels.StandardMarginFloat32; + } + } + } + + var ioAvatarNames = defaultComputer.IOAvatarNames; + var ioAvatarNamesCount = ioAvatarNames.Count; + if (ioAvatarNamesCount > 0) + { + if (ioAvatarNamesCount > 3) + { + pauseNotify1Position1 += PaintNotify1Contents(PoolSystem.Instance.GetValueText(ioAvatarNamesCount, LanguageSystem.Instance.IOHigherContents), pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, Colors.White) + Levels.StandardMarginFloat32; + } + else + { + pauseNotify1Position1 += PaintNotify1Contents(PoolSystem.Instance.GetFormattedText(LanguageSystem.Instance.IOLowerContents, string.Join(", ", ioAvatarNames)), pauseNotify1Position0, pauseNotify1Position1, PauseNotifyFont, Colors.White) + Levels.StandardMarginFloat32; + } + } + + var waitingTwilightLevel = defaultComputer.WaitingTwilightLevel; + if (waitingTwilightLevel != DefaultCompute.WaitingTwilight.Default) + { + pauseNotify0Position1 += PaintNotify0Contents(waitingTwilightLevel switch + { + DefaultCompute.WaitingTwilight.Net => LanguageSystem.Instance.WaitingNetContents, + DefaultCompute.WaitingTwilight.WaitIO => LanguageSystem.Instance.WaitingIOContents, + DefaultCompute.WaitingTwilight.CallIO => LanguageSystem.Instance.CallingIOContents, + _ => default + }, pauseNotify0Position0, pauseNotify0Position1, PauseNotifyFont, Colors.White) + Levels.StandardMarginFloat32; + } + + if (!isItemMode && defaultComputer.IsTwilightNetItems && Configure.Instance.UIPipelineNet && defaultComputer.IsF) + { + pauseNotify0Position1 += PaintNotify0Contents(LanguageSystem.Instance.TwilightCommentIOContents, pauseNotify0Position0, pauseNotify0Position1, PauseNotifyFont, Colors.White) + Levels.StandardMarginFloat32; + } + + if (defaultComputer.IsPausingWindowOpened) + { + var defaultSpinningModeValue = Configure.Instance.DefaultSpinningModeValue; + r.Set(drawingComponentValue.pausedUnpausePosition0, drawingComponentValue.pausedUnpausePosition1, drawingComponentValue.pausedUnpauseLength, drawingComponentValue.pausedUnpauseHeight); + SetEventHandler(ref r, setDefaultSpinningModeUnpause); + targetSession.PaintDrawing(ref r, UI.Instance.PausedUnpauseDrawings[defaultSpinningModeValue == Configure.DefaultSpinningMode.Unpause ? 1 : 0]); + + r.Set(drawingComponentValue.pausedConfigurePosition0, drawingComponentValue.pausedConfigurePosition1, drawingComponentValue.pausedConfigureLength, drawingComponentValue.pausedConfigureHeight); + SetEventHandler(ref r, setDefaultSpinningModeConfigure); + targetSession.PaintDrawing(ref r, UI.Instance.PausedConfigureDrawings[defaultSpinningModeValue == Configure.DefaultSpinningMode.Configure ? 1 : 0]); + + r.Set(drawingComponentValue.pausedUndoPosition0, drawingComponentValue.pausedUndoPosition1, drawingComponentValue.pausedUndoLength, drawingComponentValue.pausedUndoHeight); + SetEventHandler(ref r, setDefaultSpinningModeUndo); + targetSession.PaintDrawing(ref r, UI.Instance.PausedUndoDrawings[defaultSpinningModeValue == Configure.DefaultSpinningMode.Undo ? 1 : 0]); + + r.Set(drawingComponentValue.pausedStopPosition0, drawingComponentValue.pausedStopPosition1, drawingComponentValue.pausedStopLength, drawingComponentValue.pausedStopHeight); + SetEventHandler(ref r, setDefaultSpinningModeStop); + targetSession.PaintDrawing(ref r, UI.Instance.PausedStopDrawings[defaultSpinningModeValue == Configure.DefaultSpinningMode.Stop ? 1 : 0]); + } + + PaintFading(); + PaintNotifyXamlItems(); + } + else + { + pauseNotify0Position1 += PaintNotify0Contents(faultText, pauseNotify0Position0, pauseNotify0Position1, PauseNotifyFont, Colors.Red) + Levels.StandardMarginFloat32; + } + } + PaintFramerate(); + } + + CopyD3D9Drawing(); + + using (targetSession = _rawTargetSystem.CreateDrawingSession(Colors.Black)) + { + targetSession.DrawImage(_targetSystem); + + SetNVLLFlagIf(ReflexMarker.eSimulationEnd); + SetNVLLFlagIf(ReflexMarker.eRenderSubmitStart); + } + SetNVLLFlagIf(ReflexMarker.eRenderSubmitEnd); + } + + if (isNVLL) + { + WaitNVLL(); + } + + SetNVLLFlagIf(ReflexMarker.ePresentStart); + var vesa = Configure.Instance.VESAV2; + _rawTargetSystem.Present(vesa ? 1 : 0); + SetNVLLFlagIf(ReflexMarker.ePresentEnd); + + if (isNVLL) + { + GetNVLLFrame(); + } + SetNVLLFlagIf(ReflexMarker.eSimulationStart); + + void SetNVLLFlagIf(ReflexMarker setFlag) + { + if (isNVLL) + { + SetNVLLFlag(setFlag); + } + } + break; + case MainViewModel.Mode.Quit: + defaultComputer = mainViewModel.Computer; + modeComponentValue = defaultComputer.ModeComponentValue; + var handlingComputer = mainViewModel.GetHandlingComputer(); + lock (D2D1CSX) + { + using (targetSession = _targetSystem.CreateDrawingSession()) + { + targetSession.Clear(Colors.Black); + + lock (UI.Instance.ContentsCSX) + { + var faultText = BaseUI.Instance.FaultText; + if (string.IsNullOrEmpty(faultText)) + { + var judgmentQuitColors = BaseUI.Instance.JudgmentQuitColors; + var judgmentColors = BaseUI.Instance.JudgmentColors; + + PaintBaseProperty(0); + + r.Set(BaseUI.Instance.TitleQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.Title, BaseUI.Instance.TitleQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.TitleQuitColor); + r.Set(BaseUI.Instance.ArtistQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.Artist, BaseUI.Instance.ArtistQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.ArtistQuitColor); + r.Set(BaseUI.Instance.GenreQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.GenreText, BaseUI.Instance.GenreQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.GenreQuitColor); + r.Set(BaseUI.Instance.LevelQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.LevelText, BaseUI.Instance.LevelQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.D2DLevelColors[(int)defaultComputer.LevelValue]); + r.Set(BaseUI.Instance.WantLevelIDQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.NoteFile.WantLevelID, BaseUI.Instance.WantLevelIDQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.WantLevelIDQuitColor); + + var judgmentDrawings = BaseUI.Instance.JudgmentDrawings; + r.Set(BaseUI.Instance.TotalNotesJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.TotalNotesJudgmentDrawing); + r.Set(BaseUI.Instance.HighestJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, judgmentDrawings[(int)Component.Judged.Highest]?.Drawing); + r.Set(BaseUI.Instance.HigherJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, judgmentDrawings[(int)Component.Judged.Higher]?.Drawing); + r.Set(BaseUI.Instance.HighJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, judgmentDrawings[(int)Component.Judged.High]?.Drawing); + r.Set(BaseUI.Instance.LowJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, judgmentDrawings[(int)Component.Judged.Low]?.Drawing); + r.Set(BaseUI.Instance.LowerJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, judgmentDrawings[(int)Component.Judged.Lower]?.Drawing); + r.Set(BaseUI.Instance.LowestJudgmentQuitPoint); + targetSession.PaintDrawing(ref r, judgmentDrawings[(int)Component.Judged.Lowest]?.Drawing); + + r.Set(BaseUI.Instance.TotalNotesJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.TotalNotesInQuit, BaseUI.Instance.TotalNotesQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.TotalNotesJudgmentQuitColor); + r.Set(BaseUI.Instance.HighestJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.HighestJudgmentInQuit, BaseUI.Instance.HighestJudgmentQuitFont, (float)r.Length, (float)r.Height), ref r, judgmentQuitColors[(int)Component.Judged.Highest]); + r.Set(BaseUI.Instance.HigherJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.HigherJudgmentInQuit, BaseUI.Instance.HigherJudgmentQuitFont, (float)r.Length, (float)r.Height), ref r, judgmentQuitColors[(int)Component.Judged.Higher]); + r.Set(BaseUI.Instance.HighJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.HighJudgmentInQuit, BaseUI.Instance.HighJudgmentQuitFont, (float)r.Length, (float)r.Height), ref r, judgmentQuitColors[(int)Component.Judged.High]); + r.Set(BaseUI.Instance.LowJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.LowJudgmentInQuit, BaseUI.Instance.LowJudgmentQuitFont, (float)r.Length, (float)r.Height), ref r, judgmentQuitColors[(int)Component.Judged.Low]); + r.Set(BaseUI.Instance.LowerJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.LowerJudgmentInQuit, BaseUI.Instance.LowerJudgmentQuitFont, (float)r.Length, (float)r.Height), ref r, judgmentQuitColors[(int)Component.Judged.Lower]); + r.Set(BaseUI.Instance.LowestJudgmentContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.LowestJudgmentInQuit, BaseUI.Instance.LowestJudgmentQuitFont, (float)r.Length, (float)r.Height), ref r, judgmentQuitColors[(int)Component.Judged.Lowest]); + + r.Set(BaseUI.Instance.QuitDrawingPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.QuitDrawings[(int)defaultComputer.QuitStatusValue][defaultComputer.IsP ? 1 : 0]?.Drawing); + + r.Set(BaseUI.Instance.StandQuitPoint); + if (defaultComputer.NetPosition != -1) + { + targetSession.PaintDrawing(ref r, BaseUI.Instance.NetPositionDrawings.ElementAtOrDefault(defaultComputer.NetPosition) ?? BaseUI.Instance.StandDrawing); + } + else + { + targetSession.PaintDrawing(ref r, defaultComputer.IsNewStand || TelnetSystem.Instance.IsAlwaysNewStand ? BaseUI.Instance.NewStandDrawing : BaseUI.Instance.StandDrawing); + } + r.Set(BaseUI.Instance.PointQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.PointDrawing); + r.Set(BaseUI.Instance.BandQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.HighestBandDrawing); + + r.Set(BaseUI.Instance.StandContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(PoolSystem.Instance.GetValueText(defaultComputer.Stand.TargetValue, "#,##0"), BaseUI.Instance.StandQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.StandQuitColor); + r.Set(BaseUI.Instance.PointContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(PoolSystem.Instance.GetValueText((100.0 * defaultComputer.Point.TargetValue), "0.00%"), BaseUI.Instance.PointQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.PointQuitColor); + r.Set(BaseUI.Instance.BandContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(PoolSystem.Instance.GetValueText(defaultComputer.HighestBand, string.Empty), BaseUI.Instance.BandQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.BandQuitColor); + + r.Set(BaseUI.Instance.CommentPlace0Point); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.CommentPlace0Text, BaseUI.Instance.CommentPlace0Font, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.CommentPlaceColor); + r.Set(BaseUI.Instance.CommentPlace1Point); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.CommentPlace1Text, BaseUI.Instance.CommentPlace1Font, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.CommentPlaceColor); + + var judgmentMeterViewPosition0 = BaseUI.Instance.JudgmentMeterViewPoint[0]; + var judgmentMeterViewPosition1 = BaseUI.Instance.JudgmentMeterViewPoint[1]; + var judgmentMeterViewLength = BaseUI.Instance.JudgmentMeterViewPoint[2]; + var judgmentMeterViewHeight = BaseUI.Instance.JudgmentMeterViewPoint[3]; + r.Set(judgmentMeterViewPosition0, judgmentMeterViewPosition1, judgmentMeterViewLength, judgmentMeterViewHeight); + targetSession.DrawRectangle(r, Colors.White); + v0.Set(judgmentMeterViewPosition0, judgmentMeterViewPosition1 + judgmentMeterViewHeight / 2); + v1.Set(judgmentMeterViewPosition0 + judgmentMeterViewLength, judgmentMeterViewPosition1 + judgmentMeterViewHeight / 2); + targetSession.DrawLine(v0, v1, Colors.White); + var lowestJudgmentMillis = defaultComputer.LowestJudgmentMillis; + var highestJudgmentMillis = defaultComputer.HighestJudgmentMillis; + var noteFileLength = defaultComputer.NoteFile.Length; + var judgmentMeterEventValues = defaultComputer.JudgmentMeterEventValues; + lock (judgmentMeterEventValues) + { + for (var i = (int)Component.Judged.Lowest; i >= (int)Component.Judged.Highest; --i) + { + foreach (var (wait, judgmentMeter) in judgmentMeterEventValues[i]) + { + var judgmentMeterPosition0 = (float)(judgmentMeterViewPosition0 + judgmentMeterViewLength * wait / noteFileLength); + var judgmentMeterPosition1 = (float)(judgmentMeterViewPosition1 + judgmentMeterViewHeight * Math.Clamp(0.5 + (judgmentMeter < 0.0 ? -judgmentMeter / lowestJudgmentMillis : judgmentMeter / highestJudgmentMillis) / 2, 0.0, 1.0)); + if (judgmentMeterViewPosition0 <= judgmentMeterPosition0 && + judgmentMeterPosition0 <= judgmentMeterViewPosition0 + judgmentMeterViewLength && + judgmentMeterViewPosition1 <= judgmentMeterPosition1 && + judgmentMeterPosition1 <= judgmentMeterViewPosition1 + judgmentMeterViewHeight) + { + r.SetPosition(judgmentMeterPosition0, judgmentMeterPosition1); + targetSession.FillCircle(r, 1F, judgmentColors[i]); + } + } + } + } + + r.SetPosition(judgmentMeterViewPosition0 + 5.0, judgmentMeterViewPosition1 + 5.0); + var textItem = PoolSystem.Instance.GetTextItem(defaultComputer.JudgmentMeterText, JudgmentMeterViewFont, (float)r.Length, (float)r.Height); + targetSession.PaintVisibleText(textItem, ref r, Colors.White); + r.Position1 += textItem.LayoutBounds.Height + Levels.StandardMarginFloat32; + textItem = PoolSystem.Instance.GetTextItem(defaultComputer.EarlyLateText, JudgmentMeterViewFont, (float)r.Length, (float)r.Height); + targetSession.PaintVisibleText(textItem, ref r, Colors.White); + + var statusViewPosition0 = BaseUI.Instance.StatusViewPoint[0]; + var statusViewPosition1 = BaseUI.Instance.StatusViewPoint[1]; + var statusViewLength = BaseUI.Instance.StatusViewPoint[2]; + var statusViewHeight = BaseUI.Instance.StatusViewPoint[3]; + r.Set(statusViewPosition0, statusViewPosition1, statusViewLength, statusViewHeight); + targetSession.DrawRectangle(r, Colors.White); + + var hitPointsStatusViewColor = BaseUI.Instance.HitPointsStatusViewColor; + var hitPointsEventValues = defaultComputer.HitPointsEventValues; + var standStatusViewColor = BaseUI.Instance.StandStatusViewColor; + var standEventValues = defaultComputer.StandEventValues; + var pointStatusViewColor = BaseUI.Instance.PointStatusViewColor; + var pointEventValues = defaultComputer.PointEventValues; + var bandStatusViewColor = BaseUI.Instance.BandStatusViewColor; + var bandEventValues = defaultComputer.BandEventValues; + lock (defaultComputer.EventValuesCSX) + { + for (var i = hitPointsEventValues.Count - 2; i >= 0; --i) + { + var hitPointsEventValue = hitPointsEventValues[i]; + var hitPointsEventValueAs = hitPointsEventValues[i + 1]; + + v0.Set((float)(statusViewPosition0 + hitPointsEventValue.Key * statusViewLength), (float)(statusViewPosition1 + hitPointsEventValue.Value * statusViewHeight)); + v1.Set((float)(statusViewPosition0 + hitPointsEventValueAs.Key * statusViewLength), (float)(statusViewPosition1 + hitPointsEventValueAs.Value * statusViewHeight)); + targetSession.DrawLine(v0, v1, hitPointsStatusViewColor); + } + + for (var i = standEventValues.Count - 2; i >= 0; --i) + { + var standEventValue = standEventValues[i]; + var standEventValueAs = standEventValues[i + 1]; + + v0.Set((float)(statusViewPosition0 + standEventValue.Key * statusViewLength), (float)(statusViewPosition1 + standEventValue.Value * statusViewHeight)); + v1.Set((float)(statusViewPosition0 + standEventValueAs.Key * statusViewLength), (float)(statusViewPosition1 + standEventValueAs.Value * statusViewHeight)); + targetSession.DrawLine(v0, v1, standStatusViewColor); + } + + for (var i = pointEventValues.Count - 2; i >= 0; --i) + { + var pointEventValue = pointEventValues[i]; + var pointEventValueAs = pointEventValues[i + 1]; + + v0.Set((float)(statusViewPosition0 + pointEventValue.Key * statusViewLength), (float)(statusViewPosition1 + pointEventValue.Value * statusViewHeight)); + v1.Set((float)(statusViewPosition0 + pointEventValueAs.Key * statusViewLength), (float)(statusViewPosition1 + pointEventValueAs.Value * statusViewHeight)); + targetSession.DrawLine(v0, v1, pointStatusViewColor); + } + + for (var i = bandEventValues.Count - 2; i >= 0; --i) + { + var bandEventValue = bandEventValues[i]; + var bandEventValueAs = bandEventValues[i + 1]; + + v0.Set((float)(statusViewPosition0 + bandEventValue.Key * statusViewLength), (float)(statusViewPosition1 + bandEventValue.Value * statusViewHeight)); + v1.Set((float)(statusViewPosition0 + bandEventValueAs.Key * statusViewLength), (float)(statusViewPosition1 + bandEventValueAs.Value * statusViewHeight)); + targetSession.DrawLine(v0, v1, bandStatusViewColor); + } + } + + r.SetPosition(statusViewPosition0 + 5.0, statusViewPosition1 + 5.0); + textItem = PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.HitPointsLegend, StatusViewFont, (float)r.Length, (float)r.Height); + targetSession.PaintVisibleText(textItem, ref r, BaseUI.Instance.HitPointsStatusViewColor); + r.Position1 += textItem.LayoutBounds.Height + Levels.StandardMarginFloat32; + textItem = PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.StandLegend, StatusViewFont, (float)r.Length, (float)r.Height); + targetSession.PaintVisibleText(textItem, ref r, BaseUI.Instance.StandStatusViewColor); + r.Position1 += textItem.LayoutBounds.Height + Levels.StandardMarginFloat32; + textItem = PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.PointLegend, StatusViewFont, (float)r.Length, (float)r.Height); + targetSession.PaintVisibleText(textItem, ref r, BaseUI.Instance.PointStatusViewColor); + r.Position1 += textItem.LayoutBounds.Height + Levels.StandardMarginFloat32; + textItem = PoolSystem.Instance.GetTextItem(LanguageSystem.Instance.BandLegend, StatusViewFont, (float)r.Length, (float)r.Height); + targetSession.PaintVisibleText(textItem, ref r, BaseUI.Instance.BandStatusViewColor); + + r.Set(BaseUI.Instance.AutoModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.AutoModeVariety][(int)modeComponentValue.AutoModeValue]?.Drawing, modeComponentValue.AutoModeValue == ModeComponent.AutoMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.NoteSaltModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.NoteSaltModeVariety][(int)modeComponentValue.NoteSaltModeValue]?.Drawing, modeComponentValue.NoteSaltModeValue == ModeComponent.NoteSaltMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.FaintNoteModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.FaintNoteModeVariety][(int)modeComponentValue.FaintNoteModeValue]?.Drawing, modeComponentValue.FaintNoteModeValue == ModeComponent.FaintNoteMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.JudgmentModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.JudgmentModeVariety][(int)modeComponentValue.JudgmentModeValue]?.Drawing, modeComponentValue.JudgmentModeValue == ModeComponent.JudgmentMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.HitPointsModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.HitPointsModeVariety][(int)modeComponentValue.HandlingHitPointsModeValue]?.Drawing, modeComponentValue.HandlingHitPointsModeValue == ModeComponent.HitPointsMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.NoteMobilityModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.NoteMobilityModeVariety][(int)modeComponentValue.NoteMobilityModeValue]?.Drawing, modeComponentValue.NoteMobilityModeValue == ModeComponent.NoteMobilityMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.InputFavorModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.InputFavorModeVariety][(int)modeComponentValue.InputFavorModeValue]?.Drawing, modeComponentValue.InputFavorModeValue == ModeComponent.InputFavorMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.LongNoteModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.LongNoteModeVariety][(int)modeComponentValue.LongNoteModeValue]?.Drawing, modeComponentValue.LongNoteModeValue == ModeComponent.LongNoteMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.NoteModifyModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.NoteModifyModeVariety][(int)modeComponentValue.NoteModifyModeValue]?.Drawing, modeComponentValue.NoteModifyModeValue == ModeComponent.NoteModifyMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.BPMModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.BPMModeVariety][(int)modeComponentValue.BPMModeValue]?.Drawing, modeComponentValue.BPMModeValue == ModeComponent.BPMMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.WaveModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.WaveModeVariety][(int)modeComponentValue.WaveModeValue]?.Drawing, modeComponentValue.WaveModeValue == ModeComponent.WaveMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.SetNoteModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.SetNoteModeVariety][(int)modeComponentValue.SetNoteModeValue]?.Drawing, modeComponentValue.SetNoteModeValue == ModeComponent.SetNoteMode.Default ? 0.125F : 1F); + r.Set(BaseUI.Instance.LowestJudgmentConditionModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ModeComponentDrawings[ModifyModeComponentViewModel.LowestJudgmentConditionModeVariety][(int)modeComponentValue.LowestJudgmentConditionModeValue]?.Drawing, modeComponentValue.LowestJudgmentConditionModeValue == ModeComponent.LowestJudgmentConditionMode.Default ? 0.125F : 1F); + + r.Set(BaseUI.Instance.JudgmentStageQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.JudgmentStageDrawing?.Drawing); + r.Set(BaseUI.Instance.HighestInputCountQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.HighestInputCountDrawing?.Drawing); + r.Set(BaseUI.Instance.LengthQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.LengthDrawing?.Drawing); + r.Set(BaseUI.Instance.BPMQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.BPMDrawing?.Drawing); + r.Set(BaseUI.Instance.InputModeQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.InputModeDrawing?.Drawing); + + r.Set(BaseUI.Instance.JudgmentStageContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.JudgmentStageContents, BaseUI.Instance.JudgmentStageQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.JudgmentStageQuitColor); + r.Set(BaseUI.Instance.HighestInputCountContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(Utility.GetHighestInputCountText(defaultComputer.AverageInputCount, defaultComputer.HighestInputCount, defaultComputer.AudioMultiplier), BaseUI.Instance.HighestInputCountQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.HighestInputCountQuitColor); + r.Set(BaseUI.Instance.LengthContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.LengthText, BaseUI.Instance.LengthQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.LengthQuitColor); + r.Set(BaseUI.Instance.BPMContentsQuitPoint); + targetSession.PaintVisibleText(PoolSystem.Instance.GetTextItem(defaultComputer.BPMText, BaseUI.Instance.BPMQuitFont, (float)r.Length, (float)r.Height), ref r, BaseUI.Instance.BPMQuitColor); + r.Set(BaseUI.Instance.InputModeContentsQuitPoint); + targetSession.PaintDrawing(ref r, BaseUI.Instance.InputModeDrawings[(int)defaultComputer.NoteFile.InputMode]?.Drawing); + + r.Set(BaseUI.Instance.ViewCommentPoint); + SetEventHandler(ref r, handleViewCommentImpl); + targetSession.PaintDrawing(ref r, BaseUI.Instance.ViewCommentDrawing); + + r.Set(BaseUI.Instance.HandleUndoPoint); + SetEventHandler(ref r, handleUndoImpl); + targetSession.PaintDrawing(ref r, BaseUI.Instance.HandleUndoDrawing); + + if (defaultComputer.LevyingComputingPosition > 0 && BaseUI.Instance.QuitMove0Point != null) + { + r.Set(BaseUI.Instance.QuitMove0Point); + SetEventHandler(ref r, handleQuitMove0Impl); + targetSession.PaintDrawing(ref r, BaseUI.Instance.QuitMove0Drawing); + } + + if (defaultComputer.LevyingComputingPosition < defaultComputer.HighestComputingPosition && BaseUI.Instance.QuitMove1Point != null) + { + r.Set(BaseUI.Instance.QuitMove1Point); + SetEventHandler(ref r, handleQuitMove1Impl); + targetSession.PaintDrawing(ref r, BaseUI.Instance.QuitMove1Drawing); + } + + PaintBaseProperty(1); + + PaintFading(); + PaintNotifyXamlItems(); + + void PaintBaseProperty(int layer) + { + foreach (var paintPropertyValue in BaseUI.Instance.PaintPropertyValues) + { + if (paintPropertyValue?.Layer == layer) + { + paintPropertyValue.Paint(targetSession, distanceMillis, defaultComputer, handlingComputer); + } + } + } + } + else + { + PaintNotify0Contents(faultText, pauseNotify0Position0, pauseNotify0Position1, PauseNotifyFont, Colors.Red); + } + } + PaintFramerate(); + } + + CopyD3D9Drawing(); + + using (targetSession = _rawTargetSystem.CreateDrawingSession(Colors.Black)) + { + targetSession.DrawImage(_targetSystem); + } + } + + _rawTargetSystem.Present(); + break; + } + } + + var millis = loopingHandler.GetMillis(); + distanceMillis = millis - lastMillis; + lastMillis = millis; + + if (wasLastPointed && !HandleLastPointed()) + { + if (mainViewModel.IsComputingMode) + { + var lastPointedPosition = lastPointed.Item1; + var lastPointedPositionX = lastPointedPosition.X; + var lastPointedPositionY = lastPointedPosition.Y; + switch (_mediaInputAreaStatus) + { + case MediaInputAreaStatus.Not: + if (!defaultComputer.IsPausingWindowOpened && defaultComputer.CanSetPosition) + { + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var has2P = defaultComputer.Has2P; + var distance2P = drawingComponentValue.p1BuiltLength + drawingComponentValue.p2Position; + if (!MoveStatus(drawingComponentValue.statusPosition0, drawingComponentValue.statusPosition1, drawingComponentValue.statusLength, drawingComponentValue.statusHeight, drawingComponentValue.statusSystem, drawingComponentValue.altStatus)) + { + MoveStatus(drawingComponentValue.statusSliderPosition0, drawingComponentValue.statusSliderPosition1, drawingComponentValue.statusSliderLength, drawingComponentValue.statusSliderHeight, drawingComponentValue.statusSliderSystem, drawingComponentValue.altStatusSlider); + } + + bool MoveStatus(float position0, float position1, float length, float height, int system, int alt) + { + for (var i = alt >> 1; i >= alt % 2; --i) + { + var distance = i == 1 && has2P ? distance2P : 0F; + if (lastPointedPositionX >= position0 + distance && lastPointedPositionX < position0 + distance + length && lastPointedPositionY >= position1 && lastPointedPositionY < position1 + height) + { + defaultComputer.LevyingWait = lastPointed.Item2 ? 0.0 : system switch + { + 0 => defaultComputer.Length * (1 - (lastPointedPositionY - position1) / height), + 1 => defaultComputer.Length * (lastPointedPositionY - position1) / height, + 2 => defaultComputer.Length * (1 - (lastPointedPositionX - position0 - distance) / length), + 3 => defaultComputer.Length * (lastPointedPositionX - position0 - distance) / length, + _ => default, + }; + defaultComputer.SetUndo = true; + return true; + } + } + return false; + } + } + break; + case MediaInputAreaStatus.Position: + _mediaInputPosition0 = lastPointedPositionX; + _mediaInputPosition1 = lastPointedPositionY; + _mediaInputAreaStatus = MediaInputAreaStatus.Area; + Configure.Instance.MediaInputPosition0 = lastPointedPositionX; + Configure.Instance.MediaInputPosition1 = lastPointedPositionY; + break; + } + } + } + + if (wasLastMoved) + { + if (mainViewModel.IsComputingMode) + { + switch (_mediaInputAreaStatus) + { + case MediaInputAreaStatus.Area: + var lastMovedPositionX = lastMoved.X; + var lastMovedPositionY = lastMoved.Y; + if (_mediaInputPosition0 < lastMovedPositionX) + { + Configure.Instance.MediaInputLength = lastMovedPositionX - _mediaInputPosition0; + } + else + { + Configure.Instance.MediaInputPosition0 = lastMovedPositionX; + Configure.Instance.MediaInputLength = _mediaInputPosition0 - lastMovedPositionX; + } + if (_mediaInputPosition1 < lastMovedPositionY) + { + Configure.Instance.MediaInputHeight = lastMovedPositionY - _mediaInputPosition1; + } + else + { + Configure.Instance.MediaInputPosition1 = lastMovedPositionY; + Configure.Instance.MediaInputHeight = _mediaInputPosition1 - lastMovedPositionY; + } + break; + } + } + } + + if (wasLastNotPointed) + { + if (mainViewModel.IsComputingMode) + { + switch (_mediaInputAreaStatus) + { + case MediaInputAreaStatus.Area: + _mediaInputAreaStatus = MediaInputAreaStatus.Not; + break; + } + } + } + + _eventHandler = null; + _netItemHandler = null; + _toNotifyXamlItemHandler = null; + + if (allowFramerate) + { + distanceMillisMax = Math.Max(distanceMillisMax, distanceMillis); + ++frameCount; + frametime += distanceMillis; + if (frametime >= 1000.0) + { + framerate = PoolSystem.Instance.GetValueText(Math.Round(1000.0 * frameCount / frametime), "0 frame/s"); + framerateLowest = PoolSystem.Instance.GetValueText(Math.Round(1000.0 / distanceMillisMax), "0 frame/s (\\0% Low)"); + frameCount = 0; + frametime = 0.0; + distanceMillisMax = 0.0; + for (var i = 0; i < QwilightComponent.HeapCount; ++i) + { + textGCs[i] = PoolSystem.Instance.GetFormattedText("GC{0} {1}", PoolSystem.Instance.GetValueText(i, string.Empty), PoolSystem.Instance.GetValueText(GC.CollectionCount(i), string.Empty)); + } + var valueHeap = GC.GetTotalMemory(false); + var distanceHeap = valueHeap - lastHeap; + textHeap = PoolSystem.Instance.GetFormattedText("Heap {0} ({1}{2}/s)", PoolSystem.Instance.GetFormattedUnitText(valueHeap), distanceHeap >= 0 ? "+" : "-", PoolSystem.Instance.GetFormattedUnitText(Math.Abs(distanceHeap))); + lastHeap = valueHeap; + } + } + + void PaintFading() + { + if (fadingStatus > 0.0) + { + var fadingComputer = mainViewModel.FadingViewComputer; + var fadingPropertyValue = BaseUI.Instance.FadingPropertyValues[(int)mode]?[fadingValue.Layer]; + var fadingPropertyFrame = fadingPropertyValue?.Frame ?? 0; + if (fadingPropertyFrame > 0) + { + if (fadingPropertyValue.DrawingStatus <= fadingStatus) + { + var hasContents = false; + if (fadingComputer != null) + { + lock (fadingComputer.ContentsCSX) + { + var fadingViewDrawing = fadingComputer.NoteHandledDrawingItem; + hasContents = fadingComputer.HasContents && fadingViewDrawing != null; + if (hasContents) + { + HandleDrawing(fadingViewDrawing); + } + } + } + if (!hasContents) + { + HandleDrawing(DrawingSystem.Instance.DefaultDrawing); + } + + void HandleDrawing(HandledDrawingItem? fadingViewDrawing) + { + var drawing = fadingViewDrawing?.Drawing; + if (drawing.HasValue) + { + r.SetArea(defaultLength, defaultHeight); + targetSession.FillRectangle(r, Colors.Black); + var drawingBound = drawing.Value.DrawingBound; + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, drawingBound.Length, drawingBound.Height, 0.0, 0.0, defaultLength, defaultHeight); + targetSession.PaintDrawing(ref r, drawing); + } + } + } + r.SetArea(defaultLength, defaultHeight); + targetSession.PaintDrawing(ref r, fadingPropertyValue.HandledDrawingItems[(int)Math.Floor(fadingStatus * (fadingPropertyFrame - 1))]?.Drawing); + } + } + } + + void PaintNotifyXamlItems() + { + var toNotifyXamlItemCollection = ViewModels.Instance.NotifyXamlValue.NotifyXamlItemCollection; + var toNotifyPosition1 = 0F; + lock (toNotifyXamlItemCollection) + { + foreach (var toNotifyXamlItem in toNotifyXamlItemCollection) + { + var toNotifyTextBoundHeight = 24F; + var toNotifyTextItem = PoolSystem.Instance.GetTextItem(toNotifyXamlItem.Contents, NotifyXamlFont, 0F, toNotifyTextBoundHeight); + var toNotifyTextBound = toNotifyTextItem.LayoutBounds; + var toNotifyHeight = Levels.StandardMarginFloat32 + toNotifyTextBoundHeight + Levels.StandardMarginFloat32; + var toNotifyDrawing = BaseUI.Instance.NotifyDrawings[(int)toNotifyXamlItem.Variety]; + var toNotifyDrawingLength = toNotifyDrawing?.Drawing != null ? (float)(toNotifyTextBoundHeight * toNotifyDrawing.Value.Drawing.Value.DrawingBound.Length / toNotifyDrawing.Value.Drawing.Value.DrawingBound.Height) : 0F; + + toNotifyPosition1 += Levels.StandardMarginFloat32; + r.Set(Levels.StandardMarginFloat32, toNotifyPosition1, Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32 + toNotifyDrawingLength + 2 * Levels.StandardMarginFloat32 + toNotifyTextBound.Width + Levels.StandardMarginFloat32 + Levels.StandardEdgeFloat32, Levels.StandardEdgeFloat32 + toNotifyHeight + Levels.StandardEdgeFloat32); + SetNotifyXamlItemHandler(ref r, handleNotifyXamlItemImpl, toNotifyXamlItem); + targetSession.DrawRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, Colors.White); + + r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, r.Length - 2 * Levels.StandardEdgeFloat32, r.Height - 2 * Levels.StandardEdgeFloat32); + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, toNotifyXamlItem.Color); + + r.Set(r.Position0 + Levels.StandardMarginFloat32, r.Position1 + Levels.StandardMarginFloat32, toNotifyDrawingLength, toNotifyTextBoundHeight); + targetSession.PaintDrawing(ref r, toNotifyDrawing?.Drawing); + + r.Position0 += r.Length + 2 * Levels.StandardMarginFloat32; + targetSession.PaintText(toNotifyTextItem, ref r, Colors.White); + toNotifyPosition1 += (float)(Levels.StandardEdgeFloat32 + toNotifyHeight + Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32); + } + } + } + + void PaintFramerate() + { + if (allowFramerate) + { + r.SetPosition(Levels.StandardMarginFloat32, Levels.StandardMarginFloat32); + + var textItem = PoolSystem.Instance.GetTextItem(framerate, UtilityFont); + targetSession.PaintText(textItem, ref r, Colors.Red); + r.Position1 += (float)(textItem.LayoutBounds.Height + Levels.StandardMarginFloat32); + + textItem = PoolSystem.Instance.GetTextItem(framerateLowest, UtilityFont); + targetSession.PaintText(textItem, ref r, Colors.Red); + r.Position1 += (float)(textItem.LayoutBounds.Height + Levels.StandardMarginFloat32); + + for (var i = 0; i < QwilightComponent.HeapCount; ++i) + { + textItem = PoolSystem.Instance.GetTextItem(textGCs[i], UtilityFont); + targetSession.PaintText(textItem, ref r, Colors.Red); + r.Position1 += (float)(textItem.LayoutBounds.Height + Levels.StandardMarginFloat32); + } + + textItem = PoolSystem.Instance.GetTextItem(textHeap, UtilityFont); + targetSession.PaintText(textItem, ref r, Colors.Red); + } + } + + void CopyD3D9Drawing() + { + if (isWPFViewVisible) + { + _targetSystem.GetPixelBytes(_targetSystemData); + var w = new WriteableBitmap((int)_targetSystem.SizeInPixels.Width, (int)_targetSystem.SizeInPixels.Height, _targetSystem.Dpi, _targetSystem.Dpi, PixelFormats.Bgra32, null); + w.WritePixels(new(0, 0, w.PixelWidth, w.PixelHeight), _rawTargetSystemData, w.Format.BitsPerPixel / 8 * w.PixelWidth, 0); + w.Freeze(); + D3D9Drawing = w; + } + } + + float PaintNotify0Contents(string toNotifyContents, float toNotifyPosition0, float toNotifyPosition1, CanvasTextFormat toNotifyFont, Color toNotifyColor, Action onHandled = null) + { + var toNotifyTextItem = PoolSystem.Instance.GetTextItem(toNotifyContents, toNotifyFont); + var textBound = toNotifyTextItem.LayoutBounds; + var textBoundLength = textBound.Width; + var textBoundHeight = textBound.Height; + + r.Set(toNotifyPosition0, toNotifyPosition1, Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32 + textBoundLength + Levels.StandardMarginFloat32 + Levels.StandardEdgeFloat32, Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32 + textBoundHeight + Levels.StandardMarginFloat32 + Levels.StandardEdgeFloat32); + if (onHandled != null) + { + SetEventHandler(ref r, onHandled); + } + targetSession.DrawRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, Colors.White); + + r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, r.Length - 2 * Levels.StandardEdgeFloat32, r.Height - 2 * Levels.StandardEdgeFloat32); + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, FaintFilledPaints[50]); + + r.Position0 += Levels.StandardMarginFloat32; + r.Position1 += Levels.StandardMarginFloat32; + targetSession.PaintText(toNotifyTextItem, ref r, toNotifyColor); + r.Height += 2 * Levels.StandardEdgeFloat32; + return (float)r.Height; + } + + float PaintNotify1Contents(string toNotifyContents, float toNotifyPosition0, float toNotifyPosition1, CanvasTextFormat toNotifyFont, Color toNotifyColor, Action onHandled = null) + { + var toNotifyTextItem = PoolSystem.Instance.GetTextItem(toNotifyContents, toNotifyFont); + var textBound = toNotifyTextItem.LayoutBounds; + var textBoundLength = textBound.Width; + var textBoundHeight = textBound.Height; + + r.Set(toNotifyPosition0, toNotifyPosition1, Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32 + textBoundLength + Levels.StandardMarginFloat32 + Levels.StandardEdgeFloat32, Levels.StandardEdgeFloat32 + Levels.StandardMarginFloat32 + textBoundHeight + Levels.StandardMarginFloat32 + Levels.StandardEdgeFloat32); + r.Position0 -= r.Length; if (onHandled != null) + { + SetEventHandler(ref r, onHandled); + } + targetSession.DrawRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, Colors.White); + + r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, r.Length - 2 * Levels.StandardEdgeFloat32, r.Height - 2 * Levels.StandardEdgeFloat32); + targetSession.FillRoundedRectangle(r, Levels.StandardEllipseFloat32, Levels.StandardEllipseFloat32, FaintFilledPaints[50]); + + r.Position0 += Levels.StandardMarginFloat32; + r.Position1 += Levels.StandardMarginFloat32; + targetSession.PaintText(toNotifyTextItem, ref r, toNotifyColor); + r.Height += 2 * Levels.StandardEdgeFloat32; + return (float)r.Height; + } + + bool CanPaint(PaintPipelineID paintPipeline) => paintPipeline switch + { + PaintPipelineID.AudioVisualizer => Configure.Instance.AudioVisualizer, + PaintPipelineID.JudgmentMeter => Configure.Instance.UIPipelineJudgmentMeter, + PaintPipelineID.BPM => Configure.Instance.UIPipelineBPM, + PaintPipelineID.JudgmentPaint => Configure.Instance.UIPipelineJudgmentPaint, + PaintPipelineID.Net => Configure.Instance.UIPipelineNet, + PaintPipelineID.JudgmentInputVisualizer => Configure.Instance.UIPipelineJudgmentInputVisualizer, + PaintPipelineID.JudgmentMain => Configure.Instance.UIPipelineJudgmentMain, + PaintPipelineID.HighestJudgment => Configure.Instance.UIPipelineJudgmentCount, + PaintPipelineID.HigherJudgment => Configure.Instance.UIPipelineJudgmentCount, + PaintPipelineID.HighJudgment => Configure.Instance.UIPipelineJudgmentCount, + PaintPipelineID.LowJudgment => Configure.Instance.UIPipelineJudgmentCount, + PaintPipelineID.LowerJudgment => Configure.Instance.UIPipelineJudgmentCount, + PaintPipelineID.LowestJudgment => Configure.Instance.UIPipelineJudgmentCount, + PaintPipelineID.Limiter => Configure.Instance.UIPipelineLimiter, + PaintPipelineID.JudgmentVisualizer => Configure.Instance.UIPipelineJudgmentVisualizer, + PaintPipelineID.HitNotePaint => Configure.Instance.UIPipelineHitNotePaint, + PaintPipelineID.Hunter => Configure.Instance.UIPipelineHunter, + PaintPipelineID.MediaInput => Configure.Instance.MediaInput, + PaintPipelineID.VeilDrawing => Configure.Instance.VeilDrawingHeight > 0.0, + PaintPipelineID.MainJudgmentMeter => Configure.Instance.UIPipelineMainJudgmentMeter, + _ => true + }; + + bool HandleLastPointed() + { + if (_eventHandler != null) + { + _eventHandler(); + return true; + } + else if (_netItemHandler != null) + { + _netItemHandler(_netItemParam); + return true; + } + else if (_toNotifyXamlItemHandler != null) + { + _toNotifyXamlItemHandler(_toNotifyXamlItemParam); + return true; + } + else + { + return false; + } + } + + void SetEventHandler(ref Bound r, Action eventHandler) + { + if (wasLastPointed && r.IsPoint(lastPointed.Item1)) + { + _eventHandler = eventHandler; + } + } + + void SetNetItemHandler(ref Bound r, Action netItemHandler, NetItem netItemParam) + { + if (wasLastPointed && r.IsPoint(lastPointed.Item1)) + { + _eventHandler = null; + _netItemHandler = netItemHandler; + _netItemParam = netItemParam; + } + } + + void SetNotifyXamlItemHandler(ref Bound r, Action toNotifyXamlItemHandler, NotifyXamlItem toNotifyXamlItemParam) + { + if (wasLastPointed && r.IsPoint(lastPointed.Item1)) + { + _eventHandler = null; + _netItemHandler = null; + _toNotifyXamlItemHandler = toNotifyXamlItemHandler; + _toNotifyXamlItemParam = toNotifyXamlItemParam; + } + } + } + catch (ThreadInterruptedException) + { + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + finally + { + AvatarDrawingSystem.Instance.ClosePendingAvatarDrawings(); + AvatarEdgeSystem.Instance.ClosePendingAvatarEdges(); + } + } + } + + public virtual void SetFaintPaints(IDrawingContainer drawingContainer, ICanvasBrush[] faintPaints, Color faintColor) + { + for (var i = faintPaints.Length - 1; i >= 0; --i) + { + var faintPaint = new CanvasSolidColorBrush(CanvasDevice.GetSharedDevice(), faintColor) + { + Opacity = i / 100F + }; + faintPaints[i] = faintPaint; + if (drawingContainer != null) + { + _toCloseValues.AddOrUpdate(drawingContainer, (drawingContainer, faintPaint) => new() + { + faintPaint + }, (drawingContainer, drawingItems, faintPaint) => + { + drawingItems.Add(faintPaint); + return drawingItems; + }, faintPaint); + } + } + } + + public void OnModified() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetWindowArea, + Contents = new Action((windowAreaPosition0, windowAreaPosition1, windowAreaLength, windowAreaHeight) => + { + var mainViewModel = ViewModels.Instance.MainValue; + var defaultLength = (float)mainViewModel.DefaultLength; + var defaultHeight = (float)mainViewModel.DefaultHeight; + var drawingQuality = new Vector2((float)(96.0 * windowAreaLength / defaultLength), (float)(96.0 * windowAreaHeight / defaultHeight)); + var targetWindowDPI = Math.Max(drawingQuality.X, drawingQuality.Y); + var dataCount = Configure.Instance.DataCount; + if (_rawTargetSystem == null) + { + Task.Run(() => + { + lock (D2D1CSX) + { + _targetSystem?.Dispose(); + _targetSystem = new(CanvasDevice.GetSharedDevice(), defaultLength, defaultHeight, targetWindowDPI, DirectXPixelFormat.B8G8R8A8UIntNormalized, CanvasAlphaMode.Ignore); + _rawTargetSystemData = new byte[_targetSystem.SizeInPixels.Width * _targetSystem.SizeInPixels.Height * 4]; + _targetSystemData = _rawTargetSystemData.AsBuffer(); + _rawTargetSystem?.Dispose(); + _rawTargetSystem = new(CanvasDevice.GetSharedDevice(), defaultLength, defaultHeight, targetWindowDPI, DirectXPixelFormat.B8G8R8A8UIntNormalized, dataCount, CanvasAlphaMode.Ignore); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetD2DView, + Contents = _rawTargetSystem + }); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetD2DViewArea + }); + }); + } + else if (_rawTargetSystem.Size.Width != defaultLength || _rawTargetSystem.Size.Height != defaultHeight || _drawingQuality != drawingQuality || _rawTargetSystem.BufferCount != dataCount) + { + Task.Run(() => + { + lock (D2D1CSX) + { + _targetSystem?.Dispose(); + _targetSystem = new(CanvasDevice.GetSharedDevice(), defaultLength, defaultHeight, targetWindowDPI, DirectXPixelFormat.B8G8R8A8UIntNormalized, CanvasAlphaMode.Ignore); + _rawTargetSystemData = new byte[_targetSystem.SizeInPixels.Width * _targetSystem.SizeInPixels.Height * 4]; + _targetSystemData = _rawTargetSystemData.AsBuffer(); + _rawTargetSystem.ResizeBuffers(defaultLength, defaultHeight, targetWindowDPI, DirectXPixelFormat.B8G8R8A8UIntNormalized, dataCount); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetD2DViewArea + }); + }); + } + _drawingQuality = drawingQuality; + }) + }); + + public DrawingItem Load(string drawingFilePath, IDrawingContainer drawingContainer) + { + using var fs = File.OpenRead(drawingFilePath); + return Load(fs, drawingContainer); + } + + public DrawingItem Load(Stream s, IDrawingContainer drawingContainer, bool setAverage = false) + { + s.Position = 0; + var hash = Utility.GetID128s(s); + if (drawingContainer != null && _drawingMap.TryGetValue(drawingContainer, out var drawingItems) && drawingItems.TryGetValue(hash, out var drawingItem)) + { + return drawingItem; + } + drawingItem = Load(s, setAverage); + if (drawingContainer != null) + { + _drawingMap.AddOrUpdate(drawingContainer, (drawingContainer, drawingItem) => new(new[] { KeyValuePair.Create(hash, drawingItem) }), (drawingContainer, drawingItems, drawingItem) => + { + drawingItems[hash] = drawingItem; + return drawingItems; + }, drawingItem); + } + return drawingItem; + } + + public DrawingItem LoadBMS(string drawingFilePath, IDrawingContainer drawingContainer) + { + using var fs = File.OpenRead(drawingFilePath); + var hash = $"@{Utility.GetID128s(fs)}"; + if (_drawingMap.TryGetValue(drawingContainer, out var drawingItems) && drawingItems.TryGetValue(hash, out var drawingItem)) + { + return drawingItem; + } + + drawingItem = Load(fs); + var defaultBound = drawingItem.DrawingBound; + drawingItem = new() + { + Drawing = new ChromaKeyEffect + { + Source = drawingItem.Drawing, + Color = Colors.Black, + Tolerance = 1 / 512F + }, + DrawingBound = defaultBound + }; + + var defaultLength = defaultBound.Length; + var defaultHeight = defaultBound.Height; + if (defaultLength != defaultHeight && defaultLength <= 256 && defaultHeight <= 256) + { + var areaLength = (float)Math.Max(defaultLength, defaultHeight); + var target = new CanvasRenderTarget(CanvasDevice.GetSharedDevice(), areaLength, areaLength, 96F); + using (var session = target.CreateDrawingSession()) + { + session.Clear(Colors.Transparent); + var r = new Bound((areaLength - defaultLength) / 2, 0.0, target.Size.Width, target.Size.Height); + session.PaintDrawing(ref r, drawingItem); + } + drawingItem.Dispose(); + drawingItem = new() + { + Drawing = target, + DrawingBound = target.Bounds + }; + } + + _drawingMap.AddOrUpdate(drawingContainer, (drawingContainer, drawingItem) => new(new[] { KeyValuePair.Create(hash, drawingItem) }), (drawingContainer, drawingItems, drawingItem) => + { + drawingItems[hash] = drawingItem; + return drawingItems; + }, drawingItem); + return drawingItem; + } + + static DrawingItem Load(Stream s, bool setAverage = false) + { + s.Position = 0; + var drawing = Utility.Await(CanvasBitmap.LoadAsync(CanvasDevice.GetSharedDevice(), s.AsRandomAccessStream())); + var averageColor = 0U; + var averageHeight = 0.0; + if (setAverage) + { + var averageCount = 0; + var averageColor0 = 0L; + var averageColor1 = 0L; + var averageColor2 = 0L; + var averageColor3 = 0L; + var drawingColors = drawing.GetPixelColors(); + var drawingLength = drawing.SizeInPixels.Width; + var drawingHeight = drawing.SizeInPixels.Height; + var hasColors = ArrayPool.Shared.Rent((int)drawingHeight); + Array.Clear(hasColors, 0, (int)drawingHeight); + for (var i = (int)(drawingHeight - 1); i >= 0; --i) + { + for (var j = (int)(drawingLength - 1); j >= 0; --j) + { + var drawingColor = drawingColors[drawingLength * i + j]; + if (drawingColor.R > 0 || drawingColor.G > 0 || drawingColor.B > 0) + { + if (drawingColor.A > 0) + { + if (drawingColor.A > 127) + { + averageColor0 += drawingColor.B; + averageColor1 += drawingColor.G; + averageColor2 += drawingColor.R; + averageColor3 += drawingColor.A; + ++averageCount; + } + hasColors[i] = true; + } + } + } + } + if (averageCount > 0) + { + averageColor0 /= averageCount; + averageColor1 /= averageCount; + averageColor2 /= averageCount; + averageColor3 /= averageCount; + averageColor = (uint)(16777216 * averageColor0 + 65536 * averageColor1 + 256 * averageColor2 + averageColor3); + } + var lowestPosition1 = 0; + var highestPosition1 = 0; + for (var i = 0; i < drawingHeight; ++i) + { + if (hasColors[i]) + { + lowestPosition1 = i; + break; + } + } + for (var i = (int)(drawingHeight - 1); i >= 0; --i) + { + if (hasColors[i]) + { + highestPosition1 = i + 1; + break; + } + } + ArrayPool.Shared.Return(hasColors); + averageHeight = (double)(highestPosition1 - lowestPosition1) / drawingHeight; + } + return new() + { + Drawing = drawing, + DrawingBound = drawing.Bounds, + AverageColor = averageColor, + StandardHeight = averageHeight + }; + } + + public ImageSource LoadDefault(string drawingFilePath, IDrawingContainer drawingContainer) + { + using var fs = File.OpenRead(drawingFilePath); + return LoadDefault(fs, drawingContainer); + } + + public ImageSource LoadDefault(Stream s, IDrawingContainer drawingContainer) + { + if (drawingContainer != null) + { + var hash = Utility.GetID128s(s); + if (_defaultDrawingMap.TryGetValue(drawingContainer, out var defaultDrawings) && defaultDrawings.TryGetValue(hash, out var defaultDrawing)) + { + return defaultDrawing; + } + defaultDrawing = LoadDefault(s); + _defaultDrawingMap.AddOrUpdate(drawingContainer, (drawingContainer, defaultDrawing) => new(new[] { KeyValuePair.Create(hash, defaultDrawing) }), (drawingContainer, defaultDrawings, defaultDrawing) => + { + defaultDrawings[hash] = defaultDrawing; + return defaultDrawings; + }, defaultDrawing); + return defaultDrawing; + } + else + { + return LoadDefault(s); + } + } + + public ImageSource LoadDefaultBMS(string drawingFilePath, IDrawingContainer drawingContainer) + { + using var fs = File.OpenRead(drawingFilePath); + if (drawingContainer != null) + { + var hash = $"@{Utility.GetID128s(fs)}"; + if (_defaultDrawingMap.TryGetValue(drawingContainer, out var defaultDrawings) && defaultDrawings.TryGetValue(hash, out var defaultDrawing)) + { + return defaultDrawing; + } + defaultDrawing = LoadImpl(); + _defaultDrawingMap.AddOrUpdate(drawingContainer, (drawingContainer, defaultDrawing) => new(new[] { KeyValuePair.Create(hash, defaultDrawing) }), (drawingContainer, defaultDrawings, defaultDrawing) => + { + defaultDrawings[hash] = defaultDrawing; + return defaultDrawings; + }, defaultDrawing); + return defaultDrawing; + } + else + { + return LoadImpl(); + } + + BitmapSource LoadImpl() + { + BitmapSource defaultDrawing; + + fs.Position = 0; + var drawing = new BitmapImage(); + drawing.BeginInit(); + drawing.CacheOption = BitmapCacheOption.OnLoad; + drawing.StreamSource = fs; + drawing.EndInit(); + drawing.Freeze(); + defaultDrawing = drawing; + + if (defaultDrawing.Format != PixelFormats.Bgra32) + { + var formatDrawing = new FormatConvertedBitmap(); + formatDrawing.BeginInit(); + formatDrawing.Source = defaultDrawing; + formatDrawing.DestinationFormat = PixelFormats.Bgra32; + formatDrawing.EndInit(); + formatDrawing.Freeze(); + defaultDrawing = formatDrawing; + } + + var defaultLength = defaultDrawing.PixelWidth; + var defaultHeight = defaultDrawing.PixelHeight; + var row = 4 * defaultLength; + var data = ArrayPool.Shared.Rent(row * defaultHeight); + try + { + defaultDrawing.CopyPixels(data, row, 0); + + for (var i = defaultHeight - 1; i >= 0; --i) + { + for (var j = defaultLength - 1; j >= 0; --j) + { + var m = row * i + 4 * j; + if (data[m] == 0 && data[m + 1] == 0 && data[m + 2] == 0) + { + data[m + 3] = 0; + } + } + } + + if (defaultLength != defaultHeight && defaultLength <= 256 && defaultHeight <= 256) + { + var targetValue = Math.Max(defaultLength, defaultHeight); + var rowTarget = 4 * targetValue; + var target = ArrayPool.Shared.Rent(rowTarget * targetValue); + try + { + var distanceLength = (targetValue - defaultLength) / 2; + + for (var i = targetValue - 1; i >= 0; --i) + { + for (var j = targetValue - 1; j >= 0; --j) + { + if (i < defaultHeight && distanceLength <= j && j < targetValue - distanceLength) + { + var m = row * i + 4 * (j - distanceLength); + if (data[m] == 0 && data[m + 1] == 0 && data[m + 2] == 0) + { + data[m + 3] = 0; + } + var mTarget = rowTarget * i + 4 * j; + target[mTarget] = data[m]; + target[mTarget + 1] = data[m + 1]; + target[mTarget + 2] = data[m + 2]; + target[mTarget + 3] = data[m + 3]; + } + else + { + var m = rowTarget * i + 4 * j; + target[m] = 0; + target[m + 1] = 0; + target[m + 2] = 0; + target[m + 3] = 0; + } + } + } + + defaultDrawing = BitmapSource.Create(targetValue, targetValue, defaultDrawing.DpiX, defaultDrawing.DpiY, defaultDrawing.Format, null, target, rowTarget); + defaultDrawing.Freeze(); + } + finally + { + ArrayPool.Shared.Return(target); + } + } + else + { + defaultDrawing = BitmapSource.Create(defaultLength, defaultHeight, defaultDrawing.DpiX, defaultDrawing.DpiY, defaultDrawing.Format, null, data, row); + defaultDrawing.Freeze(); + } + } + finally + { + ArrayPool.Shared.Return(data); + } + + return defaultDrawing; + } + } + + static ImageSource LoadDefault(Stream s) + { + s.Position = 0; + var defaultDrawing = new BitmapImage(); + defaultDrawing.BeginInit(); + defaultDrawing.CacheOption = BitmapCacheOption.OnLoad; + defaultDrawing.StreamSource = s; + defaultDrawing.EndInit(); + defaultDrawing.Freeze(); + return defaultDrawing; + } + + public Brush GetDefaultPaint(string titleColor) + { + switch (titleColor) + { + case "titleLV2000": + var titleLV2000 = new LinearGradientBrush(new(new GradientStop[] + { + new (System.Windows.Media.Colors.Red, 0.0), + new (System.Windows.Media.Colors.Orange, 1.0 / 6), + new (System.Windows.Media.Colors.Yellow, 2.0 / 6), + new (System.Windows.Media.Colors.Green, 3.0 / 6), + new (System.Windows.Media.Colors.Blue, 4.0 / 6), + new (System.Windows.Media.Colors.Indigo, 5.0 / 6), + new (System.Windows.Media.Colors.Purple, 1.0) + })); + titleLV2000.Freeze(); + return titleLV2000; + default: + return null; + } + } + + public Brush GetDefaultPaint(Color valueColor, int faint = 100) + { + var defaultPaint = new SolidColorBrush(Utility.ModifyColor(valueColor)) + { + Opacity = faint / 100.0 + }; + defaultPaint.Freeze(); + return defaultPaint; + } + + public Pen GetPen(Brush defaultPaint) + { + var defaultPen = new Pen(defaultPaint, 1.0); + defaultPen.Freeze(); + return defaultPen; + } + + public void Close(IDrawingContainer drawingContainer) + { + if (_drawingMap.TryRemove(drawingContainer, out var drawingItems)) + { + foreach (var drawingItem in drawingItems.Values) + { + drawingItem.Dispose(); + } + } + _defaultDrawingMap.TryRemove(drawingContainer, out _); + if (_toCloseValues.TryRemove(drawingContainer, out var toCloseValues)) + { + foreach (var toCloseValue in toCloseValues) + { + toCloseValue.Dispose(); + } + } + } + + public void Migrate(IDrawingContainer src, IDrawingContainer target) + { + if (_drawingMap.TryRemove(src, out var drawingItems)) + { + _drawingMap[target] = drawingItems; + } + if (_defaultDrawingMap.TryRemove(src, out var defaultDrawings)) + { + _defaultDrawingMap[target] = defaultDrawings; + } + if (_toCloseValues.TryRemove(src, out var toCloseValues)) + { + _toCloseValues[target] = toCloseValues; + } + } + + public void SetFontFamily() + { + SetFontFamily(MeterFont); + SetFontLevel(MeterFont, Levels.FontLevel1Float32); + SetFontFamily(UtilityFont); + SetFontLevel(UtilityFont, Levels.FontLevel0Float32); + SetFontSystem(UtilityFont, 1, 0); + SetFontFamily(NotifyXamlFont); + SetFontLevel(NotifyXamlFont, Levels.FontLevel0Float32); + SetFontSystem(NotifyXamlFont, 1, 2); + SetFontFamily(NoteItemFont); + SetFontLevel(NoteItemFont, Levels.FontLevel1Float32); + SetFontFamily(InputAssistFont); + SetFontLevel(InputAssistFont, Levels.FontLevel1Float32); + SetFontFamily(PauseNotifyFont); + SetFontLevel(PauseNotifyFont, Levels.FontLevel0Float32); + SetFontFamily(NetFont); + SetFontLevel(NetFont, Levels.FontLevel0Float32); + SetFontFamily(JudgmentMeterViewFont); + SetFontLevel(JudgmentMeterViewFont, Levels.FontLevel0Float32); + SetFontFamily(StatusViewFont); + SetFontLevel(StatusViewFont, Levels.FontLevel0Float32); + } + + public virtual CanvasTextFormat GetFont() => new() + { + WordWrapping = CanvasWordWrapping.NoWrap + }; + + public virtual void SetFontLevel(CanvasTextFormat font, float fontLevel) + { + font.FontSize = fontLevel; + } + + public virtual void SetFontSystem(CanvasTextFormat font, int fontSystem0, int fontSystem1) + { + font.HorizontalAlignment = fontSystem0 switch + { + 0 => CanvasHorizontalAlignment.Right, + 1 => CanvasHorizontalAlignment.Left, + 2 => CanvasHorizontalAlignment.Center, + _ => default, + }; + font.VerticalAlignment = fontSystem1 switch + { + 0 => CanvasVerticalAlignment.Top, + 1 => CanvasVerticalAlignment.Bottom, + 2 => CanvasVerticalAlignment.Center, + _ => default, + }; + } + + public virtual void SetFontFamily(CanvasTextFormat font) + { + font.FontFamily = Configure.Instance.GetAFontFamily(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DrawingSystem/HandledDrawingItem.cs b/Qwilight/Qwilight/System/DrawingSystem/HandledDrawingItem.cs new file mode 100644 index 0000000..384fb1f --- /dev/null +++ b/Qwilight/Qwilight/System/DrawingSystem/HandledDrawingItem.cs @@ -0,0 +1,23 @@ +using System.Windows.Media; + +namespace Qwilight +{ + public struct HandledDrawingItem : IHandledItem, IDisposable + { + public double Length => double.PositiveInfinity; + + public DrawingItem? Drawing { get; init; } + + public ImageSource DefaultDrawing { get; init; } + + public IHandlerItem Handle(IMediaHandler mediaHandler, TimeSpan levyingWait, MediaNote.Mode mode, bool isLooping) => new DrawingHandlerItem + { + DrawingComputingValue = this + }; + + public void Dispose() + { + Drawing?.Dispose(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/DrawingSystem/IDrawingContainer.cs b/Qwilight/Qwilight/System/DrawingSystem/IDrawingContainer.cs new file mode 100644 index 0000000..4d56a17 --- /dev/null +++ b/Qwilight/Qwilight/System/DrawingSystem/IDrawingContainer.cs @@ -0,0 +1,6 @@ +namespace Qwilight +{ + public interface IDrawingContainer + { + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/FastDB/FastDB.cs b/Qwilight/Qwilight/System/FastDB/FastDB.cs new file mode 100644 index 0000000..1db6dbe --- /dev/null +++ b/Qwilight/Qwilight/System/FastDB/FastDB.cs @@ -0,0 +1,256 @@ +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.Collections.Concurrent; +using System.IO; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Qwilight +{ + public sealed class FastDB + { + public struct FastClass + { + public Version date; + public Dictionary noteFiles = new(); + public Dictionary> entryItems = new(); + public Dictionary> defaultEntryItems = new(); + public Dictionary defaultEntryItemDates = new(); + + public FastClass() + { + } + } + + static readonly string _fileName = Path.Combine(QwilightComponent.QwilightEntryPath, "DB.json"); + + public static readonly FastDB Instance = new(); + + readonly ConcurrentDictionary _fastNoteFiles = new(); + readonly ConcurrentDictionary> _fastEntryItems = new(); + readonly ConcurrentDictionary> _fastDefaultEntryItems = new(); + readonly ConcurrentDictionary _fastDefaultEntryItemDates = new(); + + public void Load() + { + try + { + if (File.Exists(_fileName)) + { + var fastClass = Utility.GetJSON(File.ReadAllText(_fileName, Encoding.UTF8), new JsonSerializerOptions + { + IncludeFields = true, + NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals + }); + foreach (var (noteID, fastNoteFile) in fastClass.noteFiles) + { + _fastNoteFiles[noteID] = fastNoteFile; + } + foreach (var (entryPath, fastEntryItems) in fastClass.entryItems) + { + _fastEntryItems[entryPath] = new ConcurrentBag(fastEntryItems); + } + foreach (var (defaultEntryPath, fastDefaultEntryItems) in fastClass.defaultEntryItems) + { + _fastDefaultEntryItems[defaultEntryPath] = new ConcurrentBag(fastDefaultEntryItems); + } + foreach (var (defaultEntryPath, defaultEntryItemDate) in fastClass.defaultEntryItemDates) + { + _fastDefaultEntryItemDates[defaultEntryPath] = defaultEntryItemDate; + } + } + } + catch + { + } + } + + public bool GetNoteFile(BaseNoteFile noteFile) + { + if (_fastNoteFiles.TryGetValue(noteFile.GetNoteID512(), out var fastNoteFile)) + { + noteFile.InputMode = fastNoteFile.inputMode; + noteFile.Title = fastNoteFile.title; + noteFile.Artist = fastNoteFile.artist; + noteFile.Genre = fastNoteFile.genre; + noteFile.LevelText = fastNoteFile.levelText; + noteFile.LevelTextValue = fastNoteFile.levelTextValue; + noteFile.BPM = fastNoteFile.bpm; + noteFile.JudgmentStage = fastNoteFile.judgmentStage; + noteFile.HitPointsValue = fastNoteFile.hitPointsValue; + noteFile.LevelValue = fastNoteFile.levelValue; + noteFile.NoteDrawingName = fastNoteFile.noteDrawingName; + if (!string.IsNullOrEmpty(noteFile.NoteDrawingName)) + { + noteFile.NoteDrawingPath = Path.Combine(noteFile.EntryItem.EntryPath, noteFile.NoteDrawingName); + } + noteFile.BannerDrawingName = fastNoteFile.bannerDrawingName; + if (!string.IsNullOrEmpty(noteFile.BannerDrawingName)) + { + noteFile.BannerDrawingPath = Path.Combine(noteFile.EntryItem.EntryPath, noteFile.BannerDrawingName); + } + var trailerAudioName = fastNoteFile.trailerAudioName; + noteFile.TrailerAudioName = trailerAudioName; + noteFile.TrailerAudioPath = Path.Combine(noteFile.EntryItem.EntryPath, string.IsNullOrEmpty(trailerAudioName) ? "PREVIEW.WAV" : trailerAudioName); + noteFile.TotalNotes = fastNoteFile.totalNotes; + noteFile.AutoableNotes = fastNoteFile.autoableNotes; + noteFile.LongNotes = fastNoteFile.longNotes; + noteFile.TrapNotes = fastNoteFile.trapNotes; + noteFile.Length = fastNoteFile.length; + noteFile.Tag = fastNoteFile.tag; + noteFile.IsBanned = fastNoteFile.isBanned; + noteFile.LowestBPM = fastNoteFile.lowestBPM; + noteFile.HighestBPM = fastNoteFile.highestBPM; + noteFile.HighestInputCount = fastNoteFile.highestInputCount; + noteFile.IsHellBPM = fastNoteFile.isHellBPM; + noteFile.IsAutoLongNote = fastNoteFile.isAutoLongNote; + noteFile.IsSalt = fastNoteFile.isSalt; + noteFile.AssistFileName = fastNoteFile.assistFileName; + noteFile.PlatformText = Utility.GetPlatformText(noteFile.Title, noteFile.Artist, noteFile.GenreText, noteFile.LevelText); + return true; + } + else + { + return false; + } + } + + public void SetNoteFile(BaseNoteFile noteFile) + { + _fastNoteFiles[noteFile.GetNoteID512()] = new FastNoteFile + { + inputMode = noteFile.InputMode, + artist = noteFile.Artist, + title = noteFile.Title, + genre = noteFile.Genre, + levelText = noteFile.LevelText, + levelTextValue = noteFile.LevelTextValue, + bpm = noteFile.BPM, + judgmentStage = noteFile.JudgmentStage, + hitPointsValue = noteFile.HitPointsValue, + levelValue = noteFile.LevelValue, + noteDrawingName = noteFile.NoteDrawingName, + bannerDrawingName = noteFile.BannerDrawingName, + trailerAudioName = noteFile.TrailerAudioName, + totalNotes = noteFile.TotalNotes, + autoableNotes = noteFile.AutoableNotes, + longNotes = noteFile.LongNotes, + trapNotes = noteFile.TrapNotes, + length = noteFile.Length, + tag = noteFile.Tag, + isBanned = noteFile.IsBanned, + lowestBPM = noteFile.LowestBPM, + highestBPM = noteFile.HighestBPM, + highestInputCount = noteFile.HighestInputCount, + isHellBPM = noteFile.IsHellBPM, + isAutoLongNote = noteFile.IsAutoLongNote, + isSalt = noteFile.IsSalt, + assistFileName = noteFile.AssistFileName + }; + } + + public void WipeNoteFile(BaseNoteFile noteFile) + { + _fastNoteFiles.Remove(noteFile.GetNoteID512(), out _); + } + + public IEnumerable GetEntryItems(string entryPath) + { + if (_fastEntryItems.TryGetValue(entryPath, out var fastEntryItems)) + { + return fastEntryItems; + } + else + { + return Array.Empty(); + } + } + + public void WipeEntryItem(string entryPath) + { + _fastEntryItems.Remove(entryPath, out _); + } + + public void SetEntryItem(string entryPath, BaseNoteFile noteFile, int dataIDCount) + { + _fastEntryItems.GetOrAdd(entryPath, New>).Add(new FastEntryItem + { + noteFilePath = noteFile?.NoteFilePath, + noteID128 = noteFile?.GetNoteID128(), + noteID256 = noteFile?.GetNoteID256(), + noteID512 = noteFile?.GetNoteID512(), + dataIDCount = dataIDCount, + }); + } + + public IEnumerable GetDefaultEntryItems(string defaultEntryPath) + { + if (_fastDefaultEntryItems.TryGetValue(defaultEntryPath, out var fastDefaultEntryItems)) + { + return fastDefaultEntryItems; + } + else + { + return Array.Empty(); + } + } + + public void WipeDefaultEntryItem(string defaultEntryPath) + { + _fastDefaultEntryItems.Remove(defaultEntryPath, out _); + } + + public void WipeDefaultEntryItems() + { + _fastDefaultEntryItems.Clear(); + } + + public void SetDefaultEntryItem(string defaultEntryPath, string entryPath) + { + _fastDefaultEntryItems.GetOrAdd(defaultEntryPath, New>).Add(entryPath); + } + + public DateTime GetDefaultEntryItemDate(string defaultEntryPath) + { + if (_fastDefaultEntryItemDates.TryGetValue(defaultEntryPath, out var fastDefaultEntryItemDate)) + { + return fastDefaultEntryItemDate; + } + else + { + return DateTime.MinValue; + } + } + + public void SetDefaultEntryItemDate(string defaultEntryPath, DateTime date) + { + _fastDefaultEntryItemDates[defaultEntryPath] = date; + } + + static T New(string text) where T : new() => new T(); + + public void Clear() + { + _fastNoteFiles.Clear(); + _fastEntryItems.Clear(); + _fastDefaultEntryItems.Clear(); + } + + public void Save() + { + File.WriteAllText(_fileName, Utility.SetJSON(new FastClass + { + date = QwilightComponent.Date, + noteFiles = _fastNoteFiles.ToDictionary(pair => pair.Key, pair => pair.Value), + entryItems = _fastEntryItems.ToDictionary(pair => pair.Key, pair => pair.Value.ToList()), + defaultEntryItems = _fastDefaultEntryItems.ToDictionary(pair => pair.Key, pair => pair.Value.ToList()), + defaultEntryItemDates = _fastDefaultEntryItemDates.ToDictionary(pair => pair.Key, pair => pair.Value), + }, new JsonSerializerOptions + { + IncludeFields = true, + NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals + })); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/FastDB/FastEntryItem.cs b/Qwilight/Qwilight/System/FastDB/FastEntryItem.cs new file mode 100644 index 0000000..7445977 --- /dev/null +++ b/Qwilight/Qwilight/System/FastDB/FastEntryItem.cs @@ -0,0 +1,11 @@ +namespace Qwilight +{ + public struct FastEntryItem + { + public string noteFilePath; + public string noteID128; + public string noteID256; + public string noteID512; + public int dataIDCount; + } +} diff --git a/Qwilight/Qwilight/System/FastDB/FastNoteFile.cs b/Qwilight/Qwilight/System/FastDB/FastNoteFile.cs new file mode 100644 index 0000000..ee8ac82 --- /dev/null +++ b/Qwilight/Qwilight/System/FastDB/FastNoteFile.cs @@ -0,0 +1,39 @@ +using Qwilight.NoteFile; + +namespace Qwilight +{ + public struct FastNoteFile + { + public Component.InputMode inputMode = Component.InputMode.InputMode51; + public string artist = string.Empty; + public string title = string.Empty; + public string genre = string.Empty; + public string levelText = string.Empty; + public double levelTextValue = double.NaN; + public double bpm = Component.StandardBPM; + public double judgmentStage = 5.0; + public double hitPointsValue = 0.01; + public BaseNoteFile.Level levelValue = BaseNoteFile.Level.Level0; + public string noteDrawingName = string.Empty; + public string bannerDrawingName = string.Empty; + public string trailerAudioName = string.Empty; + public int totalNotes; + public int autoableNotes; + public int longNotes; + public int trapNotes; + public double length; + public string tag = string.Empty; + public bool isBanned; + public double lowestBPM = Component.StandardBPM; + public double highestBPM = Component.StandardBPM; + public int highestInputCount; + public bool isHellBPM; + public bool isAutoLongNote; + public bool isSalt; + public string assistFileName = string.Empty; + + public FastNoteFile() + { + } + } +} diff --git a/Qwilight/Qwilight/System/FlintSystem.cs b/Qwilight/Qwilight/System/FlintSystem.cs new file mode 100644 index 0000000..25cd8fc --- /dev/null +++ b/Qwilight/Qwilight/System/FlintSystem.cs @@ -0,0 +1,74 @@ +using CommandLine; +using Qwilight.ViewModel; +using System.IO; +using System.IO.Pipes; + +namespace Qwilight +{ + public sealed class FlintSystem + { + public sealed class FlintParams + { + [Option('P')] + public bool Handle { get; set; } + + [Option('S')] + public bool Stop { get; set; } + + [Option('N')] + public int Meter { get; set; } + + [Value(0)] + public string FileName { get; set; } + } + + public static readonly FlintSystem Instance = new(); + + public void HandleSystem() + { + while (true) + { + try + { + using var ss = new NamedPipeServerStream("Qwilight", PipeDirection.In); + ss.WaitForConnection(); + using var sr = new StreamReader(ss); + Parser.Default.ParseArguments(sr.ReadLine()?.Split(" ", 3) ?? Array.Empty()).WithParsed(o => + { + var mainViewModel = ViewModels.Instance.MainValue; + var defaultComputer = mainViewModel.Computer; + if (o.Stop) + { + if (defaultComputer != null) + { + defaultComputer.SetPause = true; + } + } + else if (o.Handle) + { + var m = o.Meter; + var noteFile = defaultComputer?.NoteFile; + var noteFilePath = o.FileName.Replace("\"", string.Empty); + if (defaultComputer?.IsHandling == true && noteFile?.NoteFilePath == noteFilePath && noteFile.IsValid()) + { + defaultComputer.LevyingMeter = m; + defaultComputer.SetUndo = true; + } + else + { + mainViewModel.FlintNoteFile(noteFilePath, m); + } + } + }); + } + catch (IOException) + { + return; + } + catch + { + } + } + } + } +} diff --git a/Qwilight/Qwilight/System/HandlingController.cs b/Qwilight/Qwilight/System/HandlingController.cs new file mode 100644 index 0000000..62576d0 --- /dev/null +++ b/Qwilight/Qwilight/System/HandlingController.cs @@ -0,0 +1,229 @@ +using Qwilight.Compute; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; + +namespace Qwilight +{ + public sealed class HandlingController + { + readonly HashSet _rawInputs = new(); + readonly Stopwatch _loopingHandler = Stopwatch.StartNew(); + readonly Action _onInputViewModel; + readonly Action _onStandardInputControllerViewModel; + readonly TimerCallback _onLowerMultiplier = new(state => ViewModels.Instance.MainValue.LowerMultiplier()); + readonly TimerCallback _onHigherMultiplier = new(state => ViewModels.Instance.MainValue.HigherMultiplier()); + readonly TimerCallback _onLowerEntry = new(state => + { + var mainViewModel = ViewModels.Instance.MainValue; + switch (mainViewModel.ModeValue) + { + case MainViewModel.Mode.NoteFile: + mainViewModel.LowerEntryItem(); + break; + case MainViewModel.Mode.Computing: + if (mainViewModel.Computer.IsPausingWindowOpened) + { + mainViewModel.LowerDefaultSpinningMode(); + } + break; + } + }); + readonly TimerCallback _onHigherEntry = new(state => + { + var mainViewModel = ViewModels.Instance.MainValue; + switch (mainViewModel.ModeValue) + { + case MainViewModel.Mode.NoteFile: + mainViewModel.HigherEntryItem(); + break; + case MainViewModel.Mode.Computing: + if (mainViewModel.Computer.IsPausingWindowOpened) + { + mainViewModel.HigherDefaultSpinningMode(); + } + break; + } + }); + readonly DefaultCompute.InputFlag _inputFlag; + double _loopingCounter; + double _atLoopingCounter1000; + Timer _lowerMultiplierHandler; + Timer _higherMultiplierHandler; + Timer _lowerEntryHandler; + Timer _higherEntryHandler; + Timer _lowerSpinningValueHandler; + Timer _higherSpinningValueHandler; + + public HandlingController(Action onInputViewModel, Action onStandardInputControllerViewModel, DefaultCompute.InputFlag inputFlag) + { + _onInputViewModel = onInputViewModel; + _onStandardInputControllerViewModel = onStandardInputControllerViewModel; + _inputFlag = inputFlag; + } + + public void Init() + { + _lowerMultiplierHandler?.Dispose(); + _lowerMultiplierHandler = null; + _higherMultiplierHandler?.Dispose(); + _higherMultiplierHandler = null; + _lowerEntryHandler?.Dispose(); + _lowerEntryHandler = null; + _higherEntryHandler?.Dispose(); + _higherEntryHandler = null; + _lowerSpinningValueHandler?.Dispose(); + _lowerSpinningValueHandler = null; + _higherSpinningValueHandler?.Dispose(); + _higherSpinningValueHandler = null; + } + + public void Input(T rawInput, T[] inputStandardConfigure, T[][][] inputConfigure, bool isInput, byte inputPower = byte.MaxValue) + { + var mainViewModel = ViewModels.Instance.MainValue; + var input = Array.IndexOf(inputStandardConfigure, rawInput); + if (isInput) + { + var isInputWindowOpened = ViewModels.Instance.InputValue.IsOpened; + var isInputStandardWindowOpened = ViewModels.Instance.InputStandardControllerValue.IsOpened; + if (isInputWindowOpened) + { + _onInputViewModel(rawInput); + } + if (isInputStandardWindowOpened) + { + _onStandardInputControllerViewModel(rawInput); + } + switch (input) + { + case InputStandardControllerViewModel.Wait when !isInputWindowOpened && !isInputStandardWindowOpened: + mainViewModel.HandleESC(); + break; + case InputStandardControllerViewModel.LowerMultiplier when _lowerMultiplierHandler == null: + _lowerMultiplierHandler = new(_onLowerMultiplier, null, 0, (int)QwilightComponent.StandardLoopMillis); + break; + case InputStandardControllerViewModel.HigherMultiplier when _higherMultiplierHandler == null: + _higherMultiplierHandler = new(_onHigherMultiplier, null, 0, (int)QwilightComponent.StandardLoopMillis); + break; + case InputStandardControllerViewModel.MediaMode: + mainViewModel.HandleMediaMode(); + break; + case InputStandardControllerViewModel.HandleUndo: + mainViewModel.HandleUndo(); + break; + } + } + else + { + switch (input) + { + case InputStandardControllerViewModel.LowerEntry: + _lowerEntryHandler?.Dispose(); + _lowerEntryHandler = null; + break; + case InputStandardControllerViewModel.HigherEntry: + _higherEntryHandler?.Dispose(); + _higherEntryHandler = null; + break; + case InputStandardControllerViewModel.LowerNoteFile: + _lowerSpinningValueHandler?.Dispose(); + _lowerSpinningValueHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case InputStandardControllerViewModel.HigherNoteFile: + _higherSpinningValueHandler?.Dispose(); + _higherSpinningValueHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case InputStandardControllerViewModel.LowerMultiplier: + _lowerMultiplierHandler?.Dispose(); + _lowerMultiplierHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + case InputStandardControllerViewModel.HigherMultiplier: + _higherMultiplierHandler?.Dispose(); + _higherMultiplierHandler = null; + mainViewModel.UndoUnitMultiplier(); + break; + } + } + var defaultComputer = mainViewModel.Computer; + switch (mainViewModel.ModeValue) + { + case MainViewModel.Mode.NoteFile: + if (isInput) + { + switch (input) + { + case InputStandardControllerViewModel.LevyNoteFile: + mainViewModel.HandleLevyNoteFile(); + break; + case InputStandardControllerViewModel.LowerEntry: + _lowerEntryHandler = new(_onLowerEntry, null, 0, 1000 / 7); + break; + case InputStandardControllerViewModel.HigherEntry: + _higherEntryHandler = new(_onHigherEntry, null, 0, 1000 / 7); + break; + case InputStandardControllerViewModel.LowerNoteFile: + mainViewModel.LowerNoteFile(); + break; + case InputStandardControllerViewModel.HigherNoteFile: + mainViewModel.HigherNoteFile(); + break; + } + } + break; + case MainViewModel.Mode.Computing: + if (isInput) + { + if (_rawInputs.Add(rawInput)) + { + mainViewModel.Input(inputConfigure, rawInput, true, _inputFlag, inputPower); + } + } + else + { + if (_rawInputs.Remove(rawInput)) + { + mainViewModel.Input(inputConfigure, rawInput, false, _inputFlag, inputPower); + } + } + break; + case MainViewModel.Mode.Quit: + if (isInput) + { + switch (input) + { + case InputStandardControllerViewModel.LevyNoteFile: + mainViewModel.HandleEnter(); + break; + } + } + break; + } + } + + public void HandleLooping(bool hasControllers, Action onHandle1000, Action onHandle) + { + var millisPolling = 1000.0 / (hasControllers ? Configure.Instance.LoopUnit : 1); + _atLoopingCounter1000 += millisPolling; + if (_atLoopingCounter1000 >= 1000.0) + { + _atLoopingCounter1000 -= 1000.0; + Task.Run(onHandle1000); + } + + if (hasControllers) + { + onHandle(); + } + + _loopingCounter += millisPolling; + var toWait = _loopingCounter - _loopingHandler.GetMillis(); + if (toWait > 0.0) + { + Thread.Sleep(TimeSpan.FromMilliseconds(toWait)); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/HandlingUISystem.cs b/Qwilight/Qwilight/System/HandlingUISystem.cs new file mode 100644 index 0000000..c7d7ecd --- /dev/null +++ b/Qwilight/Qwilight/System/HandlingUISystem.cs @@ -0,0 +1,70 @@ +using System.Windows.Threading; + +namespace Qwilight +{ + public sealed class HandlingUISystem + { + public static readonly HandlingUISystem Instance = new(); + + public Dispatcher UIHandler { get; set; } + + public void Init(Action onUnhandledFault) + { + UIHandler = Dispatcher.CurrentDispatcher; + UIHandler.UnhandledException += (sender, e) => + { + onUnhandledFault(e.Exception); + e.Handled = true; + }; + } + + public void HandleParallel(Action onHandle) + { + if (UIHandler.CheckAccess()) + { + onHandle(); + } + else + { + UIHandler.InvokeAsync(onHandle); + } + } + + public T Handle(Func onHandle) + { + if (UIHandler.CheckAccess()) + { + return onHandle(); + } + else + { + var handleCSX = new object(); + var isHandling = true; + T value = default; + UIHandler.InvokeAsync(() => + { + try + { + value = onHandle(); + } + finally + { + lock (handleCSX) + { + isHandling = false; + Monitor.Pulse(handleCSX); + } + } + }); + lock (handleCSX) + { + if (isHandling) + { + Monitor.Wait(handleCSX); + } + } + return value; + } + } + } +} diff --git a/Qwilight/Qwilight/System/IHandledItem.cs b/Qwilight/Qwilight/System/IHandledItem.cs new file mode 100644 index 0000000..c0db13a --- /dev/null +++ b/Qwilight/Qwilight/System/IHandledItem.cs @@ -0,0 +1,9 @@ +namespace Qwilight +{ + public interface IHandledItem + { + double Length { get; } + + IHandlerItem Handle(IMediaHandler mediaHandler, TimeSpan levyingWait, MediaNote.Mode mode, bool isLooping = false); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/IHandlerItem.cs b/Qwilight/Qwilight/System/IHandlerItem.cs new file mode 100644 index 0000000..5d9bedc --- /dev/null +++ b/Qwilight/Qwilight/System/IHandlerItem.cs @@ -0,0 +1,7 @@ +namespace Qwilight +{ + public interface IHandlerItem + { + public IHandledItem Value { get; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/IlluminationSystem/AuraSystem.cs b/Qwilight/Qwilight/System/IlluminationSystem/AuraSystem.cs new file mode 100644 index 0000000..3e182e5 --- /dev/null +++ b/Qwilight/Qwilight/System/IlluminationSystem/AuraSystem.cs @@ -0,0 +1,270 @@ +using AuraServiceLib; +using Microsoft.UI; +using Qwilight.Utilities; +using Windows.System; +using Windows.UI; + +namespace Qwilight +{ + public sealed class AuraSystem : BaseIlluminationSystem + { + public static readonly AuraSystem Instance = new(); + + static readonly Dictionary _inputMap = new(); + + static AuraSystem() + { + _inputMap[1] = VirtualKey.Escape; + _inputMap[2] = VirtualKey.Number1; + _inputMap[3] = VirtualKey.Number2; + _inputMap[4] = VirtualKey.Number3; + _inputMap[5] = VirtualKey.Number4; + _inputMap[6] = VirtualKey.Number5; + _inputMap[7] = VirtualKey.Number6; + _inputMap[8] = VirtualKey.Number7; + _inputMap[9] = VirtualKey.Number8; + _inputMap[10] = VirtualKey.Number9; + _inputMap[11] = VirtualKey.Number0; + _inputMap[12] = (VirtualKey)189; + _inputMap[13] = (VirtualKey)187; + _inputMap[14] = VirtualKey.Back; + _inputMap[15] = VirtualKey.Tab; + _inputMap[16] = VirtualKey.Q; + _inputMap[17] = VirtualKey.W; + _inputMap[18] = VirtualKey.E; + _inputMap[19] = VirtualKey.R; + _inputMap[20] = VirtualKey.T; + _inputMap[21] = VirtualKey.Y; + _inputMap[22] = VirtualKey.U; + _inputMap[23] = VirtualKey.I; + _inputMap[24] = VirtualKey.O; + _inputMap[25] = VirtualKey.P; + _inputMap[26] = (VirtualKey)219; + _inputMap[27] = (VirtualKey)221; + _inputMap[28] = VirtualKey.Enter; + _inputMap[29] = VirtualKey.LeftControl; + _inputMap[30] = VirtualKey.A; + _inputMap[31] = VirtualKey.S; + _inputMap[32] = VirtualKey.D; + _inputMap[33] = VirtualKey.F; + _inputMap[34] = VirtualKey.G; + _inputMap[35] = VirtualKey.H; + _inputMap[36] = VirtualKey.J; + _inputMap[37] = VirtualKey.K; + _inputMap[38] = VirtualKey.L; + _inputMap[39] = (VirtualKey)186; + _inputMap[40] = (VirtualKey)222; + _inputMap[41] = (VirtualKey)192; + _inputMap[42] = VirtualKey.LeftShift; + _inputMap[43] = (VirtualKey)220; + _inputMap[44] = VirtualKey.Z; + _inputMap[45] = VirtualKey.X; + _inputMap[46] = VirtualKey.C; + _inputMap[47] = VirtualKey.V; + _inputMap[48] = VirtualKey.B; + _inputMap[49] = VirtualKey.N; + _inputMap[50] = VirtualKey.M; + _inputMap[51] = (VirtualKey)188; + _inputMap[52] = (VirtualKey)190; + _inputMap[53] = (VirtualKey)191; + _inputMap[54] = VirtualKey.RightShift; + _inputMap[55] = VirtualKey.Multiply; + + _inputMap[57] = VirtualKey.Space; + _inputMap[58] = VirtualKey.CapitalLock; + _inputMap[59] = VirtualKey.F1; + _inputMap[60] = VirtualKey.F2; + _inputMap[61] = VirtualKey.F3; + _inputMap[62] = VirtualKey.F4; + _inputMap[63] = VirtualKey.F5; + _inputMap[64] = VirtualKey.F6; + _inputMap[65] = VirtualKey.F7; + _inputMap[66] = VirtualKey.F8; + _inputMap[67] = VirtualKey.F9; + _inputMap[68] = VirtualKey.F10; + _inputMap[69] = VirtualKey.NumberKeyLock; + _inputMap[70] = VirtualKey.Scroll; + _inputMap[71] = VirtualKey.NumberPad7; + _inputMap[72] = VirtualKey.NumberPad8; + _inputMap[73] = VirtualKey.NumberPad9; + + _inputMap[75] = VirtualKey.NumberPad4; + _inputMap[76] = VirtualKey.NumberPad5; + _inputMap[77] = VirtualKey.NumberPad6; + + _inputMap[79] = VirtualKey.NumberPad1; + _inputMap[80] = VirtualKey.NumberPad2; + _inputMap[81] = VirtualKey.NumberPad3; + _inputMap[82] = VirtualKey.NumberPad0; + + _inputMap[87] = VirtualKey.F11; + _inputMap[88] = VirtualKey.F12; + + _inputMap[157] = VirtualKey.RightControl; + + _inputMap[197] = VirtualKey.Pause; + _inputMap[199] = VirtualKey.Home; + _inputMap[200] = VirtualKey.Up; + _inputMap[201] = VirtualKey.PageUp; + _inputMap[203] = VirtualKey.Left; + _inputMap[205] = VirtualKey.Right; + _inputMap[207] = VirtualKey.End; + _inputMap[208] = VirtualKey.Down; + _inputMap[209] = VirtualKey.PageDown; + _inputMap[210] = VirtualKey.Insert; + _inputMap[211] = VirtualKey.Delete; + _inputMap[219] = VirtualKey.LeftWindows; + _inputMap[221] = VirtualKey.Application; + } + + readonly Dictionary> _statusItems = new(); + readonly Dictionary> _inputItems = new(); + readonly List _etcItems = new(); + readonly List _illuminatedItems = new(); + int _highestStatusCount; + IAuraSdk2 _auraSDK; + IAuraSyncDeviceCollection _auraItems; + + public override bool IsAvailable => Configure.Instance.Aura; + + public override bool Init() + { + try + { + _auraSDK = new AuraSdk() as IAuraSdk2; + _auraSDK.SwitchMode(); + _auraItems = _auraSDK.Enumerate(0); + if (_auraItems.Count > 0) + { + _statusItems.Clear(); + _inputItems.Clear(); + _etcItems.Clear(); + _illuminatedItems.Clear(); + foreach (IAuraSyncDevice auraItem in _auraItems) + { + foreach (IAuraRgbLight ledItem in auraItem.Lights) + { + _illuminatedItems.Add(ledItem); + } + if (auraItem is IAuraSyncKeyboard auraInput) + { + foreach (IAuraRgbKey ledItem in auraInput.Keys) + { + if (_inputMap.TryGetValue(ledItem.Code, out var input)) + { + Utility.Into(_inputItems, input, auraInput.Key[ledItem.Code]); + } + } + } + else + { + if (auraItem.Name.IsFrontCaselsss("ENE_RGB_For_ASUS")) + { + for (var i = auraItem.Lights.Count - 1; i >= 0; --i) + { + Utility.Into(_statusItems, i, auraItem.Lights[i]); + } + } + else + { + foreach (IAuraRgbLight ledItem in auraItem.Lights) + { + _etcItems.Add(ledItem); + } + } + } + } + _highestStatusCount = _statusItems.Keys.Count > 0 ? _statusItems.Keys.Max() : 0; + } + return true; + } + catch + { + return false; + } + } + + public override void SetInputColor(VirtualKey input, uint value) + { + if (_inputItems.TryGetValue(input, out var inputItems)) + { + foreach (var inputItem in inputItems) + { + inputItem.Color = value; + } + } + } + + public override void SetStatusColors(double status, uint value0, uint value1, uint value2, uint value3) + { + if (!double.IsNaN(status)) + { + var value = _highestStatusCount * status; + var valueInt = (int)value; + var remainder = value - valueInt; + if (remainder > 0.0 && _statusItems.TryGetValue(valueInt, out var faintStatusItems)) + { + foreach (var statusItem in faintStatusItems) + { + statusItem.Color = Utility.GetColor((uint)(value0 * remainder), (uint)(value1 * remainder), (uint)(value2 * remainder), (uint)(value3 * remainder)); + } + } + for (var i = valueInt - 1; i >= 0; --i) + { + if (_statusItems.TryGetValue(valueInt, out var statusItems)) + { + foreach (var statusItem in statusItems) + { + statusItem.Color = Utility.GetColor(value0, value1, value2, value3); + } + } + } + } + } + + public override void SetEtcColor(uint value) + { + foreach (var etcItem in _etcItems) + { + etcItem.Color = value; + } + } + + public override void OnBeforeHandle() + { + foreach (IAuraRgbLight ledItem in _illuminatedItems) + { + ledItem.Color = 0; + } + } + + public override void OnHandled() + { + foreach (IAuraSyncDevice auraItem in _auraItems) + { + auraItem.Apply(); + } + } + + public override Color GetMeterColor() => Colors.Red; + + public override void Dispose() + { + lock (IlluminationSystem.Instance.HandlingCSX) + { + if (IsHandling) + { + IsHandling = false; + _auraSDK.ReleaseControl(0); + _auraSDK = null; + } + } + } + + public override void Toggle() + { + Configure.Instance.Aura = !Configure.Instance.Aura; + base.Toggle(); + } + } +} diff --git a/Qwilight/Qwilight/System/IlluminationSystem/BWSystem.cs b/Qwilight/Qwilight/System/IlluminationSystem/BWSystem.cs new file mode 100644 index 0000000..fe7e3ed --- /dev/null +++ b/Qwilight/Qwilight/System/IlluminationSystem/BWSystem.cs @@ -0,0 +1,234 @@ +using ChromaSDK; +using Microsoft.UI; +using Qwilight.Utilities; +using Windows.System; +using Windows.UI; + +namespace Qwilight +{ + public sealed class BWSystem : BaseIlluminationSystem + { + public static readonly BWSystem Instance = new(); + + static Keyboard.RZKEY GetInput(VirtualKey input) => input switch + { + VirtualKey.Escape => Keyboard.RZKEY.RZKEY_ESC, + VirtualKey.F1 => Keyboard.RZKEY.RZKEY_F1, + VirtualKey.F2 => Keyboard.RZKEY.RZKEY_F2, + VirtualKey.F3 => Keyboard.RZKEY.RZKEY_F3, + VirtualKey.F4 => Keyboard.RZKEY.RZKEY_F4, + VirtualKey.F5 => Keyboard.RZKEY.RZKEY_F5, + VirtualKey.F6 => Keyboard.RZKEY.RZKEY_F6, + VirtualKey.F7 => Keyboard.RZKEY.RZKEY_F7, + VirtualKey.F8 => Keyboard.RZKEY.RZKEY_F8, + VirtualKey.F9 => Keyboard.RZKEY.RZKEY_F9, + VirtualKey.F10 => Keyboard.RZKEY.RZKEY_F10, + VirtualKey.F11 => Keyboard.RZKEY.RZKEY_F11, + VirtualKey.F12 => Keyboard.RZKEY.RZKEY_F12, + VirtualKey.Insert => Keyboard.RZKEY.RZKEY_INSERT, + VirtualKey.Delete => Keyboard.RZKEY.RZKEY_DELETE, + (VirtualKey)192 => Keyboard.RZKEY.RZKEY_OEM_1, + VirtualKey.Number1 => Keyboard.RZKEY.RZKEY_1, + VirtualKey.Number2 => Keyboard.RZKEY.RZKEY_2, + VirtualKey.Number3 => Keyboard.RZKEY.RZKEY_3, + VirtualKey.Number4 => Keyboard.RZKEY.RZKEY_4, + VirtualKey.Number5 => Keyboard.RZKEY.RZKEY_5, + VirtualKey.Number6 => Keyboard.RZKEY.RZKEY_6, + VirtualKey.Number7 => Keyboard.RZKEY.RZKEY_7, + VirtualKey.Number8 => Keyboard.RZKEY.RZKEY_8, + VirtualKey.Number9 => Keyboard.RZKEY.RZKEY_9, + VirtualKey.Number0 => Keyboard.RZKEY.RZKEY_0, + (VirtualKey)189 => Keyboard.RZKEY.RZKEY_OEM_2, + (VirtualKey)187 => Keyboard.RZKEY.RZKEY_OEM_3, + VirtualKey.Back => Keyboard.RZKEY.RZKEY_BACKSPACE, + VirtualKey.Tab => Keyboard.RZKEY.RZKEY_TAB, + VirtualKey.Q => Keyboard.RZKEY.RZKEY_Q, + VirtualKey.W => Keyboard.RZKEY.RZKEY_W, + VirtualKey.E => Keyboard.RZKEY.RZKEY_E, + VirtualKey.R => Keyboard.RZKEY.RZKEY_R, + VirtualKey.T => Keyboard.RZKEY.RZKEY_T, + VirtualKey.Y => Keyboard.RZKEY.RZKEY_Y, + VirtualKey.U => Keyboard.RZKEY.RZKEY_U, + VirtualKey.I => Keyboard.RZKEY.RZKEY_I, + VirtualKey.O => Keyboard.RZKEY.RZKEY_O, + VirtualKey.P => Keyboard.RZKEY.RZKEY_P, + (VirtualKey)219 => Keyboard.RZKEY.RZKEY_OEM_4, + (VirtualKey)221 => Keyboard.RZKEY.RZKEY_OEM_5, + (VirtualKey)220 => Keyboard.RZKEY.RZKEY_OEM_6, + VirtualKey.CapitalLock => Keyboard.RZKEY.RZKEY_CAPSLOCK, + VirtualKey.A => Keyboard.RZKEY.RZKEY_A, + VirtualKey.S => Keyboard.RZKEY.RZKEY_S, + VirtualKey.D => Keyboard.RZKEY.RZKEY_D, + VirtualKey.F => Keyboard.RZKEY.RZKEY_F, + VirtualKey.G => Keyboard.RZKEY.RZKEY_G, + VirtualKey.H => Keyboard.RZKEY.RZKEY_H, + VirtualKey.J => Keyboard.RZKEY.RZKEY_J, + VirtualKey.K => Keyboard.RZKEY.RZKEY_K, + VirtualKey.L => Keyboard.RZKEY.RZKEY_L, + (VirtualKey)186 => Keyboard.RZKEY.RZKEY_OEM_7, + (VirtualKey)222 => Keyboard.RZKEY.RZKEY_OEM_8, + VirtualKey.Enter => Keyboard.RZKEY.RZKEY_ENTER, + VirtualKey.LeftShift => Keyboard.RZKEY.RZKEY_LSHIFT, + VirtualKey.Z => Keyboard.RZKEY.RZKEY_Z, + VirtualKey.X => Keyboard.RZKEY.RZKEY_X, + VirtualKey.C => Keyboard.RZKEY.RZKEY_C, + VirtualKey.V => Keyboard.RZKEY.RZKEY_V, + VirtualKey.B => Keyboard.RZKEY.RZKEY_B, + VirtualKey.N => Keyboard.RZKEY.RZKEY_N, + VirtualKey.M => Keyboard.RZKEY.RZKEY_M, + (VirtualKey)188 => Keyboard.RZKEY.RZKEY_OEM_9, + (VirtualKey)190 => Keyboard.RZKEY.RZKEY_OEM_10, + (VirtualKey)191 => Keyboard.RZKEY.RZKEY_OEM_11, + VirtualKey.RightShift => Keyboard.RZKEY.RZKEY_RSHIFT, + VirtualKey.LeftControl => Keyboard.RZKEY.RZKEY_LCTRL, + VirtualKey.LeftWindows => Keyboard.RZKEY.RZKEY_LWIN, + VirtualKey.LeftMenu => Keyboard.RZKEY.RZKEY_LALT, + VirtualKey.Space => Keyboard.RZKEY.RZKEY_SPACE, + VirtualKey.RightMenu => Keyboard.RZKEY.RZKEY_RALT, + VirtualKey.RightControl => Keyboard.RZKEY.RZKEY_RCTRL, + VirtualKey.Left => Keyboard.RZKEY.RZKEY_LEFT, + VirtualKey.Up => Keyboard.RZKEY.RZKEY_UP, + VirtualKey.Down => Keyboard.RZKEY.RZKEY_DOWN, + VirtualKey.Right => Keyboard.RZKEY.RZKEY_RIGHT, + VirtualKey.NumberKeyLock => Keyboard.RZKEY.RZKEY_NUMLOCK, + VirtualKey.NumberPad0 => Keyboard.RZKEY.RZKEY_NUMPAD0, + VirtualKey.NumberPad1 => Keyboard.RZKEY.RZKEY_NUMPAD1, + VirtualKey.NumberPad2 => Keyboard.RZKEY.RZKEY_NUMPAD2, + VirtualKey.NumberPad3 => Keyboard.RZKEY.RZKEY_NUMPAD3, + VirtualKey.NumberPad4 => Keyboard.RZKEY.RZKEY_NUMPAD4, + VirtualKey.NumberPad5 => Keyboard.RZKEY.RZKEY_NUMPAD5, + VirtualKey.NumberPad6 => Keyboard.RZKEY.RZKEY_NUMPAD6, + VirtualKey.NumberPad7 => Keyboard.RZKEY.RZKEY_NUMPAD7, + VirtualKey.NumberPad8 => Keyboard.RZKEY.RZKEY_NUMPAD8, + VirtualKey.NumberPad9 => Keyboard.RZKEY.RZKEY_NUMPAD9, + VirtualKey.Snapshot => Keyboard.RZKEY.RZKEY_PRINTSCREEN, + VirtualKey.Scroll => Keyboard.RZKEY.RZKEY_SCROLL, + VirtualKey.Pause => Keyboard.RZKEY.RZKEY_PAUSE, + VirtualKey.Home => Keyboard.RZKEY.RZKEY_HOME, + VirtualKey.PageUp => Keyboard.RZKEY.RZKEY_PAGEUP, + VirtualKey.End => Keyboard.RZKEY.RZKEY_END, + VirtualKey.PageDown => Keyboard.RZKEY.RZKEY_PAGEDOWN, + _ => Keyboard.RZKEY.RZKEY_INVALID + }; + + int[] _dataInputColors; + int[] _dataInputs; + int[] _dataPoint; + int[] _dataAudio; + int[] _dataPanel; + + public override bool IsAvailable => Configure.Instance.BW; + + public override bool Init() + { + try + { + var data = new APPINFOTYPE + { + Title = "Qwilight", + Description = "Qwilight", + + Author_Name = "Taehui", + Author_Contact = "https://taehui.ddns.net", + + SupportedDevice = 1, + Category = 2 + }; + var isOK = ChromaAnimationAPI.InitSDK(ref data) == RazerErrors.RZRESULT_SUCCESS; + if (isOK) + { + _dataInputColors = new int[ChromaAnimationAPI.GetMaxRow(ChromaAnimationAPI.Device2D.Keyboard) * ChromaAnimationAPI.GetMaxColumn(ChromaAnimationAPI.Device2D.Keyboard)]; + _dataInputs = new int[ChromaAnimationAPI.GetMaxRow(ChromaAnimationAPI.Device2D.Keyboard) * ChromaAnimationAPI.GetMaxColumn(ChromaAnimationAPI.Device2D.Keyboard)]; + _dataPoint = new int[ChromaAnimationAPI.GetMaxRow(ChromaAnimationAPI.Device2D.Mouse) * ChromaAnimationAPI.GetMaxColumn(ChromaAnimationAPI.Device2D.Mouse)]; + _dataAudio = new int[ChromaAnimationAPI.GetMaxLeds(ChromaAnimationAPI.Device1D.Headset)]; + _dataPanel = new int[ChromaAnimationAPI.GetMaxLeds(ChromaAnimationAPI.Device1D.Mousepad)]; + } + return isOK; + } + catch + { + return false; + } + } + + public override void SetInputColor(VirtualKey rawInput, uint value) + { + var input = GetInput(rawInput); + if (input != Keyboard.RZKEY.RZKEY_INVALID) + { + _dataInputColors[ChromaAnimationAPI.GetMaxColumn(ChromaAnimationAPI.Device2D.Keyboard) * (((int)input & 65280) >> 8) + ((int)input & 255)] = (int)value; + _dataInputs[ChromaAnimationAPI.GetMaxColumn(ChromaAnimationAPI.Device2D.Keyboard) * (((int)input & 65280) >> 8) + ((int)input & 255)] = (int)value; + } + } + + public override void SetStatusColors(double status, uint value0, uint value1, uint value2, uint value3) + { + if (!double.IsNaN(status)) + { + var value = _dataPanel.Length * status; + var valueInt = (int)value; + for (var i = valueInt - 1; i >= 0; --i) + { + _dataPanel[i] = (int)Utility.GetColor(value0, value1, value2, value3); + } + var remainder = value - valueInt; + if (remainder > 0.0) + { + _dataPanel[valueInt] = (int)Utility.GetColor((uint)(value0 * remainder), (uint)(value1 * remainder), (uint)(value2 * remainder), (uint)(value3 * remainder)); + } + } + } + + public override void SetEtcColor(uint value) + { + Array.Fill(_dataAudio, (int)value); + Array.Fill(_dataPoint, (int)value); + } + + public override void OnBeforeHandle() + { + Array.Clear(_dataInputColors, 0, _dataInputColors.Length); + Array.Clear(_dataInputs, 0, _dataInputs.Length); + Array.Clear(_dataAudio, 0, _dataAudio.Length); + Array.Clear(_dataPoint, 0, _dataPoint.Length); + Array.Clear(_dataPanel, 0, _dataPanel.Length); + } + + public override void OnHandled() + { + ChromaAnimationAPI.SetCustomColorFlag2D((int)ChromaAnimationAPI.Device2D.Keyboard, _dataInputColors); + ChromaAnimationAPI.SetEffectKeyboardCustom2D((int)ChromaAnimationAPI.Device2D.Keyboard, _dataInputColors, _dataInputs); + ChromaAnimationAPI.SetEffectCustom1D((int)ChromaAnimationAPI.Device1D.Headset, _dataAudio); + ChromaAnimationAPI.SetEffectCustom2D((int)ChromaAnimationAPI.Device2D.Mouse, _dataPoint); + ChromaAnimationAPI.SetEffectCustom1D((int)ChromaAnimationAPI.Device1D.Mousepad, _dataPanel); + } + + public override Color GetMeterColor() => Colors.Green; + + public override void Dispose() + { + lock (IlluminationSystem.Instance.HandlingCSX) + { + if (IsHandling) + { + IsHandling = false; + try + { + ChromaAnimationAPI.StopAll(); + ChromaAnimationAPI.CloseAll(); + ChromaAnimationAPI.Uninit(); + } + catch (DllNotFoundException) + { + } + } + } + } + + public override void Toggle() + { + Configure.Instance.BW = !Configure.Instance.BW; + base.Toggle(); + } + } +} diff --git a/Qwilight/Qwilight/System/IlluminationSystem/BaseIlluminationSystem.cs b/Qwilight/Qwilight/System/IlluminationSystem/BaseIlluminationSystem.cs new file mode 100644 index 0000000..9309343 --- /dev/null +++ b/Qwilight/Qwilight/System/IlluminationSystem/BaseIlluminationSystem.cs @@ -0,0 +1,40 @@ +using Windows.System; +using Windows.UI; + +namespace Qwilight +{ + public abstract class BaseIlluminationSystem : IDisposable + { + public abstract bool IsAvailable { get; } + + public abstract bool Init(); + + public bool IsHandling { get; set; } + + public abstract void SetInputColor(VirtualKey input, uint value); + + public abstract void SetStatusColors(double status, uint value0, uint value1, uint value2, uint value3); + + public abstract void SetEtcColor(uint value); + + public abstract void OnBeforeHandle(); + + public abstract void OnHandled(); + + public abstract Color GetMeterColor(); + + public abstract void Dispose(); + + public virtual void Toggle() + { + if (IsAvailable) + { + IlluminationSystem.Instance.HandleIfAvailable(); + } + else + { + Dispose(); + } + } + } +} diff --git a/Qwilight/Qwilight/System/IlluminationSystem/IlluminationSystem.cs b/Qwilight/Qwilight/System/IlluminationSystem/IlluminationSystem.cs new file mode 100644 index 0000000..a8c97e7 --- /dev/null +++ b/Qwilight/Qwilight/System/IlluminationSystem/IlluminationSystem.cs @@ -0,0 +1,613 @@ +using Qwilight.Compute; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.IO; +using Windows.System; +using Windows.UI; + +namespace Qwilight +{ + public sealed class IlluminationSystem : IDisposable + { + public static readonly IlluminationSystem Instance = new(); + + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(IlluminationSystem)); + + readonly BaseIlluminationSystem[] _targetSystems = new BaseIlluminationSystem[] + { + BWSystem.Instance, AuraSystem.Instance, K70System.Instance, LSSystem.Instance + }; + + readonly object _availableCSX = new(); + + void Init() + { + foreach (var targetSystem in _targetSystems) + { + if (!targetSystem.IsHandling && targetSystem.IsAvailable) + { + targetSystem.IsHandling = targetSystem.Init(); + } + } + } + + void OnBeforeHandle() + { + foreach (var targetSystem in _targetSystems) + { + if (targetSystem.IsHandling) + { + targetSystem.OnBeforeHandle(); + } + } + } + + void SetInputColor(VirtualKey rawInput, uint value) + { + foreach (var targetSystem in _targetSystems) + { + if (targetSystem.IsHandling) + { + targetSystem.SetInputColor(rawInput, value); + } + } + } + + void SetStatusColors(double status, uint value0, uint value1, uint value2, uint value3) + { + foreach (var targetSystem in _targetSystems) + { + if (targetSystem.IsHandling) + { + targetSystem.SetStatusColors(status, value0, value1, value2, value3); + } + } + } + + void SetEtcColor(double failedValue, double meterValue) + { + foreach (var targetSystem in _targetSystems) + { + if (targetSystem.IsHandling) + { + if (failedValue > 0.0) + { + targetSystem.SetEtcColor(GetFailedColor(failedValue)); + } + else if (meterValue > 0.0) + { + targetSystem.SetEtcColor(GetValueColor(targetSystem.GetMeterColor(), meterValue)); + } + } + } + } + + void OnHandled() + { + foreach (var targetSystem in _targetSystems) + { + if (targetSystem.IsHandling) + { + targetSystem.OnHandled(); + } + } + } + + public object HandlingCSX { get; } = new(); + + public bool[] HasInputValues { get; } = new bool[53]; + + public double[] InputValues { get; } = new double[53]; + + public bool IsMeter { get; set; } + + public bool IsFailed { get; set; } + + bool IsAvailable => _targetSystems.Any(targetSystem => targetSystem.IsAvailable); + + public void HandleIfAvailable() + { + lock (_availableCSX) + { + if (IsAvailable) + { + Monitor.Pulse(_availableCSX); + } + } + } + + public void HandleSystem() + { + var voteViewModel = ViewModels.Instance.VoteValue; + var wwwLevelViewModel = ViewModels.Instance.WwwLevelValue; + var assistViewModel = ViewModels.Instance.AssistValue; + var mainViewModel = ViewModels.Instance.MainValue; + var inputViewModel = ViewModels.Instance.InputValue; + var toNotifyViewModel = ViewModels.Instance.NotifyValue; + var inputStandardViewModel = ViewModels.Instance.InputStandardValue; + var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; + var valueConfigureViewModel = ViewModels.Instance.ConfigureValue; + var defaultStatusInputs = new[] { + VirtualKey.Number1, + VirtualKey.Number2, + VirtualKey.Number3, + VirtualKey.Number4, + VirtualKey.Number5, + VirtualKey.Number6, + VirtualKey.Number7, + VirtualKey.Number8, + VirtualKey.Number9, + VirtualKey.Number0, + }; + var defaultStatusInputsLength = defaultStatusInputs.Length; + var defaultStatusInputsUnit = 1.0 / defaultStatusInputsLength; + var mainHitPointsInputs = new[] { + VirtualKey.Number1, + VirtualKey.Number2, + VirtualKey.Number3, + VirtualKey.Number4, + VirtualKey.Number5, + }; + var mainHitPointsInputsLength = mainHitPointsInputs.Length; + var mainHitPointsInputsUnit = 1.0 / mainHitPointsInputsLength; + var mainStatusInputs = new[] { + VirtualKey.Number6, + VirtualKey.Number7, + VirtualKey.Number8, + VirtualKey.Number9, + VirtualKey.Number0, + }; + var mainStatusInputsLength = mainStatusInputs.Length; + var mainStatusInputsUnit = 1.0 / mainStatusInputsLength; + var audioVisualizerInputs = new VirtualKey[10][] { + new[] + { + VirtualKey.Z, + VirtualKey.A, + VirtualKey.Q, + }, + new[] + { + VirtualKey.X, + VirtualKey.S, + VirtualKey.W, + }, + new[] + { + VirtualKey.C, + VirtualKey.D, + VirtualKey.E, + }, + new[] + { + VirtualKey.V, + VirtualKey.F, + VirtualKey.R, + }, + new[] + { + VirtualKey.B, + VirtualKey.G, + VirtualKey.T, + }, + new[] + { + VirtualKey.N, + VirtualKey.H, + VirtualKey.Y, + }, + new[] + { + VirtualKey.M, + VirtualKey.J, + VirtualKey.U, + }, + new[] + { + (VirtualKey)188, + VirtualKey.K, + VirtualKey.I, + }, + new[] + { + (VirtualKey)190, + VirtualKey.L, + VirtualKey.O, + }, + new[] + { + (VirtualKey)191, + (VirtualKey)186, + VirtualKey.P, + } + }; + var audioVisualizerInputsLength = audioVisualizerInputs.Length; + + var audioMainVisualizerValues = new double[audioVisualizerInputsLength]; + var audioMainVisualizerFrames = new double[audioVisualizerInputsLength]; + var lastAudioVisualizerMainValues = new double[audioVisualizerInputsLength]; + var audioInputVisualizerValues = new double[audioVisualizerInputsLength]; + var audioInputVisualizerFrames = new double[audioVisualizerInputsLength]; + var lastAudioVisualizerInputValues = new double[audioVisualizerInputsLength]; + var audioVisualizerColors = new Color[audioVisualizerInputs.Length, 3, 2]; + + var meterValue = 0.0; + var failedValue = 0.0; + + var handlingColor = GetHandlingColor(1.0); + var inputStandardColor = GetInputStandardColor(1.0); + var defaultColor = GetDefaultColor(1.0); + var inputColor = GetInputColor(0.0); + + var loopingCounter = 0.0; + var loopingHandler = Stopwatch.StartNew(); + while (true) + { + try + { + lock (HandlingCSX) + { + Init(); + OnBeforeHandle(); + + SetInputColor(VirtualKey.F6, defaultColor); + SetInputColor(VirtualKey.F7, voteViewModel.IsOpened ? handlingColor : defaultColor); + SetInputColor(VirtualKey.F8, siteContainerViewModel.IsOpened ? handlingColor : defaultColor); + SetInputColor(VirtualKey.F10, wwwLevelViewModel.IsOpened ? handlingColor : defaultColor); + SetInputColor(VirtualKey.F11, toNotifyViewModel.IsOpened ? handlingColor : defaultColor); + if (!QwilightComponent.IsValve) + { + SetInputColor(VirtualKey.F12, defaultColor); + } + + var isInputStandardWindowOpened = inputStandardViewModel.IsOpened; + var isDefaultInputWindowOpened = inputViewModel.IsOpened && inputViewModel.ControllerModeValue == InputViewModel.ControllerMode.DefaultInput; + + var defaultComputer = mainViewModel.Computer; + switch (mainViewModel.ModeValue) + { + case MainViewModel.Mode.NoteFile: + PaintInputAudioVisualizer(); + + PaintEtc(); + + var autoComputer = mainViewModel.AutoComputer; + if (autoComputer != null) + { + PaintInputStatus(autoComputer); + PaintStatusStatus(autoComputer); + } + + SetInputColor(VirtualKey.Escape, defaultColor); + SetInputColor(VirtualKey.Enter, defaultColor); + SetInputColor(VirtualKey.Delete, defaultColor); + SetInputColor(VirtualKey.Left, defaultColor); + SetInputColor(VirtualKey.Right, defaultColor); + SetInputColor(VirtualKey.Up, defaultColor); + SetInputColor(VirtualKey.Down, defaultColor); + SetInputColor(VirtualKey.Space, defaultColor); + + SetInputColor(VirtualKey.F1, assistViewModel.IsOpened ? handlingColor : defaultColor); + SetInputColor(VirtualKey.F5, mainViewModel.IsDefaultEntryLoading ? handlingColor : defaultColor); + break; + case MainViewModel.Mode.Computing: + PaintEtc(); + + var handlingHitPointsColor = defaultComputer.ModeComponentValue.HandlingHitPointsColor; + var hitPoints = defaultComputer.HitPoints.Value; + for (var i = mainHitPointsInputsLength - 1; i >= 0; --i) + { + var value = Math.Clamp((hitPoints - ((double)i / mainHitPointsInputsLength)) / mainHitPointsInputsUnit, 0, 1); + SetInputColor(mainHitPointsInputs[i], GetValueColor(handlingHitPointsColor, value)); + } + + SetStatusColors(hitPoints, handlingHitPointsColor.R, handlingHitPointsColor.G, handlingHitPointsColor.B, handlingHitPointsColor.A); + + var status = defaultComputer.Status; + for (var i = mainStatusInputsLength - 1; i >= 0; --i) + { + var value = Math.Clamp((status - (double)i / mainStatusInputsLength) / mainStatusInputsUnit, 0, 1); + SetInputColor(mainStatusInputs[i], GetStatusColor(value * meterValue)); + } + + SetInputColor(VirtualKey.Escape, defaultComputer.IsPausingWindowOpened ? handlingColor : defaultColor); + SetInputColor(VirtualKey.Enter, defaultComputer.IsPassable || defaultComputer.IsPausingWindowOpened ? defaultColor : handlingColor); + + if (defaultComputer.IsPausingWindowOpened) + { + SetInputColor(VirtualKey.Up, defaultColor); + SetInputColor(VirtualKey.Down, defaultColor); + SetInputColor(VirtualKey.Space, defaultColor); + } + + if (!isInputStandardWindowOpened) + { + for (var i = Configure.Instance.DefaultInputBundlesV6.StandardInputs.Length - 1; i >= 0; --i) + { + switch (i) + { + case InputStandardViewModel.ModifyAutoMode: + if (defaultComputer.CanModifyAutoMode) + { + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[i].Data, defaultComputer.IsAutoMode ? inputStandardColor : handlingColor); + } + break; + case InputStandardViewModel.Media: + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[i].Data, Configure.Instance.LoadedMedia && Configure.Instance.Media ? inputStandardColor : handlingColor); + break; + case InputStandardViewModel.PostItem0: + case InputStandardViewModel.PostItem1: + if (defaultComputer.PostableItems[0] != null || defaultComputer.PostableItems[1] != null) + { + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[i].Data, inputStandardColor); + } + break; + default: + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[i].Data, inputStandardColor); + break; + } + } + } + + if (!isDefaultInputWindowOpened) + { + var inputs = Configure.Instance.DefaultInputBundlesV6.Inputs[(int)defaultComputer.InputMode]; + if (inputs != null) + { + for (var i = inputs.Length - 1; i > 0; --i) + { + foreach (var defaultInput in inputs[i]) + { + SetInputColor(defaultInput.Data, failedValue > 0.0 ? GetFailedColor(failedValue) : GetInputColor(InputValues[i])); + } + } + } + } + + for (var i = InputValues.Length - 1; i > 0; --i) + { + if (!HasInputValues[i]) + { + InputValues[i] = Math.Max(0.0, InputValues[i] - (60 / 1000.0)); + } + } + break; + case MainViewModel.Mode.Quit: + PaintInputAudioVisualizer(); + PaintEtc(); + + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.Media].Data, Configure.Instance.Media ? inputStandardColor : handlingColor); + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.Undo].Data, inputStandardColor); + + SetInputColor(VirtualKey.Escape, defaultColor); + SetInputColor(VirtualKey.Enter, defaultColor); + if (0 < defaultComputer.LevyingComputingPosition) + { + SetInputColor(VirtualKey.Left, defaultColor); + } + if (defaultComputer.LevyingComputingPosition < defaultComputer.HighestComputingPosition) + { + SetInputColor(VirtualKey.Right, defaultColor); + } + break; + } + + if (isInputStandardWindowOpened) + { + for (var i = Configure.Instance.DefaultInputBundlesV6.StandardInputs.Length - 1; i >= 0; --i) + { + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[i].Data, inputStandardColor); + } + } + else + { + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.LowerMultiplier].Data, inputStandardColor); + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.HigherMultiplier].Data, inputStandardColor); + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.LowerAudioMultiplier].Data, inputStandardColor); + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.HigherAudioMultiplier].Data, inputStandardColor); + SetInputColor(Configure.Instance.DefaultInputBundlesV6.StandardInputs[InputStandardViewModel.Media].Data, Configure.Instance.Media ? inputStandardColor : handlingColor); + } + + if (isDefaultInputWindowOpened) + { + var inputControllerInputs = Configure.Instance.DefaultInputBundlesV6.Inputs[(int)inputViewModel.InputMode]; + if (inputControllerInputs != null) + { + foreach (var inputControllerInput in inputControllerInputs) + { + if (inputControllerInput != null) + { + foreach (var defaultInput in inputControllerInput) + { + SetInputColor(defaultInput.Data, inputColor); + } + } + } + } + } + + var modeComponentValue = mainViewModel.ModeComponentValue; + if (valueConfigureViewModel.IsOpened && valueConfigureViewModel.TabPosition == 0 && valueConfigureViewModel.TabPositionComputing == 0 && (mainViewModel.CanModifyModeComponent || modeComponentValue.CanModifyMultiplier || modeComponentValue.CanModifyAudioMultiplier)) + { + SetInputColor(VirtualKey.F1, defaultColor); + SetInputColor(VirtualKey.F2, defaultColor); + SetInputColor(VirtualKey.F3, defaultColor); + SetInputColor(VirtualKey.F4, defaultColor); + SetInputColor(VirtualKey.F5, defaultColor); + SetInputColor(VirtualKey.F6, defaultColor); + SetInputColor(VirtualKey.F7, defaultColor); + SetInputColor(VirtualKey.F8, defaultColor); + } + + if (IsMeter) + { + meterValue = 1.0; + IsMeter = false; + } + else + { + meterValue = Math.Max(0.0, meterValue - 60 / 1000.0); + } + + if (IsFailed) + { + failedValue = 1.0; + IsFailed = false; + } + else + { + failedValue = Math.Max(0.0, failedValue - 60 / QwilightComponent.StandardWaitMillis); + } + + OnHandled(); + } + + loopingCounter += 1000.0 / 60; + var toWait = loopingCounter - loopingHandler.GetMillis(); + if (toWait > 0.0) + { + Thread.Sleep(TimeSpan.FromMilliseconds(toWait)); + } + + lock (_availableCSX) + { + if (!IsAvailable) + { + Monitor.Wait(_availableCSX); + } + } + + void PaintEtc() + { + SetEtcColor(failedValue, meterValue); + } + + void PaintStatusStatus(DefaultCompute defaultComputer) + { + var statusColor = defaultComputer.IsHandling ? defaultComputer.IsPausing ? BaseUI.Instance.StatusPausedColor : BaseUI.Instance.StatusHandlingColor : BaseUI.Instance.StatusLoadingNoteFileColor; + var handlingMeterValue = defaultComputer.IsHandling && !defaultComputer.IsPausing ? meterValue : 1.0; + SetStatusColors(defaultComputer.Status, (uint)(statusColor.R * handlingMeterValue), (uint)(statusColor.G * handlingMeterValue), (uint)(statusColor.B * handlingMeterValue), (uint)(statusColor.A * handlingMeterValue)); + } + + void PaintInputStatus(DefaultCompute defaultComputer) + { + var statusColor = defaultComputer.IsHandling ? defaultComputer.IsPausing ? BaseUI.Instance.StatusPausedColor : BaseUI.Instance.StatusHandlingColor : BaseUI.Instance.StatusLoadingNoteFileColor; + var handlingMeterValue = defaultComputer.IsHandling && !defaultComputer.IsPausing ? meterValue : 1.0; + for (var i = defaultStatusInputsLength - 1; i >= 0; --i) + { + SetInputColor(defaultStatusInputs[i], GetValueColor(statusColor, handlingMeterValue * Math.Clamp((defaultComputer.Status - (double)i / defaultStatusInputsLength) / defaultStatusInputsUnit, 0, 1))); + } + } + + void PaintInputAudioVisualizer() + { + for (var i = audioVisualizerInputsLength - 1; i >= 0; --i) + { + var audioMainVisualizerValue = 0.0; + var audioInputVisualizerValue = 0.0; + for (var j = ((i + 1) * Configure.Instance.AudioVisualizerCount / audioVisualizerInputsLength) - 1; j >= i * Configure.Instance.AudioVisualizerCount / audioVisualizerInputsLength; --j) + { + audioMainVisualizerValue = Math.Max(audioMainVisualizerValue, AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.MainAudio, j)); + audioInputVisualizerValue = Math.Max(audioInputVisualizerValue, AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.InputAudio, j)); + } + audioMainVisualizerValues[i] = audioMainVisualizerValue; + audioInputVisualizerValues[i] = audioInputVisualizerValue; + + var distance = lastAudioVisualizerMainValues[i] - audioMainVisualizerValues[i]; + audioMainVisualizerFrames[i] = Math.Clamp(audioMainVisualizerFrames[i] + (distance == 0.0 ? 0.0 : distance > 0 ? -1 / 3.0 : 1 / 3.0), 0.0, 3.0); + distance = lastAudioVisualizerInputValues[i] - audioInputVisualizerValues[i]; + audioInputVisualizerFrames[i] = Math.Clamp(audioInputVisualizerFrames[i] + (distance == 0.0 ? 0.0 : distance > 0 ? -1 / 3.0 : 1 / 3.0), 0.0, 3.0); + } + + Array.Copy(audioMainVisualizerValues, lastAudioVisualizerMainValues, audioVisualizerInputsLength); + Array.Copy(audioInputVisualizerValues, lastAudioVisualizerInputValues, audioVisualizerInputsLength); + + Array.Clear(audioVisualizerColors, 0, audioVisualizerColors.Length); + var audioVisualizerMainColor = Configure.Instance.AudioVisualizerMainColor; + var audioVisualizerInputColor = Configure.Instance.AudioVisualizerInputColor; + for (var i = audioVisualizerInputsLength - 1; i >= 0; --i) + { + var value = audioMainVisualizerFrames[i]; + var valueInt = (int)value; + var remainder = value - valueInt; + if (remainder > 0.0) + { + audioVisualizerColors[i, valueInt, 0] = new() + { + R = (byte)(audioVisualizerMainColor.R * remainder), + G = (byte)(audioVisualizerMainColor.R * remainder), + B = (byte)(audioVisualizerMainColor.R * remainder), + }; + } + for (var j = valueInt - 1; j >= 0; --j) + { + audioVisualizerColors[i, j, 0] = audioVisualizerMainColor; + } + + value = audioInputVisualizerFrames[i]; + valueInt = (int)value; + remainder = value - valueInt; + if (remainder > 0.0) + { + audioVisualizerColors[i, valueInt, 1] = new() + { + R = (byte)(audioVisualizerInputColor.R * remainder), + G = (byte)(audioVisualizerInputColor.R * remainder), + B = (byte)(audioVisualizerInputColor.R * remainder), + }; + } + for (var j = valueInt - 1; j >= 0; --j) + { + audioVisualizerColors[i, j, 1] = audioVisualizerInputColor; + } + + for (var j = audioVisualizerColors.GetLength(0) - 1; j >= 0; --j) + { + for (var m = audioVisualizerColors.GetLength(1) - 1; m >= 0; --m) + { + SetInputColor(audioVisualizerInputs[j][m], GetValueColor(new() + { + A = (byte)((audioVisualizerColors[j, m, 0].A + audioVisualizerColors[j, m, 1].A) / 2), + R = (byte)((audioVisualizerColors[j, m, 0].R + audioVisualizerColors[j, m, 1].R) / 2), + G = (byte)((audioVisualizerColors[j, m, 0].G + audioVisualizerColors[j, m, 1].G) / 2), + B = (byte)((audioVisualizerColors[j, m, 0].B + audioVisualizerColors[j, m, 1].B) / 2) + }, 1.0)); + } + } + } + } + } + catch (ThreadInterruptedException) + { + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + } + } + + uint GetDefaultColor(double status) => Utility.GetColor((uint)(0 * status), (uint)(127 * status), (uint)(255 * status), 255); + + uint GetHandlingColor(double status) => Utility.GetColor((uint)(255 * status), (uint)(127 * status), (uint)(0 * status), 255); + + uint GetInputColor(double status) => Utility.GetColor((uint)(0 * status), (uint)(255 * (1.0 - status)), (uint)(255 * status), 255); + + uint GetInputStandardColor(double status) => Utility.GetColor((uint)(255 * status), (uint)(255 * status), (uint)(0 * status), 255); + + uint GetFailedColor(double status) => Utility.GetColor((uint)(255 * status), (uint)(0 * status), (uint)(0 * status), 255); + + uint GetStatusColor(double status) => Utility.GetColor((uint)(0 * status), (uint)(255 * status), (uint)(255 * status), 255); + + uint GetValueColor(Color value, double status) => Utility.GetColor((uint)(value.R * status), (uint)(value.G * status), (uint)(value.B * status), 255); + + public void Dispose() + { + foreach (var targetSystem in _targetSystems) + { + targetSystem.Dispose(); + } + } + } +} diff --git a/Qwilight/Qwilight/System/IlluminationSystem/K70System.cs b/Qwilight/Qwilight/System/IlluminationSystem/K70System.cs new file mode 100644 index 0000000..9a9ff67 --- /dev/null +++ b/Qwilight/Qwilight/System/IlluminationSystem/K70System.cs @@ -0,0 +1,208 @@ +using CUESDK; +using Microsoft.UI; +using System.Buffers; +using Windows.System; +using Windows.UI; + +namespace Qwilight +{ + public sealed class K70System : BaseIlluminationSystem + { + public static readonly K70System Instance = new(); + + static CorsairLedId GetInput(VirtualKey input) => input switch + { + VirtualKey.Escape => CorsairLedId.KeyboardEscape, + VirtualKey.F1 => CorsairLedId.KeyboardF1, + VirtualKey.F2 => CorsairLedId.KeyboardF2, + VirtualKey.F3 => CorsairLedId.KeyboardF3, + VirtualKey.F4 => CorsairLedId.KeyboardF4, + VirtualKey.F5 => CorsairLedId.KeyboardF5, + VirtualKey.F6 => CorsairLedId.KeyboardF6, + VirtualKey.F7 => CorsairLedId.KeyboardF7, + VirtualKey.F8 => CorsairLedId.KeyboardF8, + VirtualKey.F9 => CorsairLedId.KeyboardF9, + VirtualKey.F10 => CorsairLedId.KeyboardF10, + VirtualKey.F11 => CorsairLedId.KeyboardF11, + VirtualKey.F12 => CorsairLedId.KeyboardF12, + VirtualKey.Insert => CorsairLedId.KeyboardInsert, + VirtualKey.Delete => CorsairLedId.KeyboardDelete, + (VirtualKey)192 => CorsairLedId.KeyboardGraveAccentAndTilde, + VirtualKey.Number1 => CorsairLedId.Keyboard1, + VirtualKey.Number2 => CorsairLedId.Keyboard2, + VirtualKey.Number3 => CorsairLedId.Keyboard3, + VirtualKey.Number4 => CorsairLedId.Keyboard4, + VirtualKey.Number5 => CorsairLedId.Keyboard5, + VirtualKey.Number6 => CorsairLedId.Keyboard6, + VirtualKey.Number7 => CorsairLedId.Keyboard7, + VirtualKey.Number8 => CorsairLedId.Keyboard8, + VirtualKey.Number9 => CorsairLedId.Keyboard9, + VirtualKey.Number0 => CorsairLedId.Keyboard0, + (VirtualKey)189 => CorsairLedId.KeyboardMinusAndUnderscore, + (VirtualKey)187 => CorsairLedId.KeyboardEqualsAndPlus, + VirtualKey.Back => CorsairLedId.KeyboardBackspace, + VirtualKey.Tab => CorsairLedId.KeyboardTab, + VirtualKey.Q => CorsairLedId.KeyboardQ, + VirtualKey.W => CorsairLedId.KeyboardW, + VirtualKey.E => CorsairLedId.KeyboardE, + VirtualKey.R => CorsairLedId.KeyboardR, + VirtualKey.T => CorsairLedId.KeyboardT, + VirtualKey.Y => CorsairLedId.KeyboardY, + VirtualKey.U => CorsairLedId.KeyboardU, + VirtualKey.I => CorsairLedId.KeyboardI, + VirtualKey.O => CorsairLedId.KeyboardO, + VirtualKey.P => CorsairLedId.KeyboardP, + (VirtualKey)219 => CorsairLedId.KeyboardBracketLeft, + (VirtualKey)221 => CorsairLedId.KeyboardBracketRight, + (VirtualKey)220 => CorsairLedId.KeyboardBackslash, + VirtualKey.CapitalLock => CorsairLedId.KeyboardCapsLock, + VirtualKey.A => CorsairLedId.KeyboardA, + VirtualKey.S => CorsairLedId.KeyboardS, + VirtualKey.D => CorsairLedId.KeyboardD, + VirtualKey.F => CorsairLedId.KeyboardF, + VirtualKey.G => CorsairLedId.KeyboardG, + VirtualKey.H => CorsairLedId.KeyboardH, + VirtualKey.J => CorsairLedId.KeyboardJ, + VirtualKey.K => CorsairLedId.KeyboardK, + VirtualKey.L => CorsairLedId.KeyboardL, + (VirtualKey)186 => CorsairLedId.KeyboardSemicolonAndColon, + (VirtualKey)222 => CorsairLedId.KeyboardApostropheAndDoubleQuote, + VirtualKey.Enter => CorsairLedId.KeyboardEnter, + VirtualKey.LeftShift => CorsairLedId.KeyboardLeftShift, + VirtualKey.Z => CorsairLedId.KeyboardZ, + VirtualKey.X => CorsairLedId.KeyboardX, + VirtualKey.C => CorsairLedId.KeyboardC, + VirtualKey.V => CorsairLedId.KeyboardV, + VirtualKey.B => CorsairLedId.KeyboardB, + VirtualKey.N => CorsairLedId.KeyboardN, + VirtualKey.M => CorsairLedId.KeyboardM, + (VirtualKey)188 => CorsairLedId.KeyboardCommaAndLessThan, + (VirtualKey)190 => CorsairLedId.KeyboardPeriodAndBiggerThan, + (VirtualKey)191 => CorsairLedId.KeyboardSlashAndQuestionMark, + VirtualKey.RightShift => CorsairLedId.KeyboardRightShift, + VirtualKey.LeftControl => CorsairLedId.KeyboardLeftCtrl, + VirtualKey.LeftWindows => CorsairLedId.KeyboardLeftGui, + VirtualKey.LeftMenu => CorsairLedId.KeyboardLeftAlt, + VirtualKey.Space => CorsairLedId.KeyboardSpace, + VirtualKey.RightMenu => CorsairLedId.KeyboardRightAlt, + VirtualKey.RightControl => CorsairLedId.KeyboardRightCtrl, + VirtualKey.Left => CorsairLedId.KeyboardLeftArrow, + VirtualKey.Up => CorsairLedId.KeyboardUpArrow, + VirtualKey.Down => CorsairLedId.KeyboardDownArrow, + VirtualKey.Right => CorsairLedId.KeyboardRightArrow, + VirtualKey.NumberKeyLock => CorsairLedId.KeyboardNumLock, + VirtualKey.NumberPad0 => CorsairLedId.KeyboardKeypad0, + VirtualKey.NumberPad1 => CorsairLedId.KeyboardKeypad1, + VirtualKey.NumberPad2 => CorsairLedId.KeyboardKeypad2, + VirtualKey.NumberPad3 => CorsairLedId.KeyboardKeypad3, + VirtualKey.NumberPad4 => CorsairLedId.KeyboardKeypad4, + VirtualKey.NumberPad5 => CorsairLedId.KeyboardKeypad5, + VirtualKey.NumberPad6 => CorsairLedId.KeyboardKeypad6, + VirtualKey.NumberPad7 => CorsairLedId.KeyboardKeypad7, + VirtualKey.NumberPad8 => CorsairLedId.KeyboardKeypad8, + VirtualKey.NumberPad9 => CorsairLedId.KeyboardKeypad9, + VirtualKey.Snapshot => CorsairLedId.KeyboardPrintScreen, + VirtualKey.Scroll => CorsairLedId.KeyboardScrollLock, + VirtualKey.Pause => CorsairLedId.KeyboardPauseBreak, + VirtualKey.Home => CorsairLedId.KeyboardHome, + VirtualKey.PageUp => CorsairLedId.KeyboardPageUp, + VirtualKey.End => CorsairLedId.KeyboardEnd, + VirtualKey.PageDown => CorsairLedId.KeyboardPageDown, + _ => default, + }; + + readonly CorsairLedId[] _inputs; + readonly Dictionary _illuminatedIDs = new(); + readonly CorsairLedColor[] _illuminatedColors; + int _illuminatedCount; + + K70System() + { + _inputs = (Enum.GetValues(typeof(CorsairLedId)) as CorsairLedId[]).Where(input => (CorsairLedId.KeyboardEscape <= input && input <= CorsairLedId.KeyboardFn) || input == CorsairLedId.KeyboardLogo || (CorsairLedId.KeyboardLightPipeZone1 <= input && input <= CorsairLedId.KeyboardLightPipeZone19) || (CorsairLedId.KeyboardLightPipeZone20 <= input && input <= CorsairLedId.KeyboardProfile)).ToArray(); + _illuminatedColors = new CorsairLedColor[_inputs.Length]; + } + + public override bool IsAvailable => Configure.Instance.K70; + + public override bool Init() + { + CorsairLightingSDK.PerformProtocolHandshake(); + return CorsairLightingSDK.GetLastError() == CorsairError.Success && CorsairLightingSDK.RequestControl(CorsairAccessMode.ExclusiveLightingControl); + } + + public override void SetInputColor(VirtualKey rawInput, uint value) + { + var input = GetInput(rawInput); + if (input != CorsairLedId.Invalid) + { + _illuminatedIDs[input] = value; + } + } + + public override void SetStatusColors(double status, uint value0, uint value1, uint value2, uint value3) + { + } + + public override void SetEtcColor(uint value) + { + _illuminatedIDs[CorsairLedId.KeyboardLogo] = value; + for (var i = CorsairLedId.KeyboardLightPipeZone19; i >= CorsairLedId.KeyboardLightPipeZone1; --i) + { + _illuminatedIDs[i] = value; + } + for (var i = CorsairLedId.KeyboardProfile; i >= CorsairLedId.KeyboardLightPipeZone20; --i) + { + _illuminatedIDs[i] = value; + } + } + + public override void OnBeforeHandle() + { + _illuminatedIDs.Clear(); + _illuminatedCount = CorsairLightingSDK.GetDeviceCount(); + } + + public override void OnHandled() + { + for (var i = _inputs.Length - 1; i >= 0; --i) + { + var input = _inputs[i]; + _illuminatedColors[i] = _illuminatedIDs.TryGetValue(input, out var value) ? new() + { + LedId = input, + R = (int)(value & 255), + G = (int)((value >> 8) & 255), + B = (int)(value >> 16) + } : new() + { + LedId = input + }; + } + for (var i = _illuminatedCount - 1; i >= 0; --i) + { + CorsairLightingSDK.SetLedsColorsBufferByDeviceIndex(i, _illuminatedColors); + } + CorsairLightingSDK.SetLedsColorsFlushBuffer(); + } + + public override Color GetMeterColor() => Colors.Yellow; + + public override void Dispose() + { + lock (IlluminationSystem.Instance.HandlingCSX) + { + if (IsHandling) + { + IsHandling = false; + CorsairLightingSDK.ReleaseControl(CorsairAccessMode.ExclusiveLightingControl); + } + } + } + + public override void Toggle() + { + Configure.Instance.K70 = !Configure.Instance.K70; + base.Toggle(); + } + } +} diff --git a/Qwilight/Qwilight/System/IlluminationSystem/LSSystem.cs b/Qwilight/Qwilight/System/IlluminationSystem/LSSystem.cs new file mode 100644 index 0000000..5a05f7d --- /dev/null +++ b/Qwilight/Qwilight/System/IlluminationSystem/LSSystem.cs @@ -0,0 +1,197 @@ +using LedCSharp; +using Microsoft.UI; +using Windows.System; +using Windows.UI; + +namespace Qwilight +{ + public sealed class LSSystem : BaseIlluminationSystem + { + public static readonly LSSystem Instance = new(); + + static keyboardNames GetInput(VirtualKey input) => input switch + { + VirtualKey.Escape => keyboardNames.ESC, + VirtualKey.F1 => keyboardNames.F1, + VirtualKey.F2 => keyboardNames.F2, + VirtualKey.F3 => keyboardNames.F3, + VirtualKey.F4 => keyboardNames.F4, + VirtualKey.F5 => keyboardNames.F5, + VirtualKey.F6 => keyboardNames.F6, + VirtualKey.F7 => keyboardNames.F7, + VirtualKey.F8 => keyboardNames.F8, + VirtualKey.F9 => keyboardNames.F9, + VirtualKey.F10 => keyboardNames.F10, + VirtualKey.F11 => keyboardNames.F11, + VirtualKey.F12 => keyboardNames.F12, + VirtualKey.Insert => keyboardNames.INSERT, + VirtualKey.Delete => keyboardNames.KEYBOARD_DELETE, + (VirtualKey)192 => keyboardNames.TILDE, + VirtualKey.Number1 => keyboardNames.ONE, + VirtualKey.Number2 => keyboardNames.TWO, + VirtualKey.Number3 => keyboardNames.THREE, + VirtualKey.Number4 => keyboardNames.FOUR, + VirtualKey.Number5 => keyboardNames.FIVE, + VirtualKey.Number6 => keyboardNames.SIX, + VirtualKey.Number7 => keyboardNames.SEVEN, + VirtualKey.Number8 => keyboardNames.EIGHT, + VirtualKey.Number9 => keyboardNames.NINE, + VirtualKey.Number0 => keyboardNames.ZERO, + (VirtualKey)189 => keyboardNames.MINUS, + (VirtualKey)187 => keyboardNames.EQUALS, + VirtualKey.Back => keyboardNames.BACKSPACE, + VirtualKey.Tab => keyboardNames.TAB, + VirtualKey.Q => keyboardNames.Q, + VirtualKey.W => keyboardNames.W, + VirtualKey.E => keyboardNames.E, + VirtualKey.R => keyboardNames.R, + VirtualKey.T => keyboardNames.T, + VirtualKey.Y => keyboardNames.Y, + VirtualKey.U => keyboardNames.U, + VirtualKey.I => keyboardNames.I, + VirtualKey.O => keyboardNames.O, + VirtualKey.P => keyboardNames.P, + (VirtualKey)219 => keyboardNames.OPEN_BRACKET, + (VirtualKey)221 => keyboardNames.CLOSE_BRACKET, + (VirtualKey)220 => keyboardNames.BACKSLASH, + VirtualKey.CapitalLock => keyboardNames.CAPS_LOCK, + VirtualKey.A => keyboardNames.A, + VirtualKey.S => keyboardNames.S, + VirtualKey.D => keyboardNames.D, + VirtualKey.F => keyboardNames.F, + VirtualKey.G => keyboardNames.G, + VirtualKey.H => keyboardNames.H, + VirtualKey.J => keyboardNames.J, + VirtualKey.K => keyboardNames.K, + VirtualKey.L => keyboardNames.L, + (VirtualKey)186 => keyboardNames.SEMICOLON, + (VirtualKey)222 => keyboardNames.APOSTROPHE, + VirtualKey.Enter => keyboardNames.ENTER, + VirtualKey.LeftShift => keyboardNames.LEFT_SHIFT, + VirtualKey.Z => keyboardNames.Z, + VirtualKey.X => keyboardNames.X, + VirtualKey.C => keyboardNames.C, + VirtualKey.V => keyboardNames.V, + VirtualKey.B => keyboardNames.B, + VirtualKey.N => keyboardNames.N, + VirtualKey.M => keyboardNames.M, + (VirtualKey)188 => keyboardNames.COMMA, + (VirtualKey)190 => keyboardNames.PERIOD, + (VirtualKey)191 => keyboardNames.FORWARD_SLASH, + VirtualKey.RightShift => keyboardNames.RIGHT_SHIFT, + VirtualKey.LeftControl => keyboardNames.LEFT_CONTROL, + VirtualKey.LeftWindows => keyboardNames.LEFT_WINDOWS, + VirtualKey.LeftMenu => keyboardNames.LEFT_ALT, + VirtualKey.Space => keyboardNames.SPACE, + VirtualKey.RightMenu => keyboardNames.RIGHT_ALT, + VirtualKey.RightControl => keyboardNames.RIGHT_CONTROL, + VirtualKey.Left => keyboardNames.ARROW_LEFT, + VirtualKey.Up => keyboardNames.ARROW_UP, + VirtualKey.Down => keyboardNames.ARROW_DOWN, + VirtualKey.Right => keyboardNames.ARROW_RIGHT, + VirtualKey.NumberKeyLock => keyboardNames.NUM_LOCK, + VirtualKey.NumberPad0 => keyboardNames.NUM_ZERO, + VirtualKey.NumberPad1 => keyboardNames.NUM_ONE, + VirtualKey.NumberPad2 => keyboardNames.NUM_TWO, + VirtualKey.NumberPad3 => keyboardNames.NUM_THREE, + VirtualKey.NumberPad4 => keyboardNames.NUM_FOUR, + VirtualKey.NumberPad5 => keyboardNames.NUM_FIVE, + VirtualKey.NumberPad6 => keyboardNames.NUM_SIX, + VirtualKey.NumberPad7 => keyboardNames.NUM_SEVEN, + VirtualKey.NumberPad8 => keyboardNames.NUM_EIGHT, + VirtualKey.NumberPad9 => keyboardNames.NUM_NINE, + VirtualKey.Snapshot => keyboardNames.PRINT_SCREEN, + VirtualKey.Scroll => keyboardNames.SCROLL_LOCK, + VirtualKey.Pause => keyboardNames.PAUSE_BREAK, + VirtualKey.Home => keyboardNames.HOME, + VirtualKey.PageUp => keyboardNames.PAGE_UP, + VirtualKey.End => keyboardNames.END, + VirtualKey.PageDown => keyboardNames.PAGE_DOWN, + _ => 0 + }; + + readonly keyboardNames[] _inputs; + readonly Dictionary _illuminatedIDs = new(); + + LSSystem() + { + _inputs = (Enum.GetValues(typeof(keyboardNames)) as keyboardNames[]); + } + + + public override bool IsAvailable => Configure.Instance.LS; + + public override bool Init() + { + try + { + var isOK = LogitechGSDK.LogiLedInitWithName("Qwilight"); + if (isOK) + { + LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_ALL); + } + return isOK; + } + catch + { + return false; + } + } + + public override void SetInputColor(VirtualKey rawInput, uint value) + { + var input = GetInput(rawInput); + if (input != 0) + { + _illuminatedIDs[input] = value; + } + } + + public override void SetStatusColors(double status, uint value0, uint value1, uint value2, uint value3) + { + } + + public override void SetEtcColor(uint value) + { + LogitechGSDK.LogiLedSetLightingForTargetZone(DeviceType.Headset, 0, (int)(100 * (value & 255) / 255), (int)(100 * ((value >> 8) & 255) / 255), (int)(100 * ((value >> 16) & 255) / 255)); + LogitechGSDK.LogiLedSetLightingForTargetZone(DeviceType.Keyboard, 0, (int)(100 * (value & 255) / 255), (int)(100 * ((value >> 8) & 255) / 255), (int)(100 * ((value >> 16) & 255) / 255)); + LogitechGSDK.LogiLedSetLightingForTargetZone(DeviceType.Mouse, 0, (int)(100 * (value & 255) / 255), (int)(100 * ((value >> 8) & 255) / 255), (int)(100 * ((value >> 16) & 255) / 255)); + LogitechGSDK.LogiLedSetLightingForTargetZone(DeviceType.Mousemat, 0, (int)(100 * (value & 255) / 255), (int)(100 * ((value >> 8) & 255) / 255), (int)(100 * ((value >> 16) & 255) / 255)); + LogitechGSDK.LogiLedSetLightingForTargetZone(DeviceType.Speaker, 0, (int)(100 * (value & 255) / 255), (int)(100 * ((value >> 8) & 255) / 255), (int)(100 * ((value >> 16) & 255) / 255)); + } + + public override void OnBeforeHandle() + { + _illuminatedIDs.Clear(); + } + + public override void OnHandled() + { + foreach (var input in _inputs) + { + var value = _illuminatedIDs.GetValueOrDefault(input); + LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(input, (int)(100 * (value & 255) / 255), (int)(100 * ((value >> 8) & 255) / 255), (int)(100 * ((value >> 16) & 255) / 255)); + } + } + + public override Color GetMeterColor() => Colors.Cyan; + + public override void Dispose() + { + lock (IlluminationSystem.Instance.HandlingCSX) + { + if (IsHandling) + { + IsHandling = false; + LogitechGSDK.LogiLedShutdown(); + } + } + } + + public override void Toggle() + { + Configure.Instance.LS = !Configure.Instance.LS; + base.Toggle(); + } + } +} diff --git a/Qwilight/Qwilight/System/LanguageSystem/LanguageSystem.cs b/Qwilight/Qwilight/System/LanguageSystem/LanguageSystem.cs new file mode 100644 index 0000000..e0a31c8 --- /dev/null +++ b/Qwilight/Qwilight/System/LanguageSystem/LanguageSystem.cs @@ -0,0 +1,165 @@ +using Qwilight.ViewModel; +using System.IO; +using System.Reflection; +using System.Text.Json; + +namespace Qwilight +{ + public sealed partial class LanguageSystem : Model + { + public static readonly LanguageSystem Instance = QwilightComponent.GetBuiltInData(nameof(LanguageSystem)); + + public string[] AutoModeTexts { get; } = new string[2]; + public string[] NoteSaltModeTexts { get; } = new string[15]; + public string[] FaintNoteModeTexts { get; } = new string[4]; + public string[] JudgmentModeTexts { get; } = new string[6]; + public string[] HitPointsModeTexts { get; } = new string[8]; + public string[] NoteMobilityModeTexts { get; } = new string[6]; + public string[] LongNoteModeTexts { get; } = new string[4]; + public string[] InputFavorModeTexts { get; } = new string[17]; + public string[] NoteModifyModeTexts { get; } = new string[3]; + public string[] BPMModeTexts { get; } = new string[2]; + public string[] WaveModeTexts { get; } = new string[2]; + public string[] SetNoteModeTexts { get; } = new string[6]; + public string[] LowestJudgmentConditionModeTexts { get; } = new string[2]; + + public void Init(string language) + { + var languageSystem = typeof(LanguageSystem); + foreach (var property in languageSystem.GetProperties().Where(property => property.PropertyType == typeof(string))) + { + property.SetValue(this, default); + } + language = QwilightComponent.TestLanguage ?? language; + var textHeight = 0; + var lastLanguage = string.Empty; + PropertyInfo lastPropertyInfo = null; + var defaultValue = string.Empty; + var r = new Utf8JsonReader(File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Assets", "Language.json"))); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.StartObject) + { + if (++textHeight == 2) + { + defaultValue = string.Empty; + } + continue; + } + + if (r.TokenType == JsonTokenType.EndObject) + { + if (--textHeight == 1 && lastPropertyInfo != null && string.IsNullOrEmpty(lastPropertyInfo.GetValue(this) as string)) + { + lastPropertyInfo?.SetValue(this, defaultValue); + } + continue; + } + + if (textHeight == 1) + { + if (r.TokenType == JsonTokenType.PropertyName) + { + lastPropertyInfo = languageSystem.GetProperty(r.GetString()); + continue; + } + } + + if (textHeight == 2) + { + switch (r.TokenType) + { + case JsonTokenType.PropertyName: + lastLanguage = r.GetString(); + break; + case JsonTokenType.String: + if (lastLanguage == "en-US") + { + defaultValue = r.GetString(); + } + if (lastLanguage == language) + { + lastPropertyInfo?.SetValue(this, r.GetString()); + } + break; + } + } + } + + AutoModeTexts[(int)ModeComponent.AutoMode.Default] = DefaultModeContents; + AutoModeTexts[(int)ModeComponent.AutoMode.Autoable] = AutoableModeContents; + + FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.Default] = DefaultFaintNoteModeContents; + FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.Faint] = FaintNoteModeContents; + FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.Fading] = FadingNoteModeContents; + FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.TotalFading] = TotalFadingNoteModeContents; + + JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Lower] = LowerJudgmentModeContents; + JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Default] = DefaultJudgmentModeContents; + JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Higher] = HigherJudgmentModeContents; + JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Lowest] = LowestJudgmentModeContents; + JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Highest] = HighestJudgmentModeContents; + JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Favor] = FavorJudgmentModeContents; + + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Lower] = LowerHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Default] = DefaultHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Higher] = HigherHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Failed] = FailedHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Lowest] = LowestHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Highest] = HighestHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Favor] = FavorHitPointsModeContents; + HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Test] = TestHitPointsModeContents; + + NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode.Default] = DefaultMobilityMode; + NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode._4DHD] = _4DModeContents; + NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode.ZipHD] = ZipModeContents; + NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode._4D] = Easy4DModeContents; + NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode.Zip] = EasyZipModeContents; + + LongNoteModeTexts[(int)ModeComponent.LongNoteMode.Default] = DefaultLongNoteMode; + LongNoteModeTexts[(int)ModeComponent.LongNoteMode.Auto] = AutoLongNoteMode; + LongNoteModeTexts[(int)ModeComponent.LongNoteMode.Input] = HigherLongNoteMode; + + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Default] = InputDefaultMode; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode4] = InputFavorMode4; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode5] = InputFavorMode5; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode6] = InputFavorMode6; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode7] = InputFavorMode7; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode8] = InputFavorMode8; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode9] = InputFavorMode9; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode10] = InputFavorMode10; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode51] = InputFavorMode51; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode71] = InputFavorMode71; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode102] = InputFavorMode102; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode142] = InputFavorMode142; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode242] = InputFavorMode242; + InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode484] = InputFavorMode484; + + NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.Default] = DefaultSaltModeContents; + NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.Symmetric] = SymmetricModeContents; + NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.Salt] = SaltModeContents; + NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.InputSalt] = InputSaltModeContents; + NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.MeterSalt] = MeterSaltModeContents; + NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.HalfInputSalt] = HalfInputSaltModeContents; + + NoteModifyModeTexts[(int)ModeComponent.NoteModifyMode.Default] = DefaultNoteModifyContents; + NoteModifyModeTexts[(int)ModeComponent.NoteModifyMode.InputNote] = InputNoteSetContents; + NoteModifyModeTexts[(int)ModeComponent.NoteModifyMode.LongNote] = LongNoteModifyContents; + + BPMModeTexts[(int)ModeComponent.BPMMode.Default] = DefaultBPMModeContents; + BPMModeTexts[(int)ModeComponent.BPMMode.Not] = NotBPMModeContents; + + WaveModeTexts[(int)ModeComponent.WaveMode.Default] = DefaultWaveModeContents; + WaveModeTexts[(int)ModeComponent.WaveMode.Counter] = CounterWaveModeContents; + + SetNoteModeTexts[(int)ModeComponent.SetNoteMode.Default] = DefaultSetNoteModeContents; + SetNoteModeTexts[(int)ModeComponent.SetNoteMode.Put] = PutSetNoteModeContents; + SetNoteModeTexts[(int)ModeComponent.SetNoteMode.VoidPut] = VoidPutSetNoteModeContents; + + LowestJudgmentConditionModeTexts[(int)ModeComponent.LowestJudgmentConditionMode.Default] = DefaultLowestJudgmentConditionModeContents; + LowestJudgmentConditionModeTexts[(int)ModeComponent.LowestJudgmentConditionMode.Wrong] = WrongLowestJudgmentConditionModeContents; + + ViewModels.Instance.MainValue.NotifyModel(); + } + } +} diff --git a/Qwilight/Qwilight/System/LanguageSystem/LanguageSystem.g.cs b/Qwilight/Qwilight/System/LanguageSystem/LanguageSystem.g.cs new file mode 100644 index 0000000..4fdd702 --- /dev/null +++ b/Qwilight/Qwilight/System/LanguageSystem/LanguageSystem.g.cs @@ -0,0 +1,897 @@ +namespace Qwilight +{ + public sealed partial class LanguageSystem + { + public string _4DModeContents { get; set; } + public string AbilityStandContents { get; set; } + public string AegisPostedItemText { get; set; } + public string AllowEssentialInputs { get; set; } + public string AllowTotalLevyingText { get; set; } + public string AllowTwilightCommentAssist { get; set; } + public string AlreadyAvatarID { get; set; } + public string AlreadyLatestDate { get; set; } + public string AlreadyLoadingBundle { get; set; } + public string AlwaysNotP2PositionContents { get; set; } + public string AlwaysNotP2PositionText { get; set; } + public string AlwaysP2PositionContents { get; set; } + public string AlwaysP2PositionText { get; set; } + public string AlwaysText { get; set; } + public string AlwaysViewContents { get; set; } + public string Assist0 { get; set; } + public string Assist1 { get; set; } + public string Assist2 { get; set; } + public string Assist3 { get; set; } + public string Assist4 { get; set; } + public string Assist5 { get; set; } + public string Assist6 { get; set; } + public string Assist7 { get; set; } + public string Assist8 { get; set; } + public string Assister { get; set; } + public string AssistText { get; set; } + public string AudioAssister { get; set; } + public string AudioComponentConfigure { get; set; } + public string AudioConfigureText { get; set; } + public string AudioDataContents { get; set; } + public string AudioDateHTMLText { get; set; } + public string AudioDateText { get; set; } + public string AudioHandlerItemCountText { get; set; } + public string AudioInputConfigure { get; set; } + public string AudioInputValueContents { get; set; } + public string AudioItemCountText { get; set; } + public string AudioModeContents { get; set; } + public string AudioMultiplierAtoneText { get; set; } + public string AudioMultiplierContents { get; set; } + public string AudioMultiplierWarning { get; set; } + public string AudioUnitUsageText { get; set; } + public string AudioValueContents { get; set; } + public string AudioVarietyASIOAssist { get; set; } + public string AudioVarietyText { get; set; } + public string AudioVarietyWASAPIAssist { get; set; } + public string AudioVisualizerConfigure { get; set; } + public string AudioVisualizerCountText { get; set; } + public string AudioVisualizerFaintContents { get; set; } + public string AudioVisualizerInputColor { get; set; } + public string AudioVisualizerMainColor { get; set; } + public string AudioVisualizerMode0Contents { get; set; } + public string AudioVisualizerMode1Contents { get; set; } + public string AudioVisualizerMode2Contents { get; set; } + public string AudioVisualizerModeText { get; set; } + public string AudioWaitContents { get; set; } + public string AuraContents { get; set; } + public string AuraText { get; set; } + public string AutoableInputNoteCountViewColor { get; set; } + public string AutoableLimiterVariety { get; set; } + public string AutoableModeContents { get; set; } + public string AutoComputeContents { get; set; } + public string AutoComputeText { get; set; } + public string AutoComputingSituationContents { get; set; } + public string AutoEdgeText { get; set; } + public string AutoEnterContents { get; set; } + public string AutoEnterDefaultSiteContents { get; set; } + public string AutoEnterNotifySiteContents { get; set; } + public string AutoEnterPlatformSiteContents { get; set; } + public string AutoEnterSignedInContents { get; set; } + public string AutoHighlightContents { get; set; } + public string AutoHighlightText { get; set; } + public string AutoLevyingContents { get; set; } + public string AutoLevyingText { get; set; } + public string AutoLongNoteMode { get; set; } + public string AutoModeAssist { get; set; } + public string AutoModeContents { get; set; } + public string AutoNetLevyingText { get; set; } + public string AutoSaltAssist { get; set; } + public string AutoSignIn { get; set; } + public string AutoSiteHandText { get; set; } + public string AutoText { get; set; } + public string AvatarCipher { get; set; } + public string AvatarCipherTest { get; set; } + public string AvatarCountContents { get; set; } + public string AvatarEdgeText { get; set; } + public string AvatarID { get; set; } + public string AvatarName { get; set; } + public string AvatarText { get; set; } + public string AvatarTitleText { get; set; } + public string AvatarViewAbilityContents { get; set; } + public string AvatarViewDateContents { get; set; } + public string AvatarViewDateText { get; set; } + public string AvatarViewFavoritesContents { get; set; } + public string AvatarViewHighestCountText { get; set; } + public string AvatarViewIntro { get; set; } + public string AvatarViewLastsContents { get; set; } + public string AvatarViewQuitContents { get; set; } + public string AvatarViewText { get; set; } + public string AvatarViewTotalCountText { get; set; } + public string AvatarViewTotalLengthText { get; set; } + public string AvatarViewWwwLevelContents { get; set; } + public string AveragerContents { get; set; } + public string AveragerText { get; set; } + public string BanalAudioContents { get; set; } + public string BanalAudioText { get; set; } + public string BanalFailedMediaContents { get; set; } + public string BanalFailedMediaText { get; set; } + public string BanalMediaContents { get; set; } + public string BanalMediaText { get; set; } + public string Band { get; set; } + public string BandContents { get; set; } + public string BandLegend { get; set; } + public string BandPositionContents { get; set; } + public string BandValidHunterModeText { get; set; } + public string BannedNoteFileContents { get; set; } + public string BeforeEventNoteContents { get; set; } + public string BPMModeAssist { get; set; } + public string BPMVarietyAudioMultiplierText { get; set; } + public string BPMVarietyContents { get; set; } + public string BPMVarietyMultiplierText { get; set; } + public string BundleAvatarContents { get; set; } + public string BundleCallableContents { get; set; } + public string BundleEntryContents { get; set; } + public string BundleText { get; set; } + public string BundleUbuntuContents { get; set; } + public string BundleVoidContents { get; set; } + public string BWContents { get; set; } + public string BWText { get; set; } + public string CallingIOContents { get; set; } + public string CallIO { get; set; } + public string CallSiteAssist { get; set; } + public string CanBeTwilightCommentContents { get; set; } + public string CannotBeTwilightCommentContents { get; set; } + public string CannotIOContents { get; set; } + public string CenterLimiterVariety { get; set; } + public string ColorText { get; set; } + public string CommentAssist { get; set; } + public string CommentComputingSituationContents { get; set; } + public string CommentSiteName { get; set; } + public string CommentText { get; set; } + public string CompileFaultText { get; set; } + public string CompilingBinText { get; set; } + public string ComponentConfigure { get; set; } + public string ComputingConfigureText { get; set; } + public string ComputingGUIConfigure { get; set; } + public string ComputingModeComponentConfigure { get; set; } + public string ComputingUIConfigure { get; set; } + public string ConfigureAssist { get; set; } + public string ConfigureBaseUIContents { get; set; } + public string ConfigureEtcUIContents { get; set; } + public string ConfigureFontFamilyContents { get; set; } + public string ConfigureLevelContents { get; set; } + public string ConfigurePutNoteSetContents { get; set; } + public string ConfigurePutNoteSetMillisContents { get; set; } + public string ConfigureText { get; set; } + public string ConfigureUIContents { get; set; } + public string ControllerConfigure { get; set; } + public string ControllerCountContents { get; set; } + public string ControllerViewerContents { get; set; } + public string CopyPutCopyNotesText { get; set; } + public string CountContents { get; set; } + public string CounterWaveModeContents { get; set; } + public string DataCount3Contents { get; set; } + public string DataCount3Text { get; set; } + public string DateAssistText { get; set; } + public string DBConfigure { get; set; } + public string DefaultAudioVarietyContents { get; set; } + public string DefaultBPMModeContents { get; set; } + public string DefaultBundleCompetenceContents { get; set; } + public string DefaultComment { get; set; } + public string DefaultComputeInNetSiteFault { get; set; } + public string DefaultComputingSituationContents { get; set; } + public string DefaultConfigureText { get; set; } + public string DefaultControllerDefaultInputContents { get; set; } + public string DefaultControllerDefaultInputText { get; set; } + public string DefaultControllerDInputContents { get; set; } + public string DefaultControllerDInputText { get; set; } + public string DefaultControllerViewerContents { get; set; } + public string DefaultDrawingContents { get; set; } + public string DefaultFaintNoteModeContents { get; set; } + public string DefaultGPUMode { get; set; } + public string DefaultHitPointsModeContents { get; set; } + public string DefaultInputAudioVariety { get; set; } + public string DefaultInputAudioVarietyAssist { get; set; } + public string DefaultJudgmentModeContents { get; set; } + public string DefaultLongNoteMode { get; set; } + public string DefaultLowestJudgmentConditionModeContents { get; set; } + public string DefaultMobilityMode { get; set; } + public string DefaultModeContents { get; set; } + public string DefaultNoteAssister { get; set; } + public string DefaultNoteModifyContents { get; set; } + public string DefaultPutCopyNotesText { get; set; } + public string DefaultSaltModeContents { get; set; } + public string DefaultSetNoteModeContents { get; set; } + public string DefaultSiteName { get; set; } + public string DefaultUIAssister { get; set; } + public string DefaultWaveModeContents { get; set; } + public string DetailedConfigure { get; set; } + public string DetailedConfigureText { get; set; } + public string DInputContents { get; set; } + public string DInputControllerVarietyText { get; set; } + public string DInputIIDXSensitivityText { get; set; } + public string DInputText { get; set; } + public string DInputXyzSensitivityText { get; set; } + public string DrawingComponentConfigure { get; set; } + public string DrawingItemCountText { get; set; } + public string Easy4DModeContents { get; set; } + public string EasyZipModeContents { get; set; } + public string EditedNoteFileFault { get; set; } + public string EditorConfigureFault { get; set; } + public string EditorContents { get; set; } + public string EditorSoftwareFault { get; set; } + public string EnterAutoComputeConfigure { get; set; } + public string EnterAutoComputeMediaInputConfigure { get; set; } + public string EnterAutoComputeUIConfigure { get; set; } + public string EnterSiteCipherContents { get; set; } + public string EnterSiteInputContents { get; set; } + public string EqualizerContents { get; set; } + public string EqualizerText { get; set; } + public string EventNote { get; set; } + public string EventNoteBundleText { get; set; } + public string EventNoteEntryContents { get; set; } + public string EventNoteNameAssist { get; set; } + public string ExileAvatar { get; set; } + public string F5Notify0 { get; set; } + public string F5Notify1 { get; set; } + public string FadingNoteModeContents { get; set; } + public string FailedDrawingMillisText { get; set; } + public string FailedHitPointsModeContents { get; set; } + public string FailedValidation { get; set; } + public string FailedVibrationModeText { get; set; } + public string FaintNoteAssist { get; set; } + public string FaintNoteModeContents { get; set; } + public string FastInputMillisContents { get; set; } + public string FaultCommentContents { get; set; } + public string FaultStillDrawing { get; set; } + public string FavorAudioMultiplierText { get; set; } + public string FavorDefaultAudioVarietyText { get; set; } + public string FavorHitPoints0Unit { get; set; } + public string FavorHitPoints1Unit { get; set; } + public string FavorHitPointsModeContents { get; set; } + public string FavorHitPointsNameAssist { get; set; } + public string FavoriteEntryText { get; set; } + public string FavorJudgmentModeContents { get; set; } + public string FavorJudgmentNameAssist { get; set; } + public string FavorMediaInputContents { get; set; } + public string FavorModeComponentText { get; set; } + public string FavorMultiplierText { get; set; } + public string FavorNoteFileText { get; set; } + public string Fax { get; set; } + public string FitAssist { get; set; } + public string FitDefaultEntry { get; set; } + public string FlangeContents { get; set; } + public string FlangeText { get; set; } + public string FlowNetItemContents { get; set; } + public string FlowNetItemText { get; set; } + public string FontFamilyAssist { get; set; } + public string FontFamilyText { get; set; } + public string FrontEntryText { get; set; } + public string GASWarning { get; set; } + public string GetMediaInputContents { get; set; } + public string GetMediaInputText { get; set; } + public string GetMIDIText { get; set; } + public string GetQwilightFault { get; set; } + public string GetQwilightText { get; set; } + public string GetWaveInValuesText { get; set; } + public string GetWaveValuesText { get; set; } + public string GetWwwLevel { get; set; } + public string GPUModeModified { get; set; } + public string GPUModeText { get; set; } + public string GUIConfigureText { get; set; } + public string HalfInputSaltModeContents { get; set; } + public string HandledBand1 { get; set; } + public string HandledClear { get; set; } + public string HandledContents { get; set; } + public string HandledF { get; set; } + public string HandledHigherClear { get; set; } + public string HandledHighestClear { get; set; } + public string HandledNot { get; set; } + public string HandleFailedAudioCountText { get; set; } + public string HandleFailedAudioText { get; set; } + public string HandleInputAudioContents { get; set; } + public string HandleInputAudioText { get; set; } + public string HandleMeterContents { get; set; } + public string HandleMeterText { get; set; } + public string HandleUndoContents { get; set; } + public string HandlingAudioCountText { get; set; } + public string HandlingCountContents { get; set; } + public string HasNotEventNoteNoteFile { get; set; } + public string HasNotIONoteFile { get; set; } + public string HasNotNetNoteFile { get; set; } + public string HellBPMContents { get; set; } + public string HellBPMText { get; set; } + public string HigherAudioMultiplierContents { get; set; } + public string HigherEntryContents { get; set; } + public string HigherHitPointsModeContents { get; set; } + public string HigherJudgmentModeContents { get; set; } + public string HigherLongNoteMode { get; set; } + public string HigherMultiplierContents { get; set; } + public string HigherNoteFileContents { get; set; } + public string HighestHitPointsModeContents { get; set; } + public string HighestJudgmentModeContents { get; set; } + public string HighestLongNoteModify { get; set; } + public string HighestWantBPMContents { get; set; } + public string HighestWantInputCountContents { get; set; } + public string HighestWantLevelTextValue { get; set; } + public string HitPoints { get; set; } + public string HitPointsLegend { get; set; } + public string HitPointsModeAssist { get; set; } + public string HunterVariety1stText { get; set; } + public string HunterVarietyContents { get; set; } + public string HunterVarietyFavorText { get; set; } + public string HunterVarietyHigherText { get; set; } + public string HunterVarietyLowerText { get; set; } + public string HunterVarietyMeText { get; set; } + public string HwModeContents { get; set; } + public string IIDXInputAudioVariety { get; set; } + public string IIDXInputAudioVarietyAssist { get; set; } + public string InitCommentContents { get; set; } + public string InitCommentNotify { get; set; } + public string InitCommentOK { get; set; } + public string InitCommentText { get; set; } + public string InitCompiledContents { get; set; } + public string InitCompiledNotify { get; set; } + public string InitCompiledOK { get; set; } + public string InitCompiledText { get; set; } + public string InitFavoriteEntryContents { get; set; } + public string InitFavoriteEntryNotify { get; set; } + public string InitFavoriteEntryOK { get; set; } + public string InitFavoriteEntryText { get; set; } + public string InitMediaContents { get; set; } + public string InitMediaNotify { get; set; } + public string InitMediaOK { get; set; } + public string InitMediaText { get; set; } + public string InitModeComponent { get; set; } + public string InitTotalContents { get; set; } + public string InitTotalNotify { get; set; } + public string InitTotalOK { get; set; } + public string InitTotalText { get; set; } + public string InitWaitContents { get; set; } + public string InitWaitNotify { get; set; } + public string InitWaitOK { get; set; } + public string InitWaitText { get; set; } + public string InputAudioVarietyText { get; set; } + public string InputAudioVolume { get; set; } + public string InputConfigure { get; set; } + public string InputConfigureText { get; set; } + public string InputDefaultMode { get; set; } + public string InputFavorMode10 { get; set; } + public string InputFavorMode102 { get; set; } + public string InputFavorMode142 { get; set; } + public string InputFavorMode242 { get; set; } + public string InputFavorMode4 { get; set; } + public string InputFavorMode484 { get; set; } + public string InputFavorMode5 { get; set; } + public string InputFavorMode51 { get; set; } + public string InputFavorMode6 { get; set; } + public string InputFavorMode7 { get; set; } + public string InputFavorMode71 { get; set; } + public string InputFavorMode8 { get; set; } + public string InputFavorMode9 { get; set; } + public string InputFavorModeAssist { get; set; } + public string InputMapText { get; set; } + public string InputNoteCountViewColor { get; set; } + public string InputNoteSetContents { get; set; } + public string InputSaltCommentWarning { get; set; } + public string InputSaltModeContents { get; set; } + public string InputVibrationModeText { get; set; } + public string InputWindowAssist0 { get; set; } + public string InputWindowAssist1 { get; set; } + public string InputWindowAssist2 { get; set; } + public string InputWindowAssist3 { get; set; } + public string IOAvatarContents { get; set; } + public string IOCallableContents { get; set; } + public string IOCompetenceContents { get; set; } + public string IOComputingSituationContents { get; set; } + public string IOHigherContents { get; set; } + public string IOLowerContents { get; set; } + public string IOUbuntuContents { get; set; } + public string IOVoidContents { get; set; } + public string IsAudioInputContents { get; set; } + public string IsFailModeContents { get; set; } + public string IsFailModeText { get; set; } + public string IsGetNotifyContents { get; set; } + public string IsXwindowContents { get; set; } + public string JudgmentMainPosition1Contents { get; set; } + public string JudgmentMeterMillisText { get; set; } + public string JudgmentModeAssist { get; set; } + public string JudgmentStage { get; set; } + public string JudgmentVisualizerMillisText { get; set; } + public string K70Contents { get; set; } + public string K70Text { get; set; } + public string Level0Contents { get; set; } + public string Level1Contents { get; set; } + public string Level2Contents { get; set; } + public string Level3Contents { get; set; } + public string Level4Contents { get; set; } + public string Level5Contents { get; set; } + public string LevelInputContents { get; set; } + public string LevelItem { get; set; } + public string LevelSystemText { get; set; } + public string LevelUpContents { get; set; } + public string LevyNoteFileContents { get; set; } + public string LevyWwwLevel { get; set; } + public string Library { get; set; } + public string Limiter57Variety { get; set; } + public string LimiterColor { get; set; } + public string LimiterVarietyContents { get; set; } + public string LoadBanalAudio { get; set; } + public string LoadBanalFailedMedia { get; set; } + public string LoadBanalMedia { get; set; } + public string LoadDefaultAudio { get; set; } + public string LoadedModeComponent { get; set; } + public string LoadedMultiplier { get; set; } + public string LoadingBinText { get; set; } + public string LoadLevelFault { get; set; } + public string LongNoteModeAssist { get; set; } + public string LongNoteModifyContents { get; set; } + public string LongNoteModifyFaultText { get; set; } + public string LoopUnitText { get; set; } + public string LoopWaveInContents { get; set; } + public string LoopWaveInText { get; set; } + public string LostPointAudioContents { get; set; } + public string LostPointAudioText { get; set; } + public string LowerAudioMultiplierContents { get; set; } + public string LowerEntryContents { get; set; } + public string LowerHitPointsModeContents { get; set; } + public string LowerJudgmentModeContents { get; set; } + public string LowerMultiplierContents { get; set; } + public string LowerNoteFileContents { get; set; } + public string LowestHitPointsModeContents { get; set; } + public string LowestJudgmentConditionModeAssist { get; set; } + public string LowestJudgmentModeContents { get; set; } + public string LowestLongNoteModify { get; set; } + public string LowestWantBPMContents { get; set; } + public string LowestWantInputCountContents { get; set; } + public string LowestWantLevelTextValue { get; set; } + public string LowHitPointsFaintUIContents { get; set; } + public string LowHitPointsFaintUIText { get; set; } + public string LSCompileFault { get; set; } + public string LSContents { get; set; } + public string LSText { get; set; } + public string MainAreaFaintContents { get; set; } + public string MainControllerPowerText { get; set; } + public string MainFaintContents { get; set; } + public string MainPositionContents { get; set; } + public string MainSetContents { get; set; } + public string MediaComponentConfigure { get; set; } + public string MediaConfigure { get; set; } + public string MediaContents { get; set; } + public string MediaFaintContents { get; set; } + public string MediaFillContents { get; set; } + public string MediaFillText { get; set; } + public string MediaHandlerItemCountText { get; set; } + public string MediaInputConfigure { get; set; } + public string MediaInputFaintContents { get; set; } + public string MediaInputQualityContents { get; set; } + public string MediaItemCountText { get; set; } + public string MediaModifierContents { get; set; } + public string MediaText { get; set; } + public string MediaWaitContents { get; set; } + public string MeterNoteColor { get; set; } + public string MeterSaltModeContents { get; set; } + public string MIDIConfigure { get; set; } + public string MIDICountContents { get; set; } + public string MIDIPBCSensitivityText { get; set; } + public string MIDIViewerContents { get; set; } + public string MITMFaultText { get; set; } + public string ModifyAutoModeContents { get; set; } + public string ModifyDefaultEntryAssist0 { get; set; } + public string ModifyDefaultEntryText { get; set; } + public string ModifyEditorContents { get; set; } + public string ModifyEventNoteName { get; set; } + public string ModifyEventNoteNameContents { get; set; } + public string ModifyFavoriteEntry { get; set; } + public string ModifyFavoriteEntryName { get; set; } + public string ModifyFavoriteEntryNameContents { get; set; } + public string ModifyFrontEntry { get; set; } + public string ModifyModeComponentText { get; set; } + public string ModifyPositionAssist { get; set; } + public string MultiplierContents { get; set; } + public string NegativePostedItemText { get; set; } + public string NegativeStopFault { get; set; } + public string NetCommentFollowContents { get; set; } + public string NetCommentFollowText { get; set; } + public string NetCommentNotFollowContents { get; set; } + public string NetCommentNotFollowText { get; set; } + public string NetComputingSituationContents { get; set; } + public string NetItemCountText { get; set; } + public string NetItemFaintContents { get; set; } + public string NetSiteCommentsText { get; set; } + public string NetText { get; set; } + public string NetUIContents { get; set; } + public string NewDefaultEntry { get; set; } + public string NewEventNote { get; set; } + public string NewFavorHitPoints { get; set; } + public string NewFavoriteEntry { get; set; } + public string NewFavoriteEntryContents { get; set; } + public string NewFavorJudgment { get; set; } + public string NewFrontEntry { get; set; } + public string NewNetSiteContents { get; set; } + public string NewNetSiteText { get; set; } + public string NewSilentSite { get; set; } + public string NewSiteContents { get; set; } + public string NewSiteText { get; set; } + public string NewTitleContents { get; set; } + public string NewUbuntu { get; set; } + public string NotAllowPauseText { get; set; } + public string NotAuraText { get; set; } + public string NotAutoComputeConfigureFault { get; set; } + public string NotAutoComputeContents { get; set; } + public string NotAutoComputeFault { get; set; } + public string NotAutoComputeText { get; set; } + public string NotAutoComputeViewContents { get; set; } + public string NotAvailableEventNoteFileFault { get; set; } + public string NotAvailableLevelWww { get; set; } + public string NotAvatarBundleFault { get; set; } + public string NotAvatarGroup { get; set; } + public string NotAvatarTitle { get; set; } + public string NotAvatarUbuntuFault { get; set; } + public string NotAvatarViewFault { get; set; } + public string NotAveragerText { get; set; } + public string NotBanalAudioText { get; set; } + public string NotBanalFailedMediaText { get; set; } + public string NotBanalMediaText { get; set; } + public string NotBPMModeContents { get; set; } + public string NotBWText { get; set; } + public string NotDataCount3Text { get; set; } + public string NotDefaultAudioVarietyText { get; set; } + public string NoteDrawingCountText { get; set; } + public string NoteFileBundleText { get; set; } + public string NoteFileLevelText { get; set; } + public string NoteFileModeSituationContents { get; set; } + public string NoteFilesLevelText { get; set; } + public string NoteFormat { get; set; } + public string NoteFormatIDText65001 { get; set; } + public string NoteFormatIDText932 { get; set; } + public string NoteFormatIDText936 { get; set; } + public string NoteFormatIDText949 { get; set; } + public string NoteHeightContents { get; set; } + public string NoteLengthContents { get; set; } + public string NoteMobilityAssist { get; set; } + public string NoteModifyModeAssist { get; set; } + public string NoteSaltModeAssist { get; set; } + public string NoteWaitContents { get; set; } + public string NotFavoritesF10 { get; set; } + public string NotFlangeText { get; set; } + public string NotFlowNetItemText { get; set; } + public string NotHandleInputAudioText { get; set; } + public string NotHandleMeterText { get; set; } + public string NotHaveLevelTarget { get; set; } + public string NotHaveNoteFileEntryText { get; set; } + public string NotHellBPMText { get; set; } + public string NotifyInSite { get; set; } + public string NotifySaveBundleAvatarContents { get; set; } + public string NotifySaveBundleCallableContents { get; set; } + public string NotifySaveBundleCompetenceContents { get; set; } + public string NotifySaveBundleUbuntuContents { get; set; } + public string NotifySaveBundleVoidContents { get; set; } + public string NotifySiteYellInvite { get; set; } + public string NotifySiteYellTV { get; set; } + public string NotifyText { get; set; } + public string NotifyUbuntuCompetenceContents { get; set; } + public string NotifyUbuntuContents { get; set; } + public string NotIsFailModeContents { get; set; } + public string NotIsFailModeText { get; set; } + public string NotK70Text { get; set; } + public string NotLoopWaveInContents { get; set; } + public string NotLoopWaveInText { get; set; } + public string NotLostPointAudioText { get; set; } + public string NotLowHitPointsFaintUIText { get; set; } + public string NotLSText { get; set; } + public string NotMediaFillContents { get; set; } + public string NotMediaFillText { get; set; } + public string NotMediaText { get; set; } + public string NotNotifyUbuntuContents { get; set; } + public string NotQwilightFillContents { get; set; } + public string NotQwilightFillText { get; set; } + public string NotSFXText { get; set; } + public string NotSignedInContents { get; set; } + public string NotSignedInSituationContents { get; set; } + public string NotSignInNotify { get; set; } + public string NotSignInText { get; set; } + public string NotStillDrawing { get; set; } + public string NotStopLastEqualAudioText { get; set; } + public string NotSupportedFileContents { get; set; } + public string NotTubeText { get; set; } + public string NotUbuntuSituationContents { get; set; } + public string NotValidNetLevelContents { get; set; } + public string NotValidNoteFile { get; set; } + public string NotVESAText { get; set; } + public string NotVibrationModeText { get; set; } + public string NotViewContents { get; set; } + public string NotWantHandledContents { get; set; } + public string NotWantLevelContents { get; set; } + public string NotWantLevelItemContents { get; set; } + public string NotWantModeContents { get; set; } + public string NotWantNoteVarietyContents { get; set; } + public string NotWindowedModeContents { get; set; } + public string NotWindowedModeText { get; set; } + public string NotXwindowText { get; set; } + public string NVLLFramerateContents { get; set; } + public string NVLLModeContents { get; set; } + public string NVLLModeNotText { get; set; } + public string NVLLModeOKText { get; set; } + public string NVLLModeUnlimitedText { get; set; } + public string OBSText0 { get; set; } + public string OBSText1 { get; set; } + public string OpenedCountContents { get; set; } + public string OpenedEventNotes { get; set; } + public string OpenedUIFileContents { get; set; } + public string OpeningUIFileContents { get; set; } + public string P1SymmetricCopyNotesText { get; set; } + public string P2SymmetricCopyNotesText { get; set; } + public string PassContents { get; set; } + public string PauseAssist { get; set; } + public string PlatformAutoComputing { get; set; } + public string PlatformCommentComputing { get; set; } + public string PlatformDefaultComputing { get; set; } + public string PlatformNoteFileMode { get; set; } + public string PlatformQuitMode { get; set; } + public string PlatformSiteName { get; set; } + public string PlatformText0 { get; set; } + public string PlatformText1 { get; set; } + public string Point { get; set; } + public string PointLegend { get; set; } + public string PointLevelContents { get; set; } + public string PointValidHunterModeText { get; set; } + public string PositivePostedItemText { get; set; } + public string PostableItemModeViewCommentFault { get; set; } + public string PostableItemModeWarning { get; set; } + public string PostableItemText { get; set; } + public string PostItem0Contents { get; set; } + public string PostItem1Contents { get; set; } + public string PostItemContents { get; set; } + public string Power00 { get; set; } + public string Power01 { get; set; } + public string Power02 { get; set; } + public string Power03 { get; set; } + public string Power04 { get; set; } + public string Power10 { get; set; } + public string Power11 { get; set; } + public string Power12 { get; set; } + public string Power13 { get; set; } + public string PutCopyNotesContents { get; set; } + public string PutSetNoteModeContents { get; set; } + public string QuitComputingSituationContents { get; set; } + public string QuitContents { get; set; } + public string QuitSiteAssist { get; set; } + public string QuitText { get; set; } + public string QwilightBundleText { get; set; } + public string QwilightFillContents { get; set; } + public string QwilightFillText { get; set; } + public string SaltContents { get; set; } + public string SaltModeContents { get; set; } + public string SaveAsBundle { get; set; } + public string SaveAsBundleContents { get; set; } + public string SaveAsBundleFault { get; set; } + public string SaveAsNetBundle { get; set; } + public string SaveBundle { get; set; } + public string SaveBundleContents { get; set; } + public string SaveBundleFault { get; set; } + public string SaveCommentFailed { get; set; } + public string SavedAsBundleContents { get; set; } + public string SavedBundleContents { get; set; } + public string SaveDefaultNoteContents { get; set; } + public string SaveDefaultNoteNotify { get; set; } + public string SaveDefaultNoteText { get; set; } + public string SaveDefaultUIContents { get; set; } + public string SaveDefaultUINotify { get; set; } + public string SaveDefaultUIText { get; set; } + public string SavedFileContents { get; set; } + public string SavedLevelContents { get; set; } + public string SavedQwilightBundleContents { get; set; } + public string SavedQwilightContents { get; set; } + public string SavedStillDrawing { get; set; } + public string SavedUIContents { get; set; } + public string SaveFileFault { get; set; } + public string SaveModeComponent { get; set; } + public string SaveModeComponentContents { get; set; } + public string SaveNetBundle { get; set; } + public string SaveUIFault { get; set; } + public string SavingAsBundleContents { get; set; } + public string SavingBundleContents { get; set; } + public string SavingDefaultNoteContents { get; set; } + public string SavingDefaultUIContents { get; set; } + public string SavingFileContents { get; set; } + public string SavingLevelContents { get; set; } + public string SavingQwilightContents { get; set; } + public string SavingUIContents { get; set; } + public string SetAutoNoteWait { get; set; } + public string SetEntryItem { get; set; } + public string SetFavoritesF10 { get; set; } + public string SetNoteFile { get; set; } + public string SetNoteModeAssist { get; set; } + public string SetNotTotalText { get; set; } + public string SetSaltText { get; set; } + public string SetSiteHand { get; set; } + public string SetSiteName { get; set; } + public string SetSiteNameContents { get; set; } + public string SetTotalText { get; set; } + public string SFXContents { get; set; } + public string SFXText { get; set; } + public string SignIn { get; set; } + public string SignUp { get; set; } + public string SilentSiteAvatarContents { get; set; } + public string SilentSiteCallableContents { get; set; } + public string SilentSiteCompetenceContents { get; set; } + public string SilentSiteUbuntuContents { get; set; } + public string SilentSiteVoidContents { get; set; } + public string SiteCipher { get; set; } + public string SiteHandLevyingText { get; set; } + public string SiteInputAssist { get; set; } + public string SiteLevyingText { get; set; } + public string SiteText { get; set; } + public string SiteYellEnter { get; set; } + public string SiteYellInvite { get; set; } + public string SiteYellNewNetSite { get; set; } + public string SiteYellNewSite { get; set; } + public string SiteYellQuit { get; set; } + public string SiteYellTaehui { get; set; } + public string SiteYellTV { get; set; } + public string SlowLoopingContents { get; set; } + public string SoftwareAssister { get; set; } + public string Stand { get; set; } + public string StandardControllerModeContents { get; set; } + public string StandardControllerModeText { get; set; } + public string StandardDefaultControllerModeContents { get; set; } + public string StandardDefaultControllerModeText { get; set; } + public string StandardMIDIModeContents { get; set; } + public string StandardMIDIModeText { get; set; } + public string StandardWaitUnitContents { get; set; } + public string StandContents { get; set; } + public string StandLegend { get; set; } + public string StandValidHunterModeText { get; set; } + public string StopLastEqualAudioContents { get; set; } + public string StopLastEqualAudioText { get; set; } + public string StopSavingAsBundleContents { get; set; } + public string StopSavingBundleContents { get; set; } + public string StopSiteNetText { get; set; } + public string SuccessfullySignedInContents { get; set; } + public string SymmetricModeContents { get; set; } + public string TestHitPointsModeContents { get; set; } + public string TestHitPointsModeWarning { get; set; } + public string TotalAudioVolume { get; set; } + public string TotalFadingNoteModeContents { get; set; } + public string TotalLimiterVariety { get; set; } + public string TotalVarietyContents { get; set; } + public string TubeContents { get; set; } + public string TubeText { get; set; } + public string Tutorial0 { get; set; } + public string Tutorial1 { get; set; } + public string Tutorial20 { get; set; } + public string Tutorial200 { get; set; } + public string Tutorial201 { get; set; } + public string Tutorial21 { get; set; } + public string Tutorial22 { get; set; } + public string Tutorial220 { get; set; } + public string TutorialAssistText { get; set; } + public string TutorialID0 { get; set; } + public string TutorialID1 { get; set; } + public string TutorialID2 { get; set; } + public string TVAssistConfigure { get; set; } + public string TwilightCloseContents { get; set; } + public string TwilightComment { get; set; } + public string TwilightCommentaryAssist { get; set; } + public string TwilightCommentIOContents { get; set; } + public string TwilightCommentWarning { get; set; } + public string TwilightConfigure { get; set; } + public string TwilightConfigureAssist { get; set; } + public string UbuntuAssist { get; set; } + public string UbuntuNetItemTargetAssist { get; set; } + public string UbuntuText { get; set; } + public string UIBinText { get; set; } + public string UIBundleText { get; set; } + public string UICommentNote { get; set; } + public string UIDefaultAudioVarietyText { get; set; } + public string UIFaultText { get; set; } + public string UIHitNotePaint { get; set; } + public string UIHunter { get; set; } + public string UIJudgmentCount { get; set; } + public string UIJudgmentInputVisualizer { get; set; } + public string UIJudgmentMain { get; set; } + public string UIJudgmentMeter { get; set; } + public string UIJudgmentPaint { get; set; } + public string UIJudgmentVisualizer { get; set; } + public string UILimiter { get; set; } + public string UIMainDrawingPaint { get; set; } + public string UIMainJudgmentMeter { get; set; } + public string UINet { get; set; } + public string UndoColorContents { get; set; } + public string UndoColorNotify { get; set; } + public string UndoColorOK { get; set; } + public string UndoColorText { get; set; } + public string UndoContents { get; set; } + public string UndoEqualizerContents { get; set; } + public string ValidNetMode0Text { get; set; } + public string ValidNetMode1Text { get; set; } + public string ValidNetMode2Text { get; set; } + public string ValidNetMode3Text { get; set; } + public string ValidNetMode4Text { get; set; } + public string VeilDrawingHeightContents { get; set; } + public string VESAContents { get; set; } + public string VESAText { get; set; } + public string Vibration0 { get; set; } + public string Vibration1 { get; set; } + public string Vibration2 { get; set; } + public string Vibration3 { get; set; } + public string VibrationModeContents { get; set; } + public string ViewAvatarView { get; set; } + public string ViewBundle { get; set; } + public string ViewFailedDrawingText { get; set; } + public string ViewLowestJudgmentText { get; set; } + public string ViewQwilightEntry { get; set; } + public string ViewUIEntry { get; set; } + public string VisibleWindowValuesContents { get; set; } + public string VoidPutSetNoteModeContents { get; set; } + public string VoteText { get; set; } + public string WaitContents { get; set; } + public string WaitingIOContents { get; set; } + public string WaitingNetContents { get; set; } + public string WaitingNotifyContents { get; set; } + public string WaitSiteContents { get; set; } + public string WaitUnitContents { get; set; } + public string WantAverageInputCountContents { get; set; } + public string WantBannedContents { get; set; } + public string WantBPMContents { get; set; } + public string WantHighestInputCountContents { get; set; } + public string WantInputAssist { get; set; } + public string WantLevelItemContents { get; set; } + public string WantLevelTextValueContents { get; set; } + public string WantNotBannedText { get; set; } + public string WantText { get; set; } + public string WantTotalBannedText { get; set; } + public string WaveContents { get; set; } + public string WaveFadeVolumeContents { get; set; } + public string WaveFault { get; set; } + public string WaveInContents { get; set; } + public string WaveInFault { get; set; } + public string WaveModeAssist { get; set; } + public string WGIContents { get; set; } + public string WGIText { get; set; } + public string WindowedModeContents { get; set; } + public string WindowedModeText { get; set; } + public string WipeBundleNotify { get; set; } + public string WipeBundleText { get; set; } + public string WipeCommentNotify { get; set; } + public string WipeDefaultEntryNotify { get; set; } + public string WipedSiteYell { get; set; } + public string WipeEntryItemNotify { get; set; } + public string WipeEntryOK { get; set; } + public string WipeEventNoteContents { get; set; } + public string WipeFavoriteEntryNotify { get; set; } + public string WipeFavoritesF10 { get; set; } + public string WipeHandled { get; set; } + public string WipeLevelNotify { get; set; } + public string WipeNoteFileNotify { get; set; } + public string WipeNoteFileOK { get; set; } + public string WipeTotalNotify { get; set; } + public string WipeUbuntuNotify { get; set; } + public string WowAbilityContents { get; set; } + public string WowCommentAtContents { get; set; } + public string WowCommentContents { get; set; } + public string WowCommentText { get; set; } + public string WowLevelContents { get; set; } + public string WrongLowestJudgmentConditionModeContents { get; set; } + public string WwwCommentBand { get; set; } + public string WwwCommentHighest { get; set; } + public string WwwCommentStand { get; set; } + public string WwwCommentTotal { get; set; } + public string WwwLevelAudioMultiplierContents0 { get; set; } + public string WwwLevelAudioMultiplierContents1 { get; set; } + public string WwwLevelBandContents0 { get; set; } + public string WwwLevelBandContents1 { get; set; } + public string WwwLevelClearContents { get; set; } + public string WwwLevelClearItem { get; set; } + public string WwwLevelClearItemEdge { get; set; } + public string WwwLevelClearItemTitle { get; set; } + public string WwwLevelJudgmentContents0 { get; set; } + public string WwwLevelJudgmentContents1 { get; set; } + public string WwwLevelPointContents0 { get; set; } + public string WwwLevelPointContents1 { get; set; } + public string WwwLevelStandContents0 { get; set; } + public string WwwLevelStandContents1 { get; set; } + public string WwwLevelTest { get; set; } + public string WwwLevelText { get; set; } + public string XInputContents { get; set; } + public string XInputText { get; set; } + public string XwindowText { get; set; } + public string YAMLCompileFault { get; set; } + public string ZipModeContents { get; set; } + } +} diff --git a/Qwilight/Qwilight/System/LevelSystem.cs b/Qwilight/Qwilight/System/LevelSystem.cs new file mode 100644 index 0000000..2c037de --- /dev/null +++ b/Qwilight/Qwilight/System/LevelSystem.cs @@ -0,0 +1,195 @@ +using HtmlAgilityPack; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Buffers; +using System.Collections.ObjectModel; +using System.IO; +using System.Net; +using System.Net.Http; + +namespace Qwilight +{ + public sealed class LevelSystem + { + public static readonly string EntryPath = Path.Combine(QwilightComponent.QwilightEntryPath, "Level"); + + public static readonly LevelSystem Instance = QwilightComponent.GetBuiltInData(nameof(LevelSystem)); + + public Comparer WantLevelIDEquality { get; } + + public ObservableCollection LevelFileNames { get; } = new(); + + public ObservableCollection LevelCollection { get; } = new(); + + public Dictionary LevelID128s { get; } = new(); + + public Dictionary LevelID256s { get; } = new(); + + public Dictionary LevelID128NoteFiles { get; } = new(); + + public Dictionary LevelID256NoteFiles { get; } = new(); + + public LevelSystem() + { + WantLevelIDEquality = Comparer.Create((x, y) => LevelCollection.IndexOf(x).CompareTo(LevelCollection.IndexOf(y))); + } + + public void LoadLevelFiles() => Utility.SetUICollection(LevelFileNames, Utility.GetFiles(EntryPath).Where(levelFile => !Path.GetFileName(levelFile).StartsWith('#') && levelFile.IsTailCaselsss(".json")).Select(levelFile => Path.GetFileNameWithoutExtension(levelFile)).ToArray()); + + public void LoadJSON(bool isNotify) + { + LevelID128s.Clear(); + LevelID256s.Clear(); + LevelID128NoteFiles.Clear(); + LevelID256NoteFiles.Clear(); + LevelCollection.Clear(); + var levelName = Configure.Instance.WantLevelName; + if (!string.IsNullOrEmpty(levelName)) + { + try + { + var levelFilePath = Path.Combine(QwilightComponent.QwilightEntryPath, "Level", $"{levelName}.json"); + if (File.Exists(levelFilePath)) + { + var levelTableFilePath = Path.Combine(QwilightComponent.QwilightEntryPath, "Level", $"#{levelName}.json"); + if (File.Exists(levelTableFilePath)) + { + var levelTable = Utility.GetJSON(File.ReadAllText(levelTableFilePath)); + if (levelTable.HasValue) + { + var levelTableValue = levelTable.Value; + var levelTexts = new List(); + var levelTitle = levelTableValue.symbol; + foreach (var levelData in Utility.GetJSON(File.ReadAllText(levelFilePath))) + { + var level = levelData.level; + var noteID128 = levelData.md5; + var www = levelData.url; + if (!string.IsNullOrEmpty(noteID128)) + { + LevelID128s[$"{noteID128}:0"] = levelTitle + level; + LevelID128NoteFiles[$"{noteID128}:0"] = new LevelNoteFile(levelData, levelTitle + level); + } + var noteID256 = levelData.sha256; + if (!string.IsNullOrEmpty(noteID256)) + { + LevelID256s[$"{noteID256}:0"] = levelTitle + level; + LevelID256NoteFiles[$"{noteID256}:0"] = new LevelNoteFile(levelData, levelTitle + level); + } + var levelText = level.ToString(); + if (!levelTexts.Contains(levelText)) + { + levelTexts.Add(levelText); + } + } + var levels = levelTableValue.level_order.Select(level => level.ToString()).ToArray(); + levelTexts.Sort((x, y) => Array.IndexOf(levels, x).CompareTo(Array.IndexOf(levels, y))); + foreach (var levelText in levelTexts) + { + LevelCollection.Add(levelTitle + levelText); + } + } + } + } + } + catch (Exception e) + { + if (isNotify) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.LoadLevelFault, e.Message)); + } + } + } + } + + public async ValueTask LoadWww(string www) + { + var data = ArrayPool.Shared.Rent(QwilightComponent.SendUnit); + try + { + var o = new HtmlDocument(); + using var os = await TwilightSystem.Instance.GetWwwParallel(www); + o.Load(os); + using var s = await TwilightSystem.Instance.GetWwwParallel(WebUtility.HtmlDecode(ModifyDataValue(o.CreateNavigator().SelectSingleNode("/html/head/meta[@name='bmstable']/@content")?.ToString() + ?? o.CreateNavigator().SelectSingleNode("/html/body/meta[@name='bmstable']/@content")?.ToString() + ?? o.CreateNavigator().SelectSingleNode("/html/head/body/meta[@name='bmstable']/@content")?.ToString()))); + var levelTable = Utility.GetJSON(s); + s.Position = 0; + if (levelTable.HasValue) + { + var levelTableValue = levelTable.Value; + var savingLevelBundleItem = new NotifyItem + { + Text = LanguageSystem.Instance.SavingLevelContents, + Variety = NotifySystem.NotifyVariety.Levying, + OnStop = isTotal => false + }; + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingLevelBundleItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingLevelBundleItem.Text); + var target = ModifyDataValue(levelTableValue.data_url); + var levelTableFileName = levelTableValue.name; + foreach (var targetFileName in Path.GetInvalidFileNameChars()) + { + levelTableFileName = levelTableFileName.Replace(targetFileName.ToString(), string.Empty); + } + using (var wwwClient = new HttpClient()) + { + wwwClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0"); + using (var fs = File.Open(Path.Combine(EntryPath, $"{levelTableFileName}.json"), FileMode.Create)) + using (var ts = await wwwClient.GetAsync(target)) + { + savingLevelBundleItem.QuitStatus = ts.Content.Headers.ContentLength ?? 0L; + var length = 0; + while ((length = await (await ts.Content.ReadAsStreamAsync()).ReadAsync(data.AsMemory(0, data.Length))) > 0) + { + await fs.WriteAsync(data.AsMemory(0, length)); + savingLevelBundleItem.LevyingStatus += length; + savingLevelBundleItem.NotifyBundleStatus(); + } + } + } + using (var fs = File.Open(Path.Combine(EntryPath, $"#{levelTableFileName}.json"), FileMode.Create)) + { + await s.CopyToAsync(fs); + } + savingLevelBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savingLevelBundleItem.Text = LanguageSystem.Instance.SavedLevelContents; + savingLevelBundleItem.OnStop = isTotal => true; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, LanguageSystem.Instance.SavedLevelContents); + Configure.Instance.LevelTargetMap[levelTableFileName] = www; + LoadLevelFiles(); + Configure.Instance.WantLevelName = levelTableFileName; + } + + string ModifyDataValue(string dataValue) + { + if (!Uri.IsWellFormedUriString(dataValue, UriKind.Absolute)) + { + if (www.Substring(www.LastIndexOf('/')).Contains('.') || www.EndsWith('/')) + { + return $"{www}/../{dataValue}"; + } + else + { + return $"{www}/{dataValue}"; + } + } + else + { + return dataValue; + } + } + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.NotValidNetLevelContents, e.Message)); + } + finally + { + ArrayPool.Shared.Return(data); + } + } + } +} diff --git a/Qwilight/Qwilight/System/MIDISystem/MIDI.cs b/Qwilight/Qwilight/System/MIDISystem/MIDI.cs new file mode 100644 index 0000000..6e0357b --- /dev/null +++ b/Qwilight/Qwilight/System/MIDISystem/MIDI.cs @@ -0,0 +1,23 @@ +using Windows.Devices.Midi; + +namespace Qwilight +{ + public struct MIDI : IEquatable + { + public MidiMessageType Data { get; set; } + + public byte Value { get; set; } + + public override bool Equals(object obj) => obj is MIDI mMIDI && Equals(mMIDI); + + public bool Equals(MIDI other) => Data == other.Data && Value == other.Value; + + public override int GetHashCode() => HashCode.Combine(Data, Value); + + public override string ToString() => Data != MidiMessageType.None ? $"{Data} {Value}" : string.Empty; + + public static bool operator ==(MIDI left, MIDI right) => left.Equals(right); + + public static bool operator !=(MIDI left, MIDI right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/MIDISystem/MIDISystem.cs b/Qwilight/Qwilight/System/MIDISystem/MIDISystem.cs new file mode 100644 index 0000000..aa16b0a --- /dev/null +++ b/Qwilight/Qwilight/System/MIDISystem/MIDISystem.cs @@ -0,0 +1,174 @@ +using Qwilight.Compute; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Buffers; +using System.IO; +using Windows.Devices.Enumeration; +using Windows.Devices.Midi; +using Windows.Storage.Streams; + +namespace Qwilight +{ + public sealed class MIDISystem : Model + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(MIDISystem)); + + public static readonly MIDISystem Instance = QwilightComponent.GetBuiltInData(nameof(MIDISystem)); + + readonly List _rawMIDIControllers = new(); + readonly HandlingController _handlingController = new(rawInput => ViewModels.Instance.InputValue.OnMIDILower(rawInput), rawInput => ViewModels.Instance.InputStandardControllerValue.OnMIDILower(rawInput), DefaultCompute.InputFlag.MIDI); + + public string LastMIDI { get; set; } + + public string[] MIDIs { get; set; } = Array.Empty(); + + public string MIDIContents => string.Join(", ", MIDIs); + + public string MIDICountContents => string.Format(LanguageSystem.Instance.MIDICountContents, MIDIs.Length); + + public void Init() + { + _handlingController.Init(); + } + + void Handle(object sender, MidiMessageReceivedEventArgs args) + { + var input = args.Message; + var inputVariety = input.Type; + var rawInput = input.RawData; + var data = ArrayPool.Shared.Rent((int)rawInput.Length); + try + { + var dataLength = 0; + using (var r = DataReader.FromBuffer(rawInput)) + { + while (dataLength < rawInput.Length) + { + data[dataLength++] = r.ReadByte(); + } + } + if (ViewModels.Instance.ConfigureValue.IsOpened) + { + LastMIDI = $"{nameof(input.RawData)}: [{string.Join(", ", data.Take(dataLength))}], {nameof(input.Type)}: {inputVariety}"; + OnPropertyChanged(nameof(LastMIDI)); + } + switch (inputVariety) + { + case MidiMessageType.NoteOn: + _handlingController.Input(new MIDI + { + Data = MidiMessageType.NoteOn, + Value = data[1] + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, data[2] > 0, data[2]); + break; + case MidiMessageType.NoteOff: + _handlingController.Input(new MIDI + { + Data = MidiMessageType.NoteOn, + Value = data[1] + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, false, 0); + break; + case MidiMessageType.ControlChange: + _handlingController.Input(new MIDI + { + Data = MidiMessageType.ControlChange, + Value = data[1] + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, data[2] > 0, data[2]); + break; + case MidiMessageType.ProgramChange: + _handlingController.Input(new MIDI + { + Data = MidiMessageType.ProgramChange, + Value = data[1] + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, true, byte.MaxValue); + break; + case MidiMessageType.PitchBendChange: + var value = data[2]; + var mMIDIPBCSensitivity = 63 * Configure.Instance.MIDIPBCSensitivity / 100.0; + if (value > 127 - mMIDIPBCSensitivity) + { + _handlingController.Input(new MIDI + { + Data = MidiMessageType.PitchBendChange, + Value = 0 + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, false, byte.MaxValue); + _handlingController.Input(new MIDI + { + Data = MidiMessageType.PitchBendChange, + Value = 1 + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, true, byte.MaxValue); + } + else if (value < mMIDIPBCSensitivity + 1) + { + _handlingController.Input(new MIDI + { + Data = MidiMessageType.PitchBendChange, + Value = 1 + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, false, byte.MaxValue); + _handlingController.Input(new MIDI + { + Data = MidiMessageType.PitchBendChange, + Value = 0 + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, true, byte.MaxValue); + } + else + { + _handlingController.Input(new MIDI + { + Data = MidiMessageType.PitchBendChange, + Value = 0 + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, false, byte.MaxValue); + _handlingController.Input(new MIDI + { + Data = MidiMessageType.PitchBendChange, + Value = 1 + }, Configure.Instance.MIDIBundlesV4.StandardInputs, Configure.Instance.MIDIBundlesV4.Inputs, false, byte.MaxValue); + } + break; + } + } + finally + { + ArrayPool.Shared.Return(data); + } + } + + public async void GetMIDIs() + { + var rawMIDIControllers = (await Task.WhenAll((await DeviceInformation.FindAllAsync(MidiInPort.GetDeviceSelector())).Select(async data => (data.Name, await MidiInPort.FromIdAsync(data.Id))))).Where(inputController => inputController.Item2 != null).ToArray(); + Utility.SetUICollection(_rawMIDIControllers, rawMIDIControllers.Select(rawMIDIController => rawMIDIController.Item2).ToArray(), rawMIDIController => + { + try + { + using (rawMIDIController) + { + rawMIDIController.MessageReceived -= Handle; + } + _rawMIDIControllers.Remove(rawMIDIController); + } + catch + { + } + }, rawMIDIController => + { + rawMIDIController.MessageReceived += Handle; + _rawMIDIControllers.Add(rawMIDIController); + }); + MIDIs = rawMIDIControllers.Select(rawMIDIController => rawMIDIController.Name).ToArray(); + OnPropertyChanged(nameof(MIDIs)); + OnPropertyChanged(nameof(MIDIContents)); + OnPropertyChanged(nameof(MIDICountContents)); + } + + public void HandleSystem() + { + GetMIDIs(); + var w = DeviceInformation.CreateWatcher(MidiInPort.GetDeviceSelector()); + w.Added += (sender, args) => GetMIDIs(); + w.Removed += (sender, args) => GetMIDIs(); + w.Updated += (sender, args) => GetMIDIs(); + w.EnumerationCompleted += (sender, args) => GetMIDIs(); + w.Start(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/MediaInputSystem.cs b/Qwilight/Qwilight/System/MediaInputSystem.cs new file mode 100644 index 0000000..d651177 --- /dev/null +++ b/Qwilight/Qwilight/System/MediaInputSystem.cs @@ -0,0 +1,140 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using Windows.Graphics.Imaging; +using Windows.Media.Capture; +using Windows.Media.Capture.Frames; +using Windows.Media.MediaProperties; + +namespace Qwilight +{ + public sealed class MediaInputSystem : Model + { + public static readonly MediaInputSystem Instance = QwilightComponent.GetBuiltInData(nameof(MediaInputSystem)); + + readonly CanvasDevice _mediaFrameSystem = new CanvasDevice(); + MediaCapture _mediaInputSystem; + CanvasBitmap _mediaFrame; + MediaFrameReader _mediaInputComputer; + MediaInputItem? _mediaInputItem; + MediaInputQuality? _mediaInputQuality; + + public MediaInputItem? MediaInputItemValue + { + get => _mediaInputItem; + + set + { + if (SetProperty(ref _mediaInputItem, value, nameof(MediaInputItemValue)) && value.HasValue) + { + InitMediaInput(); + + async void InitMediaInput() + { + _mediaInputComputer = await _mediaInputSystem.CreateFrameReaderAsync(_mediaInputSystem.FrameSources[value.Value.ID], MediaEncodingSubtypes.Bgra8); + _mediaInputComputer.FrameArrived += OnMediaFrameAvailable; + await _mediaInputComputer.StartAsync(); + } + } + } + } + + public MediaInputQuality? MediaInputQualityValue + { + get => _mediaInputQuality; + + set + { + if (SetProperty(ref _mediaInputQuality, value, nameof(MediaInputQualityValue)) && value.HasValue) + { + SetMediaInputQuality(); + + async void SetMediaInputQuality() + { + await _mediaInputSystem.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoRecord, value.Value.Data); + } + } + } + } + + public ObservableCollection MediaInputQualityCollection { get; } = new(); + + public ObservableCollection MediaInputItemCollection { get; } = new(); + + public CanvasBitmap MediaFrame { get; set; } + + public MediaInputSystem() => GetMediaInputItems(); + + public void PaintMediaInput(CanvasDrawingSession targetSession, ref Bound r, float mediaInputFaint) + { + if (MediaFrame != null) + { + var mediaFrameBound = MediaFrame.Bounds; + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, mediaFrameBound.Width, mediaFrameBound.Height, r.Position0, r.Position1, r.Length, r.Height); + targetSession.PaintDrawing(ref r, MediaFrame, mediaInputFaint); + } + } + + public async void GetMediaInputItems() + { + if (Configure.Instance.MediaInput) + { + try + { + _mediaInputSystem?.Dispose(); + _mediaInputSystem = new MediaCapture(); + await _mediaInputSystem.InitializeAsync(new MediaCaptureInitializationSettings + { + MemoryPreference = MediaCaptureMemoryPreference.Cpu, + StreamingCaptureMode = StreamingCaptureMode.Video + }); + Utility.SetUICollection(MediaInputItemCollection, _mediaInputSystem.FrameSources.Select(pair => new MediaInputItem + { + ID = pair.Key, + Name = pair.Value.Info.DeviceInformation.Name + }).ToArray()); + Utility.SetUICollection(MediaInputQualityCollection, _mediaInputSystem.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.VideoRecord).Cast().Select(vep => new MediaInputQuality + { + Data = vep + }).Order().ToArray()); + } + catch + { + MediaInputItemCollection.Clear(); + MediaInputQualityCollection.Clear(); + } + MediaInputItemValue = MediaInputItemCollection.Count > 0 ? MediaInputItemCollection.First() : null; + MediaInputQualityValue = MediaInputQualityCollection.Count > 0 ? MediaInputQualityCollection.First() : null; + } + } + + public void CloseMediaInput() + { + _mediaInputComputer?.Dispose(); + _mediaInputSystem?.Dispose(); + } + + void OnMediaFrameAvailable(MediaFrameReader sender, MediaFrameArrivedEventArgs args) + { + try + { + using (var mediaFrame = sender.TryAcquireLatestFrame().VideoMediaFrame.SoftwareBitmap) + using (var mediaFrameModified = mediaFrame.BitmapPixelFormat != BitmapPixelFormat.Bgra8 || mediaFrame.BitmapAlphaMode != BitmapAlphaMode.Ignore ? SoftwareBitmap.Convert(mediaFrame, BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore) : mediaFrame) + { + _mediaFrame?.Dispose(); + _mediaFrame = CanvasBitmap.CreateFromSoftwareBitmap(_mediaFrameSystem, mediaFrameModified); + if (MediaFrame == null || MediaFrame.Bounds.Width != _mediaFrame.Bounds.Width || MediaFrame.Bounds.Height != _mediaFrame.Bounds.Height) + { + MediaFrame?.Dispose(); + MediaFrame = CanvasBitmap.CreateFromSoftwareBitmap(CanvasDevice.GetSharedDevice(), mediaFrameModified); + } + } + MediaFrame.CopyPixelsFromBitmap(_mediaFrame); + } + catch + { + } + } + } +} diff --git a/Qwilight/Qwilight/System/MediaSystem/HandledMediaItem.cs b/Qwilight/Qwilight/System/MediaSystem/HandledMediaItem.cs new file mode 100644 index 0000000..a262067 --- /dev/null +++ b/Qwilight/Qwilight/System/MediaSystem/HandledMediaItem.cs @@ -0,0 +1,24 @@ +using FFmpegInteropX; +using Windows.Media.Playback; + +namespace Qwilight +{ + public struct HandledMediaItem : IHandledItem, IDisposable + { + public FFmpegMediaSource MediaSrc { get; init; } + + public MediaPlayer Media { get; init; } + + public System.Windows.Media.MediaPlayer DefaultMedia { get; init; } + + public double Length { get; init; } + + public IHandlerItem Handle(IMediaHandler mediaHandler, TimeSpan levyingWait, MediaNote.Mode mode, bool isLooping) => MediaSystem.Instance.Handle(this, mediaHandler, levyingWait, mode, isLooping); + + public void Dispose() + { + Media.Dispose(); + HandlingUISystem.Instance.HandleParallel(DefaultMedia.Close); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/MediaSystem/IMediaContainer.cs b/Qwilight/Qwilight/System/MediaSystem/IMediaContainer.cs new file mode 100644 index 0000000..ceb597c --- /dev/null +++ b/Qwilight/Qwilight/System/MediaSystem/IMediaContainer.cs @@ -0,0 +1,9 @@ +namespace Qwilight +{ + public interface IMediaContainer + { + public MediaModifier MediaModifierValue { get; } + + public bool IsCounterWave { get; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/MediaSystem/IMediaHandler.cs b/Qwilight/Qwilight/System/MediaSystem/IMediaHandler.cs new file mode 100644 index 0000000..68aa466 --- /dev/null +++ b/Qwilight/Qwilight/System/MediaSystem/IMediaHandler.cs @@ -0,0 +1,13 @@ +namespace Qwilight +{ + public interface IMediaHandler + { + public double LoopingCounter { get; } + + public bool IsPausing { get; } + + public bool IsCounterWave { get; } + + public double AudioMultiplier { get; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/MediaSystem/MediaHandlerItem.cs b/Qwilight/Qwilight/System/MediaSystem/MediaHandlerItem.cs new file mode 100644 index 0000000..2cd12d4 --- /dev/null +++ b/Qwilight/Qwilight/System/MediaSystem/MediaHandlerItem.cs @@ -0,0 +1,146 @@ +using Microsoft.Graphics.Canvas; +using Windows.Graphics.Imaging; +using Windows.Media.Playback; + +namespace Qwilight +{ + public sealed class MediaHandlerItem : IHandlerItem, IDisposable + { + CanvasBitmap _mediaFrame; + + public HandledMediaItem HandledMediaItem { get; set; } + + public TimeSpan LevyingPosition { get; set; } + + public MediaNote.Mode Mode { get; set; } + + public bool IsAvailable { get; set; } + + public bool IsDefaultAvailable { get; set; } + + public bool IsLooping { get; set; } + + public bool IsHandling { get; set; } + + public bool IsDefaultHandling { get; set; } + + public bool IsVisible { get; set; } + + public CanvasBitmap MediaFrame { get; set; } + + public IHandledItem Value => HandledMediaItem; + + public double GetMediaPosition(IMediaHandler mediaHandler) => (mediaHandler.LoopingCounter - LevyingPosition.TotalMilliseconds) % (IsLooping ? HandledMediaItem.Length : double.PositiveInfinity); + + public void Handle(IMediaHandler mediaHandler, double mediaPosition) + { + if (mediaPosition < HandledMediaItem.Length) + { + HandledMediaItem.Media.PlaybackSession.Position = TimeSpan.Zero; + HandledMediaItem.Media.PlaybackSession.Position = TimeSpan.FromMilliseconds(mediaPosition); + HandledMediaItem.Media.PlaybackSession.PlaybackRate = mediaHandler.AudioMultiplier; + HandledMediaItem.Media.VideoFrameAvailable += OnMediaFrameAvailable; + HandledMediaItem.Media.Play(); + IsHandling = true; + } + } + + public void Stop() + { + HandledMediaItem.Media.VideoFrameAvailable -= OnMediaFrameAvailable; + HandledMediaItem.Media.Pause(); + IsHandling = false; + } + + void OnMediaFrameAvailable(MediaPlayer sender, object args) + { + try + { + if (_mediaFrame == null && MediaFrame == null) + { + var mediaSession = sender.PlaybackSession; + using var mediaFrame = new SoftwareBitmap(BitmapPixelFormat.Bgra8, (int)mediaSession.NaturalVideoWidth, (int)mediaSession.NaturalVideoHeight, BitmapAlphaMode.Ignore); + _mediaFrame = CanvasBitmap.CreateFromSoftwareBitmap(new CanvasDevice(), mediaFrame); + MediaFrame = CanvasBitmap.CreateFromSoftwareBitmap(CanvasDevice.GetSharedDevice(), mediaFrame); + } + sender.CopyFrameToVideoSurface(_mediaFrame); + MediaFrame.CopyPixelsFromBitmap(_mediaFrame); + } + catch + { + } + } + + public void Pause(bool isPaused) + { + if (isPaused) + { + HandledMediaItem.Media.Pause(); + } + else + { + HandledMediaItem.Media.Play(); + } + } + + public void SetMediaPosition(double mediaPosition) + { + if (Math.Abs(HandledMediaItem.Media.PlaybackSession.Position.TotalMilliseconds - mediaPosition) >= 500.0) + { + HandledMediaItem.Media.PlaybackSession.Position = TimeSpan.FromMilliseconds(mediaPosition); + } + } + + public void HandleDefault(IMediaHandler mediaHandler, double mediaPosition) + { + if (mediaPosition < HandledMediaItem.Length) + { + HandlingUISystem.Instance.HandleParallel(() => + { + HandledMediaItem.DefaultMedia.Position = TimeSpan.FromMilliseconds(mediaPosition); + HandledMediaItem.DefaultMedia.SpeedRatio = mediaHandler.AudioMultiplier; + HandledMediaItem.DefaultMedia.Play(); + }); + IsDefaultHandling = true; + } + } + + public void StopDefault() + { + HandlingUISystem.Instance.HandleParallel(HandledMediaItem.DefaultMedia.Stop); + IsDefaultHandling = false; + } + + public void PauseDefault(bool isPaused) + { + if (isPaused) + { + HandlingUISystem.Instance.HandleParallel(HandledMediaItem.DefaultMedia.Pause); + } + else + { + HandlingUISystem.Instance.HandleParallel(HandledMediaItem.DefaultMedia.Play); + } + } + + public void SetDefaultMediaPosition(double mediaPosition) + { + HandlingUISystem.Instance.HandleParallel(() => + { + if (Math.Abs(HandledMediaItem.DefaultMedia.Position.TotalMilliseconds - mediaPosition) >= 500.0) + { + HandledMediaItem.DefaultMedia.Position = TimeSpan.FromMilliseconds(mediaPosition); + } + }); + } + + public void Dispose() + { + _mediaFrame?.Dispose(); + _mediaFrame?.Device?.Dispose(); + _mediaFrame = null; + _mediaFrame?.Dispose(); + _mediaFrame = null; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/MediaSystem/MediaNote.cs b/Qwilight/Qwilight/System/MediaSystem/MediaNote.cs new file mode 100644 index 0000000..0900644 --- /dev/null +++ b/Qwilight/Qwilight/System/MediaSystem/MediaNote.cs @@ -0,0 +1,24 @@ +namespace Qwilight +{ + public struct MediaNote + { + public enum Mode + { + Default, + Layer, + Failed + } + + public Mode MediaMode { get; set; } + + public bool IsLooping { get; set; } + + public IHandledItem MediaItem { get; set; } + + public bool HasContents { get; set; } + + public TimeSpan MediaLevyingPosition { get; set; } + + public double Length { get; set; } + } +} diff --git a/Qwilight/Qwilight/System/MediaSystem/MediaSystem.cs b/Qwilight/Qwilight/System/MediaSystem/MediaSystem.cs new file mode 100644 index 0000000..3293955 --- /dev/null +++ b/Qwilight/Qwilight/System/MediaSystem/MediaSystem.cs @@ -0,0 +1,377 @@ +using FFmpegInteropX; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.Concurrent; +using System.IO; +using MediaPlayer = System.Windows.Media.MediaPlayer; + +namespace Qwilight +{ + public sealed class MediaSystem + { + public static readonly MediaSystem Instance = new(); + + static readonly object _exeCSX = new(); + static readonly string[] _wrongMedia = new string[] + { + "ed7f217838d78942898e53d5dbee64ec", // Celestial Axes + "095bf7b6bc3eb3c06b3569f5b0247163" // キミとボクへの葬送歌 + }; + + readonly ConcurrentDictionary> _mediaMap = new(); + readonly ConcurrentDictionary> _mediaHandlerMap = new(); + + public int MediaItemCount => _mediaMap.Values.Sum(mediaItems => mediaItems.Count); + + public int MediaHandlerItemCount => _mediaHandlerMap.Values.Sum(mediaHandlerItems => mediaHandlerItems.Count); + + public void Pause(IMediaHandler mediaHandler, bool isPaused) + { + if (Configure.Instance.Media && _mediaHandlerMap.TryGetValue(mediaHandler, out var mediaHandlerItems)) + { + var isNoteFileMode = ViewModels.Instance.MainValue.IsNoteFileMode; + foreach (var mediaHandlerItem in mediaHandlerItems) + { + if (isNoteFileMode) + { + mediaHandlerItem.PauseDefault(isPaused); + } + else + { + mediaHandlerItem.Pause(isPaused); + } + } + } + } + + public void SetAudioMultiplier(IMediaHandler mediaHandler) + { + if (Configure.Instance.Media && _mediaHandlerMap.TryGetValue(mediaHandler, out var mediaHandlerItems)) + { + foreach (var mediaHandlerItem in mediaHandlerItems) + { + if (ViewModels.Instance.MainValue.IsWPFViewVisible) + { + HandlingUISystem.Instance.HandleParallel(() => mediaHandlerItem.HandledMediaItem.DefaultMedia.SpeedRatio = mediaHandler.AudioMultiplier); + } + else + { + mediaHandlerItem.HandledMediaItem.Media.PlaybackSession.PlaybackRate = mediaHandler.AudioMultiplier; + } + } + } + } + + public void SetMediaPosition(IMediaHandler mediaHandler) + { + if (Configure.Instance.Media && _mediaHandlerMap.TryGetValue(mediaHandler, out var mediaHandlerItems)) + { + foreach (var mediaHandlerItem in mediaHandlerItems) + { + if (mediaHandlerItem.IsVisible && !mediaHandlerItem.IsLooping) + { + if (ViewModels.Instance.MainValue.IsWPFViewVisible) + { + if (mediaHandlerItem.IsDefaultHandling) + { + mediaHandlerItem.SetDefaultMediaPosition(mediaHandlerItem.GetMediaPosition(mediaHandler)); + } + } + else + { + if (mediaHandlerItem.IsHandling) + { + mediaHandlerItem.SetMediaPosition(mediaHandlerItem.GetMediaPosition(mediaHandler)); + } + } + } + } + } + } + + public HandledMediaItem Load(string mediaFilePath, IMediaContainer mediaContainer) + { + var isCounterWave = mediaContainer.IsCounterWave; + var hash = $"{(isCounterWave ? '@' : string.Empty)}{Utility.GetID128s(File.ReadAllBytes(mediaFilePath))}"; + if (_mediaMap.TryGetValue(mediaContainer, out var handledMediaItems) && handledMediaItems.TryGetValue(hash, out var handledMediaItem)) + { + return handledMediaItem; + } + + var mediaSrc = Utility.Await(FFmpegMediaSource.CreateFromFileAsync(mediaFilePath)); + var mediaModifierValue = mediaContainer.MediaModifierValue; + if (mediaModifierValue != null) + { + lock (_exeCSX) + { + var hashFilePath = Utility.GetAvailable(Path.Combine(QwilightComponent.MediaEntryPath, hash), Utility.AvailableFlag.Media); + if (File.Exists(hashFilePath)) + { + mediaFilePath = hashFilePath; + } + else + { + var isWrongMedia = Array.IndexOf(_wrongMedia, hash) != -1; + var hasAudio = mediaSrc.AudioStreams.Count > 0; + if (isWrongMedia || hasAudio || isCounterWave) + { + mediaSrc.Dispose(); + mediaSrc = null; + hashFilePath = Path.ChangeExtension(Path.Combine(QwilightComponent.MediaEntryPath, hash), isWrongMedia || isCounterWave ? ".mkv" : Path.GetExtension(mediaFilePath)); + mediaModifierValue.ModifyMedia(mediaFilePath, hashFilePath, isWrongMedia, isCounterWave); + mediaFilePath = hashFilePath; + } + } + } + } + mediaSrc ??= Utility.Await(FFmpegMediaSource.CreateFromFileAsync(mediaFilePath)); + var mediaLength = mediaSrc.Duration.TotalMilliseconds; + handledMediaItem = new() + { + MediaSrc = mediaSrc, + Media = new() + { + Source = mediaSrc.CreateMediaPlaybackItem(), + IsMuted = true, + IsVideoFrameServerEnabled = true + }, + DefaultMedia = HandlingUISystem.Instance.Handle(() => + { + var defaultMedia = new MediaPlayer + { + IsMuted = true + }; + defaultMedia.Open(new(mediaFilePath)); + defaultMedia.Stop(); + return defaultMedia; + }), + Length = mediaLength > 0.0 ? mediaLength : double.PositiveInfinity + }; + handledMediaItem.Media.CommandManager.IsEnabled = false; + handledMediaItem.Media.SystemMediaTransportControls.IsEnabled = false; + _mediaMap.AddOrUpdate(mediaContainer, (mediaContainer, handledMediaItem) => new(new[] { KeyValuePair.Create(hash, handledMediaItem) }), (mediaContainer, handledMediaItems, handledMediaItem) => + { + handledMediaItems[hash] = handledMediaItem; + return handledMediaItems; + }, handledMediaItem); + return handledMediaItem; + } + + public void Stop(IMediaHandler mediaHandler) + { + if (_mediaHandlerMap.TryRemove(mediaHandler, out var mediaHandlerItems)) + { + foreach (var mediaHandlerItem in mediaHandlerItems) + { + mediaHandlerItem.Stop(); + mediaHandlerItem.StopDefault(); + } + } + } + + public MediaHandlerItem Handle(HandledMediaItem handledMediaItem, IMediaHandler mediaHandler, TimeSpan levyingWait, MediaNote.Mode mode, bool isLooping) + { + if (!isLooping) + { + switch (handledMediaItem.MediaSrc.VideoStreams[0].CodecName) + { + case "mpeg1video": + levyingWait -= TimeSpan.FromMilliseconds(500.0); + break; + } + } + handledMediaItem.Media.IsLoopingEnabled = isLooping; + var mediaHandlerItem = new MediaHandlerItem + { + HandledMediaItem = handledMediaItem, + LevyingPosition = levyingWait, + Mode = mode, + IsLooping = isLooping, + IsHandling = false, + IsDefaultHandling = false, + IsVisible = false + }; + if (isLooping) + { + HandlingUISystem.Instance.HandleParallel(() => + { + handledMediaItem.DefaultMedia.MediaEnded += (sender, e) => + { + handledMediaItem.DefaultMedia.Stop(); + handledMediaItem.DefaultMedia.Play(); + }; + }); + } + _mediaHandlerMap.AddOrUpdate(mediaHandler, (mediaHandler, t) => new() + { + t.mediaHandlerItem + }, (mediaHandler, mediaHandlerItems, t) => + { + var mode = t.mode; + foreach (var mediaHandlerItem in mediaHandlerItems) + { + if (mediaHandlerItem.IsVisible) + { + if (mediaHandlerItem.Mode == mode) + { + if (mediaHandlerItem.IsDefaultHandling) + { + mediaHandlerItem.StopDefault(); + } + if (mediaHandlerItem.IsHandling) + { + mediaHandlerItem.Stop(); + } + } + t.mediaHandlerItem.IsVisible = false; + } + } + mediaHandlerItems.Add(mediaHandlerItem); + return mediaHandlerItems; + }, (mediaHandlerItem, mode)); + + if (Configure.Instance.Media) + { + var mediaPosition = mediaHandlerItem.GetMediaPosition(mediaHandler); + if (ViewModels.Instance.MainValue.IsNoteFileMode) + { + mediaHandlerItem.HandleDefault(mediaHandler, mediaPosition); + } + else + { + mediaHandlerItem.Handle(mediaHandler, mediaPosition); + } + } + + mediaHandlerItem.IsVisible = true; + return mediaHandlerItem; + } + + public MediaHandlerItem Handle(HandledMediaItem handledMediaItem, IMediaHandler mediaHandler, bool isAvailable, bool isDefaultAvailable) + { + handledMediaItem.Media.IsLoopingEnabled = true; + var mediaHandlerItem = new MediaHandlerItem + { + HandledMediaItem = handledMediaItem, + LevyingPosition = TimeSpan.Zero, + Mode = MediaNote.Mode.Default, + IsLooping = true, + IsAvailable = isAvailable, + IsDefaultAvailable = isDefaultAvailable + }; + HandlingUISystem.Instance.HandleParallel(() => + { + handledMediaItem.DefaultMedia.MediaEnded += (sender, e) => + { + handledMediaItem.DefaultMedia.Stop(); + handledMediaItem.DefaultMedia.Play(); + }; + }); + _mediaHandlerMap.AddOrUpdate(mediaHandler, (mediaHandler, mediaHandlerItem) => new() + { + mediaHandlerItem + }, (mediaHandler, mediaHandlerItems, mediaHandlerItem) => + { + mediaHandlerItems.Add(mediaHandlerItem); + return mediaHandlerItems; + }, mediaHandlerItem); + + var mainViewModel = ViewModels.Instance.MainValue; + if (mainViewModel.IsNoteFileMode && isDefaultAvailable) + { + mediaHandlerItem.HandleDefault(mediaHandler, 0.0); + } + if (mainViewModel.IsQuitMode && isAvailable) + { + mediaHandlerItem.Handle(mediaHandler, 0.0); + } + + mediaHandlerItem.IsVisible = true; + return mediaHandlerItem; + } + + public void HandleIfAvailable(IMediaHandler mediaHandler) + { + if (!mediaHandler.IsPausing && _mediaHandlerMap.TryGetValue(mediaHandler, out var mediaHandlerItems)) + { + var mainViewModel = ViewModels.Instance.MainValue; + var isNoteFileMode = mainViewModel.IsNoteFileMode; + var isQuitMode = mainViewModel.IsQuitMode; + foreach (var mediaHandlerItem in mediaHandlerItems) + { + if (mediaHandlerItem.IsVisible) + { + if (mediaHandler == BaseUI.Instance ? isQuitMode && mediaHandlerItem.IsAvailable : !isNoteFileMode && Configure.Instance.Media) + { + if (!mediaHandlerItem.IsHandling) + { + mediaHandlerItem.Handle(mediaHandler, mediaHandlerItem.GetMediaPosition(mediaHandler)); + } + } + else + { + if (mediaHandlerItem.IsHandling) + { + mediaHandlerItem.Stop(); + } + } + } + } + } + } + + public void HandleDefaultIfAvailable(IMediaHandler mediaHandler) + { + if (!mediaHandler.IsPausing && _mediaHandlerMap.TryGetValue(mediaHandler, out var mediaHandlerItems)) + { + var isNoteFileMode = ViewModels.Instance.MainValue.IsNoteFileMode; + foreach (var mediaHandlerItem in mediaHandlerItems) + { + if (mediaHandlerItem.IsVisible) + { + if (isNoteFileMode && (mediaHandler == BaseUI.Instance ? mediaHandlerItem.IsDefaultAvailable : Configure.Instance.Media)) + { + if (!mediaHandlerItem.IsDefaultHandling) + { + mediaHandlerItem.HandleDefault(mediaHandler, mediaHandlerItem.GetMediaPosition(mediaHandler)); + } + } + else + { + if (mediaHandlerItem.IsDefaultHandling) + { + mediaHandlerItem.StopDefault(); + } + } + } + } + } + } + + public void Close(IMediaContainer mediaContainer, IMediaHandler mediaHandler) + { + if (_mediaMap.TryRemove(mediaContainer, out var mediaItems)) + { + foreach (var mediaItem in mediaItems) + { + mediaItem.Value.Dispose(); + } + } + if (_mediaHandlerMap.TryRemove(mediaHandler, out var mediaHandlerItems)) + { + foreach (var mediaHandlerItem in mediaHandlerItems) + { + mediaHandlerItem.Dispose(); + } + } + } + + public void Migrate(IMediaContainer src, IMediaContainer target) + { + if (_mediaMap.TryRemove(src, out var audioItems)) + { + _mediaMap[target] = audioItems; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/NotifySystem.cs b/Qwilight/Qwilight/System/NotifySystem.cs new file mode 100644 index 0000000..08f0b0f --- /dev/null +++ b/Qwilight/Qwilight/System/NotifySystem.cs @@ -0,0 +1,122 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; + +namespace Qwilight +{ + public sealed class NotifySystem + { + public const int ModeComponentID = 0; + + public enum NotifyVariety + { + OK, Fault, Warning, Info, Levying, Stopped, Quit + } + + public enum NotifyConfigure + { + Default, Save, NotSave + } + + public static readonly NotifySystem Instance = new(); + + int _toNotifyID = 1; + + public void NotifyPending() => HandlingUISystem.Instance.HandleParallel(() => + { + var toNotifyCount = ViewModels.Instance.NotifyValue.NotifyItemCollection.Count(toNotifyItem => + { + var isNew = toNotifyItem.IsNew; + toNotifyItem.IsNew = false; + return isNew; + }); + if (toNotifyCount > 0) + { + Notify(NotifyVariety.Info, NotifyConfigure.NotSave, string.Format(LanguageSystem.Instance.WaitingNotifyContents, toNotifyCount)); + } + }); + + public void Notify(NotifyVariety toNotifyVariety, NotifyConfigure toNotifyConfigure, string toNotify, bool allowComputingMode = true, string audioAlt = null, Action onHandle = null, int toNotifyID = -1) + { + HandlingUISystem.Instance.HandleParallel(() => + { + switch (toNotifyConfigure) + { + case NotifyConfigure.Default: + Save(toNotifyVariety, toNotify, !Notify()); + break; + case NotifyConfigure.Save: + Save(toNotifyVariety, toNotify, true); + break; + case NotifyConfigure.NotSave: + Notify(); + break; + } + }); + + bool Notify() + { + if (allowComputingMode || !ViewModels.Instance.MainValue.IsComputingMode) + { + if (audioAlt == null || audioAlt.Length > 0) + { + switch (toNotifyVariety) + { + case NotifyVariety.OK: + Utility.HandleUIAudio(audioAlt ?? "Notify OK", "Notify"); + break; + case NotifyVariety.Info: + Utility.HandleUIAudio(audioAlt ?? "Notify", "Notify"); + break; + case NotifyVariety.Fault: + Utility.HandleUIAudio(audioAlt ?? "Notify Fault", "Notify"); + break; + case NotifyVariety.Warning: + Utility.HandleUIAudio(audioAlt ?? "Notify Warning", "Notify"); + break; + } + } + ViewModels.Instance.NotifyXamlValue.PutNotify(new() + { + Variety = toNotifyVariety, + Paint = toNotifyVariety switch + { + NotifyVariety.OK => Paints.PaintOK, + NotifyVariety.Info => Paints.PaintInfo, + NotifyVariety.Fault => Paints.PaintFault, + NotifyVariety.Warning => Paints.PaintWarning, + _ => default + }, + Color = toNotifyVariety switch + { + NotifyVariety.OK => Paints.ColorOK, + NotifyVariety.Info => Paints.ColorInfo, + NotifyVariety.Fault => Paints.ColorFault, + NotifyVariety.Warning => Paints.ColorWarning, + _ => default + }, + Contents = toNotify, + OnHandle = onHandle, + ID = toNotifyID != -1 ? toNotifyID : ++_toNotifyID + }); + return true; + } + return false; + } + void Save(NotifyVariety toNotifyVariety, string toNotify, bool isNew) + { + var toNotifyCollection = ViewModels.Instance.NotifyValue.NotifyItemCollection; + if (toNotifyCollection.Count == 100) + { + toNotifyCollection.RemoveAt(99); + } + toNotifyCollection.Insert(0, new() + { + Variety = toNotifyVariety, + Text = toNotify, + IsNew = isNew, + OnHandle = onHandle + }); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/PIDClass.cs b/Qwilight/Qwilight/System/PIDClass.cs new file mode 100644 index 0000000..88169e4 --- /dev/null +++ b/Qwilight/Qwilight/System/PIDClass.cs @@ -0,0 +1,72 @@ +using Qwilight.Utilities; +#if !DEBUG +using System.Diagnostics; +#endif +using System.IO; +using System.Text; +using System.Windows; +#if !DEBUG +using Windows.Win32; +using Windows.Win32.Foundation; +using Windows.Win32.UI.WindowsAndMessaging; +#endif + +namespace Qwilight +{ + public sealed class PIDClass : IDisposable + { + public static readonly PIDClass Instance = new(); + public static readonly string FilePath = Path.Combine(QwilightComponent.QwilightEntryPath, "Qwilight.#"); + + Stream _fs; + + public void HaveIt(SplashScreen wpfLoadingAsset) + { + try + { + _fs = File.Open(FilePath, FileMode.Create, FileAccess.Write, FileShare.Read); + _fs.Write(Encoding.UTF8.GetBytes(Environment.ProcessId.ToString())); + _fs.Flush(); + } + catch + { +#if !DEBUG + switch (PInvoke.MessageBox(HWND.Null, $"Qwilight is already running", "Qwilight", MESSAGEBOX_STYLE.MB_CANCELTRYCONTINUE | MESSAGEBOX_STYLE.MB_ICONQUESTION)) + { + case MESSAGEBOX_RESULT.IDCANCEL: + wpfLoadingAsset.Show(true, true); + Environment.Exit(1); + break; + case MESSAGEBOX_RESULT.IDTRYAGAIN: + wpfLoadingAsset.Show(true, true); + try + { + using var sr = new StreamReader(File.Open(FilePath, FileMode.Open, FileAccess.Read, FileShare.Write)); + Process.GetProcessById(Utility.ToInt32(sr.ReadToEnd())).Kill(); + } + catch + { + } + Utility.WaitUntilCanOpen(FilePath, 1000.0); + HaveIt(wpfLoadingAsset); + break; + case MESSAGEBOX_RESULT.IDCONTINUE: + wpfLoadingAsset.Show(true, true); + HaveIt(wpfLoadingAsset); + break; + } +#endif + } + } + + public void Dispose() + { +#if DEBUG + _fs?.Dispose(); +#else + _fs.Dispose(); +#endif + Utility.WipeFile(FilePath); + } + } +} diff --git a/Qwilight/Qwilight/System/PlatformSystem.cs b/Qwilight/Qwilight/System/PlatformSystem.cs new file mode 100644 index 0000000..ae675d7 --- /dev/null +++ b/Qwilight/Qwilight/System/PlatformSystem.cs @@ -0,0 +1,73 @@ +using DiscordRPC; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.IO; + +namespace Qwilight +{ + public sealed class PlatformSystem + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(PlatformSystem)); + + public static readonly PlatformSystem Instance = new(); + + readonly Timestamps _time = Timestamps.Now; + + public void HandleSystem() + { + var mainViewModel = ViewModels.Instance.MainValue; + var time = new Timestamps(); + var data = new RichPresence + { + Assets = new() + { + LargeImageKey = "qwilight", + } + }; + while (true) + { + try + { + using var targetSystem = new DiscordRpcClient(QwilightComponent.AssetsClientJSON.platform); + if (targetSystem.Initialize()) + { + while (true) + { + var defaultComputer = mainViewModel.Computer; + switch (mainViewModel.ModeValue) + { + case MainViewModel.Mode.NoteFile: + var autoComputer = mainViewModel.AutoComputer; + data.State = LanguageSystem.Instance.PlatformNoteFileMode; + data.Details = autoComputer?.IsHandling == true ? autoComputer.PlatformText128 : "Idle"; + data.Timestamps = _time; + break; + case MainViewModel.Mode.Computing: + data.State = defaultComputer.PlatformVarietyContents; + data.Details = defaultComputer.PlatformText128; + time.StartUnixMilliseconds = (ulong)(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - Math.Clamp(defaultComputer.LoopingCounter, 0, defaultComputer.Length)); + data.Timestamps = time; + break; + case MainViewModel.Mode.Quit: + data.State = LanguageSystem.Instance.PlatformQuitMode; + data.Details = defaultComputer.PlatformText128; + data.Timestamps = _time; + break; + } + targetSystem.SetPresence(data); + Thread.Sleep(1000); + } + } + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + finally + { + Thread.Sleep(1000); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/PoolSystem/DefaultTextID.cs b/Qwilight/Qwilight/System/PoolSystem/DefaultTextID.cs new file mode 100644 index 0000000..4305c4c --- /dev/null +++ b/Qwilight/Qwilight/System/PoolSystem/DefaultTextID.cs @@ -0,0 +1,25 @@ +using System.Windows.Media; + +namespace Qwilight +{ + public struct DefaultTextID : IEquatable + { + public string text; + public double fontLength; + public double textLength; + public Brush fontPaint; + + public override bool Equals(object obj) => obj is DefaultTextID defaultTextID && Equals(defaultTextID); + + public bool Equals(DefaultTextID other) => text == other.text && + fontLength == other.fontLength && + textLength == other.textLength && + fontPaint == other.fontPaint; + + public override int GetHashCode() => HashCode.Combine(text, fontLength, textLength, fontPaint); + + public static bool operator ==(DefaultTextID left, DefaultTextID right) => left.Equals(right); + + public static bool operator !=(DefaultTextID left, DefaultTextID right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/System/PoolSystem/FormattedTextID.cs b/Qwilight/Qwilight/System/PoolSystem/FormattedTextID.cs new file mode 100644 index 0000000..9df535a --- /dev/null +++ b/Qwilight/Qwilight/System/PoolSystem/FormattedTextID.cs @@ -0,0 +1,25 @@ +namespace Qwilight +{ + public struct FormattedTextID : IEquatable + { + public string textFormat; + public string param0; + public string param1; + public string param2; + public string param3; + + public override bool Equals(object obj) => obj is FormattedTextID formattedTextID && Equals(formattedTextID); + + public bool Equals(FormattedTextID other) => textFormat == other.textFormat && + param0 == other.param0 && + param1 == other.param1 && + param2 == other.param2 && + param3 == other.param3; + + public override int GetHashCode() => HashCode.Combine(textFormat, param0, param1, param2, param3); + + public static bool operator ==(FormattedTextID left, FormattedTextID right) => left.Equals(right); + + public static bool operator !=(FormattedTextID left, FormattedTextID right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/System/PoolSystem/PoolSystem.cs b/Qwilight/Qwilight/System/PoolSystem/PoolSystem.cs new file mode 100644 index 0000000..93f74e2 --- /dev/null +++ b/Qwilight/Qwilight/System/PoolSystem/PoolSystem.cs @@ -0,0 +1,170 @@ +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.IO; +using Qwilight.Utilities; +using System.Collections.Concurrent; +using System.Globalization; +using System.IO; +using System.Windows; +using System.Windows.Media; +using Windows.Graphics.DirectX; + +namespace Qwilight +{ + public sealed class PoolSystem + { + public static readonly PoolSystem Instance = new(); + + readonly RecyclableMemoryStreamManager _rmsm = new(); + readonly Dictionary _textItems = new(); + readonly Dictionary _defaultTextItems = new(); + readonly Dictionary _targetItems = new(); + readonly ConcurrentDictionary, string> _valueIntTexts = new(); + readonly ConcurrentDictionary, string> _valueFloat64Texts = new(); + readonly ConcurrentDictionary _formattedTexts = new(); + readonly ConcurrentDictionary _formattedUnitTexts = new(); + + PoolSystem() + { + _rmsm.GenerateCallStacks = !QwilightComponent.IsVS; + _rmsm.AggressiveBufferReturn = true; + _rmsm.MaximumFreeSmallPoolBytes = _rmsm.LargeBufferMultiple * 4; + _rmsm.MaximumFreeLargePoolBytes = 100 * _rmsm.BlockSize; + } + + public MemoryStream GetDataFlow() + { + return _rmsm.GetStream(); + } + + public MemoryStream GetDataFlow(int dataLength) + { + return _rmsm.GetStream(null, dataLength); + } + + public MemoryStream GetDataFlow(byte[] data) + { + return _rmsm.GetStream(data); + } + + public CanvasRenderTarget GetTargetItem(float targetLength, float targetHeight) + { + var targetID = new TargetID + { + targetLength = targetLength, + targetHeight = targetHeight + }; + if (!_targetItems.TryGetValue(targetID, out var targetItem)) + { + targetItem = new(CanvasDevice.GetSharedDevice(), targetLength, targetHeight, 96F, DirectXPixelFormat.B8G8R8A8UIntNormalized, CanvasAlphaMode.Ignore); + _targetItems[targetID] = targetItem; + } + return targetItem; + } + + public CanvasTextLayout GetTextItem(string text, CanvasTextFormat font, float textLength = 0F, float textHeight = 0F) + { + var textID = new TextID + { + text = text, + fontLength = font.FontSize, + textLength = textLength, + textHeight = textHeight, + textSystem0 = font.HorizontalAlignment, + textSystem1 = font.VerticalAlignment, + }; + if (!_textItems.TryGetValue(textID, out var textItem)) + { + textItem = new(CanvasDevice.GetSharedDevice(), text, font, textLength, textHeight); + if (textLength > 0F && textHeight > 0F) + { + textItem.Options = CanvasDrawTextOptions.Clip; + } + _textItems[textID] = textItem; + } + return textItem; + } + + public FormattedText GetDefaultTextItem(string text, double fontLength, Brush fontPaint, double textLength = 0.0) + { + var defaultTextID = new DefaultTextID + { + text = text, + fontLength = fontLength, + textLength = textLength, + fontPaint = fontPaint + }; + if (!_defaultTextItems.TryGetValue(defaultTextID, out var defaultTextItem)) + { + defaultTextItem = new(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, Configure.Instance.FontFace, fontLength, fontPaint, 96.0) + { + MaxLineCount = 1 + }; + if (textLength > 0.0) + { + defaultTextItem.SetMaxTextWidths(new[] { textLength }); + } + _defaultTextItems[defaultTextID] = defaultTextItem; + } + return defaultTextItem; + } + + public string GetValueText(int value, string textFormat) + { + var valueTextID = new ValueTextID + { + value = value, + textFormat = textFormat + }; + if (!_valueIntTexts.TryGetValue(valueTextID, out var valueText)) + { + valueText = string.IsNullOrEmpty(textFormat) ? value.ToString() : value.ToString(textFormat); + _valueIntTexts[valueTextID] = valueText; + } + return valueText; + } + + public string GetValueText(double value, string textFormat) + { + var valueTextID = new ValueTextID + { + value = value, + textFormat = textFormat + }; + if (!_valueFloat64Texts.TryGetValue(valueTextID, out var valueText)) + { + valueText = string.IsNullOrEmpty(textFormat) ? value.ToString() : value.ToString(textFormat); + _valueFloat64Texts[valueTextID] = valueText; + } + return valueText; + } + + public string GetFormattedText(string textFormat, string param0, string param1 = null, string param2 = null, string param3 = null) + { + var formattedTextID = new FormattedTextID + { + textFormat = textFormat, + param0 = param0, + param1 = param1, + param2 = param2, + param3 = param3, + }; + if (!_formattedTexts.TryGetValue(formattedTextID, out var formattedText)) + { + formattedText = string.Format(textFormat, param0, param1, param2, param3); + _formattedTexts[formattedTextID] = formattedText; + } + return formattedText; + } + + public string GetFormattedUnitText(long value) + { + if (!_formattedUnitTexts.TryGetValue(value, out var formattedUnitText)) + { + formattedUnitText = Utility.FormatUnit(value); + _formattedUnitTexts[value] = formattedUnitText; + } + return formattedUnitText; + } + } +} diff --git a/Qwilight/Qwilight/System/PoolSystem/TargetID.cs b/Qwilight/Qwilight/System/PoolSystem/TargetID.cs new file mode 100644 index 0000000..1c65ea4 --- /dev/null +++ b/Qwilight/Qwilight/System/PoolSystem/TargetID.cs @@ -0,0 +1,19 @@ +namespace Qwilight +{ + public struct TargetID : IEquatable + { + public float targetLength; + public float targetHeight; + + public override bool Equals(object obj) => obj is TargetID targetID && Equals(targetID); + + public bool Equals(TargetID other) => targetLength == other.targetLength && + targetHeight == other.targetHeight; + + public override int GetHashCode() => HashCode.Combine(targetLength, targetHeight); + + public static bool operator ==(TargetID left, TargetID right) => left.Equals(right); + + public static bool operator !=(TargetID left, TargetID right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/System/PoolSystem/TextID.cs b/Qwilight/Qwilight/System/PoolSystem/TextID.cs new file mode 100644 index 0000000..44f8dab --- /dev/null +++ b/Qwilight/Qwilight/System/PoolSystem/TextID.cs @@ -0,0 +1,29 @@ +using Microsoft.Graphics.Canvas.Text; + +namespace Qwilight +{ + public struct TextID : IEquatable + { + public string text; + public float fontLength; + public float textLength; + public float textHeight; + public CanvasHorizontalAlignment textSystem0; + public CanvasVerticalAlignment textSystem1; + + public override bool Equals(object obj) => obj is TextID textID && Equals(textID); + + public bool Equals(TextID other) => text == other.text && + fontLength == other.fontLength && + textLength == other.textLength && + textHeight == other.textHeight && + textSystem0 == other.textSystem0 && + textSystem1 == other.textSystem1; + + public override int GetHashCode() => HashCode.Combine(text, fontLength, textLength, textHeight, textSystem0, textSystem1); + + public static bool operator ==(TextID left, TextID right) => left.Equals(right); + + public static bool operator !=(TextID left, TextID right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/System/PoolSystem/ValueTextID.cs b/Qwilight/Qwilight/System/PoolSystem/ValueTextID.cs new file mode 100644 index 0000000..40ac974 --- /dev/null +++ b/Qwilight/Qwilight/System/PoolSystem/ValueTextID.cs @@ -0,0 +1,18 @@ +namespace Qwilight +{ + public struct ValueTextID : IEquatable> where T : IEquatable + { + public T value; + public string textFormat; + + public override bool Equals(object obj) => obj is ValueTextID valueTextID && Equals(valueTextID); + + public bool Equals(ValueTextID other) => value.Equals(other.value) && textFormat == other.textFormat; + + public override int GetHashCode() => HashCode.Combine(value, textFormat); + + public static bool operator ==(ValueTextID left, ValueTextID right) => left.Equals(right); + + public static bool operator !=(ValueTextID left, ValueTextID right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/System/StillSystem.cs b/Qwilight/Qwilight/System/StillSystem.cs new file mode 100644 index 0000000..24e0a85 --- /dev/null +++ b/Qwilight/Qwilight/System/StillSystem.cs @@ -0,0 +1,85 @@ +using Microsoft.Graphics.Canvas; +using Microsoft.UI; +using Qwilight.Utilities; +using System.IO; +using Windows.ApplicationModel.DataTransfer; +using Windows.Graphics; +using Windows.Graphics.Capture; +using Windows.Graphics.DirectX; +using Windows.Storage; +using Windows.Storage.Streams; +using WindowId = Windows.UI.WindowId; + +namespace Qwilight +{ + public sealed class StillSystem + { + public static readonly StillSystem Instance = new(); + public static readonly string EntryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Qwilight"); + + readonly CanvasDevice _targetSystem = new(); + GraphicsCaptureItem _window; + SizeInt32 _lastView; + + public void Init(nint handle) + { + try + { + _window = GraphicsCaptureItem.TryCreateFromWindowId(new WindowId(Win32Interop.GetWindowIdFromWindow(handle).Value)); + _lastView = _window.Size; + } + catch + { + } + } + + public void Save() + { + if (_window != null) + { + HandlingUISystem.Instance.HandleParallel(() => + { + GraphicsCaptureSession session = null; + var framePool = Direct3D11CaptureFramePool.Create(_targetSystem, DirectXPixelFormat.B8G8R8A8UIntNormalized, 2, _window.Size); + framePool.FrameArrived += (sender, args) => HandlingUISystem.Instance.HandleParallel(async () => + { + CanvasBitmap drawing; + try + { + using (var frame = sender.TryGetNextFrame()) + { + if (frame.ContentSize != _lastView) + { + _lastView = frame.ContentSize; + sender.Recreate(_targetSystem, DirectXPixelFormat.B8G8R8A8UIntNormalized, 2, _lastView); + } + drawing = CanvasBitmap.CreateFromDirect3D11Surface(_targetSystem, frame.Surface); + } + } + finally + { + session.Dispose(); + sender.Dispose(); + } + try + { + Directory.CreateDirectory(EntryPath); + var pngFilePath = Path.Combine(EntryPath, $"{DateTime.Now:F}.png".Replace(':', ' ')); + await drawing.SaveAsync(pngFilePath, CanvasBitmapFileFormat.Png); + var dataBundle = new DataPackage(); + dataBundle.SetBitmap(RandomAccessStreamReference.CreateFromFile(await StorageFile.GetFileFromPathAsync(pngFilePath))); + Clipboard.SetContent(dataBundle); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SavedStillDrawing, pngFilePath), true, "F12", () => Utility.OpenAs(pngFilePath)); + } + catch (IOException e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.FaultStillDrawing, e.Message)); + } + }); + session = framePool.CreateCaptureSession(_window); + session.StartCapture(); + }); + } + } + } +} diff --git a/Qwilight/Qwilight/System/TVSystem.cs b/Qwilight/Qwilight/System/TVSystem.cs new file mode 100644 index 0000000..35e92fd --- /dev/null +++ b/Qwilight/Qwilight/System/TVSystem.cs @@ -0,0 +1,108 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.IO; + +namespace Qwilight +{ + public sealed partial class TVSystem : Model + { + public static readonly TVSystem Instance = QwilightComponent.GetBuiltInData(nameof(TVSystem)); + + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(TVSystem)); + + readonly object _availableCSX = new(); + readonly bool[] _tvAssists = new bool[2]; + + public bool TVAssist0 + { + get => _tvAssists[0]; + + set + { + if (SetProperty(ref _tvAssists[0], value, nameof(TVAssist0))) + { + OnPropertyChanged(nameof(TVAssists)); + } + } + } + + public bool TVAssist1 + { + get => _tvAssists[1]; + + set + { + if (SetProperty(ref _tvAssists[1], value, nameof(TVAssist1))) + { + OnPropertyChanged(nameof(TVAssists)); + } + } + } + + public bool TVAssists => TVAssist0 || TVAssist1; + + bool IsAvailable => !ViewModels.Instance.MainValue.IsVital; + + public void HandleSystemIfAvailable() + { + lock (_availableCSX) + { + if (IsAvailable) + { + Monitor.Pulse(_availableCSX); + } + } + } + + public void HandleSystem() + { + var availableExes = new Dictionary + { + { "obs64", 0 }, + { "TwitchStudio", 0 }, + { "PRISMLiveStudio", 0 }, + { "XGS64", 0 }, + { "Discord", 1 } + }; + Span tvAssists = stackalloc bool[2]; + while (true) + { + try + { + tvAssists.Clear(); + foreach (var lppe in Process.GetProcesses()) + { + foreach (var (fileName, tvAssist) in availableExes) + { + if (lppe.ProcessName == fileName) + { + tvAssists[tvAssist] = true; + } + } + } + if ((tvAssists[0] || tvAssists[1]) && !TVAssist0 && !TVAssist1 && Configure.Instance.TVAssistConfigure) + { + ViewModels.Instance.AssistValue.Open(); + } + TVAssist0 = tvAssists[0]; + TVAssist1 = tvAssists[1]; + + Thread.Sleep(1000); + + lock (_availableCSX) + { + if (!IsAvailable) + { + Monitor.Wait(_availableCSX); + } + } + } + catch (Exception e) + { + Utility.SetFault(FaultEntryPath, e); + } + } + } + } +} diff --git a/Qwilight/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs b/Qwilight/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs new file mode 100644 index 0000000..e2ea08c --- /dev/null +++ b/Qwilight/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs @@ -0,0 +1,196 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.Compiler; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.Concurrent; +#if DEBUG +using System.Diagnostics; +#endif +using System.IO; +using System.Text; + +namespace Qwilight +{ + public sealed class DefaultTelnetSystem + { + readonly IHandleTelnet _handleTelnet; + bool _isAvailable = true; + + public DefaultTelnetSystem(IHandleTelnet handleTelnet) + { + _handleTelnet = handleTelnet; + } + + public void HandleSystem() => Utility.HandleLongParallel(() => + { + while (_isAvailable) + { + try + { + Console.Clear(); +#if DEBUG + Console.WriteLine($"D: {Debugger.IsAttached}"); +#endif + Console.WriteLine($"H: {QwilightComponent.TaehuiNetHost}"); + Console.WriteLine($"S: {_handleTelnet.IsAlwaysNewStand}"); + switch (Console.ReadKey(true).Key) + { + case ConsoleKey.Escape: + _handleTelnet.Toggle(); + break; +#if DEBUG + case ConsoleKey.D: + Debugger.Launch(); + break; +#endif + case ConsoleKey.E: + Console.Clear(); + Console.WriteLine("1, 2, 3, 4, 5, 6, 7, 8"); + switch (Console.ReadKey(true).Key) + { + case ConsoleKey.D1: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.LevelUp); + break; + case ConsoleKey.D2: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.LevelClear); + break; + case ConsoleKey.D3: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.SignIn); + break; + case ConsoleKey.D4: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.NotSignIn); + break; + case ConsoleKey.D5: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.ModifyEntryItem); + break; + case ConsoleKey.D6: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.ModifyNoteFile); + break; + case ConsoleKey.D7: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.NewTitle); + break; + case ConsoleKey.D8: + BaseUI.Instance.HandleEvent(BaseUI.EventItem.AbilityUp); + break; + } + break; + case ConsoleKey.H: + Console.Clear(); + Console.WriteLine("1. taehui.ddns.net"); + Console.WriteLine("2. taehui"); + Console.WriteLine("3. localhost"); + switch (Console.ReadKey(true).Key) + { + case ConsoleKey.D1: + QwilightComponent.TaehuiNetHost = "taehui.ddns.net"; + QwilightComponent.TaehuiNetFE = "https://taehui.ddns.net"; + QwilightComponent.TaehuiNetAPI = "https://taehui.ddns.net/www"; + QwilightComponent.QwilightAPI = "https://taehui.ddns.net/qwilight/www"; + break; + case ConsoleKey.D2: + QwilightComponent.TaehuiNetHost = "taehui"; + QwilightComponent.TaehuiNetFE = "http://taehui"; + QwilightComponent.TaehuiNetAPI = "http://taehui:10100/www"; + QwilightComponent.QwilightAPI = "http://taehui:7301/qwilight/www"; + break; + case ConsoleKey.D3: + QwilightComponent.TaehuiNetHost = "localhost"; + QwilightComponent.TaehuiNetFE = "http://localhost"; + QwilightComponent.TaehuiNetAPI = "http://localhost:10100/www"; + QwilightComponent.QwilightAPI = "http://localhost:7301/qwilight/www"; + break; + default: + continue; + } + TwilightSystem.Instance.Stop(); + break; + case ConsoleKey.N: + Console.Clear(); + Console.WriteLine("1, 2, 3, 4"); + switch (Console.ReadKey(true).Key) + { + case ConsoleKey.D1: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + break; + case ConsoleKey.D2: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + break; + case ConsoleKey.D3: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + break; + case ConsoleKey.D4: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + break; + } + break; + case ConsoleKey.S: + _handleTelnet.IsAlwaysNewStand = !_handleTelnet.IsAlwaysNewStand; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, _handleTelnet.IsAlwaysNewStand.ToString()); + break; + case ConsoleKey.T: + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewEntryWindow, + Contents = new Action(fileName => + { + ViewModels.Instance.MainValue.ModeComponentValue.Salt = 0; + Utility.HandleHMP(new ConcurrentBag(ViewModels.Instance.MainValue.EntryItems.SelectMany(entryItem => entryItem.WellNoteFiles.Where(noteFile => !noteFile.IsLogical))), Configure.Instance.UIBin, noteFile => + { + Console.WriteLine(noteFile.NoteFilePath); + var targetCompiler = BaseCompiler.GetCompiler(noteFile, null); + var defaultComputer = new TestCompute(noteFile); + targetCompiler.Compile(defaultComputer); + var noteID = noteFile.GetNoteID512(); + noteID = noteID.Substring(0, noteID.IndexOf(':')); + File.WriteAllBytes(Path.Combine(fileName, Path.ChangeExtension(noteID, Path.GetExtension(noteFile.NoteFilePath))), noteFile.GetContents()); + var builder = new StringBuilder(); + builder.AppendLine(defaultComputer.IsAutoLongNote.ToString()); + builder.AppendLine(defaultComputer.IsBanned.ToString()); + builder.AppendLine(defaultComputer.InputMode.ToString()); + builder.AppendLine(defaultComputer.Genre); + builder.AppendLine(defaultComputer.Artist); + builder.AppendLine(defaultComputer.Title); + builder.AppendLine(defaultComputer.LevelText); + builder.AppendLine(defaultComputer.LevelTextValue.ToString()); + builder.AppendLine(defaultComputer.LevyingBPM.ToString()); + builder.AppendLine(defaultComputer.BPM.ToString()); + builder.AppendLine(defaultComputer.Length.ToString()); + builder.AppendLine(defaultComputer.TotalNotes.ToString()); + builder.AppendLine(defaultComputer.AutoableNotes.ToString()); + builder.AppendLine(defaultComputer.TrapNotes.ToString()); + builder.AppendLine(defaultComputer.LongNotes.ToString()); + builder.AppendLine(defaultComputer.JudgmentStage.ToString()); + builder.AppendLine(defaultComputer.HitPointsValue.ToString()); + builder.AppendLine(defaultComputer.LevelValue.ToString()); + builder.AppendLine(defaultComputer.NoteDrawingName); + builder.AppendLine(defaultComputer.BannerDrawingName); + builder.AppendLine(defaultComputer.TrailerAudioName); + builder.AppendLine(defaultComputer.AudioLevyingPosition.ToString()); + builder.AppendLine(defaultComputer.IsSalt.ToString()); + builder.AppendLine(defaultComputer.Tag); + builder.AppendLine(defaultComputer.LowestBPM.ToString()); + builder.AppendLine(defaultComputer.HighestBPM.ToString()); + builder.AppendLine(defaultComputer.HighestInputCount.ToString()); + builder.AppendLine(defaultComputer.IsHellBPM.ToString()); + File.WriteAllText(Path.Combine(fileName, Path.ChangeExtension(noteID, ".txt")), builder.ToString(), Encoding.UTF8); + }); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, "OK"); + }) + }); + break; + } + } + catch + { + } + } + }, false); + + public void Stop() + { + _isAvailable = false; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/TelnetSystem/IHandleTelnet.cs b/Qwilight/Qwilight/System/TelnetSystem/IHandleTelnet.cs new file mode 100644 index 0000000..f774a8b --- /dev/null +++ b/Qwilight/Qwilight/System/TelnetSystem/IHandleTelnet.cs @@ -0,0 +1,11 @@ +namespace Qwilight +{ + public interface IHandleTelnet + { + public bool IsAvailable { get; set; } + + public bool IsAlwaysNewStand { get; set; } + + public void Toggle(); + } +} diff --git a/Qwilight/Qwilight/System/TelnetSystem/TelnetSystem.cs b/Qwilight/Qwilight/System/TelnetSystem/TelnetSystem.cs new file mode 100644 index 0000000..fa592d9 --- /dev/null +++ b/Qwilight/Qwilight/System/TelnetSystem/TelnetSystem.cs @@ -0,0 +1,43 @@ +using System.IO; +using Windows.Win32; + +namespace Qwilight +{ + public sealed class TelnetSystem : IHandleTelnet + { + public static readonly TelnetSystem Instance = new(); + + bool _isAlwaysNewStand; + + public bool IsAlwaysNewStand + { + get => IsAvailable && _isAlwaysNewStand; + + set => _isAlwaysNewStand = value; + } + + public bool IsAvailable { get; set; } + + DefaultTelnetSystem _defaultTelnetSystem; + + public void Toggle() + { + if (IsAvailable = !IsAvailable) + { + PInvoke.AllocConsole(); + _defaultTelnetSystem = new(this); + _defaultTelnetSystem.HandleSystem(); + } + else + { + _defaultTelnetSystem.Stop(); + _defaultTelnetSystem = null; + PInvoke.FreeConsole(); + } + Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) + { + AutoFlush = true + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/TwilightSystem.cs b/Qwilight/Qwilight/System/TwilightSystem.cs new file mode 100644 index 0000000..f1efedf --- /dev/null +++ b/Qwilight/Qwilight/System/TwilightSystem.cs @@ -0,0 +1,1611 @@ +using CommunityToolkit.Mvvm.Messaging; +using Google.Protobuf; +using Ionic.Zip; +using Qwilight.Compute; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.View; +using Qwilight.ViewModel; +using System.Buffers; +using System.Collections.Concurrent; +using System.Data.SQLite; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Text; +using System.Windows.Media; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight +{ + public sealed class TwilightSystem : Model, IDisposable + { + const int NotEstablished = 0; + const int NotSignedIn = 1; + const int SignedIn = 2; + + public static readonly TwilightSystem Instance = QwilightComponent.GetBuiltInData(nameof(TwilightSystem)); + + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(TwilightSystem)); + + readonly Action _handleSendParallel; + readonly ConcurrentDictionary _saveBundleMap = new(); + readonly ConcurrentDictionary _saveAsBundleMap = new(); + readonly HttpClient _wwwClient = new() + { + DefaultRequestVersion = HttpVersion.Version30 + }; + SslStream _ss; + int _twilightSituation; + ImageSource _avatarDrawing; + bool _wantAvatarDrawing; + bool _isAvailable = true; + + string QwilightName => QwilightComponent.IsValve ? ValveSystem.Instance.ValveName : Environment.UserName; + + public TwilightSystem() + { + _wwwClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0"); + _handleSendParallel = obj => + { + var eventItem = obj as Event; + if (eventItem != null) + { + eventItem.Millis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + eventItem.AvatarID = AvatarID; + try + { + lock (_ss) + { + eventItem.WriteDelimitedTo(_ss); + } + } + catch + { + } + } + }; + } + + public ImageSource AvatarDrawing + { + get + { + if (_wantAvatarDrawing) + { + _wantAvatarDrawing = false; + Task.Run(async () => SetProperty(ref _avatarDrawing, (await AvatarDrawingSystem.Instance.GetAvatarDrawing(AvatarID)).DefaultDrawing, nameof(AvatarDrawing))); + } + return _avatarDrawing; + } + } + + public string Totem { get; set; } = string.Empty; + + public string AvatarID { get; set; } = string.Empty; + + public string AvatarName { get; set; } = string.Empty; + + public string GetAvatarName() => TwilightSituation == NotEstablished ? QwilightName : AvatarName; + + public int TwilightSituation + { + get => _twilightSituation; + + set + { + if (SetProperty(ref _twilightSituation, value, nameof(TwilightSituation))) + { + OnPropertyChanged(nameof(IsEstablished)); + OnPropertyChanged(nameof(IsSignedIn)); + NotifyAvatarDrawing(); + ViewModels.Instance.MainValue.NotifyCanSaveAsBundle(); + ViewModels.Instance.MainValue.NotifyCanTwilightCommentary(); + ViewModels.Instance.MainValue.NotifyCanTwilightFavor(); + ViewModels.Instance.ConfigureValue.NotifyCanGetDefaultText(); + ViewModels.Instance.ConfigureValue.NotifyCanSaveAsBundle(); + ViewModels.Instance.BundleValue.NotifyIsMe(); + ViewModels.Instance.AvatarValue.NotifyIsMe(); + } + } + } + + public void StopBundle(string siteID) + { + if (_saveAsBundleMap.TryGetValue(siteID, out var toStopSaveAsBundleItem)) + { + toStopSaveAsBundleItem.OnStop(false); + } + if (_saveBundleMap.TryGetValue(siteID, out var toStopSaveBundleItem)) + { + toStopSaveBundleItem.OnStop(false); + } + } + + public bool IsEstablished => TwilightSituation != NotEstablished; + + public bool IsSignedIn => TwilightSituation == SignedIn; + + public void NotifyAvatarDrawing() + { + _wantAvatarDrawing = true; + OnPropertyChanged(nameof(AvatarDrawing)); + } + + public override void NotifyModel() + { + _wantAvatarDrawing = true; + base.NotifyModel(); + } + + static Event NewEvent(Event.Types.EventID eventID, T text, ByteString[] data) + { + var eventItem = new Event + { + EventID = eventID, + Text = text != null ? text as string ?? Utility.SetJSON(text) : string.Empty + }; + if (data != null) + { + eventItem.Data.AddRange(data); + } + return eventItem; + } + + void Send(Event.Types.EventID eventID, T text, params ByteString[] data) + { + if (IsEstablished) + { + _handleSendParallel(NewEvent(eventID, text, data)); + } + } + + public void SendParallel(Event.Types.EventID eventID, string text, params ByteString[] data) + { + if (IsEstablished || eventID == Event.Types.EventID.Establish) + { + Task.Factory.StartNew(_handleSendParallel, NewEvent(eventID, text, data)); + } + } + + public void SendParallel(Event.Types.EventID eventID, T text, params ByteString[] data) + { + if (IsEstablished || eventID == Event.Types.EventID.Establish) + { + Task.Factory.StartNew(_handleSendParallel, NewEvent(eventID, text, data)); + } + } + + public void SendParallel(Event eventItem) + { + if (IsEstablished) + { + Task.Factory.StartNew(_handleSendParallel, eventItem); + } + } + + void AutoEnter(Func onAutoEnter) + { + if (onAutoEnter(Configure.Instance.AutoEnterNotifySite.Data)) + { + SendParallel(Event.Types.EventID.EnterSite, new + { + siteID = "00000000-0000-0000-0000-000000000000", + siteCipher = string.Empty + }); + } + if (onAutoEnter(Configure.Instance.AutoEnterDefaultSite.Data)) + { + SendParallel(Event.Types.EventID.EnterSite, new + { + siteID = "00000000-0000-0000-0000-000000000001", + siteCipher = string.Empty + }); + } + if (onAutoEnter(Configure.Instance.AutoEnterPlatformSite.Data)) + { + SendParallel(Event.Types.EventID.EnterSite, new + { + siteID = "00000000-0000-0000-0000-000000000002", + siteCipher = string.Empty + }); + } + } + + public void HandleSystem() + { + var mainViewModel = ViewModels.Instance.MainValue; + var signInViewModel = ViewModels.Instance.SignInValue; + var bundleViewModel = ViewModels.Instance.BundleValue; + var ubuntuViewModel = ViewModels.Instance.UbuntuValue; + var toNotifyViewModel = ViewModels.Instance.NotifyValue; + var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; + var twilightConfigureViewModel = ViewModels.Instance.TwilightConfigure; + var netSiteCommentViewModel = ViewModels.Instance.NetSiteCommentValue; + var wasMITM = false; + while (true) + { + string textClose = null; + try + { + using (var tc = new TcpClient(QwilightComponent.TaehuiNetHost, 6101)) + using (_ss = QwilightComponent.IsVS ? new(tc.GetStream(), false, (sender, certificate, chain, sslPolicyErrors) => true) : new(tc.GetStream())) + { + _ss.AuthenticateAsClient("taehui.ddns.net"); + wasMITM = false; + var textEstablish = new + { + hash = QwilightComponent.HashText, + date = QwilightComponent.DateText, + language = Configure.Instance.Language, + qwilightName = QwilightName, + amd64 = QwilightComponent.AMD64Name, + os = QwilightComponent.OSName, + ram = QwilightComponent.RAMName, + vga = QwilightComponent.GPUName, + m2 = QwilightComponent.M2Name, + audio = QwilightComponent.AudioName, + tv = QwilightComponent.TVName, + lan = QwilightComponent.LANName, + }; + if (ValveSystem.Instance.ValveDrawing != null) + { + SendParallel(Event.Types.EventID.Establish, textEstablish, ValveSystem.Instance.ValveDrawing); + } + else + { + SendParallel(Event.Types.EventID.Establish, textEstablish); + } + while (_isAvailable) + { + var eventItem = Event.Parser.ParseDelimitedFrom(_ss); + var eventItemText = eventItem.Text; + var eventItemData = eventItem.Data; + var defaultComputer = mainViewModel.Computer; + switch (eventItem.EventID) + { + case Event.Types.EventID.Close: + textClose = eventItemText; + break; + case Event.Types.EventID.Establish: + var twilightEstablish = Utility.GetJSON(eventItemText); + Totem = string.Empty; + AvatarID = twilightEstablish.avatarID; + AvatarName = twilightEstablish.avatarName; + TwilightSituation = NotSignedIn; + mainViewModel.LoadCommentCollection(); + Configure.Instance.CommentViewTabPosition = Configure.Instance.CommentViewTabPosition; + AutoEnter(autoEnter => autoEnter == AutoEnterSite.AutoEnter); + if (Configure.Instance.AutoSignIn) + { + var avatarCipher = Configure.Instance.GetCipher(); + if (!string.IsNullOrEmpty(avatarCipher)) + { + SendParallel(Event.Types.EventID.SignIn, new + { + avatarID = Configure.Instance.AvatarID, + avatarCipher + }); + } + } + GetDefaultNoteDate(Configure.Instance.DefaultNoteDate, Configure.Instance.AutoGetDefaultNote); + GetDefaultUIDate(Configure.Instance.DefaultUIDate, Configure.Instance.AutoGetDefaultUI); + break; + case Event.Types.EventID.UnavailableDate: + if (!Configure.Instance.AutoGetQwilight) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, eventItemText); + } + break; + case Event.Types.EventID.SignIn: + signInViewModel.Close(); + var twilightSignIn = Utility.GetJSON(eventItemText); + Totem = twilightSignIn.totem; + AvatarID = twilightSignIn.avatarID; + AvatarName = twilightSignIn.avatarName; + TwilightSituation = SignedIn; + NotifyAvatarDrawing(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SuccessfullySignedInContents, GetAvatarName()), false, "Sign in"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.SignIn); + AutoEnter(autoEnter => autoEnter != AutoEnterSite.WaitSite); + break; + case Event.Types.EventID.NotSignIn: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.NotSignedInContents, GetAvatarName()), false, "Not Sign in"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.NotSignIn); + var twilightNotSignIn = Utility.GetJSON(eventItemText); + Totem = string.Empty; + AvatarID = twilightNotSignIn.avatarID; + AvatarName = twilightNotSignIn.avatarName; + TwilightSituation = NotSignedIn; + AutoEnter(autoEnter => autoEnter == AutoEnterSite.AutoEnter); + break; + case Event.Types.EventID.QuitSite: + var toWipeSiteViewModel = ViewModels.Instance.WipeSiteViewModel(eventItemText); + if (toWipeSiteViewModel != null) + { + HandlingUISystem.Instance.HandleParallel(() => siteContainerViewModel.SiteCollection.Remove(toWipeSiteViewModel.View)); + } + break; + case Event.Types.EventID.Warning: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, eventItemText); + break; + case Event.Types.EventID.NotifyInfo: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, eventItemText); + break; + case Event.Types.EventID.NotifyYes: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, eventItemText); + break; + case Event.Types.EventID.LevelUp: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.LevelUpContents, true, "Level Up"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.LevelUp); + break; + case Event.Types.EventID.AbilityUp: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, eventItemText, true, "Ability Up"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.AbilityUp); + break; + case Event.Types.EventID.WwwLevel: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.WwwLevelClearContents, eventItemText), true, "Www Level Clear"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.LevelClear); + break; + case Event.Types.EventID.NewTitle: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.NewTitleContents, eventItemText), true, "New Title"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.NewTitle); + break; + case Event.Types.EventID.SiteYell: + var twilightSiteYell = Utility.GetJSON(eventItemText); + var siteYellSiteViewModel = ViewModels.Instance.GetSiteViewModel(twilightSiteYell.siteID); + if (siteYellSiteViewModel != null) + { + var siteYell = new JSON.TwilightSiteYellItem + { + avatarID = twilightSiteYell.avatarID, + avatarName = twilightSiteYell.avatarName, + date = twilightSiteYell.date, + siteYell = twilightSiteYell.siteYell, + siteYellID = twilightSiteYell.siteYellID + }; + siteYellSiteViewModel.NewSiteYells(new[] { siteYell }, false); + siteYellSiteViewModel.SetNew(); + if (twilightSiteYell.avatarName != "@Enter" || twilightSiteYell.siteYell != GetAvatarName()) + { + siteYellSiteViewModel.Notify(siteYell); + } + } + break; + case Event.Types.EventID.ModifySiteYell: + var twilightModifySiteYell = Utility.GetJSON(eventItemText); + ViewModels.Instance.GetSiteViewModel(twilightModifySiteYell.siteID)?.ModifySiteYell(twilightModifySiteYell); + break; + case Event.Types.EventID.WipeSiteYell: + var twilightWipeSiteYell = Utility.GetJSON(eventItemText); + ViewModels.Instance.GetSiteViewModel(twilightWipeSiteYell.siteID)?.WipeSiteYell(twilightWipeSiteYell); + break; + case Event.Types.EventID.GetSiteYells: + var twilightGetSiteYells = Utility.GetJSON(eventItemText); + ViewModels.Instance.GetSiteViewModel(twilightGetSiteYells.siteID)?.NewSiteYells(twilightGetSiteYells.data, true); + break; + case Event.Types.EventID.EnterSite: + var twilightEnterSite = Utility.GetJSON(eventItemText); + var toEnterSiteID = twilightEnterSite.siteID; + var toEnterSiteViewModel = ViewModels.Instance.NewSiteViewModel(toEnterSiteID); + toEnterSiteViewModel.SiteID = toEnterSiteID; + toEnterSiteViewModel.SiteNotify = twilightEnterSite.siteNotify; + toEnterSiteViewModel.IsGetNotify = twilightEnterSite.isGetNotify; + toEnterSiteViewModel.IsEditable = twilightEnterSite.isEditable; + toEnterSiteViewModel.CanAudioInput = twilightEnterSite.isAudioInput; + toEnterSiteViewModel.IsAudioInput = twilightEnterSite.isAudioInput; + toEnterSiteViewModel.NewSiteYells(twilightEnterSite.data, false); + toEnterSiteViewModel.IsNetSite = twilightEnterSite.isNetSite; + if (toEnterSiteViewModel.IsNetSite) + { + toEnterSiteViewModel.SetComputingValues(twilightEnterSite); + toEnterSiteViewModel.IsFavorNoteFile = twilightEnterSite.isFavorNoteFile; + toEnterSiteViewModel.IsFavorModeComponent = twilightEnterSite.isFavorModeComponent; + toEnterSiteViewModel.IsFavorAudioMultiplier = twilightEnterSite.isFavorAudioMultiplier; + toEnterSiteViewModel.IsAutoSiteHand = twilightEnterSite.isAutoSiteHand; + toEnterSiteViewModel.ValidHunterMode = twilightEnterSite.validHunterMode; + toEnterSiteViewModel.ValidNetModeValue = new() + { + Data = twilightEnterSite.validNetMode + }; + toEnterSiteViewModel.SetAllowedPostableItems(twilightEnterSite); + toEnterSiteViewModel.ModeComponentValue.CopyAsJSON(twilightEnterSite.modeComponentData); + } + var toEnterSite = HandlingUISystem.Instance.Handle(() => new Site + { + DataContext = toEnterSiteViewModel + }); + toEnterSiteViewModel.View = toEnterSite; + HandlingUISystem.Instance.HandleParallel(() => siteContainerViewModel.SiteCollection.Add(toEnterSite)); + siteContainerViewModel.SiteView = toEnterSite; + break; + case Event.Types.EventID.CallBundle: + var twilightCallBundle = Utility.GetJSON(eventItemText); + var targetAvatar = twilightCallBundle.targetAvatar; + if (twilightCallBundle.isWindowOpen || (bundleViewModel.IsOpened && bundleViewModel.TargetBundleAvatar == targetAvatar)) + { + var noteFilesBundleItems = new List(); + var noteFileBundleItems = new List(); + var valueUIBundleItems = new List(); + var qwilightBundleItems = new List(); + var eventNoteBundleItems = new List(); + foreach (var bundleDataItem in twilightCallBundle.data) + { + ((BundleItem.BundleVariety)bundleDataItem.bundleVariety switch + { + BundleItem.BundleVariety.Note => noteFileBundleItems, + BundleItem.BundleVariety.UI => valueUIBundleItems, + BundleItem.BundleVariety.Qwilight => qwilightBundleItems, + BundleItem.BundleVariety.EventNote => eventNoteBundleItems, + _ => default + })?.Add(new(new() + { + Data = bundleDataItem.bundleCompetence + }) + { + Avatar = targetAvatar, + Date = DateTimeOffset.FromUnixTimeMilliseconds(bundleDataItem.date).LocalDateTime.ToLongDateString(), + Name = bundleDataItem.bundleName, + Length = bundleDataItem.bundleLength, + Variety = (BundleItem.BundleVariety)bundleDataItem.bundleVariety + }); + } + var noteFileBundleCollection = bundleViewModel.NoteFileBundleCollection; + var valueUIBundleCollection = bundleViewModel.UIBundleCollection; + var qwilightBundleCollection = bundleViewModel.QwilightBundleCollection; + var eventNoteBundleCollection = bundleViewModel.EventNoteBundleCollection; + HandlingUISystem.Instance.HandleParallel(() => + { + noteFileBundleCollection.Clear(); + foreach (var noteFileBundleItem in noteFileBundleItems) + { + noteFileBundleItem.BundleCollection = noteFileBundleCollection; + noteFileBundleCollection.Add(noteFileBundleItem); + } + valueUIBundleCollection.Clear(); + foreach (var valueUIBundleItem in valueUIBundleItems) + { + valueUIBundleItem.BundleCollection = valueUIBundleCollection; + valueUIBundleCollection.Add(valueUIBundleItem); + } + qwilightBundleCollection.Clear(); + foreach (var qwilightBundleItem in qwilightBundleItems) + { + qwilightBundleItem.BundleCollection = qwilightBundleCollection; + qwilightBundleCollection.Add(qwilightBundleItem); + } + eventNoteBundleCollection.Clear(); + foreach (var eventNoteBundleItem in eventNoteBundleItems) + { + eventNoteBundleItem.BundleCollection = eventNoteBundleCollection; + eventNoteBundleCollection.Add(eventNoteBundleItem); + } + }); + bundleViewModel.TargetBundleAvatar = targetAvatar; + bundleViewModel.TargetValue = twilightCallBundle.targetValue; + bundleViewModel.BundleLength = twilightCallBundle.bundleLength; + bundleViewModel.NotifyUI(); + bundleViewModel.Open(); + } + break; + case Event.Types.EventID.CallConfigure: + var twilightCallConfigure = Utility.GetJSON(eventItemText); + twilightConfigureViewModel.SilentSiteCompetence = new() + { + Data = twilightCallConfigure.silentSiteCompetence + }; + twilightConfigureViewModel.NotifyUbuntuCompetence = new() + { + Data = twilightCallConfigure.toNotifyUbuntuCompetence + }; + twilightConfigureViewModel.DefaultBundleCompetence = new() + { + Data = twilightCallConfigure.defaultBundleCompetence + }; + twilightConfigureViewModel.IOCompetence = new() + { + Data = twilightCallConfigure.ioCompetence + }; + twilightConfigureViewModel.NotifySaveBundleCompetence = new() + { + Data = twilightCallConfigure.toNotifySaveBundle + }; + twilightConfigureViewModel.Open(); + break; + case Event.Types.EventID.CallUbuntu: + Utility.SetUICollection(ubuntuViewModel.UbuntuCollection, Utility.GetJSON(eventItemText).Select(data => new UbuntuItem(data.ubuntuID) + { + AvatarName = data.ubuntuName, + UbuntuSituationValue = (UbuntuItem.UbuntuSituation)data.situationValue, + SituationText = data.situationText + }).ToArray(), null, null, (valueItem, targetItem) => + { + valueItem.AvatarName = targetItem.AvatarName; + valueItem.UbuntuSituationValue = targetItem.UbuntuSituationValue; + valueItem.SituationText = targetItem.SituationText; + }); + break; + case Event.Types.EventID.CallSiteAvatar: + var twilightCallSiteAvatar = Utility.GetJSON(eventItemText); + ViewModels.Instance.GetSiteViewModel(twilightCallSiteAvatar.siteID)?.SetSiteAvatar(twilightCallSiteAvatar); + break; + case Event.Types.EventID.CallSiteNet: + var twilightCallSiteNet = Utility.GetJSON(eventItemText); + ViewModels.Instance.GetSiteViewModel(twilightCallSiteNet.siteID)?.SetSiteNet(twilightCallSiteNet); + break; + case Event.Types.EventID.CallSiteModeComponent: + var twilightCallSiteModeComponent = Utility.GetJSON(eventItemText); + ViewModels.Instance.GetSiteViewModel(twilightCallSiteModeComponent.siteID)?.SetSiteModeComponent(twilightCallSiteModeComponent); + break; + case Event.Types.EventID.LevyNet: + var twilightLevyNet = Utility.GetJSON(eventItemText); + var toLevyNetSiteViewModel = ViewModels.Instance.GetSiteViewModel(twilightLevyNet.siteID); + if (toLevyNetSiteViewModel != null) + { + if (mainViewModel.NoteID512s.TryGetValue(toLevyNetSiteViewModel.ComputingValue.NoteID, out var toLevyNoteFile)) + { + var isFavorModeComponent = twilightLevyNet.isFavorModeComponent; + toLevyNetSiteViewModel.IsFavorModeComponent = isFavorModeComponent; + toLevyNetSiteViewModel.IsFavorAudioMultiplier = twilightLevyNet.isFavorAudioMultiplier; + var toLevyModeComponentValue = toLevyNetSiteViewModel.ModeComponentValue; + toLevyModeComponentValue.ComputingValue = toLevyNoteFile; + toLevyModeComponentValue.CopyAsJSON(twilightLevyNet.modeComponentData); + + mainViewModel.IsCommentMode = false; + var modeComponentValue = mainViewModel.ModeComponentValue; + var defaultModeComponentValue = modeComponentValue.Clone(); + var defaultMultiplierValue = modeComponentValue.MultiplierValue; + modeComponentValue.ComputingValue = toLevyNoteFile; + if (!isFavorModeComponent) + { + modeComponentValue.CopyAs(toLevyModeComponentValue); + } + modeComponentValue.CanModifyMultiplier = true; + modeComponentValue.MultiplierValue = defaultMultiplierValue; + modeComponentValue.CanModifyAudioMultiplier = toLevyNetSiteViewModel.IsFavorAudioMultiplier; + if (modeComponentValue.CanModifyAudioMultiplier) + { + modeComponentValue.AudioMultiplier = mainViewModel.ModeComponentValue.AudioMultiplier; + } + else + { + modeComponentValue.AudioMultiplier = toLevyModeComponentValue.AudioMultiplier; + } + if (twilightLevyNet.validNetMode > 0) + { + modeComponentValue.AudioMultiplier = 1.0; + modeComponentValue.FaintNoteModeValue = ModeComponent.FaintNoteMode.Default; + modeComponentValue.JudgmentModeValue = ModeComponent.JudgmentMode.Default; + modeComponentValue.HitPointsModeValue = ModeComponent.HitPointsMode.Default; + modeComponentValue.NoteMobilityModeValue = ModeComponent.NoteMobilityMode.Default; + } + Utility.HandleUIAudio("Levy Note File"); + mainViewModel.SetComputingMode(new NetCompute(new[] { toLevyNoteFile }, twilightLevyNet.validNetMode == 0 && isFavorModeComponent ? null : defaultModeComponentValue, AvatarID, GetAvatarName(), twilightLevyNet)); + } + else + { + SendParallel(Event.Types.EventID.Compiled, new + { + siteID = toLevyNetSiteViewModel.SiteID, + twilightLevyNet.handlerID, + isCompiled = false + }); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.HasNotNetNoteFile); + } + } + break; + case Event.Types.EventID.Compiled: + if (defaultComputer is NetCompute && defaultComputer.HandlerID == eventItemText) + { + defaultComputer.HandleComputer(); + defaultComputer.WaitingTwilightLevel = DefaultCompute.WaitingTwilight.Default; + } + break; + case Event.Types.EventID.CallNet: + var twilightCallNet = eventItem.TwilightCallNet; + if ((defaultComputer is NetCompute || defaultComputer is IOCompute) && defaultComputer.HandlerID == twilightCallNet.HandlerID && defaultComputer.IsHandling) + { + lock (defaultComputer.IsTwilightNetItemsCSX) + { + if (defaultComputer.IsTwilightNetItems) + { + foreach (var netItem in defaultComputer.NetItems) + { + foreach (var data in twilightCallNet.Data) + { + if (data.AvatarID == netItem.AvatarID) + { + if (data.IsFailed) + { + netItem.IsFailedStatus = 100.0; + } + netItem.TargetPosition = data.TargetPosition; + netItem.LastJudged = (Component.Judged)data.LastJudged; + netItem.AvatarNetStatus = data.AvatarNetStatus; + netItem.HitPointsModeValue = (ModeComponent.HitPointsMode)data.HitPointsMode; + netItem.SetValue(data.Stand, data.Band, data.Point, data.HitPoints, 1, data.Drawings, data.DrawingComponent); + break; + } + } + } + } + else + { + var date = DateTime.Now; + defaultComputer.IsTwilightNetItems = true; + defaultComputer.LevyingNetPosition = 0; + defaultComputer.QuitNetPosition = defaultComputer.SetNetItems(twilightCallNet.Data.Select((data, i) => + { + var avatarID = data.AvatarID; + return new NetItem(avatarID, data.AvatarName, date, data.Stand, data.Band, data.Point, data.HitPoints) + { + TargetPosition = i, + AvatarNetStatus = data.AvatarNetStatus, + IsMyNetItem = avatarID == defaultComputer.AvatarID, + IsFailedStatus = data.IsFailed ? 100.0 : 0.0, + LastJudged = (Component.Judged)data.LastJudged, + QuitValue = Utility.GetQuitStatusValue(data.Point, data.Stand, data.HitPoints, 1), + HitPointsModeValue = (ModeComponent.HitPointsMode)data.HitPointsMode + }; + }).ToList()) - 1; + } + } + } + break; + case Event.Types.EventID.QuitNet: + var twilightQuitNet = Utility.GetJSON(eventItemText); + if (defaultComputer is NetCompute && defaultComputer.HandlerID == twilightQuitNet.handlerID) + { + if (twilightQuitNet.quitNetItems != null) + { + defaultComputer.PendingQuitNetItems = twilightQuitNet.quitNetItems; + defaultComputer.PendingQuitNetComments = eventItemData.Select(data => Comment.Parser.ParseFrom(data)).ToArray(); + defaultComputer.SetQuitMode(); + } + else + { + defaultComputer.SetNoteFileMode(); + } + } + break; + case Event.Types.EventID.CallNetSiteComments: + var twilightCallNetSiteComments = Utility.GetJSON(eventItemText); + if (twilightCallNetSiteComments != null) + { + var netSIteCommentItemCollection = new Dictionary(); + foreach (var twilightCallNetSiteComment in twilightCallNetSiteComments) + { + var date = twilightCallNetSiteComment.date; + if (!netSIteCommentItemCollection.TryGetValue(date, out var netSiteCommentItems)) + { + netSiteCommentItems = new() + { + NetSiteCommentItems = new(), + Date = date + }; + } + foreach (var toCallNetSiteCommentItem in twilightCallNetSiteComment.data) + { + netSiteCommentItems.NetSiteCommentItems.Add(new(toCallNetSiteCommentItem)); + } + netSIteCommentItemCollection[date] = netSiteCommentItems; + } + var netSiteCommentItemsCollection = netSiteCommentViewModel.NetSiteCommentItemsCollection; + HandlingUISystem.Instance.HandleParallel(() => + { + netSiteCommentItemsCollection.Clear(); + foreach (var date in netSIteCommentItemCollection.Values) + { + netSiteCommentItemsCollection.Add(date); + } + netSiteCommentViewModel.NetSiteCommentItemsValue = netSiteCommentItemsCollection.LastOrDefault(); + }); + netSiteCommentViewModel.Open(); + } + break; + case Event.Types.EventID.SaveAsBundle: + var twilightSaveAsBundle = Utility.GetJSON(eventItemText); + var bundleEntryPath = twilightSaveAsBundle.bundleEntryPath; + var saveAsBundleID = twilightSaveAsBundle.bundleID; + var saveAsBundleItem = new NotifyItem + { + Text = LanguageSystem.Instance.SaveAsBundleContents, + Variety = NotifySystem.NotifyVariety.Levying, + SaveAsDataStore = ArrayPool.Shared.Rent(QwilightComponent.SendUnit), + OnStop = isTotal => + { + if (isTotal) + { + return !_saveAsBundleMap.ContainsKey(saveAsBundleID); + } + else + { + if (_saveAsBundleMap.Remove(saveAsBundleID, out var toStopSaveAsBundleItem)) + { + toStopSaveAsBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; + toStopSaveAsBundleItem.Text = LanguageSystem.Instance.StopSavingAsBundleContents; + toStopSaveAsBundleItem.Dispose(); + toStopSaveAsBundleItem.IsStopped = true; + SendParallel(Event.Types.EventID.StopSavingAsBundle, saveAsBundleID); + return false; + } + else + { + return true; + } + } + } + }; + _saveAsBundleMap[saveAsBundleID] = saveAsBundleItem; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, saveAsBundleItem.Text); + HandlingUISystem.Instance.HandleParallel(() => toNotifyViewModel.NotifyItemCollection.Insert(0, saveAsBundleItem)); + var onZipSaving = new EventHandler((sender, e) => + { + e.Cancel = saveAsBundleItem.IsStopped; + saveAsBundleItem.LevyingStatus = e.EntriesSaved; + saveAsBundleItem.QuitStatus = e.EntriesTotal; + saveAsBundleItem.NotifyBundleStatus(); + }); + Task.Run(() => + { + try + { + using var rms = PoolSystem.Instance.GetDataFlow(); + using (var zipFile = new ZipFile + { + AlternateEncoding = Encoding.UTF8, + AlternateEncodingUsage = ZipOption.Always, + }) + { + switch ((BundleItem.BundleVariety)twilightSaveAsBundle.bundleVariety) + { + case BundleItem.BundleVariety.Net: + zipFile.AddDirectory(bundleEntryPath); + zipFile.SaveProgress += onZipSaving; + zipFile.Save(rms); + break; + case BundleItem.BundleVariety.UI: + if (Path.GetFileName(twilightSaveAsBundle.bundleName).StartsWith('@')) + { + BaseUI.ZipUIFile(zipFile, new() + { + UIEntry = Path.GetDirectoryName(bundleEntryPath), + YamlName = Path.GetFileNameWithoutExtension(bundleEntryPath) + }, string.Empty); + } + else + { + UI.ZipUIFile(zipFile, new() + { + UIEntry = Path.GetDirectoryName(bundleEntryPath), + YamlName = Path.GetFileNameWithoutExtension(bundleEntryPath) + }, string.Empty); + } + zipFile.SaveProgress += onZipSaving; + zipFile.Save(rms); + break; + case BundleItem.BundleVariety.Qwilight: + Configure.Instance.Save(); + GPUConfigure.Instance.Save(); + if (Directory.Exists(QwilightComponent.CommentEntryPath)) + { + zipFile.AddDirectory(QwilightComponent.CommentEntryPath, "Comment"); + } + var levelFilePath = Path.Combine(LevelSystem.EntryPath, $"{Configure.Instance.WantLevelName}.json"); + if (File.Exists(levelFilePath)) + { + zipFile.AddFile(levelFilePath, "Level"); + } + levelFilePath = Path.Combine(LevelSystem.EntryPath, $"#{Configure.Instance.WantLevelName}.json"); + if (File.Exists(levelFilePath)) + { + zipFile.AddFile(levelFilePath, "Level"); + } + if (Configure.Instance.BaseUIItemValue.UIEntry != "@Default" || Configure.Instance.BaseUIItemValue.YamlName != "@Default") + { + BaseUI.ZipUIFile(zipFile, Configure.Instance.BaseUIItemValue, "UI"); + } + if (Configure.Instance.UIItemValue.UIEntry != "Default" || Configure.Instance.UIItemValue.YamlName != "Default") + { + UI.ZipUIFile(zipFile, Configure.Instance.UIItemValue, "UI"); + } + zipFile.AddFile(Path.Combine(QwilightComponent.QwilightEntryPath, "Configure.json"), string.Empty); + zipFile.AddFile(Path.Combine(QwilightComponent.QwilightEntryPath, "GPU Configure.json"), string.Empty); + zipFile.AddFile(Path.Combine(QwilightComponent.QwilightEntryPath, "DB.db"), string.Empty); + zipFile.SaveProgress += onZipSaving; + zipFile.Save(rms); + break; + case BundleItem.BundleVariety.EventNote: + var eventNoteData = Encoding.UTF8.GetBytes(bundleEntryPath); + rms.Write(eventNoteData, 0, eventNoteData.Length); + break; + case BundleItem.BundleVariety.Note: + twilightSaveAsBundle.bundleEntryPath = Path.GetDirectoryName(bundleEntryPath)!; + zipFile.AddFile(bundleEntryPath, string.Empty); + zipFile.SaveProgress += onZipSaving; + zipFile.Save(rms); + break; + } + } + + if (!saveAsBundleItem.IsStopped) + { + using (saveAsBundleItem) + { + saveAsBundleItem.Text = LanguageSystem.Instance.SavingAsBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, saveAsBundleItem.Text); + saveAsBundleItem.QuitStatus = rms.Length; + rms.Position = 0; + while (_saveAsBundleMap.TryGetValue(saveAsBundleID, out var saveAsBundleItem)) + { + var length = (int)Math.Min(saveAsBundleItem.SaveAsDataStore.Length, rms.Length - rms.Position); + rms.Read(saveAsBundleItem.SaveAsDataStore, 0, length); + saveAsBundleItem.LevyingStatus += length; + saveAsBundleItem.NotifyBundleStatus(); + if (length < saveAsBundleItem.SaveAsDataStore.Length) + { + Send(Event.Types.EventID.SavedAsBundle, saveAsBundleID, UnsafeByteOperations.UnsafeWrap(saveAsBundleItem.SaveAsDataStore.AsMemory(0, length))); + break; + } + else + { + Send(Event.Types.EventID.SavingAsBundle, saveAsBundleID, UnsafeByteOperations.UnsafeWrap(saveAsBundleItem.SaveAsDataStore)); + } + } + } + } + } + catch (Exception e) + { + saveAsBundleItem.OnStop(false); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SaveAsBundleFault, e.Message)); + } + }); + break; + case Event.Types.EventID.SavedAsBundle: + if (_saveAsBundleMap.TryGetValue(eventItemText, out var savedAsBundleItem)) + { + savedAsBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savedAsBundleItem.Text = LanguageSystem.Instance.SavedAsBundleContents; + savedAsBundleItem.Dispose(); + savedAsBundleItem.OnStop = isTotal => true; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savedAsBundleItem.Text); + } + break; + case Event.Types.EventID.SaveBundle: + var twilightSaveBundle = Utility.GetJSON(eventItemText); + var saveBundleID = twilightSaveBundle.bundleID; + var bundleLength = twilightSaveBundle.bundleLength; + var saveBundleItem = new NotifyItem + { + Text = LanguageSystem.Instance.SaveBundleContents, + Variety = NotifySystem.NotifyVariety.Levying, + SaveDataFlow = PoolSystem.Instance.GetDataFlow(bundleLength), + OnStop = isTotal => + { + if (isTotal) + { + return !_saveBundleMap.ContainsKey(saveBundleID); + } + else + { + if (_saveBundleMap.Remove(saveBundleID, out var toStopSaveBundleItem)) + { + toStopSaveBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; + toStopSaveBundleItem.Text = LanguageSystem.Instance.StopSavingBundleContents; + toStopSaveBundleItem.Dispose(); + toStopSaveBundleItem.IsStopped = true; + SendParallel(Event.Types.EventID.StopSavingBundle, saveBundleID); + return false; + } + else + { + return true; + } + } + }, + QuitStatus = bundleLength + }; + _saveBundleMap[saveBundleID] = saveBundleItem; + HandlingUISystem.Instance.HandleParallel(() => toNotifyViewModel.NotifyItemCollection.Insert(0, saveBundleItem)); + var bundleVariety = (BundleItem.BundleVariety)twilightSaveBundle.bundleVariety; + if (bundleVariety != BundleItem.BundleVariety.DefaultNotes && bundleVariety != BundleItem.BundleVariety.DefaultUI) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, saveBundleItem.Text); + } + SendParallel(Event.Types.EventID.SavingBundle, saveBundleID); + break; + case Event.Types.EventID.SavingBundle: + if (_saveBundleMap.TryGetValue(eventItemText, out var savingBundleItem)) + { + eventItemData[0].WriteTo(savingBundleItem.SaveDataFlow); + savingBundleItem.LevyingStatus += eventItemData[0].Length; + savingBundleItem.NotifyBundleStatus(); + } + break; + case Event.Types.EventID.SavedBundle: + var twilightSavedBundle = Utility.GetJSON(eventItemText); + if (_saveBundleMap.TryGetValue(twilightSavedBundle.bundleID, out var savedBundleItem)) + { + var saveDataFlow = savedBundleItem.SaveDataFlow; + eventItemData[0].WriteTo(saveDataFlow); + saveDataFlow.Position = 0; + Utility.HandleLongParallel(() => + { + var bundleVariety = (BundleItem.BundleVariety)twilightSavedBundle.bundleVariety; + var isNotDefaultBundle = bundleVariety != BundleItem.BundleVariety.DefaultNotes && bundleVariety != BundleItem.BundleVariety.DefaultUI; + try + { + switch (bundleVariety) + { + case BundleItem.BundleVariety.DefaultNotes: + case BundleItem.BundleVariety.Net: + var bundleEntry = Path.Combine(QwilightComponent.BundleEntryPath, twilightSavedBundle.bundleName); + using (var zipFile = ZipFile.Read(saveDataFlow)) + { + savedBundleItem.Text = LanguageSystem.Instance.SavingBundleContents; + if (isNotDefaultBundle) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + zipFile.ExtractProgress += (sender, e) => + { + e.Cancel = savedBundleItem.IsStopped; + savedBundleItem.LevyingStatus = e.EntriesExtracted; + savedBundleItem.QuitStatus = e.EntriesTotal; + savedBundleItem.NotifyBundleStatus(); + }; + zipFile.ExtractAll(bundleEntry, ExtractExistingFileAction.OverwriteSilently); + } + if (!savedBundleItem.IsStopped) + { + mainViewModel.LoadEntryItem(DefaultEntryItem.EssentialBundle, bundleEntry, isNotDefaultBundle); + savedBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savedBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; + if (isNotDefaultBundle) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + } + break; + case BundleItem.BundleVariety.DefaultUI: + case BundleItem.BundleVariety.UI: + using (var zipFile = ZipFile.Read(saveDataFlow)) + { + savedBundleItem.Text = LanguageSystem.Instance.SavingBundleContents; + if (bundleVariety != BundleItem.BundleVariety.DefaultUI) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + zipFile.ExtractProgress += (sender, e) => + { + e.Cancel = savedBundleItem.IsStopped; + savedBundleItem.LevyingStatus = e.EntriesExtracted; + savedBundleItem.QuitStatus = e.EntriesTotal; + savedBundleItem.NotifyBundleStatus(); + }; + zipFile.ExtractAll(string.IsNullOrEmpty(Path.GetDirectoryName(zipFile.Where(zipEntry => zipEntry.FileName.IsTailCaselsss(".yaml")).OrderBy(zipEntry => zipEntry.FileName).FirstOrDefault().FileName)) ? Path.Combine(QwilightComponent.UIEntryPath, twilightSavedBundle.bundleName) : QwilightComponent.UIEntryPath, ExtractExistingFileAction.OverwriteSilently); + } + if (!savedBundleItem.IsStopped) + { + savedBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savedBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; + if (bundleVariety != BundleItem.BundleVariety.DefaultUI) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + } + break; + case BundleItem.BundleVariety.Qwilight: + using (var zipFile = ZipFile.Read(saveDataFlow)) + { + zipFile.Save(Path.Combine(QwilightComponent.QwilightEntryPath, "Qwilight.zip")); + savedBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savedBundleItem.Text = LanguageSystem.Instance.SavedQwilightBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + break; + case BundleItem.BundleVariety.EventNote: + try + { + var eventNoteID = Encoding.UTF8.GetString(saveDataFlow.ToArray()).Split('.')[0]; + var eventNoteName = Path.GetFileNameWithoutExtension(twilightSavedBundle.bundleName); + var eventNoteVariety = twilightSavedBundle.etc switch + { + "MD5" => DB.EventNoteVariety.MD5, + "Qwilight" => DB.EventNoteVariety.Qwilight, + _ => default + }; + var date = DateTime.Now; + DB.Instance.SetEventNote(eventNoteID, eventNoteName, date, eventNoteVariety); + savedBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savedBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + mainViewModel.LoadEventNoteEntryItems(); + mainViewModel.Want(); + } + catch (SQLiteException) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.BeforeEventNoteContents); + } + break; + case BundleItem.BundleVariety.Note: + var noteID = twilightSavedBundle.etc.Split('/').FirstOrDefault(noteID512s => mainViewModel.NoteID512s.ContainsKey(noteID512s)); + if (noteID != null && mainViewModel.NoteID512s.TryGetValue(noteID, out var noteFile)) + { + using (var zipFile = ZipFile.Read(saveDataFlow)) + { + savedBundleItem.Text = LanguageSystem.Instance.SavingBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + zipFile.ExtractProgress += (sender, e) => + { + e.Cancel = savedBundleItem.IsStopped; + savedBundleItem.LevyingStatus = e.EntriesExtracted; + savedBundleItem.QuitStatus = e.EntriesTotal; + savedBundleItem.NotifyBundleStatus(); + }; + zipFile.ExtractAll(noteFile.EntryItem.EntryPath, ExtractExistingFileAction.OverwriteSilently); + } + if (!savedBundleItem.IsStopped) + { + mainViewModel.LoadEntryItem(noteFile.DefaultEntryItem, noteFile.EntryItem.EntryPath); + savedBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savedBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + } + else + { + savedBundleItem.Text = LanguageSystem.Instance.NotHaveNoteFileEntryText; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.NotSave, savedBundleItem.Text); + } + break; + } + } + catch (Exception e) + { + savedBundleItem.OnStop(false); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SaveBundleFault, e.Message)); + } + finally + { + savedBundleItem.Dispose(); + savedBundleItem.OnStop = isTotal => true; + } + }, false); + } + break; + case Event.Types.EventID.PostFile: + var toPostFileSiteViewModel = ViewModels.Instance.SiteContainerValue.SiteValue; + if (toPostFileSiteViewModel != null) + { + toPostFileSiteViewModel.Input = eventItemText; + } + break; + case Event.Types.EventID.CallIo: + var twilightCallIO = Utility.GetJSON(eventItemText); + if (defaultComputer?.CanIO == true && defaultComputer.IsHandling) + { + SendParallel(Event.Types.EventID.CallIoComponent, new + { + noteID = defaultComputer.NoteFile.GetNoteID512(), + handlerID = defaultComputer.HandlerID, + twilightCallIO.avatarID, + data = defaultComputer.ModeComponentValue.GetJSON(), + ioHandlerID = twilightCallIO.handlerID, + isFailMode = defaultComputer.IsFailMode, + ioMillis = twilightCallIO.ioMillis, + targetIOMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }); + } + else + { + SendParallel(Event.Types.EventID.IoNot, new + { + avatarID = twilightCallIO.avatarID, + handlerID = twilightCallIO.handlerID + }); + } + break; + case Event.Types.EventID.IoNot: + if (string.IsNullOrEmpty(eventItemText)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.CannotIOContents); + } + break; + case Event.Types.EventID.CallIoComponent: + var twilightCallIOComponent = Utility.GetJSON(eventItemText); + if (mainViewModel.NoteID512s.TryGetValue(twilightCallIOComponent.noteID, out var ioNoteFile)) + { + mainViewModel.IsCommentMode = false; + var modeComponentValue = mainViewModel.ModeComponentValue; + var defaultModeComponentValue = modeComponentValue.Clone(); + modeComponentValue.ComputingValue = ioNoteFile; + modeComponentValue.CopyAsJSON(twilightCallIOComponent.data); + modeComponentValue.CanModifyMultiplier = false; + modeComponentValue.CanModifyAudioMultiplier = false; + mainViewModel.SetComputingMode(new IOCompute(new[] { ioNoteFile }, defaultModeComponentValue, twilightCallIOComponent)); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.HasNotIONoteFile); + if (!string.IsNullOrEmpty(twilightCallIOComponent.ioHandlerID)) + { + mainViewModel.Computer.SetNoteFileMode(); + } + } + break; + case Event.Types.EventID.CompiledIo: + var twilightCompiledIO = Utility.GetJSON(eventItemText); + if (defaultComputer.HandlerID == twilightCompiledIO.handlerID) + { + if (defaultComputer.CanIO && defaultComputer.IsHandling) + { + defaultComputer.TwilightCompiledIOQueue.Enqueue(twilightCompiledIO); + } + else + { + SendParallel(Event.Types.EventID.IoQuit, new + { + twilightCompiledIO.handlerID, + avatarIDs = new[] { twilightCompiledIO.avatarID }, + isBanned = true + }); + } + } + break; + case Event.Types.EventID.LevyIo: + var twilightLevyIO = Utility.GetJSON(eventItemText); + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightLevyIO.handlerID) + { + var comment = Comment.Parser.ParseFrom(eventItemData[0]); + defaultComputer.IOLazyInit = new(() => + { + defaultComputer.LastStand = twilightLevyIO.lastStand; + defaultComputer.IsF.SetValue(twilightLevyIO.isF); + var sentMultiplier = twilightLevyIO.multiplier; + defaultComputer.ModeComponentValue.SentMultiplier = sentMultiplier; + defaultComputer.ModeComponentValue.MultiplierValue = defaultComputer.ModeComponentValue.BPM * defaultComputer.ModeComponentValue.AudioMultiplier * sentMultiplier; + defaultComputer.ModeComponentValue.AudioMultiplier = twilightLevyIO.audioMultiplier; + }); + defaultComputer.IOMillis += twilightLevyIO.ioMillis; + defaultComputer.LevyingWait = twilightLevyIO.levyingWait; + defaultComputer.WaitingTwilightLevel = DefaultCompute.WaitingTwilight.Default; + defaultComputer.EventComment = comment; + if (defaultComputer.IsHandling) + { + defaultComputer.SetUndo = true; + } + else + { + defaultComputer.HandleComputer(); + } + } + break; + case Event.Types.EventID.IoInput: + var twilightIOInput = eventItem.TwilightIOInput; + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOInput.HandlerID) + { + var twilightIOInputQueue = defaultComputer.TwilightIOInputQueue; + lock (twilightIOInputQueue) + { + twilightIOInputQueue.Enqueue(Elapsable.GetElapsable(twilightIOInput)); + } + } + break; + case Event.Types.EventID.IoJudge: + var twilightIOJudge = eventItem.TwilightIOJudge; + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOJudge.HandlerID) + { + var twilightIOJudgeQueue = defaultComputer.TwilightIOJudgeQueue; + lock (twilightIOJudgeQueue) + { + twilightIOJudgeQueue.Enqueue(Elapsable.GetElapsable(twilightIOJudge)); + } + } + break; + case Event.Types.EventID.IoNoteVisibility: + var twilightIONoteVisibility = eventItem.TwilightIONoteVisibility; + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIONoteVisibility.HandlerID) + { + var twilightIONoteVisibilityQueue = defaultComputer.TwilightIONoteVisibilityQueue; + lock (twilightIONoteVisibilityQueue) + { + twilightIONoteVisibilityQueue.Enqueue(Elapsable.GetElapsable(twilightIONoteVisibility)); + } + } + break; + case Event.Types.EventID.IoJudgmentMeter: + var twilightIOJudgmentMeter = eventItem.TwilightIOJudgmentMeter; + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOJudgmentMeter.HandlerID) + { + var twilightIOJudgmentMeterQueue = defaultComputer.TwilightIOJudgmentMeterQueue; + lock (twilightIOJudgmentMeterQueue) + { + twilightIOJudgmentMeterQueue.Enqueue(Elapsable.GetElapsable(twilightIOJudgmentMeter)); + } + } + break; + case Event.Types.EventID.IoMultiplier: + var twilightIOMultiplier = eventItem.TwilightIOMultiplier; + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOMultiplier.HandlerID) + { + var twilightIOMultiplierQueue = defaultComputer.TwilightIOMultiplierQueue; + lock (twilightIOMultiplierQueue) + { + twilightIOMultiplierQueue.Enqueue(Elapsable.GetElapsable(twilightIOMultiplier)); + } + } + break; + case Event.Types.EventID.IoAudioMultiplier: + var twilightIOAudioMultiplier = eventItem.TwilightIOAudioMultiplier; + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOAudioMultiplier.HandlerID) + { + var twilightAudioMultiplierQueue = defaultComputer.TwilightIOAudioMultiplierQueue; + lock (twilightAudioMultiplierQueue) + { + twilightAudioMultiplierQueue.Enqueue(Elapsable.GetElapsable(twilightIOAudioMultiplier)); + } + } + break; + case Event.Types.EventID.IoPause: + var twilightIOPause = Utility.GetJSON(eventItemText); + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOPause.handlerID) + { + defaultComputer.SetPause = twilightIOPause.isPaused; + } + break; + case Event.Types.EventID.IoQuit: + var twilightIOQuit = Utility.GetJSON(eventItemText); + if (defaultComputer is IOCompute && defaultComputer.HandlerID == twilightIOQuit.handlerID) + { + if (string.IsNullOrEmpty(twilightIOQuit.avatarID)) + { + defaultComputer.SetNoteFileMode(); + } + else + { + defaultComputer.IOLazyInit = new(() => + { + defaultComputer.SetPause = true; + }); + defaultComputer.LevyingWait = double.NaN; + defaultComputer.SetUndo = true; + defaultComputer.WaitingTwilightLevel = DefaultCompute.WaitingTwilight.CallIO; + } + } + break; + case Event.Types.EventID.AudioInput: + var twilightAudioInput = eventItem.TwilightAudioInput; + var audioInputSiteViewModel = ViewModels.Instance.GetSiteViewModel(twilightAudioInput.SiteID); + if (audioInputSiteViewModel?.IsAudioInput == true) + { + AudioInputSystem.Instance.Handle(twilightAudioInput.AvatarID, eventItemData[0].ToByteArray(), eventItemData[0].Length); + } + break; + case Event.Types.EventID.InvalidateAvatarDrawing: + AvatarDrawingSystem.Instance.WipeAvatarDrawing(eventItemText); + break; + case Event.Types.EventID.InvalidateAvatarTitle: + AvatarTitleSystem.Instance.WipeAvatarTitle(eventItemText); + break; + case Event.Types.EventID.InvalidateAvatarEdge: + AvatarEdgeSystem.Instance.WipeAvatarEdge(eventItemText); + break; + case Event.Types.EventID.AlreadyLoadingBundle: + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.AlreadyLoadingBundle); + ViewModels.Instance.NotifyValue.Open(); + break; + case Event.Types.EventID.PostItem: + var twilightPostItem = eventItem.TwilightPostItem; + if (defaultComputer is NetCompute && defaultComputer.IsPostableItemMode && defaultComputer.HandlerID == twilightPostItem.HandlerID) + { + defaultComputer.TwilightPostItemQueue.Enqueue(twilightPostItem); + } + break; + } + } + } + } + catch (AuthenticationException e) + { + if (!wasMITM) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.MITMFaultText, e.Message)); + wasMITM = true; + } + } + catch (SocketException) + { + Thread.Sleep(1000); + } + catch (Exception e) + { + if (_isAvailable) + { + if (textClose == null) + { + var (faultFilePath, _) = Utility.SetFault(FaultEntryPath, e); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, e.Message, false, null, () => Utility.OpenAs(faultFilePath)); + } + else if (textClose.Length > 0) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, string.Format($"{LanguageSystem.Instance.TwilightCloseContents} ({{0}})", textClose), false); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.TwilightCloseContents, false); + } + } + } + finally + { + if (IsEstablished) + { + HandlingUISystem.Instance.HandleParallel(siteContainerViewModel.SiteCollection.Clear); + ViewModels.Instance.WipeSiteViewModels(); + foreach (var bundleID in _saveBundleMap.Keys) + { + if (_saveBundleMap.Remove(bundleID, out var savingBundleItem)) + { + savingBundleItem.OnStop(false); + } + } + foreach (var bundleID in _saveAsBundleMap.Keys) + { + if (_saveAsBundleMap.Remove(bundleID, out var savingBundleItem)) + { + savingBundleItem.OnStop(false); + } + } + AvatarDrawingSystem.Instance.WipeAvatarDrawings(); + AvatarEdgeSystem.Instance.WipeAvatarEdges(); + AvatarTitleSystem.Instance.WipeAvatarTitles(); + Totem = string.Empty; + AvatarID = string.Empty; + AvatarName = string.Empty; + TwilightSituation = NotEstablished; + } + } + } + } + + public void Stop() + { + _ss?.Dispose(); + } + + public void Dispose() + { + _isAvailable = false; + Stop(); + } + + public async ValueTask GetWwwParallel(string target) + { + if (!target.IsFrontCaselsss(QwilightComponent.QwilightAPI) || IsEstablished) + { + try + { + var dataGet = new HttpRequestMessage(HttpMethod.Get, target); + var www = await _wwwClient.SendAsync(dataGet); + www.EnsureSuccessStatusCode(); + return await www.Content.ReadAsStreamAsync(); + } + catch + { + } + } + + return Stream.Null; + } + + public async ValueTask GetWwwParallel(string target) + { + if (target.EqualsCaseless($"{QwilightComponent.TaehuiNetFE}/qwilight/qwilight.json") || !target.IsFrontCaselsss(QwilightComponent.TaehuiNetFE) || IsEstablished) + { + try + { + var dataGet = new HttpRequestMessage(HttpMethod.Get, target); + using var www = await _wwwClient.SendAsync(dataGet); + www.EnsureSuccessStatusCode(); + var text = await www.Content.ReadAsStringAsync(); + if (!string.IsNullOrEmpty(text)) + { + return Utility.GetJSON(text); + } + } + catch + { + } + } + + return default(T); + } + + public async ValueTask PostWwwParallel(string target, string data, string dataVariety = "text/plain") + { + if (IsEstablished) + { + try + { + var dataPost = new HttpRequestMessage(HttpMethod.Post, target) + { + Content = new StringContent(data, Encoding.UTF8, dataVariety) + }; + dataPost.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); + using var www = await _wwwClient.SendAsync(dataPost); + www.EnsureSuccessStatusCode(); + return true; + } + catch + { + } + } + + return false; + } + + public async ValueTask PostAvatarDrawingParallel(string target, string fileName) + { + if (IsEstablished) + { + try + { + var dataContents = new ByteArrayContent(await File.ReadAllBytesAsync(fileName)); + dataContents.Headers.ContentDisposition = new("form-data") + { + Name = "data", + FileName = Path.GetFileName(fileName) + }; + dataContents.Headers.ContentType = new("image/png"); + var dataPost = new HttpRequestMessage(HttpMethod.Post, target) + { + Content = new MultipartFormDataContent + { + dataContents + } + }; + dataPost.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); + dataPost.Headers.Add("totem", Totem); + using var www = await _wwwClient.SendAsync(dataPost); + www.EnsureSuccessStatusCode(); + return true; + } + catch + { + } + } + + return false; + } + + public async ValueTask PostWwwParallel(string target, byte[] data) + { + if (IsEstablished) + { + try + { + var dataPost = new HttpRequestMessage(HttpMethod.Post, target) + { + Content = new ByteArrayContent(data) + }; + dataPost.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); + using var www = await _wwwClient.SendAsync(dataPost); + www.EnsureSuccessStatusCode(); + return await www.Content.ReadAsStringAsync(); + } + catch + { + } + } + + return string.Empty; + } + + public async ValueTask PutAvatarParallel(string target, string avatarIntro) + { + if (!target.IsFrontCaselsss(QwilightComponent.TaehuiNetFE) || IsEstablished) + { + try + { + var dataPut = new HttpRequestMessage(HttpMethod.Put, target) + { + Content = new StringContent(avatarIntro) + }; + dataPut.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); + dataPut.Headers.Add("totem", Totem); + using var www = await _wwwClient.SendAsync(dataPut); + www.EnsureSuccessStatusCode(); + return true; + } + catch + { + } + } + + return false; + } + + public async void GetDefaultNoteDate(long defaultNoteDate, bool isSilent) + { + var twilightWwwDefaultDate = await GetWwwParallel($"{QwilightComponent.QwilightAPI}/defaultNoteDate?date={defaultNoteDate}"); + if (twilightWwwDefaultDate.HasValue) + { + var date = twilightWwwDefaultDate.Value.date; + Configure.Instance.DefaultNoteDate = date; + if (isSilent) + { + GetDefaultNote(); + } + else + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + string.Format(LanguageSystem.Instance.SaveDefaultNoteNotify, DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongDateString()), + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + GetDefaultNote(); + } + }) + } + }); + } + + void GetDefaultNote() + { + SendParallel(Event.Types.EventID.SaveDefaultNote, Utility.GetEntry(QwilightComponent.BundleEntryPath).Select(bundleEntryPath => Path.GetFileName(bundleEntryPath))); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.SavingDefaultNoteContents); + } + } + } + + public async void GetDefaultUIDate(long defaultUIDate, bool isSilent) + { + var twilightWwwDefaultDate = await GetWwwParallel($"{QwilightComponent.QwilightAPI}/defaultUIDate?date={defaultUIDate}"); + if (twilightWwwDefaultDate.HasValue && !ViewModels.Instance.MainValue.IsVital) + { + var date = twilightWwwDefaultDate.Value.date; + Configure.Instance.DefaultUIDate = date; + if (isSilent) + { + GetDefaultUI(); + } + else + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + string.Format(LanguageSystem.Instance.SaveDefaultUINotify, DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongDateString()), + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + GetDefaultUI(); + } + }) + } + }); + } + + void GetDefaultUI() + { + SendParallel(Event.Types.EventID.SaveDefaultUi, bool.TrueString); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.SavingDefaultUIContents); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/UI/DrawingComponent.cs b/Qwilight/Qwilight/System/UI/DrawingComponent.cs new file mode 100644 index 0000000..934e5e3 --- /dev/null +++ b/Qwilight/Qwilight/System/UI/DrawingComponent.cs @@ -0,0 +1,780 @@ +using MoonSharp.Interpreter; +using Qwilight.Compute; +using Qwilight.Utilities; +using System.Text; + +namespace Qwilight +{ + public sealed class DrawingComponent + { + public int judgmentPaintComposition; + public int hitNotePaintComposition; + public int hitInputPaintComposition; + + public float audioVisualizerPosition0; + public float audioVisualizerPosition1; + public float audioVisualizerLength; + public float audioVisualizerHeight; + + public float mediaPosition0; + public float mediaPosition1; + public float mediaLength; + public float mediaHeight; + + public float mainPosition1; + public float mainHeight; + + public float mainPosition; + public float p2Position; + + public float judgmentMainPosition; + + public float mainWall0Position1; + public float mainWall0Length; + public float mainWall0Height; + + public float mainWall1Position1; + public float mainWall1Length; + public float mainWall1Height; + + public float hitPointsPosition0; + public float hitPointsPosition1; + public float hitPointsLength; + public float hitPointsHeight; + public int hitPointsSystem; + + public float levelPosition0; + public float levelPosition1; + public float levelLength; + public float levelHeight; + + public float bandPosition0; + public float bandPosition1; + public float binBandLength; + public float binBandHeight; + public int bandSystem; + public float enlargeBand; + + public float judgmentMeterPosition0; + public float judgmentMeterPosition1; + public float binJudgmentMeterLength; + public float binJudgmentMeterHeight; + public float judgmentMeterFrontDrawingLength; + public float judgmentMeterUnitDrawingLength; + public int judgmentMeterSystem; + + public float hunterPosition0; + public float hunterPosition1; + public float binHunterLength; + public float binHunterHeight; + public float hunterFrontDrawingLength; + public int hunterSystem; + + public float standCommaDrawingLength; + public float standPosition0; + public float standPosition1; + public float binStandLength; + public float binStandHeight; + public float standSystem; + + public float pointStopPointDrawingLength; + public float pointPosition0; + public float pointPosition1; + public float binPointLength; + public float binPointHeight; + public float pointUnitDrawingLength; + public int pointSystem; + + public float bpmPosition0; + public float bpmPosition1; + public float binBPMLength; + public float binBPMHeight; + public float bpmUnitDrawingLength; + public int bpmSystem; + + public float multiplierPosition0; + public float multiplierPosition1; + public float binMultiplierLength; + public float binMultiplierHeight; + public float multiplierStopPointDrawingLength; + public float multiplierUnitDrawingLength; + public int multiplierSystem; + + public float netPosition0; + public float netPosition1; + public int netSystem; + + public float pausePosition0; + public float pausePosition1; + public float pauseLength; + public float pauseHeight; + public int pauseSystem; + + public float statusPosition0; + public float statusPosition1; + public float statusLength; + public float statusHeight; + public int statusSystem; + + public float statusSliderPosition0; + public float statusSliderPosition1; + public float statusSliderLength; + public float statusSliderHeight; + public float statusSliderContentsLength; + public float statusSliderContentsHeight; + public int statusSliderSystem; + + public float hmsPosition0; + public float hmsPosition1; + public float binHmsLength; + public float binHmsHeight; + public int hmsSystem; + public float hmsColonDrawingLength; + public float hmsSlashDrawingLength; + + public float judgmentPointsPosition0; + public float judgmentPointsPosition1; + public float judgmentPointsLength; + public float judgmentPointsHeight; + public int judgmentPointsSystem; + + public float band1Position0; + public float band1Position1; + public float band1Length; + public float band1Height; + public int band1System; + + public float lastPosition0; + public float lastPosition1; + public float lastLength; + public float lastHeight; + public int lastSystem; + + public float autoMainPosition0; + public float autoMainPosition1; + public float autoMainLength; + public float autoMainHeight; + public int autoMainSystem; + + public float audioMultiplierPosition0; + public float audioMultiplierPosition1; + public float binAudioMultiplierLength; + public float binAudioMultiplierHeight; + public float audioMultiplierStopPointDrawingLength; + public float audioMultiplierUnitDrawingLength; + public int audioMultiplierSystem; + + public float hitPointsVisualizerPosition0; + public float hitPointsVisualizerPosition1; + public float binHitPointsVisualizerLength; + public float binHitPointsVisualizerHeight; + public float hitPointsVisualizerUnitDrawingLength; + public int hitPointsVisualizerSystem; + + public float limiterPosition1; + public float limiterLength; + public float limiterHeight; + + public float judgmentVisualizerPosition0; + public float judgmentVisualizerPosition1; + public float judgmentVisualizerLength; + public float judgmentVisualizerHeight; + public float judgmentVisualizerContentsLength; + public float judgmentVisualizerContentsHeight; + public int judgmentVisualizerSystem; + + public float judgmentInputVisualizerPosition0; + public float judgmentInputVisualizerPosition1; + public float judgmentInputVisualizerLength; + public float judgmentInputVisualizerHeight; + + public int highestJudgmentValueSystem; + public float highestJudgmentValuePosition0; + public float highestJudgmentValuePosition1; + public float binHighestJudgmentValueLength; + public float binHighestJudgmentValueHeight; + + public int higherJudgmentValueSystem; + public float higherJudgmentValuePosition0; + public float higherJudgmentValuePosition1; + public float binHigherJudgmentValueLength; + public float binHigherJudgmentValueHeight; + + public int highJudgmentValueSystem; + public float highJudgmentValuePosition0; + public float highJudgmentValuePosition1; + public float binHighJudgmentValueLength; + public float binHighJudgmentValueHeight; + + public int lowJudgmentValueSystem; + public float lowJudgmentValuePosition0; + public float lowJudgmentValuePosition1; + public float binLowJudgmentValueLength; + public float binLowJudgmentValueHeight; + + public int lowerJudgmentValueSystem; + public float lowerJudgmentValuePosition0; + public float lowerJudgmentValuePosition1; + public float binLowerJudgmentValueLength; + public float binLowerJudgmentValueHeight; + + public int lowestJudgmentValueSystem; + public float lowestJudgmentValuePosition0; + public float lowestJudgmentValuePosition1; + public float binLowestJudgmentValueLength; + public float binLowestJudgmentValueHeight; + + public int highestBandSystem; + public float highestBandPosition0; + public float highestBandPosition1; + public float binHighestBandLength; + public float binHighestBandHeight; + + public int inputVisualizerSystem; + public float inputVisualizerPosition0; + public float inputVisualizerPosition1; + public float binInputVisualizerLength; + public float binInputVisualizerHeight; + + public float titlePosition0; + public float titlePosition1; + public float titleLength; + public float titleHeight; + public int titleSystem0; + public int titleSystem1; + + public float artistPosition0; + public float artistPosition1; + public float artistLength; + public float artistHeight; + public int artistSystem0; + public int artistSystem1; + + public float genrePosition0; + public float genrePosition1; + public float genreLength; + public float genreHeight; + public int genreSystem0; + public int genreSystem1; + + public float levelTextPosition0; + public float levelTextPosition1; + public float levelTextLength; + public float levelTextHeight; + public int levelTextSystem0; + public int levelTextSystem1; + + public float wantLevelPosition0; + public float wantLevelPosition1; + public float wantLevelLength; + public float wantLevelHeight; + public int wantLevelSystem0; + public int wantLevelSystem1; + + public float judgmentPosition0; + public float judgmentPosition1; + public float judgmentLength; + public float judgmentHeight; + public int judgmentSystem; + + public int earlyValueSystem; + public float earlyValuePosition0; + public float earlyValuePosition1; + public float binEarlyValueLength; + public float binEarlyValueHeight; + + public int lateValueSystem; + public float lateValuePosition0; + public float lateValuePosition1; + public float binLateValueLength; + public float binLateValueHeight; + + public int judgmentVSVisualizerSystem; + public float judgmentVSVisualizerPosition0; + public float judgmentVSVisualizerPosition1; + public float binJudgmentVSVisualizerLength; + public float binJudgmentVSVisualizerHeight; + public float judgmentVSVisualizerStopPointDrawingLength; + + public float pausedUnpausePosition0; + public float pausedUnpausePosition1; + public float pausedUnpauseLength; + public float pausedUnpauseHeight; + + public float pausedStopPosition0; + public float pausedStopPosition1; + public float pausedStopLength; + public float pausedStopHeight; + + public float pausedUndoPosition0; + public float pausedUndoPosition1; + public float pausedUndoLength; + public float pausedUndoHeight; + + public float pausedConfigurePosition0; + public float pausedConfigurePosition1; + public float pausedConfigureLength; + public float pausedConfigureHeight; + + public float assistTextPosition1; + public float inputAssistTextPosition1; + + public int autoMainFrame; + public double autoMainFramerate; + public int judgmentMainFrame; + public int noteFrame; + public double noteFramerate; + public int pauseFrame; + public int mainFrame; + public double mainFramerate; + public double judgmentMainFramerate; + public int mainJudgmentMeterFrame; + public double mainJudgmentMeterFramerate; + public int noteHitFrame; + public double noteHitFramerate; + public int longNoteHitFrame; + public double longNoteHitFramerate; + public int inputFrame; + public double inputFramerate; + public int levelFrame; + public double levelFramerate; + public int hitInputPaintFrame; + public double hitInputPaintFramerate; + public int bandFrame; + public double bandFramerate; + public int judgmentFrame; + public double judgmentFramerate; + public int band1Frame; + public double band1Framerate; + public int lastFrame; + public double lastFramerate; + public int longNoteHitLoopFrame; + public int lastEnlargedBandLoopFrame; + + public int altWall0; + public int altWall1; + public int altHitPoints; + public int altBand; + public int altJudgmentMeter; + public int altStand; + public int altPoint; + public int altBPM; + public int altMultiplier; + public int altNet; + public int altPause; + public int altStatus; + public int altStatusSlider; + public int altHms; + public int altJudgmentPoints; + public int altLevel; + public int altAudioMultiplier; + public int altHitPointsVisualizer; + public int altJudgmentVisualizer; + public int altHighestJudgmentValue; + public int altHigherJudgmentValue; + public int altHighJudgmentValue; + public int altLowJudgmentValue; + public int altLowerJudgmentValue; + public int altLowestJudgmentValue; + public int altHighestBand; + public int altInputVisualizer; + public int altBand1; + public int altLast; + public int altHunter; + public int altAutoMain; + public int altEarlyValue; + public int altLateValue; + public int altJudgmentVSVisualizer; + public int altJudgmentInputVisualizer; + public int altMedia; + public int altTitle; + public int altArtist; + public int altGenre; + public int altLevelText; + public int altWantLevel; + + public float[] noteHeights = new float[53]; + public float[] noteHeightJudgments = new float[53]; + public float[] inputPosition0s = new float[53]; + public float[] inputPosition1s = new float[53]; + public float[] inputLengths = new float[53]; + public float[] inputHeights = new float[53]; + public float[] longNoteTailEdgeHeights = new float[53]; + public float[] longNoteTailEdgePositions = new float[53]; + public float[] longNoteTailContentsHeights = new float[53]; + public float[] longNoteFrontEdgeHeights = new float[53]; + public float[] longNoteFrontEdgePositions = new float[53]; + public float[] longNoteFrontContentsHeights = new float[53]; + public float[] autoInputPosition1s = new float[53]; + public float[] autoInputHeights = new float[53]; + public float[] judgmentMainPosition1s = new float[53]; + public float[] judgmentMainHeights = new float[53]; + public float[] hitNotePaintPosition0s = new float[53]; + public float[] hitNotePaintPosition1s = new float[53]; + public float[] hitNotePaintLengths = new float[53]; + public float[] hitNotePaintHeights = new float[53]; + public float[] hitLongNotePaintPosition0s = new float[53]; + public float[] hitLongNotePaintPosition1s = new float[53]; + public float[] hitLongNotePaintLengths = new float[53]; + public float[] hitLongNotePaintHeights = new float[53]; + public float[] mainJudgmentMeterPosition1s = new float[53]; + public float[] mainJudgmentMeterHeights = new float[53]; + + public readonly object PaintPropertyCSX = new(); + public readonly List PaintPropertyIDs = new(); + public readonly Dictionary[] PaintPropertyIntMap = new Dictionary[UI.HighestPaintPropertyID]; + public readonly Dictionary[] PaintPropertyValueMap = new Dictionary[UI.HighestPaintPropertyID]; + /// + /// 라인 길이 + /// 플로팅 노트는 라인 길이가 0 이다. + /// + public readonly float[] MainNoteLengthMap = new float[53]; + /// + /// 노트 길이 + /// + public readonly float[] DrawingNoteLengthMap = new float[53]; + /// + /// 노트는 여기서부터 그린다. + /// + public readonly float[] MainNoteLengthLevyingMap = new float[53]; + /// + /// 노트는 여기까지 그린다. + /// + public readonly float[] MainNoteLengthBuiltMap = new float[53]; + + public float p1BuiltLength; + public float p2BuiltLength; + + public DrawingComponent() + { + for (var i = PaintPropertyValueMap.Length - 1; i >= 0; --i) + { + PaintPropertyValueMap[i] = new(); + } + for (var i = PaintPropertyIntMap.Length - 1; i >= 0; --i) + { + PaintPropertyIntMap[i] = new(); + } + } + + public void SetValue(DefaultCompute defaultComputer) + { + var valueMap = new Dictionary(); + var intMap = new Dictionary(); + var has2P = defaultComputer.Has2P; + var inputMode = defaultComputer.InputMode; + var inputCount = Component.InputCounts[(int)inputMode]; + var autoableInputCount = Component.AutoableInputCounts[(int)inputMode]; + var noteLengths = new float[inputCount + 1]; + var floatingNotePosition0s = new float[inputCount + 1]; + var floatingNoteLengths = new float[inputCount + 1]; + var slashNotePosition0s = new float[inputCount + 1]; + var p1BuiltLengthFunc = new Func(e => (float)(MainNoteLengthBuiltMap.Skip(1).Take(defaultComputer.Input1PCount).DefaultIfEmpty(0).Max() * e)); + var p2BuiltLengthFunc = new Func(e => (float)(MainNoteLengthBuiltMap.Skip(1).Max() * e)); + var p1Length = new Func(e => (float)(MainNoteLengthBuiltMap.Skip(1).Take(Component.Input1PCounts[(int)inputMode]).DefaultIfEmpty(0).Max() * e)); + var lsCaller = new Script(); + lsCaller.Globals["judgmentStage"] = defaultComputer.JudgmentStage; + lsCaller.Globals["autoableInputCount"] = autoableInputCount; + lsCaller.Globals["defaultInputCount"] = inputCount - autoableInputCount; + lsCaller.Globals["inputCount"] = inputCount; + lsCaller.Globals["has2P"] = has2P; + var judgmentMainPosition1 = Configure.Instance.UIConfigureValue.JudgmentMainPosition1V2; + lsCaller.Globals["judgmentMainPosition"] = judgmentMainPosition1 + 600.0; + lsCaller.Globals["judgmentMainPositionV2"] = 1.0 + judgmentMainPosition1 / 600.0; + lsCaller.Globals["judgmentMainPositionV3"] = judgmentMainPosition1; + lsCaller.Globals["mainPosition"] = Configure.Instance.UIConfigureValue.MainPositionValues.GetValueOrDefault((int)inputMode); + lsCaller.Globals["noteLength"] = Configure.Instance.UIConfigureValue.NoteLengthText.GetValueOrDefault((int)inputMode); + lsCaller.Globals["noteHeight"] = Configure.Instance.UIConfigureValue.NoteHeightValue.GetValueOrDefault((int)inputMode); + lsCaller.Globals["bandPosition"] = Configure.Instance.UIConfigureValue.BandPositionV2; + lsCaller.Globals["inputMapping"] = (int)Configure.Instance.InputMappingValue; + lsCaller.Globals["P1Length"] = p1Length; + lsCaller.Globals["P1BuiltLength"] = p1BuiltLengthFunc; + lsCaller.Globals["P2BuiltLength"] = p2BuiltLengthFunc; + lsCaller.Globals["Wall"] = new Func(e => (float)(e + valueMap["mainPosition"] + p1BuiltLength)); + lsCaller.Globals["Contents"] = new Func(e => (float)(valueMap["mainPosition"] + p1BuiltLengthFunc(e))); + UI.Instance.SetConfigures(lsCaller); + + if (!string.IsNullOrEmpty(UI.Instance.UILS)) + { + lsCaller.DoString(UI.Instance.UILS); + } + + foreach (var (valueID, value) in UI.Instance.ValueMap) + { + valueMap[valueID] = value; + } + foreach (var (valueID, value) in UI.Instance.IntMap) + { + intMap[valueID] = value; + } + foreach (var (valueID, value) in UI.Instance.AltMap) + { + intMap[valueID] = has2P ? value : 0; + } + + // 이 항목들은 Wall, Contents 함수등 기반이 되므로 먼저 처리 + SaveValueMap("mainPosition"); + for (var i = UI.HighestNoteID; i > 0; --i) + { + SaveValueMap($"noteLength{i}"); + SaveValueMap($"floatingNotePosition0{i}"); + SaveValueMap($"floatingNoteLength{i}"); + SaveValueMap($"slashNotePosition0{i}"); + } + SaveSplitMap("noteLength", ref noteLengths); + SaveSplitMap("floatingNotePosition0", ref floatingNotePosition0s); + SaveSplitMap("floatingNoteLength", ref floatingNoteLengths); + SaveSplitMap("slashNotePosition0", ref slashNotePosition0s); + + Array.Clear(DrawingNoteLengthMap, 0, DrawingNoteLengthMap.Length); + Array.Clear(MainNoteLengthMap, 0, MainNoteLengthMap.Length); + for (var i = inputCount; i > 0; --i) + { + if (floatingNoteLengths[i] > 0.0) + { + DrawingNoteLengthMap[i] = floatingNoteLengths[i]; + MainNoteLengthMap[i] = 0F; + } + else + { + DrawingNoteLengthMap[i] = noteLengths[i]; + MainNoteLengthMap[i] = noteLengths[i]; + } + } + + Array.Clear(MainNoteLengthLevyingMap, 0, MainNoteLengthLevyingMap.Length); + Array.Clear(MainNoteLengthBuiltMap, 0, MainNoteLengthBuiltMap.Length); + for (var i = 1; i <= inputCount; ++i) + { + if (floatingNoteLengths[i] > 0.0) + { + MainNoteLengthLevyingMap[i] = floatingNotePosition0s[i]; + MainNoteLengthBuiltMap[i] = MainNoteLengthLevyingMap[i] + floatingNoteLengths[i]; + } + else + { + var inputMappingValue = (int)defaultComputer.InputMappingValue; + var j = Component.InputMappingValues[inputMappingValue, (int)inputMode][i]; + MainNoteLengthLevyingMap[i] += slashNotePosition0s[i]; + for (var m = 1; m < j; ++m) + { + var o = Component.BasePaintMap[inputMappingValue, (int)inputMode][m]; + MainNoteLengthLevyingMap[i] += MainNoteLengthMap[o] + slashNotePosition0s[o]; + } + MainNoteLengthBuiltMap[i] = MainNoteLengthLevyingMap[i] + MainNoteLengthMap[Component.BasePaintMap[inputMappingValue, (int)inputMode][j]]; + } + } + p1BuiltLength = p1BuiltLengthFunc(1.0); + p2BuiltLength = p2BuiltLengthFunc(1.0); + + // 위에서 여러 항목이 계산되므로 모든 항목을 다시 설정한다. + foreach (var valueID in UI.Instance.ValueCallMap.Keys) + { + SaveValueMap(valueID, true); + } + foreach (var (valueID, values) in UI.Instance.IntCallMap) + { + if (!intMap.ContainsKey(valueID)) + { + try + { + intMap[valueID] = (int)lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + catch + { + throw new ArgumentException($"{values[0]}({string.Join(", ", values.Skip(1))})"); + } + } + } + foreach (var (valueID, values) in UI.Instance.AltCallMap) + { + if (!intMap.ContainsKey(valueID)) + { + try + { + intMap[valueID] = has2P ? (int)lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number switch + { + 0 => 0, + 1 => 3, + 2 => 2, + _ => 0 + } : 0; + } + catch + { + throw new ArgumentException($"{values[0]}({string.Join(", ", values.Skip(1))})"); + } + } + } + + void SaveValueMap(string target, bool doForce = false) + { + if ((doForce || !valueMap.ContainsKey(target)) && UI.Instance.ValueCallMap.TryGetValue(target, out var values)) + { + try + { + valueMap[target] = lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + catch + { + throw new ArgumentException($"{values[0]}({string.Join(", ", values.Skip(1))})"); + } + } + } + + SaveSplitMap("noteHeight", ref noteHeights); + SaveSplitMap("noteHeightJudgment", ref noteHeightJudgments); + SaveSplitMap("inputPosition0", ref inputPosition0s); + SaveSplitMap("inputPosition1", ref inputPosition1s); + SaveSplitMap("inputLength", ref inputLengths); + SaveSplitMap("inputHeight", ref inputHeights); + SaveSplitMap("longNoteTailEdgeHeight", ref longNoteTailEdgeHeights); + SaveSplitMap("longNoteTailEdgePosition", ref longNoteTailEdgePositions); + SaveSplitMap("longNoteTailContentsHeight", ref longNoteTailContentsHeights); + SaveSplitMap("longNoteFrontEdgeHeight", ref longNoteFrontEdgeHeights); + SaveSplitMap("longNoteFrontEdgePosition", ref longNoteFrontEdgePositions); + SaveSplitMap("longNoteFrontContentsHeight", ref longNoteFrontContentsHeights); + SaveSplitMap("autoInputPosition1", ref autoInputPosition1s); + SaveSplitMap("autoInputHeight", ref autoInputHeights); + SaveSplitMap("judgmentMainPosition1", ref judgmentMainPosition1s); + SaveSplitMap("judgmentMainHeight", ref judgmentMainHeights); + SaveSplitMap("hitNotePaintPosition0", ref hitNotePaintPosition0s); + SaveSplitMap("hitNotePaintPosition1", ref hitNotePaintPosition1s); + SaveSplitMap("hitNotePaintLength", ref hitNotePaintLengths); + SaveSplitMap("hitNotePaintHeight", ref hitNotePaintHeights); + SaveSplitMap("hitLongNotePaintPosition0", ref hitLongNotePaintPosition0s); + SaveSplitMap("hitLongNotePaintPosition1", ref hitLongNotePaintPosition1s); + SaveSplitMap("hitLongNotePaintLength", ref hitLongNotePaintLengths); + SaveSplitMap("hitLongNotePaintHeight", ref hitLongNotePaintHeights); + SaveSplitMap("mainJudgmentMeterPosition1", ref mainJudgmentMeterPosition1s); + SaveSplitMap("mainJudgmentMeterHeight", ref mainJudgmentMeterHeights); + + void SaveSplitMap(string target, ref float[] data) + { + var drawingInputMode = UI.Instance.DrawingInputModeMap[(int)inputMode]; + for (var i = inputCount; i > 0; --i) + { + data[i] = (float)valueMap[$"{target}{drawingInputMode[i]}"]; + } + } + + lock (PaintPropertyCSX) + { + PaintPropertyIDs.Clear(); + for (var i = UI.Instance.PaintPropertyValues.Length - 1; i >= 0; --i) + { + PaintPropertyValueMap[i].Clear(); + PaintPropertyIntMap[i].Clear(); + + var paintPropertyValue = UI.Instance.PaintPropertyValues[i]; + if (paintPropertyValue != null) + { + PaintPropertyIDs.Add(i); + + foreach (var (valueID, value) in paintPropertyValue.ValueMap) + { + PaintPropertyValueMap[i][valueID] = value; + } + foreach (var (valueID, value) in paintPropertyValue.AltMap) + { + PaintPropertyIntMap[i][valueID] = value; + } + foreach (var (valueID, value) in paintPropertyValue.IntMap) + { + PaintPropertyIntMap[i][valueID] = value; + } + foreach (var (valueID, values) in paintPropertyValue.ValueCallMap) + { + if (!PaintPropertyValueMap[i].ContainsKey(valueID)) + { + try + { + PaintPropertyValueMap[i][valueID] = lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + catch + { + throw new ArgumentException($"{values[0]}({string.Join(", ", values.Skip(1))})"); + } + } + } + foreach (var (valueID, values) in paintPropertyValue.IntCallMap) + { + if (!PaintPropertyIntMap[i].ContainsKey(valueID)) + { + try + { + PaintPropertyIntMap[i][valueID] = (int)lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + catch + { + throw new ArgumentException($"{values[0]}({string.Join(", ", values.Skip(1))})"); + } + } + } + foreach (var (valueID, values) in paintPropertyValue.AltCallMap) + { + if (!PaintPropertyIntMap[i].ContainsKey(valueID)) + { + try + { + PaintPropertyIntMap[i][valueID] = has2P ? (int)lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number switch + { + 0 => 0, + 1 => 3, + 2 => 2, + _ => 0 + } : 0; + } + catch + { + throw new ArgumentException($"{values[0]}({string.Join(", ", values.Skip(1))})"); + } + } + } + } + } + } + + var drawingComponent = typeof(DrawingComponent); + foreach (var value in drawingComponent.GetFields().Where(value => !value.FieldType.IsArray && !value.IsInitOnly && value.Name != nameof(p1BuiltLength) && value.Name != nameof(p2BuiltLength))) + { + value.SetValue(this, default); + } + foreach (var (valueID, value) in valueMap) + { + drawingComponent.GetField(GetProperty(valueID))?.SetValue(this, (float)value); + } + foreach (var (valueID, value) in intMap) + { + drawingComponent.GetField(GetProperty(valueID))?.SetValue(this, value); + } + + static string GetProperty(string property) + { + switch (property) + { + case "alt-judgment-vs-visualizer": + return nameof(altJudgmentVSVisualizer); + case "alt-bpm": + return nameof(altBPM); + default: + property = property.Replace('!', '1'); + var propertyLength = property.Length; + var builder = new StringBuilder(); + for (var i = 0; i < propertyLength; ++i) + { + if (property[i] == '-') + { + builder.Append(property.Substring(i++ + 1, 1).ToUpperInvariant()); + } + else + { + builder.Append(property[i]); + } + } + return builder.ToString(); + } + } + } + } +} diff --git a/Qwilight/Qwilight/System/UI/PaintPipelineID.cs b/Qwilight/Qwilight/System/UI/PaintPipelineID.cs new file mode 100644 index 0000000..040c513 --- /dev/null +++ b/Qwilight/Qwilight/System/UI/PaintPipelineID.cs @@ -0,0 +1,59 @@ +namespace Qwilight +{ + public enum PaintPipelineID + { + Media, + AudioVisualizer, + MainWall, + Main, + AutoInput, + HitPoints = 6, + Note, + Input, + Band, + JudgmentMeter, + Stand, + Point, + BPM, + Multiplier, + JudgmentPaint, + Net = 26, + Unpause, + Status, + Hms, + JudgmentPoints, + JudgmentMain, + MainAreaFaint, + AudioMultiplier, + HitPointsVisualizer, + HighestJudgment, + HigherJudgment, + HighJudgment, + LowJudgment, + LowerJudgment, + LowestJudgment, + HighestBand, + Limiter, + JudgmentVisualizer, + InputVisualizer, + HitNotePaint, + Hunter, + Title, + Artist, + MediaInput, + VeilDrawing, + Genre, + LevelText, + AutoMain, + EarlyValue, + LateValue, + JudgmentVSVisualizer, + MainJudgmentMeter, + StatusSlider, + WantLevel, + Level, + JudgmentInputVisualizer, + PaintProperty0 = 100, + PaintProperty255 = 355 + } +} diff --git a/Qwilight/Qwilight/System/UI/PaintProperty.cs b/Qwilight/Qwilight/System/UI/PaintProperty.cs new file mode 100644 index 0000000..59d4828 --- /dev/null +++ b/Qwilight/Qwilight/System/UI/PaintProperty.cs @@ -0,0 +1,24 @@ +namespace Qwilight +{ + public sealed class PaintProperty + { + public enum ID + { + Position0, Position1, Length, Height, Alt, Frame, Framerate, Mode, Pipeline, Composition + } + + public Dictionary ValueCallMap { get; } = new(); + + public Dictionary IntCallMap { get; } = new(); + + public Dictionary AltCallMap { get; } = new(); + + public Dictionary ValueMap { get; } = new(); + + public Dictionary IntMap { get; } = new(); + + public Dictionary AltMap { get; } = new(); + + public DrawingItem?[] Drawings { get; set; } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/UI/UI.cs b/Qwilight/Qwilight/System/UI/UI.cs new file mode 100644 index 0000000..e284fa6 --- /dev/null +++ b/Qwilight/Qwilight/System/UI/UI.cs @@ -0,0 +1,2251 @@ +using Ionic.Zip; +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI; +using MoonSharp.Interpreter; +using Qwilight.Note; +using Qwilight.PaintComponent; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.IO; +using System.Text; +using Windows.UI; +using YamlDotNet.Core; +using YamlDotNet.RepresentationModel; + +namespace Qwilight +{ + public sealed class UI : Model, IDrawingContainer, IAudioContainer + { + public const int HighestUIConfigure = 16; + public const int HighestNoteID = 64; + public const int HighestPaintPropertyID = 256; + + public static readonly UI Instance = QwilightComponent.GetBuiltInData(nameof(UI)); + + public static void ZipUIFile(ZipFile zipFile, UIItem value, string entryPath) + { + var yamlFilePath = value.GetYamlFilePath(); + if (File.Exists(yamlFilePath)) + { + zipFile.AddFile(yamlFilePath, Path.Combine(entryPath, Path.GetRelativePath(QwilightComponent.UIEntryPath, Path.GetDirectoryName(yamlFilePath)))); + var ys = new YamlStream(); + using (var sr = File.OpenText(yamlFilePath)) + { + ys.Load(sr); + } + var formatNode = ys.Documents[0].RootNode[new YamlScalarNode("format")]; + var zipFilePath = Path.Combine(QwilightComponent.UIEntryPath, value.UIEntry, Path.ChangeExtension(Utility.GetText(formatNode, "zip", value.YamlName), "zip")); + if (File.Exists(zipFilePath)) + { + zipFile.AddFile(zipFilePath, Path.Combine(entryPath, Path.GetRelativePath(QwilightComponent.UIEntryPath, Path.GetDirectoryName(zipFilePath)))); + } + var luaFilePath = Path.Combine(QwilightComponent.UIEntryPath, value.UIEntry, Path.ChangeExtension(Utility.GetText(formatNode, "lua", value.YamlName), "lua")); + if (File.Exists(luaFilePath)) + { + zipFile.AddFile(luaFilePath, Path.Combine(entryPath, Path.GetRelativePath(QwilightComponent.UIEntryPath, Path.GetDirectoryName(luaFilePath)))); + } + } + } + + readonly Dictionary _audioItemMap = new(); + + /// + /// UI, BaseUI가 로드됨을 보장하는 락 + /// + public object ContentsCSX { get; } = new(); + + public XamlUIConfigure[] XamlUIConfigures { get; set; } = Array.Empty(); + + public string[] LoadedConfigures { get; } = new string[8]; + + public bool HasMain => PaintPipelineValues.Contains(PaintPipelineID.Main); + + public bool HasJudgmentMain => PaintPipelineValues.Contains(PaintPipelineID.JudgmentMain); + + public bool HasJudgmentCount => PaintPipelineValues.Contains(PaintPipelineID.HighestJudgment) || + PaintPipelineValues.Contains(PaintPipelineID.HigherJudgment) || + PaintPipelineValues.Contains(PaintPipelineID.HighJudgment) || + PaintPipelineValues.Contains(PaintPipelineID.LowJudgment) || + PaintPipelineValues.Contains(PaintPipelineID.LowerJudgment) || + PaintPipelineValues.Contains(PaintPipelineID.LowestJudgment); + + public bool HasJudgmentMeter => PaintPipelineValues.Contains(PaintPipelineID.JudgmentMeter); + + public bool HasJudgmentVisualizer => PaintPipelineValues.Contains(PaintPipelineID.JudgmentVisualizer); + + public bool HasJudgmentPaint => PaintPipelineValues.Contains(PaintPipelineID.JudgmentPaint); + + public bool HasHitNotePaint => PaintPipelineValues.Contains(PaintPipelineID.HitNotePaint); + + public bool HasBPM => PaintPipelineValues.Contains(PaintPipelineID.BPM); + + public bool HasNet => PaintPipelineValues.Contains(PaintPipelineID.Net); + + public bool HasJudgmentInputVisualizer => PaintPipelineValues.Contains(PaintPipelineID.JudgmentInputVisualizer); + + public bool HasHunter => PaintPipelineValues.Contains(PaintPipelineID.Hunter); + + public bool HasMediaInput => PaintPipelineValues.Contains(PaintPipelineID.MediaInput); + + public bool HasMainJudgmentMeter => PaintPipelineValues.Contains(PaintPipelineID.MainJudgmentMeter); + + public double DefaultLength { get; set; } + + public double DefaultHeight => Component.StandardHeight; + + public ObservableCollection UIItems { get; } = new(); + + public Dictionary IntCallMap { get; } = new(); + + public Dictionary ValueCallMap { get; } = new(); + + public Dictionary AltCallMap { get; } = new(); + + public Dictionary ValueMap { get; } = new(); + + public Dictionary IntMap { get; } = new(); + + public Dictionary AltMap { get; } = new(); + + public List PaintPipelineValues { get; } = new(); + + public Color TitleColor { get; set; } + + public Color ArtistColor { get; set; } + + public Color GenreColor { get; set; } + + public Color WantLevelIDColor { get; set; } + + public ICanvasBrush[] NetPaints { get; } = new ICanvasBrush[101]; + + public ICanvasBrush[] NetInPaints { get; } = new ICanvasBrush[101]; + + public List DrawingPipeline { get; } = new(); + + public int[][] DrawingInputModeMap { get; } = new int[17][]; + + public DrawingItem?[][] PauseDrawings { get; } = new DrawingItem?[3][]; + + public DrawingItem?[][][][][] NoteDrawings { get; } = new DrawingItem?[17][][][][]; + + public DrawingItem?[][][] NoteHitDrawings { get; } = new DrawingItem?[17][][]; + + public DrawingItem?[][][] LongNoteHitDrawings { get; } = new DrawingItem?[17][][]; + + public DrawingItem?[][][] MainDrawings { get; } = new DrawingItem?[17][][]; + + public DrawingItem?[][][] JudgmentMainDrawings { get; } = new DrawingItem?[17][][]; + + public DrawingItem?[][][] InputDrawings { get; } = new DrawingItem?[17][][]; + + public DrawingItem?[] MainWalls { get; } = new DrawingItem?[2]; + + public DrawingItem?[][] AutoInputDrawings { get; } = new DrawingItem?[17][]; + + public DrawingItem?[] BinStandMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinPointMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinHitPointsVisualizerMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinHmsMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinAudioMultiplierMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[][] BinJudgmentValueMap { get; } = new DrawingItem?[6][]; + + public DrawingItem?[] BinBPMMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinMultiplierMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinHighestBandMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinInputVisualizerMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinJudgmentMeterMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinHunterMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinEarlyValueMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinLateValueMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] BinJudgmentVSVisualizerMap { get; } = new DrawingItem?[10]; + + public DrawingItem?[] JudgmentPointsDrawings { get; } = new DrawingItem?[6]; + + public DrawingItem?[] JudgmentInputDrawings { get; } = new DrawingItem?[6]; + + public PaintProperty[] PaintPropertyValues { get; } = new PaintProperty[HighestPaintPropertyID]; + + public DrawingItem?[][] JudgmentDrawings { get; } = new DrawingItem?[11][]; + + public DrawingItem?[][] LevelDrawings { get; } = new DrawingItem?[6][]; + + public DrawingItem?[] AutoMainDrawings { get; set; } + + public Dictionary[][] MainJudgmentMeterDrawings { get; } = new Dictionary[17][]; + + public CanvasTextFormat TitleFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat ArtistFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat GenreFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat LevelTextFont { get; } = DrawingSystem.Instance.GetFont(); + + public CanvasTextFormat WantLevelFont { get; } = DrawingSystem.Instance.GetFont(); + + public string UILS { get; set; } = string.Empty; + + public bool MaintainLongNoteFrontEdge { get; set; } + + public bool MaintainAutoInput { get; set; } + + public int LoopingMain { get; set; } + + public int LoopingInput { get; set; } + + public bool SetJudgmentMainPosition { get; set; } + + public bool SetMainPosition { get; set; } + + public bool SetNoteLength { get; set; } + + public bool SetNoteHeight { get; set; } + + public bool SetBandPosition { get; set; } + + public DrawingItem?[] HitPointsDrawings { get; } = new DrawingItem?[8]; + + public HandledDrawingItem? VeilDrawing { get; set; } + + public DrawingItem? StatusDrawing { get; set; } + + public DrawingItem? StatusSliderDrawing { get; set; } + + public DrawingItem? CommaDrawing { get; set; } + + public DrawingItem? SlashDrawing { get; set; } + + public DrawingItem? ColonDrawing { get; set; } + + public DrawingItem? AudioMultiplierStopPointDrawing { get; set; } + + public DrawingItem? MultiplierStopPointDrawing { get; set; } + + public DrawingItem? PointStopPointDrawing { get; set; } + + public DrawingItem? JudgmentVSVisualizerStopPointDrawing { get; set; } + + public DrawingItem? PointUnitDrawing { get; set; } + + public DrawingItem? HitPointsVisualizerUnitDrawing { get; set; } + + public DrawingItem? BPMUnitDrawing { get; set; } + + public DrawingItem? JudgmentMererHigherDrawing { get; set; } + + public DrawingItem? JudgmentMeterLowerDrawing { get; set; } + + public DrawingItem? HunterHigherDrawing { get; set; } + + public DrawingItem? HunterLowerDrawing { get; set; } + + public DrawingItem? JudgmentMeterUnitDrawing { get; set; } + + public DrawingItem? AudioMultiplierUnitDrawing { get; set; } + + public DrawingItem? MultiplierUnitDrawing { get; set; } + + public DrawingItem?[,] BinBandMap { get; set; } + + public DrawingItem?[] PausedUnpauseDrawings { get; } = new DrawingItem?[2]; + + public DrawingItem?[] PausedStopDrawings { get; } = new DrawingItem?[2]; + + public DrawingItem?[] PausedUndoDrawings { get; } = new DrawingItem?[2]; + + public DrawingItem?[] PausedConfigureDrawings { get; } = new DrawingItem?[2]; + + public bool HandleAudio(string audioFileName, string defaultFileName, PausableAudioHandler pausableAudioHandler, double fadeInLength) + { + lock (ContentsCSX) + { + if (!_audioItemMap.TryGetValue(audioFileName, out var audioItem) && defaultFileName != null) + { + _audioItemMap.TryGetValue(defaultFileName, out audioItem); + } + if (audioItem != null) + { + AudioSystem.Instance.Handle(new AudioNote + { + AudioLevyingPosition = pausableAudioHandler?.GetAudioPosition() ?? 0U, + AudioItem = audioItem + }, AudioSystem.SEAudio, 1.0, false, pausableAudioHandler, fadeInLength); + return true; + } + return false; + } + } + + public string FaultText { get; set; } + + public UI() => Init(); + + void LoadUIImpl(UIItem src, UIItem target) + { + #region COMPATIBLE + Compatible.Compatible.UI(QwilightComponent.UIEntryPath, target.GetYamlFilePath(), target.YamlName, target.UIEntry); + #endregion + + var mainViewModel = ViewModels.Instance.MainValue; + try + { + Init(); + + var drawingMap = new int[HighestNoteID + 1][]; + drawingMap[0] = new int[] { 0 }; + var noteHitDrawings = new DrawingItem?[HighestNoteID + 1][]; + var longNoteHitDrawings = new DrawingItem?[HighestNoteID + 1][]; + var inputDrawings = new DrawingItem?[HighestNoteID + 1][]; + var noteDrawings = new DrawingItem?[HighestNoteID + 1][][][]; + var mainDrawings = new DrawingItem?[HighestNoteID + 1][]; + var autoInputDrawings = new DrawingItem?[HighestNoteID + 1]; + var judgmentMainDrawings = new DrawingItem?[HighestNoteID + 1][]; + var mainJudgmentMeterDrawings = new Dictionary[HighestNoteID + 1]; + string zipName; + + var lsCaller = new Script(); + + var parallelItems = new ConcurrentBag(); + + var ys = new YamlStream(); + using (var sr = File.OpenText(target.GetYamlFilePath())) + { + ys.Load(sr); + + var valueNode = ys.Documents[0].RootNode; + var formatNode = valueNode[new YamlScalarNode("format")]; + var funcNode = valueNode[new YamlScalarNode("func")]; + var frameNode = valueNode[new YamlScalarNode("frame")]; + var pointNode = valueNode[new YamlScalarNode("point")]; + (valueNode as YamlMappingNode).Children.TryGetValue(new YamlScalarNode("paint"), out var paintNode); + (valueNode as YamlMappingNode).Children.TryGetValue(new YamlScalarNode("font"), out var fontNode); + + zipName = Utility.GetText(formatNode, "zip", target.YamlName); + + XamlUIConfigures = Enumerable.Range(0, HighestUIConfigure).Select(i => + { + var configures = (Utility.GetText(funcNode, $"configure-{i}-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(funcNode, $"configure-{i}"))?.Split(',')?.Select(configure => configure.Trim())?.ToArray(); + if (configures != null) + { + LoadedConfigures[i] = Configure.Instance.UIConfigureValue.UIConfiguresV2[i] ??= configures.FirstOrDefault(); + return new XamlUIConfigure + { + Position = i, + Configures = configures, + ConfigureComment = Utility.GetText(funcNode, $"configure-comment-{i}-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(funcNode, $"configure-comment-{i}") + }; + } + else + { + return null; + } + }).Where(value => value != null).ToArray(); + SetConfigures(lsCaller); + + UILS = File.ReadAllText(Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, Path.ChangeExtension(Utility.GetText(formatNode, "lua", target.YamlName), "lua")), Encoding.UTF8); + Script.RunString(UILS); + lsCaller.DoString(UILS); + + var setPaintPipelines = Utility.ToBool(Utility.GetText(funcNode, "set-paint-pinelines", bool.FalseString)); + foreach (var pipeline in GetCalledText(Utility.GetText(funcNode, "pipeline")).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var pipeline) ? pipeline : 0)) + { + var paintPipeline = (PaintPipelineID)pipeline; + PaintPipelineValues.Add(paintPipeline); + if (paintPipeline == PaintPipelineID.JudgmentPaint && !setPaintPipelines) + { + PaintPipelineValues.Add(PaintPipelineID.HitNotePaint); + } + } + if (!PaintPipelineValues.Contains(PaintPipelineID.Media)) + { + PaintPipelineValues.Insert(0, PaintPipelineID.Media); + } + if (!PaintPipelineValues.Contains(PaintPipelineID.MainAreaFaint)) + { + var mainPosition = PaintPipelineValues.IndexOf(PaintPipelineID.Main); + if (mainPosition >= 0) + { + PaintPipelineValues.Insert(mainPosition, PaintPipelineID.MainAreaFaint); + } + } + if (!PaintPipelineValues.Contains(PaintPipelineID.Limiter)) + { + var mainPosition = PaintPipelineValues.IndexOf(PaintPipelineID.Main); + if (mainPosition >= 0) + { + PaintPipelineValues.Insert(mainPosition + 1, PaintPipelineID.Limiter); + } + } + if (!PaintPipelineValues.Contains(PaintPipelineID.VeilDrawing)) + { + var notePosition = PaintPipelineValues.IndexOf(PaintPipelineID.Note); + if (notePosition >= 0) + { + PaintPipelineValues.Insert(notePosition + 1, PaintPipelineID.VeilDrawing); + } + } + PaintPipelineValues.Add(PaintPipelineID.MediaInput); + SaveInt(funcNode, "drawingInputModeSystem", 0); + + TitleColor = Utility.GetText(paintNode, "title", nameof(Colors.White)).GetColor(); + ArtistColor = Utility.GetText(paintNode, "artist", nameof(Colors.DeepSkyBlue)).GetColor(); + GenreColor = Utility.GetText(paintNode, "genre", nameof(Colors.LightGreen)).GetColor(); + WantLevelIDColor = Utility.GetText(paintNode, "wantLevelID", nameof(Colors.DodgerBlue)).GetColor(); + parallelItems.Add(() => DrawingSystem.Instance.SetFaintPaints(this, NetPaints, Utility.GetText(paintNode, "net", nameof(Colors.White)).GetColor())); + parallelItems.Add(() => DrawingSystem.Instance.SetFaintPaints(this, NetInPaints, Utility.GetText(paintNode, "netIn", nameof(Colors.Black)).GetColor())); + + SaveValueMap(pointNode, "mainPosition"); + SaveValueMap(pointNode, "p2Position"); + + SaveValueMap(pointNode, "binLength"); + SaveValueMap(pointNode, "binHeight"); + SaveValueMapAsDefaultID("stopPointDrawingLength", "binLength"); + + SaveSplitValueMap("floatingNotePosition0", 0.0); + SaveSplitValueMap("floatingNoteLength", 0.0); + SaveSplitValueMap("slashNotePosition0", 0.0); + + SaveValueMap(pointNode, "judgmentMainPosition"); + + SaveValueMap(pointNode, "mediaPosition0", 0.0); + SaveValueMap(pointNode, "mediaPosition1", 0.0); + SaveValueMap(pointNode, "mediaLength", 1280.0); + SaveValueMap(pointNode, "mediaHeight", 720.0); + SaveAltMap("alt-media", 0); + + SaveValueMap(pointNode, "titlePosition0"); + SaveValueMap(pointNode, "titlePosition1"); + SaveValueMap(pointNode, "titleLength"); + SaveValueMap(pointNode, "titleHeight"); + SaveIntMap(pointNode, "titleSystem0"); + SaveIntMap(pointNode, "titleSystem1", 2); + SaveAltMap("alt-title", 0); + + SaveValueMap(pointNode, "artistPosition0"); + SaveValueMap(pointNode, "artistPosition1"); + SaveValueMap(pointNode, "artistLength"); + SaveValueMap(pointNode, "artistHeight"); + SaveIntMap(pointNode, "artistSystem0"); + SaveIntMap(pointNode, "artistSystem1", 2); + SaveAltMap("alt-artist", 0); + + SaveValueMap(pointNode, "genrePosition0"); + SaveValueMap(pointNode, "genrePosition1"); + SaveValueMap(pointNode, "genreLength"); + SaveValueMap(pointNode, "genreHeight"); + SaveIntMap(pointNode, "genreSystem0"); + SaveIntMap(pointNode, "genreSystem1"); + SaveAltMap("alt-genre", 0); + + SaveValueMap(pointNode, "levelTextPosition0"); + SaveValueMap(pointNode, "levelTextPosition1"); + SaveValueMap(pointNode, "levelTextLength"); + SaveValueMap(pointNode, "levelTextHeight"); + SaveIntMap(pointNode, "levelTextSystem0"); + SaveIntMap(pointNode, "levelTextSystem1"); + SaveAltMap("alt-level-text", 0); + + SaveValueMap(pointNode, "wantLevelPosition0"); + SaveValueMap(pointNode, "wantLevelPosition1"); + SaveValueMap(pointNode, "wantLevelLength"); + SaveValueMap(pointNode, "wantLevelHeight"); + SaveIntMap(pointNode, "wantLevelSystem0"); + SaveIntMap(pointNode, "wantLevelSystem1"); + SaveAltMap("alt-want-level", 0); + + SaveValueMap(pointNode, "audioVisualizerPosition0", 0.0); + SaveValueMap(pointNode, "audioVisualizerPosition1", 0.0); + SaveValueMap(pointNode, "audioVisualizerLength", 1280.0); + SaveValueMap(pointNode, "audioVisualizerHeight", 720.0); + + DrawingSystem.Instance.SetFontLevel(TitleFont, Utility.ToFloat32(Utility.GetText(fontNode, "titleLevel", QwilightComponent.GetBuiltInFloat64As("FontLevel0")))); + DrawingSystem.Instance.SetFontLevel(ArtistFont, Utility.ToFloat32(Utility.GetText(fontNode, "artistLevel", QwilightComponent.GetBuiltInFloat64As("FontLevel0")))); + DrawingSystem.Instance.SetFontLevel(GenreFont, Utility.ToFloat32(Utility.GetText(fontNode, "genreLevel", QwilightComponent.GetBuiltInFloat64As("FontLevel0")))); + DrawingSystem.Instance.SetFontLevel(LevelTextFont, Utility.ToFloat32(Utility.GetText(fontNode, "levelTextLevel", QwilightComponent.GetBuiltInFloat64As("FontLevel0")))); + DrawingSystem.Instance.SetFontLevel(WantLevelFont, Utility.ToFloat32(Utility.GetText(fontNode, "wantLevelLevel", QwilightComponent.GetBuiltInFloat64As("FontLevel0")))); + + DefaultLength = Utility.ToFloat64(Utility.GetText(formatNode, "defaultLength", "1280")); + + SaveValueMap(pointNode, "mainWall0Length"); + SaveValueMap(pointNode, "mainWall1Length"); + SaveValueMap(pointNode, "mainWall0Position1"); + SaveValueMap(pointNode, "mainWall0Height", 720.0); + SaveValueMap(pointNode, "mainWall1Position1"); + SaveValueMap(pointNode, "mainWall1Height", 720.0); + SaveAltMap("alt-wall-0", 2); + SaveAltMap("alt-wall-1", 2); + + SaveIntMap(frameNode, "main-frame"); + SaveValueMap(frameNode, "main-framerate"); + SaveValueMap(pointNode, "mainPosition1"); + SaveValueMap(pointNode, "mainHeight", 720.0); + + SaveSplitValueMap("autoInputPosition1"); + SaveSplitValueMap("autoInputHeight", 720.0); + + SaveIntMap(pointNode, "hitPointsSystem"); + SaveValueMap(pointNode, "hitPointsPosition0"); + SaveValueMap(pointNode, "hitPointsPosition1"); + SaveValueMap(pointNode, "hitPointsLength"); + SaveValueMap(pointNode, "hitPointsHeight"); + SaveAltMap("alt-hit-points", 2); + + SaveIntMap(frameNode, "note-frame"); + SaveValueMap(frameNode, "note-framerate"); + SaveSplitValueMap("noteLength"); + SaveSplitValueMap("noteHeight"); + SaveSplitValueMap("noteHeightJudgment"); + SaveSplitValueMap("longNoteTailEdgeHeight"); + SaveSplitValueMap("longNoteFrontEdgeHeight"); + SaveSplitValueMap("longNoteTailEdgePosition"); + SaveSplitValueMap("longNoteFrontEdgePosition"); + SaveSplitValueMap("longNoteTailContentsHeight"); + SaveSplitValueMap("longNoteFrontContentsHeight"); + MaintainLongNoteFrontEdge = Utility.ToBool(Utility.GetText(funcNode, "maintainLongNoteFrontEdge", bool.FalseString)); + MaintainAutoInput = Utility.ToBool(Utility.GetText(funcNode, "maintainAutoInput", bool.TrueString)); + LoopingMain = Utility.ToInt32(Utility.GetText(funcNode, "loopingMain", 0.ToString())); + LoopingInput = Utility.ToInt32(Utility.GetText(funcNode, "loopingInput", 0.ToString())); + SetJudgmentMainPosition = Utility.ToBool(Utility.GetText(funcNode, "setJudgmentMainPosition", bool.FalseString)); + SetMainPosition = Utility.ToBool(Utility.GetText(funcNode, "setMainPosition", bool.FalseString)); + SetNoteLength = Utility.ToBool(Utility.GetText(funcNode, "setNoteLength", bool.FalseString)); + SetNoteHeight = Utility.ToBool(Utility.GetText(funcNode, "setNoteHeight", bool.FalseString)); + SetBandPosition = Utility.ToBool(Utility.GetText(funcNode, "setBandPosition", bool.FalseString)); + + SaveIntMap(funcNode, "judgmentPaintComposition"); + SaveIntMap(funcNode, "hitNotePaintComposition", (int)CanvasComposite.Add); + + SaveIntMap(frameNode, "input-frame"); + SaveValueMap(frameNode, "input-framerate"); + SaveSplitValueMap("inputPosition0"); + SaveSplitValueMapAsDefaultID("inputPosition1", "judgmentMainPosition"); + SaveSplitValueMap("inputLength"); + SaveSplitValueMapAsDefaultID("inputHeight", "judgmentMainPosition", value => 720.0 - value); + + SaveIntMap(frameNode, "level-frame"); + SaveValueMap(frameNode, "level-framerate"); + SaveValueMap(pointNode, "levelPosition0"); + SaveValueMap(pointNode, "levelPosition1"); + SaveValueMap(pointNode, "levelLength"); + SaveValueMap(pointNode, "levelHeight"); + SaveAltMap("alt-level"); + + SaveIntMap(pointNode, "bandSystem"); + SaveValueMap(pointNode, "bandPosition0"); + SaveValueMap(pointNode, "bandPosition1"); + SaveIntMap(frameNode, "band-frame"); + SaveValueMap(frameNode, "band-framerate"); + SaveValueMapAsDefaultID("binBandLength", "binLength"); + SaveValueMapAsDefaultID("binBandHeight", "binHeight"); + SaveValueMap(pointNode, "enlargeBand"); + SaveAltMap("alt-band", 2); + + SaveIntMap(pointNode, "judgmentMeterSystem"); + SaveValueMap(pointNode, "judgmentMeterPosition0"); + SaveValueMap(pointNode, "judgmentMeterPosition1"); + SaveValueMapAsDefaultID("binJudgmentMeterLength", "binLength"); + SaveValueMapAsDefaultID("binJudgmentMeterHeight", "binHeight"); + SaveValueMapAsDefaultID("judgmentMeterFrontDrawingLength", "binJudgmentMeterLength"); + SaveValueMapAsDefaultID("judgmentMeterUnitDrawingLength", "binJudgmentMeterLength"); + SaveAltMap("alt-judgment-meter", 3); + + SaveIntMap(pointNode, "standSystem"); + SaveValueMap(pointNode, "standPosition0"); + SaveValueMap(pointNode, "standPosition1"); + SaveValueMapAsDefaultID("binStandLength", "binLength"); + SaveValueMapAsDefaultID("binStandHeight", "binHeight"); + SaveValueMapAsDefaultID("standCommaDrawingLength", "binLength"); + SaveAltMap("alt-stand"); + + SaveIntMap(pointNode, "pointSystem"); + SaveValueMap(pointNode, "pointPosition0"); + SaveValueMap(pointNode, "pointPosition1"); + SaveValueMapAsDefaultID("binPointLength", "binLength"); + SaveValueMapAsDefaultID("binPointHeight", "binHeight"); + SaveValueMapAsDefaultID("pointStopPointDrawingLength", "stopPointDrawingLength"); + SaveValueMapAsDefaultID("pointUnitDrawingLength", "binPointLength"); + SaveAltMap("alt-point"); + + SaveIntMap(pointNode, "bpmSystem"); + SaveValueMap(pointNode, "bpmPosition0"); + SaveValueMap(pointNode, "bpmPosition1"); + SaveValueMapAsDefaultID("binBPMLength", "binLength"); + SaveValueMapAsDefaultID("binBPMHeight", "binHeight"); + SaveValueMapAsDefaultID("bpmUnitDrawingLength", "binBPMLength"); + SaveAltMap("alt-bpm"); + + SaveIntMap(pointNode, "multiplierSystem"); + SaveValueMap(pointNode, "multiplierPosition0"); + SaveValueMap(pointNode, "multiplierPosition1"); + SaveValueMapAsDefaultID("binMultiplierLength", "binLength"); + SaveValueMapAsDefaultID("binMultiplierHeight", "binHeight"); + SaveValueMapAsDefaultID("multiplierStopPointDrawingLength", "stopPointDrawingLength"); + SaveValueMapAsDefaultID("multiplierUnitDrawingLength", "binMultiplierLength"); + SaveAltMap("alt-multiplier"); + + SaveIntMap(frameNode, "note-hit-frame"); + SaveValueMap(frameNode, "note-hit-framerate"); + SaveIntMap(frameNode, "long-note-hit-frame"); + SaveValueMap(frameNode, "long-note-hit-framerate"); + SaveIntMap(frameNode, "judgment-frame"); + SaveValueMap(frameNode, "judgment-framerate"); + SaveIntMap(pointNode, "judgmentSystem"); + SaveValueMap(pointNode, "judgmentPosition0"); + SaveValueMap(pointNode, "judgmentPosition1"); + SaveValueMap(pointNode, "judgmentLength"); + SaveValueMap(pointNode, "judgmentHeight"); + SaveSplitValueMap("hitNotePaintLength"); + SaveSplitValueMap("hitNotePaintHeight"); + SaveSplitValueMap("hitLongNotePaintLength"); + SaveSplitValueMap("hitLongNotePaintHeight"); + SaveSplitValueMapAsDefaultID("hitNotePaintPosition0", "hitNotePaintLength1", value => -value / 2); + SaveSplitValueMapAsDefaultID("hitNotePaintPosition1", "hitNotePaintHeight1", value => -value / 2); + SaveSplitValueMapAsDefaultID("hitLongNotePaintPosition0", "hitLongNotePaintLength1", value => -value / 2); + SaveSplitValueMapAsDefaultID("hitLongNotePaintPosition1", "hitLongNotePaintHeight1", value => -value / 2); + SaveIntMap(frameNode, "hit-input-paint-frame"); + SaveValueMap(frameNode, "hit-input-paint-framerate"); + SaveSplitValueMap("hitInputPaintPosition0"); + SaveSplitValueMap("hitInputPaintPosition1"); + SaveSplitValueMap("hitInputPaintLength"); + SaveSplitValueMap("hitInputPaintHeight"); + SaveIntMap(frameNode, "long-note-hit-loop-frame"); + SaveIntMap(frameNode, "last-enlarged-band-loop-frame"); + SaveIntMap(frameNode, "last-frame"); + SaveValueMap(frameNode, "last-framerate"); + SaveIntMap(pointNode, "lastSystem"); + SaveValueMap(pointNode, "lastPosition0"); + SaveValueMap(pointNode, "lastPosition1"); + SaveValueMap(pointNode, "lastLength"); + SaveValueMap(pointNode, "lastHeight"); + SaveAltMap("alt-last", 2); + SaveIntMap(frameNode, "band!-frame"); + SaveValueMap(frameNode, "band!-framerate"); + SaveIntMap(pointNode, "band!System"); + SaveValueMap(pointNode, "band!Position0"); + SaveValueMap(pointNode, "band!Position1"); + SaveValueMap(pointNode, "band!Length"); + SaveValueMap(pointNode, "band!Height"); + SaveAltMap("alt-band!", 2); + + SaveIntMap(pointNode, "netSystem"); + SaveValueMap(pointNode, "netPosition0"); + SaveValueMap(pointNode, "netPosition1"); + SaveAltMap("alt-net"); + + SaveIntMap(frameNode, "auto-main-frame"); + SaveValueMap(frameNode, "auto-main-framerate"); + SaveIntMap(pointNode, "autoMainSystem"); + SaveValueMap(pointNode, "autoMainPosition0"); + SaveValueMap(pointNode, "autoMainPosition1"); + SaveValueMap(pointNode, "autoMainLength"); + SaveValueMap(pointNode, "autoMainHeight"); + SaveAltMap("alt-auto-main"); + + SaveIntMap(frameNode, "pause-frame", 1); + SaveIntMap(pointNode, "pauseSystem"); + SaveValueMap(pointNode, "pausePosition0"); + SaveValueMap(pointNode, "pausePosition1"); + SaveValueMap(pointNode, "pauseLength"); + SaveValueMap(pointNode, "pauseHeight"); + SaveAltMap("alt-pause", 2); + + SaveIntMap(pointNode, "statusSystem"); + SaveValueMap(pointNode, "statusPosition0"); + SaveValueMap(pointNode, "statusPosition1"); + SaveValueMap(pointNode, "statusLength"); + SaveValueMap(pointNode, "statusHeight"); + SaveAltMap("alt-status"); + + SaveIntMap(pointNode, "statusSliderSystem"); + SaveValueMap(pointNode, "statusSliderPosition0"); + SaveValueMap(pointNode, "statusSliderPosition1"); + SaveValueMap(pointNode, "statusSliderLength"); + SaveValueMap(pointNode, "statusSliderHeight"); + SaveValueMap(pointNode, "statusSliderContentsLength"); + SaveValueMap(pointNode, "statusSliderContentsHeight"); + SaveAltMap("alt-status-slider"); + + SaveIntMap(pointNode, "hmsSystem"); + SaveValueMap(pointNode, "hmsPosition0"); + SaveValueMap(pointNode, "hmsPosition1"); + SaveValueMapAsDefaultID("binHmsLength", "binLength"); + SaveValueMapAsDefaultID("binHmsHeight", "binHeight"); + SaveValueMapAsDefaultID("hmsColonDrawingLength", "binLength"); + SaveValueMapAsDefaultID("hmsSlashDrawingLength", "binLength"); + SaveAltMap("alt-hms"); + + SaveIntMap(pointNode, "judgmentPointsSystem"); + SaveValueMap(pointNode, "judgmentPointsPosition0"); + SaveValueMap(pointNode, "judgmentPointsPosition1"); + SaveValueMap(pointNode, "judgmentPointsLength"); + SaveValueMap(pointNode, "judgmentPointsHeight"); + SaveAltMap("alt-judgment-points"); + + SaveIntMap(frameNode, "judgment-main-frame"); + SaveValueMap(frameNode, "judgment-main-framerate"); + SaveSplitValueMap("judgmentMainPosition1"); + SaveSplitValueMap("judgmentMainHeight"); + + SaveIntMap(frameNode, "main-judgment-meter-frame"); + SaveValueMap(frameNode, "main-judgment-meter-framerate"); + SaveSplitValueMap("mainJudgmentMeterPosition1"); + SaveSplitValueMap("mainJudgmentMeterHeight"); + + SaveIntMap(pointNode, "audioMultiplierSystem"); + SaveValueMap(pointNode, "audioMultiplierPosition0"); + SaveValueMap(pointNode, "audioMultiplierPosition1"); + SaveValueMapAsDefaultID("binAudioMultiplierLength", "binLength"); + SaveValueMapAsDefaultID("binAudioMultiplierHeight", "binHeight"); + SaveValueMapAsDefaultID("audioMultiplierStopPointDrawingLength", "stopPointDrawingLength"); + SaveValueMapAsDefaultID("audioMultiplierUnitDrawingLength", "binAudioMultiplierLength"); + SaveAltMap("alt-audio-multiplier"); + + SaveIntMap(pointNode, "hitPointsVisualizerSystem"); + SaveValueMap(pointNode, "hitPointsVisualizerPosition0"); + SaveValueMap(pointNode, "hitPointsVisualizerPosition1"); + SaveValueMapAsDefaultID("binHitPointsVisualizerLength", "binLength"); + SaveValueMapAsDefaultID("binHitPointsVisualizerHeight", "binHeight"); + SaveValueMap(pointNode, "hitPointsVisualizerUnitDrawingLength"); + SaveAltMap("alt-hit-points-visualizer"); + + SaveIntMap(pointNode, "highestJudgmentValueSystem"); + SaveValueMap(pointNode, "highestJudgmentValuePosition0"); + SaveValueMap(pointNode, "highestJudgmentValuePosition1"); + SaveValueMapAsDefaultID("binHighestJudgmentValueLength", "binLength"); + SaveValueMapAsDefaultID("binHighestJudgmentValueHeight", "binHeight"); + SaveAltMap("alt-highest-judgment-value"); + + SaveIntMap(pointNode, "higherJudgmentValueSystem"); + SaveValueMap(pointNode, "higherJudgmentValuePosition0"); + SaveValueMap(pointNode, "higherJudgmentValuePosition1"); + SaveValueMapAsDefaultID("binHigherJudgmentValueLength", "binLength"); + SaveValueMapAsDefaultID("binHigherJudgmentValueHeight", "binHeight"); + SaveAltMap("alt-higher-judgment-value"); + + SaveIntMap(pointNode, "highJudgmentValueSystem"); + SaveValueMap(pointNode, "highJudgmentValuePosition0"); + SaveValueMap(pointNode, "highJudgmentValuePosition1"); + SaveValueMapAsDefaultID("binHighJudgmentValueLength", "binLength"); + SaveValueMapAsDefaultID("binHighJudgmentValueHeight", "binHeight"); + SaveAltMap("alt-high-judgment-value"); + + SaveIntMap(pointNode, "lowJudgmentValueSystem"); + SaveValueMap(pointNode, "lowJudgmentValuePosition0"); + SaveValueMap(pointNode, "lowJudgmentValuePosition1"); + SaveValueMapAsDefaultID("binLowJudgmentValueLength", "binLength"); + SaveValueMapAsDefaultID("binLowJudgmentValueHeight", "binHeight"); + SaveAltMap("alt-low-judgment-value"); + + SaveIntMap(pointNode, "lowerJudgmentValueSystem"); + SaveValueMap(pointNode, "lowerJudgmentValuePosition0"); + SaveValueMap(pointNode, "lowerJudgmentValuePosition1"); + SaveValueMapAsDefaultID("binLowerJudgmentValueLength", "binLength"); + SaveValueMapAsDefaultID("binLowerJudgmentValueHeight", "binHeight"); + SaveAltMap("alt-lower-judgment-value"); + + SaveIntMap(pointNode, "lowestJudgmentValueSystem"); + SaveValueMap(pointNode, "lowestJudgmentValuePosition0"); + SaveValueMap(pointNode, "lowestJudgmentValuePosition1"); + SaveValueMapAsDefaultID("binLowestJudgmentValueLength", "binLength"); + SaveValueMapAsDefaultID("binLowestJudgmentValueHeight", "binHeight"); + SaveAltMap("alt-lowest-judgment-value"); + + SaveIntMap(pointNode, "highestBandSystem"); + SaveValueMap(pointNode, "highestBandPosition0"); + SaveValueMap(pointNode, "highestBandPosition1"); + SaveValueMapAsDefaultID("binHighestBandLength", "binLength"); + SaveValueMapAsDefaultID("binHighestBandHeight", "binHeight"); + SaveAltMap("alt-highest-band"); + + SaveValueMapAsDefaultID("limiterPosition1", "mainPosition1"); + SaveValueMap(pointNode, "limiterLength", 1.0); + SaveValueMapAsDefaultID("limiterHeight", "mainHeight"); + + SaveIntMap(pointNode, "judgmentVisualizerSystem"); + SaveValueMap(pointNode, "judgmentVisualizerPosition0"); + SaveValueMap(pointNode, "judgmentVisualizerPosition1"); + SaveValueMap(pointNode, "judgmentVisualizerLength"); + SaveValueMap(pointNode, "judgmentVisualizerHeight"); + SaveValueMap(pointNode, "judgmentVisualizerContentsLength"); + SaveValueMap(pointNode, "judgmentVisualizerContentsHeight"); + SaveAltMap("alt-judgment-visualizer"); + + SaveIntMap(pointNode, "hunterSystem"); + SaveValueMap(pointNode, "hunterPosition0"); + SaveValueMap(pointNode, "hunterPosition1"); + SaveValueMapAsDefaultID("binHunterLength", "binLength"); + SaveValueMapAsDefaultID("binHunterHeight", "binHeight"); + SaveValueMapAsDefaultID("hunterFrontDrawingLength", "binHunterLength"); + SaveAltMap("alt-hunter"); + + SaveIntMap(pointNode, "inputVisualizerSystem"); + SaveValueMap(pointNode, "inputVisualizerPosition0"); + SaveValueMap(pointNode, "inputVisualizerPosition1"); + SaveValueMapAsDefaultID("binInputVisualizerLength", "binLength"); + SaveValueMapAsDefaultID("binInputVisualizerHeight", "binHeight"); + SaveAltMap("alt-input-visualizer"); + + SaveIntMap(pointNode, "earlyValueSystem"); + SaveValueMap(pointNode, "earlyValuePosition0"); + SaveValueMap(pointNode, "earlyValuePosition1"); + SaveValueMapAsDefaultID("binEarlyValueLength", "binLength"); + SaveValueMapAsDefaultID("binEarlyValueHeight", "binHeight"); + SaveAltMap("alt-early-value"); + + SaveIntMap(pointNode, "lateValueSystem"); + SaveValueMap(pointNode, "lateValuePosition0"); + SaveValueMap(pointNode, "lateValuePosition1"); + SaveValueMapAsDefaultID("binLateValueLength", "binLength"); + SaveValueMapAsDefaultID("binLateValueHeight", "binHeight"); + SaveAltMap("alt-late-value"); + + SaveIntMap(pointNode, "judgmentVSVisualizerSystem"); + SaveValueMap(pointNode, "judgmentVSVisualizerPosition0"); + SaveValueMap(pointNode, "judgmentVSVisualizerPosition1"); + SaveValueMapAsDefaultID("binJudgmentVSVisualizerLength", "binLength"); + SaveValueMapAsDefaultID("binJudgmentVSVisualizerHeight", "binHeight"); + SaveValueMapAsDefaultID("judgmentVSVisualizerStopPointDrawingLength", "stopPointDrawingLength"); + SaveAltMap("alt-judgment-vs-visualizer"); + + SaveValueMap(pointNode, "judgmentInputVisualizerPosition0"); + SaveValueMap(pointNode, "judgmentInputVisualizerPosition1"); + SaveValueMap(pointNode, "judgmentInputVisualizerLength"); + SaveValueMap(pointNode, "judgmentInputVisualizerHeight"); + SaveAltMap("alt-judgment-input-visualizer"); + + SaveValueMap(pointNode, "pausedUnpausePosition0", 539); + SaveValueMap(pointNode, "pausedUnpausePosition1", 239); + SaveValueMap(pointNode, "pausedUnpauseLength", 202); + SaveValueMap(pointNode, "pausedUnpauseHeight", 53); + + SaveValueMap(pointNode, "pausedConfigurePosition0", 539); + SaveValueMap(pointNode, "pausedConfigurePosition1", 302); + SaveValueMap(pointNode, "pausedConfigureLength", 202); + SaveValueMap(pointNode, "pausedConfigureHeight", 53); + + SaveValueMap(pointNode, "pausedUndoPosition0", 539); + SaveValueMap(pointNode, "pausedUndoPosition1", 365); + SaveValueMap(pointNode, "pausedUndoLength", 202); + SaveValueMap(pointNode, "pausedUndoHeight", 53); + + SaveValueMap(pointNode, "pausedStopPosition0", 539); + SaveValueMap(pointNode, "pausedStopPosition1", 428); + SaveValueMap(pointNode, "pausedStopLength", 202); + SaveValueMap(pointNode, "pausedStopHeight", 53); + + SaveValueMap(pointNode, "assistTextPosition1", DefaultHeight / 2); + SaveValueMap(pointNode, "inputAssistTextPosition1", 2 * DefaultHeight / 3); + + for (var i = HighestNoteID; i > 0; --i) + { + drawingMap[i] = GetCalledText(Utility.GetText(funcNode, $"drawing{i}", i.ToString())).Split(',').Select(value => Utility.ToInt32(value, out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => 0 < drawingPipeline && drawingPipeline < HighestNoteID).ToArray(); + } + + DrawingInputModeMap[(int)Component.InputMode.InputMode4] = GetDrawingInputMode((int)Component.InputMode.InputMode4, "2, 3, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode5] = GetDrawingInputMode((int)Component.InputMode.InputMode5, "2, 3, 4, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode6] = GetDrawingInputMode((int)Component.InputMode.InputMode6, "2, 3, 2, 2, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode7] = GetDrawingInputMode((int)Component.InputMode.InputMode7, "2, 3, 2, 5, 2, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode8] = GetDrawingInputMode((int)Component.InputMode.InputMode8, "2, 3, 2, 3, 3, 2, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode9] = GetDrawingInputMode((int)Component.InputMode.InputMode9, "2, 3, 2, 3, 4, 3, 2, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode51] = GetDrawingInputMode((int)Component.InputMode.InputMode51, "1, 2, 3, 4, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode71] = GetDrawingInputMode((int)Component.InputMode.InputMode71, "1, 2, 3, 2, 5, 2, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode102] = GetDrawingInputMode2P((int)Component.InputMode.InputMode102, "1, 2, 3, 4, 3, 2, 2, 3, 4, 3, 2, 10"); + DrawingInputModeMap[(int)Component.InputMode.InputMode142] = GetDrawingInputMode2P((int)Component.InputMode.InputMode142, "1, 2, 3, 2, 5, 2, 3, 2, 2, 3, 2, 5, 2, 3, 2, 10"); + DrawingInputModeMap[(int)Component.InputMode.InputMode10] = GetDrawingInputMode((int)Component.InputMode.InputMode10, "2, 3, 2, 3, 2, 2, 3, 2, 3, 2"); + DrawingInputModeMap[(int)Component.InputMode.InputMode242] = GetDrawingInputMode((int)Component.InputMode.InputMode242, "6, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 11"); + DrawingInputModeMap[(int)Component.InputMode.InputMode484] = GetDrawingInputMode((int)Component.InputMode.InputMode484, "6, 6, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 9, 8, 7, 8, 7, 9, 8, 7, 8, 7, 8, 7, 11, 11"); + if (DrawingInputModeMap[(int)Component.InputMode.InputMode484].Length == 51) + { + DrawingInputModeMap[(int)Component.InputMode.InputMode484] = new int[] { default }.Append(DrawingInputModeMap[(int)Component.InputMode.InputMode484][1]).Concat(DrawingInputModeMap[(int)Component.InputMode.InputMode484].Skip(1)).Append(DrawingInputModeMap[(int)Component.InputMode.InputMode484][50]).ToArray(); + } + + DrawingPipeline.AddRange(GetCalledText(Utility.GetText(funcNode, "drawingPipeline", string.Join(", ", Enumerable.Range(0, HighestNoteID)))).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => drawingPipeline < HighestNoteID)); + + int[] GetDrawingInputMode(int mode, string defaultValue) + { + return new int[] { default }.Concat(GetCalledText(Utility.GetText(funcNode, $"drawingInputMode{mode}", defaultValue)).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => 0 < drawingPipeline && drawingPipeline < HighestNoteID)).ToArray(); + } + int[] GetDrawingInputMode2P(int mode, string defaultValue) + { + var drawingInputModeMap = GetDrawingInputMode(mode, defaultValue).Skip(1).ToArray(); + return IntMap["drawingInputModeSystem"] switch + { + 0 => new int[] { default }.Concat(drawingInputModeMap).Concat(drawingInputModeMap.Skip(1)).Append(drawingInputModeMap.First()).ToArray(), + 1 => new int[] { default }.Concat(drawingInputModeMap).Concat(drawingInputModeMap.Reverse()).ToArray(), + 2 => new int[] { default }.Concat(drawingInputModeMap).ToArray(), + _ => throw new ArgumentException("drawingInputModeSystem") + }; + } + string GetCalledText(string text) + { + if (QwilightComponent.GetCallComputer().IsMatch(text)) + { + var values = text.Split("("); + text = lsCaller.Call(lsCaller.Globals[values[0]], values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => Utility.ToInt32(value.Trim(), out var arg) ? (object)arg : value as object).ToArray()).String; + } + return text; + } + + static string[] GetCalledData(YamlNode yamlNode, string target, string[] defaultValues = null) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + return defaultValues; + } + else + { + return text.Split(',').Select(value => value.Trim()).ToArray(); + } + } + + void SaveInt(YamlNode yamlNode, string target, int defaultValue = default) + { + var text = Utility.GetText(yamlNode, target); + if (!string.IsNullOrEmpty(text) && Utility.ToInt32(text, out var value)) + { + IntMap[target] = value; + } + else + { + IntMap[target] = defaultValue; + } + } + void SaveIntMap(YamlNode yamlNode, string target, int defaultValue = default) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + IntMap[target] = defaultValue; + } + else + { + SaveIntMapImpl(text, target, IntMap, IntCallMap); + } + } + void SaveSplitValueMap(string target, double defaultValue = default) + { + var data = GetCalledData(pointNode, target); + if (data != null) + { + string lastData = null; + for (var i = 0; i < HighestNoteID; ++i) + { + var t = data.ElementAtOrDefault(i) ?? "~"; + var s = t != "~" ? t : lastData; + SaveValueMapImpl(s, $"{target}{i + 1}", ValueMap, ValueCallMap); + lastData = s; + } + } + else + { + for (var i = HighestNoteID - 1; i >= 0; --i) + { + ValueMap[$"{target}{i + 1}"] = defaultValue; + } + } + } + void SaveSplitValueMapAsDefaultID(string target, string defaultValueID = null, Func valueMapping = null) + { + var data = GetCalledData(pointNode, target); + if (data != null) + { + string lastData = null; + for (var i = 0; i < HighestNoteID; ++i) + { + var t = data.ElementAtOrDefault(i) ?? "~"; + var s = t != "~" ? t : lastData; + SaveValueMapImpl(s, $"{target}{i + 1}", ValueMap, ValueCallMap); + lastData = s; + } + } + else + { + for (var i = HighestNoteID - 1; i >= 0; --i) + { + if (ValueMap.TryGetValue(defaultValueID, out var defaultValue)) + { + ValueMap[$"{target}{i + 1}"] = valueMapping?.Invoke(defaultValue) ?? defaultValue; + } + } + } + } + void SaveValueMap(YamlNode yamlNode, string target, double defaultValue = default) + { + var text = Utility.GetText(yamlNode, target); + if (string.IsNullOrEmpty(text)) + { + ValueMap[target] = defaultValue; + } + else + { + SaveValueMapImpl(text, target, ValueMap, ValueCallMap); + } + } + void SaveValueMapAsDefaultID(string target, string defaultValueID, Func valueMapping = null) + { + var text = Utility.GetText(pointNode, target); + if (string.IsNullOrEmpty(text)) + { + if (ValueMap.TryGetValue(defaultValueID, out var defaultValue)) + { + ValueMap[target] = valueMapping?.Invoke(defaultValue) ?? defaultValue; + } + } + else + { + SaveValueMapImpl(text, target, ValueMap, ValueCallMap); + } + } + void SaveAltMap(string target, int defaultValue = default) + { + var text = Utility.GetText(funcNode, target); + if (string.IsNullOrEmpty(text)) + { + AltMap[target] = defaultValue; + } + else + { + SaveAltImpl(text, target, AltMap, AltCallMap); + } + } + for (var i = PaintPropertyValues.Length - 1; i >= 0; --i) + { + var data = GetCalledData(pointNode, $"paintProperty{i}"); + if (data?.Length > 4) + { + var paintProperty = new PaintProperty(); + SavePaintMap(PaintProperty.ID.Position0, 0); + SavePaintMap(PaintProperty.ID.Position1, 1); + SavePaintMap(PaintProperty.ID.Length, 2); + SavePaintMap(PaintProperty.ID.Height, 3); + SavePaintAlt(PaintProperty.ID.Alt, 4); + SavePaintInt(PaintProperty.ID.Frame, 5, 1); + SavePaintValue(PaintProperty.ID.Framerate, 6); + SavePaintInt(PaintProperty.ID.Mode, 7); + SavePaintInt(PaintProperty.ID.Pipeline, 8, -1); + SavePaintInt(PaintProperty.ID.Composition, 9); + PaintPropertyValues[i] = paintProperty; + void SavePaintMap(PaintProperty.ID target, int paintPosition, double defaultValue = default) + { + if (paintPosition < data.Length) + { + SaveValueMapImpl(data[paintPosition], target, paintProperty.ValueMap, paintProperty.ValueCallMap); + } + else + { + paintProperty.ValueMap[target] = defaultValue; + } + } + void SavePaintAlt(PaintProperty.ID target, int paintPosition, int defaultValue = default) + { + if (paintPosition < data.Length) + { + SaveAltImpl(data[paintPosition], target, paintProperty.AltMap, paintProperty.AltCallMap); + } + else + { + paintProperty.AltMap[target] = defaultValue; + } + } + void SavePaintValue(PaintProperty.ID target, int paintPosition, double defaultValue = default) + { + var text = data.ElementAtOrDefault(paintPosition); + if (!string.IsNullOrEmpty(text) && Utility.ToFloat64(data[paintPosition], out var value)) + { + paintProperty.ValueMap[target] = value; + } + else + { + paintProperty.ValueMap[target] = defaultValue; + } + } + void SavePaintInt(PaintProperty.ID target, int paintPosition, int defaultValue = default) + { + if (paintPosition < data.Length) + { + SaveIntMapImpl(data[paintPosition], target, paintProperty.IntMap, paintProperty.IntCallMap); + } + else + { + paintProperty.IntMap[target] = defaultValue; + } + } + } + } + static void SaveIntMapImpl(string text, T target, Dictionary toIntMap, Dictionary toCallMap) + { + if (Utility.ToInt32(text, out var r)) + { + toIntMap[target] = r; + } + else if (QwilightComponent.GetCallComputer().IsMatch(text)) + { + var data = new List(); + var values = text.Split("("); + data.Add(values[0]); + data.AddRange(values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => value.Trim())); + toCallMap[target] = data.ToArray(); + } + else + { + throw new ArgumentException(target.ToString()); + } + } + static void SaveValueMapImpl(string text, T target, Dictionary toValueMap, Dictionary toCallMap) + { + if (Utility.ToFloat64(text, out var r)) + { + toValueMap[target] = r; + } + else if (QwilightComponent.GetCallComputer().IsMatch(text)) + { + var data = new List(); + var values = text.Split("("); + data.Add(values[0]); + data.AddRange(values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => value.Trim())); + toCallMap[target] = data.ToArray(); + } + else + { + throw new ArgumentException(target.ToString()); + } + } + static void SaveAltImpl(string text, T target, Dictionary altMap, Dictionary toCallMap) + { + switch (text) + { + case "0": + altMap[target] = 0; + break; + case "1": + altMap[target] = 3; + break; + case "2": + altMap[target] = 2; + break; + default: + if (QwilightComponent.GetCallComputer().IsMatch(text)) + { + var data = new List(); + var values = text.Split("("); + data.Add(values[0]); + data.AddRange(values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => value.Trim())); + toCallMap[target] = data.ToArray(); + } + else + { + throw new ArgumentException(target.ToString()); + } + break; + } + } + } + + var getNote = new Func(args => "N"); + var getNotePaint = new Func(args => "N"); + var getLongNotePaint = new Func(args => "L"); + var getJudgmentPaint = new Func(args => "J"); + var getMain = new Func(args => "M"); + var getWall = new Func(args => "W"); + var get = new Func(args => "W"); + var getAutoInput = new Func(args => "A"); + var getAutoMain = new Func(args => "AM"); + var getPause = new Func(args => "PS"); + var getJudgmentMain = new Func(args => "J"); + var getMainJudgmentMeter = new Func(args => "JM"); + var getInput = new Func(args => "I"); + var getLevel = new Func(args => "L"); + var getPaintProperty = new Func(args => "P"); + var getHighestBandBin = new Func(args => "HC"); + var getStandBin = new Func(args => "S"); + + SetFunc("_GetNote", ref getNote); + SetFunc("_GetNotePaint", ref getNotePaint); + SetFunc("_GetLongNotePaint", ref getLongNotePaint); + SetFunc("_GetJudgmentPaint", ref getJudgmentPaint); + SetFunc("_GetMain", ref getMain); + SetFunc("_GetWall", ref getWall); + SetFunc("_GetAutoInput", ref getAutoInput); + SetFunc("_GetAutoMain", ref getAutoMain); + SetFunc("_GetJudgmentMain", ref getJudgmentMain); + SetFunc("_GetMainJudgmentMeter", ref getMainJudgmentMeter); + SetFunc("_GetInput", ref getInput); + SetFunc("_GetPaintProperty", ref getPaintProperty); + SetFunc("_GetHighestBandBin", ref getHighestBandBin); + SetFunc("_GetStandBin", ref getStandBin); + + void SetFunc(string funcName, ref Func value) + { + var funcValue = lsCaller.Globals[funcName]; + if (funcValue != null) + { + value = new Func(args => + { + try + { + return lsCaller.Call(funcValue, args).String; + } + catch + { + throw new ArgumentException($"{funcName}([{string.Join(", ", args)}])"); + } + }); + } + } + + foreach (var (toCallID, values) in IntCallMap) + { + if (!IntMap.ContainsKey(toCallID)) + { + var funcName = values[0]; + var funcValue = lsCaller.Globals[funcName]; + if (funcValue != null) + { + try + { + IntMap[toCallID] = (int)lsCaller.Call(funcValue, values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + catch + { + // 여기서는 불가능한 연산들 + } + } + else + { + throw new ArgumentException($"{funcName}({string.Join(", ", values.Skip(1))})"); + } + } + } + foreach (var paintPropertyValue in PaintPropertyValues.Where(paintPropertyValue => paintPropertyValue != null)) + { + foreach (var (toCallID, values) in paintPropertyValue.IntCallMap) + { + if (!paintPropertyValue.IntMap.ContainsKey(toCallID)) + { + var funcName = values[0]; + var funcValue = lsCaller.Globals[funcName]; + if (funcValue != null) + { + try + { + paintPropertyValue.IntMap[toCallID] = (int)lsCaller.Call(lsCaller.Globals[values[0]], values.Skip(1).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + catch + { + // 여기서는 불가능한 연산들 + } + } + else + { + throw new ArgumentException($"{funcName}({string.Join(", ", values.Skip(1))})"); + } + } + } + switch (paintPropertyValue.IntMap[PaintProperty.ID.Mode]) + { + case 0: + case 2: + paintPropertyValue.Drawings = new DrawingItem?[paintPropertyValue.IntMap[PaintProperty.ID.Frame]]; + break; + case 1: + paintPropertyValue.Drawings = new DrawingItem?[paintPropertyValue.IntMap[PaintProperty.ID.Frame] + 1]; + break; + } + } + + for (var i = BinJudgmentValueMap.Length - 1; i >= 0; --i) + { + BinJudgmentValueMap[i] = new DrawingItem?[10]; + } + IntMap.TryGetValue("judgment-frame", out var judgmentFrame); + for (var i = JudgmentDrawings.Length - 1; i >= 0; --i) + { + JudgmentDrawings[i] = new DrawingItem?[judgmentFrame]; + } + IntMap.TryGetValue("band!-frame", out var band1Frame); + JudgmentDrawings[JudgmentPaint.Band1] = new DrawingItem?[band1Frame]; + IntMap.TryGetValue("last-frame", out var lastFrame); + JudgmentDrawings[JudgmentPaint.Last] = new DrawingItem?[lastFrame]; + if (!IntMap.TryGetValue("band-frame", out var bandFrame)) + { + bandFrame = 1; + IntMap["band-frame"] = bandFrame; + } + BinBandMap = new DrawingItem?[10, bandFrame]; + IntMap.TryGetValue("note-hit-frame", out var noteHitFrame); + for (var i = noteHitDrawings.Length - 1; i > 0; --i) + { + noteHitDrawings[i] = new DrawingItem?[noteHitFrame]; + } + IntMap.TryGetValue("long-note-hit-frame", out var longNoteHitFrame); + for (var i = longNoteHitDrawings.Length - 1; i > 0; --i) + { + longNoteHitDrawings[i] = new DrawingItem?[longNoteHitFrame]; + } + if (!IntMap.TryGetValue("long-note-hit-loop-frame", out var longNoteHitLoopFrame)) + { + longNoteHitLoopFrame = longNoteHitFrame; + IntMap["long-note-hit-loop-frame"] = longNoteHitLoopFrame; + } + if (!IntMap.TryGetValue("last-enlarged-band-loop-frame", out var lastEnlargedBandLoopFrame)) + { + lastEnlargedBandLoopFrame = longNoteHitLoopFrame; + IntMap["last-enlarged-band-loop-frame"] = lastEnlargedBandLoopFrame; + } + IntMap.TryGetValue("main-frame", out var mainFrame); + for (var i = mainDrawings.Length - 1; i > 0; --i) + { + mainDrawings[i] = new DrawingItem?[mainFrame + 1]; + } + IntMap.TryGetValue("judgment-main-frame", out var judgmentMainFrame); + for (var i = judgmentMainDrawings.Length - 1; i > 0; --i) + { + judgmentMainDrawings[i] = new DrawingItem?[judgmentMainFrame + 1]; + } + IntMap.TryGetValue("input-frame", out var inputFrame); + for (var i = inputDrawings.Length - 1; i > 0; --i) + { + inputDrawings[i] = new DrawingItem?[inputFrame + 1]; + } + IntMap.TryGetValue("level-frame", out var levelFrame); + for (var i = LevelDrawings.Length - 1; i >= 0; --i) + { + LevelDrawings[i] = new DrawingItem?[levelFrame]; + } + IntMap.TryGetValue("note-frame", out var noteFrame); + for (var i = noteDrawings.Length - 1; i >= 0; --i) + { + noteDrawings[i] = new DrawingItem?[noteFrame][][]; + for (var j = noteDrawings[i].Length - 1; j >= 0; --j) + { + noteDrawings[i][j] = new DrawingItem?[18][]; + for (var m = noteDrawings[i][j].Length - 1; m >= 0; --m) + { + noteDrawings[i][j][m] = new DrawingItem?[3]; + } + } + } + IntMap.TryGetValue("auto-main-frame", out var autoMainFrame); + AutoMainDrawings = new DrawingItem?[autoMainFrame]; + IntMap.TryGetValue("pause-frame", out var pauseFrame); + for (var i = PauseDrawings.Length - 1; i >= 0; --i) + { + PauseDrawings[i] = new DrawingItem?[pauseFrame]; + } + IntMap.TryGetValue("main-judgment-meter-frame", out var mainJudgmentMeterFrame); + for (var i = mainJudgmentMeterDrawings.Length - 1; i > 0; --i) + { + mainJudgmentMeterDrawings[i] = new Dictionary(); + } + DrawingItem? pointUnitDrawing = null; + DrawingItem? multiplierUnitDrawing = null; + DrawingItem? stopPointDrawing = null; + DrawingItem? lowerDrawing = null; + DrawingItem? higherDrawing = null; + var binMap = new DrawingItem?[10]; + var audioValues = new ConcurrentDictionary(); + var drawingValues = new ConcurrentDictionary(); + var handledDrawingValues = new ConcurrentDictionary(); + var zipFilePath = Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, Path.ChangeExtension(zipName, "zip")); + var fileNames = new HashSet(); + if (File.Exists(zipFilePath)) + { + using var zipFile = new ZipFile(zipFilePath); + foreach (var zipEntry in zipFile) + { + if (!zipEntry.IsDirectory) + { + var rms = PoolSystem.Instance.GetDataFlow((int)zipEntry.UncompressedSize); + zipEntry.Extract(rms); + SetDrawing(zipEntry.FileName, rms); + } + } + } + foreach (var pausedFileName in new[] { "Configure 0.png", "Configure 1.png", "Stop 0.png", "Stop 1.png", "Undo 0.png", "Undo 1.png", "Unpause 0.png", "Unpause 1.png" }) + { + if (!fileNames.Contains($"Paused/{pausedFileName}")) + { + SetDrawing($"Paused/{pausedFileName}", File.OpenRead(Path.Combine(AppContext.BaseDirectory, "Assets", "Paused", pausedFileName))); + } + } + void SetDrawing(string fileName, Stream s) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + fileNames.Add(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Audio": + parallelItems.Add(() => + { + try + { + using (s) + { + audioValues[fileName] = AudioSystem.Instance.Load(s, this, 1F, null, QwilightComponent.GetLoopingAudioComputer().IsMatch(justFileName)); + } + } + catch + { + } + }); + break; + case "Note": + case "Main": + NewDrawing(s, true); + break; + case "Drawing": + switch (justFileName) + { + case "Veil": + NewHandledDrawing(s); + break; + default: + NewDrawing(s); + break; + } + break; + default: + NewDrawing(s); + break; + } + void NewDrawing(Stream s, bool setAverage = false) => parallelItems.Add(() => + { + try + { + using (s) + { + drawingValues[fileName] = DrawingSystem.Instance.Load(s, this, setAverage); + } + } + catch + { + } + }); + void NewHandledDrawing(Stream s) + { + parallelItems.Add(() => + { + using (s) + { + try + { + handledDrawingValues[fileName] = new HandledDrawingItem + { + Drawing = DrawingSystem.Instance.Load(s, this), + DefaultDrawing = DrawingSystem.Instance.LoadDefault(s, this) + }; + } + catch + { + } + } + }); + } + } + + if (src != target) + { + AudioSystem.Instance.Close(this); + DrawingSystem.Instance.Close(this); + } + Utility.HandleHMP(parallelItems, Configure.Instance.UIBin, parallelItem => parallelItem()); + + foreach (var fileName in audioValues.Keys) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + var audioItem = audioValues[fileName]; + if (Path.GetDirectoryName(fileName) == "Audio") + { + _audioItemMap[justFileName] = audioItem; + } + } + foreach (var (fileName, drawingItem) in drawingValues.OrderBy(drawingValue => drawingValue.Key)) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Paint": + var fileNameContents = justFileName.Split(' '); + var main = Utility.ToInt32(fileNameContents.ElementAtOrDefault(1)); + var frame = Utility.ToInt32(fileNameContents.ElementAtOrDefault(2)); + if (fileNameContents[0] == getNotePaint(new[] { main, frame })) + { + switch (fileNameContents.Length) + { + case 2: + for (var i = HighestNoteID; i > 0; --i) + { + noteHitDrawings.SetValue(i, main, drawingItem); + } + break; + case 3: + foreach (var drawingMapValue in drawingMap[main]) + { + noteHitDrawings.SetValue(drawingMapValue, frame, drawingItem); + } + break; + } + } + else if (fileNameContents[0] == getLongNotePaint(new[] { main, frame })) + { + switch (fileNameContents.Length) + { + case 2: + for (var i = HighestNoteID; i > 0; --i) + { + longNoteHitDrawings.SetValue(i, main, drawingItem); + } + break; + case 3: + foreach (var drawingMapValue in drawingMap[main]) + { + longNoteHitDrawings.SetValue(drawingMapValue, frame, drawingItem); + } + break; + } + } + else if (fileNameContents[0] == getJudgmentPaint(new[] { main, frame })) + { + JudgmentDrawings.SetValue(main, frame, drawingItem); + } + break; + case "Drawing": + fileNameContents = justFileName.Split(' '); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var value1); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var value2); + if (fileNameContents[0] == getPaintProperty(new[] { value1, value2 })) + { + Utility.GetValue(PaintPropertyValues, value1)?.Drawings?.SetValue(fileNameContents.Length >= 3 ? value2 : 0, drawingItem); + } + else if (fileNameContents[0] == getAutoMain(new[] { value1 })) + { + AutoMainDrawings[value1] = drawingItem; + } + else if (fileNameContents[0] == getPause(new[] { value1, value2 })) + { + PauseDrawings.SetValue(value1, value2, drawingItem); + } + else if (justFileName.IsFrontCaselsss("JI")) + { + if (Utility.ToInt32(justFileName.Split(' ')[1], out var i)) + { + JudgmentInputDrawings.SetValue(i, drawingItem); + } + } + else if (justFileName.IsFrontCaselsss("J")) + { + if (Utility.ToInt32(justFileName.Split(' ')[1], out var i)) + { + JudgmentPointsDrawings.SetValue(i, drawingItem); + } + } + else if (justFileName.IsFrontCaselsss("HP")) + { + if (Utility.ToInt32(justFileName.Split(' ')[1], out var i)) + { + HitPointsDrawings.SetValue(i, drawingItem); + } + } + else + { + switch (justFileName) + { + case "Status": + StatusDrawing = drawingItem; + break; + case "Status Slider": + StatusSliderDrawing = drawingItem; + break; + } + } + break; + case "Note": + fileNameContents = justFileName.Split(' '); + main = Utility.ToInt32(fileNameContents.ElementAtOrDefault(1)); + frame = Utility.ToInt32(fileNameContents.ElementAtOrDefault(2)); + var text = Utility.ToInt32(fileNameContents.ElementAtOrDefault(3)); + var longNoteContents = Utility.ToInt32(fileNameContents.ElementAtOrDefault(4)); + if (fileNameContents[0] == getNote(new[] { main, frame, text, longNoteContents })) + { + var status = fileNameContents.Length > 4 ? longNoteContents : LongNote.LongNoteBefore; + foreach (var drawingMapValue in drawingMap[main]) + { + noteDrawings.SetValue(drawingMapValue, frame, text, status, drawingItem); + } + } + break; + case "Main": + fileNameContents = justFileName.Split(' '); + main = Utility.ToInt32(fileNameContents.ElementAtOrDefault(1)); + frame = Utility.ToInt32(fileNameContents.ElementAtOrDefault(2)); + if (fileNameContents[0] == getMain(new[] { main, frame })) + { + foreach (var drawingMapValue in drawingMap[main]) + { + mainDrawings.SetValue(drawingMapValue, frame, drawingItem); + } + } + else if (fileNameContents[0] == getWall(new[] { main, frame })) + { + MainWalls.SetValue(main, drawingItem); + } + else if (fileNameContents[0] == getAutoInput(new[] { main, frame })) + { + foreach (var drawingMapValue in drawingMap[main]) + { + autoInputDrawings.SetValue(drawingMapValue, drawingItem); + } + } + else if (fileNameContents[0] == getJudgmentMain(new[] { main, frame })) + { + foreach (var drawingMapValue in drawingMap[main]) + { + judgmentMainDrawings.SetValue(drawingMapValue, frame, drawingItem); + } + } + else if (fileNameContents[0] == getMainJudgmentMeter(new[] { main, frame })) + { + if (main > 0) + { + foreach (var drawingMapValue in drawingMap[main]) + { + mainJudgmentMeterDrawings[drawingMapValue][frame] = drawingItem; + } + } + else + { + for (var i = drawingMap.Length - 1; i > 0; --i) + { + mainJudgmentMeterDrawings[i][frame] = drawingItem; + } + } + } + break; + case "Input": + fileNameContents = justFileName.Split(' '); + main = Utility.ToInt32(fileNameContents[1]); + frame = Utility.ToInt32(fileNameContents[2]); + if (fileNameContents[0] == getInput(new[] { main, frame })) + { + foreach (var drawingMapValue in drawingMap[main]) + { + if (drawingMapValue > 0) + { + inputDrawings.SetValue(drawingMapValue, frame, drawingItem); + } + } + } + break; + case "Level": + fileNameContents = justFileName.Split(' '); + main = Utility.ToInt32(fileNameContents[1]); + frame = Utility.ToInt32(fileNameContents[2]); + if (fileNameContents[0] == getLevel(new[] { main, frame })) + { + LevelDrawings.SetValue(main, frame, drawingItem); + } + break; + case "Paused": + fileNameContents = justFileName.Split(' '); + switch (fileNameContents[0]) + { + case "Unpause": + PausedUnpauseDrawings[Utility.ToInt32(fileNameContents[1])] = drawingItem; + break; + case "Stop": + PausedStopDrawings[Utility.ToInt32(fileNameContents[1])] = drawingItem; + break; + case "Undo": + PausedUndoDrawings[Utility.ToInt32(fileNameContents[1])] = drawingItem; + break; + case "Configure": + PausedConfigureDrawings[Utility.ToInt32(fileNameContents[1])] = drawingItem; + break; + } + break; + case "Bin": + switch (justFileName) + { + case "%": + pointUnitDrawing = drawingItem; + break; + case ",": + CommaDrawing = drawingItem; + break; + case ".": + stopPointDrawing = drawingItem; + break; + case "..": + ColonDrawing = drawingItem; + break; + case "+": + higherDrawing = drawingItem; + break; + case "-": + lowerDrawing = drawingItem; + break; + case "BPM": + BPMUnitDrawing = drawingItem; + break; + case "Millis": + JudgmentMeterUnitDrawing = drawingItem; + break; + case "Slash": + SlashDrawing = drawingItem; + break; + case "X": + multiplierUnitDrawing = drawingItem; + break; + default: + fileNameContents = justFileName.Split(' '); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out value1); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out value2); + if (Utility.ToInt32(justFileName, out var bin)) + { + binMap.SetValue(bin, drawingItem); + } + else if (fileNameContents[0].IsFrontCaselsss("A")) + { + switch (justFileName) + { + case "AW": + AudioMultiplierUnitDrawing = drawingItem; + break; + case "A .": + AudioMultiplierStopPointDrawing = drawingItem; + break; + default: + BinAudioMultiplierMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == "B") + { + BinBPMMap.SetValue(value1, drawingItem); + } + else if (fileNameContents[0] == "C") + { + switch (fileNameContents.Length) + { + case 2: + BinBandMap.SetValue(value1, 0, drawingItem); + break; + case 3: + BinBandMap.SetValue(value1, value2, drawingItem); + break; + } + } + else if (fileNameContents[0] == "E") + { + BinEarlyValueMap.SetValue(value1, drawingItem); + } + else if (fileNameContents[0] == getHighestBandBin(new[] { value1 })) + { + BinHighestBandMap.SetValue(value1, drawingItem); + } + else if (fileNameContents[0] == "HU") + { + switch (justFileName) + { + case "HU +": + HunterHigherDrawing = drawingItem; + break; + case "HU -": + HunterLowerDrawing = drawingItem; + break; + default: + BinHunterMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == "HH") + { + switch (justFileName) + { + case "HH .": + JudgmentVSVisualizerStopPointDrawing = drawingItem; + break; + default: + BinJudgmentVSVisualizerMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == "HP") + { + switch (justFileName) + { + case "HP %": + HitPointsVisualizerUnitDrawing = drawingItem; + break; + default: + BinHitPointsVisualizerMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == "IS") + { + BinInputVisualizerMap.SetValue(value1, drawingItem); + } + else if (fileNameContents[0] == "JM") + { + switch (justFileName) + { + case "JM -": + JudgmentMeterLowerDrawing = drawingItem; + break; + case "JM +": + JudgmentMererHigherDrawing = drawingItem; + break; + default: + BinJudgmentMeterMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == "J") + { + BinJudgmentValueMap.SetValue(value1, value2, drawingItem); + } + else if (fileNameContents[0] == "L") + { + BinLateValueMap.SetValue(value1, drawingItem); + } + else if (fileNameContents[0].IsFrontCaselsss("M")) + { + switch (justFileName) + { + case "MW": + MultiplierUnitDrawing = drawingItem; + break; + case "M .": + MultiplierStopPointDrawing = drawingItem; + break; + default: + BinMultiplierMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == "P") + { + switch (justFileName) + { + case "P %": + PointUnitDrawing = drawingItem; + break; + case "P .": + PointStopPointDrawing = drawingItem; + break; + default: + BinPointMap.SetValue(value1, drawingItem); + break; + } + } + else if (fileNameContents[0] == getStandBin(new[] { value1 })) + { + BinStandMap.SetValue(value1, drawingItem); + } + else if (fileNameContents[0] == "W") + { + BinHmsMap.SetValue(value1, drawingItem); + } + break; + } + break; + } + } + foreach (var (fileName, handledDrawingItem) in handledDrawingValues.OrderBy(handledDrawingValue => handledDrawingValue.Key)) + { + var justFileName = Path.GetFileNameWithoutExtension(fileName); + switch (Path.GetDirectoryName(fileName)) + { + case "Drawing": + switch (justFileName) + { + case "Veil": + VeilDrawing = handledDrawingItem; + break; + } + break; + } + } + + for (var i = (int)Component.Judged.Lowest; i >= (int)Component.Judged.Highest; --i) + { + for (var j = 1; j < judgmentFrame; ++j) + { + JudgmentDrawings[i][j] ??= JudgmentDrawings[i][j - 1]; + } + } + for (var i = 1; i < band1Frame; ++i) + { + JudgmentDrawings[JudgmentPaint.Band1][i] ??= JudgmentDrawings[JudgmentPaint.Band1][i - 1]; + } + for (var i = 1; i < lastFrame; ++i) + { + JudgmentDrawings[JudgmentPaint.Last][i] ??= JudgmentDrawings[JudgmentPaint.Last][i - 1]; + } + + for (var i = noteDrawings.Length - 1; i > 0; --i) + { + for (var j = noteFrame - 1; j >= 0; --j) + { + noteDrawings[i][j][TrapNote.TrapNoteContents][LongNote.LongNoteBefore] ??= noteDrawings[0][j][InputNote.InputNoteContents][LongNote.LongNoteBefore]; + for (var m = InputNote.NeutralPostableItemNoteContents; m >= TrapNote.TrapNoteContents; --m) + { + noteDrawings[i][j][m][LongNote.LongNoteBefore] ??= noteDrawings[0][j][m][LongNote.LongNoteBefore]; + } + } + } + for (var i = noteDrawings.Length - 1; i > 0; --i) + { + for (var j = noteFrame - 1; j >= 0; --j) + { + for (var m = InputNote.NeutralPostableItemNoteContents; m >= InputNote.InputNoteContents; --m) + { + for (var o = LongNote.LongNoteFailed; o > LongNote.LongNoteBefore; --o) + { + noteDrawings[i][j][m][o] ??= noteDrawings[i][j][m][LongNote.LongNoteBefore]; + } + } + } + } + for (var i = noteDrawings.Length - 1; i >= 0; --i) + { + for (var j = noteFrame - 1; j >= 0; --j) + { + for (var m = LongNote.LongNoteFailed; m >= LongNote.LongNoteBefore; --m) + { + noteDrawings[i][j][VoidNote.VoidNoteContents][m] ??= noteDrawings[i][j][TrapNote.TrapNoteContents][m]; + } + } + } + for (var i = noteDrawings.Length - 1; i >= 0; --i) + { + for (var j = 1; j < noteFrame; ++j) + { + for (var m = InputNote.NeutralPostableItemNoteContents; m >= InputNote.InputNoteContents; --m) + { + for (var o = LongNote.LongNoteFailed; o >= LongNote.LongNoteBefore; --o) + { + noteDrawings[i][j][m][o] ??= noteDrawings[i][j - 1][m][o]; + } + } + } + } + + var lowestHitFrame = Math.Min(longNoteHitFrame, noteHitFrame); + if (lowestHitFrame > 0) + { + for (var i = longNoteHitDrawings.Length - 1; i > 0; --i) + { + for (var j = lowestHitFrame - 1; j >= 0; --j) + { + longNoteHitDrawings[i][j] ??= noteHitDrawings[i][j]; + } + } + } + + if (mainFrame > 0) + { + for (var i = mainDrawings.Length - 1; i > 0; --i) + { + for (var j = 1; j <= mainFrame; ++j) + { + mainDrawings[i][j] ??= mainDrawings[i][j - 1]; + } + } + } + + if (judgmentMainFrame > 0) + { + for (var i = judgmentMainDrawings.Length - 1; i > 0; --i) + { + for (var j = 1; j <= judgmentMainFrame; ++j) + { + judgmentMainDrawings[i][j] ??= judgmentMainDrawings[i][j - 1]; + } + } + } + + if (mainJudgmentMeterFrame > 0) + { + for (var i = mainJudgmentMeterDrawings.Length - 1; i > 0; --i) + { + for (var j = 1; j <= mainJudgmentMeterFrame; ++j) + { + if (mainJudgmentMeterDrawings[i].ContainsKey(j - 1)) + { + mainJudgmentMeterDrawings[i][j] ??= mainJudgmentMeterDrawings[i][j - 1]; + } + } + for (var j = -1; j >= -mainJudgmentMeterFrame; --j) + { + if (mainJudgmentMeterDrawings[i].ContainsKey(j + 1)) + { + mainJudgmentMeterDrawings[i][j] ??= mainJudgmentMeterDrawings[i][j + 1]; + } + } + } + } + + if (inputFrame > 0) + { + for (var i = inputDrawings.Length - 1; i > 0; --i) + { + for (var j = 1; j <= inputFrame; ++j) + { + inputDrawings[i][j] ??= inputDrawings[i][j - 1]; + } + } + } + + if (levelFrame > 0) + { + for (var i = LevelDrawings.Length - 1; i >= 0; --i) + { + for (var j = 1; j < levelFrame; ++j) + { + LevelDrawings[i][j] ??= LevelDrawings[i][j - 1]; + } + } + } + + if (autoMainFrame > 0) + { + for (var i = 1; i < autoMainFrame; ++i) + { + AutoMainDrawings[i] ??= AutoMainDrawings[i - 1]; + } + } + + if (pauseFrame > 0) + { + for (var i = PauseDrawings.Length - 1; i > 0; --i) + { + for (var j = 1; j < pauseFrame; ++j) + { + PauseDrawings[i][j] ??= PauseDrawings[i][j - 1]; + } + } + } + + for (var i = 9; i >= 0; --i) + { + BinBandMap[i, 0] ??= binMap[i]; + for (var j = 0; j < bandFrame; ++j) + { + if (BinBandMap[i, j] == null) + { + for (var m = j - 1; m >= 0; --m) + { + if (BinBandMap[i, m] != null) + { + BinBandMap[i, j] ??= BinBandMap[i, m]; + break; + } + } + } + } + for (var j = (int)Component.Judged.Lowest; j >= (int)Component.Judged.Highest; --j) + { + BinJudgmentValueMap[j][i] ??= binMap[i]; + } + BinStandMap[i] ??= binMap[i]; + BinPointMap[i] ??= binMap[i]; + BinHmsMap[i] ??= binMap[i]; + BinHitPointsVisualizerMap[i] ??= binMap[i]; + BinJudgmentMeterMap[i] ??= binMap[i]; + BinHighestBandMap[i] ??= binMap[i]; + BinInputVisualizerMap[i] ??= binMap[i]; + BinAudioMultiplierMap[i] ??= binMap[i]; + BinMultiplierMap[i] ??= binMap[i]; + BinBPMMap[i] ??= binMap[i]; + BinHunterMap[i] ??= binMap[i]; + BinEarlyValueMap[i] ??= binMap[i]; + BinLateValueMap[i] ??= binMap[i]; + BinJudgmentVSVisualizerMap[i] ??= binMap[i]; + } + HitPointsVisualizerUnitDrawing ??= pointUnitDrawing; + PointUnitDrawing ??= pointUnitDrawing; + PointStopPointDrawing ??= stopPointDrawing; + MultiplierStopPointDrawing ??= stopPointDrawing; + AudioMultiplierStopPointDrawing ??= stopPointDrawing; + JudgmentVSVisualizerStopPointDrawing ??= stopPointDrawing; + MultiplierUnitDrawing ??= multiplierUnitDrawing; + AudioMultiplierUnitDrawing ??= multiplierUnitDrawing; + JudgmentMeterLowerDrawing ??= lowerDrawing; + JudgmentMererHigherDrawing ??= higherDrawing; + HunterLowerDrawing ??= lowerDrawing; + HunterHigherDrawing ??= higherDrawing; + for (var i = HitPointsDrawings.Length - 1; i >= 0; --i) + { + HitPointsDrawings[i] ??= HitPointsDrawings[(int)ModeComponent.HitPointsMode.Default]; + } + for (var i = (int)Component.InputMode.InputMode484; i >= (int)Component.InputMode.InputMode4; --i) + { + var inputCount = Component.InputCounts[i]; + AutoInputDrawings[i] = new DrawingItem?[inputCount + 1]; + NoteHitDrawings[i] = new DrawingItem?[inputCount + 1][]; + LongNoteHitDrawings[i] = new DrawingItem?[inputCount + 1][]; + MainDrawings[i] = new DrawingItem?[inputCount + 1][]; + JudgmentMainDrawings[i] = new DrawingItem?[inputCount + 1][]; + InputDrawings[i] = new DrawingItem?[inputCount + 1][]; + NoteDrawings[i] = new DrawingItem?[inputCount + 1][][][]; + MainJudgmentMeterDrawings[i] = new Dictionary[inputCount + 1]; + for (var j = inputCount; j > 0; --j) + { + AutoInputDrawings[i][j] = autoInputDrawings[DrawingInputModeMap[i][j]]; + NoteHitDrawings[i][j] = noteHitDrawings[DrawingInputModeMap[i][j]]; + LongNoteHitDrawings[i][j] = longNoteHitDrawings[DrawingInputModeMap[i][j]]; + MainDrawings[i][j] = mainDrawings[DrawingInputModeMap[i][j]]; + JudgmentMainDrawings[i][j] = judgmentMainDrawings[DrawingInputModeMap[i][j]]; + InputDrawings[i][j] = inputDrawings[DrawingInputModeMap[i][j]]; + NoteDrawings[i][j] = noteDrawings[DrawingInputModeMap[i][j]]; + MainJudgmentMeterDrawings[i][j] = mainJudgmentMeterDrawings[DrawingInputModeMap[i][j]]; + } + } + + mainViewModel.GetHandlingComputer()?.SetUIMap(); + FaultText = null; + } + finally + { + ViewModels.Instance.NotifyWindowViewModels(); + mainViewModel.NotifyModel(); + mainViewModel.IsUILoading = false; + } + } + + public void SetFontFamily() + { + DrawingSystem.Instance.SetFontFamily(TitleFont); + DrawingSystem.Instance.SetFontFamily(ArtistFont); + DrawingSystem.Instance.SetFontFamily(GenreFont); + DrawingSystem.Instance.SetFontFamily(LevelTextFont); + DrawingSystem.Instance.SetFontFamily(WantLevelFont); + } + + public void LoadUIFiles() => Utility.SetUICollection(UIItems, Utility.GetEntry(QwilightComponent.UIEntryPath).Prepend(QwilightComponent.UIEntryPath).SelectMany(targetEntryPath => Utility.GetFiles(targetEntryPath).Where(targetFilePath => !Path.GetFileName(targetFilePath).StartsWith('@') && targetFilePath.IsTailCaselsss(".yaml")).Select(yamlFilePath => new UIItem + { + UIEntry = Path.GetRelativePath(QwilightComponent.UIEntryPath, targetEntryPath), + YamlName = Path.GetFileNameWithoutExtension(yamlFilePath) + })).ToArray()); + + void Init() + { + foreach (var value in typeof(UI).GetProperties()) + { + if (value.CanWrite) + { + value.SetValue(this, default); + } + else if (value.PropertyType.IsArray) + { + var data = value.GetValue(this) as Array; + Array.Clear(data, 0, data.Length); + } + } + _audioItemMap.Clear(); + ValueCallMap.Clear(); + ValueMap.Clear(); + IntMap.Clear(); + IntCallMap.Clear(); + AltMap.Clear(); + PaintPipelineValues.Clear(); + DrawingPipeline.Clear(); + DefaultLength = 1280.0; + DrawingSystem.Instance.SetFontLevel(TitleFont, Levels.FontLevel0Float32); + DrawingSystem.Instance.SetFontLevel(ArtistFont, Levels.FontLevel0Float32); + DrawingSystem.Instance.SetFontLevel(GenreFont, Levels.FontLevel0Float32); + DrawingSystem.Instance.SetFontLevel(LevelTextFont, Levels.FontLevel0Float32); + DrawingSystem.Instance.SetFontLevel(WantLevelFont, Levels.FontLevel0Float32); + } + + public void SetConfigures(Script lsCaller) + { + lsCaller.Globals["configures"] = Enumerable.Range(0, HighestUIConfigure).Select(i => + { + return Math.Max(0, Array.IndexOf(XamlUIConfigures.SingleOrDefault(value => value.Position == i)?.Configures ?? Array.Empty(), Configure.Instance.UIConfigureValue.UIConfiguresV2[i])); + }).ToArray(); + } + + public void LoadUI(UIItem src, UIItem target, bool isParallel = true) + { + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsUILoading) + { + mainViewModel.IsUILoading = true; + if (isParallel) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.OpeningUIFileContents); + Task.Run(() => + { + lock (ContentsCSX) + { + try + { + LoadUIImpl(src, target); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.OpenedUIFileContents); + } + catch (YamlException e) + { + FaultText = string.Format(LanguageSystem.Instance.YAMLCompileFault, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, FaultText); + } + catch (InterpreterException e) + { + FaultText = string.Format(LanguageSystem.Instance.LSCompileFault, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, FaultText); + } + catch (Exception e) + { + FaultText = string.Format(LanguageSystem.Instance.UIFaultText, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, FaultText); + } + } + }); + } + else + { + lock (ContentsCSX) + { + try + { + LoadUIImpl(src, target); + } + catch (YamlException e) + { + FaultText = string.Format(LanguageSystem.Instance.YAMLCompileFault, e.Message, true); + } + catch (InterpreterException e) + { + FaultText = string.Format(LanguageSystem.Instance.LSCompileFault, e.Message, true); + } + catch (Exception e) + { + FaultText = string.Format(LanguageSystem.Instance.UIFaultText, e.Message, true); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/UI/XamlUIConfigure.cs b/Qwilight/Qwilight/System/UI/XamlUIConfigure.cs new file mode 100644 index 0000000..79bd76d --- /dev/null +++ b/Qwilight/Qwilight/System/UI/XamlUIConfigure.cs @@ -0,0 +1,18 @@ +namespace Qwilight +{ + public sealed class XamlUIConfigure + { + public int Position { get; set; } + + public string[] Configures { get; set; } + + public string ConfigureComment { get; set; } + + public string UIConfigure + { + get => Configure.Instance.UIConfigureValue.UIConfiguresV2[Position]; + + set => Configure.Instance.UIConfigureValue.UIConfiguresV2[Position] = value; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/ValveSystem.cs b/Qwilight/Qwilight/System/ValveSystem.cs new file mode 100644 index 0000000..d0816bf --- /dev/null +++ b/Qwilight/Qwilight/System/ValveSystem.cs @@ -0,0 +1,89 @@ +using Google.Protobuf; +using Microsoft.Graphics.Canvas; +using Qwilight.ViewModel; +using Steamworks; +using System.Buffers; +using System.IO; +using Windows.Graphics.DirectX; + +namespace Qwilight +{ + public sealed class ValveSystem : IDisposable + { + static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(ValveSystem)); + + public static readonly ValveSystem Instance = new(); + + public string ValveName { get; set; } + + public ByteString ValveDrawing { get; set; } + + public async ValueTask Init() + { + if (QwilightComponent.IsValve) + { + try + { + SteamClient.Init(QwilightComponent.AssetsClientJSON.valve); + SteamScreenshots.Hooked = true; + SteamScreenshots.OnScreenshotRequested += ViewModels.Instance.MainValue.HandleF12; + ValveName = SteamClient.Name; + using var t = SteamFriends.GetLargeAvatarAsync(SteamClient.SteamId); + t.Wait(); + var largeAvatarDrawing = t.Result; + if (largeAvatarDrawing.HasValue) + { + var largeAvatarDrawingValue = largeAvatarDrawing.Value; + var largeAvatarLength = largeAvatarDrawingValue.Width; + var largeAvatarHeight = largeAvatarDrawingValue.Height; + var data = largeAvatarDrawing.Value.Data; + var row = 4 * largeAvatarLength; + var length = (int)(row * largeAvatarHeight); + var target = ArrayPool.Shared.Rent(length); + try + { + for (var i = 0; i < largeAvatarHeight; ++i) + { + for (var j = 0; j < largeAvatarLength; ++j) + { + var m = row * i + 4 * j; + target[m] = data[m + 2]; + target[m + 1] = data[m + 1]; + target[m + 2] = data[m]; + target[m + 3] = data[m + 3]; + } + } + using (var avatarDrawing = CanvasBitmap.CreateFromBytes(CanvasDevice.GetSharedDevice(), target, (int)largeAvatarLength, (int)largeAvatarHeight, DirectXPixelFormat.B8G8R8A8UIntNormalized)) + using (var rms = PoolSystem.Instance.GetDataFlow()) + { + await avatarDrawing.SaveAsync(rms.AsRandomAccessStream(), CanvasBitmapFileFormat.Png); + rms.Position = 0; + ValveDrawing = ByteString.CopyFrom(rms.GetBuffer(), 0, (int)rms.Length); + } + } + finally + { + ArrayPool.Shared.Return(target); + } + } + else + { + ValveDrawing = ByteString.Empty; + } + } + catch (Exception e) + { + Environment.Exit(e.HResult); + } + } + } + + public void Dispose() + { + if (QwilightComponent.IsValve) + { + SteamClient.Shutdown(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/System/XwindowSystem.cs b/Qwilight/Qwilight/System/XwindowSystem.cs new file mode 100644 index 0000000..a470cfc --- /dev/null +++ b/Qwilight/Qwilight/System/XwindowSystem.cs @@ -0,0 +1,35 @@ +using System.Diagnostics; +using System.IO; + +namespace Qwilight +{ + public sealed class XwindowSystem + { + public static readonly XwindowSystem Instance = new(); + + Process _exe; + + public void HandleSystem() + { + try + { + _exe = Process.Start(Path.Combine(QwilightComponent.SoftwareEntryPath, "Xwindow.exe"), $"\"{PIDClass.FilePath}\""); + } + catch + { + } + } + + public void Stop() + { + if (_exe != null) + { + using (_exe) + { + _exe.Kill(); + } + _exe = null; + } + } + } +} diff --git a/Qwilight/Qwilight/UIComponent/AudioValue.cs b/Qwilight/Qwilight/UIComponent/AudioValue.cs new file mode 100644 index 0000000..fd2889e --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AudioValue.cs @@ -0,0 +1,21 @@ +namespace Qwilight.UIComponent +{ + public struct AudioValue : IEquatable + { + public int ID { get; init; } + + public string Name { get; init; } + + public override bool Equals(object obj) => obj is AudioValue audioValue && Equals(audioValue); + + public bool Equals(AudioValue other) => ID == other.ID; + + public override int GetHashCode() => ID.GetHashCode(); + + public override string ToString() => Name; + + public static bool operator ==(AudioValue left, AudioValue right) => left.Equals(right); + + public static bool operator !=(AudioValue left, AudioValue right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/AutoEnterSite.cs b/Qwilight/Qwilight/UIComponent/AutoEnterSite.cs new file mode 100644 index 0000000..9026bf2 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AutoEnterSite.cs @@ -0,0 +1,29 @@ +namespace Qwilight.UIComponent +{ + public struct AutoEnterSite : IEquatable + { + public const int AutoEnter = 0; + public const int AutoEnterSignedIn = 1; + public const int WaitSite = 2; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is AutoEnterSite autoEnterSite && Equals(autoEnterSite); + + public bool Equals(AutoEnterSite other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + AutoEnter => LanguageSystem.Instance.AutoEnterContents, + AutoEnterSignedIn => LanguageSystem.Instance.AutoEnterSignedInContents, + WaitSite => LanguageSystem.Instance.WaitSiteContents, + _ => default + }; + + public static bool operator ==(AutoEnterSite left, AutoEnterSite right) => left.Equals(right); + + public static bool operator !=(AutoEnterSite left, AutoEnterSite right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/AutoJudgmentMeterMillisItem.cs b/Qwilight/Qwilight/UIComponent/AutoJudgmentMeterMillisItem.cs new file mode 100644 index 0000000..f011c9d --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AutoJudgmentMeterMillisItem.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct AutoJudgmentMeterMillisItem : IEquatable + { + public Component.Judged Judged { get; init; } + + [JsonIgnore] + public ImageSource Drawing => BaseUI.Instance.JudgmentDrawings[(int)Judged]?.DefaultDrawing; + + public override bool Equals(object obj) => obj is AutoJudgmentMeterMillisItem autoJudgmentMeterMillisItem && Equals(autoJudgmentMeterMillisItem); + + public bool Equals(AutoJudgmentMeterMillisItem other) => Judged == other.Judged; + + public override int GetHashCode() => Judged.GetHashCode(); + + public static bool operator ==(AutoJudgmentMeterMillisItem left, AutoJudgmentMeterMillisItem right) => left.Equals(right); + + public static bool operator !=(AutoJudgmentMeterMillisItem left, AutoJudgmentMeterMillisItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/AvatarEdgeItem.cs b/Qwilight/Qwilight/UIComponent/AvatarEdgeItem.cs new file mode 100644 index 0000000..d0ab5e0 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AvatarEdgeItem.cs @@ -0,0 +1,44 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class AvatarEdgeItem : Model + { + bool _wantDrawing = true; + ImageSource _drawing; + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string EdgeID { get; init; } + + public ImageSource Drawing + { + get + { + if (_wantDrawing) + { + _wantDrawing = false; + Task.Run(async () => + { + using var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/edge?edgeID={EdgeID}"); + if (s.Length > 0) + { + try + { + SetProperty(ref _drawing, DrawingSystem.Instance.LoadDefault(s, null), nameof(Drawing)); + } + catch + { + } + } + else + { + SetProperty(ref _drawing, null, nameof(Drawing)); + } + }); + } + return _drawing; + } + } + } +} diff --git a/Qwilight/Qwilight/UIComponent/AvatarGroup.cs b/Qwilight/Qwilight/UIComponent/AvatarGroup.cs new file mode 100644 index 0000000..21f5822 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AvatarGroup.cs @@ -0,0 +1,47 @@ +using System.Windows.Media; +using Colors = Microsoft.UI.Colors; + +namespace Qwilight.UIComponent +{ + public struct AvatarGroup : IEquatable + { + static readonly Brush[] _avatarGroupPaints = new[] + { + DrawingSystem.Instance.GetDefaultPaint(Colors.Gray), + DrawingSystem.Instance.GetDefaultPaint(Colors.White), + DrawingSystem.Instance.GetDefaultPaint(Colors.LightYellow), + DrawingSystem.Instance.GetDefaultPaint(Colors.LightBlue), + DrawingSystem.Instance.GetDefaultPaint(Colors.LightPink) + }; + + public int Data { get; init; } + + public Brush Paint => _avatarGroupPaints.ElementAtOrDefault(Data); + + public override string ToString() => Data switch + { + 0 => LanguageSystem.Instance.NotAvatarGroup, + 1 => "TEAM SOBREM", + 2 => "TEAM SCTL", + 3 => "TEAM CHILLDIVE", + 4 => "TEAM SPEHS", + _ => string.Empty + }; + + public string Title => Data switch + { + 0 => string.Empty, + _ => ToString() + }; + + public override bool Equals(object obj) => obj is AvatarGroup avatarGroup && Equals(avatarGroup); + + public bool Equals(AvatarGroup other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public static bool operator ==(AvatarGroup left, AvatarGroup right) => left.Equals(right); + + public static bool operator !=(AvatarGroup left, AvatarGroup right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/AvatarItem.cs b/Qwilight/Qwilight/UIComponent/AvatarItem.cs new file mode 100644 index 0000000..a38a7e9 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AvatarItem.cs @@ -0,0 +1,78 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class AvatarItem : Model + { + public enum AvatarConfigure + { + Not = 0, + Levying = 2, + Compiling = 3, + Compiled = 4, + } + + bool _isSiteHand; + bool _isMe; + AvatarConfigure _avatarConfigureValue; + AvatarGroup _avatarGroupValue; + bool _isAudioInput; + + public bool IsSiteHand + { + get => _isSiteHand; + + set => SetProperty(ref _isSiteHand, value, nameof(IsSiteHand)); + } + + public bool IsMe + { + get => _isMe; + + set => SetProperty(ref _isMe, value, nameof(IsMe)); + } + + public AvatarConfigure AvatarConfigureValue + { + get => _avatarConfigureValue; + + set => SetProperty(ref _avatarConfigureValue, value, nameof(AvatarConfigureValue)); + } + + public AvatarGroup AvatarGroupValue + { + get => _avatarGroupValue; + + set => SetProperty(ref _avatarGroupValue, value, nameof(AvatarGroupValue)); + } + + public bool IsAudioInput + { + get => _isAudioInput; + + set => SetProperty(ref _isAudioInput, value, nameof(IsAudioInput)); + } + + public Brush AudioInputPaint => IsAudioInput ? Paints.Paint3 : Paints.Paint4; + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string AvatarID { get; init; } + + public string AvatarName { get; init; } + + public AvatarWww AvatarWwwValue { get; } + + public bool IsValve { get; init; } + + public override bool Equals(object obj) => obj is AvatarItem avatarItem && AvatarID == avatarItem.AvatarID; + + public override int GetHashCode() => AvatarID.GetHashCode(); + + public AvatarItem(string avatarID) + { + AvatarID = avatarID; + AvatarWwwValue = new(avatarID); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/AvatarLevelItem.cs b/Qwilight/Qwilight/UIComponent/AvatarLevelItem.cs new file mode 100644 index 0000000..67b9f04 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AvatarLevelItem.cs @@ -0,0 +1,18 @@ +using Qwilight.NoteFile; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct AvatarLevelItem + { + public string Title { get; init; } + + public string LevelText { get; init; } + + public BaseNoteFile.Level LevelValue { get; init; } + + public string Date { get; init; } + + public Brush LevelPaint => BaseUI.Instance.LevelPaints[(int)LevelValue]; + } +} diff --git a/Qwilight/Qwilight/UIComponent/AvatarTitle.cs b/Qwilight/Qwilight/UIComponent/AvatarTitle.cs new file mode 100644 index 0000000..abc7d2c --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AvatarTitle.cs @@ -0,0 +1,23 @@ +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight.UIComponent +{ + public struct AvatarTitle + { + public string Title { get; init; } + + public string TitleNBSP => string.IsNullOrEmpty(Title) ? string.Empty : $"{Title} "; + + public Brush TitlePaint { get; init; } + + public Color TitleColor { get; init; } + + public AvatarTitle(string title, Brush titlePaint, Color titleColor) + { + Title = title; + TitlePaint = titlePaint; + TitleColor = titleColor; + } + } +} diff --git a/Qwilight/Qwilight/UIComponent/AvatarTitleItem.cs b/Qwilight/Qwilight/UIComponent/AvatarTitleItem.cs new file mode 100644 index 0000000..395bb96 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/AvatarTitleItem.cs @@ -0,0 +1,28 @@ +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight.UIComponent +{ + public struct AvatarTitleItem : IEquatable + { + public Brush PointedPaint => TitlePaint; + + public string TitleID { get; init; } + + public string Title { get; init; } + + public Brush TitlePaint { get; init; } + + public Color TitleColor { get; init; } + + public override bool Equals(object obj) => obj is AvatarTitleItem avatarTitleItem && Equals(avatarTitleItem); + + public bool Equals(AvatarTitleItem other) => TitleID == other.TitleID; + + public override int GetHashCode() => TitleID.GetHashCode(); + + public static bool operator ==(AvatarTitleItem left, AvatarTitleItem right) => left.Equals(right); + + public static bool operator !=(AvatarTitleItem left, AvatarTitleItem right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/UIComponent/BPMVariety.cs b/Qwilight/Qwilight/UIComponent/BPMVariety.cs new file mode 100644 index 0000000..7784594 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/BPMVariety.cs @@ -0,0 +1,29 @@ +namespace Qwilight.UIComponent +{ + public struct BPMVariety : IEquatable + { + public const int BPM = 0; + public const int AudioMultiplier = 1; + public const int Multiplier = 2; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is BPMVariety bpmVariety && Equals(bpmVariety); + + public bool Equals(BPMVariety other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + BPM => "BPM", + AudioMultiplier => LanguageSystem.Instance.BPMVarietyAudioMultiplierText, + Multiplier => LanguageSystem.Instance.BPMVarietyMultiplierText, + _ => default + }; + + public static bool operator ==(BPMVariety left, BPMVariety right) => left.Equals(right); + + public static bool operator !=(BPMVariety left, BPMVariety right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/BundleCompetence.cs b/Qwilight/Qwilight/UIComponent/BundleCompetence.cs new file mode 100644 index 0000000..c2a97ee --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/BundleCompetence.cs @@ -0,0 +1,42 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct BundleCompetence : IEquatable + { + public const int BundleCallable = 0; + public const int BundleAvatar = 3; + public const int BundleUbuntu = 1; + public const int BundleVoid = 2; + + public Brush Paint => Data switch + { + BundleCallable => Paints.Paint3, + BundleAvatar => Paints.Paint3, + BundleUbuntu => Paints.Paint2, + BundleVoid => Paints.Paint1, + _ => default + }; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is BundleCompetence bundleCompetence && Equals(bundleCompetence); + + public bool Equals(BundleCompetence other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + BundleCallable => LanguageSystem.Instance.BundleCallableContents, + BundleAvatar => LanguageSystem.Instance.BundleAvatarContents, + BundleUbuntu => LanguageSystem.Instance.BundleUbuntuContents, + BundleVoid => LanguageSystem.Instance.BundleVoidContents, + _ => default + }; + + public static bool operator ==(BundleCompetence left, BundleCompetence right) => left.Equals(right); + + public static bool operator !=(BundleCompetence left, BundleCompetence right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/BundleItem.cs b/Qwilight/Qwilight/UIComponent/BundleItem.cs new file mode 100644 index 0000000..3114a21 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/BundleItem.cs @@ -0,0 +1,83 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.ViewModel; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight.UIComponent +{ + public sealed partial class BundleItem + { + public enum BundleVariety + { + DefaultUI = -2, + DefaultNotes = -1, + UI = 1, + Qwilight = 2, + EventNote = 3, + Note = 4, + Net = 5 + } + + BundleCompetence _bundleCompetence; + + public string Date { get; init; } + + public string Avatar { get; init; } + + public string Name { get; init; } + + public long Length { get; init; } + + public BundleVariety Variety { get; init; } + + public bool IsNameVisible => Variety != BundleVariety.Qwilight; + + public BundleCompetence BundleCompetence + { + get => _bundleCompetence; + + set + { + _bundleCompetence = value; + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetBundle, new + { + bundleName = Name, + bundleCompetence = value.Data + }); + } + } + + public ICollection BundleCollection { get; set; } + + [RelayCommand] + void OnSave() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveBundle, new + { + avatarID = Avatar, + bundleName = Name + }); + + [RelayCommand] + void OnWipe() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeBundleNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + BundleCollection.Remove(this); + var bundleViewModel = ViewModels.Instance.BundleValue; + bundleViewModel.TargetValue -= Length; + bundleViewModel.NotifyUI(); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.WipeBundle, Name); + } + }) + } + }); + + public BundleItem(BundleCompetence bundleCompetence) => _bundleCompetence = bundleCompetence; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/CommentItem.cs b/Qwilight/Qwilight/UIComponent/CommentItem.cs new file mode 100644 index 0000000..1e396dc --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/CommentItem.cs @@ -0,0 +1,90 @@ +using Qwilight.Compute; +using Qwilight.Utilities; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class CommentItem : Model + { + string _twilightCommentary; + DefaultCompute.InputFlag _inputFlags; + + public DefaultCompute.QuitStatus Quit => Utility.GetQuitStatusValue(Point, Stand, 1.0, NoteFileCount); + + public Brush PointedPaint => BaseUI.Instance.CommentViewerPaints[(int)Quit]; + + public int NoteFileCount { get; init; } + + public DateTime Date { get; init; } + + public string DateText { get; init; } + + public string CommentPlace0Text { get; set; } + + public string CommentPlace1Text { get; set; } + + public Brush StandPaint => ModeComponentValue.HitPointsModeValue switch + { + ModeComponent.HitPointsMode.Lowest => BaseUI.Instance.LevelPaints[1], + ModeComponent.HitPointsMode.Lower => BaseUI.Instance.LevelPaints[2], + ModeComponent.HitPointsMode.Higher => BaseUI.Instance.LevelPaints[4], + ModeComponent.HitPointsMode.Highest => BaseUI.Instance.LevelPaints[5], + ModeComponent.HitPointsMode.Failed => BaseUI.Instance.LevelPaints[5], + _ => QwilightComponent.GetBuiltInData("CommentStandPaint") + }; + + public Brush PointPaint => ModeComponentValue.JudgmentModeValue switch + { + ModeComponent.JudgmentMode.Lowest => BaseUI.Instance.LevelPaints[1], + ModeComponent.JudgmentMode.Lower => BaseUI.Instance.LevelPaints[2], + ModeComponent.JudgmentMode.Higher => BaseUI.Instance.LevelPaints[4], + ModeComponent.JudgmentMode.Highest => BaseUI.Instance.LevelPaints[5], + _ => QwilightComponent.GetBuiltInData("CommentPointPaint") + }; + + public ImageSource QuitDrawing => BaseUI.Instance.QuitDrawings[(int)Quit][IsP ? 1 : 0]?.DefaultDrawing; + + public bool IsTwilightComment { get; init; } + + public string CommentID { get; init; } + + public string AvatarName { get; init; } + + public ModeComponent ModeComponentValue { get; init; } + + public int Stand { get; init; } + + public string StandText => Stand.ToString(LanguageSystem.Instance.StandContents); + + public int Band { get; init; } + + public double Point { get; init; } + + public bool IsP { get; init; } + + public string TwilightCommentary + { + get => _twilightCommentary; + + set => SetProperty(ref _twilightCommentary, value, nameof(TwilightCommentary)); + } + + public bool IsPaused { get; init; } + + public bool DefaultControllerComputed => (_inputFlags & DefaultCompute.InputFlag.DefaultController) == DefaultCompute.InputFlag.DefaultController; + + public bool ControllerComputed => (_inputFlags & DefaultCompute.InputFlag.Controller) == DefaultCompute.InputFlag.Controller; + + public bool MIDIComputed => (_inputFlags & DefaultCompute.InputFlag.MIDI) == DefaultCompute.InputFlag.MIDI; + + public bool PointerComputed => (_inputFlags & DefaultCompute.InputFlag.Pointer) == DefaultCompute.InputFlag.Pointer; + + public AvatarWww AvatarWwwValue { get; } + + public CommentItem(string avatarID, DefaultCompute.InputFlag inputFlags) + { + AvatarWwwValue = new AvatarWww(avatarID); + _inputFlags = inputFlags; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/DefaultEntryItem.cs b/Qwilight/Qwilight/UIComponent/DefaultEntryItem.cs new file mode 100644 index 0000000..15c8ddd --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/DefaultEntryItem.cs @@ -0,0 +1,121 @@ +using Qwilight.NoteFile; +using System.IO; +using System.Text.Json.Serialization; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class DefaultEntryItem : Model, IComparable + { + public static readonly DefaultEntryItem Total = new() + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Total, + DefaultEntryPath = "/" + }; + public static readonly DefaultEntryItem EssentialBundle = new() + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Essential, + DefaultEntryPath = QwilightComponent.BundleEntryPath + }; + + public EntryItem GetEntryItem(bool isEnter, int entryItemID) + { + var entryItem = new EntryItem + { + DefaultEntryItem = this, + Title = isEnter ? ToString() : $"🔙{this}", + Artist = DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Default || DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Essential ? DefaultEntryPath : string.Empty, + IsLogical = true, + EntryPath = DefaultEntryPath, + LogicalVarietyValue = EntryItem.LogicalVariety.DefaultEntryItem, + EntryItemID = entryItemID + }; + var noteFiles = new[] + { + new DefaultEntryItemNoteFile(this, entryItem, isEnter) + }; + entryItem.NoteFiles = noteFiles; + entryItem.WellNoteFiles = noteFiles.Cast().ToList(); + return entryItem; + } + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public enum DefaultEntryVariety + { + Total, Default, Favorite, Essential, Net + }; + + string _favoriteEntryName = string.Empty; + bool? _favoriteEntryStatus; + + public string DefaultEntryPath { get; init; } + + public int Layer { get; set; } + + public string FavoriteEntryName + { + get => _favoriteEntryName; + + set => SetProperty(ref _favoriteEntryName, value, nameof(NameInModifyDefaultEntryWindow)); + } + + public DefaultEntryVariety DefaultEntryVarietyValue { get; init; } + + public HashSet FrontEntryPaths { get; } = new(); + + [JsonIgnore] + public bool? FavoriteEntryStatus + { + get => _favoriteEntryStatus; + + set => SetProperty(ref _favoriteEntryStatus, value, nameof(FavoriteEntryStatus)); + } + + public string NameInModifyDefaultEntryWindow => DefaultEntryVarietyValue != DefaultEntryVariety.Favorite ? DefaultEntryPath : FavoriteEntryName; + + public int CompareTo(DefaultEntryItem other) + { + if ((DefaultEntryVarietyValue == DefaultEntryVariety.Default || DefaultEntryVarietyValue == DefaultEntryVariety.Favorite) && (other.DefaultEntryVarietyValue == DefaultEntryVariety.Default || other.DefaultEntryVarietyValue == DefaultEntryVariety.Favorite)) + { + return Layer.CompareTo(other.Layer); + } + else + { + return DefaultEntryVarietyValue.CompareTo(other.DefaultEntryVarietyValue); + } + } + + public override bool Equals(object obj) => obj is DefaultEntryItem defaultEntryItem && DefaultEntryVarietyValue == defaultEntryItem.DefaultEntryVarietyValue && DefaultEntryPath == defaultEntryItem.DefaultEntryPath; + + public override int GetHashCode() => HashCode.Combine(DefaultEntryPath, DefaultEntryVarietyValue); + + public override string ToString() + { + switch (DefaultEntryVarietyValue) + { + case DefaultEntryVariety.Total: + return LanguageSystem.Instance.TotalVarietyContents; + case DefaultEntryVariety.Default: + return Path.GetFileName(DefaultEntryPath); + case DefaultEntryVariety.Essential when DefaultEntryPath == QwilightComponent.BundleEntryPath: + return LanguageSystem.Instance.BundleEntryContents; + case DefaultEntryVariety.Favorite: + return FavoriteEntryName; + default: + return string.Empty; + } + } + + public string WipeNotify => DefaultEntryVarietyValue switch + { + DefaultEntryVariety.Default => LanguageSystem.Instance.WipeDefaultEntryNotify, + DefaultEntryVariety.Favorite => LanguageSystem.Instance.WipeFavoriteEntryNotify, + _ => string.Empty + }; + + public static bool operator ==(DefaultEntryItem left, DefaultEntryItem right) => ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.Equals(right); + + public static bool operator !=(DefaultEntryItem left, DefaultEntryItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/EntryItem.cs b/Qwilight/Qwilight/UIComponent/EntryItem.cs new file mode 100644 index 0000000..c0266a8 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/EntryItem.cs @@ -0,0 +1,180 @@ +using Qwilight.NoteFile; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class EntryItem : Model + { + public enum LogicalVariety + { + Salt, Level, DefaultEntryItem, DefaultEntryConfigure + } + + public static readonly EntryItem DefaultEntryConfigureEntryItem = new() + { + IsLogical = true, + NoteFiles = new[] { ModifyDefaultEntryNoteFile.Instance }, + WellNoteFiles = new(new[] { ModifyDefaultEntryNoteFile.Instance }), + LogicalVarietyValue = LogicalVariety.DefaultEntryConfigure + }; + + public static readonly EntryItem SaltEntryItem = new() + { + IsLogical = true, + NoteFiles = new[] { SaltNoteFile.Instance }, + WellNoteFiles = new(new[] { SaltNoteFile.Instance }), + LogicalVarietyValue = LogicalVariety.Salt + }; + + string _eventNoteName; + string _fittedText; + + public BaseNoteFile NoteFile => NoteFiles[NotePosition]; + + public string PositionText => WellNoteFiles.Count >= 2 ? $"{NotePosition - NoteFiles.SkipLast(NoteFiles.Length - NotePosition).Count(noteFile => !WellNoteFiles.Contains(noteFile)) + 1}/{WellNoteFiles.Count}" : string.Empty; + + public List WellNoteFiles { get; set; } + + public bool WasNotePositionModified { get; set; } + + public int NotePosition { get; set; } + + public void ModifyNotePosition(int notePosition) + { + if (NotePosition != notePosition) + { + NotePosition = notePosition; + WasNotePositionModified = true; + } + } + + public DateTime ModifiedDate { get; init; } + + public string WantLevelID { get; set; } = string.Empty; + + public DateTime? LatestDate { get; set; } + + public int HandledCount { get; set; } + + public DefaultEntryItem DefaultEntryItem { get; init; } + + public string Title { get; set; } = string.Empty; + + public string EntryPath { get; init; } = string.Empty; + + public string EventNoteID { get; init; } = string.Empty; + + public bool IsLogical { get; init; } + + public LogicalVariety LogicalVarietyValue { get; init; } + + public string EventNoteName + { + get => _eventNoteName; + + set => SetProperty(ref _eventNoteName, value, nameof(EventNoteName)); + } + + public string FittedText + { + get => _fittedText; + + set => SetProperty(ref _fittedText, value, nameof(FittedText)); + } + + public ImageSource DrawingInNoteFileWindow => NoteFile.EssentialDrawing ?? NoteFile.LogicalDrawing ?? BaseUI.Instance.DefaultEntryDrawings[(int)NoteFile.DefaultEntryItem.DefaultEntryVarietyValue]; + + public bool IsBanned => NoteFile.IsBanned || !string.IsNullOrEmpty(EventNoteID); + + public DB.EventNoteVariety EventNoteVariety { get; init; } + + public int EntryItemID { get; init; } + + public double BPM { get; set; } + + public string Artist { get; set; } = string.Empty; + + public double Length { get; set; } + + public int TotalNotes { get; set; } + + public double LevelTextValue { get; set; } + + public int HighestInputCount { get; set; } + + public double AverageInputCount => Length > 0.0 ? TotalNotes / Length : TotalNotes; + + public BaseNoteFile[] NoteFiles { get; set; } + + public BaseNoteFile[] CompatibleNoteFiles { get; set; } + + public bool CanWipeNoteFile => CompatibleNoteFiles.Length > 1; + + public override bool Equals(object obj) => obj is EntryItem entryItem && entryItem.EntryItemID == EntryItemID; + + public override int GetHashCode() => EntryItemID.GetHashCode(); + + public bool HigherNoteFile() + { + var notePosition = NotePosition + 1; + while (true) + { + if (notePosition < NoteFiles.Length) + { + if (WellNoteFiles.Contains(NoteFiles[notePosition])) + { + ModifyNotePosition(notePosition); + return true; + } + else + { + ++notePosition; + } + } + else + { + return false; + } + } + } + + public bool LowerNoteFile() + { + var notePosition = NotePosition - 1; + while (true) + { + if (notePosition < 0) + { + return false; + } + else + { + if (WellNoteFiles.Contains(NoteFiles[notePosition])) + { + ModifyNotePosition(notePosition); + return true; + } + else + { + --notePosition; + } + } + } + } + + public void WipeFavoriteEntry() + { + foreach (var noteFile in NoteFiles) + { + if (!noteFile.IsLogical) + { + noteFile.FavoriteEntryItems.Clear(); + } + } + } + + public Brush LevelPaint => NoteFile?.LevelPaint; + + public Color LevelColor => NoteFile?.LevelColor ?? Colors.Transparent; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/FavorHitPoints.cs b/Qwilight/Qwilight/UIComponent/FavorHitPoints.cs new file mode 100644 index 0000000..9d6e6b3 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/FavorHitPoints.cs @@ -0,0 +1,13 @@ +namespace Qwilight.UIComponent +{ + public struct FavorHitPoints + { + public string Name { get; init; } + + public double[][] Value { get; init; } + + public bool IsDefault { get; init; } + + public override string ToString() => Name; + } +} diff --git a/Qwilight/Qwilight/UIComponent/FavorJudgment.cs b/Qwilight/Qwilight/UIComponent/FavorJudgment.cs new file mode 100644 index 0000000..3031021 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/FavorJudgment.cs @@ -0,0 +1,13 @@ +namespace Qwilight.UIComponent +{ + public struct FavorJudgment + { + public string Name { get; init; } + + public double[][] Value { get; init; } + + public bool IsDefault { get; init; } + + public override string ToString() => Name; + } +} diff --git a/Qwilight/Qwilight/UIComponent/FitMode.cs b/Qwilight/Qwilight/UIComponent/FitMode.cs new file mode 100644 index 0000000..0379151 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/FitMode.cs @@ -0,0 +1,234 @@ +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct FitMode : IEquatable + { + public const int BPM = 0; + public const int Artist = 1; + public const int ModifiedDate = 2; + public const int Length = 3; + public const int Title = 4; + public const int TotalNotes = 5; + public const int LevelTextValue = 6; + public const int HighestInputCount = 7; + public const int LatestDate = 8; + public const int HandledCount = 9; + public const int AverageInputCount = 10; + + public ImageSource Drawing => Mode switch + { + Title => BaseUI.Instance.TitleFitDrawing, + Artist => BaseUI.Instance.ArtistFitDrawing, + ModifiedDate => BaseUI.Instance.ModifiedDateFitDrawing, + TotalNotes => BaseUI.Instance.TotalNotesFitDrawing, + Length => BaseUI.Instance.LengthFitDrawing, + BPM => BaseUI.Instance.BPMFitDrawing, + LevelTextValue => BaseUI.Instance.LevelTextValueFitDrawing, + HighestInputCount => BaseUI.Instance.HighestInputCountFitDrawing, + LatestDate => BaseUI.Instance.LatestDateFitDrawing, + HandledCount => BaseUI.Instance.HandledCountFitDrawing, + AverageInputCount => BaseUI.Instance.AverageInputCountFitDrawing, + _ => default, + }; + + public int Mode { get; init; } + + public override bool Equals(object obj) => obj is FitMode fitMode && Equals(fitMode); + + public bool Equals(FitMode other) => Mode == other.Mode; + + public void Fit(List entryItems) + { + switch (Mode) + { + case Title: + FitImpl(entryItem => entryItem.Title, null); + break; + case Artist: + FitImpl(entryItem => entryItem.Artist, null); + break; + case ModifiedDate: + FitImpl(entryItem => entryItem.ModifiedDate, null, false); + break; + case BPM: + FitImpl(entryItem => entryItem.BPM, (entryItem, noteFile) => entryItem.BPM == noteFile.BPM); + break; + case TotalNotes: + FitImpl(entryItem => entryItem.TotalNotes, (entryItem, noteFile) => entryItem.TotalNotes == noteFile.TotalNotes); + break; + case Length: + FitImpl(entryItem => entryItem.Length, (entryItem, noteFile) => entryItem.Length == noteFile.Length); + break; + case LevelTextValue: + FitImpl(entryItem => entryItem.LevelTextValue, (entryItem, noteFile) => entryItem.LevelTextValue == noteFile.LevelTextValue); + break; + case HighestInputCount: + FitImpl(entryItem => entryItem.HighestInputCount, (entryItem, noteFile) => entryItem.HighestInputCount == noteFile.HighestInputCount); + break; + case LatestDate: + FitImpl(entryItem => entryItem.LatestDate ?? DateTime.MinValue, (entryItem, noteFile) => (entryItem.LatestDate ?? DateTime.MinValue) == (noteFile.LatestDate ?? DateTime.MinValue), false); + break; + case HandledCount: + FitImpl(entryItem => entryItem.HandledCount, (entryItem, noteFile) => entryItem.HandledCount == noteFile.HandledCount, false); + break; + case AverageInputCount: + FitImpl(entryItem => entryItem.AverageInputCount, (entryItem, noteFile) => entryItem.AverageInputCount == noteFile.AverageInputCount); + break; + } + + void FitImpl(Func fromEntryItem, Func onEqual, bool asc = true) where T : IComparable + { + var wantLevelItem = Configure.Instance.WantLevelIDs.Any(); + entryItems.Sort((x, y) => + { + var value = wantLevelItem ? LevelSystem.Instance.WantLevelIDEquality.Compare(x.WantLevelID, y.WantLevelID) : 0; + return value != 0 ? value : asc ? fromEntryItem(x).CompareTo(fromEntryItem(y)) : fromEntryItem(y).CompareTo(fromEntryItem(x)); + }); + + foreach (var entryItem in entryItems) + { + if (!entryItem.WasNotePositionModified && ((wantLevelItem && entryItem.NoteFile.WantLevelID != entryItem.WantLevelID) || onEqual?.Invoke(entryItem, entryItem.NoteFile) == false)) + { + var wantLevelIDSatisfied = wantLevelItem ? entryItem.WellNoteFiles.Where(noteFile => noteFile.WantLevelID == entryItem.WantLevelID) : entryItem.WellNoteFiles; + var equalSatisfied = onEqual != null ? wantLevelIDSatisfied.Where(noteFile => onEqual(entryItem, noteFile)) : wantLevelIDSatisfied; + + var noteFile = equalSatisfied.FirstOrDefault() ?? wantLevelIDSatisfied.FirstOrDefault(); + if (noteFile != null) + { + entryItem.NotePosition = Array.IndexOf(entryItem.NoteFiles, noteFile); + } + } + } + } + } + + public override int GetHashCode() => Mode.GetHashCode(); + + public void SetFittedText(EntryItem entryItem) + { + switch (Mode) + { + case BPM: + var lowestBPM = double.MaxValue; + var highestBPM = double.MinValue; + foreach (var noteFile in entryItem.WellNoteFiles) + { + var bpm = noteFile.BPM; + noteFile.FittedText = $"{bpm} BPM"; + lowestBPM = Math.Min(lowestBPM, bpm); + highestBPM = Math.Max(highestBPM, bpm); + } + entryItem.FittedText = lowestBPM != highestBPM ? $"{lowestBPM} BPM ~ {highestBPM} BPM" : $"{lowestBPM} BPM"; + break; + case Artist: + case Title: + foreach (var noteFile in entryItem.WellNoteFiles) + { + noteFile.FittedText = null; + } + entryItem.FittedText = null; + break; + case ModifiedDate: + foreach (var noteFile in entryItem.WellNoteFiles) + { + noteFile.FittedText = null; + } + entryItem.FittedText = entryItem.ModifiedDate.ToString(); + break; + case LatestDate: + foreach (var noteFile in entryItem.WellNoteFiles) + { + noteFile.FittedText = noteFile.LatestDate?.ToString(); + } + entryItem.FittedText = entryItem.LatestDate?.ToString(); + break; + case TotalNotes: + var lowestTotalNotes = int.MaxValue; + var highestTotalNotes = int.MinValue; + foreach (var noteFile in entryItem.WellNoteFiles) + { + var totalNotes = noteFile.TotalNotes; + noteFile.FittedText = totalNotes.ToString(LanguageSystem.Instance.CountContents); + lowestTotalNotes = Math.Min(lowestTotalNotes, totalNotes); + highestTotalNotes = Math.Max(highestTotalNotes, totalNotes); + } + entryItem.FittedText = lowestTotalNotes != highestTotalNotes ? $"{lowestTotalNotes.ToString(LanguageSystem.Instance.CountContents)} ~ {highestTotalNotes.ToString(LanguageSystem.Instance.CountContents)}" : lowestTotalNotes.ToString(LanguageSystem.Instance.CountContents); + break; + case Length: + var lowestLength = double.MaxValue; + var highestLength = double.MinValue; + foreach (var noteFile in entryItem.WellNoteFiles) + { + var length = noteFile.Length; + noteFile.FittedText = Utility.GetLengthText(length); + lowestLength = Math.Min(lowestLength, length); + highestLength = Math.Max(highestLength, length); + } + entryItem.FittedText = lowestLength != highestLength ? $"{Utility.GetLengthText(lowestLength)} ~ {Utility.GetLengthText(highestLength)}" : Utility.GetLengthText(lowestLength); + break; + case HandledCount: + foreach (var noteFile in entryItem.WellNoteFiles) + { + noteFile.FittedText = noteFile.HandledCount.ToString(LanguageSystem.Instance.HandledContents); + } + var handledCount = string.IsNullOrEmpty(entryItem.EventNoteID) ? entryItem.WellNoteFiles.Sum(noteFile => noteFile.HandledCount) : entryItem.HandledCount; + entryItem.FittedText = handledCount > 0 ? handledCount.ToString(LanguageSystem.Instance.HandledContents) : string.Empty; + break; + case LevelTextValue: + var lowestLevelTextValue = double.MaxValue; + var highestLevelTextValue = double.MinValue; + var lowestLevelTextNoteFile = string.Empty; + var highestLevelTextNoteFile = string.Empty; + foreach (var noteFile in entryItem.WellNoteFiles) + { + noteFile.FittedText = null; + var levelTextValue = noteFile.LevelTextValue; + var levelText = noteFile.LevelText; + if (levelTextValue < lowestLevelTextValue) + { + lowestLevelTextValue = levelTextValue; + lowestLevelTextNoteFile = levelText; + } + if (levelTextValue > highestLevelTextValue) + { + highestLevelTextValue = levelTextValue; + highestLevelTextNoteFile = levelText; + } + } + entryItem.FittedText = lowestLevelTextValue != highestLevelTextValue ? $"{lowestLevelTextNoteFile} ~ {highestLevelTextNoteFile}" : lowestLevelTextNoteFile; + break; + case HighestInputCount: + var lowestHighestInputCount = double.MaxValue; + var highestHighestInputCount = double.MinValue; + foreach (var noteFile in entryItem.WellNoteFiles) + { + var highestInputCount = noteFile.HighestInputCount; + noteFile.FittedText = highestInputCount.ToString("#,##0.##"); + lowestHighestInputCount = Math.Min(lowestHighestInputCount, highestInputCount); + highestHighestInputCount = Math.Max(highestHighestInputCount, highestInputCount); + } + entryItem.FittedText = lowestHighestInputCount != highestHighestInputCount ? $"{lowestHighestInputCount:#,##0.##/s} ~ {highestHighestInputCount:#,##0.##/s}" : lowestHighestInputCount.ToString("#,##0.##/s"); + break; + case AverageInputCount: + var lowestAverageInputCount = double.MaxValue; + var highestAverageInputCount = double.MinValue; + foreach (var noteFile in entryItem.WellNoteFiles) + { + var averageInputCount = noteFile.AverageInputCount; + noteFile.FittedText = averageInputCount.ToString("#,##0.##"); + lowestAverageInputCount = Math.Min(lowestAverageInputCount, averageInputCount); + highestAverageInputCount = Math.Max(highestAverageInputCount, averageInputCount); + } + entryItem.FittedText = lowestAverageInputCount != highestAverageInputCount ? $"{lowestAverageInputCount:#,##0.##/s} ~ {highestAverageInputCount:#,##0.##/s}" : lowestAverageInputCount.ToString("#,##0.##/s"); + break; + } + } + + public static bool operator ==(FitMode left, FitMode right) => left.Equals(right); + + public static bool operator !=(FitMode left, FitMode right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/FontFamilyItem.cs b/Qwilight/Qwilight/UIComponent/FontFamilyItem.cs new file mode 100644 index 0000000..b9a1ea0 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/FontFamilyItem.cs @@ -0,0 +1,25 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct FontFamilyItem : IEquatable + { + public FontFamily FontFamilyValue { get; init; } + + public ICollection FontFamilyNames => FontFamilyValue.FamilyNames.Values; + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public override bool Equals(object obj) => obj is FontFamilyItem fontFamilyItem && Equals(fontFamilyItem); + + public bool Equals(FontFamilyItem other) => FontFamilyValue == other.FontFamilyValue; + + public override int GetHashCode() => FontFamilyValue.GetHashCode(); + + public override string ToString() => FontFamilyValue.ToString(); + + public static bool operator ==(FontFamilyItem left, FontFamilyItem right) => left.Equals(right); + + public static bool operator !=(FontFamilyItem left, FontFamilyItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/FrontEntryItem.cs b/Qwilight/Qwilight/UIComponent/FrontEntryItem.cs new file mode 100644 index 0000000..ead7869 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/FrontEntryItem.cs @@ -0,0 +1,21 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct FrontEntryItem : IEquatable + { + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string FrontEntryPath { get; init; } + + public override bool Equals(object obj) => obj is FrontEntryItem frontEntryItem && Equals(frontEntryItem); + + public bool Equals(FrontEntryItem other) => FrontEntryPath == other.FrontEntryPath; + + public override int GetHashCode() => FrontEntryPath.GetHashCode(); + + public static bool operator ==(FrontEntryItem left, FrontEntryItem right) => left.Equals(right); + + public static bool operator !=(FrontEntryItem left, FrontEntryItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/HunterVariety.cs b/Qwilight/Qwilight/UIComponent/HunterVariety.cs new file mode 100644 index 0000000..decf949 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/HunterVariety.cs @@ -0,0 +1,33 @@ +namespace Qwilight.UIComponent +{ + public struct HunterVariety : IEquatable + { + public const int HunterVariety1st = 0; + public const int HunterVarietyHigher = 1; + public const int HunterVarietyLower = 2; + public const int HunterVarietyFavor = 3; + public const int HunterVarietyMe = 4; + + public int Mode { get; init; } + + public override bool Equals(object obj) => obj is HunterVariety hunterVariety && Equals(hunterVariety); + + public bool Equals(HunterVariety other) => Mode == other.Mode; + + public override int GetHashCode() => Mode.GetHashCode(); + + public override string ToString() => Mode switch + { + HunterVariety1st => LanguageSystem.Instance.HunterVariety1stText, + HunterVarietyHigher => LanguageSystem.Instance.HunterVarietyHigherText, + HunterVarietyLower => LanguageSystem.Instance.HunterVarietyLowerText, + HunterVarietyFavor => LanguageSystem.Instance.HunterVarietyFavorText, + HunterVarietyMe => LanguageSystem.Instance.HunterVarietyMeText, + _ => default + }; + + public static bool operator ==(HunterVariety left, HunterVariety right) => left.Equals(right); + + public static bool operator !=(HunterVariety left, HunterVariety right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/HwMode.cs b/Qwilight/Qwilight/UIComponent/HwMode.cs new file mode 100644 index 0000000..d76bb7b --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/HwMode.cs @@ -0,0 +1,32 @@ +namespace Qwilight.UIComponent +{ + public struct HwMode : IEquatable, IComparable + { + public HwMode(uint dmPelsWidth, uint dmPelsHeight, uint dmDisplayFrequency) + { + Length = dmPelsWidth; + Height = dmPelsHeight; + Hz = dmDisplayFrequency; + } + + public uint Length { get; init; } + + public uint Height { get; init; } + + public uint Hz { get; init; } + + public int CompareTo(HwMode other) => (other.Length * other.Height * other.Hz).CompareTo(Length * Height * Hz); + + public override bool Equals(object obj) => obj is HwMode hwMode && Equals(hwMode); + + public bool Equals(HwMode other) => other.Length == Length && other.Height == Height && other.Hz == Hz; + + public override int GetHashCode() => HashCode.Combine(Length, Height, Hz); + + public override string ToString() => $"{Length}×{Height} ({Hz} Hz)"; + + public static bool operator ==(HwMode left, HwMode right) => left.Equals(right); + + public static bool operator !=(HwMode left, HwMode right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/UIComponent/IOCompetence.cs b/Qwilight/Qwilight/UIComponent/IOCompetence.cs new file mode 100644 index 0000000..a008642 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/IOCompetence.cs @@ -0,0 +1,31 @@ +namespace Qwilight.UIComponent +{ + public struct IOCompetence : IEquatable + { + public const int IOCallable = 0; + public const int IOAvatar = 3; + public const int IOUbuntu = 1; + public const int IOVoid = 2; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is IOCompetence ioCompetence && Equals(ioCompetence); + + public bool Equals(IOCompetence other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + IOCallable => LanguageSystem.Instance.IOCallableContents, + IOAvatar => LanguageSystem.Instance.IOAvatarContents, + IOUbuntu => LanguageSystem.Instance.IOUbuntuContents, + IOVoid => LanguageSystem.Instance.IOVoidContents, + _ => default + }; + + public static bool operator ==(IOCompetence left, IOCompetence right) => left.Equals(right); + + public static bool operator !=(IOCompetence left, IOCompetence right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/JudgmentMeter.cs b/Qwilight/Qwilight/UIComponent/JudgmentMeter.cs new file mode 100644 index 0000000..fe57b81 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/JudgmentMeter.cs @@ -0,0 +1,9 @@ +namespace Qwilight.UIComponent +{ + public sealed class JudgmentMeter + { + public double Millis { get; set; } + + public Component.Judged Judged { get; set; } + } +} diff --git a/Qwilight/Qwilight/UIComponent/JudgmentVisualizer.cs b/Qwilight/Qwilight/UIComponent/JudgmentVisualizer.cs new file mode 100644 index 0000000..e6914e9 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/JudgmentVisualizer.cs @@ -0,0 +1,23 @@ +namespace Qwilight.UIComponent +{ + public sealed class JudgmentVisualizer + { + double _loopingCounter; + + public double LoopingCounter { get; set; } + + public double Judgment { get; init; } + + public Component.Judged Judged { get; init; } + + public double Status => LoopingCounter / _loopingCounter; + + public JudgmentVisualizer(double judgment, Component.Judged judged) + { + _loopingCounter = Configure.Instance.JudgmentVisualizerMillis; + LoopingCounter = _loopingCounter; + Judgment = judgment; + Judged = judged; + } + } +} diff --git a/Qwilight/Qwilight/UIComponent/LevelItem.cs b/Qwilight/Qwilight/UIComponent/LevelItem.cs new file mode 100644 index 0000000..b60493f --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/LevelItem.cs @@ -0,0 +1,16 @@ +namespace Qwilight.UIComponent +{ + public sealed class LevelItem : Model + { + bool _isWanted; + + public string LevelID { get; init; } + + public bool IsWanted + { + get => _isWanted; + + set => SetProperty(ref _isWanted, value, nameof(IsWanted)); + } + } +} diff --git a/Qwilight/Qwilight/UIComponent/MediaInputItem.cs b/Qwilight/Qwilight/UIComponent/MediaInputItem.cs new file mode 100644 index 0000000..3f687bc --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/MediaInputItem.cs @@ -0,0 +1,21 @@ +namespace Qwilight.UIComponent +{ + public struct MediaInputItem : IEquatable + { + public string ID { get; init; } + + public string Name { get; init; } + + public override bool Equals(object obj) => obj is MediaInputItem mediaInputItem && Equals(mediaInputItem); + + public bool Equals(MediaInputItem other) => ID == other.ID; + + public override int GetHashCode() => ID.GetHashCode(); + + public override string ToString() => Name; + + public static bool operator ==(MediaInputItem left, MediaInputItem right) => left.Equals(right); + + public static bool operator !=(MediaInputItem left, MediaInputItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/MediaInputQuality.cs b/Qwilight/Qwilight/UIComponent/MediaInputQuality.cs new file mode 100644 index 0000000..88fb22d --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/MediaInputQuality.cs @@ -0,0 +1,23 @@ +using Windows.Media.MediaProperties; + +namespace Qwilight.UIComponent +{ + public struct MediaInputQuality : IEquatable, IComparable + { + public VideoEncodingProperties Data { get; init; } + + public int CompareTo(MediaInputQuality other) => (other.Data.Width * other.Data.Height).CompareTo(Data.Width * Data.Height); + + public override bool Equals(object obj) => obj is MediaInputQuality mediaInputQuality && Equals(mediaInputQuality); + + public bool Equals(MediaInputQuality other) => other.Data.Width == Data.Width && other.Data.Height == Data.Height && other.Data.Subtype == Data.Subtype; + + public override int GetHashCode() => HashCode.Combine(Data.Width, Data.Height, Data.Subtype); + + public static bool operator ==(MediaInputQuality left, MediaInputQuality right) => left.Equals(right); + + public static bool operator !=(MediaInputQuality left, MediaInputQuality right) => !(left == right); + + public override string ToString() => $"{Data.Width}×{Data.Height} ({Data.Subtype})"; + } +} diff --git a/Qwilight/Qwilight/UIComponent/ModifyModeComponentItem.cs b/Qwilight/Qwilight/UIComponent/ModifyModeComponentItem.cs new file mode 100644 index 0000000..7df9cb7 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/ModifyModeComponentItem.cs @@ -0,0 +1,29 @@ +using CommunityToolkit.Mvvm.Input; +using System.Windows; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class ModifyModeComponentItem : Model + { + public Brush PointedPaint => Paints.LowerStandPaints[PointedPaintID]; + + public string LowerStandText => PointedPaintID > 0 ? "❕" : string.Empty; + + public int Value { get; init; } + + public int PointedPaintID { get; set; } + + public Visibility IsConfigureVisible => OnConfigure != null ? Visibility.Visible : Visibility.Collapsed; + + public string Data { get; init; } + + public ImageSource Drawing { get; init; } + + public RelayCommand OnConfigure { get; init; } + + public override bool Equals(object obj) => obj is ModifyModeComponentItem modeComponentItem && Value == modeComponentItem.Value; + + public override int GetHashCode() => Value.GetHashCode(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NetItem.cs b/Qwilight/Qwilight/UIComponent/NetItem.cs new file mode 100644 index 0000000..d97fc49 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NetItem.cs @@ -0,0 +1,129 @@ +using Qwilight.Compute; +using Qwilight.Utilities; + +namespace Qwilight.UIComponent +{ + public sealed class NetItem : IComparable + { + Comment _comment; + + public double DrawingPosition { get; set; } + + public int TargetPosition { get; set; } + + public int SetTargetPosition { get; set; } + + public Event.Types.AvatarNetStatus AvatarNetStatus { get; set; } + + public string AvatarID { get; init; } + + public string AvatarName { get; init; } + + public DateTime Date { get; init; } + + public int StandValue { get; set; } + + public string Stand { get; set; } + + public double PointValue { get; set; } + + public string Point { get; set; } + + public int BandValue { get; set; } + + public string Band { get; set; } + + public double HitPoints { get; set; } + + public DefaultCompute.QuitStatus QuitValue { get; set; } + + public double IsFailedStatus { get; set; } + + public Component.Judged LastJudged { get; set; } = Component.Judged.Not; + + public float P2BuiltLength { get; set; } + + public float JudgmentMainPosition { get; set; } + + public ICollection Drawings { get; set; } + + public bool IsMyNetItem { get; init; } + + public bool IsFavorNetItem { get; init; } + + public CommentItem CommentItem { get; init; } + + public Comment Comment + { + get => _comment; + + set + { + _comment = value; + if (value != null) + { + var date = Version.Parse(value.Date); + PaintEventsDate = Utility.IsLowerDate(date, 1, 14, 91) ? Component.PaintEventsDate100 : Component.PaintEventsDate11491; + } + else + { + PaintEventsDate = Component.PaintEventsDate11491; + } + LastPaintEventPosition = 0; + } + } + + public int PaintEventsDate { get; set; } + + public int LastPaintEventPosition { get; set; } + + public ModeComponent.HitPointsMode HitPointsModeValue { get; set; } + + public NetItem(string avatarID, string avatarName, DateTime date, int stand = default, int band = default, double point = default, double hitPoints = default) + { + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + StandValue = stand; + Stand = stand.ToString(LanguageSystem.Instance.StandContents); + BandValue = band; + Band = band.ToString(LanguageSystem.Instance.BandContents); + PointValue = point; + Point = (100 * point).ToString("0.##%"); + HitPoints = hitPoints; + } + + public override bool Equals(object obj) => obj is NetItem netItem && AvatarID == netItem.AvatarID && IsMyNetItem == netItem.IsMyNetItem; + + public override int GetHashCode() => AvatarID.GetHashCode(); + + public void SetValue(int stand, int band, double point, double hitPoints, int noteFileCount, ICollection drawings = null, Event.Types.DrawingComponent drawingComponent = null) + { + StandValue = stand; + Stand = PoolSystem.Instance.GetValueText(stand, LanguageSystem.Instance.StandContents); + BandValue = band; + Band = PoolSystem.Instance.GetValueText(band, LanguageSystem.Instance.BandContents); + PointValue = point; + Point = PoolSystem.Instance.GetValueText(100.0 * point, "0.##%"); + HitPoints = hitPoints; + QuitValue = Utility.GetQuitStatusValue(PointValue, StandValue, hitPoints, noteFileCount); + Drawings = drawings; + if (drawingComponent != null) + { + P2BuiltLength = drawingComponent.P2BuiltLength; + JudgmentMainPosition = drawingComponent.JudgmentMainPosition; + } + } + + public int CompareTo(NetItem other) + { + var value = StandValue.CompareTo(other.StandValue); + if (value != 0) + { + return value; + } + + return other.TargetPosition.CompareTo(TargetPosition); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NetSIteCommentItems.cs b/Qwilight/Qwilight/UIComponent/NetSIteCommentItems.cs new file mode 100644 index 0000000..f5b7351 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NetSIteCommentItems.cs @@ -0,0 +1,11 @@ +namespace Qwilight.UIComponent +{ + public struct NetSIteCommentItems + { + public List NetSiteCommentItems { get; init; } + + public long Date { get; set; } + + public override string ToString() => DateTimeOffset.FromUnixTimeMilliseconds(Date).LocalDateTime.ToShortTimeString(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NetSiteCommentItem.cs b/Qwilight/Qwilight/UIComponent/NetSiteCommentItem.cs new file mode 100644 index 0000000..86cf135 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NetSiteCommentItem.cs @@ -0,0 +1,73 @@ +using Qwilight.Utilities; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct NetSiteCommentItem : IEquatable + { + public Event.Types.AvatarNetStatus AvatarNetStatus { get; init; } + + public string AvatarID { get; init; } + + public string AvatarName { get; init; } + + public AvatarWww AvatarWwwValue { get; } + + public int StandValue { get; init; } + + public string Stand { get; init; } + + public string Band { get; init; } + + public double PointValue { get; init; } + + public string Point { get; init; } + + public string HighestJudgment { get; init; } + + public string HigherJudgment { get; init; } + + public string HighJudgment { get; init; } + + public string LowJudgment { get; init; } + + public string LowerJudgment { get; init; } + + public int LowestJudgmentValue { get; init; } + + public string LowestJudgment => LowestJudgmentValue.ToString(LanguageSystem.Instance.CountContents); + + public Brush PointedPaint => Paints.NetSiteCommentPaints[(int)AvatarNetStatus]; + + public ImageSource QuitDrawing => BaseUI.Instance.QuitDrawings[(int)Utility.GetQuitStatusValue(PointValue, StandValue, AvatarNetStatus == Event.Types.AvatarNetStatus.Failed ? 0.0 : 1.0, 1)][LowestJudgmentValue > 0 ? 0 : 1]?.DefaultDrawing; + + public NetSiteCommentItem(JSON.TwilightCallNetSiteComments.CallNetSIteCommentItem toCallNetSiteCommentItem) + { + AvatarID = toCallNetSiteCommentItem.avatarID; + AvatarWwwValue = new AvatarWww(AvatarID); + AvatarNetStatus = (Event.Types.AvatarNetStatus)toCallNetSiteCommentItem.avatarNetStatus; + AvatarName = toCallNetSiteCommentItem.avatarName; + StandValue = toCallNetSiteCommentItem.stand; + Stand = StandValue.ToString(LanguageSystem.Instance.StandContents); + Band = toCallNetSiteCommentItem.band.ToString(LanguageSystem.Instance.BandContents); + PointValue = toCallNetSiteCommentItem.point; + Point = Math.Round(100.0 * PointValue, 2).ToString("0.##%"); + HighestJudgment = toCallNetSiteCommentItem.highestJudgment.ToString(LanguageSystem.Instance.CountContents); + HigherJudgment = toCallNetSiteCommentItem.higherJudgment.ToString(LanguageSystem.Instance.CountContents); + HighJudgment = toCallNetSiteCommentItem.highJudgment.ToString(LanguageSystem.Instance.CountContents); + LowJudgment = toCallNetSiteCommentItem.lowJudgment.ToString(LanguageSystem.Instance.CountContents); + LowerJudgment = toCallNetSiteCommentItem.lowerJudgment.ToString(LanguageSystem.Instance.CountContents); + LowestJudgmentValue = toCallNetSiteCommentItem.lowestJudgment; + } + + public override bool Equals(object obj) => obj is NetSiteCommentItem netSiteCommentItem && Equals(netSiteCommentItem); + + public bool Equals(NetSiteCommentItem other) => AvatarID == other.AvatarID; + + public override int GetHashCode() => AvatarID.GetHashCode(); + + public static bool operator ==(NetSiteCommentItem left, NetSiteCommentItem right) => left.Equals(right); + + public static bool operator !=(NetSiteCommentItem left, NetSiteCommentItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NotifyItem.cs b/Qwilight/Qwilight/UIComponent/NotifyItem.cs new file mode 100644 index 0000000..0378cb6 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NotifyItem.cs @@ -0,0 +1,75 @@ +using System.Buffers; +using System.IO; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class NotifyItem : Model, IDisposable + { + NotifySystem.NotifyVariety _toNotifyVariety; + string _text; + + public byte[] SaveAsDataStore { get; set; } + + public MemoryStream SaveDataFlow { get; set; } + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public DateTime Date { get; } = DateTime.Now; + + public bool IsNew { get; set; } + + public bool IsStopped { get; set; } + + public double BundleStatus { get; set; } + + public Action OnHandle { get; init; } + + public Func OnStop { get; set; } + + public NotifySystem.NotifyVariety Variety + { + get => _toNotifyVariety; + + set => SetProperty(ref _toNotifyVariety, value, nameof(Variety)); + } + + public long LevyingStatus { get; set; } + + public long QuitStatus { get; set; } + + public void NotifyBundleStatus() + { + if (QuitStatus > 0) + { + var bundleStatus = 100.0 * LevyingStatus / QuitStatus; + if (bundleStatus == 100.0 || Math.Abs(bundleStatus - BundleStatus) >= 1.0) + { + BundleStatus = bundleStatus; + OnPropertyChanged(nameof(BundleStatus)); + } + } + } + + public string Text + { + get => _text; + + set => SetProperty(ref _text, value, nameof(Text)); + } + + public void Dispose() + { + if (SaveDataFlow != null) + { + SaveDataFlow.Dispose(); + SaveDataFlow = null; + } + if (SaveAsDataStore != null) + { + ArrayPool.Shared.Return(SaveAsDataStore); + SaveAsDataStore = null; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NotifySaveBundleCompetence.cs b/Qwilight/Qwilight/UIComponent/NotifySaveBundleCompetence.cs new file mode 100644 index 0000000..a0c7d0f --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NotifySaveBundleCompetence.cs @@ -0,0 +1,31 @@ +namespace Qwilight.UIComponent +{ + public struct NotifySaveBundleCompetence : IEquatable + { + public const int NotifySaveBundleCallable = 0; + public const int NotifySaveBundleAvatar = 1; + public const int NotifySaveBundleUbuntu = 2; + public const int NotifySaveBundleVoid = 3; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is NotifySaveBundleCompetence toNotifySaveBundleCompetence && Equals(toNotifySaveBundleCompetence); + + public bool Equals(NotifySaveBundleCompetence other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + NotifySaveBundleCallable => LanguageSystem.Instance.NotifySaveBundleCallableContents, + NotifySaveBundleAvatar => LanguageSystem.Instance.NotifySaveBundleAvatarContents, + NotifySaveBundleUbuntu => LanguageSystem.Instance.NotifySaveBundleUbuntuContents, + NotifySaveBundleVoid => LanguageSystem.Instance.NotifySaveBundleVoidContents, + _ => default + }; + + public static bool operator ==(NotifySaveBundleCompetence left, NotifySaveBundleCompetence right) => left.Equals(right); + + public static bool operator !=(NotifySaveBundleCompetence left, NotifySaveBundleCompetence right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NotifyUbuntuCompetence.cs b/Qwilight/Qwilight/UIComponent/NotifyUbuntuCompetence.cs new file mode 100644 index 0000000..b71655b --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NotifyUbuntuCompetence.cs @@ -0,0 +1,27 @@ +namespace Qwilight.UIComponent +{ + public struct NotifyUbuntuCompetence : IEquatable + { + public const int NotifyUbuntu = 0; + public const int NotNotifyUbuntu = 1; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is NotifyUbuntuCompetence toNotifyUbuntuCompetence && Equals(toNotifyUbuntuCompetence); + + public bool Equals(NotifyUbuntuCompetence other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + NotifyUbuntu => LanguageSystem.Instance.NotifyUbuntuContents, + NotNotifyUbuntu => LanguageSystem.Instance.NotNotifyUbuntuContents, + _ => default + }; + + public static bool operator ==(NotifyUbuntuCompetence left, NotifyUbuntuCompetence right) => left.Equals(right); + + public static bool operator !=(NotifyUbuntuCompetence left, NotifyUbuntuCompetence right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/NotifyXamlItem.cs b/Qwilight/Qwilight/UIComponent/NotifyXamlItem.cs new file mode 100644 index 0000000..a2a9540 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/NotifyXamlItem.cs @@ -0,0 +1,38 @@ +using System.Windows.Threading; +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight.UIComponent +{ + public sealed class NotifyXamlItem : Model + { + public Brush Paint { get; set; } + + public Color Color { get; set; } + + public NotifySystem.NotifyVariety Variety { get; set; } + + public DispatcherTimer Handler { get; set; } + + public string Contents { get; set; } + + public Action OnHandle { get; init; } + + public int ID { get; init; } + + public override bool Equals(object obj) => obj is NotifyXamlItem toNotifyXamlItem && ID == toNotifyXamlItem.ID; + + public override int GetHashCode() => ID.GetHashCode(); + + public void Set(NotifyXamlItem toNotifyXamlItem) + { + Paint = toNotifyXamlItem.Paint; + Color = toNotifyXamlItem.Color; + Variety = toNotifyXamlItem.Variety; + Contents = toNotifyXamlItem.Contents; + OnPropertyChanged(nameof(Paint)); + OnPropertyChanged(nameof(Variety)); + OnPropertyChanged(nameof(Contents)); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/PostableUIItem.cs b/Qwilight/Qwilight/UIComponent/PostableUIItem.cs new file mode 100644 index 0000000..b0559d4 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/PostableUIItem.cs @@ -0,0 +1,16 @@ +namespace Qwilight.UIComponent +{ + public sealed class PostableUIItem : Model + { + bool _isWanted; + + public PostableItem PostableItemValue { get; init; } + + public bool IsWanted + { + get => _isWanted; + + set => SetProperty(ref _isWanted, value, nameof(IsWanted)); + } + } +} diff --git a/Qwilight/Qwilight/UIComponent/SilentSiteCompetence.cs b/Qwilight/Qwilight/UIComponent/SilentSiteCompetence.cs new file mode 100644 index 0000000..47e3ed0 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/SilentSiteCompetence.cs @@ -0,0 +1,31 @@ +namespace Qwilight.UIComponent +{ + public struct SilentSiteCompetence : IEquatable + { + public const int SilentSiteCallable = 0; + public const int SilentSiteAvatar = 3; + public const int SilentSiteUbuntu = 1; + public const int SilentSiteVoid = 2; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is SilentSiteCompetence silentSiteCompetence && Equals(silentSiteCompetence); + + public bool Equals(SilentSiteCompetence other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + SilentSiteCallable => LanguageSystem.Instance.SilentSiteCallableContents, + SilentSiteAvatar => LanguageSystem.Instance.SilentSiteAvatarContents, + SilentSiteUbuntu => LanguageSystem.Instance.SilentSiteUbuntuContents, + SilentSiteVoid => LanguageSystem.Instance.SilentSiteVoidContents, + _ => default + }; + + public static bool operator ==(SilentSiteCompetence left, SilentSiteCompetence right) => left.Equals(right); + + public static bool operator !=(SilentSiteCompetence left, SilentSiteCompetence right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/SiteItem.cs b/Qwilight/Qwilight/UIComponent/SiteItem.cs new file mode 100644 index 0000000..ad4e46b --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/SiteItem.cs @@ -0,0 +1,40 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class SiteItem : Model + { + public const int DefaultSite = 0; + public const int FavorSite = 1; + public const int NetSite = 2; + + string _siteName; + string _avatarCountText; + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string SiteID { get; init; } + + public string SiteName + { + get => _siteName; + + set => SetProperty(ref _siteName, value, nameof(SiteName)); + } + + public string AvatarCountText + { + get => _avatarCountText; + + set => SetProperty(ref _avatarCountText, value, nameof(AvatarCountText)); + } + + public int SiteConfigure { get; init; } + + public bool HasCipher { get; init; } + + public override bool Equals(object obj) => obj is SiteItem siteItem && SiteID == siteItem.SiteID; + + public override int GetHashCode() => HashCode.Combine(SiteID, SiteConfigure, HasCipher); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/UIItem.cs b/Qwilight/Qwilight/UIComponent/UIItem.cs new file mode 100644 index 0000000..a126b4e --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/UIItem.cs @@ -0,0 +1,28 @@ +using System.IO; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class UIItem : Model + { + public string UIEntry { get; init; } + + public string YamlName { get; init; } + + public string Title => YamlName[(YamlName.IndexOf('@') + 1)..]; + + public bool IsConfigured => YamlName.StartsWith('@') ? Equals(Configure.Instance.BaseUIItemValue) : Equals(Configure.Instance.UIItemValue); + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string GetYamlFilePath() => Path.Combine(QwilightComponent.UIEntryPath, UIEntry, Path.ChangeExtension(YamlName, ".yaml")); + + public override string ToString() => YamlName[(YamlName.IndexOf('@') + 1)..]; + + public void NotifyUI() => OnPropertyChanged(nameof(IsConfigured)); + + public override bool Equals(object obj) => obj is UIItem valueUIItem && UIEntry == valueUIItem.UIEntry && YamlName == valueUIItem.YamlName; + + public override int GetHashCode() => HashCode.Combine(UIEntry, YamlName); + } +} diff --git a/Qwilight/Qwilight/UIComponent/UbuntuItem.cs b/Qwilight/Qwilight/UIComponent/UbuntuItem.cs new file mode 100644 index 0000000..2b3e99d --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/UbuntuItem.cs @@ -0,0 +1,67 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class UbuntuItem : Model + { + public enum UbuntuSituation + { + NotUbuntu, NotSignedIn, NoteFileMode, DefaultComputing, CommentComputing, AutoComputing, QuitMode, NetComputing, IOComputing + } + + string _avatarName; + UbuntuSituation _ubuntuSituationValue; + string _situationText; + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string AvatarID { get; init; } + + public string AvatarName + { + get => _avatarName; + + set => SetProperty(ref _avatarName, value, nameof(AvatarName)); + } + + public UbuntuSituation UbuntuSituationValue + { + get => _ubuntuSituationValue; + + set => SetProperty(ref _ubuntuSituationValue, value, nameof(UbuntuSituationValue)); + } + + public string SituationText + { + get => _situationText; + + set => SetProperty(ref _situationText, value, nameof(SituationText)); + } + + public AvatarWww AvatarWwwValue { get; } + + public UbuntuItem(string avatarID) + { + AvatarID = avatarID; + AvatarWwwValue = new AvatarWww(avatarID); + } + + public override string ToString() => UbuntuSituationValue switch + { + UbuntuSituation.NotUbuntu => LanguageSystem.Instance.NotUbuntuSituationContents, + UbuntuSituation.NotSignedIn => string.Format(LanguageSystem.Instance.NotSignedInSituationContents, DateTimeOffset.FromUnixTimeMilliseconds(Convert.ToInt64(SituationText)).LocalDateTime.ToString("yyyy-MM-dd tt hh:mm:ss")), + UbuntuSituation.NoteFileMode => string.Format(LanguageSystem.Instance.NoteFileModeSituationContents, SituationText), + UbuntuSituation.DefaultComputing => string.Format(LanguageSystem.Instance.DefaultComputingSituationContents, SituationText), + UbuntuSituation.CommentComputing => string.Format(LanguageSystem.Instance.CommentComputingSituationContents, SituationText), + UbuntuSituation.AutoComputing => string.Format(LanguageSystem.Instance.AutoComputingSituationContents, SituationText), + UbuntuSituation.QuitMode => string.Format(LanguageSystem.Instance.QuitComputingSituationContents, SituationText), + UbuntuSituation.NetComputing => string.Format(LanguageSystem.Instance.NetComputingSituationContents, SituationText), + UbuntuSituation.IOComputing => string.Format(LanguageSystem.Instance.IOComputingSituationContents, SituationText), + _ => default, + }; + + public override bool Equals(object obj) => obj is UbuntuItem ubuntuItem && AvatarID == ubuntuItem.AvatarID; + + public override int GetHashCode() => AvatarID.GetHashCode(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/ValidNetMode.cs b/Qwilight/Qwilight/UIComponent/ValidNetMode.cs new file mode 100644 index 0000000..71ff3d5 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/ValidNetMode.cs @@ -0,0 +1,41 @@ +using System.Windows.Media; +using Colors = Microsoft.UI.Colors; + +namespace Qwilight.UIComponent +{ + public struct ValidNetMode : IEquatable + { + static readonly Brush[] _validNetModePaints = new[] + { + DrawingSystem.Instance.GetDefaultPaint(Colors.White), + DrawingSystem.Instance.GetDefaultPaint(Colors.LightGreen), + DrawingSystem.Instance.GetDefaultPaint(Colors.LightGreen), + DrawingSystem.Instance.GetDefaultPaint(Colors.LightGreen), + DrawingSystem.Instance.GetDefaultPaint(Colors.Red) + }; + + public int Data { get; init; } + + public Brush Paint => _validNetModePaints[Data]; + + public override string ToString() => Data switch + { + 0 => LanguageSystem.Instance.ValidNetMode0Text, + 1 => LanguageSystem.Instance.ValidNetMode1Text, + 2 => LanguageSystem.Instance.ValidNetMode2Text, + 3 => LanguageSystem.Instance.ValidNetMode3Text, + 4 => LanguageSystem.Instance.ValidNetMode4Text, + _ => string.Empty + }; + + public override bool Equals(object obj) => obj is ValidNetMode validNetMode && Equals(validNetMode); + + public bool Equals(ValidNetMode other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public static bool operator ==(ValidNetMode left, ValidNetMode right) => left.Equals(right); + + public static bool operator !=(ValidNetMode left, ValidNetMode right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/ViewItem.cs b/Qwilight/Qwilight/UIComponent/ViewItem.cs new file mode 100644 index 0000000..dafeb47 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/ViewItem.cs @@ -0,0 +1,29 @@ +namespace Qwilight.UIComponent +{ + public struct ViewItem : IEquatable + { + public const int Always = 0; + public const int NotAutoCompute = 1; + public const int Not = 2; + + public int Data { get; init; } + + public override bool Equals(object obj) => obj is ViewItem viewItem && Equals(viewItem); + + public bool Equals(ViewItem other) => Data == other.Data; + + public override int GetHashCode() => Data.GetHashCode(); + + public override string ToString() => Data switch + { + Always => LanguageSystem.Instance.AlwaysViewContents, + NotAutoCompute => LanguageSystem.Instance.NotAutoComputeViewContents, + Not => LanguageSystem.Instance.NotViewContents, + _ => default + }; + + public static bool operator ==(ViewItem left, ViewItem right) => left.Equals(right); + + public static bool operator !=(ViewItem left, ViewItem right) => !(left == right); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/WaveValue.cs b/Qwilight/Qwilight/UIComponent/WaveValue.cs new file mode 100644 index 0000000..6065daa --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/WaveValue.cs @@ -0,0 +1,23 @@ +using NAudio.CoreAudioApi; + +namespace Qwilight.UIComponent +{ + public struct WaveValue : IEquatable + { + public MMDevice System { get; init; } + + public string Name { get; init; } + + public override bool Equals(object obj) => obj is WaveValue waveValue && Equals(waveValue); + + public bool Equals(WaveValue other) => System == other.System; + + public override int GetHashCode() => System.GetHashCode(); + + public override string ToString() => Name; + + public static bool operator ==(WaveValue left, WaveValue right) => left.Equals(right); + + public static bool operator !=(WaveValue left, WaveValue right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/UIComponent/WowItem.cs b/Qwilight/Qwilight/UIComponent/WowItem.cs new file mode 100644 index 0000000..37d7911 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/WowItem.cs @@ -0,0 +1,35 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public struct WowItem : IEquatable + { + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string AvatarID { get; init; } + + public string AvatarName { get; init; } + + public string Value { get; init; } + + public AvatarWww AvatarWwwValue { get; } + + public WowItem(JSON.TwilightWwwWow.Avatar wwwWowAvatar, Func onValue) + { + AvatarID = wwwWowAvatar.avatarID; + AvatarName = wwwWowAvatar.avatarName; + AvatarWwwValue = new AvatarWww(wwwWowAvatar.avatarID); + Value = onValue(wwwWowAvatar.value); + } + + public override bool Equals(object obj) => obj is WowItem wowItem && Equals(wowItem); + + public bool Equals(WowItem other) => AvatarID == other.AvatarID; + + public override int GetHashCode() => HashCode.Combine(AvatarID); + + public static bool operator ==(WowItem left, WowItem right) => left.Equals(right); + + public static bool operator !=(WowItem left, WowItem right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/UIComponent/WwwLevelAvatar.cs b/Qwilight/Qwilight/UIComponent/WwwLevelAvatar.cs new file mode 100644 index 0000000..22425ee --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/WwwLevelAvatar.cs @@ -0,0 +1,17 @@ +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class WwwLevelAvatar + { + public AvatarWww AvatarWwwValue { get; init; } + + public string AvatarName { get; init; } + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public override bool Equals(object obj) => obj is WwwLevelAvatar wwwLevelAvatar && AvatarWwwValue == wwwLevelAvatar.AvatarWwwValue; + + public override int GetHashCode() => AvatarWwwValue.GetHashCode(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/UIComponent/WwwLevelGroup.cs b/Qwilight/Qwilight/UIComponent/WwwLevelGroup.cs new file mode 100644 index 0000000..e7dcc49 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/WwwLevelGroup.cs @@ -0,0 +1,675 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.ObjectModel; +using System.Data.SQLite; +using System.Security.Cryptography; + +namespace Qwilight.UIComponent +{ + public sealed partial class WwwLevelGroup : Model + { + public sealed class WwwLevelComputing : Computing + { + public override BaseNoteFile.NoteVariety NoteVarietyValue => WwwLevelNoteVariety; + + public BaseNoteFile.NoteVariety WwwLevelNoteVariety { get; set; } + + public override void OnCompiled() + { + } + + public override void OnFault(Exception e) + { + } + + public string NoteID { get; init; } + + public bool NotHaveIt { get; init; } + } + + readonly WwwLevelData _wwwLevelDataValue = new WwwLevelData(); + readonly double[] _audioMultipliers = new double[2]; + WwwLevelItem _wwwLevelItem; + bool _isLevelItemLoading; + + string GetEventNoteID() => string.Join('/', WwwLevelComputingCollection.Select(wwwLevelComputing => wwwLevelComputing.NoteID)); + + public bool HasEventNote => ViewModels.Instance.MainValue.EventNoteEntryItems.ContainsKey(GetEventNoteID()); + + [RelayCommand] + void OnGetWwwLevel() + { + try + { + DB.Instance.SetEventNoteData(WwwLevelComputingCollection); + if (WwwLevelItemValue != null) + { + var eventNoteName = WwwLevelItemValue.Title; + var date = DateTime.Now; + var eventNoteVariety = DB.EventNoteVariety.Qwilight; + DB.Instance.SetEventNote(GetEventNoteID(), eventNoteName, date, eventNoteVariety); + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.LoadEventNoteEntryItems(); + mainViewModel.Want(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.OpenedEventNotes); + NotifyIsCompatible(); + } + } + catch (SQLiteException) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.BeforeEventNoteContents); + } + } + + [RelayCommand] + void OnLevyWwwLevel() + { + ViewModels.Instance.WwwLevelValue.Close(); + var mainViewModel = ViewModels.Instance.MainValue; + var defaultModeComponentValue = mainViewModel.ModeComponentValue.Clone(); + var modeComponentValue = mainViewModel.ModeComponentValue; + if (!IsAutoModeCompatible) + { + modeComponentValue.AutoModeValue = AutoModes.First().Value; + } + if (!IsNoteSaltModeCompatible) + { + modeComponentValue.NoteSaltModeValue = NoteSaltModes.First().Value; + } + modeComponentValue.AudioMultiplier = Math.Clamp(modeComponentValue.AudioMultiplier, _audioMultipliers[0], _audioMultipliers[1]); + if (!IsFaintNoteModeCompatible) + { + modeComponentValue.FaintNoteModeValue = FaintNoteModes.First().Value; + } + if (!IsJudgmentModeCompatible) + { + modeComponentValue.JudgmentModeValue = JudgmentModes.First().Value; + } + if (!IsHitPointsModeCompatible) + { + modeComponentValue.HitPointsModeValue = HitPointsModes.First().Value; + } + if (!IsNoteMobilityModeCompatible) + { + modeComponentValue.NoteMobilityModeValue = NoteMobilityModes.First().Value; + } + if (!IsLongNoteModeCompatible) + { + modeComponentValue.LongNoteModeValue = LongNoteModes.First().Value; + } + if (!IsInputFavorModeCompatible) + { + modeComponentValue.InputFavorModeValue = InputFavorModes.First().Value; + } + if (!IsNoteModifyModeCompatible) + { + modeComponentValue.NoteModifyModeValue = NoteModifyModes.First().Value; + } + if (!IsBPMModeCompatible) + { + modeComponentValue.BPMModeValue = BPMModes.First().Value; + } + if (!IsWaveModeCompatible) + { + modeComponentValue.WaveModeValue = WaveModes.First().Value; + } + if (!IsSetNoteModeCompatible) + { + modeComponentValue.SetNoteModeValue = SetNoteModes.First().Value; + } + if (!IsLowestJudgmentConditionModeCompatible) + { + modeComponentValue.LowestJudgmentConditionModeValue = LowestJudgmentConditionModes.First().Value; + } + modeComponentValue.PutCopyNotesValueV2 = ModeComponent.PutCopyNotes.Default; + mainViewModel.HandleLevyNoteFile(mainViewModel.EventNoteEntryItems[GetEventNoteID()], _wwwLevelDataValue, defaultModeComponentValue); + } + + public bool IsLevelItemLoading + { + get => _isLevelItemLoading; + + set => SetProperty(ref _isLevelItemLoading, value, nameof(IsLevelItemLoading)); + } + + public string LevelName { get; init; } + + public ObservableCollection WwwLevelItemCollection { get; } = new(); + + public ObservableCollection WwwLevelComputingCollection { get; } = new(); + + public ObservableCollection ClearedEdgeItemCollection { get; } = new(); + + public ObservableCollection ClearedTitleItemCollection { get; } = new(); + + public bool HasClearedEdgeItem => ClearedEdgeItemCollection.Count > 0; + + public bool HasClearedTitleItem => ClearedTitleItemCollection.Count > 0; + + public string Title { get; set; } + + public string Comment { get; set; } + + public bool AllowPause { get; set; } + + public string[] StandContents { get; } = new string[2]; + + public string[] PointContents { get; } = new string[2]; + + public string[] BandContents { get; } = new string[2]; + + public string[] AudioMultiplierContents { get; } = new string[2]; + + public string[][] JudgmentContents { get; } = new string[6][]; + + public bool IsAutoModeCompatible => AutoModes.Count == 0 || AutoModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.AutoModeValue); + + public bool IsNoteSaltModeCompatible => NoteSaltModes.Count == 0 || NoteSaltModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.NoteSaltModeValue); + + public bool IsFaintNoteModeCompatible => FaintNoteModes.Count == 0 || FaintNoteModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.FaintNoteModeValue); + + public bool IsJudgmentModeCompatible => JudgmentModes.Count == 0 || JudgmentModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.JudgmentModeValue); + + public bool IsHitPointsModeCompatible => HitPointsModes.Count == 0 || HitPointsModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.HitPointsModeValue); + + public bool IsNoteMobilityModeCompatible => NoteMobilityModes.Count == 0 || NoteMobilityModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.NoteMobilityModeValue); + + public bool IsLongNoteModeCompatible => LongNoteModes.Count == 0 || LongNoteModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.LongNoteModeValue); + + public bool IsInputFavorModeCompatible => InputFavorModes.Count == 0 || InputFavorModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.InputFavorModeValue); + + public bool IsNoteModifyModeCompatible => NoteModifyModes.Count == 0 || NoteModifyModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.NoteModifyModeValue); + + public bool IsBPMModeCompatible => BPMModes.Count == 0 || BPMModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.BPMModeValue); + + public bool IsWaveModeCompatible => WaveModes.Count == 0 || WaveModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.WaveModeValue); + + public bool IsSetNoteModeCompatible => SetNoteModes.Count == 0 || SetNoteModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.SetNoteModeValue); + + public bool IsLowestJudgmentConditionModeCompatible => LowestJudgmentConditionModes.Count == 0 || LowestJudgmentConditionModes.Any(wwwLevelModeComponent => wwwLevelModeComponent.Value == ViewModels.Instance.MainValue.ModeComponentValue.LowestJudgmentConditionModeValue); + + public ObservableCollection> AutoModes { get; } = new(); + + public ObservableCollection> NoteSaltModes { get; } = new(); + + public ObservableCollection> FaintNoteModes { get; } = new(); + + public ObservableCollection> JudgmentModes { get; } = new(); + + public ObservableCollection> HitPointsModes { get; } = new(); + + public ObservableCollection> NoteMobilityModes { get; } = new(); + + public ObservableCollection> LongNoteModes { get; } = new(); + + public ObservableCollection> InputFavorModes { get; } = new(); + + public ObservableCollection> NoteModifyModes { get; } = new(); + + public ObservableCollection> BPMModes { get; } = new(); + + public ObservableCollection> WaveModes { get; } = new(); + + public ObservableCollection> SetNoteModes { get; } = new(); + + public ObservableCollection> LowestJudgmentConditionModes { get; } = new(); + + public WwwLevelItem WwwLevelItemValue + { + get => _wwwLevelItem; + + set + { + if (SetProperty(ref _wwwLevelItem, value, nameof(WwwLevelItemValue)) && value != null) + { + GetWwwLevelItem(); + + async void GetWwwLevelItem() + { + IsLevelItemLoading = true; + + var levelID = value.LevelID; + + var twilightWwwLevel = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/level?levelID={levelID}&language={Configure.Instance.Language}"); + if (twilightWwwLevel.HasValue && WwwLevelItemValue?.LevelID == levelID) + { + var twilightWwwLevelValue = twilightWwwLevel.Value; + + Title = value.Title; + OnPropertyChanged(nameof(Title)); + + Comment = value.Comment; + OnPropertyChanged(nameof(Comment)); + + WwwLevelComputingCollection.Clear(); + foreach (var levelNote in twilightWwwLevelValue.levelNote) + { + var title = levelNote.title; + var artist = levelNote.artist; + var levelText = levelNote.levelText; + var genre = levelNote.genre; + var noteVariety = levelNote.noteVariety; + if (noteVariety == BaseNoteFile.NoteVariety.EventNote) + { + title = new string('❌', 1 + RandomNumberGenerator.GetInt32(10)); + artist = new string('❌', 1 + RandomNumberGenerator.GetInt32(10)); + levelText = new string('❌', 1 + RandomNumberGenerator.GetInt32(10)); + genre = new string('❌', 1 + RandomNumberGenerator.GetInt32(10)); + } + WwwLevelComputingCollection.Add(new WwwLevelComputing + { + WwwLevelNoteVariety = noteVariety, + NoteID = levelNote.noteID, + Title = title, + Artist = artist, + Genre = genre, + LevelValue = levelNote.level, + LevelText = levelText, + NotHaveIt = !ViewModels.Instance.MainValue.NoteID512s.ContainsKey(levelNote.noteID) + }); + } + + Array.Fill(StandContents, null); + if (twilightWwwLevelValue.stand != null) + { + if (twilightWwwLevelValue.stand[0] != -1) + { + StandContents[0] = string.Format(LanguageSystem.Instance.WwwLevelStandContents0, twilightWwwLevelValue.stand[0].ToString("#,##0")); + } + if (twilightWwwLevelValue.stand[1] != -1) + { + StandContents[1] = string.Format(LanguageSystem.Instance.WwwLevelStandContents1, twilightWwwLevelValue.stand[1].ToString("#,##0")); + } + } + OnPropertyChanged(nameof(StandContents)); + _wwwLevelDataValue.Stand = twilightWwwLevelValue.stand; + _wwwLevelDataValue.StandContents = string.Join(" ", StandContents).Trim(); + + Array.Fill(PointContents, null); + if (twilightWwwLevelValue.point != null) + { + if (twilightWwwLevelValue.point[0] != -1) + { + PointContents[0] = string.Format(LanguageSystem.Instance.WwwLevelPointContents0, 100.0 * twilightWwwLevelValue.point[0]); + } + if (twilightWwwLevelValue.point[1] != -1) + { + PointContents[1] = string.Format(LanguageSystem.Instance.WwwLevelPointContents1, 100.0 * twilightWwwLevelValue.point[1]); + } + } + OnPropertyChanged(nameof(PointContents)); + _wwwLevelDataValue.Point = twilightWwwLevelValue.point; + _wwwLevelDataValue.PointContents = string.Join(" ", PointContents).Trim(); + + Array.Fill(BandContents, null); + if (twilightWwwLevelValue.band != null) + { + if (twilightWwwLevelValue.band[0] != -1) + { + BandContents[0] = string.Format(LanguageSystem.Instance.WwwLevelBandContents0, twilightWwwLevelValue.band[0]); + } + if (twilightWwwLevelValue.band[1] != -1) + { + BandContents[1] = string.Format(LanguageSystem.Instance.WwwLevelBandContents1, twilightWwwLevelValue.band[1]); + } + } + OnPropertyChanged(nameof(BandContents)); + _wwwLevelDataValue.Band = twilightWwwLevelValue.band; + _wwwLevelDataValue.BandContents = string.Join(" ", BandContents).Trim(); + + Array.Fill(AudioMultiplierContents, null); + if (twilightWwwLevelValue.audioMultiplier != null) + { + if (twilightWwwLevelValue.audioMultiplier[0] != -1) + { + AudioMultiplierContents[0] = string.Format(LanguageSystem.Instance.WwwLevelAudioMultiplierContents0, twilightWwwLevelValue.audioMultiplier[0].ToString("0.00")); + _audioMultipliers[0] = twilightWwwLevelValue.audioMultiplier[0]; + } + else + { + _audioMultipliers[0] = double.NegativeInfinity; + } + if (twilightWwwLevelValue.audioMultiplier[1] != -1) + { + AudioMultiplierContents[1] = string.Format(LanguageSystem.Instance.WwwLevelAudioMultiplierContents1, twilightWwwLevelValue.audioMultiplier[1].ToString("0.00")); + _audioMultipliers[1] = twilightWwwLevelValue.audioMultiplier[1]; + } + else + { + _audioMultipliers[1] = double.PositiveInfinity; + } + } + OnPropertyChanged(nameof(AudioMultiplierContents)); + _wwwLevelDataValue.LowestAudioMultiplier = (twilightWwwLevelValue.audioMultiplier?[0] == -1.0 ? null : twilightWwwLevelValue.audioMultiplier?[0] as double?) ?? 0.5; + _wwwLevelDataValue.HighestAudioMultiplier = (twilightWwwLevelValue.audioMultiplier?[1] == -1.0 ? null : twilightWwwLevelValue.audioMultiplier?[1] as double?) ?? 2.0; + + Array.Fill(JudgmentContents, null); + if (twilightWwwLevelValue.judgments != null) + { + for (var i = twilightWwwLevelValue.judgments.Length - 1; i >= 0; --i) + { + if (twilightWwwLevelValue.judgments[i] != null) + { + JudgmentContents[i] = new string[twilightWwwLevelValue.judgments[i].Length]; + if (twilightWwwLevelValue.judgments[i][0] != -1) + { + JudgmentContents[i][0] = string.Format(LanguageSystem.Instance.WwwLevelJudgmentContents0, twilightWwwLevelValue.judgments[i][0]); + } + if (twilightWwwLevelValue.judgments[i][1] != -1) + { + JudgmentContents[i][1] = string.Format(LanguageSystem.Instance.WwwLevelJudgmentContents1, twilightWwwLevelValue.judgments[i][1]); + } + } + } + } + OnPropertyChanged(nameof(JudgmentContents)); + _wwwLevelDataValue.Judgments = twilightWwwLevelValue.judgments; + _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Highest] = JudgmentContents[(int)Component.Judged.Highest] != null ? $"Yell! {string.Join(" ", JudgmentContents[(int)Component.Judged.Highest]).Trim()}" : null; + _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Higher] = JudgmentContents[(int)Component.Judged.Higher] != null ? $"Yell {string.Join(" ", JudgmentContents[(int)Component.Judged.Higher]).Trim()}" : null; + _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.High] = JudgmentContents[(int)Component.Judged.High] != null ? $"Cool {string.Join(" ", JudgmentContents[(int)Component.Judged.High]).Trim()}" : null; + _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Low] = JudgmentContents[(int)Component.Judged.Low] != null ? $"Good {string.Join(" ", JudgmentContents[(int)Component.Judged.Low]).Trim()}" : null; + _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Lower] = JudgmentContents[(int)Component.Judged.Lower] != null ? $"Poor {string.Join(" ", JudgmentContents[(int)Component.Judged.Lower]).Trim()}" : null; + _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Lowest] = JudgmentContents[(int)Component.Judged.Lowest] != null ? $"Failed {string.Join(" ", JudgmentContents[(int)Component.Judged.Lowest]).Trim()}" : null; + + AllowPause = twilightWwwLevelValue.allowPause; + OnPropertyChanged(nameof(AllowPause)); + _wwwLevelDataValue.AllowPause = twilightWwwLevelValue.allowPause; + + var mainViewModel = ViewModels.Instance.MainValue; + var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; + var toModifyModeComponentViewModel = ViewModels.Instance.ModifyModeComponentValue; + + AutoModes.Clear(); + if (twilightWwwLevelValue.autoMode != null) + { + foreach (var autoMode in twilightWwwLevelValue.autoMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.AutoModeVariety].FindIndex(modeComponentValue => (ModeComponent.AutoMode)modeComponentValue.Value == value))) + { + AutoModes.Add(new WwwLevelModeComponent + { + Value = autoMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.AutoModeValue = autoMode; + siteContainerViewModel.CallSetModeComponent(); + OnPropertyChanged(nameof(IsAutoModeCompatible)); + }) + }); + } + } + + NoteSaltModes.Clear(); + if (twilightWwwLevelValue.noteSaltMode != null) + { + foreach (var noteSaltMode in twilightWwwLevelValue.noteSaltMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.NoteSaltModeVariety].FindIndex(modeComponentValue => (ModeComponent.NoteSaltMode)modeComponentValue.Value == value))) + { + NoteSaltModes.Add(new WwwLevelModeComponent + { + Value = noteSaltMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.NoteSaltModeValue = noteSaltMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsNoteSaltModeCompatible)); + }) + }); + } + } + + FaintNoteModes.Clear(); + if (twilightWwwLevelValue.faintNoteMode != null) + { + foreach (var faintNoteMode in twilightWwwLevelValue.faintNoteMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.FaintNoteModeVariety].FindIndex(modeComponentValue => (ModeComponent.FaintNoteMode)modeComponentValue.Value == value))) + { + FaintNoteModes.Add(new WwwLevelModeComponent + { + Value = faintNoteMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.FaintNoteModeValue = faintNoteMode; + siteContainerViewModel.CallSetModeComponent(); + OnPropertyChanged(nameof(IsFaintNoteModeCompatible)); + }) + }); + } + } + + JudgmentModes.Clear(); + if (twilightWwwLevelValue.judgmentMode != null) + { + foreach (var judgmentMode in twilightWwwLevelValue.judgmentMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.JudgmentModeVariety].FindIndex(modeComponentValue => (ModeComponent.JudgmentMode)modeComponentValue.Value == value))) + { + JudgmentModes.Add(new WwwLevelModeComponent + { + Value = judgmentMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.JudgmentModeValue = judgmentMode; + mainViewModel.OnJudgmentMeterMillisModified(); + siteContainerViewModel.CallSetModeComponent(); + OnPropertyChanged(nameof(IsJudgmentModeCompatible)); + }) + }); + } + } + + HitPointsModes.Clear(); + if (twilightWwwLevelValue.hitPointsMode != null) + { + foreach (var hitPointsMode in twilightWwwLevelValue.hitPointsMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.HitPointsModeVariety].FindIndex(modeComponentValue => (ModeComponent.HitPointsMode)modeComponentValue.Value == value))) + { + HitPointsModes.Add(new WwwLevelModeComponent + { + Value = hitPointsMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.HitPointsModeValue = hitPointsMode; + siteContainerViewModel.CallSetModeComponent(); + OnPropertyChanged(nameof(IsHitPointsModeCompatible)); + }) + }); + } + } + + NoteMobilityModes.Clear(); + if (twilightWwwLevelValue.noteMobilityMode != null) + { + foreach (var noteMobilityMode in twilightWwwLevelValue.noteMobilityMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.NoteMobilityModeVariety].FindIndex(modeComponentValue => (ModeComponent.NoteMobilityMode)modeComponentValue.Value == value))) + { + NoteMobilityModes.Add(new WwwLevelModeComponent + { + Value = noteMobilityMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.NoteMobilityModeValue = noteMobilityMode; + siteContainerViewModel.CallSetModeComponent(); + OnPropertyChanged(nameof(IsNoteMobilityModeCompatible)); + }) + }); + } + } + + LongNoteModes.Clear(); + if (twilightWwwLevelValue.longNoteMode != null) + { + foreach (var longNoteMode in twilightWwwLevelValue.longNoteMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.LongNoteModeVariety].FindIndex(modeComponentValue => (ModeComponent.LongNoteMode)modeComponentValue.Value == value))) + { + LongNoteModes.Add(new WwwLevelModeComponent + { + Value = longNoteMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.LongNoteModeValue = longNoteMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsLongNoteModeCompatible)); + }) + }); + } + } + + InputFavorModes.Clear(); + if (twilightWwwLevelValue.inputFavorMode != null) + { + foreach (var inputFavorMode in twilightWwwLevelValue.inputFavorMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.InputFavorModeVariety].FindIndex(modeComponentValue => (ModeComponent.InputFavorMode)modeComponentValue.Value == value))) + { + InputFavorModes.Add(new WwwLevelModeComponent + { + Value = inputFavorMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.InputFavorModeValue = inputFavorMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsInputFavorModeCompatible)); + }) + }); + } + } + + NoteModifyModes.Clear(); + if (twilightWwwLevelValue.noteModifyMode != null) + { + foreach (var noteModifyMode in twilightWwwLevelValue.noteModifyMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.NoteModifyModeVariety].FindIndex(modeComponentValue => (ModeComponent.NoteModifyMode)modeComponentValue.Value == value))) + { + NoteModifyModes.Add(new WwwLevelModeComponent + { + Value = noteModifyMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.NoteModifyModeValue = noteModifyMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsNoteModifyModeCompatible)); + }) + }); + } + } + + BPMModes.Clear(); + if (twilightWwwLevelValue.bpmMode != null) + { + foreach (var bpmMode in twilightWwwLevelValue.bpmMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.BPMModeVariety].FindIndex(modeComponentValue => (ModeComponent.BPMMode)modeComponentValue.Value == value))) + { + BPMModes.Add(new WwwLevelModeComponent + { + Value = bpmMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.BPMModeValue = bpmMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsBPMModeCompatible)); + }) + }); + } + } + + WaveModes.Clear(); + if (twilightWwwLevelValue.waveMode != null) + { + foreach (var waveMode in twilightWwwLevelValue.waveMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.WaveModeVariety].FindIndex(modeComponentValue => (ModeComponent.WaveMode)modeComponentValue.Value == value))) + { + WaveModes.Add(new WwwLevelModeComponent + { + Value = waveMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.WaveModeValue = waveMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsWaveModeCompatible)); + }) + }); + } + } + + SetNoteModes.Clear(); + if (twilightWwwLevelValue.setNoteMode != null) + { + foreach (var setNoteMode in twilightWwwLevelValue.setNoteMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.SetNoteModeVariety].FindIndex(modeComponentValue => (ModeComponent.SetNoteMode)modeComponentValue.Value == value))) + { + SetNoteModes.Add(new WwwLevelModeComponent + { + Value = setNoteMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.SetNoteModeValue = setNoteMode; + siteContainerViewModel.CallSetModeComponent(); + mainViewModel.HandleAutoComputer(); + OnPropertyChanged(nameof(IsSetNoteModeCompatible)); + }) + }); + } + } + + LowestJudgmentConditionModes.Clear(); + if (twilightWwwLevelValue.lowestJudgmentConditionMode != null) + { + foreach (var lowestJudgmentConditionMode in twilightWwwLevelValue.lowestJudgmentConditionMode.OrderBy(value => toModifyModeComponentViewModel.ModeComponentValues[ModifyModeComponentViewModel.LowestJudgmentConditionModeVariety].FindIndex(modeComponentValue => (ModeComponent.LowestJudgmentConditionMode)modeComponentValue.Value == value))) + { + LowestJudgmentConditionModes.Add(new WwwLevelModeComponent + { + Value = lowestJudgmentConditionMode, + OnInput = new RelayCommand(() => + { + mainViewModel.ModeComponentValue.LowestJudgmentConditionModeValue = lowestJudgmentConditionMode; + siteContainerViewModel.CallSetModeComponent(); + OnPropertyChanged(nameof(IsLowestJudgmentConditionModeCompatible)); + }) + }); + } + } + + Utility.SetUICollection(ClearedTitleItemCollection, twilightWwwLevelValue.titles.Select(title => new AvatarTitleItem + { + Title = title.title, + TitleID = title.titleID, + TitlePaint = Utility.GetTitlePaint(title.titleColor), + TitleColor = Utility.GetTitleColor(title.titleColor) + }).ToArray()); + OnPropertyChanged(nameof(HasClearedTitleItem)); + + Utility.SetUICollection(ClearedEdgeItemCollection, twilightWwwLevelValue.edgeIDs.Select(data => new AvatarEdgeItem + { + EdgeID = data, + }).ToArray()); + OnPropertyChanged(nameof(HasClearedEdgeItem)); + + NotifyIsCompatible(); + } + + IsLevelItemLoading = false; + } + } + } + } + + public void NotifyIsCompatible() + { + OnPropertyChanged(nameof(IsAutoModeCompatible)); + OnPropertyChanged(nameof(IsNoteSaltModeCompatible)); + OnPropertyChanged(nameof(IsFaintNoteModeCompatible)); + OnPropertyChanged(nameof(IsJudgmentModeCompatible)); + OnPropertyChanged(nameof(IsHitPointsModeCompatible)); + OnPropertyChanged(nameof(IsNoteMobilityModeCompatible)); + OnPropertyChanged(nameof(IsLongNoteModeCompatible)); + OnPropertyChanged(nameof(IsInputFavorModeCompatible)); + OnPropertyChanged(nameof(IsNoteModifyModeCompatible)); + OnPropertyChanged(nameof(IsBPMModeCompatible)); + OnPropertyChanged(nameof(IsWaveModeCompatible)); + OnPropertyChanged(nameof(IsSetNoteModeCompatible)); + OnPropertyChanged(nameof(IsLowestJudgmentConditionModeCompatible)); + OnPropertyChanged(nameof(HasEventNote)); + } + + public override string ToString() => LevelName; + + public override bool Equals(object obj) => obj is WwwLevelGroup wwwLevelGroup && LevelName == wwwLevelGroup.LevelName; + + public override int GetHashCode() => LevelName.GetHashCode(); + } +} diff --git a/Qwilight/Qwilight/UIComponent/WwwLevelItem.cs b/Qwilight/Qwilight/UIComponent/WwwLevelItem.cs new file mode 100644 index 0000000..0d685e7 --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/WwwLevelItem.cs @@ -0,0 +1,40 @@ +using Qwilight.NoteFile; +using System.Windows.Media; + +namespace Qwilight.UIComponent +{ + public sealed class WwwLevelItem + { + public Brush PointedPaint => BaseUI.Instance.LevelPaints[(int)LevelValue]; + + public string LevelID { get; init; } + + public string NoteID { get; init; } + + public string Title { get; init; } + + public string Comment { get; init; } + + public string LevelText { get; init; } + + public BaseNoteFile.Level LevelValue { get; init; } + + public bool Handled { get; init; } + + public double Avatars { get; init; } + + public string AvatarCountContents => Avatars.ToString(LanguageSystem.Instance.AvatarCountContents); + + public override bool Equals(object obj) => obj is WwwLevelItem wwwLevelItem && + LevelID == wwwLevelItem.LevelID && + NoteID == wwwLevelItem.NoteID && + Title == wwwLevelItem.Title && + Comment == wwwLevelItem.Comment && + LevelText == wwwLevelItem.LevelText && + LevelValue == wwwLevelItem.LevelValue && + Handled == wwwLevelItem.Handled && + Avatars == wwwLevelItem.Avatars; + + public override int GetHashCode() => HashCode.Combine(LevelID, NoteID, Title, Comment, LevelText, LevelValue, Handled, Avatars); + } +} diff --git a/Qwilight/Qwilight/UIComponent/WwwLevelModeComponent.cs b/Qwilight/Qwilight/UIComponent/WwwLevelModeComponent.cs new file mode 100644 index 0000000..e53d89f --- /dev/null +++ b/Qwilight/Qwilight/UIComponent/WwwLevelModeComponent.cs @@ -0,0 +1,21 @@ +using CommunityToolkit.Mvvm.Input; + +namespace Qwilight.UIComponent +{ + public struct WwwLevelModeComponent : IEquatable> + { + public T Value { get; init; } + + public RelayCommand OnInput { get; init; } + + public override bool Equals(object obj) => obj is WwwLevelModeComponent wwwLevelModeComponent && Equals(wwwLevelModeComponent); + + public bool Equals(WwwLevelModeComponent other) => Value.Equals(other.Value); + + public override int GetHashCode() => Value.GetHashCode(); + + public static bool operator ==(WwwLevelModeComponent left, WwwLevelModeComponent right) => left.Equals(right); + + public static bool operator !=(WwwLevelModeComponent left, WwwLevelModeComponent right) => !(left == right); + } +} diff --git a/Qwilight/Qwilight/Utilities/AwaitUtility.cs b/Qwilight/Qwilight/Utilities/AwaitUtility.cs new file mode 100644 index 0000000..d4c542d --- /dev/null +++ b/Qwilight/Qwilight/Utilities/AwaitUtility.cs @@ -0,0 +1,14 @@ +using Windows.Foundation; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static T Await(IAsyncOperation awaitable) + { + using var t = awaitable.AsTask(); + t.Wait(); + return t.Result; + } + } +} diff --git a/Qwilight/Qwilight/Utilities/ColorUtility.cs b/Qwilight/Qwilight/Utilities/ColorUtility.cs new file mode 100644 index 0000000..069ec2b --- /dev/null +++ b/Qwilight/Qwilight/Utilities/ColorUtility.cs @@ -0,0 +1,81 @@ +using Microsoft.UI; +using System.Reflection; +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static Color GetColor(this string text) + { + text = text.Replace("\"", string.Empty); + if (text[0] == '#') + { + var value = Convert.ToUInt32(text.Substring(1), 16); + switch (text.Length) + { + case 9: + return Color.FromArgb((byte)(value >> 24), (byte)(value >> 16 & 255U), (byte)(value >> 8 & 255U), (byte)(value & 255U)); + case 7: + return Color.FromArgb(byte.MaxValue, (byte)(value >> 16 & 255U), (byte)(value >> 8 & 255U), (byte)(value & 255U)); + case 5: + var value0 = (byte)(value >> 12); + value0 = (byte)(value0 << 4 | value0); + var value1 = (byte)(value >> 8 & 15U); + value1 = (byte)(value1 << 4 | value1); + var value2 = (byte)(value >> 4 & 15U); + value2 = (byte)(value2 << 4 | value2); + var value3 = (byte)(value & 15U); + value3 = (byte)(value3 << 4 | value3); + return Color.FromArgb(value0, value1, value2, value3); + case 4: + value0 = (byte)(value >> 8 & 15U); + value0 = (byte)(value0 << 4 | value0); + value1 = (byte)(value >> 4 & 15U); + value1 = (byte)(value1 << 4 | value1); + value2 = (byte)(value & 15U); + value2 = (byte)(value2 << 4 | value2); + return Color.FromArgb(byte.MaxValue, value0, value1, value2); + default: + return default; + } + } + else + { + var value = typeof(Colors).GetTypeInfo().DeclaredProperties.SingleOrDefault(property => property.Name.EqualsCaseless(text))?.GetValue(null); + return value != null ? (Color)value : default; + } + } + + public static uint GetColor(uint value0, uint value1, uint value2, uint value3) => 16777216U * value3 + 65536U * value2 + 256U * value1 + value0; + + public static Brush GetTitlePaint(string titleColor) => titleColor switch + { + "level0" => BaseUI.Instance.LevelPaints[0], + "level1" => BaseUI.Instance.LevelPaints[1], + "level2" => BaseUI.Instance.LevelPaints[2], + "level3" => BaseUI.Instance.LevelPaints[3], + "level4" => BaseUI.Instance.LevelPaints[4], + "level5" => BaseUI.Instance.LevelPaints[5], + "titleLV2000" => DrawingSystem.Instance.GetDefaultPaint(titleColor), + _ => DrawingSystem.Instance.GetDefaultPaint(titleColor.GetColor()) + }; + + public static Color GetTitleColor(string titleColor) => titleColor switch + { + "level0" => BaseUI.Instance.D2DLevelColors[0], + "level1" => BaseUI.Instance.D2DLevelColors[1], + "level2" => BaseUI.Instance.D2DLevelColors[2], + "level3" => BaseUI.Instance.D2DLevelColors[3], + "level4" => BaseUI.Instance.D2DLevelColors[4], + "level5" => BaseUI.Instance.D2DLevelColors[5], + "titleLV2000" => "#FFDA70D6".GetColor(), + _ => titleColor.GetColor() + }; + + public static Color ModifyColor(System.Windows.Media.Color wasColor) => Color.FromArgb(wasColor.A, wasColor.R, wasColor.G, wasColor.B); + + public static System.Windows.Media.Color ModifyColor(Color wasColor) => System.Windows.Media.Color.FromArgb(wasColor.A, wasColor.R, wasColor.G, wasColor.B); + } +} diff --git a/Qwilight/Qwilight/Utilities/DateUtility.cs b/Qwilight/Qwilight/Utilities/DateUtility.cs new file mode 100644 index 0000000..03a622c --- /dev/null +++ b/Qwilight/Qwilight/Utilities/DateUtility.cs @@ -0,0 +1,27 @@ +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static bool IsLowerDate(Version date, int targetMajor, int targetMinor, int targetBuild) + { + if (date != null) + { + var dateMajor = date.Major; + if (dateMajor != targetMajor) + { + return dateMajor < targetMajor; + } + var dateMinor = date.Minor; + if (dateMinor != targetMinor) + { + return dateMinor < targetMinor; + } + return date.Build < targetBuild; + } + else + { + return true; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Utilities/IDUtility.cs b/Qwilight/Qwilight/Utilities/IDUtility.cs new file mode 100644 index 0000000..a0e4cbd --- /dev/null +++ b/Qwilight/Qwilight/Utilities/IDUtility.cs @@ -0,0 +1,39 @@ +using System.IO; +using System.Security.Cryptography; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static byte[] GetID512(byte[] data) + { + using var shaComputer = SHA512.Create(); + return shaComputer.ComputeHash(data); + } + + public static string GetID512s(byte[] data) => ModifyID(GetID512(data)); + + public static byte[] GetID256(byte[] data) + { + using var shaComputer = SHA256.Create(); + return shaComputer.ComputeHash(data); + } + + public static string GetID256s(byte[] data) => ModifyID(GetID256(data)); + + public static string GetID128s(Stream s) + { + s.Position = 0; + using var hashComputer = MD5.Create(); + return ModifyID(hashComputer.ComputeHash(s)); + } + + public static string GetID128s(byte[] data) + { + using var hashComputer = MD5.Create(); + return ModifyID(hashComputer.ComputeHash(data)); + } + + public static string ModifyID(byte[] hash) => BitConverter.ToString(hash).Replace("-", string.Empty).ToLowerInvariant(); + } +} diff --git a/Qwilight/Qwilight/Utilities/IOUtility.cs b/Qwilight/Qwilight/Utilities/IOUtility.cs new file mode 100644 index 0000000..56aa4d4 --- /dev/null +++ b/Qwilight/Qwilight/Utilities/IOUtility.cs @@ -0,0 +1,158 @@ +using System.Diagnostics; +using System.IO; +using System.Text; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static bool WaitUntilCanOpen(string filePath, double waitMax = double.PositiveInfinity) + { + var loopingHandler = Stopwatch.StartNew(); + while (loopingHandler.GetMillis() < waitMax) + { + try + { + using var fs = File.OpenRead(filePath); + return true; + } + catch + { + Thread.Sleep(1); + } + } + return false; + } + + public static void MoveFile(string src, string target) + { + try + { + if (File.Exists(src)) + { + WipeFile(target); + WipeEntry(target); + Directory.CreateDirectory(Path.GetDirectoryName(target)); + File.Move(src, target); + } + } + catch + { + } + } + + public static void CopyFile(string src, string target) + { + try + { + if (File.Exists(src)) + { + if (File.Exists(target)) + { + using (var fs0 = File.OpenRead(src)) + using (var fs1 = File.OpenRead(target)) + { + if (Utility.GetID128s(fs0) == Utility.GetID128s(fs1)) + { + return; + } + } + + WipeFile(target); + WipeEntry(target); + } + Directory.CreateDirectory(Path.GetDirectoryName(target)); + File.Copy(src, target, true); + } + } + catch + { + } + } + + public static void SaveText(string filePath, string text, Encoding format = null) + { + try + { + Directory.CreateDirectory(Path.GetDirectoryName(filePath)); + File.WriteAllText(filePath, text, format ?? Encoding.UTF8); + } + catch + { + } + } + + public static (string, string) SetFault(string faultEntryPath, Exception e) + { + var faultFilePath = Path.Combine(faultEntryPath, Path.GetInvalidFileNameChars().Aggregate($"{DateTime.Now:F}.log", (faultFileName, target) => faultFileName.Replace(target, ' '))); + var faultText = Utility.GetFault(e); + Console.WriteLine(faultText); + SaveText(faultFilePath, faultText); + return (faultFilePath, faultText); + } + + public static void WipeFile(string filePath) + { + try + { + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + } + catch + { + } + } + + public static void WipeEntry(string entryPath) + { + try + { + if (Directory.Exists(entryPath)) + { + Directory.Delete(entryPath, true); + } + } + catch + { + } + } + + public static void CopyEntry(string src, string target) + { + foreach (var filePath in GetFiles(src)) + { + CopyFile(filePath, Path.Combine(target, Path.GetFileName(filePath))); + } + foreach (var entryPath in GetEntry(src)) + { + CopyEntry(entryPath, Path.Combine(target, Path.GetFileName(entryPath))); + } + } + + public static string[] GetFiles(string entryPath, string o = "") + { + try + { + return Directory.Exists(entryPath) ? Directory.GetFiles(entryPath, o) : Array.Empty(); + } + catch + { + return Array.Empty(); + } + } + + public static string[] GetEntry(string entryPath, string o = "") + { + try + { + return Directory.Exists(entryPath) ? Directory.GetDirectories(entryPath, o) : Array.Empty(); + } + catch + { + return Array.Empty(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Utilities/JSONUtility.cs b/Qwilight/Qwilight/Utilities/JSONUtility.cs new file mode 100644 index 0000000..c8b0979 --- /dev/null +++ b/Qwilight/Qwilight/Utilities/JSONUtility.cs @@ -0,0 +1,59 @@ +using Qwilight.XOR; +using System.IO; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public sealed class XORInt32Modifier : JsonConverter + { + public override XORInt32 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => (XORInt32)Utility.ToInt32(reader.GetString()); + + public override void Write(Utf8JsonWriter writer, XORInt32 value, JsonSerializerOptions options) => writer.WriteNumberValue(value); + } + + public sealed class XORFloat64Modifier : JsonConverter + { + public override XORFloat64 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => (XORFloat64)Utility.ToFloat64(reader.GetString()); + + public override void Write(Utf8JsonWriter writer, XORFloat64 value, JsonSerializerOptions options) => writer.WriteNumberValue(value); + } + + static readonly JsonSerializerOptions _defaultGetJSONConfigure = new JsonSerializerOptions + { + IncludeFields = true + }; + static readonly JsonSerializerOptions _defaultSetJSONConfigure = new JsonSerializerOptions + { + Converters = + { + new XORInt32Modifier(), + new XORFloat64Modifier() + }, + IncludeFields = true, + WriteIndented = QwilightComponent.IsVS + }; + + public static T GetJSON(string text, JsonSerializerOptions defaultJSONConfigure = null) + { + return JsonSerializer.Deserialize(text, defaultJSONConfigure ?? _defaultGetJSONConfigure); + } + + public static T GetJSON(byte[] data) + { + return JsonSerializer.Deserialize(data, _defaultGetJSONConfigure); + } + + public static T GetJSON(Stream s) + { + return JsonSerializer.Deserialize(s, _defaultGetJSONConfigure); + } + + public static string SetJSON(T data, JsonSerializerOptions defaultJSONConfigure = null) + { + return JsonSerializer.Serialize(data, defaultJSONConfigure ?? _defaultSetJSONConfigure); + } + } +} diff --git a/Qwilight/Qwilight/Utilities/LanguageUtility.cs b/Qwilight/Qwilight/Utilities/LanguageUtility.cs new file mode 100644 index 0000000..26ba284 --- /dev/null +++ b/Qwilight/Qwilight/Utilities/LanguageUtility.cs @@ -0,0 +1,23 @@ +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static string GetLanguage(int language) + { + return language switch + { + 1042 => "ko-KR", + _ => "en-US", + }; + } + + public static int GetLCID(string language) + { + return language switch + { + "ko-KR" => 1042, + _ => 1033, + }; + } + } +} diff --git a/Qwilight/Qwilight/Utilities/PaintUtility.cs b/Qwilight/Qwilight/Utilities/PaintUtility.cs new file mode 100644 index 0000000..6a9039e --- /dev/null +++ b/Qwilight/Qwilight/Utilities/PaintUtility.cs @@ -0,0 +1,112 @@ +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI; +using Windows.Foundation; +using Windows.UI; +using DrawingContext = System.Windows.Media.DrawingContext; +using FormattedText = System.Windows.Media.FormattedText; +using ImageSource = System.Windows.Media.ImageSource; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static void PaintDrawing(this CanvasDrawingSession targetSession, ref Bound r, ref Bound s, DrawingItem? drawingItem, float faint = 1F, CanvasComposite drawingComposition = CanvasComposite.SourceOver) + { + if (drawingItem.HasValue && r.CanPaint && faint > 0F) + { + var drawingItemValue = drawingItem.Value; + targetSession.DrawImage(drawingItemValue.Drawing, (Rect)r, (Rect)s, faint, CanvasImageInterpolation.Linear, drawingComposition); + } + } + + public static void PaintDrawing(this CanvasDrawingSession targetSession, ref Bound r, DrawingItem? drawingItem, float faint = 1F, CanvasComposite drawingComposition = CanvasComposite.SourceOver) + { + if (drawingItem.HasValue && r.CanPaint && faint > 0F) + { + var drawingItemValue = drawingItem.Value; + targetSession.DrawImage(drawingItemValue.Drawing, (Rect)r, drawingItemValue.DrawingBound, faint, CanvasImageInterpolation.Linear, drawingComposition); + } + } + + public static void PaintDrawing(this CanvasDrawingSession targetSession, ref Bound r, CanvasBitmap drawing, float faint = 1F) + { + if (drawing != null && r.CanPaint && faint > 0F) + { + targetSession.DrawImage(drawing, (Rect)r, drawing.Bounds, faint); + } + } + + public static void PaintText(this CanvasDrawingSession targetSession, CanvasTextLayout textItem, ref Bound r, Color textColor) + { + if (textItem != null) + { + targetSession.DrawTextLayout(textItem, r, textColor); + } + } + + public static void PaintVisibleText(this CanvasDrawingSession targetSession, CanvasTextLayout textItem, ref Bound r, Color textColor) + { + if (textItem != null) + { + r.Position0 += 1.0; + r.Position1 += 1.0; + targetSession.PaintText(textItem, ref r, Colors.Black); + r.Position0 -= 1.0; + r.Position1 -= 1.0; + targetSession.PaintText(textItem, ref r, textColor); + } + } + + public static void PaintText(this CanvasDrawingSession targetSession, CanvasTextLayout textItem, ref Bound r, ICanvasBrush textPaint) + { + if (textItem != null) + { + targetSession.DrawTextLayout(textItem, r, textPaint); + } + } + + public static void PaintVisibleText(this CanvasDrawingSession targetSession, CanvasTextLayout textItem, ref Bound r, ICanvasBrush textPaint, ICanvasBrush textVisiblePaint) + { + if (textItem != null) + { + r.Position0 += 1.0; + r.Position1 += 1.0; + targetSession.PaintText(textItem, ref r, textVisiblePaint); + r.Position0 -= 1.0; + r.Position1 -= 1.0; + targetSession.PaintText(textItem, ref r, textPaint); + } + } + + public static void PaintText(this DrawingContext targetSession, FormattedText textItem, ref Bound r) + { + if (textItem != null) + { + targetSession.DrawText(textItem, r); + } + } + + public static void PaintVisibleText(this DrawingContext targetSession, FormattedText textItem, FormattedText textVisibleItem, ref Bound r) + { + if (textItem != null) + { + r.Position0 += 1.0; + r.Position1 += 1.0; + targetSession.PaintText(textVisibleItem, ref r); + r.Position0 -= 1.0; + r.Position1 -= 1.0; + targetSession.PaintText(textItem, ref r); + } + } + + public static void PaintDrawing(this DrawingContext targetSession, ref Bound r, ImageSource drawing) + { + if (drawing != null && r.CanPaint) + { + targetSession.DrawImage(drawing, r); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Utilities/ParallelUtility.cs b/Qwilight/Qwilight/Utilities/ParallelUtility.cs new file mode 100644 index 0000000..fe5e468 --- /dev/null +++ b/Qwilight/Qwilight/Utilities/ParallelUtility.cs @@ -0,0 +1,46 @@ +using System.Collections.Concurrent; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static Thread GetLongParallel(ThreadStart onHandle, bool isEssential = true) => new Thread(onHandle) + { + IsBackground = true, + Priority = isEssential ? ThreadPriority.Highest : ThreadPriority.Normal + }; + + public static Thread HandleLongParallel(ThreadStart onHandle, bool isEssential = true) + { + var t = GetLongParallel(onHandle, isEssential); + t.Start(); + return t; + } + + public static void HandleHMP(IProducerConsumerCollection parallelItems, int onHandleBin, Action onHandle, CancellationToken? setCancelParallel = null) + { + var longParallels = new Thread[onHandleBin]; + for (var i = longParallels.Length - 1; i >= 0; --i) + { + var longParallel = new Thread(() => + { + while (setCancelParallel?.IsCancellationRequested != true && parallelItems.TryTake(out var parallelItem)) + { + onHandle(parallelItem); + } + }) + { + IsBackground = true, + Priority = ThreadPriority.Lowest + }; + longParallel.Start(); + longParallels[i] = longParallel; + } + foreach (var longParallel in longParallels) + { + longParallel.Join(); + } + setCancelParallel?.ThrowIfCancellationRequested(); + } + } +} diff --git a/Qwilight/Qwilight/Utilities/TestMillis.cs b/Qwilight/Qwilight/Utilities/TestMillis.cs new file mode 100644 index 0000000..b72c01d --- /dev/null +++ b/Qwilight/Qwilight/Utilities/TestMillis.cs @@ -0,0 +1,33 @@ +using System.Diagnostics; + +namespace Qwilight.Utilities +{ + public struct TestMillis : IDisposable + { + readonly Stopwatch _loopingHandler = Stopwatch.StartNew(); + readonly double _targetMillis; + readonly object _title; + + public TestMillis(double targetMillis = 0.0, object title = null) + { + _targetMillis = targetMillis; + _title = title; + } + + public void Dispose() + { + var millis = _loopingHandler.GetMillis(); + if (millis >= _targetMillis) + { + if (_title != null) + { + Console.WriteLine("{0} {1}", _title, millis); + } + else + { + Console.WriteLine(millis); + } + } + } + } +} diff --git a/Qwilight/Qwilight/Utilities/TextUtility.cs b/Qwilight/Qwilight/Utilities/TextUtility.cs new file mode 100644 index 0000000..4ddb89f --- /dev/null +++ b/Qwilight/Qwilight/Utilities/TextUtility.cs @@ -0,0 +1,13 @@ +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static bool EqualsCaseless(this string text, string value) => text.Equals(value, StringComparison.InvariantCultureIgnoreCase); + + public static bool IsFrontCaselsss(this string text, string value) => text.StartsWith(value, StringComparison.InvariantCultureIgnoreCase); + + public static bool IsTailCaselsss(this string text, string value) => text.EndsWith(value, StringComparison.InvariantCultureIgnoreCase); + + public static bool ContainsCaselsss(this string text, string value) => text.Contains(value, StringComparison.InvariantCultureIgnoreCase); + } +} diff --git a/Qwilight/Qwilight/Utilities/ToUtility.cs b/Qwilight/Qwilight/Utilities/ToUtility.cs new file mode 100644 index 0000000..68f39ba --- /dev/null +++ b/Qwilight/Qwilight/Utilities/ToUtility.cs @@ -0,0 +1,21 @@ +using System.Globalization; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static double ToFloat64(string text) => Convert.ToDouble(text, CultureInfo.InvariantCulture); + + public static bool ToFloat64(string text, out double value) => double.TryParse(text, NumberStyles.Number, CultureInfo.InvariantCulture, out value); + + public static float ToFloat32(string text) => Convert.ToSingle(text, CultureInfo.InvariantCulture); + + public static int ToInt32(object o) => Convert.ToInt32(o, CultureInfo.InvariantCulture); + + public static long ToInt64(object o) => Convert.ToInt64(o, CultureInfo.InvariantCulture); + + public static bool ToInt32(string text, out int value) => int.TryParse(text, NumberStyles.Number, CultureInfo.InvariantCulture, out value); + + public static bool ToBool(string text) => Convert.ToBoolean(text, CultureInfo.InvariantCulture); + } +} diff --git a/Qwilight/Qwilight/Utilities/Utility.cs b/Qwilight/Qwilight/Utilities/Utility.cs new file mode 100644 index 0000000..4a42df8 --- /dev/null +++ b/Qwilight/Qwilight/Utilities/Utility.cs @@ -0,0 +1,788 @@ +using Microsoft.Graphics.Canvas; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using SharpGen.Runtime; +using System.Collections.Specialized; +using System.Diagnostics; +using System.IO; +using System.Numerics; +using System.Runtime.InteropServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using Windows.System; +using Windows.Win32; +using Windows.Win32.Graphics.Gdi; +using YamlDotNet.RepresentationModel; +using DrawingContext = System.Windows.Media.DrawingContext; +using IDirectInputDevice8 = Vortice.DirectInput.IDirectInputDevice8; +using IStateUpdate = Vortice.DirectInput.IStateUpdate; +using Point = System.Windows.Point; + +namespace Qwilight.Utilities +{ + public static partial class Utility + { + [GeneratedRegex("(http|https|mailto):\\/\\/[^ ]+", RegexOptions.IgnoreCase)] + private static partial Regex GetSiteYellsComputer(); + + [Flags] + public enum AvailableFlag + { + Not = 0, + Audio = 1, + Drawing = 2, + Media = 4 + } + + static readonly char[] _delimiters = { '[', '(' }; + + public static string GetTitle(string title) + { + var titlePosition = title.LastIndexOfAny(_delimiters); + return (titlePosition >= 0 ? title.Substring(0, titlePosition) : title).Trim(); + } + + public static void HandleUIAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0) => Task.Run(() => + { + if (!BaseUI.Instance.HandleAudio(audioFileName, defaultFileName, pausableAudioHandler, fadeInLength)) + { + UI.Instance.HandleAudio(audioFileName, defaultFileName, pausableAudioHandler, fadeInLength); + } + }); + + public static bool IsPoint(double[] point, double position0, double position1) => IsPoint(point[0], point[1], point[2], point[3], position0, position1); + + public static bool IsPoint(double pointPosition0, double pointPosition1, double pointLength, double pointHeight, double position0, double position1) + { + return pointPosition0 <= position0 && + position0 < pointPosition0 + pointLength && + pointPosition1 <= position1 && + position1 < pointPosition1 + pointHeight; + } + + public static string FormatUnit(long value) + { + if (value < 1000) + { + return $"{(value):#,##0.##} B"; + } + else if (value < 1000 * 1000) + { + return $"{(value / 1000.0):#,##0.##} KB"; + } + else if (value < 1000 * 1000 * 1000) + { + return $"{(value / 1000.0 / 1000.0):#,##0.##} MB"; + } + else + { + return $"{(value / 1000.0 / 1000.0 / 1000.0):#,##0.##} GB"; + } + } + + public static string GetHandledText(MediaElement view) + { + if (view.NaturalDuration.HasTimeSpan) + { + return $"{view.Position.Minutes}:{view.Position.Seconds.ToString("00")}/{view.NaturalDuration.TimeSpan.Minutes}:{view.NaturalDuration.TimeSpan.Seconds.ToString("00")}"; + } + else + { + return string.Empty; + } + } + + public static void ViewItems(FrameworkElement element) + { + var elements = (element as FrameworkElement).ContextMenu; + elements.DataContext = (element as FrameworkElement).DataContext; + elements.Placement = PlacementMode.Mouse; + elements.IsOpen = true; + } + + public static void SetPosition(MediaElement view, double value) + { + if (value < 100.0) + { + if (view.NaturalDuration.HasTimeSpan) + { + var targetPosition = view.NaturalDuration.TimeSpan * value / 100.0; + if (Math.Abs((view.Position - targetPosition).TotalSeconds) >= 1.0) + { + view.Position = view.NaturalDuration.TimeSpan * value / 100.0; + } + } + } + else + { + view.Stop(); + } + } + + public static bool AllowInput(InputBundle inputBundles, T e, Component.InputMode? inputMode = null) where T : new() + { + if (inputMode.HasValue) + { + var inputModeValue = (int)inputMode.Value; + var inputs = inputBundles.Inputs; + for (var i = inputs[(int)inputModeValue].Length - 1; i > 0; --i) + { + for (var j = inputs[(int)inputModeValue][i].Length - 1; j >= 0; --j) + { + if (inputs[(int)inputModeValue][i][j].Equals(e)) + { + inputs[(int)inputModeValue][i][j] = new(); + break; + } + } + } + } + return true; + } + + public static float GetMove(float target, float src, double framerate = 60.0) + { + var distance = target - src; + if (distance != 0.0) + { + if (distance > 0.0) + { + if (distance > 0.01) + { + return (float)(distance / framerate); + } + else + { + return distance; + } + } + else + { + if (distance < -0.01) + { + return (float)(distance / framerate); + } + else + { + return distance; + } + } + } + return 0F; + } + + public static double GetMove(double target, double src, double framerate = 60.0) + { + var distance = target - src; + if (distance != 0.0) + { + if (distance > 0.0) + { + if (distance > 0.01) + { + return distance / framerate; + } + else + { + return distance; + } + } + else + { + if (distance < -0.01) + { + return distance / framerate; + } + else + { + return distance; + } + } + } + return 0.0; + } + + public static int GetMove(int target, int src, double framerate = 60.0) + { + var distance = target - src; + if (distance != 0) + { + if (distance > 0) + { + return Math.Max(1, (int)(distance / framerate)); + } + else + { + return Math.Min(-1, (int)(distance / framerate)); + } + } + return 0; + } + + public static void SetUICollection(ICollection target, ICollection src, Action onWipe = null, Action onSet = null, Action onModify = null, IEqualityComparer onEqual = null) + { + onEqual ??= EqualityComparer.Default; + if (target is INotifyCollectionChanged) + { + HandlingUISystem.Instance.HandleParallel(Hande); + } + else + { + Hande(); + } + void Hande() + { + var toWipeValues = target.Except(src, onEqual).ToArray(); + var toSetValues = src.Except(target, onEqual).ToArray(); + var toModifyValues = onModify != null ? src.Intersect(target, onEqual).ToArray() : Array.Empty(); + foreach (var value in toWipeValues) + { + onWipe?.Invoke(value); + target.Remove(value); + } + foreach (var value in toSetValues) + { + onSet?.Invoke(value); + target.Add(value); + } + foreach (var value in toModifyValues) + { + onModify.Invoke(target.Single(targetValue => onEqual.Equals(value, targetValue)), value); + } + } + } + + public static double GetMillis(this Stopwatch handler) => 1000.0 * handler.ElapsedTicks / Stopwatch.Frequency; + + public static void Set(this ref Vector2 v, float position0, float position1) + { + v.X = position0; + v.Y = position1; + } + + public static void Set(this ref Point p, double position0, double position1) + { + p.X = position0; + p.Y = position1; + } + + public static void OpenAs(string fileName, string parameter = null) + { + if (!string.IsNullOrEmpty(fileName)) + { + try + { + using (Process.Start(new ProcessStartInfo(fileName, parameter) + { + UseShellExecute = true + })) + { + } + } + catch + { + } + } + } + + public static T GetFavoriteItem(IEnumerable data) + { + var dataSet = new Dictionary(); + foreach (var dataItem in data) + { + if (dataSet.ContainsKey(dataItem)) + { + dataSet[dataItem]++; + } + else + { + dataSet.Add(dataItem, 1); + } + } + var favoriteItem = default(T); + var favoriteValue = 0; + foreach (var dataItemValueID in dataSet.Keys) + { + var dataItemValue = dataSet[dataItemValueID]; + if (dataItemValue > favoriteValue) + { + favoriteItem = dataItemValueID; + favoriteValue = dataItemValue; + } + } + return favoriteItem; + } + + public static double SetCommentWait(int commentWaitDate, double audioMultiplier, double wait) + { + if (commentWaitDate < Component.CommentWaitDate1311) + { + wait -= 3000.0; + } + if (commentWaitDate < Component.CommentWaitDate164) + { + wait *= audioMultiplier; + } + return wait; + } + + public static DefaultCompute.QuitStatus GetQuitStatusValue(double point, int stand, double hitPoints, int noteFileCount) + { + if (hitPoints == 0.0) + { + return DefaultCompute.QuitStatus.F; + } + if (point < 0.8) + { + return DefaultCompute.QuitStatus.D; + } + if (point < 0.85) + { + return DefaultCompute.QuitStatus.C; + } + if (point < 0.9) + { + return DefaultCompute.QuitStatus.B; + } + if (point < 0.95) + { + return DefaultCompute.QuitStatus.A; + } + return stand < noteFileCount * 900000 ? DefaultCompute.QuitStatus.APlus : point < 1.0 ? DefaultCompute.QuitStatus.S : DefaultCompute.QuitStatus.SPlus; + } + + public static AvailableFlag GetAvailable(string filePath) + { + foreach (var audioFileFormat in QwilightComponent.AudioFileFormatItems) + { + if (filePath.IsTailCaselsss(audioFileFormat)) + { + return AvailableFlag.Audio; + } + } + foreach (var mediaFileFormat in QwilightComponent.MediaFileFormats) + { + if (filePath.IsTailCaselsss(mediaFileFormat)) + { + return AvailableFlag.Media; + } + } + foreach (var drawingFileFormat in QwilightComponent.DrawingFileFormats) + { + if (filePath.IsTailCaselsss(drawingFileFormat)) + { + return AvailableFlag.Drawing; + } + } + return AvailableFlag.Not; + } + + public static string GetAvailable(string filePath, AvailableFlag availableFlags) + { + if (File.Exists(filePath)) + { + return filePath; + } + return Utility.GetFiles(Path.GetDirectoryName(filePath), $"{Path.GetFileNameWithoutExtension(filePath)}.*").Order().FirstOrDefault(targetFilePath => + { + if (File.Exists(targetFilePath)) + { + if ((availableFlags & AvailableFlag.Audio) == AvailableFlag.Audio && GetAvailable(targetFilePath) == AvailableFlag.Audio) + { + return true; + } + if ((availableFlags & AvailableFlag.Drawing) == AvailableFlag.Drawing && GetAvailable(targetFilePath) == AvailableFlag.Drawing) + { + return true; + } + if ((availableFlags & AvailableFlag.Media) == AvailableFlag.Media && GetAvailable(targetFilePath) == AvailableFlag.Media) + { + return true; + } + } + return false; + }); + } + + public static string CompileSiteYells(string siteYells) + { + var m = GetSiteYellsComputer().Matches(siteYells); + return m.Count < 2 ? m.SingleOrDefault()?.Value ?? string.Empty : string.Empty; + } + + public static string GetFault(Exception e) + { + var builder = new StringBuilder(); + var fault = e; + builder.AppendLine(fault.ToString()); + while ((fault = fault.InnerException) != null) + { + builder.AppendLine(); + builder.AppendLine(fault.ToString()); + } + return builder.ToString(); + } + + public static double GetDistance(Component value, Queue> waitBPMMap, double loopingCounter, double targetLoopingCounter, out double lastBPM) + { + lastBPM = double.NaN; + var distance = 0.0; + while (waitBPMMap.Count > 0) + { + var (wait, bpm) = waitBPMMap.Peek(); + if (wait < targetLoopingCounter) + { + distance += value.LogicalYMillis * (wait - loopingCounter); + loopingCounter = wait; + value.SetBPM(bpm); + lastBPM = bpm; + waitBPMMap.Dequeue(); + } + else + { + break; + } + } + return distance + value.LogicalYMillis * (targetLoopingCounter - loopingCounter); + } + + public static void Into(this IDictionary> valueMap, TKey i, TValue value) + { + if (valueMap.TryGetValue(i, out var values)) + { + values.Add(value); + valueMap[i] = values; + } + else + { + valueMap[i] = new() + { + value + }; + } + } + + public static void Into(this IDictionary> valueMap, TKey i, TValue value) + { + if (valueMap.TryGetValue(i, out var values)) + { + values.Add(value); + valueMap[i] = values; + } + else + { + valueMap[i] = new() + { + value + }; + } + } + + public static string GetHighestInputCountText(double averageInputCount, int highestInputCount, double audioMultiplier) => $"{(audioMultiplier * averageInputCount).ToString("#,##0.##/s")} (PEAK: {(audioMultiplier * highestInputCount).ToString("#,##0.##/s")})"; + + public static string GetGenreText(string genre) => string.IsNullOrEmpty(genre) || genre.StartsWith('#') ? genre : $"#{genre}"; + + public static string GetBPMText(double bpm, double multiplier, double audioMultiplier) => $"{Math.Round(bpm * audioMultiplier, 2)} BPM×{multiplier.ToString("0.0")}={Math.Round(bpm * audioMultiplier * multiplier)} BPM (×{audioMultiplier.ToString("0.00")})"; + + public static string GetBPMText(double bpm, double audioMultiplier) => $"{Math.Round(bpm * audioMultiplier)} BPM (×{audioMultiplier.ToString("0.00")})"; + + public static string GetLengthText(double length) + { + var sLength = length / 1000.0; + return $"{((int)(sLength / 60))}:{((int)(sLength % 60)).ToString("00")}"; + } + + public static void LoopBefore(Queue> waitMap, double loopingCounter, double delta, Action onHandle) + { + while (waitMap.Count > 0) + { + var (wait, value) = waitMap.Peek(); + var waitModified = wait + delta; + if (waitModified < loopingCounter) + { + onHandle(waitModified, value); + waitMap.Dequeue(); + } + else + { + break; + } + } + } + + public static string GetText(YamlNode yamlNode, string target, string defaultValue = null) + { + if ((yamlNode as YamlMappingNode)?.Children?.TryGetValue(new YamlScalarNode(target), out var value) == true) + { + var text = value.ToString().Trim(); + return string.IsNullOrEmpty(text) ? defaultValue : text; + } + else + { + return defaultValue; + } + } + + public static CommentItem[] GetCommentItems(JSON.TwilightWwwComment.Comment[] www, BaseNoteFile noteFile) + { + var data = www.Select(data => + { + var date = data.date.HasValue ? DateTimeOffset.FromUnixTimeMilliseconds(data.date.Value).LocalDateTime : null as DateTime?; + var audioMultiplier = Math.Round(data.audioMultiplier, 2); + var sentMultiplier = data.multiplier; + return new CommentItem(data.avatarID, (DefaultCompute.InputFlag)data.inputFlags) + { + IsTwilightComment = true, + NoteFileCount = 1, + Date = date ?? DateTime.MinValue, + DateText = date?.ToString("yyyy-MM-dd HH:mm:ss") ?? "❌", + CommentID = data.commentID, + AvatarName = data.avatarName, + ModeComponentValue = new() + { + CanModifyMultiplier = false, + CanModifyAudioMultiplier = false, + ComputingValue = noteFile, + SentMultiplier = sentMultiplier, + MultiplierValue = noteFile.BPM * audioMultiplier * sentMultiplier, + AutoModeValue = (ModeComponent.AutoMode)data.autoMode, + NoteSaltModeValue = (ModeComponent.NoteSaltMode)data.noteSaltMode, + AudioMultiplier = audioMultiplier, + FaintNoteModeValue = (ModeComponent.FaintNoteMode)data.faintNoteMode, + JudgmentModeValue = (ModeComponent.JudgmentMode)data.judgmentMode, + HitPointsModeValue = (ModeComponent.HitPointsMode)data.hitPointsMode, + NoteMobilityModeValue = (ModeComponent.NoteMobilityMode)data.noteMobilityMode, + LongNoteModeValue = (ModeComponent.LongNoteMode)data.longNoteMode, + InputFavorModeValue = (ModeComponent.InputFavorMode)data.inputFavorMode, + NoteModifyModeValue = (ModeComponent.NoteModifyMode)data.noteModifyMode, + LowestJudgmentConditionModeValue = (ModeComponent.LowestJudgmentConditionMode)data.lowestJudgmentConditionMode, + Salt = data.salt + }, + Stand = data.stand, + Band = data.band, + IsP = data.isP, + Point = data.point, + TwilightCommentary = string.IsNullOrEmpty(data.commentary) ? string.Empty : $"💬 {data.commentary}", + IsPaused = data.isPaused + }; + }).ToArray(); + for (var i = data.Length - 1; i >= 0; --i) + { + data[i].CommentPlace0Text = $"#{i + 1}"; + data[i].CommentPlace1Text = $"/{data.Length}"; + } + return data; + } + + public static void SetFilledMediaDrawing(ref Bound r, bool isMediaFill, double mediaSoftwareLength, double mediaSoftwareHeight, double mediaPosition0, double mediaPosition1, double mediaLength, double mediaHeight) + { + if (isMediaFill) + { + r.Set(mediaPosition0, mediaPosition1, mediaLength, mediaHeight); + } + else + { + if (mediaLength / mediaSoftwareLength > mediaHeight / mediaSoftwareHeight) + { + mediaSoftwareLength = mediaHeight * mediaSoftwareLength / mediaSoftwareHeight; + r.Set(mediaPosition0 + (mediaLength - mediaSoftwareLength) / 2, mediaPosition1, mediaSoftwareLength, mediaHeight); + } + else + { + mediaSoftwareHeight = mediaLength * mediaSoftwareHeight / mediaSoftwareLength; + r.Set(mediaPosition0, mediaPosition1 + (mediaHeight - mediaSoftwareHeight) / 2, mediaLength, mediaSoftwareHeight); + } + } + } + + public static void PaintAudioVisualizer(CanvasDrawingSession targetSession, ref Bound r, int audioVisualizerFaint, double audioVisualizerPosition0, double audioVisualizerPosition1, double audioVisualizerLength, double audioVisualizerHeight) + { + if (Configure.Instance.AudioVisualizer && audioVisualizerFaint > 0) + { + var audioMainVisualizerPaint = DrawingSystem.Instance.AudioVisualizerMainPaints[audioVisualizerFaint]; + var audioInputVisualizerPaint = DrawingSystem.Instance.AudioVisualizerInputPaints[audioVisualizerFaint]; + var audioVisualizerCount = Configure.Instance.AudioVisualizerCount; + var audioVisualizerUnitLength = audioVisualizerLength / audioVisualizerCount; + for (var i = audioVisualizerCount - 1; i >= 0; --i) + { + var mainAudioVisualizerValue = audioVisualizerHeight * AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.MainAudio, i); + var inputAudioVisualizerValue = audioVisualizerHeight * AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.InputAudio, i); + if (mainAudioVisualizerValue > 0.0) + { + r.Set(audioVisualizerPosition0 + audioVisualizerUnitLength * i, audioVisualizerPosition1 + Configure.Instance.GetAudioVisualizerModifier(audioVisualizerHeight, mainAudioVisualizerValue), audioVisualizerUnitLength, mainAudioVisualizerValue); + targetSession.FillRectangle(r, audioMainVisualizerPaint); + } + if (inputAudioVisualizerValue > 0.0) + { + r.Set(audioVisualizerPosition0 + audioVisualizerUnitLength * i, audioVisualizerPosition1 + Configure.Instance.GetAudioVisualizerModifier(audioVisualizerHeight, inputAudioVisualizerValue), audioVisualizerUnitLength, inputAudioVisualizerValue); + targetSession.FillRectangle(r, audioInputVisualizerPaint); + } + } + } + } + + public static void PaintAudioVisualizer(DrawingContext targetSession, ref Bound r, int audioVisualizerFaint, double audioVisualizerPosition0, double audioVisualizerPosition1, double audioVisualizerLength, double audioVisualizerHeight) + { + if (Configure.Instance.AudioVisualizer && audioVisualizerFaint > 0) + { + var audioMainVisualizerPaint = Configure.Instance.AudioVisualizerMainPaints[audioVisualizerFaint]; + var audioInputVisualizerPaint = Configure.Instance.AudioVisualizerInputPaints[audioVisualizerFaint]; + var audioVisualizerCount = Configure.Instance.AudioVisualizerCount; + var audioVisualizerUnitLength = audioVisualizerLength / audioVisualizerCount; + for (var i = audioVisualizerCount - 1; i >= 0; --i) + { + var mainAudioVisualizerValue = audioVisualizerHeight * AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.MainAudio, i); + var inputAudioVisualizerValue = audioVisualizerHeight * AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.InputAudio, i); + if (mainAudioVisualizerValue > 0.0) + { + r.Set(audioVisualizerPosition0 + audioVisualizerUnitLength * i, audioVisualizerPosition1 + Configure.Instance.GetAudioVisualizerModifier(audioVisualizerHeight, mainAudioVisualizerValue), audioVisualizerUnitLength, mainAudioVisualizerValue); + targetSession.DrawRectangle(audioMainVisualizerPaint, null, r); + } + if (inputAudioVisualizerValue > 0.0) + { + r.Set(audioVisualizerPosition0 + audioVisualizerUnitLength * i, audioVisualizerPosition1 + Configure.Instance.GetAudioVisualizerModifier(audioVisualizerHeight, inputAudioVisualizerValue), audioVisualizerUnitLength, inputAudioVisualizerValue); + targetSession.DrawRectangle(audioInputVisualizerPaint, null, r); + } + } + } + } + + public static bool? IsItemsEqual(ICollection values, ICollection lastValues, IEqualityComparer onEqual = null) + { + if (values.Count != lastValues.Count) + { + return false; + } + else + { + onEqual ??= EqualityComparer.Default; + for (var i = values.Count - 1; i >= 0; --i) + { + var value = values.ElementAt(i); + if (lastValues.Contains(value, onEqual)) + { + if (!onEqual.Equals(lastValues.ElementAt(i), value)) + { + return null; + } + } + else + { + return false; + } + } + } + return true; + } + + public static void SetBaseUIItem(UIItem src, UIItem target) + { + if (!Configure.Instance.BaseUIConfigureValues.ContainsKey(target.Title)) + { + Configure.Instance.BaseUIConfigureValues[target.Title] = new(); + } + Configure.Instance.BaseUIItemValue = target; + foreach (var toNotifyUIItem in BaseUI.Instance.UIItems) + { + toNotifyUIItem.NotifyUI(); + } + BaseUI.Instance.LoadUI(src, target); + } + + public static void SetUIItem(UIItem src, UIItem target) + { + if (!Configure.Instance.UIConfigureValuesV2.ContainsKey(target.Title)) + { + Configure.Instance.UIConfigureValuesV2[target.Title] = new(); + } + Configure.Instance.UIItemValue = target; + foreach (var toNotifyUIItem in UI.Instance.UIItems) + { + toNotifyUIItem.NotifyUI(); + } + UI.Instance.LoadUI(src, target); + } + + public static string GetDefaultAvatarID(string avatarID) => avatarID?.Substring(avatarID.IndexOf('@') + 1); + + public static string GetLetter(Key rawInput) + { + if (Key.A <= rawInput && rawInput <= Key.Z) + { + return ((char)(21 + rawInput)).ToString(); + } + else + { + return string.Empty; + } + } + + public static T[] GetInputData(IDirectInputDevice8 dInputController) where T : unmanaged, IStateUpdate + { + var data = Array.Empty(); + try + { + if (!dInputController.Acquire().Failure && !dInputController.Poll().Failure) + { + data = dInputController.GetBufferedData(); + } + } + catch (SharpGenException) + { + } + return data; + } + + public static T Max(T value0, T value1, T value2) where T : IComparable + { + var value = value0; + if (value.CompareTo(value1) < 0) + { + value = value1; + } + if (value.CompareTo(value2) < 0) + { + value = value2; + } + return value; + } + + public static string GetSiteName(string siteName) => siteName switch + { + "@Comment" => LanguageSystem.Instance.CommentSiteName, + "@Default" => LanguageSystem.Instance.DefaultSiteName, + "@Platform" => LanguageSystem.Instance.PlatformSiteName, + _ => siteName + }; + + public static string GetPlatformText(string title, string artist, string genre, string levelText) => $"{levelText} {artist} - {title} {GetGenreText(genre)}"; + + public static bool HasInput(VirtualKey rawInput) => PInvoke.GetAsyncKeyState((int)rawInput) <= -32767; + + public static void ModifyHwMode(HwMode hwMode) + { + if (Configure.Instance.SetHwMode) + { + var rawHwModeBefore = new DEVMODEW(); + PInvoke.EnumDisplaySettings(null, ENUM_DISPLAY_SETTINGS_MODE.ENUM_CURRENT_SETTINGS, ref rawHwModeBefore); + if (hwMode != new HwMode(rawHwModeBefore.dmPelsWidth, rawHwModeBefore.dmPelsHeight, rawHwModeBefore.dmDisplayFrequency)) + { + var rawHwMode = new DEVMODEW + { + dmSize = (ushort)Marshal.SizeOf(), + dmFields = DEVMODE_FIELD_FLAGS.DM_PELSWIDTH | DEVMODE_FIELD_FLAGS.DM_PELSHEIGHT | DEVMODE_FIELD_FLAGS.DM_DISPLAYFREQUENCY, + dmPelsWidth = hwMode.Length, + dmPelsHeight = hwMode.Height, + dmDisplayFrequency = hwMode.Hz, + }; + PInvoke.ChangeDisplaySettings(rawHwMode, 0); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/Utilities/ValueUtility.cs b/Qwilight/Qwilight/Utilities/ValueUtility.cs new file mode 100644 index 0000000..17a7d2d --- /dev/null +++ b/Qwilight/Qwilight/Utilities/ValueUtility.cs @@ -0,0 +1,47 @@ +namespace Qwilight.Utilities +{ + public static partial class Utility + { + public static T GetValue(T[] data, int i) => i < data.Length ? data[i] : default; + + public static void SetValue(this T[] data, int i, T value) + { + if (i < data.Length) + { + data[i] = value; + } + } + + public static void SetValue(this T[][] data, int i, int j, T value) + { + if (i < data.Length && j < data[i].Length) + { + data[i][j] = value; + } + } + + public static void SetValue(this T[][][] data, int i, int j, int m, T value) + { + if (i < data.Length && j < data[i].Length && m < data[i][j].Length) + { + data[i][j][m] = value; + } + } + + public static void SetValue(this T[][][][] data, int i, int j, int m, int o, T value) + { + if (i < data.Length && j < data[i].Length && m < data[i][j].Length && o < data[i][j][m].Length) + { + data[i][j][m][o] = value; + } + } + + public static void SetValue(this T[,] data, int i, int j, T value) + { + if (i < data.GetLength(0) && j < data.GetLength(1)) + { + data[i, j] = value; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/Assets/Assets.xaml b/Qwilight/Qwilight/View/Assets/Assets.xaml new file mode 100644 index 0000000..1fcf2f4 --- /dev/null +++ b/Qwilight/Qwilight/View/Assets/Assets.xaml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + 0 + 1 + 2 + + 0 + 1 + 2 + + 0 + 1 + 2 + 3 + 4 + + 0 + 1 + 2 + + 0 + 3 + 1 + 2 + + 0 + 1 + 2 + 3 + + 0 + 1 + + 0 + 1 + 2 + + 0 + 1 + 2 + 3 + + 0 + 1 + 2 + 3 + + 0 + 1 + + 0 + 1 + 3 + 5 + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + + 4 + 5 + 6 + 7 + 8 + 9 + 14 + 10 + 11 + 12 + 13 + 15 + 16 + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + 0 + 1 + + 0 + 1 + 2 + 3 + 4 + 5 + + 0 + 1 + 2 + 3 + 4 + 5 + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/Assets/DrawingAssets.xaml b/Qwilight/Qwilight/View/Assets/DrawingAssets.xaml new file mode 100644 index 0000000..8334995 --- /dev/null +++ b/Qwilight/Qwilight/View/Assets/DrawingAssets.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/Assets/ModifierAssets.xaml b/Qwilight/Qwilight/View/Assets/ModifierAssets.xaml new file mode 100644 index 0000000..1787963 --- /dev/null +++ b/Qwilight/Qwilight/View/Assets/ModifierAssets.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/Assets/UIAssets.xaml b/Qwilight/Qwilight/View/Assets/UIAssets.xaml new file mode 100644 index 0000000..20f46ea --- /dev/null +++ b/Qwilight/Qwilight/View/Assets/UIAssets.xaml @@ -0,0 +1,490 @@ + + Century Gothic + + 4.0 + 8.0 + + 1.0 + 5.0 + 5.0 0.0 + 0.0 5.0 + + 12.0 + 20.0 + + DeepPink + DeepSkyBlue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AssistFileWindow.xaml b/Qwilight/Qwilight/View/AssistFileWindow.xaml new file mode 100644 index 0000000..f6bebf1 --- /dev/null +++ b/Qwilight/Qwilight/View/AssistFileWindow.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AssistFileWindow.xaml.cs b/Qwilight/Qwilight/View/AssistFileWindow.xaml.cs new file mode 100644 index 0000000..1c59069 --- /dev/null +++ b/Qwilight/Qwilight/View/AssistFileWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class AssistFileWindow + { + public AssistFileWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AssistWindow.xaml b/Qwilight/Qwilight/View/AssistWindow.xaml new file mode 100644 index 0000000..92204eb --- /dev/null +++ b/Qwilight/Qwilight/View/AssistWindow.xaml @@ -0,0 +1,475 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AssistWindow.xaml.cs b/Qwilight/Qwilight/View/AssistWindow.xaml.cs new file mode 100644 index 0000000..93e3c69 --- /dev/null +++ b/Qwilight/Qwilight/View/AssistWindow.xaml.cs @@ -0,0 +1,19 @@ +using Qwilight.Utilities; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class AssistWindow + { + public AssistWindow() => InitializeComponent(); + + void OnViewItems(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + Utility.ViewItems(sender as FrameworkElement); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AvatarDateView.xaml b/Qwilight/Qwilight/View/AvatarDateView.xaml new file mode 100644 index 0000000..c0e8740 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarDateView.xaml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AvatarDateView.xaml.cs b/Qwilight/Qwilight/View/AvatarDateView.xaml.cs new file mode 100644 index 0000000..c095b3c --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarDateView.xaml.cs @@ -0,0 +1,47 @@ +using Qwilight.ViewModel; +using System.Windows.Media; + +namespace Qwilight.View +{ + public partial class AvatarDateView + { + readonly DrawingGroup _target = new(); + + public AvatarDateView() + { + InitializeComponent(); + IsVisibleChanged += (sender, e) => + { + if ((bool)e.NewValue) + { + CompositionTarget.Rendering += OnPaint; + } + else + { + CompositionTarget.Rendering -= OnPaint; + } + }; + } + + void OnPaint(object sender, object e) + { + var viewHeight = RenderSize.Height; + var dateValues = ViewModels.Instance.AvatarValue.DateValues; + var dateValuesLength = dateValues.Length; + var dateValueLength = RenderSize.Width / dateValuesLength; + var highestDateValue = dateValues.Max(); + + using var targetSession = _target.Open(); + for (var i = dateValuesLength - 1; i >= 0; --i) + { + targetSession.DrawRectangle(Paints.Paint4, null, new Bound(dateValueLength * i, viewHeight * (highestDateValue - dateValues[i]) / highestDateValue, dateValueLength, viewHeight * dateValues[i] / highestDateValue)); + } + } + + protected override void OnRender(DrawingContext dc) + { + base.OnRender(dc); + dc.DrawDrawing(_target); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AvatarDrawingView.xaml b/Qwilight/Qwilight/View/AvatarDrawingView.xaml new file mode 100644 index 0000000..aaf8458 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarDrawingView.xaml @@ -0,0 +1,13 @@ + + + + + + diff --git a/Qwilight/Qwilight/View/AvatarDrawingView.xaml.cs b/Qwilight/Qwilight/View/AvatarDrawingView.xaml.cs new file mode 100644 index 0000000..86c480f --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarDrawingView.xaml.cs @@ -0,0 +1,39 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System.Windows; + +namespace Qwilight.View +{ + [INotifyPropertyChanged] + public partial class AvatarDrawingView + { + public static readonly DependencyProperty AvatarWwwValueProperty = DependencyProperty.Register(nameof(AvatarWwwValue), typeof(AvatarWww), typeof(AvatarDrawingView)); + + public AvatarDrawingView() => InitializeComponent(); + + public AvatarWww AvatarWwwValue + { + get => GetValue(AvatarWwwValueProperty) as AvatarWww; + + set => SetValue(AvatarWwwValueProperty, value); + } + + public Thickness MarginValue => new Thickness(-EdgeX, -EdgeY, -EdgeX, -EdgeY); + + public double EdgeLength => ActualWidth * Levels.EdgeMargin; + + public double EdgeHeight => ActualHeight * Levels.EdgeMargin; + + public double EdgeX => ActualWidth * Levels.EdgeXY; + + public double EdgeY => ActualHeight * Levels.EdgeXY; + + void OnLoaded(object sender, RoutedEventArgs e) + { + OnPropertyChanged(nameof(MarginValue)); + OnPropertyChanged(nameof(EdgeLength)); + OnPropertyChanged(nameof(EdgeHeight)); + OnPropertyChanged(nameof(EdgeX)); + OnPropertyChanged(nameof(EdgeY)); + } + } +} diff --git a/Qwilight/Qwilight/View/AvatarEdgeWindow.xaml b/Qwilight/Qwilight/View/AvatarEdgeWindow.xaml new file mode 100644 index 0000000..9333959 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarEdgeWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AvatarEdgeWindow.xaml.cs b/Qwilight/Qwilight/View/AvatarEdgeWindow.xaml.cs new file mode 100644 index 0000000..dbc0722 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarEdgeWindow.xaml.cs @@ -0,0 +1,12 @@ +using Qwilight.ViewModel; +using System.Windows.Input; + +namespace Qwilight.View +{ + public partial class AvatarEdgeWindow + { + public AvatarEdgeWindow() => InitializeComponent(); + + void OnPointLower(object sender, MouseButtonEventArgs e) => (DataContext as AvatarEdgeViewModel).OnPointLower(); + } +} diff --git a/Qwilight/Qwilight/View/AvatarNameView.xaml b/Qwilight/Qwilight/View/AvatarNameView.xaml new file mode 100644 index 0000000..90aa9a6 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarNameView.xaml @@ -0,0 +1,9 @@ + + + + diff --git a/Qwilight/Qwilight/View/AvatarNameView.xaml.cs b/Qwilight/Qwilight/View/AvatarNameView.xaml.cs new file mode 100644 index 0000000..090c676 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarNameView.xaml.cs @@ -0,0 +1,53 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System.Windows; +using System.Windows.Media; + +namespace Qwilight.View +{ + [INotifyPropertyChanged] + public partial class AvatarNameView + { + public static readonly DependencyProperty AvatarWwwValueProperty = DependencyProperty.Register(nameof(AvatarWwwValue), typeof(AvatarWww), typeof(AvatarNameView)); + public static readonly DependencyProperty AvatarNameProperty = DependencyProperty.Register(nameof(AvatarName), typeof(string), typeof(AvatarNameView)); + public static readonly DependencyProperty FontLengthProperty = DependencyProperty.Register(nameof(FontLength), typeof(double), typeof(AvatarNameView), new FrameworkPropertyMetadata(Levels.FontLevel0)); + public static readonly DependencyProperty TextPaintProperty = DependencyProperty.Register(nameof(TextPaint), typeof(Brush), typeof(AvatarNameView), new FrameworkPropertyMetadata(Paints.Paint4)); + public static readonly DependencyProperty HeavyTextProperty = DependencyProperty.Register(nameof(HeavyText), typeof(FontWeight), typeof(AvatarNameView), new FrameworkPropertyMetadata(default)); + + public AvatarNameView() => InitializeComponent(); + + public AvatarWww AvatarWwwValue + { + get => GetValue(AvatarWwwValueProperty) as AvatarWww; + + set => SetValue(AvatarWwwValueProperty, value); + } + + public string AvatarName + { + get => GetValue(AvatarNameProperty) as string; + + set => SetValue(AvatarNameProperty, value); + } + + public double FontLength + { + get => (double)GetValue(FontLengthProperty); + + set => SetValue(FontLengthProperty, value); + } + + public Brush TextPaint + { + get => GetValue(TextPaintProperty) as Brush; + + set => SetValue(TextPaintProperty, value); + } + + public FontWeight HeavyText + { + get => (FontWeight)GetValue(HeavyTextProperty); + + set => SetValue(HeavyTextProperty, value); + } + } +} diff --git a/Qwilight/Qwilight/View/AvatarTitleWindow.xaml b/Qwilight/Qwilight/View/AvatarTitleWindow.xaml new file mode 100644 index 0000000..1cf87b5 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarTitleWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/AvatarTitleWindow.xaml.cs b/Qwilight/Qwilight/View/AvatarTitleWindow.xaml.cs new file mode 100644 index 0000000..64cd194 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarTitleWindow.xaml.cs @@ -0,0 +1,12 @@ +using Qwilight.ViewModel; +using System.Windows.Input; + +namespace Qwilight.View +{ + public partial class AvatarTitleWindow + { + public AvatarTitleWindow() => InitializeComponent(); + + void OnPointLower(object sender, MouseButtonEventArgs e) => (DataContext as AvatarTitleViewModel).OnPointLower(); + } +} diff --git a/Qwilight/Qwilight/View/AvatarWindow.xaml b/Qwilight/Qwilight/View/AvatarWindow.xaml new file mode 100644 index 0000000..fc13017 --- /dev/null +++ b/Qwilight/Qwilight/View/AvatarWindow.xaml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/ColorWindow.xaml.cs b/Qwilight/Qwilight/View/ColorWindow.xaml.cs new file mode 100644 index 0000000..8eb73ca --- /dev/null +++ b/Qwilight/Qwilight/View/ColorWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public partial class ColorWindow + { + public ColorWindow() => InitializeComponent(); + } +} diff --git a/Qwilight/Qwilight/View/CommentWindow.xaml b/Qwilight/Qwilight/View/CommentWindow.xaml new file mode 100644 index 0000000..b553660 --- /dev/null +++ b/Qwilight/Qwilight/View/CommentWindow.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/CommentWindow.xaml.cs b/Qwilight/Qwilight/View/CommentWindow.xaml.cs new file mode 100644 index 0000000..5f10eef --- /dev/null +++ b/Qwilight/Qwilight/View/CommentWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class CommentWindow + { + public CommentWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/ConfigureWindow/AudioConfigureWindow.xaml b/Qwilight/Qwilight/View/ConfigureWindow/AudioConfigureWindow.xaml new file mode 100644 index 0000000..a8ce4ea --- /dev/null +++ b/Qwilight/Qwilight/View/ConfigureWindow/AudioConfigureWindow.xaml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + en-US + ko-KR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/EdgePanel.xaml.cs b/Qwilight/Qwilight/View/EdgePanel.xaml.cs new file mode 100644 index 0000000..d261e4c --- /dev/null +++ b/Qwilight/Qwilight/View/EdgePanel.xaml.cs @@ -0,0 +1,82 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using Microsoft.Web.WebView2.Wpf; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.View +{ + [INotifyPropertyChanged] + public partial class EdgePanel + { + public static readonly DependencyProperty InitWwwProperty = DependencyProperty.Register(nameof(InitWww), typeof(string), typeof(EdgePanel)); + + bool _isEdgeViewLoading; + string _www = string.Empty; + + public string InitWww + { + get => GetValue(InitWwwProperty) as string; + + set => SetValue(InitWwwProperty, value); + } + + public bool IsEdgeViewLoading + { + get => _isEdgeViewLoading; + + set => SetProperty(ref _isEdgeViewLoading, value, nameof(IsEdgeViewLoading)); + } + + public string Www + { + get => _www; + + set => SetProperty(ref _www, value, nameof(Www)); + } + + public EdgePanel() + { + InitializeComponent(); + EdgeView.CoreWebView2InitializationCompleted += (sender, e) => (sender as WebView2).CoreWebView2.Profile.DefaultDownloadFolderPath = QwilightComponent.EdgeEntryPath; + EdgeView.NavigationStarting += (sender, e) => IsEdgeViewLoading = true; + EdgeView.NavigationCompleted += (sender, e) => IsEdgeViewLoading = false; + Loaded += OnInit; + } + + void OnMove0(object sender, RoutedEventArgs e) + { + EdgeView.GoBack(); + } + + void OnLoad(object sender, RoutedEventArgs e) + { + EdgeView.Reload(); + } + + void OnInit(object sender, RoutedEventArgs e) + { + Www = InitWww; + try + { + EdgeView.Source = new Uri(Www); + } + catch + { + } + } + + void OnInputLower(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + try + { + EdgeView.Source = new Uri(Www); + } + catch + { + } + } + } + } +} diff --git a/Qwilight/Qwilight/View/EqualizerWindow.xaml b/Qwilight/Qwilight/View/EqualizerWindow.xaml new file mode 100644 index 0000000..f6b60e1 --- /dev/null +++ b/Qwilight/Qwilight/View/EqualizerWindow.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FavorHitPointsWindow.xaml.cs b/Qwilight/Qwilight/View/FavorHitPointsWindow.xaml.cs new file mode 100644 index 0000000..633e4a3 --- /dev/null +++ b/Qwilight/Qwilight/View/FavorHitPointsWindow.xaml.cs @@ -0,0 +1,12 @@ +using Qwilight.ViewModel; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class FavorHitPointsWindow + { + public FavorHitPointsWindow() => InitializeComponent(); + + void OnInputLower(object sender, KeyEventArgs e) => (DataContext as FavorHitPointsViewModel).OnInputLower(e); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FavorJudgmentWindow.xaml b/Qwilight/Qwilight/View/FavorJudgmentWindow.xaml new file mode 100644 index 0000000..88bd0c3 --- /dev/null +++ b/Qwilight/Qwilight/View/FavorJudgmentWindow.xaml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FavorJudgmentWindow.xaml.cs b/Qwilight/Qwilight/View/FavorJudgmentWindow.xaml.cs new file mode 100644 index 0000000..2332335 --- /dev/null +++ b/Qwilight/Qwilight/View/FavorJudgmentWindow.xaml.cs @@ -0,0 +1,12 @@ +using Qwilight.ViewModel; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class FavorJudgmentWindow + { + public FavorJudgmentWindow() => InitializeComponent(); + + void OnInputLower(object sender, KeyEventArgs e) => (DataContext as FavorJudgmentViewModel).OnInputLower(e); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FavoriteEntryWindow.xaml b/Qwilight/Qwilight/View/FavoriteEntryWindow.xaml new file mode 100644 index 0000000..260f654 --- /dev/null +++ b/Qwilight/Qwilight/View/FavoriteEntryWindow.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FavoriteEntryWindow.xaml.cs b/Qwilight/Qwilight/View/FavoriteEntryWindow.xaml.cs new file mode 100644 index 0000000..0852fed --- /dev/null +++ b/Qwilight/Qwilight/View/FavoriteEntryWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class FavoriteEntryWindow + { + public FavoriteEntryWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FontFamilyWindow.xaml b/Qwilight/Qwilight/View/FontFamilyWindow.xaml new file mode 100644 index 0000000..b73df65 --- /dev/null +++ b/Qwilight/Qwilight/View/FontFamilyWindow.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/FontFamilyWindow.xaml.cs b/Qwilight/Qwilight/View/FontFamilyWindow.xaml.cs new file mode 100644 index 0000000..6e467e7 --- /dev/null +++ b/Qwilight/Qwilight/View/FontFamilyWindow.xaml.cs @@ -0,0 +1,15 @@ +using Qwilight.ViewModel; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Qwilight.View +{ + public partial class FontFamilyWindow + { + public FontFamilyWindow() => InitializeComponent(); + + void OnWant(object sender, TextChangedEventArgs e) => (DataContext as FontFamilyViewModel).OnWant(); + + void OnPointLower(object sender, MouseButtonEventArgs e) => (DataContext as FontFamilyViewModel).OnPointLower(); + } +} diff --git a/Qwilight/Qwilight/View/InputPwWindow.xaml b/Qwilight/Qwilight/View/InputPwWindow.xaml new file mode 100644 index 0000000..649f475 --- /dev/null +++ b/Qwilight/Qwilight/View/InputPwWindow.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/InputStandardControllerWindow.xaml.cs b/Qwilight/Qwilight/View/InputStandardControllerWindow.xaml.cs new file mode 100644 index 0000000..a3368c3 --- /dev/null +++ b/Qwilight/Qwilight/View/InputStandardControllerWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class InputStandardControllerWindow + { + public InputStandardControllerWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/InputStandardWindow.xaml b/Qwilight/Qwilight/View/InputStandardWindow.xaml new file mode 100644 index 0000000..72f4162 --- /dev/null +++ b/Qwilight/Qwilight/View/InputStandardWindow.xaml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/InputStandardWindow.xaml.cs b/Qwilight/Qwilight/View/InputStandardWindow.xaml.cs new file mode 100644 index 0000000..2a49a52 --- /dev/null +++ b/Qwilight/Qwilight/View/InputStandardWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class InputStandardWindow + { + public InputStandardWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/InputTextWindow.xaml b/Qwilight/Qwilight/View/InputTextWindow.xaml new file mode 100644 index 0000000..aaf112f --- /dev/null +++ b/Qwilight/Qwilight/View/InputTextWindow.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/InputWindow.xaml.cs b/Qwilight/Qwilight/View/InputWindow.xaml.cs new file mode 100644 index 0000000..b99c4f4 --- /dev/null +++ b/Qwilight/Qwilight/View/InputWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class InputWindow + { + public InputWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/LevelVoteWindow.xaml b/Qwilight/Qwilight/View/LevelVoteWindow.xaml new file mode 100644 index 0000000..647d598 --- /dev/null +++ b/Qwilight/Qwilight/View/LevelVoteWindow.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/LevelVoteWindow.xaml.cs b/Qwilight/Qwilight/View/LevelVoteWindow.xaml.cs new file mode 100644 index 0000000..66a5111 --- /dev/null +++ b/Qwilight/Qwilight/View/LevelVoteWindow.xaml.cs @@ -0,0 +1,16 @@ +using Qwilight.ViewModel; + +namespace Qwilight.View +{ + public sealed partial class LevelVoteWindow + { + public LevelVoteWindow() + { + InitializeComponent(); + EdgeView0.NavigationStarting += (sender, e) => (DataContext as LevelVoteViewModel).OnEdgeView0Loading(true); + EdgeView0.NavigationCompleted += (sender, e) => (DataContext as LevelVoteViewModel).OnEdgeView0Loading(false); + EdgeView1.NavigationStarting += (sender, e) => (DataContext as LevelVoteViewModel).OnEdgeView1Loading(true); + EdgeView1.NavigationCompleted += (sender, e) => (DataContext as LevelVoteViewModel).OnEdgeView1Loading(false); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/LevelWindow.xaml b/Qwilight/Qwilight/View/LevelWindow.xaml new file mode 100644 index 0000000..a3e7f0b --- /dev/null +++ b/Qwilight/Qwilight/View/LevelWindow.xaml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/LevelWindow.xaml.cs b/Qwilight/Qwilight/View/LevelWindow.xaml.cs new file mode 100644 index 0000000..7b153bd --- /dev/null +++ b/Qwilight/Qwilight/View/LevelWindow.xaml.cs @@ -0,0 +1,15 @@ +using Qwilight.ViewModel; +using System.Windows; +using System.Windows.Controls; + +namespace Qwilight.View +{ + public sealed partial class LevelWindow + { + public LevelWindow() => InitializeComponent(); + + void OnInput(object sender, RoutedEventArgs e) => (DataContext as LevelViewModel).OnInput(); + + void OnNewLevel(object sender, SelectionChangedEventArgs e) => (DataContext as LevelViewModel).OnNewLevel(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/LongNoteModifyWindow.xaml b/Qwilight/Qwilight/View/LongNoteModifyWindow.xaml new file mode 100644 index 0000000..d9bd85a --- /dev/null +++ b/Qwilight/Qwilight/View/LongNoteModifyWindow.xaml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/LongNoteModifyWindow.xaml.cs b/Qwilight/Qwilight/View/LongNoteModifyWindow.xaml.cs new file mode 100644 index 0000000..7cf1c66 --- /dev/null +++ b/Qwilight/Qwilight/View/LongNoteModifyWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class LongNoteModifyWindow + { + public LongNoteModifyWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/DefaultMode/CommentView.xaml b/Qwilight/Qwilight/View/MainWindow/DefaultMode/CommentView.xaml new file mode 100644 index 0000000..0f973b7 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/DefaultMode/CommentView.xaml @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/DefaultMode/EntryView.xaml.cs b/Qwilight/Qwilight/View/MainWindow/DefaultMode/EntryView.xaml.cs new file mode 100644 index 0000000..c6ecaa5 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/DefaultMode/EntryView.xaml.cs @@ -0,0 +1,67 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.ViewModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Qwilight.View +{ + public partial class EntryView : IRecipient + { + public EntryView() + { + InitializeComponent(); + WeakReferenceMessenger.Default.Register(this); + } + + void OnWant(object sender, SelectionChangedEventArgs e) => (DataContext as MainViewModel).Want(); + + void OnWant(object sender, TextChangedEventArgs e) => (DataContext as MainViewModel).OnWant(); + + void OnLevyNoteFile(object sender, MouseButtonEventArgs e) => (DataContext as MainViewModel).OnLevyNoteFile(e); + + void OnFitMode(object sender, EventArgs e) => (DataContext as MainViewModel).OnFitMode(); + + void OnEntryViewInputLower(object sender, KeyEventArgs e) => (DataContext as MainViewModel).OnEntryViewInputLower(e); + + void OnEntryViewPointingLower(object sender, MouseButtonEventArgs e) => (DataContext as MainViewModel).OnEntryViewPointingLower(e); + + void OnInputWantPointed(object sender, RoutedEventArgs e) => (DataContext as MainViewModel).OnInputWantPointed(true); + + void OnInputWantNotPointed(object sender, RoutedEventArgs e) => (DataContext as MainViewModel).OnInputWantPointed(false); + + public void Receive(ICC message) + { + switch (message.IDValue) + { + case ICC.ID.MoveEntryView: + HandlingUISystem.Instance.HandleParallel(() => + { + if ((DataContext as MainViewModel).IsNoteFileMode) + { + EntryItemsView.ScrollIntoView(message.Contents); + } + }); + break; + case ICC.ID.PointEntryView: + HandlingUISystem.Instance.HandleParallel(() => + { + if ((DataContext as MainViewModel).IsNoteFileMode) + { + EntryItemsView.Focus(); + } + }); + break; + case ICC.ID.SetNoteFileModeWindowInputs: + HandlingUISystem.Instance.HandleParallel(() => + { + var i = FitInput.SelectedIndex; + FitInput.Items.Refresh(); + FitInput.SelectedIndex = -1; + FitInput.SelectedIndex = i; + }); + break; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/DefaultMode/NoteFileModeWindow.xaml b/Qwilight/Qwilight/View/MainWindow/DefaultMode/NoteFileModeWindow.xaml new file mode 100644 index 0000000..c1f2415 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/DefaultMode/NoteFileModeWindow.xaml @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/DefaultMode/NoteFileModeWindow.xaml.cs b/Qwilight/Qwilight/View/MainWindow/DefaultMode/NoteFileModeWindow.xaml.cs new file mode 100644 index 0000000..4abe7c9 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/DefaultMode/NoteFileModeWindow.xaml.cs @@ -0,0 +1,13 @@ +using Qwilight.Utilities; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.View +{ + public partial class NoteFileModeWindow + { + public NoteFileModeWindow() => InitializeComponent(); + + void OnViewItems(object sender, MouseButtonEventArgs e) => Utility.ViewItems(sender as FrameworkElement); + } +} diff --git a/Qwilight/Qwilight/View/MainWindow/Layer0View.xaml b/Qwilight/Qwilight/View/MainWindow/Layer0View.xaml new file mode 100644 index 0000000..4327565 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/Layer0View.xaml @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/Layer0View.xaml.cs b/Qwilight/Qwilight/View/MainWindow/Layer0View.xaml.cs new file mode 100644 index 0000000..46fd57c --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/Layer0View.xaml.cs @@ -0,0 +1,198 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Media; + +namespace Qwilight.View +{ + public sealed partial class Layer0View + { + readonly DrawingGroup _target = new(); + readonly Stopwatch _loopingHandler = Stopwatch.StartNew(); + double _lastMillis; + + public Layer0View() + { + InitializeComponent(); + IsVisibleChanged += OnVisibilityModified; + } + + void OnVisibilityModified(object sender, DependencyPropertyChangedEventArgs e) + { + if ((bool)e.NewValue) + { + CompositionTarget.Rendering += OnPaint; + } + else + { + CompositionTarget.Rendering -= OnPaint; + } + } + + void OnPaint(object sender, object e) + { + var millis = _loopingHandler.GetMillis(); + var distanceMillis = millis - _lastMillis; + _lastMillis = millis; + + using (var targetSession = _target.Open()) + { + var r = new Bound(); + var mainViewModel = (DataContext as MainViewModel); + if (mainViewModel.IsNoteFileMode) + { + var p1 = new Point(); + var p2 = new Point(); + var noteFile = mainViewModel.EntryItemValue?.NoteFile; + var autoComputer = mainViewModel.AutoComputer; + + foreach (var paintPropertyValue in BaseUI.Instance.PaintPropertyValues) + { + if (paintPropertyValue?.Layer == 0) + { + paintPropertyValue.Paint(targetSession, noteFile, autoComputer, distanceMillis); + } + } + + var statusPoint = BaseUI.Instance.StatusPoint; + var status = autoComputer?.Status; + if (statusPoint?.Length > 4 && status > 0.0) + { + var statusValue = status.Value; + var statusPosition0 = statusPoint[0]; + var statusPosition1 = statusPoint[1]; + var statusLength = statusPoint[2]; + var statusHeight = statusPoint[3]; + switch (statusPoint[4]) + { + case 0: + r.Set(statusPosition0, statusPosition1 + statusHeight * (1 - statusValue), statusLength, statusHeight * statusValue); + break; + case 1: + r.Set(statusPosition0, statusPosition1, statusLength, statusHeight * statusValue); + break; + case 2: + r.Set(statusPosition0 + statusLength * (1 - statusValue), statusPosition1, statusLength * statusValue, statusHeight); + break; + case 3: + r.Set(statusPosition0, statusPosition1, statusLength * statusValue, statusHeight); + break; + } + targetSession.DrawRectangle(autoComputer.IsHandling ? autoComputer.IsPausing ? BaseUI.Instance.StatusPausedPaint : BaseUI.Instance.StatusHandlingPaint : BaseUI.Instance.StatusLoadingNoteFilePaint, null, r); + } + + var statusDefaultEntryPoint = BaseUI.Instance.StatusDefaultEntryPoint; + var defaultEntryStatus = mainViewModel.Status; + if (statusDefaultEntryPoint?.Length > 4 && defaultEntryStatus > 0.0) + { + var defaultEntryPosition0 = statusDefaultEntryPoint[0]; + var defaultEntryPosition1 = statusDefaultEntryPoint[1]; + var defaultEntryLength = statusDefaultEntryPoint[2]; + var defaultEntryHeight = statusDefaultEntryPoint[3]; + switch (statusDefaultEntryPoint[4]) + { + case 0: + r.Set(defaultEntryPosition0, defaultEntryPosition1 + defaultEntryHeight * (1 - defaultEntryStatus), defaultEntryLength, defaultEntryHeight * defaultEntryStatus); + break; + case 1: + r.Set(defaultEntryPosition0, defaultEntryPosition1, defaultEntryLength, defaultEntryHeight * defaultEntryStatus); + break; + case 2: + r.Set(defaultEntryPosition0 + defaultEntryLength * (1 - defaultEntryStatus), defaultEntryPosition1, defaultEntryLength * defaultEntryStatus, defaultEntryHeight); + break; + case 3: + r.Set(defaultEntryPosition0, defaultEntryPosition1, defaultEntryLength * defaultEntryStatus, defaultEntryHeight); + break; + } + targetSession.DrawRectangle(BaseUI.Instance.StatusLoadingDefaultEntryPaint, null, r); + } + + var inputNoteCountViewPoint = BaseUI.Instance.InputNoteCountViewPoint; + if (inputNoteCountViewPoint?.Length > 3) + { + var inputNoteCountViewPosition0 = inputNoteCountViewPoint[0]; + var inputNoteCountViewPosition1 = inputNoteCountViewPoint[1]; + var inputNoteCountViewLength = inputNoteCountViewPoint[2]; + var inputNoteCountViewHeight = inputNoteCountViewPoint[3]; + + if (autoComputer?.IsHandling == true) + { + var statusValue = status.Value; + var targetInputCount = Component.Input1PCounts[(int)autoComputer.InputMode] * 6; + + if (targetInputCount > 0) + { + var inputNoteCountViewPaint = Configure.Instance.InputNoteCountViewPaint; + var inputNoteCounts = autoComputer.InputNoteCounts; + var inputNoteCountsCount = inputNoteCounts.Count; + var inputNoteCountsUnitLength = inputNoteCountViewLength / inputNoteCountsCount; + for (var i = inputNoteCountsCount - 1; i >= 0; --i) + { + var inputNoteCount = Math.Min(inputNoteCounts[i] * autoComputer.AudioMultiplier, targetInputCount); + if (inputNoteCount > 0.0) + { + r.Set(inputNoteCountViewPosition0 + inputNoteCountsUnitLength * i, inputNoteCountViewPosition1 + inputNoteCountViewHeight - inputNoteCountViewHeight * inputNoteCount / targetInputCount, inputNoteCountsUnitLength, inputNoteCountViewHeight * inputNoteCount / targetInputCount); + targetSession.DrawRectangle(inputNoteCountViewPaint, null, r); + } + } + + var autoableInputNoteCountViewPaint = Configure.Instance.AutoableInputNoteCountViewPaint; + var autoableInputNoteCounts = autoComputer.AutoableInputNoteCounts; + var autoableInputNoteCountsCount = autoableInputNoteCounts.Count; + var autoableInputNoteCountsUnitLength = inputNoteCountViewLength / autoableInputNoteCountsCount; + for (var i = autoableInputNoteCountsCount - 1; i >= 0; --i) + { + var autoableInputNoteCount = Math.Min(autoableInputNoteCounts[i] * autoComputer.AudioMultiplier, targetInputCount); + if (autoableInputNoteCount > 0.0) + { + r.Set(inputNoteCountViewPosition0 + autoableInputNoteCountsUnitLength * i, inputNoteCountViewPosition1 + inputNoteCountViewHeight - inputNoteCountViewHeight * autoableInputNoteCount / targetInputCount, autoableInputNoteCountsUnitLength, inputNoteCountViewHeight * autoableInputNoteCount / targetInputCount); + targetSession.DrawRectangle(autoableInputNoteCountViewPaint, null, r); + } + } + } + + var inputCount = autoComputer.InputCountQueue.Count; + if (statusValue > 0.0 && statusValue < 1.0) + { + p1.Set(inputNoteCountViewPosition0 + inputNoteCountViewLength * statusValue, inputNoteCountViewPosition1); + p2.Set(p1.X, p1.Y + inputNoteCountViewHeight); + targetSession.DrawLine(Paints.Pen4, p1, p2); + } + + var inputCountText = PoolSystem.Instance.GetValueText(inputCount, "NPS: 0/s"); + var defaultTextItem = PoolSystem.Instance.GetDefaultTextItem(inputCountText, Levels.FontLevel0, Paints.Paint4); + var defaultTextVisibleItem = PoolSystem.Instance.GetDefaultTextItem(inputCountText, Levels.FontLevel0, Paints.Paint0); + r.SetPosition(Levels.StandardMargin + inputNoteCountViewPosition0, Levels.StandardMargin + inputNoteCountViewPosition1); + targetSession.PaintVisibleText(defaultTextItem, defaultTextVisibleItem, ref r); + + var length = (int)(autoComputer.Length / 1000.0); + var wait = Math.Clamp((int)(autoComputer.LoopingCounter / 1000.0), 0, length); + inputCountText = PoolSystem.Instance.GetFormattedText("{0}:{1}/{2}:{3}", + PoolSystem.Instance.GetValueText(wait / 60, string.Empty), + PoolSystem.Instance.GetValueText(wait % 60, "00"), + PoolSystem.Instance.GetValueText(length / 60, string.Empty), + PoolSystem.Instance.GetValueText(length % 60, "00") + ); + defaultTextItem = PoolSystem.Instance.GetDefaultTextItem(inputCountText, Levels.FontLevel0, Paints.Paint4); + defaultTextVisibleItem = PoolSystem.Instance.GetDefaultTextItem(inputCountText, Levels.FontLevel0, Paints.Paint0); + r.SetPosition(inputNoteCountViewPosition0 + inputNoteCountViewLength - defaultTextItem.Width - Levels.StandardMargin, Levels.StandardMargin + inputNoteCountViewPosition1); + targetSession.PaintVisibleText(defaultTextItem, defaultTextVisibleItem, ref r); + } + } + } + else + { + r.SetArea(mainViewModel.DefaultLength, mainViewModel.DefaultHeight); + targetSession.DrawImage(DrawingSystem.Instance.D3D9Drawing, r); + } + } + } + + protected override void OnRender(DrawingContext dc) + { + base.OnRender(dc); + dc.DrawDrawing(_target); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/Layer1View.xaml b/Qwilight/Qwilight/View/MainWindow/Layer1View.xaml new file mode 100644 index 0000000..dd3b2d2 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/Layer1View.xaml @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/Layer1View.xaml.cs b/Qwilight/Qwilight/View/MainWindow/Layer1View.xaml.cs new file mode 100644 index 0000000..967af01 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/Layer1View.xaml.cs @@ -0,0 +1,155 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Media; + +namespace Qwilight.View +{ + public sealed partial class Layer1View + { + readonly DrawingGroup _target = new(); + readonly Stopwatch _loopingHandler = Stopwatch.StartNew(); + readonly string[] _textGCs = new string[QwilightComponent.HeapCount]; + double _distanceMillisMax = double.MinValue; + double _frametime = 0.0; + double _frameCount = 0; + string _framerate = string.Empty; + string _framerateLowest = string.Empty; + string _textHeap = string.Empty; + double _lastMillis = 0.0; + long _lastHeap = 0L; + double _distanceMillis = 0.0; + + public Layer1View() + { + Array.Fill(_textGCs, string.Empty); + InitializeComponent(); + + IsVisibleChanged += OnVisibilityModified; + } + + void OnVisibilityModified(object sender, DependencyPropertyChangedEventArgs e) + { + if ((bool)e.NewValue) + { + CompositionTarget.Rendering += OnPaint; + } + else + { + CompositionTarget.Rendering -= OnPaint; + } + } + + void OnPaint(object sender, object e) + { + var allowFramerate = TelnetSystem.Instance.IsAvailable; + using (var targetSession = _target.Open()) + { + var mainViewModel = (DataContext as MainViewModel); + var defaultLength = mainViewModel.DefaultLength; + var r = new Bound(); + + var fadingValue = mainViewModel.FadingValue; + var fadingStatus = fadingValue.Status; + + if (fadingStatus < 1.0) + { + if (mainViewModel.IsNoteFileMode) + { + var noteFile = mainViewModel.EntryItemValue?.NoteFile; + var autoComputer = mainViewModel.AutoComputer; + + foreach (var paintPropertyValue in BaseUI.Instance.PaintPropertyValues) + { + if (paintPropertyValue?.Layer == 1) + { + paintPropertyValue.Paint(targetSession, noteFile, autoComputer, _distanceMillis); + } + } + } + } + + if (fadingStatus > 0.0) + { + var fadingComputer = mainViewModel.FadingViewComputer; + var fadingPropertyValue = BaseUI.Instance.FadingPropertyValues[(int)mainViewModel.ModeValue]?[fadingValue.Layer]; + var fadingPropertyFrame = fadingPropertyValue?.Frame ?? 0; + if (fadingPropertyFrame > 0) + { + var defaultHeight = mainViewModel.DefaultHeight; + if (fadingPropertyValue.DrawingStatus <= fadingStatus) + { + var fadingViewDrawing = (fadingComputer?.NoteHandledDrawingItem ?? DrawingSystem.Instance.DefaultDrawing).DefaultDrawing; + if (fadingViewDrawing != null) + { + r.SetArea(defaultLength, defaultHeight); + targetSession.DrawRectangle(Paints.Paint0, null, r); + Utility.SetFilledMediaDrawing(ref r, Configure.Instance.IsMediaFill, fadingViewDrawing.Width, fadingViewDrawing.Height, 0.0, 0.0, defaultLength, defaultHeight); + targetSession.PaintDrawing(ref r, fadingViewDrawing); + } + } + r.SetArea(defaultLength, defaultHeight); + targetSession.PaintDrawing(ref r, fadingPropertyValue.HandledDrawingItems[(int)Math.Floor(fadingStatus * (fadingPropertyFrame - 1))]?.DefaultDrawing); + } + } + + if (allowFramerate) + { + r.SetPosition(Levels.StandardMarginFloat32, Levels.StandardMarginFloat32); + + var textItem = PoolSystem.Instance.GetDefaultTextItem(_framerate, Levels.FontLevel0, Paints.Paint1); + targetSession.PaintText(textItem, ref r); + r.Position1 += (float)(textItem.Height + Levels.StandardMarginFloat32); + + textItem = PoolSystem.Instance.GetDefaultTextItem(_framerateLowest, Levels.FontLevel0, Paints.Paint1); + targetSession.PaintText(textItem, ref r); + r.Position1 += (float)(textItem.Height + Levels.StandardMarginFloat32); + + for (var i = 0; i < QwilightComponent.HeapCount; ++i) + { + textItem = PoolSystem.Instance.GetDefaultTextItem(_textGCs[i], Levels.FontLevel0, Paints.Paint1); + targetSession.PaintText(textItem, ref r); + r.Position1 += (float)(textItem.Height + Levels.StandardMarginFloat32); + } + + textItem = PoolSystem.Instance.GetDefaultTextItem(_textHeap, Levels.FontLevel0, Paints.Paint1); + targetSession.PaintText(textItem, ref r); + } + } + + var millis = _loopingHandler.GetMillis(); + _distanceMillis = millis - _lastMillis; + _lastMillis = millis; + + if (allowFramerate) + { + _distanceMillisMax = Math.Max(_distanceMillisMax, _distanceMillis); + ++_frameCount; + _frametime += _distanceMillis; + if (_frametime >= 1000.0) + { + _framerate = PoolSystem.Instance.GetValueText(Math.Round(1000.0 * _frameCount / _frametime), "0 frame/s"); + _framerateLowest = PoolSystem.Instance.GetValueText(Math.Round(1000.0 / _distanceMillisMax), "0 frame/s (\\0% Low)"); + _frameCount = 0; + _frametime = 0.0; + _distanceMillisMax = 0.0; + for (var i = 0; i < QwilightComponent.HeapCount; ++i) + { + _textGCs[i] = PoolSystem.Instance.GetFormattedText("GC{0} {1}", PoolSystem.Instance.GetValueText(i, string.Empty), PoolSystem.Instance.GetValueText(GC.CollectionCount(i), string.Empty)); + } + var valueHeap = GC.GetTotalMemory(false); + var distanceHeap = valueHeap - _lastHeap; + _textHeap = PoolSystem.Instance.GetFormattedText("Heap {0} ({1}{2}/s)", PoolSystem.Instance.GetFormattedUnitText(valueHeap), distanceHeap >= 0 ? "+" : "-", PoolSystem.Instance.GetFormattedUnitText(Math.Abs(distanceHeap))); + _lastHeap = valueHeap; + } + } + } + + protected override void OnRender(DrawingContext dc) + { + base.OnRender(dc); + dc.DrawDrawing(_target); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/LoadingView.xaml b/Qwilight/Qwilight/View/MainWindow/LoadingView.xaml new file mode 100644 index 0000000..e14cd4c --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/LoadingView.xaml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/LoadingView.xaml.cs b/Qwilight/Qwilight/View/MainWindow/LoadingView.xaml.cs new file mode 100644 index 0000000..c227187 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/LoadingView.xaml.cs @@ -0,0 +1,38 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using System.Windows; +using System.Windows.Media.Animation; + +namespace Qwilight.View +{ + public sealed partial class LoadingView : IRecipient + { + public LoadingView() + { + InitializeComponent(); + WeakReferenceMessenger.Default.Register(this); + } + + public void Receive(ICC message) + { + switch (message.IDValue) + { + case ICC.ID.FadingLoadingView: + HandlingUISystem.Instance.HandleParallel(() => + { + var fadingElement = new DoubleAnimation + { + To = 0.0 + }; + var fadingComputer = new Storyboard(); + fadingComputer.Children.Add(fadingElement); + Storyboard.SetTarget(fadingElement, this); + Storyboard.SetTargetProperty(fadingElement, new PropertyPath(OpacityProperty)); + fadingComputer.Completed += (sender, e) => Visibility = Visibility.Collapsed; + fadingComputer.Begin(); + }); + break; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/MainWindow.xaml b/Qwilight/Qwilight/View/MainWindow/MainWindow.xaml new file mode 100644 index 0000000..d814a14 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/MainWindow.xaml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/MainWindow.xaml.cs b/Qwilight/Qwilight/View/MainWindow/MainWindow.xaml.cs new file mode 100644 index 0000000..4e5a094 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/MainWindow.xaml.cs @@ -0,0 +1,492 @@ +using CommunityToolkit.Mvvm.Messaging; +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.UI.Xaml; +using Microsoft.UI; +using Microsoft.UI.Composition.SystemBackdrops; +using Microsoft.UI.Content; +using Microsoft.UI.Input; +using Microsoft.UI.Xaml.Hosting; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Qwilight.Compute; +using Qwilight.ViewModel; +using System.Runtime.InteropServices; +using System.Windows.Input; +using System.Windows.Interop; +using Windows.Foundation; +using Windows.Graphics; +using Windows.Storage.Pickers; +using Windows.Win32; +using Windows.Win32.Foundation; +using Windows.Win32.Graphics.Dwm; +using Windows.Win32.UI.WindowsAndMessaging; +using WinRT.Interop; +using DragEventArgs = System.Windows.DragEventArgs; +using KeyEventArgs = System.Windows.Input.KeyEventArgs; +using ResizeMode = System.Windows.ResizeMode; +using UIElement = Microsoft.UI.Xaml.UIElement; +using WindowState = System.Windows.WindowState; +using WindowStyle = System.Windows.WindowStyle; + +namespace Qwilight.View +{ + public sealed partial class MainWindow : IRecipient + { + [LibraryImport("NVIDIA")] + private static partial void NotifyNVLL(uint statsWindowMessage); + + readonly HWND _handle; + readonly WNDPROC _onWin32; + readonly Dictionary _pointIDPointPositionMap = new(); + readonly DesktopWindowXamlSource _windowXamlView = new(); + readonly DesktopChildSiteBridge _siteView; + readonly CanvasSwapChainPanel _d2DView; + + public MainWindow() + { + InitializeComponent(); + + _handle = (HWND)new WindowInteropHelper(this).EnsureHandle(); + _windowXamlView.Initialize(Win32Interop.GetWindowIdFromWindow(_handle)); + _d2DView = new CanvasSwapChainPanel(); + _d2DView.PointerPressed += OnD2DPointLower; + _d2DView.PointerMoved += OnD2DPointMove; + _d2DView.PointerReleased += OnD2DPointHigher; + _d2DView.PointerEntered += OnD2DPointEnter; + _d2DView.PointerExited += OnD2DPointExit; + _d2DView.PointerWheelChanged += OnD2DPointSpin; + _windowXamlView.Content = _d2DView; + _windowXamlView.SystemBackdrop = new MicaBackdrop + { + Kind = MicaKind.BaseAlt + }; + _siteView = _windowXamlView.SiteBridge; + SetD2DViewVisibility(false); + + var pvAttribute = 1; + unsafe + { + PInvoke.DwmSetWindowAttribute(_handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, &pvAttribute, sizeof(int)); + } + + var windowInfo = new WINDOWINFO(); + PInvoke.GetWindowInfo(_handle, ref windowInfo); + var windowDPI = PInvoke.GetDpiForWindow(_handle) / 96.0; + var windowPosition0 = Configure.Instance.WindowPosition0V2; + var windowPosition1 = Configure.Instance.WindowPosition1V2; + var windowLength = (int)(windowDPI * Configure.Instance.WindowLengthV2 + (windowInfo.rcWindow.right - windowInfo.rcWindow.left) - (windowInfo.rcClient.right - windowInfo.rcClient.left)); + var windowHeight = (int)(windowDPI * Configure.Instance.WindowHeightV2 + (windowInfo.rcWindow.bottom - windowInfo.rcWindow.top) - (windowInfo.rcClient.bottom - windowInfo.rcClient.top)); + if (windowPosition0 <= -windowLength) + { + windowPosition0 = 0; + } + if (windowPosition1 <= -windowHeight) + { + windowPosition1 = 0; + } + PInvoke.SetWindowPos(_handle, HWND.Null, windowPosition0, windowPosition1, windowLength, windowHeight, SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE); + +#if DEBUG + PInvoke.SetWindowText(_handle, "Qwilight α"); +#else + PInvoke.SetWindowText(_handle, QwilightComponent.IsVS ? "Qwilight β" : "Qwilight"); +#endif + + var mainViewModel = ViewModels.Instance.MainValue; + WNDPROC lpPrevWndFunc = null; + unsafe + { + _onWin32 = (hWnd, Msg, wParam, lParam) => + { + switch (Msg) + { + case PInvoke.WM_CLOSE: + if (wParam != 0 && PInvoke.MessageBox(_handle, LanguageSystem.Instance.QuitContents, LanguageSystem.Instance.QuitText, MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON2) != MESSAGEBOX_RESULT.IDYES) + { + return (LRESULT)0; + } + break; + case PInvoke.WM_DESTROY: + mainViewModel.Close(); + break; + case PInvoke.WM_SIZE when lParam != 0: + mainViewModel.OnModified(); + break; + case PInvoke.WM_MOVE: + mainViewModel.OnMove(); + break; + case PInvoke.WM_DPICHANGED: + mainViewModel.OnWindowDPIModified(PInvoke.GetDpiForWindow(_handle) / 96.0); + break; + case PInvoke.WM_ACTIVATE: + var wa = wParam & 65535; + mainViewModel.OnSetPoint(wa != 0); + break; + default: + if (Configure.Instance.IsNVLL) + { + NotifyNVLL(Msg); + } + break; + } + return PInvoke.CallWindowProc(lpPrevWndFunc, hWnd, Msg, wParam, lParam); + }; + } + lpPrevWndFunc = Marshal.GetDelegateForFunctionPointer(PInvoke.SetWindowLongPtr(_handle, WINDOW_LONG_PTR_INDEX.GWLP_WNDPROC, Marshal.GetFunctionPointerForDelegate(_onWin32))); + + WeakReferenceMessenger.Default.Register(this); + } + + void OnEssentialInputLower(object sender, KeyEventArgs e) => ViewModels.Instance.MainValue.OnEssentialInputLower(e); + + void OnInputLower(object sender, KeyEventArgs e) => ViewModels.Instance.MainValue.OnInputLower(e); + + void OnPointLower(object sender, MouseButtonEventArgs e) => ViewModels.Instance.MainValue.OnPointLower(e); + + void OnFileAs(object sender, DragEventArgs e) => ViewModels.Instance.MainValue.OnFileAs(e); + + void OnLoaded(object sender, EventArgs e) + { + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.OnWindowDPIModified(PInvoke.GetDpiForWindow(_handle) / 96.0); + mainViewModel.OnLoaded(_handle); + } + + public async void Receive(ICC message) + { + switch (message.IDValue) + { + case ICC.ID.ViewAllowWindow: + var data = message.Contents as object[]; + (data[2] as Action)(PInvoke.MessageBox(_handle, data[0] as string, "Qwilight", (MESSAGEBOX_STYLE)data[1])); + break; + case ICC.ID.ViewEntryWindow: + var fp = new FolderPicker(); + InitializeWithWindow.Initialize(fp, _handle); + fp.FileTypeFilter.Add("*"); + var entry = await fp.PickSingleFolderAsync(); + if (entry != null) + { + (message.Contents as Action)(entry.Path); + } + break; + case ICC.ID.ViewFileWindow: + data = message.Contents as object[]; + var fop = new FileOpenPicker(); + InitializeWithWindow.Initialize(fop, _handle); + foreach (var dataItem in data[0] as IEnumerable) + { + fop.FileTypeFilter.Add(dataItem); + } + if (fop.FileTypeFilter.Count == 0) + { + fop.FileTypeFilter.Add("*"); + } + var file = await fop.PickSingleFileAsync(); + if (file != null) + { + (data[1] as Action)(file.Path); + } + break; + case ICC.ID.Quit: + PInvoke.PostMessage(_handle, PInvoke.WM_CLOSE, (bool)message.Contents ? (WPARAM)1 : (WPARAM)0, (LPARAM)0); + break; + case ICC.ID.ViewPwWindow: + data = message.Contents as object[]; + ViewModels.Instance.InputPwValue.Text = data[0] as string; + ViewModels.Instance.InputPwValue.Input = data[1] as string; + ViewModels.Instance.InputPwValue.IsInputEditable = (bool)data[2]; + ViewModels.Instance.InputPwValue.Handler = data[3] as Action; + ViewModels.Instance.InputPwValue.Open(); + break; + case ICC.ID.ViewInputWindow: + data = message.Contents as object[]; + ViewModels.Instance.InputTextValue.Text = data[0] as string; + ViewModels.Instance.InputTextValue.Input = data[1] as string; + ViewModels.Instance.InputTextValue.Handler = data[2] as Action; + ViewModels.Instance.InputTextValue.Open(); + break; + case ICC.ID.SetWindowedMode: + HandlingUISystem.Instance.HandleParallel(() => + { + if (Configure.Instance.WindowedMode) + { + ResizeMode = ResizeMode.CanResize; + WindowStyle = WindowStyle.SingleBorderWindow; + WindowState = WindowState.Normal; + } + else + { + ResizeMode = ResizeMode.NoResize; + WindowStyle = WindowStyle.None; + WindowState = WindowState.Maximized; + } + }); + break; + case ICC.ID.SetWindowArea: + var windowInfo = new WINDOWINFO + { + cbSize = (uint)Marshal.SizeOf() + }; + PInvoke.GetWindowInfo(_handle, ref windowInfo); + var windowDPI = PInvoke.GetDpiForWindow(_handle) / 96.0; + PInvoke.SetWindowPos(_handle, HWND.Null, 0, 0, + (int)(windowDPI * Configure.Instance.WindowLengthV2 + (windowInfo.rcWindow.right - windowInfo.rcWindow.left) - (windowInfo.rcClient.right - windowInfo.rcClient.left)), + (int)(windowDPI * Configure.Instance.WindowHeightV2 + (windowInfo.rcWindow.bottom - windowInfo.rcWindow.top) - (windowInfo.rcClient.bottom - windowInfo.rcClient.top)), + SET_WINDOW_POS_FLAGS.SWP_NOMOVE + ); + break; + case ICC.ID.GetWindowArea: + { + var windowArea = GetWindowArea(); + (message.Contents as Action)(windowArea.X, windowArea.Y, windowArea.Width, windowArea.Height); + } + break; + case ICC.ID.GetWindowHandle: + (message.Contents as Action)(_handle); + break; + case ICC.ID.SetD2DView: + HandlingUISystem.Instance.HandleParallel(() => _d2DView.SwapChain = message.Contents as CanvasSwapChain); + break; + case ICC.ID.SetD2DViewArea: + HandlingUISystem.Instance.HandleParallel(() => + { + var windowArea = GetWindowArea(); + var windowAreaLength = windowArea.Width; + var windowAreaHeight = windowArea.Height; + var defaultLength = _d2DView.SwapChain.Size.Width; + var defaultHeight = _d2DView.SwapChain.Size.Height; + var windowDPI = PInvoke.GetDpiForWindow(_handle) / 96.0; + if (Configure.Instance.IsQwilightFill) + { + _d2DView.Width = windowAreaLength / windowDPI; + _d2DView.Height = windowAreaHeight / windowDPI; + } + else + { + if (defaultLength / windowAreaLength > defaultHeight / windowAreaHeight) + { + _d2DView.Width = windowAreaLength / windowDPI; + _d2DView.Height = (windowAreaLength * defaultHeight / defaultLength) / windowDPI; + } + else + { + _d2DView.Width = (windowAreaHeight * defaultLength / defaultHeight) / windowDPI; + _d2DView.Height = windowAreaHeight / windowDPI; + } + } + _siteView.MoveAndResize(new RectInt32(0, 0, windowAreaLength, windowAreaHeight)); + }); + break; + case ICC.ID.SetD2DViewVisibility: + HandlingUISystem.Instance.HandleParallel(() => SetD2DViewVisibility((bool)message.Contents)); + break; + } + } + + void SetD2DViewVisibility(bool isVisible) + { + if (isVisible) + { + _siteView.Enable(); + _siteView.Show(); + } + else + { + _siteView.Hide(); + _siteView.Disable(); + } + } + + void OnD2DPointLower(object sender, PointerRoutedEventArgs e) + { + try + { + var point = e.GetCurrentPoint(sender as UIElement); + DrawingSystem.Instance.LastPointedQueue.Enqueue((GetPointPosition(point.Position), point.Properties.IsRightButtonPressed)); + } + catch (COMException) + { + } + } + + void OnD2DPointMove(object sender, PointerRoutedEventArgs e) + { + var mainViewModel = ViewModels.Instance.MainValue; + try + { + var point = e.GetCurrentPoint(sender as UIElement); + var pointPosition = GetPointPosition(point.Position); + if (point.PointerDeviceType == PointerDeviceType.Touch) + { + var pointID = point.PointerId; + var lastPointPosition = _pointIDPointPositionMap[pointID]; + _pointIDPointPositionMap[pointID] = pointPosition; + var defaultComputer = mainViewModel.Computer; + var lastInput = GetInput(lastPointPosition, defaultComputer); + var input = GetInput(pointPosition, defaultComputer); + if (lastInput != input) + { + if (lastInput > 0) + { + defaultComputer.Input(-lastInput, DefaultCompute.InputFlag.Pointer); + } + if (input > 0) + { + defaultComputer.Input(input, DefaultCompute.InputFlag.Pointer); + } + } + } + DrawingSystem.Instance.LastMovedQueue.Enqueue(pointPosition); + } + catch (COMException) + { + } + } + + void OnD2DPointHigher(object sender, PointerRoutedEventArgs e) + { + try + { + DrawingSystem.Instance.LastNotPointedQueue.Enqueue(GetPointPosition(e.GetCurrentPoint(sender as UIElement).Position)); + } + catch (COMException) + { + } + } + + void OnD2DPointEnter(object sender, PointerRoutedEventArgs e) + { + try + { + var point = e.GetCurrentPoint(sender as UIElement); + if (point.PointerDeviceType == PointerDeviceType.Touch) + { + var pointPosition = GetPointPosition(point.Position); + _pointIDPointPositionMap[point.PointerId] = pointPosition; + var defaultComputer = ViewModels.Instance.MainValue.Computer; + var input = GetInput(pointPosition, defaultComputer); + if (input > 0) + { + defaultComputer.Input(input, DefaultCompute.InputFlag.Pointer); + } + } + } + catch (COMException) + { + } + } + + void OnD2DPointExit(object sender, PointerRoutedEventArgs e) + { + try + { + var point = e.GetCurrentPoint(sender as UIElement); + if (point.PointerDeviceType == PointerDeviceType.Touch) + { + _pointIDPointPositionMap.Remove(point.PointerId); + var defaultComputer = ViewModels.Instance.MainValue.Computer; + var input = GetInput(GetPointPosition(point.Position), defaultComputer); + if (input > 0) + { + defaultComputer.Input(-input, DefaultCompute.InputFlag.Pointer); + } + } + } + catch (COMException) + { + } + } + + static int GetInput(Point pointPosition, DefaultCompute defaultComputer) + { + var drawingComponentValue = defaultComputer.DrawingComponentValue; + var p1BuiltLength = drawingComponentValue.p1BuiltLength; + var positionX = pointPosition.X - drawingComponentValue.mainPosition; + var inputMode = defaultComputer.InputMode; + var input1PCount = defaultComputer.Input1PCount; + var mainNoteLengthLevyingMap = drawingComponentValue.MainNoteLengthLevyingMap; + var mainNoteLengthBuiltMap = drawingComponentValue.MainNoteLengthBuiltMap; + if (0.0 <= positionX && positionX < p1BuiltLength) + { + for (var input = input1PCount; input > 0; --input) + { + if (mainNoteLengthLevyingMap[input] <= positionX && positionX < mainNoteLengthBuiltMap[input]) + { + return input; + } + } + } + else if (defaultComputer.Has2P) + { + positionX -= drawingComponentValue.p2Position; + var inputCount = Component.InputCounts[(int)inputMode]; + if (p1BuiltLength <= positionX && positionX < drawingComponentValue.p2BuiltLength) + { + for (var input = inputCount; input > input1PCount; --input) + { + if (mainNoteLengthLevyingMap[input] <= positionX && positionX < mainNoteLengthBuiltMap[input]) + { + return input; + } + } + } + } + return 0; + } + + Point GetPointPosition(Point point) + { + var windowDPI = PInvoke.GetDpiForWindow(_handle) / 96.0; + var windowArea = GetWindowArea(); + var windowAreaLength = windowArea.Width; + var windowAreaHeight = windowArea.Height; + var d2DArea = _d2DView.SwapChain.Size; + var d2DAreaLength = d2DArea.Width; + var d2DAreaHeight = d2DArea.Height; + if (Configure.Instance.IsQwilightFill) + { + return new Point(point.X * d2DAreaLength * windowDPI / windowAreaLength, point.Y * d2DAreaHeight * windowDPI / windowAreaHeight); + } + else + { + if (d2DAreaLength / windowAreaLength > d2DAreaHeight / windowAreaHeight) + { + return new Point(point.X * d2DAreaLength * windowDPI / windowAreaLength, point.Y * d2DAreaLength * windowDPI / windowAreaLength); + } + else + { + return new Point(point.X * d2DAreaHeight * windowDPI / windowAreaHeight, point.Y * d2DAreaHeight * windowDPI / windowAreaHeight); + } + } + } + + void OnD2DPointSpin(object sender, PointerRoutedEventArgs e) + { + var mainViewModel = ViewModels.Instance.MainValue; + var pointProperties = e.GetCurrentPoint(sender as UIElement).Properties; + var isHigher = pointProperties.MouseWheelDelta > 0; + if (!pointProperties.IsHorizontalMouseWheel && mainViewModel.Computer.IsPausingWindowOpened) + { + if (isHigher) + { + mainViewModel.HigherDefaultSpinningMode(); + } + else + { + mainViewModel.LowerDefaultSpinningMode(); + } + } + } + + RectInt32 GetWindowArea() + { + var windowInfo = new WINDOWINFO + { + cbSize = (uint)Marshal.SizeOf() + }; + PInvoke.GetWindowInfo(_handle, ref windowInfo); + return new RectInt32(windowInfo.rcClient.left, windowInfo.rcClient.top, windowInfo.rcClient.right - windowInfo.rcClient.left, windowInfo.rcClient.bottom - windowInfo.rcClient.top); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/WPFView.xaml b/Qwilight/Qwilight/View/MainWindow/WPFView.xaml new file mode 100644 index 0000000..dbbf885 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/WPFView.xaml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/MainWindow/WPFView.xaml.cs b/Qwilight/Qwilight/View/MainWindow/WPFView.xaml.cs new file mode 100644 index 0000000..8e79693 --- /dev/null +++ b/Qwilight/Qwilight/View/MainWindow/WPFView.xaml.cs @@ -0,0 +1,58 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using Qwilight.ViewModel; +using System.Windows; +using System.Windows.Controls; + +namespace Qwilight.View +{ + public partial class WPFView : IRecipient + { + public WPFView() + { + InitializeComponent(); + WeakReferenceMessenger.Default.Register(this); + } + + public void Receive(ICC message) + { + switch (message.IDValue) + { + case ICC.ID.GetWPFView: + (message.Contents as Action)(this); + break; + case ICC.ID.PointZMaxView: + HandlingUISystem.Instance.HandleParallel(() => + { + var mainViewModel = DataContext as MainViewModel; + if (mainViewModel.IsWPFViewVisible) + { + var zMaxValue = int.MinValue; + UIElement zMaxView = null; + foreach (UIElement windowView in WindowViews.Children) + { + var zValue = Canvas.GetZIndex(windowView); + if (windowView.Visibility == Visibility.Visible && zMaxValue < zValue) + { + zMaxValue = zValue; + zMaxView = windowView; + } + } + if (zMaxView != null) + { + if (mainViewModel.HasPoint) + { + zMaxView.Focus(); + } + } + else + { + mainViewModel.PointEntryView(); + } + } + }); + break; + } + } + } +} diff --git a/Qwilight/Qwilight/View/ModifyDefaultEntryWindow.xaml b/Qwilight/Qwilight/View/ModifyDefaultEntryWindow.xaml new file mode 100644 index 0000000..d507c97 --- /dev/null +++ b/Qwilight/Qwilight/View/ModifyDefaultEntryWindow.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/ModifyModeComponentWindow.xaml.cs b/Qwilight/Qwilight/View/ModifyModeComponentWindow.xaml.cs new file mode 100644 index 0000000..069bd6c --- /dev/null +++ b/Qwilight/Qwilight/View/ModifyModeComponentWindow.xaml.cs @@ -0,0 +1,12 @@ +using Qwilight.ViewModel; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class ModifyModeComponentWindow + { + public ModifyModeComponentWindow() => InitializeComponent(); + + void OnPointLower(object sender, MouseButtonEventArgs e) => (DataContext as ModifyModeComponentViewModel).OnPointLower(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/NetSiteCommentWindow.xaml b/Qwilight/Qwilight/View/NetSiteCommentWindow.xaml new file mode 100644 index 0000000..47c82bc --- /dev/null +++ b/Qwilight/Qwilight/View/NetSiteCommentWindow.xaml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/NetSiteCommentWindow.xaml.cs b/Qwilight/Qwilight/View/NetSiteCommentWindow.xaml.cs new file mode 100644 index 0000000..5e1ffab --- /dev/null +++ b/Qwilight/Qwilight/View/NetSiteCommentWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class NetSIteCommentWindow + { + public NetSIteCommentWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/NoteFileWindow.xaml b/Qwilight/Qwilight/View/NoteFileWindow.xaml new file mode 100644 index 0000000..4daf276 --- /dev/null +++ b/Qwilight/Qwilight/View/NoteFileWindow.xaml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/NoteFileWindow.xaml.cs b/Qwilight/Qwilight/View/NoteFileWindow.xaml.cs new file mode 100644 index 0000000..63317b7 --- /dev/null +++ b/Qwilight/Qwilight/View/NoteFileWindow.xaml.cs @@ -0,0 +1,22 @@ +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class NoteFileWindow + { + public NoteFileWindow() => InitializeComponent(); + + void OnPointLower(object sender, MouseButtonEventArgs e) => (DataContext as NoteFileViewModel).OnPointLower(); + + void OnViewItems(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + Utility.ViewItems(sender as FrameworkElement); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/NotifyWindow.xaml b/Qwilight/Qwilight/View/NotifyWindow.xaml new file mode 100644 index 0000000..ea72d7f --- /dev/null +++ b/Qwilight/Qwilight/View/NotifyWindow.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/PutNoteSetWindow.xaml.cs b/Qwilight/Qwilight/View/PutNoteSetWindow.xaml.cs new file mode 100644 index 0000000..11b17b3 --- /dev/null +++ b/Qwilight/Qwilight/View/PutNoteSetWindow.xaml.cs @@ -0,0 +1,14 @@ +using Qwilight.ViewModel; +using System.Windows; + +namespace Qwilight.View +{ + public sealed partial class PutNoteSetWindow + { + public PutNoteSetWindow() => InitializeComponent(); + + void OnMeterModified(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as PutNoteSetViewModel).OnMeterModified(); + + void OnSetMeter(object sender, RoutedEventArgs e) => (DataContext as PutNoteSetViewModel).OnMeterModified(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/QwilightClass.xaml b/Qwilight/Qwilight/View/QwilightClass.xaml new file mode 100644 index 0000000..9a592fa --- /dev/null +++ b/Qwilight/Qwilight/View/QwilightClass.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/QwilightClass.xaml.cs b/Qwilight/Qwilight/View/QwilightClass.xaml.cs new file mode 100644 index 0000000..6bd8cbd --- /dev/null +++ b/Qwilight/Qwilight/View/QwilightClass.xaml.cs @@ -0,0 +1,199 @@ +using Ionic.Zip; +using Microsoft.UI.Dispatching; +using Microsoft.UI.Xaml; +using Microsoft.Win32; +using Microsoft.Windows.ApplicationModel.DynamicDependency; +using Qwilight.Utilities; +using System.Collections.Concurrent; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Runtime; +using System.Runtime.InteropServices; +using System.Text; +using Windows.Win32; +using Windows.Win32.Foundation; +using Windows.Win32.UI.WindowsAndMessaging; +using SplashScreen = System.Windows.SplashScreen; +using StartupEventArgs = System.Windows.StartupEventArgs; + +namespace Qwilight.View +{ + public sealed partial class QwilightClass + { + static SplashScreen _wpfLoadingAsset = new SplashScreen("Assets/Drawing/Loading.png"); + + [STAThread] + static void Main() + { + #region COMPATIBLE + Compatible.Compatible.Qwilight(QwilightComponent.QwilightEntryPath); + #endregion + + GPUConfigure.Instance.Load(); + switch (GPUConfigure.Instance.GPUModeValue) + { + case GPUConfigure.GPUMode.NVIDIA: + NativeLibrary.TryLoad("nvapi64", out _); + break; + } + _wpfLoadingAsset.Show(true, true); + +#if DEBUG + Environment.SetEnvironmentVariable("ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO", "1"); +#endif + Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", QwilightComponent.EdgeEntryPath); + + ProfileOptimization.SetProfileRoot(QwilightComponent.QwilightEntryPath); + ProfileOptimization.StartProfile("Qwilight.$"); + + if (!Bootstrap.TryInitialize(65540U, out _)) + { +#if X64 + using var exe = Process.Start(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "windowsappruntimeinstall-x64.exe")); +#else + using var exe = Process.Start(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "windowsappruntimeinstall-arm64.exe")); +#endif + exe.WaitForExit(); + Bootstrap.Initialize(65540U, null, default, Bootstrap.InitializeOptions.OnNoMatch_ShowUI); + } + + try + { + using (var r = Registry.LocalMachine.OpenSubKey("SOFTWARE")?.OpenSubKey("WOW6432Node")?.OpenSubKey("Microsoft")?.OpenSubKey("EdgeUpdate")?.OpenSubKey("Clients")?.OpenSubKey("{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}")) + { + if (string.IsNullOrEmpty(r?.GetValue("pv") as string)) + { + using var exe = Process.Start(Path.Combine(QwilightComponent.AssetsEntryPath, "MicrosoftEdgeWebview2Setup.exe")); + exe.WaitForExit(); + } + } + } + catch + { + } + + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + PInvoke.timeBeginPeriod(1); + Thread.CurrentThread.Priority = ThreadPriority.Highest; + ThreadPool.GetMaxThreads(out var tw, out var tIOCP); + ThreadPool.SetMinThreads(tw, tIOCP); + + Application.Start(p => + { + SynchronizationContext.SetSynchronizationContext(new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread())); + try + { + new QwilightClass().Run(); + } + finally + { + Application.Current.Exit(); + } + }); + } + + readonly ConcurrentDictionary _handledFaultMap = new(); + + async void OnUnhandledFault(Exception e) + { + if (_handledFaultMap.TryAdd(e, null)) + { + var (logFilePath, faultText) = Utility.SetFault(QwilightComponent.FaultEntryPath, e); + PInvoke.MessageBox(HWND.Null, e.Message, "Qwilight", MESSAGEBOX_STYLE.MB_OK | MESSAGEBOX_STYLE.MB_ICONERROR); + Utility.OpenAs(logFilePath); + await TwilightSystem.Instance.PostWwwParallel($"{QwilightComponent.QwilightAPI}/fault", faultText); + } + } + + public QwilightClass() => InitializeComponent(); + + protected override void OnStartup(StartupEventArgs e) + { + AppContext.SetSwitch("MVVMTOOLKIT_DISABLE_INOTIFYPROPERTYCHANGING", true); + + AppDomain.CurrentDomain.UnhandledException += (sender, e) => + { + var fault = e.ExceptionObject as Exception; + if (!(fault is Win32Exception && (fault as Win32Exception).NativeErrorCode == 1400)) + { + OnUnhandledFault(fault); + } + }; + HandlingUISystem.Instance.Init(OnUnhandledFault); + + QwilightComponent.OnGetBuiltInData = data => TryFindResource(data); + + try + { + Directory.CreateDirectory(QwilightComponent.BundleEntryPath); + Directory.CreateDirectory(QwilightComponent.CommentEntryPath); + Directory.CreateDirectory(QwilightComponent.EdgeEntryPath); + Directory.CreateDirectory(QwilightComponent.FaultEntryPath); + Directory.CreateDirectory(QwilightComponent.MediaEntryPath); + Directory.CreateDirectory(LevelSystem.EntryPath); + } + catch + { + PInvoke.MessageBox(HWND.Null, $"Cannot run Qwilight from {QwilightComponent.QwilightEntryPath}", "Qwilight", MESSAGEBOX_STYLE.MB_OK | MESSAGEBOX_STYLE.MB_ICONERROR); + Environment.Exit(1); + } + + PIDClass.Instance.HaveIt(_wpfLoadingAsset); + + Utility.CopyEntry(Path.Combine(QwilightComponent.AssetsEntryPath, "UI"), Path.Combine(QwilightComponent.UIEntryPath)); + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.common.dll"), Path.Combine(AppContext.BaseDirectory, "sl.common.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.interposer.dll"), Path.Combine(AppContext.BaseDirectory, "sl.interposer.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "sl.reflex.dll"), Path.Combine(AppContext.BaseDirectory, "sl.reflex.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "NVIDIA.dll"), Path.Combine(AppContext.BaseDirectory, "NVIDIA.dll")); + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "CChromaEditorLibrary64.dll"), Path.Combine(AppContext.BaseDirectory, "CChromaEditorLibrary64.dll")); + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "fmod.dll"), Path.Combine(AppContext.BaseDirectory, "fmod.dll")); + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "LogitechLedEnginesWrapper.dll"), Path.Combine(AppContext.BaseDirectory, "LogitechLedEnginesWrapper.dll")); + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "concrt140_app.dll"), Path.Combine(AppContext.BaseDirectory, "concrt140_app.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "msvcp140_1_app.dll"), Path.Combine(AppContext.BaseDirectory, "msvcp140_1_app.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "msvcp140_2_app.dll"), Path.Combine(AppContext.BaseDirectory, "msvcp140_2_app.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "msvcp140_app.dll"), Path.Combine(AppContext.BaseDirectory, "msvcp140_app.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "vcamp140_app.dll"), Path.Combine(AppContext.BaseDirectory, "vcamp140_app.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "vccorlib140_app.dll"), Path.Combine(AppContext.BaseDirectory, "vccorlib140_app.dll")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "vcomp140_app.dll"), Path.Combine(AppContext.BaseDirectory, "vcomp140_app.dll")); +#if X64 + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "vcruntime140_1_app.dll"), Path.Combine(AppContext.BaseDirectory, "vcruntime140_1_app.dll")); +#endif + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "vcruntime140_app.dll"), Path.Combine(AppContext.BaseDirectory, "vcruntime140_app.dll")); + + if (QwilightComponent.IsValve) + { + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "steam_api64.dll"), Path.Combine(AppContext.BaseDirectory, "steam_api64.dll")); + } + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "ffmpeg.exe"), Path.Combine(QwilightComponent.SoftwareEntryPath, "ffmpeg.exe")); + + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "Flint.exe"), Path.Combine(QwilightComponent.SoftwareEntryPath, "Flint.exe")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "Igniter.exe"), Path.Combine(QwilightComponent.SoftwareEntryPath, "Igniter.exe")); + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "Xwindow.exe"), Path.Combine(QwilightComponent.SoftwareEntryPath, "Xwindow.exe")); + + var qwilightBundleFilePath = Path.Combine(QwilightComponent.QwilightEntryPath, "Qwilight.zip"); + if (File.Exists(qwilightBundleFilePath)) + { + using (var zipFile = new ZipFile(qwilightBundleFilePath)) + { + zipFile.ExtractAll(QwilightComponent.QwilightEntryPath, ExtractExistingFileAction.OverwriteSilently); + } + Utility.WipeFile(qwilightBundleFilePath); + } + + Configure.Instance.Load(); + LanguageSystem.Instance.Init(Configure.Instance.Language); + DB.Instance.Load(); + FastDB.Instance.Load(); + AudioSystem.Instance.Init(); + + _wpfLoadingAsset = null; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/SignInWindow.xaml b/Qwilight/Qwilight/View/SignInWindow.xaml new file mode 100644 index 0000000..a7ecc6b --- /dev/null +++ b/Qwilight/Qwilight/View/SignInWindow.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/Site.xaml.cs b/Qwilight/Qwilight/View/Site.xaml.cs new file mode 100644 index 0000000..1f6ef73 --- /dev/null +++ b/Qwilight/Qwilight/View/Site.xaml.cs @@ -0,0 +1,30 @@ +using Qwilight.ViewModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class Site + { + public Site() => InitializeComponent(); + + void OnInputLower(object sender, KeyEventArgs e) => (DataContext as SiteViewModel).OnInputLower(e); + + void OnEssentialInputLower(object sender, KeyEventArgs e) => (DataContext as SiteViewModel).OnEssentialInputLower(e); + + void OnPointedModified(object sender, KeyboardFocusChangedEventArgs e) => (DataContext as SiteViewModel).OnPointedModified(sender == e.NewFocus); + + void OnSiteYellsViewerMove(object sender, ScrollChangedEventArgs e) => (DataContext as SiteViewModel).OnSiteYellsViewerMove(e); + + void OnSetFavorNoteFile(object sender, RoutedEventArgs e) => (DataContext as SiteViewModel).OnSetFavorNoteFile(); + + void OnSetFavorModeComponent(object sender, RoutedEventArgs e) => (DataContext as SiteViewModel).OnSetFavorModeComponent(); + + void OnSetFavorAudioMultiplier(object sender, RoutedEventArgs e) => (DataContext as SiteViewModel).OnSetFavorAudioMultiplier(); + + void OnSetAutoSiteHand(object sender, RoutedEventArgs e) => (DataContext as SiteViewModel).OnSetAutoSiteHand(); + + void OnInputPostableItem(object sender, RoutedEventArgs e) => (DataContext as SiteViewModel).OnInputPostableItem(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/SiteContainer.xaml b/Qwilight/Qwilight/View/SiteContainer.xaml new file mode 100644 index 0000000..5e9c295 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteContainer.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/SiteContainer.xaml.cs b/Qwilight/Qwilight/View/SiteContainer.xaml.cs new file mode 100644 index 0000000..9a56c79 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteContainer.xaml.cs @@ -0,0 +1,15 @@ +using Qwilight.ViewModel; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Qwilight.View +{ + public sealed partial class SiteContainer + { + public SiteContainer() => InitializeComponent(); + + void OnSiteView(object sender, SelectionChangedEventArgs e) => (DataContext as SiteContainerViewModel).OnSiteView(); + + void OnPointLower(object sender, MouseButtonEventArgs e) => e.Handled = true; + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/SiteWindow.xaml b/Qwilight/Qwilight/View/SiteWindow.xaml new file mode 100644 index 0000000..1159110 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteWindow.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/AudioSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/AudioSiteYell.xaml.cs new file mode 100644 index 0000000..3e2b6c7 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/AudioSiteYell.xaml.cs @@ -0,0 +1,102 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using Qwilight.Utilities; +using System.ComponentModel; +using System.Windows; +using System.Windows.Threading; + +namespace Qwilight.View.SiteYell +{ + [INotifyPropertyChanged] + public partial class AudioSiteYell : ISiteYell + { + bool _isStopped = true; + double _audioPosition; + + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string Target { get; } + + public AvatarWww AvatarWwwValue { get; } + + public double AudioPosition + { + get => _audioPosition; + + set + { + if (SetProperty(ref _audioPosition, value, nameof(AudioPosition))) + { + Utility.SetPosition(AudioView, value); + OnPropertyChanged(nameof(HandledText)); + } + } + } + + public string HandledText => Utility.GetHandledText(AudioView); + + public bool IsStopped + { + get => _isStopped; + + set => SetProperty(ref _isStopped, value, nameof(IsStopped)); + } + + public AudioSiteYell(string avatarID, string avatarName, string date, string siteYell, string target, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + SiteYell = siteYell; + Target = Utility.CompileSiteYells(siteYell); + AvatarWwwValue = new(avatarID); + InitializeComponent(); + + var audioViewHandler = new DispatcherTimer(TimeSpan.FromSeconds(1.0), DispatcherPriority.Background, (sender, e) => + { + if (AudioView.NaturalDuration.HasTimeSpan) + { + AudioPosition = 100.0 * AudioView.Position / AudioView.NaturalDuration.TimeSpan; + } + }, HandlingUISystem.Instance.UIHandler) + { + IsEnabled = false + }; + AudioView.Loaded += (sender, e) => + { + audioViewHandler.Start(); + }; + AudioView.Unloaded += (sender, e) => + { + audioViewHandler.Stop(); + }; + } + + void OnHandle(object sender, RoutedEventArgs e) + { + if (IsStopped) + { + AudioView.Play(); + } + else + { + AudioView.Pause(); + } + IsStopped = !IsStopped; + } + + void OnStop(object sender, RoutedEventArgs e) + { + IsStopped = true; + AudioView.Stop(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DefaultSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DefaultSiteYell.xaml new file mode 100644 index 0000000..18e4029 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DefaultSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DefaultSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DefaultSiteYell.xaml.cs new file mode 100644 index 0000000..9457c3b --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DefaultSiteYell.xaml.cs @@ -0,0 +1,54 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using Qwilight.Utilities; +using System.Windows.Input; +using System.Windows.Media; + +namespace Qwilight.View.SiteYell +{ + [INotifyPropertyChanged] + public partial class DefaultSiteYell : ISiteYell + { + string _siteYell; + + public int SiteYellID { get; } + + public string SiteYell + { + get => _siteYell; + + set => SetProperty(ref _siteYell, value, nameof(SiteYell)); + } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string Href { get; } + + public AvatarWww AvatarWwwValue { get; } + + public Brush HrefPaint => string.IsNullOrEmpty(Href) ? Paints.Paint4 : QwilightComponent.GetBuiltInData("SiteHrefPaint"); + + public DefaultSiteYell(string avatarID, string avatarName, string date, string siteYell, string href, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + SiteYell = siteYell; + Href = href; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + + void OnOpenAs(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + Utility.OpenAs(Href); + } + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DrawingSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DrawingSiteYell.xaml new file mode 100644 index 0000000..e66bbc2 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DrawingSiteYell.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DrawingSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DrawingSiteYell.xaml.cs new file mode 100644 index 0000000..97e9365 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/DrawingSiteYell.xaml.cs @@ -0,0 +1,50 @@ +using Qwilight.Utilities; +using System.Windows.Input; + +namespace Qwilight.View.SiteYell +{ + public partial class DrawingSiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string Target { get; } + + public bool HasAudio { get; } + + public bool HasDrawing { get; } + + public bool HasMedia { get; } + + public bool HasNotTarget { get; } + + public AvatarWww AvatarWwwValue { get; } + + public DrawingSiteYell(string avatarID, string avatarName, string date, string siteYell, string target, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + SiteYell = siteYell; + Target = target; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + + void OnPointLower(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + Utility.OpenAs(Target); + } + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/MediaSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/MediaSiteYell.xaml new file mode 100644 index 0000000..93ea6d2 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/MediaSiteYell.xaml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/MediaSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/MediaSiteYell.xaml.cs new file mode 100644 index 0000000..2f95009 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/DefaultSiteYell/MediaSiteYell.xaml.cs @@ -0,0 +1,108 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using Qwilight.Utilities; +using System.ComponentModel; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; + +namespace Qwilight.View.SiteYell +{ + [INotifyPropertyChanged] + public partial class MediaSiteYell : ISiteYell + { + bool _isStopped = true; + double _mediaPosition; + + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string Target { get; } + + public AvatarWww AvatarWwwValue { get; } + + public double MediaPosition + { + get => _mediaPosition; + + set + { + if (SetProperty(ref _mediaPosition, value, nameof(MediaPosition))) + { + Utility.SetPosition(MediaView, value); + OnPropertyChanged(nameof(HandledText)); + } + } + } + + public string HandledText => Utility.GetHandledText(MediaView); + + public bool IsStopped + { + get => _isStopped; + + set => SetProperty(ref _isStopped, value, nameof(IsStopped)); + } + + public Brush TargetPaint => string.IsNullOrEmpty(Target) ? Paints.Paint4 : QwilightComponent.GetBuiltInData("SiteHrefPaint"); + + public MediaSiteYell(string avatarID, string avatarName, string date, string siteYell, string target, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + SiteYell = siteYell; + Target = target; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + + var mediaViewHandler = new DispatcherTimer(TimeSpan.FromSeconds(1.0), DispatcherPriority.Background, (sender, e) => + { + if (MediaView.NaturalDuration.HasTimeSpan) + { + MediaPosition = 100.0 * MediaView.Position / MediaView.NaturalDuration.TimeSpan; + } + }, HandlingUISystem.Instance.UIHandler) + { + IsEnabled = false + }; + MediaView.Loaded += (sender, e) => + { + mediaViewHandler.Start(); + }; + MediaView.Unloaded += (sender, e) => + { + mediaViewHandler.Stop(); + }; + } + + void OnOpenAs(object sender, MouseButtonEventArgs e) => Utility.OpenAs(Target); + + void OnHandle(object sender, RoutedEventArgs e) + { + if (IsStopped) + { + MediaView.Play(); + } + else + { + MediaView.Pause(); + } + IsStopped = !IsStopped; + } + + void OnStop(object sender, RoutedEventArgs e) + { + IsStopped = true; + MediaView.Stop(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/EnterSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/EnterSiteYell.xaml new file mode 100644 index 0000000..037c770 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/EnterSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/EnterSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/EnterSiteYell.xaml.cs new file mode 100644 index 0000000..c5ca118 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/EnterSiteYell.xaml.cs @@ -0,0 +1,27 @@ +namespace Qwilight.View.SiteYell +{ + public partial class EnterSiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public AvatarWww AvatarWwwValue { get; } + + public EnterSiteYell(string avatarID, string avatarName, string date, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/ErasedSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/ErasedSiteYell.xaml new file mode 100644 index 0000000..9d4d887 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/ErasedSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/ErasedSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/ErasedSiteYell.xaml.cs new file mode 100644 index 0000000..a42a524 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/ErasedSiteYell.xaml.cs @@ -0,0 +1,27 @@ +namespace Qwilight.View.SiteYell +{ + public partial class WipedSiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public AvatarWww AvatarWwwValue { get; } + + public WipedSiteYell(string avatarID, string avatarName, string date, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/ISiteYell.cs b/Qwilight/Qwilight/View/SiteYell/ISiteYell.cs new file mode 100644 index 0000000..ab1242a --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/ISiteYell.cs @@ -0,0 +1,15 @@ +namespace Qwilight.View.SiteYell +{ + public interface ISiteYell + { + public int SiteYellID { get; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string SiteYell { get; set; } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/InviteSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/InviteSiteYell.xaml new file mode 100644 index 0000000..28fb3e1 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/InviteSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/InviteSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/InviteSiteYell.xaml.cs new file mode 100644 index 0000000..62934b9 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/InviteSiteYell.xaml.cs @@ -0,0 +1,49 @@ +using Qwilight.Utilities; +using System.Windows.Input; + +namespace Qwilight.View.SiteYell +{ + public partial class InviteSiteYell : ISiteYell + { + readonly string _siteID; + + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string SiteYellInvite { get; } + + public AvatarWww AvatarWwwValue { get; } + + public InviteSiteYell(string avatarID, string siteYell, string date, int siteYellID) + { + SiteYellID = siteYellID; + var twilightInviteSiteYell = Utility.GetJSON(siteYell); + _siteID = twilightInviteSiteYell.siteID; + SiteYellInvite = string.Format(LanguageSystem.Instance.SiteYellInvite, twilightInviteSiteYell.siteName); + AvatarID = avatarID; + AvatarName = twilightInviteSiteYell.avatarName; + Date = date; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + + void OnPointLower(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.EnterSite, new + { + siteID = _siteID, + siteCipher = string.Empty + }); + } + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/NewNetSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/NewNetSiteYell.xaml new file mode 100644 index 0000000..ddbd487 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/NewNetSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/NewNetSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/NewNetSiteYell.xaml.cs new file mode 100644 index 0000000..c1c3b7d --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/NewNetSiteYell.xaml.cs @@ -0,0 +1,27 @@ +namespace Qwilight.View.SiteYell +{ + public partial class NewNetSiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public AvatarWww AvatarWwwValue { get; } + + public NewNetSiteYell(string avatarID, string avatarName, string date, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/NewSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/NewSiteYell.xaml new file mode 100644 index 0000000..be66b18 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/NewSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/NewSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/NewSiteYell.xaml.cs new file mode 100644 index 0000000..6dc556f --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/NewSiteYell.xaml.cs @@ -0,0 +1,27 @@ +namespace Qwilight.View.SiteYell +{ + public partial class NewSiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public AvatarWww AvatarWwwValue { get; } + + public NewSiteYell(string avatarID, string avatarName, string date, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/NotifySiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/NotifySiteYell.xaml new file mode 100644 index 0000000..d6bc598 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/NotifySiteYell.xaml @@ -0,0 +1,7 @@ + + + diff --git a/Qwilight/Qwilight/View/SiteYell/NotifySiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/NotifySiteYell.xaml.cs new file mode 100644 index 0000000..1be73a0 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/NotifySiteYell.xaml.cs @@ -0,0 +1,22 @@ +namespace Qwilight.View.SiteYell +{ + public partial class NotifySiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public string SiteYell { get; set; } + + public NotifySiteYell(string siteYell, int siteYellID) + { + SiteYellID = siteYellID; + SiteYell = siteYell; + InitializeComponent(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/QuitSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/QuitSiteYell.xaml new file mode 100644 index 0000000..e43a8ab --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/QuitSiteYell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/QuitSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/QuitSiteYell.xaml.cs new file mode 100644 index 0000000..265f00b --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/QuitSiteYell.xaml.cs @@ -0,0 +1,27 @@ +namespace Qwilight.View.SiteYell +{ + public partial class QuitSiteYell : ISiteYell + { + public int SiteYellID { get; } + + public string SiteYell { get; set; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string Date { get; } + + public AvatarWww AvatarWwwValue { get; } + + public QuitSiteYell(string avatarID, string avatarName, string date, int siteYellID) + { + SiteYellID = siteYellID; + AvatarID = avatarID; + AvatarName = avatarName; + Date = date; + AvatarWwwValue = new AvatarWww(avatarID); + InitializeComponent(); + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/TVSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/TVSiteYell.xaml new file mode 100644 index 0000000..653a619 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/TVSiteYell.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/TVSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/TVSiteYell.xaml.cs new file mode 100644 index 0000000..63bcfb4 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/TVSiteYell.xaml.cs @@ -0,0 +1,41 @@ +using Qwilight.Utilities; +using System.Windows.Input; + +namespace Qwilight.View.SiteYell +{ + public partial class TVSiteYell : ISiteYell + { + public string _href; + + public int SiteYellID { get; } + + public string AvatarID { get; } + + public string SiteYell { get; set; } + + public string AvatarName { get; } + + public string Date { get; } + + public string SiteYellTV { get; } + + public TVSiteYell(string avatarID, string siteYell, string date, int siteYellID) + { + SiteYellID = siteYellID; + var twilightTVSiteYell = Utility.GetJSON(siteYell); + _href = twilightTVSiteYell.href; + SiteYellTV = string.Format(LanguageSystem.Instance.SiteYellTV, twilightTVSiteYell.title); + AvatarName = twilightTVSiteYell.text; + Date = date; + InitializeComponent(); + } + + void OnPointLower(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + Utility.OpenAs(_href); + } + } + } +} diff --git a/Qwilight/Qwilight/View/SiteYell/TaehuiSiteYell.xaml b/Qwilight/Qwilight/View/SiteYell/TaehuiSiteYell.xaml new file mode 100644 index 0000000..ce8f494 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/TaehuiSiteYell.xaml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/Qwilight/Qwilight/View/SiteYell/TaehuiSiteYell.xaml.cs b/Qwilight/Qwilight/View/SiteYell/TaehuiSiteYell.xaml.cs new file mode 100644 index 0000000..979f600 --- /dev/null +++ b/Qwilight/Qwilight/View/SiteYell/TaehuiSiteYell.xaml.cs @@ -0,0 +1,49 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using Qwilight.Utilities; +using System.Windows.Input; +using System.Windows.Media; + +namespace Qwilight.View.SiteYell +{ + [INotifyPropertyChanged] + public partial class TaehuiSiteYell : ISiteYell + { + string _siteYell; + + public int SiteYellID { get; } + + public string AvatarID { get; } + + public string AvatarName { get; } + + public string SiteYell + { + get => _siteYell; + + set => SetProperty(ref _siteYell, value, nameof(SiteYell)); + } + + public string Date { get; } + + public string Href { get; } + + public Brush HrefPaint => string.IsNullOrEmpty(Href) ? Paints.Paint4 : QwilightComponent.GetBuiltInData("SiteHrefPaint"); + + public TaehuiSiteYell(string siteYell, string date, int siteYellID) + { + SiteYellID = siteYellID; + SiteYell = siteYell; + Date = date; + Href = Utility.CompileSiteYells(siteYell); + InitializeComponent(); + } + + void OnOpenAs(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + Utility.OpenAs(Href); + } + } + } +} diff --git a/Qwilight/Qwilight/View/TwilightConfigureWindow.xaml b/Qwilight/Qwilight/View/TwilightConfigureWindow.xaml new file mode 100644 index 0000000..c33043c --- /dev/null +++ b/Qwilight/Qwilight/View/TwilightConfigureWindow.xaml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/TwilightConfigureWindow.xaml.cs b/Qwilight/Qwilight/View/TwilightConfigureWindow.xaml.cs new file mode 100644 index 0000000..5bb808b --- /dev/null +++ b/Qwilight/Qwilight/View/TwilightConfigureWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class TwilightConfigureWindow + { + public TwilightConfigureWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/UbuntuWindow.xaml b/Qwilight/Qwilight/View/UbuntuWindow.xaml new file mode 100644 index 0000000..66d370f --- /dev/null +++ b/Qwilight/Qwilight/View/UbuntuWindow.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/VoteWindow.xaml.cs b/Qwilight/Qwilight/View/VoteWindow.xaml.cs new file mode 100644 index 0000000..4d1ffb0 --- /dev/null +++ b/Qwilight/Qwilight/View/VoteWindow.xaml.cs @@ -0,0 +1,27 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using Qwilight.ViewModel; + +namespace Qwilight.View +{ + public sealed partial class VoteWindow : IRecipient + { + public VoteWindow() + { + InitializeComponent(); + WeakReferenceMessenger.Default.Register(this); + EdgeView.NavigationStarting += (sender, e) => (DataContext as VoteViewModel).OnEdgeViewLoading(true); + EdgeView.NavigationCompleted += (sender, e) => (DataContext as VoteViewModel).OnEdgeViewLoading(false); + } + + public void Receive(ICC message) + { + switch (message.IDValue) + { + case ICC.ID.SetVoteWindowEdgeView: + EdgeView.Source = new Uri(message.Contents as string); + break; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/WantWindow.xaml b/Qwilight/Qwilight/View/WantWindow.xaml new file mode 100644 index 0000000..8b57126 --- /dev/null +++ b/Qwilight/Qwilight/View/WantWindow.xaml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/WantWindow.xaml.cs b/Qwilight/Qwilight/View/WantWindow.xaml.cs new file mode 100644 index 0000000..6749e2d --- /dev/null +++ b/Qwilight/Qwilight/View/WantWindow.xaml.cs @@ -0,0 +1,26 @@ +using Qwilight.ViewModel; +using System.Windows; + +namespace Qwilight.View +{ + public sealed partial class WantWindow + { + public WantWindow() => InitializeComponent(); + + void OnLowestWantLevelTextValue(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnLowestWantLevelTextValue(); + + void OnHighestWantLevelTextValue(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnHighestWantLevelTextValue(); + + void OnLowestWantBPM(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnLowestWantBPM(); + + void OnHighestWantBPM(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnHighestWantBPM(); + + void OnLowestWantAverageInputCount(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnLowestWantAverageInputCount(); + + void OnHighestWantAverageInputCount(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnHighestWantAverageInputCount(); + + void OnLowestWantHighestInputCount(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnLowestWantHighestInputCount(); + + void OnHighestWantHighestInputCount(object sender, RoutedPropertyChangedEventArgs e) => (DataContext as WantViewModel).OnHighestWantHighestInputCount(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/View/WwwLevelWindow.xaml b/Qwilight/Qwilight/View/WwwLevelWindow.xaml new file mode 100644 index 0000000..cd1b064 --- /dev/null +++ b/Qwilight/Qwilight/View/WwwLevelWindow.xaml @@ -0,0 +1,429 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qwilight/Qwilight/View/WwwLevelWindow.xaml.cs b/Qwilight/Qwilight/View/WwwLevelWindow.xaml.cs new file mode 100644 index 0000000..fe15ff6 --- /dev/null +++ b/Qwilight/Qwilight/View/WwwLevelWindow.xaml.cs @@ -0,0 +1,7 @@ +namespace Qwilight.View +{ + public sealed partial class WwwLevelWindow + { + public WwwLevelWindow() => InitializeComponent(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/AssistFileViewModel.cs b/Qwilight/Qwilight/ViewModel/AssistFileViewModel.cs new file mode 100644 index 0000000..4328ad0 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/AssistFileViewModel.cs @@ -0,0 +1,27 @@ + +namespace Qwilight.ViewModel +{ + public sealed partial class AssistFileViewModel : BaseViewModel + { + public override double TargetLength => 0.8; + + public override double TargetHeight => 0.8; + + string _title; + string _assist; + + public string Title + { + get => _title; + + set => SetProperty(ref _title, value, nameof(Title)); + } + + public string Assist + { + get => _assist; + + set => SetProperty(ref _assist, value, nameof(Assist)); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/AssistViewModel.cs b/Qwilight/Qwilight/ViewModel/AssistViewModel.cs new file mode 100644 index 0000000..d85fb16 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/AssistViewModel.cs @@ -0,0 +1,41 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.Utilities; + +namespace Qwilight.ViewModel +{ + public sealed partial class AssistViewModel : BaseViewModel + { + public override double TargetLength => 0.8; + + [RelayCommand] + static void OnOpenAs(string e) => Utility.OpenAs(e); + + [RelayCommand] + static void OnNewBMS() => ViewModels.Instance.VoteValue.Open(); + + [RelayCommand] + static void OnLoadBMS() => ViewModels.Instance.ModifyDefaultEntryValue.Open(); + + [RelayCommand] + static void OnSetUI() + { + ViewModels.Instance.ConfigureValue.TabPosition = 0; + ViewModels.Instance.ConfigureValue.TabPositionComputing = 1; + ViewModels.Instance.ConfigureValue.Open(); + } + + [RelayCommand] + static void OnSetInput() + { + ViewModels.Instance.ConfigureValue.TabPosition = 1; + ViewModels.Instance.ConfigureValue.Open(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.Tutorial220); + } + + public override void OnCollasped() + { + base.OnCollasped(); + Configure.Instance.NotifyTutorial(Configure.TutorialID.F1Assist); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/AvatarEdgeViewModel.cs b/Qwilight/Qwilight/ViewModel/AvatarEdgeViewModel.cs new file mode 100644 index 0000000..a08c036 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/AvatarEdgeViewModel.cs @@ -0,0 +1,67 @@ +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class AvatarEdgeViewModel : BaseViewModel + { + bool _isAvatarEdgeLoading; + AvatarEdgeItem _avatarEdgeItem; + + public override double TargetLength => 0.4; + + public override double TargetHeight => 0.6; + + public override HorizontalAlignment TargetLengthSystem => HorizontalAlignment.Center; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public ObservableCollection AvatarEdgeItemCollection { get; } = new(); + + public AvatarEdgeItem AvatarEdgeItemValue + { + get => _avatarEdgeItem; + + set => SetProperty(ref _avatarEdgeItem, value, nameof(AvatarEdgeItemValue)); + } + + public bool IsAvatarEdgeLoading + { + get => _isAvatarEdgeLoading; + + set => SetProperty(ref _isAvatarEdgeLoading, value, nameof(IsAvatarEdgeLoading)); + } + + public void OnPointLower() => Close(); + + public override async void OnOpened() + { + base.OnOpened(); + IsAvatarEdgeLoading = true; + + var edgeIDs = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/edges?avatarID={TwilightSystem.Instance.AvatarID}"); + if (edgeIDs != null) + { + Utility.SetUICollection(AvatarEdgeItemCollection, edgeIDs.Select(edgeID => new AvatarEdgeItem + { + EdgeID = edgeID, + }).ToArray()); + } + + IsAvatarEdgeLoading = false; + } + + public override void OnCollasped() + { + base.OnCollasped(); + var avatarEdgeItemValue = AvatarEdgeItemValue; + if (avatarEdgeItemValue != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.AvatarEdge, avatarEdgeItemValue.EdgeID); + ViewModels.Instance.AvatarValue.InitAvatarWwwValue(TwilightSystem.Instance.AvatarID, null, avatarEdgeItemValue.Drawing); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/AvatarTitleViewModel.cs b/Qwilight/Qwilight/ViewModel/AvatarTitleViewModel.cs new file mode 100644 index 0000000..88eaaa5 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/AvatarTitleViewModel.cs @@ -0,0 +1,77 @@ +using Microsoft.UI; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class AvatarTitleViewModel : BaseViewModel + { + bool _isAvatarTitleLoading; + AvatarTitleItem? _avatarTitleItem; + + public override double TargetLength => 0.4; + + public override double TargetHeight => 0.6; + + public override HorizontalAlignment TargetLengthSystem => HorizontalAlignment.Center; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public ObservableCollection AvatarTitleItemCollection { get; } = new(); + + public AvatarTitleItem? AvatarTitleItemValue + { + get => _avatarTitleItem; + + set => SetProperty(ref _avatarTitleItem, value, nameof(AvatarTitleItemValue)); + } + + public bool IsAvatarTitleLoading + { + get => _isAvatarTitleLoading; + + set => SetProperty(ref _isAvatarTitleLoading, value, nameof(IsAvatarTitleLoading)); + } + + public void OnPointLower() => Close(); + + public override async void OnOpened() + { + base.OnOpened(); + IsAvatarTitleLoading = true; + + var twilightWwwTitles = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/titles?avatarID={TwilightSystem.Instance.AvatarID}&language={Configure.Instance.Language}"); + if (twilightWwwTitles != null) + { + Utility.SetUICollection(AvatarTitleItemCollection, twilightWwwTitles.Prepend(new JSON.TwilightWwwTitles + { + titleID = string.Empty, + title = LanguageSystem.Instance.NotAvatarTitle, + titleColor = nameof(Colors.White) + }).Select(data => new AvatarTitleItem + { + Title = data.title, + TitleID = data.titleID, + TitlePaint = Utility.GetTitlePaint(data.titleColor), + TitleColor = Utility.GetTitleColor(data.titleColor) + }).ToArray()); + } + + IsAvatarTitleLoading = false; + } + + public override void OnCollasped() + { + base.OnCollasped(); + var avatarTitleItem = AvatarTitleItemValue; + if (avatarTitleItem.HasValue) + { + var avatarTitleItemValue = avatarTitleItem.Value; + TwilightSystem.Instance.SendParallel(Event.Types.EventID.AvatarTitle, avatarTitleItemValue.TitleID); + ViewModels.Instance.AvatarValue.InitAvatarWwwValue(TwilightSystem.Instance.AvatarID, new AvatarTitle(avatarTitleItemValue.Title, avatarTitleItemValue.TitlePaint, avatarTitleItemValue.TitleColor)); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/AvatarViewModel.cs b/Qwilight/Qwilight/ViewModel/AvatarViewModel.cs new file mode 100644 index 0000000..6891ec4 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/AvatarViewModel.cs @@ -0,0 +1,446 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Media; + +namespace Qwilight.ViewModel +{ + public sealed partial class AvatarViewModel : BaseViewModel + { + public sealed class AvatarComputing : Computing + { + public override BaseNoteFile.NoteVariety NoteVarietyValue => AvatarNoteVarietyValue; + + public BaseNoteFile.NoteVariety AvatarNoteVarietyValue { get; init; } + + public override void OnCompiled() + { + } + + public override void OnFault(Exception e) + { + } + + public string AvatarValue { get; set; } + } + + public ObservableCollection FavoriteAvatarComputingCollection { get; } = new(); + + public ObservableCollection LastAvatarComputingCollection { get; } = new(); + + public ObservableCollection Ability5KAvatarComputingCollection { get; } = new(); + + public ObservableCollection Ability7KAvatarComputingCollection { get; } = new(); + + public ObservableCollection Ability9KAvatarComputingCollection { get; } = new(); + + public ObservableCollection AvatarWwwLevelItemCollection { get; } = new(); + + public override double TargetHeight => 0.8; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + readonly int[] _avatarLevels = new int[3]; + string _avatarAbility5KPlaceText0 = string.Empty; + string _avatarAbility5KPlaceText1 = string.Empty; + ImageSource _abilityClass5KDrawing; + double _avatarAbility5K; + string _avatarAbility7KPlaceText0 = string.Empty; + string _avatarAbility7KPlaceText1 = string.Empty; + ImageSource _abilityClass7KDrawing; + double _avatarAbility7K; + string _avatarAbility9KPlaceText0 = string.Empty; + string _avatarAbility9KPlaceText1 = string.Empty; + ImageSource _abilityClass9KDrawing; + double _avatarAbility9K; + bool _isAvatarLoading; + string _avatarID; + string _avatarName; + int _totalCount; + double _totalLength; + int _highestCount; + DateTime _date; + + public string AvatarAbility5KPlaceText0 + { + get => _avatarAbility5KPlaceText0; + + set => SetProperty(ref _avatarAbility5KPlaceText0, value, nameof(AvatarAbility5KPlaceText0)); + } + + public string AvatarAbility5KPlaceText1 + { + get => _avatarAbility5KPlaceText1; + + set => SetProperty(ref _avatarAbility5KPlaceText1, value, nameof(AvatarAbility5KPlaceText1)); + } + + public ImageSource AbilityClass5KDrawing + { + get => _abilityClass5KDrawing; + + set => SetProperty(ref _abilityClass5KDrawing, value, nameof(AbilityClass5KDrawing)); + } + + public string AvatarViewAbility5KText => _avatarAbility5K.ToString("#,##0.## Point"); + + public string AvatarAbility7KPlaceText0 + { + get => _avatarAbility7KPlaceText0; + + set => SetProperty(ref _avatarAbility7KPlaceText0, value, nameof(AvatarAbility7KPlaceText0)); + } + + public string AvatarAbility7KPlaceText1 + { + get => _avatarAbility7KPlaceText1; + + set => SetProperty(ref _avatarAbility7KPlaceText1, value, nameof(AvatarAbility7KPlaceText1)); + } + + public ImageSource AbilityClass7KDrawing + { + get => _abilityClass7KDrawing; + + set => SetProperty(ref _abilityClass7KDrawing, value, nameof(AbilityClass7KDrawing)); + } + + public string AvatarViewAbility7KText => _avatarAbility7K.ToString("#,##0.## Point"); + + public string AvatarAbility9KPlaceText0 + { + get => _avatarAbility9KPlaceText0; + + set => SetProperty(ref _avatarAbility9KPlaceText0, value, nameof(AvatarAbility9KPlaceText0)); + } + + public string AvatarAbility9KPlaceText1 + { + get => _avatarAbility9KPlaceText1; + + set => SetProperty(ref _avatarAbility9KPlaceText1, value, nameof(AvatarAbility9KPlaceText1)); + } + + public ImageSource AbilityClass9KDrawing + { + get => _abilityClass9KDrawing; + + set => SetProperty(ref _abilityClass9KDrawing, value, nameof(AbilityClass9KDrawing)); + } + + public string AvatarViewAbility9KText => _avatarAbility9K.ToString("#,##0.## Point"); + + public string AvatarID { get; set; } + + public bool IsMe => _avatarID == TwilightSystem.Instance.AvatarID; + + public string[] QuitCountTexts { get; } = new string[7]; + + public int[] DateValues { get; } = new int[91]; + + public bool IsAvatarLoading + { + get => _isAvatarLoading; + + set => SetProperty(ref _isAvatarLoading, value, nameof(IsAvatarLoading)); + } + + public AvatarWww AvatarWwwValue { get; set; } + + public string AvatarViewText => string.Format(LanguageSystem.Instance.AvatarViewText, _avatarName, _avatarID); + + public string AvatarViewTotalCountText => string.Format(LanguageSystem.Instance.AvatarViewTotalCountText, _totalCount.ToString("#,##0")); + + public string AvatarViewTotalLengthText => string.Format(LanguageSystem.Instance.AvatarViewTotalLengthText, ((int)_totalLength / 1000 / 60 / 60).ToString("#,##0"), ((int)_totalLength / 1000 / 60 % 60).ToString(), ((int)_totalLength / 1000 % 60).ToString()); + + public string AvatarViewHighestCountText => string.Format(LanguageSystem.Instance.AvatarViewHighestCountText, _highestCount.ToString("#,##0")); + + public string AvatarViewDateText => string.Format(LanguageSystem.Instance.AvatarViewDateText, _date); + + public string AvatarViewLevelText0 => $"LV. {_avatarLevels[0]}"; + + public string AvatarViewLevelText1 => $"XP: {_avatarLevels[1]}/{_avatarLevels[2]}"; + + public double AvatarViewLevelValue => _avatarLevels[2] > 0 ? 100.0 * _avatarLevels[1] / _avatarLevels[2] : 0.0; + + public string AvatarViewWwwLevelContents => string.Format(LanguageSystem.Instance.AvatarViewWwwLevelContents, AvatarWwwLevelItemCollection.Count); + + public string AvatarIntro { get; set; } + + public override async void OnOpened() + { + base.OnOpened(); + InitAvatarWwwValue(string.Empty); + + IsAvatarLoading = true; + + var twilightWwwAvatar = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/avatar?avatarID={AvatarID}"); + if (twilightWwwAvatar.HasValue) + { + var twilightWwwAvatarValue = twilightWwwAvatar.Value; + + _avatarID = twilightWwwAvatarValue.avatarID; + NotifyIsMe(); + + _avatarName = twilightWwwAvatarValue.avatarName; + OnPropertyChanged(nameof(AvatarViewText)); + + AvatarIntro = twilightWwwAvatarValue.avatarIntro; + OnPropertyChanged(nameof(AvatarIntro)); + + InitAvatarWwwValue(twilightWwwAvatarValue.avatarID); + + _totalCount = twilightWwwAvatarValue.totalCount; + OnPropertyChanged(nameof(AvatarViewTotalCountText)); + + _totalLength = twilightWwwAvatarValue.totalLength; + OnPropertyChanged(nameof(AvatarViewTotalLengthText)); + + _highestCount = twilightWwwAvatarValue.highestCount; + OnPropertyChanged(nameof(AvatarViewHighestCountText)); + + _date = DateTime.UnixEpoch.ToLocalTime().AddMilliseconds(twilightWwwAvatarValue.date); + OnPropertyChanged(nameof(AvatarViewDateText)); + + Array.Copy(twilightWwwAvatarValue.avatarLevels, _avatarLevels, _avatarLevels.Length); + OnPropertyChanged(nameof(AvatarViewLevelText0)); + OnPropertyChanged(nameof(AvatarViewLevelText1)); + OnPropertyChanged(nameof(AvatarViewLevelValue)); + + var avatarAbility5KClass = twilightWwwAvatarValue.avatarAbility5KClass; + using (var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/drawing?abilityClass5K={(avatarAbility5KClass < 0 ? avatarAbility5KClass : 100 * avatarAbility5KClass)}")) + { + if (s.Length > 0) + { + try + { + AbilityClass5KDrawing = DrawingSystem.Instance.LoadDefault(s, null); + } + catch + { + } + } + } + if (twilightWwwAvatarValue.avatarAbility5KPlace > 0) + { + AvatarAbility5KPlaceText0 = twilightWwwAvatarValue.avatarAbility5KPlace.ToString("##,##0"); + AvatarAbility5KPlaceText1 = twilightWwwAvatarValue.avatarAbility5KCount.ToString("/#,##0"); + } + else + { + AvatarAbility5KPlaceText0 = string.Empty; + AvatarAbility5KPlaceText1 = string.Empty; + } + _avatarAbility5K = twilightWwwAvatarValue.avatarAbility5K; + OnPropertyChanged(nameof(AvatarViewAbility5KText)); + + var avatarAbility7KClass = twilightWwwAvatarValue.avatarAbility7KClass; + using (var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/drawing?abilityClass7K={(avatarAbility7KClass < 0 ? avatarAbility7KClass : 100 * avatarAbility7KClass)}")) + { + if (s.Length > 0) + { + try + { + AbilityClass7KDrawing = DrawingSystem.Instance.LoadDefault(s, null); + } + catch + { + } + } + } + if (twilightWwwAvatarValue.avatarAbility7KPlace > 0) + { + AvatarAbility7KPlaceText0 = twilightWwwAvatarValue.avatarAbility7KPlace.ToString("##,##0"); + AvatarAbility7KPlaceText1 = twilightWwwAvatarValue.avatarAbility7KCount.ToString("/#,##0"); + } + else + { + AvatarAbility7KPlaceText0 = string.Empty; + AvatarAbility7KPlaceText1 = string.Empty; + } + _avatarAbility7K = twilightWwwAvatarValue.avatarAbility7K; + OnPropertyChanged(nameof(AvatarViewAbility7KText)); + + var avatarAbility9KClass = twilightWwwAvatarValue.avatarAbility9KClass; + using (var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/drawing?abilityClass9K={(avatarAbility9KClass < 0 ? avatarAbility9KClass : 100 * avatarAbility9KClass)}")) + { + if (s.Length > 0) + { + try + { + AbilityClass9KDrawing = DrawingSystem.Instance.LoadDefault(s, null); + } + catch + { + } + } + } + if (twilightWwwAvatarValue.avatarAbility9KPlace > 0) + { + AvatarAbility9KPlaceText0 = twilightWwwAvatarValue.avatarAbility9KPlace.ToString("##,##0"); + AvatarAbility9KPlaceText1 = twilightWwwAvatarValue.avatarAbility9KCount.ToString("/#,##0"); + } + else + { + AvatarAbility9KPlaceText0 = string.Empty; + AvatarAbility9KPlaceText1 = string.Empty; + } + _avatarAbility9K = twilightWwwAvatarValue.avatarAbility9K; + OnPropertyChanged(nameof(AvatarViewAbility9KText)); + + for (var i = twilightWwwAvatarValue.quitStatusValues.Length - 1; i >= 0; --i) + { + QuitCountTexts[i] = twilightWwwAvatarValue.quitStatusValues[i].ToString(LanguageSystem.Instance.CountContents); + } + OnPropertyChanged(nameof(QuitCountTexts)); + + Array.Copy(twilightWwwAvatarValue.dateValues, DateValues, DateValues.Length); + + FavoriteAvatarComputingCollection.Clear(); + foreach (var wwwAvatarFavorite in twilightWwwAvatarValue.favorites) + { + FavoriteAvatarComputingCollection.Add(new AvatarComputing + { + AvatarNoteVarietyValue = wwwAvatarFavorite.noteVariety, + Title = wwwAvatarFavorite.title, + Artist = wwwAvatarFavorite.artist, + Genre = wwwAvatarFavorite.genre, + LevelValue = wwwAvatarFavorite.level, + LevelText = wwwAvatarFavorite.levelText, + AvatarValue = wwwAvatarFavorite.totalCount.ToString(LanguageSystem.Instance.HandledContents) + }); + } + + LastAvatarComputingCollection.Clear(); + foreach (var wwwAvatarLast in twilightWwwAvatarValue.lasts) + { + LastAvatarComputingCollection.Add(new AvatarComputing + { + AvatarNoteVarietyValue = wwwAvatarLast.noteVariety, + Title = wwwAvatarLast.title, + Artist = wwwAvatarLast.artist, + Genre = wwwAvatarLast.genre, + LevelValue = wwwAvatarLast.level, + LevelText = wwwAvatarLast.levelText, + AvatarValue = DateTime.UnixEpoch.ToLocalTime().AddMilliseconds(wwwAvatarLast.date).ToString() + }); + } + + Ability5KAvatarComputingCollection.Clear(); + foreach (var wwwAvatarAbility in twilightWwwAvatarValue.abilities5K) + { + Ability5KAvatarComputingCollection.Add(new AvatarComputing + { + AvatarNoteVarietyValue = wwwAvatarAbility.noteVariety, + Title = wwwAvatarAbility.title, + Artist = wwwAvatarAbility.artist, + Genre = wwwAvatarAbility.genre, + LevelValue = wwwAvatarAbility.level, + LevelText = wwwAvatarAbility.levelText, + AvatarValue = string.Format(LanguageSystem.Instance.AbilityStandContents, wwwAvatarAbility.stand.ToString("#,##0"), Math.Round(wwwAvatarAbility.ability, 3)) + }); + } + + Ability7KAvatarComputingCollection.Clear(); + foreach (var wwwAvatarAbility in twilightWwwAvatarValue.abilities7K) + { + Ability7KAvatarComputingCollection.Add(new AvatarComputing + { + AvatarNoteVarietyValue = wwwAvatarAbility.noteVariety, + Title = wwwAvatarAbility.title, + Artist = wwwAvatarAbility.artist, + Genre = wwwAvatarAbility.genre, + LevelValue = wwwAvatarAbility.level, + LevelText = wwwAvatarAbility.levelText, + AvatarValue = string.Format(LanguageSystem.Instance.AbilityStandContents, wwwAvatarAbility.stand.ToString("#,##0"), Math.Round(wwwAvatarAbility.ability, 3)) + }); + } + + Ability9KAvatarComputingCollection.Clear(); + foreach (var wwwAvatarAbility in twilightWwwAvatarValue.abilities9K) + { + Ability9KAvatarComputingCollection.Add(new AvatarComputing + { + AvatarNoteVarietyValue = wwwAvatarAbility.noteVariety, + Title = wwwAvatarAbility.title, + Artist = wwwAvatarAbility.artist, + Genre = wwwAvatarAbility.genre, + LevelValue = wwwAvatarAbility.level, + LevelText = wwwAvatarAbility.levelText, + AvatarValue = string.Format(LanguageSystem.Instance.AbilityStandContents, wwwAvatarAbility.stand.ToString("#,##0"), Math.Round(wwwAvatarAbility.ability, 3)) + }); + } + + AvatarWwwLevelItemCollection.Clear(); + foreach (var wwwLevel in twilightWwwAvatarValue.levels) + { + AvatarWwwLevelItemCollection.Add(new AvatarLevelItem + { + Title = wwwLevel.title, + LevelValue = wwwLevel.level, + LevelText = wwwLevel.levelText, + Date = DateTime.UnixEpoch.ToLocalTime().AddMilliseconds(wwwLevel.date).ToString() + }); + } + + OnPropertyChanged(nameof(AvatarViewWwwLevelContents)); + } + else + { + Close(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAvatarViewFault); + } + + IsAvatarLoading = false; + } + + [RelayCommand] + static void OnAvatarTitle() => ViewModels.Instance.AvatarTitleValue.Open(); + + [RelayCommand] + static void OnAvatarEdge() => ViewModels.Instance.AvatarEdgeValue.Open(); + + public void OnAvatarDrawing() + { + if (IsMe) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + new[] { ".png" }, + new Action(async fileName => + { + if (await TwilightSystem.Instance.PostAvatarDrawingParallel($"{QwilightComponent.TaehuiNetAPI}/avatar/drawing", fileName)) + { + InitAvatarWwwValue(TwilightSystem.Instance.AvatarID); + TwilightSystem.Instance.NotifyAvatarDrawing(); + } + }) + } + }); + } + } + + public void NotifyIsMe() => OnPropertyChanged(nameof(IsMe)); + + public void InitAvatarWwwValue(string avatarID, AvatarTitle? avatarTitle = null, ImageSource avatarEdge = null) + { + AvatarWwwValue = new(avatarID, avatarTitle, avatarEdge, true); + OnPropertyChanged(nameof(AvatarWwwValue)); + } + + public override async void OnCollasped() + { + base.OnCollasped(); + if (IsMe) + { + await TwilightSystem.Instance.PutAvatarParallel($"{QwilightComponent.TaehuiNetAPI}/avatar/avatarIntro", AvatarIntro); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/BaseViewModel.cs b/Qwilight/Qwilight/ViewModel/BaseViewModel.cs new file mode 100644 index 0000000..7f71dcb --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/BaseViewModel.cs @@ -0,0 +1,141 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.Utilities; +using System.Windows; +using System.Windows.Media; + +namespace Qwilight.ViewModel +{ + public partial class BaseViewModel : Model + { + static int _lastZvalue; + + int _zValue; + bool _isControlling; + + public bool IsLoaded { get; set; } + + public bool IsOpened => IsControlling && OpeningCondition; + + public bool IsControlling + { + get => _isControlling; + + set + { + if (SetProperty(ref _isControlling, value, nameof(IsControlling))) + { + NotifyIsOpened(); + ViewModels.Instance.MainValue.OnWPFViewVisibilityModified(); + } + } + } + + public double Length => ViewModels.Instance.MainValue.DefaultLength * TargetLength; + + public double Height => ViewModels.Instance.MainValue.DefaultHeight * TargetHeight; + + public double Position0 => TargetLengthSystem switch + { + HorizontalAlignment.Right => ViewModels.Instance.MainValue.DefaultLength - Length, + HorizontalAlignment.Center => (ViewModels.Instance.MainValue.DefaultLength - Length) / 2, + _ => 0.0 + }; + + public double Position1 => TargetHeightSystem switch + { + VerticalAlignment.Bottom => ViewModels.Instance.MainValue.DefaultHeight - Height, + VerticalAlignment.Center => (ViewModels.Instance.MainValue.DefaultHeight - Height) / 2, + _ => 0.0 + }; + + public virtual double TargetLength => 1.0; + + public virtual double TargetHeight => 1.0; + + public virtual HorizontalAlignment TargetLengthSystem => HorizontalAlignment.Center; + + public virtual VerticalAlignment TargetHeightSystem => VerticalAlignment.Center; + + public int Zvalue + { + get => _zValue; + + set => SetProperty(ref _zValue, value, nameof(Zvalue)); + } + + public virtual bool ClosingCondition => true; + + public virtual bool OpeningCondition => true; + + public virtual bool IsModal => true; + + public Brush ModalPaint => IsModal ? Paints.ModalPaint : null; + + [RelayCommand] + void OnClose() => Close(); + + public void Close(bool handleAudio = true) + { + if (IsOpened && ClosingCondition) + { + if (handleAudio) + { + Utility.HandleUIAudio("Window 0"); + } + IsControlling = false; + OnCollasped(); + } + } + + public void Open(bool handleAudio = true) + { + if (!IsOpened && OpeningCondition) + { + if (handleAudio) + { + Utility.HandleUIAudio("Window 1"); + } + Zvalue = ++_lastZvalue; + IsControlling = true; + OnOpened(); + } + } + + public void Toggle() + { + if (IsOpened) + { + Close(); + } + else + { + Open(); + } + } + + public void NotifyIsOpened() => OnPropertyChanged(nameof(IsOpened)); + + public void NotifyArea() + { + OnPropertyChanged(nameof(Position0)); + OnPropertyChanged(nameof(Position1)); + OnPropertyChanged(nameof(Length)); + OnPropertyChanged(nameof(Height)); + } + + public virtual void OnOpened() + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointZMaxView + }); + IsLoaded = true; + } + + public virtual void OnCollasped() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointZMaxView + }); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/BundleViewModel.cs b/Qwilight/Qwilight/ViewModel/BundleViewModel.cs new file mode 100644 index 0000000..e033fd2 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/BundleViewModel.cs @@ -0,0 +1,58 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; + +namespace Qwilight.ViewModel +{ + public sealed partial class BundleViewModel : BaseViewModel + { + string _targetBundleAvatar = string.Empty; + + public ObservableCollection NoteFileBundleCollection { get; } = new(); + + public ObservableCollection UIBundleCollection { get; } = new(); + + public ObservableCollection QwilightBundleCollection { get; } = new(); + + public ObservableCollection EventNoteBundleCollection { get; } = new(); + + public override double TargetLength => 0.8; + + public bool IsMe => TargetBundleAvatar == TwilightSystem.Instance.AvatarID; + + public double Value => BundleLength > 0L ? 100.0 * TargetValue / BundleLength : 0.0; + + public string TargetBundleAvatar + { + get => _targetBundleAvatar; + + set + { + _targetBundleAvatar = value; + NotifyIsMe(); + } + } + + public long TargetValue { get; set; } + + public long BundleLength { get; set; } + + public string ValueContents => $"{Utility.FormatUnit(TargetValue)}/{Utility.FormatUnit(BundleLength)}"; + + [RelayCommand] + static void OnSaveAsBundle() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveAsBundle, new + { + bundleVariety = BundleItem.BundleVariety.Qwilight + }); + + + public void NotifyIsMe() => OnPropertyChanged(nameof(IsMe)); + + public void NotifyUI() + { + OnPropertyChanged(nameof(Value)); + OnPropertyChanged(nameof(ValueContents)); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/ColorViewModel.cs b/Qwilight/Qwilight/ViewModel/ColorViewModel.cs new file mode 100644 index 0000000..88b10cc --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/ColorViewModel.cs @@ -0,0 +1,99 @@ +using System.Windows; +using Windows.UI; +using Brush = System.Windows.Media.Brush; + +namespace Qwilight.ViewModel +{ + public sealed class ColorViewModel : BaseViewModel + { + readonly byte[] _valueColors = new byte[4]; + + public override double TargetLength => 0.3; + + public override double TargetHeight => 0.2; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public Action OnLazyCollasped { get; set; } + + public void SetColor(Color value) + { + Color0 = value.R; + Color1 = value.G; + Color2 = value.B; + Color3 = value.A; + } + + public byte Color0 + { + get => _valueColors[0]; + + set + { + if (SetProperty(ref _valueColors[0], value, nameof(Color0))) + { + OnPropertyChanged(nameof(PaintValue)); + } + } + } + + public byte Color1 + { + get => _valueColors[1]; + + set + { + if (SetProperty(ref _valueColors[1], value, nameof(Color1))) + { + OnPropertyChanged(nameof(PaintValue)); + } + } + } + + public byte Color2 + { + get => _valueColors[2]; + + set + { + if (SetProperty(ref _valueColors[2], value, nameof(Color2))) + { + OnPropertyChanged(nameof(PaintValue)); + } + } + } + + public byte Color3 + { + get => _valueColors[3]; + + set + { + if (SetProperty(ref _valueColors[3], value, nameof(Color3))) + { + OnPropertyChanged(nameof(PaintValue)); + } + } + } + + public Brush PaintValue => DrawingSystem.Instance.GetDefaultPaint(new Color + { + R = Color0, + G = Color1, + B = Color2, + A = Color3, + }); + + public override void OnCollasped() + { + base.OnCollasped(); + OnLazyCollasped(new Color + { + R = Color0, + G = Color1, + B = Color2, + A = Color3 + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/CommentViewModel.cs b/Qwilight/Qwilight/ViewModel/CommentViewModel.cs new file mode 100644 index 0000000..b7c832e --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/CommentViewModel.cs @@ -0,0 +1,17 @@ +namespace Qwilight.ViewModel +{ + public sealed partial class CommentViewModel : BaseViewModel + { + public override double TargetLength => 0.5; + + public override double TargetHeight => 0.9; + + public override bool OpeningCondition => BaseUI.Instance.HasCommentPoint; + + public override void OnOpened() + { + base.OnOpened(); + ViewModels.Instance.MainValue.LoadCommentCollection(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/ConfigureViewModel.cs b/Qwilight/Qwilight/ViewModel/ConfigureViewModel.cs new file mode 100644 index 0000000..34f7346 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/ConfigureViewModel.cs @@ -0,0 +1,1561 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using FMOD; +using Ionic.Zip; +using Qwilight.Compute; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Windows.Threading; +using Windows.ApplicationModel.DataTransfer; +using Windows.Win32; +using Windows.Win32.Graphics.Gdi; +using Windows.Win32.UI.WindowsAndMessaging; +using YamlDotNet.RepresentationModel; +using ImageSource = System.Windows.Media.ImageSource; + +namespace Qwilight.ViewModel +{ + public sealed partial class ConfigureViewModel : BaseViewModel + { + readonly UIItem[] _targets = new UIItem[2]; + readonly bool[] _audioVisualizerModeInputs = new bool[3]; + readonly bool[] _inputMapInputs = new bool[4]; + readonly bool[] _dInputControllerVarietyInputs = new bool[2]; + readonly bool[] _audioVarietyInputs = new bool[2]; + readonly bool[] _valueGPUModeInputs = new bool[2]; + readonly bool[] _loopUnitInputs = new bool[4]; + readonly bool[] _inputAudioVarietyInputs = new bool[2]; + readonly DispatcherTimer _detailedHandler; + DispatcherTimer _fadingComputingHandler; + Timer _setComputingHandler; + GPUConfigure.GPUMode _defaultGPUMode; + uint _defaultAudioDataLength; + int _detailedAudioInputValue; + string _detailedAudioItemCount; + string _detailedAudioHandlerItemCount; + string _detailedHandlingAudioCount; + float _detailedAudioUnitStatus; + string _detailedMediaItemCount; + string _detailedMediaHandlerItemCount; + string _detailedNoteDrawingCount; + string _detailedDrawingItemCount; + string _mainControllerPowerStatus; + long _detailedSet; + int _tabPosition; + int _tabPositioinComputing; + int _tabPositionUI; + HunterVariety _defaultHunterVariety; + bool _defaultNetCommentFollow; + double _faint = 1.0; + + public double Faint + { + get => _faint; + + set => SetProperty(ref _faint, value, nameof(Faint)); + } + + public UIItem BaseUIItemValue + { + get => _targets[0]; + + set => SetProperty(ref _targets[0], value, nameof(BaseUIItemValue)); + } + + public UIItem UIItemValue + { + get => _targets[1]; + + set => SetProperty(ref _targets[1], value, nameof(UIItemValue)); + } + + public bool AudioVisualizerMode0 + { + get => _audioVisualizerModeInputs[0]; + + set + { + if (SetProperty(ref _audioVisualizerModeInputs[0], value, nameof(AudioVisualizerMode0)) && value) + { + Configure.Instance.AudioVisualizerModeValue = Configure.AudioVisualizerMode.AudioVisualizerMode0; + } + } + } + + public bool AudioVisualizerMode1 + { + get => _audioVisualizerModeInputs[1]; + + set + { + if (SetProperty(ref _audioVisualizerModeInputs[1], value, nameof(AudioVisualizerMode1)) && value) + { + Configure.Instance.AudioVisualizerModeValue = Configure.AudioVisualizerMode.AudioVisualizerMode1; + } + } + } + + public bool AudioVisualizerMode2 + { + get => _audioVisualizerModeInputs[2]; + + set + { + if (SetProperty(ref _audioVisualizerModeInputs[2], value, nameof(AudioVisualizerMode2)) && value) + { + Configure.Instance.AudioVisualizerModeValue = Configure.AudioVisualizerMode.AudioVisualizerMode2; + } + } + } + + public bool InputMapping0 + { + get => _inputMapInputs[0]; + + set + { + if (SetProperty(ref _inputMapInputs[0], value, nameof(InputMapping0)) && value) + { + Configure.Instance.InputMappingValue = Component.InputMapping.Mapping0; + } + } + } + + public bool InputMapping1 + { + get => _inputMapInputs[1]; + + set + { + if (SetProperty(ref _inputMapInputs[1], value, nameof(InputMapping1)) && value) + { + Configure.Instance.InputMappingValue = Component.InputMapping.Mapping1; + } + } + } + + public bool InputMapping2 + { + get => _inputMapInputs[2]; + + set + { + if (SetProperty(ref _inputMapInputs[2], value, nameof(InputMapping2)) && value) + { + Configure.Instance.InputMappingValue = Component.InputMapping.Mapping2; + } + } + } + + public bool InputMapping3 + { + get => _inputMapInputs[3]; + + set + { + if (SetProperty(ref _inputMapInputs[3], value, nameof(InputMapping3)) && value) + { + Configure.Instance.InputMappingValue = Component.InputMapping.Mapping3; + } + } + } + + public int TabPosition + { + get => _tabPosition; + + set => SetProperty(ref _tabPosition, value, nameof(TabPosition)); + } + + public int TabPositionComputing + { + get => _tabPositioinComputing; + + set => SetProperty(ref _tabPositioinComputing, value, nameof(TabPositionComputing)); + } + + public int TabPositionUI + { + get => _tabPositionUI; + + set + { + if (SetProperty(ref _tabPositionUI, value, nameof(TabPositionUI))) + { + NotifyCanSaveAsBundle(); + OnSetTabPositionUI(); + } + } + } + + void OnSetTabPositionUI() + { + switch (TabPositionUI) + { + case 0: + HandlingUISystem.Instance.HandleParallel(() => + { + BaseUI.Instance.LoadUIFiles(); + BaseUIItemValue = BaseUI.Instance.UIItems.Contains(Configure.Instance.BaseUIItemValue) ? Configure.Instance.BaseUIItemValue : null; + }); + break; + case 1: + HandlingUISystem.Instance.HandleParallel(() => + { + UI.Instance.LoadUIFiles(); + UIItemValue = UI.Instance.UIItems.Contains(Configure.Instance.UIItemValue) ? Configure.Instance.UIItemValue : null; + }); + break; + } + } + + public string[] Titles { get; } = new string[2]; + + public string[] Comments { get; } = new string[2]; + + public ImageSource[] Drawings { get; } = new ImageSource[2]; + + public void OnPointBaseUI() => SetUI(0); + + public void OnPointUI() => SetUI(1); + + public void OnBaseUIConfigure() + { + if (!BaseUI.Instance.LoadedConfigures.SequenceEqual(Configure.Instance.BaseUIConfigureValue.UIConfigures)) + { + Utility.SetBaseUIItem(Configure.Instance.BaseUIItemValue, Configure.Instance.BaseUIItemValue); + } + } + + public void OnUIConfigure() + { + if (!UI.Instance.LoadedConfigures.SequenceEqual(Configure.Instance.UIConfigureValue.UIConfiguresV2)) + { + Utility.SetUIItem(Configure.Instance.UIItemValue, Configure.Instance.UIItemValue); + } + } + + public void OnWindowArea() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetWindowArea + }); + + public void OnDefaultDrawing() + { + if (File.Exists(Configure.Instance.DefaultDrawingFilePath)) + { + Configure.Instance.DefaultDrawingFilePath = string.Empty; + DrawingSystem.Instance.LoadDefaultDrawing(); + } + else + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + QwilightComponent.DrawingFileFormats, + new Action(fileName => + { + Configure.Instance.DefaultDrawingFilePath = fileName; + DrawingSystem.Instance.LoadDefaultDrawing(); + }) + } + }); + } + } + public void OnSetBaseUI() + { + if (!ViewModels.Instance.MainValue.IsUILoading && BaseUIItemValue != null && BaseUIItemValue != Configure.Instance.BaseUIItemValue) + { + Utility.SetBaseUIItem(null, BaseUIItemValue); + } + } + + public void OnSetUI() + { + if (!ViewModels.Instance.MainValue.IsUILoading && UIItemValue != null && UIItemValue != Configure.Instance.UIItemValue) + { + Utility.SetUIItem(null, UIItemValue); + } + } + + public void OnVeilDrawing() + { + if (File.Exists(Configure.Instance.VeilDrawingFilePath)) + { + Configure.Instance.VeilDrawingFilePath = string.Empty; + DrawingSystem.Instance.LoadVeilDrawing(); + } + else + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + QwilightComponent.DrawingFileFormats, + new Action(fileName => + { + Configure.Instance.VeilDrawingFilePath = fileName; + DrawingSystem.Instance.LoadVeilDrawing(); + }) + } + }); + } + } + + public void OnComputingPointed() + { + _fadingComputingHandler?.Stop(); + var fadingCounter = Stopwatch.StartNew(); + _fadingComputingHandler = new(QwilightComponent.StandardFrametime, DispatcherPriority.Render, (sender, e) => + { + var fadingStatus = Math.Min(QwilightComponent.StandardWaitMillis, fadingCounter.GetMillis()) / QwilightComponent.StandardWaitMillis; + Faint = -0.875 * fadingStatus + 1; + + if (fadingStatus == 1.0) + { + (sender as DispatcherTimer).Stop(); + } + }, HandlingUISystem.Instance.UIHandler); + } + + public void OnComputingNotPointed() + { + _fadingComputingHandler?.Stop(); + var fadingCounter = Stopwatch.StartNew(); + _fadingComputingHandler = new(QwilightComponent.StandardFrametime, DispatcherPriority.Render, (sender, e) => + { + var fadingStatus = Math.Min(QwilightComponent.StandardWaitMillis, fadingCounter.GetMillis()) / QwilightComponent.StandardWaitMillis; + Faint = 0.875 * fadingStatus + 0.125; + + if (fadingStatus == 1.0) + { + (sender as DispatcherTimer).Stop(); + } + }, HandlingUISystem.Instance.UIHandler); + } + + public void OnComputingModified() + { + var targetComputer = ViewModels.Instance.MainValue.Computer; + if (targetComputer != null) + { + _setComputingHandler?.Dispose(); + _setComputingHandler = new(state => + { + (state as DefaultCompute).SetUIMap(); + }, targetComputer, QwilightComponent.StandardFrametime, Timeout.InfiniteTimeSpan); + } + } + + [RelayCommand] + void OnEnterAutoComputeUIConfigure() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (mainViewModel.AutoComputer?.IsHandling == true) + { + mainViewModel.EnterAutoComputingMode(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.EnterAutoComputeUIConfigure); + } + else if (Configure.Instance.AutoCompute) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAutoComputeFault); + } + else + { + TabPosition = 4; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAutoComputeConfigureFault); + } + } + + [RelayCommand] + void OnEnterAutoComputeMediaInputConfigure() + { + var mainViewModel = ViewModels.Instance.MainValue; + if (mainViewModel.GetHandlingComputer()?.IsHandling == true) + { + Close(); + Configure.Instance.InitMediaInputArea(); + DrawingSystem.Instance.InitMediaInputArea(); + mainViewModel.EnterAutoComputingMode(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.EnterAutoComputeMediaInputConfigure); + } + else if (Configure.Instance.AutoCompute) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAutoComputeFault); + } + else + { + TabPosition = 4; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAutoComputeConfigureFault); + } + } + + [RelayCommand] + void OnCopySalt() + { + var dataBundle = new DataPackage(); + dataBundle.SetText(ViewModels.Instance.MainValue.ModeComponentValue.Salt.ToString()); + Clipboard.SetContent(dataBundle); + } + + [RelayCommand] + void OnSetAudioMultiplier(double e) => ViewModels.Instance.MainValue.ModeComponentValue.AudioMultiplier = e; + + [RelayCommand] + void OnIsMediaFill() => Configure.Instance.IsMediaFill = !Configure.Instance.IsMediaFill; + + [RelayCommand] + void OnViewQwilightEntry() => Utility.OpenAs(QwilightComponent.QwilightEntryPath); + + [RelayCommand] + void OnViewUIEntry() => Utility.OpenAs(QwilightComponent.UIEntryPath); + + [RelayCommand] + void OnOpenAs(string e) => Utility.OpenAs(e); + + [RelayCommand] + void OnUIPipelineLimiter() => Configure.Instance.UIPipelineLimiter = !Configure.Instance.UIPipelineLimiter; + + [RelayCommand] + void OnUIPipelineMainDrawingPaint() => Configure.Instance.UIPipelineMainDrawingPaint = !Configure.Instance.UIPipelineMainDrawingPaint; + + [RelayCommand] + void OnUIPipelineJudgmentMain() => Configure.Instance.UIPipelineJudgmentMain = !Configure.Instance.UIPipelineJudgmentMain; + + [RelayCommand] + void OnUIPipelineJudgmentCount() => Configure.Instance.UIPipelineJudgmentCount = !Configure.Instance.UIPipelineJudgmentCount; + + [RelayCommand] + void OnUIPipelineJudgmentMeter() => Configure.Instance.UIPipelineJudgmentMeter = !Configure.Instance.UIPipelineJudgmentMeter; + + [RelayCommand] + void OnUIPipelineJudgmentVisualizer() => Configure.Instance.UIPipelineJudgmentVisualizer = !Configure.Instance.UIPipelineJudgmentVisualizer; + + [RelayCommand] + void OnUIPipelineJudgmentPaint() => Configure.Instance.UIPipelineJudgmentPaint = !Configure.Instance.UIPipelineJudgmentPaint; + + [RelayCommand] + void OnUIPipelineHitNotePaint() => Configure.Instance.UIPipelineHitNotePaint = !Configure.Instance.UIPipelineHitNotePaint; + + [RelayCommand] + void OnUIPipelineBPM() => Configure.Instance.UIPipelineBPM = !Configure.Instance.UIPipelineBPM; + + [RelayCommand] + void OnUIPipelineNet() => Configure.Instance.UIPipelineNet = !Configure.Instance.UIPipelineNet; + + [RelayCommand] + void OnUIPipelineJudgmentInputVisualizer() => Configure.Instance.UIPipelineJudgmentInputVisualizer = !Configure.Instance.UIPipelineJudgmentInputVisualizer; + + [RelayCommand] + void OnUIPipelineHunter() => Configure.Instance.UIPipelineHunter = !Configure.Instance.UIPipelineHunter; + + [RelayCommand] + void OnUICommentNote() => Configure.Instance.UICommentNote = !Configure.Instance.UICommentNote; + + [RelayCommand] + void OnUIPipelineMainJudgmentMeter() => Configure.Instance.UIPipelineMainJudgmentMeter = !Configure.Instance.UIPipelineMainJudgmentMeter; + + [RelayCommand] + void OnLowHitPointsFaintUI() => Configure.Instance.LowHitPointsFaintUI = !Configure.Instance.LowHitPointsFaintUI; + + [RelayCommand] + void OnAlwaysNotP2Position() => Configure.Instance.AlwaysNotP2Position = !Configure.Instance.AlwaysNotP2Position; + + [RelayCommand] + void OnNetCommentFollow() => Configure.Instance.NetCommentFollow = !Configure.Instance.NetCommentFollow; + + [RelayCommand] + void OnNetItemTarget() => Configure.Instance.UbuntuNetItemTarget = !Configure.Instance.UbuntuNetItemTarget; + + [RelayCommand] + void OnHandleMeter() => Configure.Instance.HandleMeter = !Configure.Instance.HandleMeter; + + [RelayCommand] + void OnFlowNetItem() => Configure.Instance.FlowNetItem = !Configure.Instance.FlowNetItem; + + [RelayCommand] + void OnIsFailMode() => Configure.Instance.IsFailMode = !Configure.Instance.IsFailMode; + + [RelayCommand] + void OnPutCopyNotes() => ViewModels.Instance.MainValue.ModeComponentValue.PutCopyNotesValueV2 = (ModeComponent.PutCopyNotes)(((int)ViewModels.Instance.MainValue.ModeComponentValue.PutCopyNotesValueV2 + 1) % 4); + + [RelayCommand] + void OnInitModeComponent() => ViewModels.Instance.MainValue.InitModeComponent(); + + [RelayCommand] + void OnModifyModeComponent(int? e) + { + if (e.HasValue) + { + var toModifyModeComponentViewModel = ViewModels.Instance.ModifyModeComponentValue; + toModifyModeComponentViewModel.ModeComponentVariety = e.Value; + toModifyModeComponentViewModel.Open(); + } + } + + [RelayCommand] + void OnSaveModeComponent(int? e) + { + if (e.HasValue) + { + var modeComponentBundle = Configure.Instance.ModeComponentBundles[e.Value]; + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewInputWindow, + Contents = new object[] + { + LanguageSystem.Instance.SaveModeComponentContents, + modeComponentBundle.Name, + new Action(modeComponentBundleName => + { + modeComponentBundle.Name = modeComponentBundleName; + modeComponentBundle.Value.CopyAs(ViewModels.Instance.MainValue.ModeComponentValue); + }) + } + }); + } + } + + [RelayCommand] + void OnSaveAsBundle() + { + switch (TabPositionUI) + { + case 0: + if (BaseUIItemValue != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveAsBundle, new + { + bundleVariety = BundleItem.BundleVariety.UI, + bundleName = BaseUIItemValue.YamlName, + bundleEntryPath = Path.Combine(BaseUIItemValue.UIEntry, BaseUIItemValue.YamlName) + }); + } + break; + case 1: + if (UIItemValue != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveAsBundle, new + { + bundleVariety = BundleItem.BundleVariety.UI, + bundleName = UIItemValue.YamlName, + bundleEntryPath = Path.Combine(UIItemValue.UIEntry, UIItemValue.YamlName) + }); + } + break; + } + } + + void SetUI(int i) + { + var target = i == 0 ? BaseUIItemValue : UIItemValue; + Titles[i] = target?.Title ?? string.Empty; + Comments[i] = string.Empty; + Drawings[i] = null; + if (target != null) + { + try + { + string zipName; + + var ys = new YamlStream(); + using (var sr = File.OpenText(target.GetYamlFilePath())) + { + ys.Load(sr); + var valueNode = ys.Documents[0].RootNode; + var formatNode = valueNode[new YamlScalarNode("format")]; + Titles[i] = Utility.GetText(formatNode, $"title-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(formatNode, "title") ?? target.Title; + Comments[i] = Utility.GetText(formatNode, $"comment-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(formatNode, "comment"); + zipName = $"{(i == 0 ? '@' : string.Empty)}{Utility.GetText(formatNode, "zip")}"; + } + + var zipFilePath = Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, Path.ChangeExtension(zipName, "zip")); + if (File.Exists(zipFilePath)) + { + var drawingFileName = $"_{target.YamlName.Substring(i == 0 ? 1 : 0)}."; + using var zipFile = new ZipFile(zipFilePath); + var drawingZipEntry = zipFile.FirstOrDefault(zipEntry => zipEntry.FileName.IsFrontCaselsss(drawingFileName)); + if (drawingZipEntry != null) + { + try + { + using var rms = PoolSystem.Instance.GetDataFlow((int)drawingZipEntry.UncompressedSize); + drawingZipEntry.Extract(rms); + Drawings[i] = DrawingSystem.Instance.LoadDefault(rms, null); + } + catch + { + } + } + } + } + catch + { + } + } + + OnPropertyChanged(nameof(Titles)); + OnPropertyChanged(nameof(Comments)); + OnPropertyChanged(nameof(Drawings)); + } + + public ObservableCollection HwModeCollection { get; } = new(); + + public string DateText { get; } = $"v{QwilightComponent.DateText} ({QwilightComponent.HashText.Substring(0, 8)})"; + + public bool IsValve => QwilightComponent.IsValve; + + public bool DInputBMSControllerMode + { + get => _dInputControllerVarietyInputs[0]; + + set + { + if (SetProperty(ref _dInputControllerVarietyInputs[0], value, nameof(DInputBMSControllerMode)) && value) + { + Configure.Instance.DInputControllerVarietyValue = ControllerSystem.DInputControllerVariety.BMS; + } + } + } + + public bool DInputIIDXControllerMode + { + get => _dInputControllerVarietyInputs[1]; + + set + { + if (SetProperty(ref _dInputControllerVarietyInputs[1], value, nameof(DInputIIDXControllerMode)) && value) + { + Configure.Instance.DInputControllerVarietyValue = ControllerSystem.DInputControllerVariety.IIDX; + } + } + } + + public bool CanGetDefaultText => TwilightSystem.Instance.IsEstablished && Configure.Instance.DetailedConfigure; + + public void NotifyCanGetDefaultText() => OnPropertyChanged(nameof(CanGetDefaultText)); + + public bool CanSaveAsBundle => TwilightSystem.Instance.IsSignedIn && TabPositionUI != 2; + + public void NotifyCanSaveAsBundle() => OnPropertyChanged(nameof(CanSaveAsBundle)); + + public override double TargetLength => 0.9; + + public double CPUCount => QwilightComponent.CPUCount; + + public string MainControllerPowerStatus + { + get => _mainControllerPowerStatus; + + set => SetProperty(ref _mainControllerPowerStatus, value, nameof(MainControllerPowerStatus)); + } + + public bool DefaultInputAudioVariety + { + get => _inputAudioVarietyInputs[0]; + + set + { + if (SetProperty(ref _inputAudioVarietyInputs[0], value, nameof(DefaultInputAudioVariety)) && value) + { + Configure.Instance.InputAudioVarietyValue = Configure.InputAudioVariety.DJMAX; + } + } + } + + public bool IIDXInputAudioVariety + { + get => _inputAudioVarietyInputs[1]; + + set + { + if (SetProperty(ref _inputAudioVarietyInputs[1], value, nameof(IIDXInputAudioVariety)) && value) + { + Configure.Instance.InputAudioVarietyValue = Configure.InputAudioVariety.IIDX; + } + } + } + + public bool AudioVarietyWASAPI + { + get => _audioVarietyInputs[0]; + + set + { + if (SetProperty(ref _audioVarietyInputs[0], value, nameof(AudioVarietyWASAPI)) && value) + { + AudioSystem.Instance.SetAudioVariety(Configure.Instance.AudioVariety = OUTPUTTYPE.WASAPI); + } + } + } + + public bool AudioVarietyASIO + { + get => _audioVarietyInputs[1]; + + set + { + if (SetProperty(ref _audioVarietyInputs[1], value, nameof(AudioVarietyASIO)) && value) + { + AudioSystem.Instance.SetAudioVariety(Configure.Instance.AudioVariety = OUTPUTTYPE.ASIO); + } + } + } + + public bool DefaultGPUMode + { + get => _valueGPUModeInputs[0]; + + set + { + if (SetProperty(ref _valueGPUModeInputs[0], value, nameof(DefaultGPUMode)) && value) + { + GPUConfigure.Instance.GPUModeValue = GPUConfigure.GPUMode.Default; + } + } + } + + public bool NVIDIAGPUMode + { + get => _valueGPUModeInputs[1]; + + set + { + if (SetProperty(ref _valueGPUModeInputs[1], value, nameof(NVIDIAGPUMode)) && value) + { + GPUConfigure.Instance.GPUModeValue = GPUConfigure.GPUMode.NVIDIA; + } + } + } + + public bool LoopUnit1000 + { + get => _loopUnitInputs[0]; + + set + { + if (SetProperty(ref _loopUnitInputs[0], value, nameof(LoopUnit1000)) && value) + { + Configure.Instance.LoopUnit = 1000; + } + } + } + + public bool LoopUnit2000 + { + get => _loopUnitInputs[1]; + + set + { + if (SetProperty(ref _loopUnitInputs[1], value, nameof(LoopUnit2000)) && value) + { + Configure.Instance.LoopUnit = 2000; + } + } + } + + public bool LoopUnit4000 + { + get => _loopUnitInputs[2]; + + set + { + if (SetProperty(ref _loopUnitInputs[2], value, nameof(LoopUnit4000)) && value) + { + Configure.Instance.LoopUnit = 4000; + } + } + } + + public bool LoopUnit8000 + { + get => _loopUnitInputs[3]; + + set + { + if (SetProperty(ref _loopUnitInputs[3], value, nameof(LoopUnit8000)) && value) + { + Configure.Instance.LoopUnit = 8000; + } + } + } + + public int DetailedAudioInputValue + { + get => _detailedAudioInputValue; + + set => SetProperty(ref _detailedAudioInputValue, value, nameof(DetailedAudioInputValue)); + } + + public long DetailedSet + { + get => _detailedSet; + + set => SetProperty(ref _detailedSet, value, nameof(DetailedSet)); + } + + public string DetailedAudioItemCount + { + get => _detailedAudioItemCount; + + set => SetProperty(ref _detailedAudioItemCount, value, nameof(DetailedAudioItemCount)); + } + + public string DetailedAudioHandlerItemCount + { + get => _detailedAudioHandlerItemCount; + + set => SetProperty(ref _detailedAudioHandlerItemCount, value, nameof(DetailedAudioHandlerItemCount)); + } + + public string DetailedHandlingAudioCount + { + get => _detailedHandlingAudioCount; + + set => SetProperty(ref _detailedHandlingAudioCount, value, nameof(DetailedHandlingAudioCount)); + } + + public float DetailedAudioUnitStatus + { + get => _detailedAudioUnitStatus; + + set => SetProperty(ref _detailedAudioUnitStatus, value, nameof(DetailedAudioUnitStatus)); + } + + public string DetailedMediaItemCount + { + get => _detailedMediaItemCount; + + set => SetProperty(ref _detailedMediaItemCount, value, nameof(DetailedMediaItemCount)); + } + + public string DetailedMediaHandlerItemCount + { + get => _detailedMediaHandlerItemCount; + + set => SetProperty(ref _detailedMediaHandlerItemCount, value, nameof(DetailedMediaHandlerItemCount)); + } + + public string DetailedDrawingItemCount + { + get => _detailedDrawingItemCount; + + set => SetProperty(ref _detailedDrawingItemCount, value, nameof(DetailedDrawingItemCount)); + } + + public string DetailedNoteDrawingCount + { + get => _detailedNoteDrawingCount; + + set => SetProperty(ref _detailedNoteDrawingCount, value, nameof(DetailedNoteDrawingCount)); + } + + public void OnTotalVolume(float audioVolume) + { + if (IsLoaded) + { + AudioSystem.Instance.SetVolume(AudioSystem.TotalAudio, audioVolume); + } + } + + public void OnMainVolume(float audioVolume) + { + if (IsLoaded) + { + AudioSystem.Instance.SetVolume(AudioSystem.MainAudio, audioVolume); + } + } + + public void OnInputVolume(float audioVolume) + { + if (IsLoaded) + { + AudioSystem.Instance.SetVolume(AudioSystem.InputAudio, audioVolume); + } + } + + public void OnSEVolume(float audioVolume) + { + if (IsLoaded) + { + AudioSystem.Instance.SetVolume(AudioSystem.SEAudio, audioVolume); + } + } + + [RelayCommand] + void OnStopLastEqualAudio() => Configure.Instance.StopLastEqualAudio = !Configure.Instance.StopLastEqualAudio; + + [RelayCommand] + void OnGetMIDI() => MIDISystem.Instance.GetMIDIs(); + + [RelayCommand] + void OnFontFamily(int? e) + { + if (e.HasValue) + { + ViewModels.Instance.FontFamilyValue.FontPosition = e.Value; + ViewModels.Instance.FontFamilyValue.Open(); + } + } + + [RelayCommand] + void OnLoopWaveIn() => AudioInputSystem.Instance.LoopWaveIn = !AudioInputSystem.Instance.LoopWaveIn; + + [RelayCommand] + void OnIsXwindow() => Configure.Instance.IsXwindow = !Configure.Instance.IsXwindow; + + [RelayCommand] + void OnDefaultControllerInputAPI() + { + Configure.Instance.DefaultControllerInputAPI = (DefaultControllerSystem.InputAPI)((int)(Configure.Instance.DefaultControllerInputAPI + 1) % 2); + DefaultControllerSystem.Instance.HandleSystem(); + } + + [RelayCommand] + void OnControllerInputAPI() => Configure.Instance.ControllerInputAPI = (ControllerSystem.InputAPI)((int)(Configure.Instance.ControllerInputAPI + 1) % 3); + + [RelayCommand] + void OnLostPointAudio() => Configure.Instance.LostPointAudio = !Configure.Instance.LostPointAudio; + + [RelayCommand] + void OnInitCompiled() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.InitCompiledNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + FastDB.Instance.Clear(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InitCompiledOK); + } + }) + } + }); + + [RelayCommand] + void OnInitFavoriteEntry() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.InitFavoriteEntryNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + ViewModels.Instance.MainValue.WipeFavoriteEntry(); + DB.Instance.WipeFavoriteEntry(); + foreach (var defaultEntryItem in Configure.Instance.DefaultEntryItems.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite).ToArray()) + { + Configure.Instance.DefaultEntryItems.Remove(defaultEntryItem); + } + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InitFavoriteEntryOK); + } + }) + } + }); + + [RelayCommand] + void OnInitWait() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.InitWaitNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Configure.Instance.AudioWait = 0.0; + Configure.Instance.BanalAudioWait = 0.0; + Configure.Instance.MediaWait = 0.0; + Configure.Instance.BanalMediaWait = 0.0; + Configure.Instance.NotifyModel(); + DB.Instance.InitWait(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InitWaitOK); + } + }) + } + }); + + [RelayCommand] + void OnUndoColor() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.UndoColorNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Configure.Instance.InitColors(int.MaxValue); + AvatarTitleSystem.Instance.WipeAvatarTitles(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.UndoColorOK); + } + }) + } + }); + + [RelayCommand] + void OnInitMedia() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.InitMediaNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Configure.Instance.Media = true; + var handlingComputer = ViewModels.Instance.MainValue.GetHandlingComputer(); + if (handlingComputer != null) + { + MediaSystem.Instance.HandleDefaultIfAvailable(handlingComputer); + } + DB.Instance.InitMedia(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InitMediaOK); + } + }) + } + }); + + [RelayCommand] + void OnInitComment() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.InitCommentNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + DB.Instance.WipeComment(); + foreach (var commentFilePath in Utility.GetFiles(QwilightComponent.CommentEntryPath)) + { + Utility.WipeFile(commentFilePath); + } + ViewModels.Instance.MainValue.DefaultCommentCollection.Clear(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InitCommentOK); + } + }) + } + }); + + [RelayCommand] + void OnInitTotal() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.InitTotalNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Configure.Instance.Validate(true); + ViewModels.Instance.MainValue.SetDefaultEntryItems(); + Init(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.InitTotalOK); + } + }) + } + }); + + [RelayCommand] + void OnMode(int? e) + { + if (e.HasValue) + { + var inputVIewModel = ViewModels.Instance.InputValue; + inputVIewModel.ControllerModeValue = InputViewModel.ControllerMode.DefaultInput; + inputVIewModel.InputMode = (Component.InputMode)e.Value; + inputVIewModel.Open(); + } + else + { + ViewModels.Instance.InputStandardValue.Open(); + } + } + + [RelayCommand] + void OnControllerMode(int? e) + { + if (e.HasValue) + { + var inputVIewModel = ViewModels.Instance.InputValue; + switch (Configure.Instance.ControllerInputAPI) + { + case ControllerSystem.InputAPI.DInput: + inputVIewModel.ControllerModeValue = InputViewModel.ControllerMode.DInput; + break; + case ControllerSystem.InputAPI.XInput: + inputVIewModel.ControllerModeValue = InputViewModel.ControllerMode.XInput; + break; + case ControllerSystem.InputAPI.WGI: + inputVIewModel.ControllerModeValue = InputViewModel.ControllerMode.WGI; + break; + } + inputVIewModel.InputMode = (Component.InputMode)e.Value; + inputVIewModel.Open(); + } + else + { + var inputStandardControllerViewModel = ViewModels.Instance.InputStandardControllerValue; + switch (Configure.Instance.ControllerInputAPI) + { + case ControllerSystem.InputAPI.DInput: + inputStandardControllerViewModel.ControllerModeValue = InputStandardControllerViewModel.ControllerMode.DInput; + break; + case ControllerSystem.InputAPI.XInput: + inputStandardControllerViewModel.ControllerModeValue = InputStandardControllerViewModel.ControllerMode.XInput; + break; + case ControllerSystem.InputAPI.WGI: + inputStandardControllerViewModel.ControllerModeValue = InputStandardControllerViewModel.ControllerMode.WGI; + break; + } + inputStandardControllerViewModel.Open(); + } + } + + [RelayCommand] + void OnMIDIMode(int? e) + { + if (e.HasValue) + { + var inputVIewModel = ViewModels.Instance.InputValue; + inputVIewModel.ControllerModeValue = InputViewModel.ControllerMode.MIDI; + inputVIewModel.InputMode = (Component.InputMode)e.Value; + inputVIewModel.Open(); + } + else + { + var inputStandardControllerViewModel = ViewModels.Instance.InputStandardControllerValue; + inputStandardControllerViewModel.ControllerModeValue = InputStandardControllerViewModel.ControllerMode.MIDI; + inputStandardControllerViewModel.Open(); + } + } + + [RelayCommand] + void OnAudioInputConfigure() + { + if (Configure.Instance.AudioInput) + { + AudioInputSystem.Instance.GetWaveInValues(); + AudioInputSystem.Instance.GetWaveValues(); + } + else + { + AudioInputSystem.Instance.CloseWaveIn(); + AudioInputSystem.Instance.CloseWave(); + } + } + + [RelayCommand] + void OnWaveIn() + { + if (Configure.Instance.WaveIn) + { + AudioInputSystem.Instance.GetWaveInValues(); + } + else + { + AudioInputSystem.Instance.CloseWaveIn(); + } + } + + [RelayCommand] + void OnWave() + { + if (Configure.Instance.Wave) + { + AudioInputSystem.Instance.GetWaveValues(); + } + else + { + AudioInputSystem.Instance.CloseWave(); + } + } + + [RelayCommand] + void OnGetWaveInValues() => AudioInputSystem.Instance.GetWaveInValues(); + + [RelayCommand] + void OnGetWaveValues() => AudioInputSystem.Instance.GetWaveValues(); + + [RelayCommand] + void OnMedia() + { + Configure.Instance.Media = !Configure.Instance.Media; + ViewModels.Instance.MainValue.AutoComputer?.SetWait(); + } + + [RelayCommand] + void OnHandleInputAudio() => Configure.Instance.HandleInputAudio = !Configure.Instance.HandleInputAudio; + + [RelayCommand] + void OnBanalAudio() => Configure.Instance.BanalAudio = !Configure.Instance.BanalAudio; + + [RelayCommand] + void OnBanalMedia() => Configure.Instance.BanalMedia = !Configure.Instance.BanalMedia; + + [RelayCommand] + void OnBanalFailedMedia() => Configure.Instance.BanalFailedMedia = !Configure.Instance.BanalFailedMedia; + + [RelayCommand] + void OnBW() => BWSystem.Instance.Toggle(); + + [RelayCommand] + void OnLS() => LSSystem.Instance.Toggle(); + + [RelayCommand] + void OnAura() => AuraSystem.Instance.Toggle(); + + [RelayCommand] + void OnK70() => K70System.Instance.Toggle(); + + [RelayCommand] + void OnLoadBanalAudio() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + QwilightComponent.AudioFileFormatItems, + new Action(fileName => + { + Configure.Instance.BanalAudioFilePath = fileName; + Configure.Instance.BanalAudio = true; + AudioSystem.Instance.LoadBanalAudio(); + }) + } + }); + + [RelayCommand] + void OnLoadDefaultAudio() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + QwilightComponent.AudioFileFormatItems, + new Action(fileName => + { + Configure.Instance.DefaultAudioVarietyValue = Configure.DefaultAudioVariety.Favor; + Configure.Instance.DefaultAudioFilePath = fileName; + AudioSystem.Instance.LoadDefaultAudio(); + }) + } + }); + + [RelayCommand] + void OnDefaultAudioVariety() => Configure.Instance.DefaultAudioVarietyValue = (Configure.DefaultAudioVariety)((int)(Configure.Instance.DefaultAudioVarietyValue + 1) % 3); + + [RelayCommand] + void OnLoadBanalMedia() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + QwilightComponent.DrawingFileFormats.Concat(QwilightComponent.MediaFileFormats), + new Action(fileName => + { + Configure.Instance.BanalMediaFilePath = fileName; + Configure.Instance.BanalMedia = true; + ViewModels.Instance.MainValue.HandleAutoComputer(); + }) + } + }); + + [RelayCommand] + void OnDefaultNote() => TwilightSystem.Instance.GetDefaultNoteDate(0, false); + + [RelayCommand] + void OnDefaultUI() => TwilightSystem.Instance.GetDefaultUIDate(0, false); + + [RelayCommand] + void OnLoadBanalFailedMedia() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + QwilightComponent.DrawingFileFormats.Concat(QwilightComponent.MediaFileFormats), + new Action(fileName => + { + Configure.Instance.BanalFailedMediaFilePath = fileName; + Configure.Instance.BanalFailedMedia = true; + ViewModels.Instance.MainValue.HandleAutoComputer(); + }) + } + }); + + [RelayCommand] + void OnMediaInputConfigure() + { + if (Configure.Instance.MediaInput) + { + MediaInputSystem.Instance.GetMediaInputItems(); + } + else + { + MediaInputSystem.Instance.CloseMediaInput(); + } + } + + [RelayCommand] + void OnGetMedia() + { + MediaInputSystem.Instance.GetMediaInputItems(); + } + + [RelayCommand] + void OnGetQwilight() => ViewModels.Instance.MainValue.GetQwilight(false); + + [RelayCommand] + void OnAutoHighlight() => Configure.Instance.AutoHighlight = !Configure.Instance.AutoHighlight; + + [RelayCommand] + void OnAverager() => Configure.Instance.Averager = !Configure.Instance.Averager; + + [RelayCommand] + void OnEqualizer() => ViewModels.Instance.EqualizerValue.Open(); + + [RelayCommand] + void OnTube() => Configure.Instance.Tube = !Configure.Instance.Tube; + + [RelayCommand] + void OnSFX() => Configure.Instance.SFX = !Configure.Instance.SFX; + + [RelayCommand] + void OnFlange() => Configure.Instance.Flange = !Configure.Instance.Flange; + + [RelayCommand] + void OnVibrationMode() => Configure.Instance.VibrationModeValue = (ControllerSystem.VibrationMode)((int)(Configure.Instance.VibrationModeValue + 1) % 3); + + [RelayCommand] + void OnAutoCompute() => Configure.Instance.AutoCompute = !Configure.Instance.AutoCompute; + + [RelayCommand] + void OnWindowedMode() + { + Configure.Instance.WindowedMode = !Configure.Instance.WindowedMode; + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetWindowedMode + }); + } + + [RelayCommand] + void OnIsQwilightFill() => Configure.Instance.IsQwilightFill = !Configure.Instance.IsQwilightFill; + + [RelayCommand] + void OnVESA() => Configure.Instance.VESAV2 = !Configure.Instance.VESAV2; + + [RelayCommand] + void OnDataCount3() => Configure.Instance.DataCount3 = !Configure.Instance.DataCount3; + + [RelayCommand] + void OnNVLLMode() => Configure.Instance.NVLLModeValue = (Configure.NVLLMode)(((int)Configure.Instance.NVLLModeValue + 1) % 3); + + [RelayCommand] + void OnTelnet() + { + TelnetSystem.Instance.Toggle(); + } + + public ConfigureViewModel() + { + _detailedHandler = new(DispatcherPriority.Background, HandlingUISystem.Instance.UIHandler) + { + Interval = TimeSpan.FromSeconds(1) + }; + _detailedHandler.Tick += (sender, e) => + { + DetailedSet = Environment.WorkingSet; + DetailedAudioItemCount = AudioSystem.Instance.AudioItemCount.ToString(LanguageSystem.Instance.OpenedCountContents); + DetailedAudioHandlerItemCount = AudioSystem.Instance.AudioHandlerItemCount.ToString(LanguageSystem.Instance.OpenedCountContents); + DetailedAudioInputValue = (int)AudioInputSystem.Instance.AudioInputValue; + DetailedHandlingAudioCount = AudioSystem.Instance.GetHandlingAudioCount().ToString(LanguageSystem.Instance.OpenedCountContents); + DetailedAudioUnitStatus = AudioSystem.Instance.GetAudioUnitStatus() / 100; + DetailedDrawingItemCount = DrawingSystem.Instance.DrawingItemCount.ToString(LanguageSystem.Instance.OpenedCountContents); + DetailedMediaItemCount = MediaSystem.Instance.MediaItemCount.ToString(LanguageSystem.Instance.OpenedCountContents); + DetailedMediaHandlerItemCount = MediaSystem.Instance.MediaHandlerItemCount.ToString(LanguageSystem.Instance.OpenedCountContents); + DetailedNoteDrawingCount = ViewModels.Instance.MainValue.NoteDrawingCount.ToString(LanguageSystem.Instance.OpenedCountContents); + MainControllerPowerStatus = ControllerSystem.Instance.MainControllerPower; + ControllerSystem.Instance.MainControllerPower = null; + }; + } + + void Init() + { + switch (Configure.Instance.DInputControllerVarietyValue) + { + case ControllerSystem.DInputControllerVariety.BMS: + DInputBMSControllerMode = true; + break; + case ControllerSystem.DInputControllerVariety.IIDX: + DInputIIDXControllerMode = true; + break; + } + switch (Configure.Instance.InputAudioVarietyValue) + { + case Configure.InputAudioVariety.DJMAX: + DefaultInputAudioVariety = true; + break; + case Configure.InputAudioVariety.IIDX: + IIDXInputAudioVariety = true; + break; + } + switch (Configure.Instance.LoopUnit) + { + case 1000: + LoopUnit1000 = true; + break; + case 2000: + LoopUnit2000 = true; + break; + case 4000: + LoopUnit4000 = true; + break; + case 8000: + LoopUnit8000 = true; + break; + } + switch (Configure.Instance.AudioVariety) + { + case OUTPUTTYPE.WASAPI: + AudioVarietyWASAPI = true; + break; + case OUTPUTTYPE.ASIO: + AudioVarietyASIO = true; + break; + } + switch (GPUConfigure.Instance.GPUModeValue) + { + case GPUConfigure.GPUMode.Default: + DefaultGPUMode = true; + break; + case GPUConfigure.GPUMode.NVIDIA: + NVIDIAGPUMode = true; + break; + } + switch (Configure.Instance.AudioVisualizerModeValue) + { + case Configure.AudioVisualizerMode.AudioVisualizerMode0: + AudioVisualizerMode0 = true; + break; + case Configure.AudioVisualizerMode.AudioVisualizerMode1: + AudioVisualizerMode1 = true; + break; + case Configure.AudioVisualizerMode.AudioVisualizerMode2: + AudioVisualizerMode2 = true; + break; + } + switch (Configure.Instance.InputMappingValue) + { + case Component.InputMapping.Mapping0: + InputMapping0 = true; + break; + case Component.InputMapping.Mapping1: + InputMapping1 = true; + break; + case Component.InputMapping.Mapping2: + InputMapping2 = true; + break; + case Component.InputMapping.Mapping3: + InputMapping3 = true; + break; + } + } + + public override void OnOpened() + { + base.OnOpened(); + Init(); + OnSetTabPositionUI(); + var mainViewModel = ViewModels.Instance.MainValue; + if (!mainViewModel.IsNoteFileMode) + { + mainViewModel.ModeComponentValue.SetMultiplier(mainViewModel.Computer.ModeComponentValue.MultiplierValue); + mainViewModel.ModeComponentValue.SetAudioMultiplier(mainViewModel.Computer.AudioMultiplier); + } + _defaultGPUMode = GPUConfigure.Instance.GPUModeValue; + _defaultHunterVariety = Configure.Instance.HunterVarietyV2Value; + _defaultNetCommentFollow = Configure.Instance.NetCommentFollow; + _defaultAudioDataLength = Configure.Instance.AudioDataLength; + _detailedHandler.Start(); + + var hwModeCollection = new List(); + var rawHwMode = new DEVMODEW(); + var i = 0U; + while (PInvoke.EnumDisplaySettings(null, (ENUM_DISPLAY_SETTINGS_MODE)i++, ref rawHwMode)) + { + if (rawHwMode.Anonymous1.Anonymous2.dmDisplayFixedOutput == 0) + { + hwModeCollection.Add(new(rawHwMode.dmPelsWidth, rawHwMode.dmPelsHeight, rawHwMode.dmDisplayFrequency)); + } + } + hwModeCollection.Sort(); + Utility.SetUICollection(HwModeCollection, hwModeCollection); + } + + public override void OnCollasped() + { + base.OnCollasped(); + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.OnJudgmentMeterMillisModified(); + mainViewModel.HandleAutoComputer(); + ViewModels.Instance.SiteContainerValue.CallSetModeComponent(); + var handlingComputer = ViewModels.Instance.MainValue.GetHandlingComputer(); + if (handlingComputer != null) + { + Task.Run(handlingComputer.SetUIMap); + if (_defaultHunterVariety != Configure.Instance.HunterVarietyV2Value || _defaultNetCommentFollow != Configure.Instance.NetCommentFollow) + { + handlingComputer.InitNetComments(); + } + } + if (mainViewModel.IsNoteFileMode) + { + mainViewModel.NotifyBPMText(); + mainViewModel.NotifyHighestInputCountText(); + } + _detailedHandler.Stop(); + if (_defaultGPUMode != GPUConfigure.Instance.GPUModeValue) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.GPUModeModified); + } + if (_defaultAudioDataLength != Configure.Instance.AudioDataLength) + { + mainViewModel.CloseAutoComputer(); + AudioSystem.Instance.Dispose(); + AudioSystem.Instance.Init(); + AudioSystem.Instance.LoadDefaultAudio(); + AudioSystem.Instance.LoadBanalAudio(); + Task.Run(() => + { + BaseUI.Instance.LoadUI(null, Configure.Instance.BaseUIItemValue, false); + UI.Instance.LoadUI(null, Configure.Instance.UIItemValue, false); + }); + } + mainViewModel.AutoComputer?.SetWait(); + mainViewModel.HandleAutoComputer(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/EqualizerViewModel.cs b/Qwilight/Qwilight/ViewModel/EqualizerViewModel.cs new file mode 100644 index 0000000..53bfd9b --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/EqualizerViewModel.cs @@ -0,0 +1,52 @@ +using CommunityToolkit.Mvvm.Input; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed partial class EqualizerViewModel : BaseViewModel + { + public void OnEqualizer0(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizer(0, (float)e.NewValue); + + public void OnEqualizer1(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizer(1, (float)e.NewValue); + + public void OnEqualizer2(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizer(2, (float)e.NewValue); + + public void OnEqualizer3(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizer(3, (float)e.NewValue); + + public void OnEqualizer4(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizer(4, (float)e.NewValue); + + public void OnEqualizerHz0(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizerHz(0, (float)e.NewValue); + + public void OnEqualizerHz1(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizerHz(1, (float)e.NewValue); + + public void OnEqualizerHz2(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizerHz(2, (float)e.NewValue); + + public void OnEqualizerHz3(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizerHz(3, (float)e.NewValue); + + public void OnEqualizerHz4(RoutedPropertyChangedEventArgs e) => AudioSystem.Instance.SetEqualizerHz(4, (float)e.NewValue); + + public void OnEqualizerSet(bool isEqualizerSet) => AudioSystem.Instance.SetEqualizer(isEqualizerSet); + + public override double TargetLength => 0.4; + + public override double TargetHeight => 0.4; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + [RelayCommand] + void OnUndoEqualizer() + { + Configure.Instance.UndoEqualizers(int.MaxValue); + AudioSystem.Instance.SetEqualizer(0, (float)Configure.Instance.Equalizer0); + AudioSystem.Instance.SetEqualizer(1, (float)Configure.Instance.Equalizer1); + AudioSystem.Instance.SetEqualizer(2, (float)Configure.Instance.Equalizer2); + AudioSystem.Instance.SetEqualizer(3, (float)Configure.Instance.Equalizer3); + AudioSystem.Instance.SetEqualizer(4, (float)Configure.Instance.Equalizer4); + AudioSystem.Instance.SetEqualizerHz(0, (float)Configure.Instance.Equalizer0); + AudioSystem.Instance.SetEqualizerHz(1, (float)Configure.Instance.Equalizer1); + AudioSystem.Instance.SetEqualizerHz(2, (float)Configure.Instance.Equalizer2); + AudioSystem.Instance.SetEqualizerHz(3, (float)Configure.Instance.Equalizer3); + AudioSystem.Instance.SetEqualizerHz(4, (float)Configure.Instance.Equalizer4); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/EventNoteViewModel.cs b/Qwilight/Qwilight/ViewModel/EventNoteViewModel.cs new file mode 100644 index 0000000..cbb81aa --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/EventNoteViewModel.cs @@ -0,0 +1,113 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.NoteFile; +using System.Collections.ObjectModel; +using System.Data.SQLite; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class EventNoteViewModel : BaseViewModel + { + string _eventNoteName; + BaseNoteFile _noteFile; + + public override double TargetLength => 0.8; + + public override double TargetHeight => 0.6; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public ObservableCollection NoteFileCollection { get; } = new(); + + public BaseNoteFile NoteFile + { + get => _noteFile; + + set => SetProperty(ref _noteFile, value, nameof(NoteFile)); + } + + public string EventNoteName + { + get => _eventNoteName; + + set => SetProperty(ref _eventNoteName, value, nameof(EventNoteName)); + } + + public void OnNoteFileView(KeyEventArgs e) + { + switch (e.Key) + { + case Key.Up when NoteFile != null: + var i = NoteFileCollection.IndexOf(NoteFile); + if (i > 0) + { + NoteFileCollection.Move(i, i - 1); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointEventNoteView, + Contents = NoteFile + }); + e.Handled = true; + break; + case Key.Down when NoteFile != null: + i = NoteFileCollection.IndexOf(NoteFile); + if (i < NoteFileCollection.Count - 1) + { + NoteFileCollection.Move(i, i + 1); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointEventNoteView, + Contents = NoteFile + }); + e.Handled = true; + break; + case Key.Delete when NoteFile != null: + i = NoteFileCollection.IndexOf(NoteFile); + NoteFileCollection.RemoveAt(i); + if (i < NoteFileCollection.Count) + { + NoteFile = NoteFileCollection[i]; + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointEventNoteView, + Contents = NoteFile + }); + break; + } + } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + OnSetEventNote(); + } + } + + [RelayCommand] + void OnSetEventNote() + { + try + { + var eventNoteID = string.Join('/', NoteFileCollection.Select(noteFile => noteFile.GetNoteID512())); + var date = DateTime.Now; + DB.Instance.SetEventNote(eventNoteID, EventNoteName, date, DB.EventNoteVariety.Qwilight); + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.LoadEventNoteEntryItems(); + mainViewModel.Want(); + Close(); + NoteFileCollection.Clear(); + EventNoteName = null; + } + catch (SQLiteException) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.BeforeEventNoteContents); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/FavorHitPointsViewModel.cs b/Qwilight/Qwilight/ViewModel/FavorHitPointsViewModel.cs new file mode 100644 index 0000000..4ab87e1 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/FavorHitPointsViewModel.cs @@ -0,0 +1,107 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class FavorHitPointsViewModel : BaseViewModel + { + string _favorHitPointsName; + FavorHitPoints? _favorHitPointsValue; + + public override double TargetLength => 0.3; + + public override double TargetHeight => 0.6; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public FavorHitPoints? FavorHitPointsValue + { + get => _favorHitPointsValue; + + set + { + if (SetProperty(ref _favorHitPointsValue, value, nameof(FavorHitPointsValue)) && value.HasValue) + { + var favorHitPointsValue = value.Value.Value; + ViewModels.Instance.MainValue.ModeComponentValue.HighestHitPoints0 = favorHitPointsValue[(int)Component.Judged.Highest][0]; + ViewModels.Instance.MainValue.ModeComponentValue.HigherHitPoints0 = favorHitPointsValue[(int)Component.Judged.Higher][0]; + ViewModels.Instance.MainValue.ModeComponentValue.HighHitPoints0 = favorHitPointsValue[(int)Component.Judged.High][0]; + ViewModels.Instance.MainValue.ModeComponentValue.LowHitPoints0 = favorHitPointsValue[(int)Component.Judged.Low][0]; + ViewModels.Instance.MainValue.ModeComponentValue.LowerHitPoints0 = favorHitPointsValue[(int)Component.Judged.Lower][0]; + ViewModels.Instance.MainValue.ModeComponentValue.LowestHitPoints0 = favorHitPointsValue[(int)Component.Judged.Lowest][0]; + + ViewModels.Instance.MainValue.ModeComponentValue.HighestHitPoints1 = favorHitPointsValue[(int)Component.Judged.Highest][1]; + ViewModels.Instance.MainValue.ModeComponentValue.HigherHitPoints1 = favorHitPointsValue[(int)Component.Judged.Higher][1]; + ViewModels.Instance.MainValue.ModeComponentValue.HighHitPoints1 = favorHitPointsValue[(int)Component.Judged.High][1]; + ViewModels.Instance.MainValue.ModeComponentValue.LowHitPoints1 = favorHitPointsValue[(int)Component.Judged.Low][1]; + ViewModels.Instance.MainValue.ModeComponentValue.LowerHitPoints1 = favorHitPointsValue[(int)Component.Judged.Lower][1]; + ViewModels.Instance.MainValue.ModeComponentValue.LowestHitPoints1 = favorHitPointsValue[(int)Component.Judged.Lowest][1]; + + OnPropertyChanged(nameof(CanWipe)); + } + } + } + + public bool CanWipe => FavorHitPointsValue?.IsDefault == false; + + public ObservableCollection FavorHitPointsCollection { get; } = new(); + + public string FavorHitPointsName + { + get => _favorHitPointsName; + + set => SetProperty(ref _favorHitPointsName, value, nameof(FavorHitPointsName)); + } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + OnSetFavorHitPoints(); + } + } + + [RelayCommand] + void OnSetFavorHitPoints() + { + var value = new double[6][]; + var favorHitPoints = ViewModels.Instance.MainValue.ModeComponentValue.FavorHitPoints; + for (var i = favorHitPoints.Length - 1; i >= 0; --i) + { + value[i] = new double[favorHitPoints[i].Length]; + for (var j = favorHitPoints[i].Length - 1; j >= 0; --j) + { + value[i][j] = favorHitPoints[i][j]; + } + } + var favorHitPointsValue = new FavorHitPoints + { + Name = FavorHitPointsName, + Value = value + }; + Configure.Instance.FavorHitPoints.Add(favorHitPointsValue); + SetFavorHitPointsCollection(); + FavorHitPointsValue = favorHitPointsValue; + FavorHitPointsName = string.Empty; + } + + [RelayCommand] + void OnQuitFavorHitPoints() + { + Configure.Instance.FavorHitPoints.Remove(FavorHitPointsValue.Value); + SetFavorHitPointsCollection(); + } + + public void SetFavorHitPointsCollection() => Utility.SetUICollection(FavorHitPointsCollection, Configure.Instance.FavorHitPoints); + + public override void OnOpened() + { + base.OnOpened(); + SetFavorHitPointsCollection(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/FavorJudgmentViewModel.cs b/Qwilight/Qwilight/ViewModel/FavorJudgmentViewModel.cs new file mode 100644 index 0000000..820460e --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/FavorJudgmentViewModel.cs @@ -0,0 +1,107 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class FavorJudgmentViewModel : BaseViewModel + { + string _favorJudgmentName; + FavorJudgment? _favorJudgmentValue; + + public override double TargetLength => 0.3; + + public override double TargetHeight => 0.55; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public FavorJudgment? FavorJudgmentValue + { + get => _favorJudgmentValue; + + set + { + if (SetProperty(ref _favorJudgmentValue, value, nameof(FavorJudgmentValue)) && value.HasValue) + { + var favorJudgmentValue = value.Value.Value; + ViewModels.Instance.MainValue.ModeComponentValue.HighestJudgment0 = favorJudgmentValue[(int)Component.Judged.Highest][0]; + ViewModels.Instance.MainValue.ModeComponentValue.HigherJudgment0 = favorJudgmentValue[(int)Component.Judged.Higher][0]; + ViewModels.Instance.MainValue.ModeComponentValue.HighJudgment0 = favorJudgmentValue[(int)Component.Judged.High][0]; + ViewModels.Instance.MainValue.ModeComponentValue.LowJudgment0 = favorJudgmentValue[(int)Component.Judged.Low][0]; + ViewModels.Instance.MainValue.ModeComponentValue.LowerJudgment0 = favorJudgmentValue[(int)Component.Judged.Lower][0]; + ViewModels.Instance.MainValue.ModeComponentValue.LowestJudgment0 = favorJudgmentValue[(int)Component.Judged.Lowest][0]; + + ViewModels.Instance.MainValue.ModeComponentValue.HighestJudgment1 = favorJudgmentValue[(int)Component.Judged.Highest][1]; + ViewModels.Instance.MainValue.ModeComponentValue.HigherJudgment1 = favorJudgmentValue[(int)Component.Judged.Higher][1]; + ViewModels.Instance.MainValue.ModeComponentValue.HighJudgment1 = favorJudgmentValue[(int)Component.Judged.High][1]; + ViewModels.Instance.MainValue.ModeComponentValue.LowJudgment1 = favorJudgmentValue[(int)Component.Judged.Low][1]; + ViewModels.Instance.MainValue.ModeComponentValue.LowerJudgment1 = favorJudgmentValue[(int)Component.Judged.Lower][1]; + ViewModels.Instance.MainValue.ModeComponentValue.LowestJudgment1 = favorJudgmentValue[(int)Component.Judged.Lowest][1]; + + OnPropertyChanged(nameof(CanWipe)); + } + } + } + + public bool CanWipe => FavorJudgmentValue?.IsDefault == false; + + public ObservableCollection FavorJudgmentCollection { get; } = new(); + + public string FavorJudgmentName + { + get => _favorJudgmentName; + + set => SetProperty(ref _favorJudgmentName, value, nameof(FavorJudgmentName)); + } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + OnSetFavorJudgment(); + } + } + + [RelayCommand] + void OnSetFavorJudgment() + { + var value = new double[6][]; + var favorJudgments = ViewModels.Instance.MainValue.ModeComponentValue.FavorJudgments; + for (var i = favorJudgments.Length - 1; i >= 0; --i) + { + value[i] = new double[favorJudgments[i].Length]; + for (var j = favorJudgments[i].Length - 1; j >= 0; --j) + { + value[i][j] = favorJudgments[i][j]; + } + } + var favorJudgmentValue = new FavorJudgment + { + Name = FavorJudgmentName, + Value = value + }; + Configure.Instance.FavorJudgments.Add(favorJudgmentValue); + SetFavorHitPointsCollection(); + FavorJudgmentValue = favorJudgmentValue; + FavorJudgmentName = string.Empty; + } + + [RelayCommand] + void OnQuitFavorJudgment() + { + Configure.Instance.FavorJudgments.Remove(FavorJudgmentValue.Value); + SetFavorHitPointsCollection(); + } + + public void SetFavorHitPointsCollection() => Utility.SetUICollection(FavorJudgmentCollection, Configure.Instance.FavorJudgments); + + public override void OnOpened() + { + base.OnOpened(); + SetFavorHitPointsCollection(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/FavoriteEntryViewModel.cs b/Qwilight/Qwilight/ViewModel/FavoriteEntryViewModel.cs new file mode 100644 index 0000000..35f0d8c --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/FavoriteEntryViewModel.cs @@ -0,0 +1,141 @@ +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class FavoriteEntryViewModel : BaseViewModel + { + public const int NoteFileMode = 0; + public const int EntryItemMode = 1; + + public override double TargetLength => 0.2; + + public override double TargetHeight => 0.4; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + int _mode; + + public ObservableCollection FavoriteEntryCollection { get; } = new(); + + public BaseNoteFile NoteFile { get; set; } + + public EntryItem EntryItem { get; set; } + + public int Mode + { + get => _mode; + + set => SetProperty(ref _mode, value, nameof(Mode)); + } + + public override void OnOpened() + { + base.OnOpened(); + Utility.SetUICollection(FavoriteEntryCollection, Configure.Instance.DefaultEntryItems.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite).ToArray()); + var favoriteEntryItems = new List(FavoriteEntryCollection); + FavoriteEntryCollection.Clear(); + foreach (var favoriteEntryItem in favoriteEntryItems.Order()) + { + FavoriteEntryCollection.Add(favoriteEntryItem); + } + switch (Mode) + { + case NoteFileMode: + foreach (var favoriteEntryItem in favoriteEntryItems) + { + favoriteEntryItem.FavoriteEntryStatus = NoteFile.FavoriteEntryItems.Contains(favoriteEntryItem); + } + break; + case EntryItemMode: + foreach (var favoriteEntryItem in favoriteEntryItems) + { + var favoriteEntryValueCount = EntryItem.NoteFiles.Where(noteFile => noteFile.FavoriteEntryItems.Contains(favoriteEntryItem)).Count(); + if (favoriteEntryValueCount == EntryItem.NoteFiles.Length) + { + favoriteEntryItem.FavoriteEntryStatus = true; + } + else if (favoriteEntryValueCount == 0) + { + favoriteEntryItem.FavoriteEntryStatus = false; + } + else + { + favoriteEntryItem.FavoriteEntryStatus = null; + } + } + break; + } + } + + public override void OnCollasped() + { + base.OnCollasped(); + var favoriteEntryItemsModified = new HashSet(); + switch (Mode) + { + case NoteFileMode: + foreach (var favoriteEntryItem in FavoriteEntryCollection) + { + if (favoriteEntryItem.FavoriteEntryStatus.Value) + { + if (NoteFile.FavoriteEntryItems.Add(favoriteEntryItem)) + { + favoriteEntryItemsModified.Add(favoriteEntryItem); + } + } + else + { + if (NoteFile.FavoriteEntryItems.Remove(favoriteEntryItem)) + { + favoriteEntryItemsModified.Add(favoriteEntryItem); + } + } + } + foreach (var favoriteEntryItem in NoteFile.FavoriteEntryItems) + { + favoriteEntryItem.FrontEntryPaths.Add(NoteFile.DefaultEntryItem.DefaultEntryPath); + } + DB.Instance.SetFavoriteEntry(NoteFile); + break; + case EntryItemMode: + foreach (var noteFile in EntryItem.NoteFiles) + { + if (!noteFile.IsLogical) + { + foreach (var favoriteEntryItem in FavoriteEntryCollection.Where(favoriteEntryItem => favoriteEntryItem.FavoriteEntryStatus.HasValue)) + { + if (favoriteEntryItem.FavoriteEntryStatus.Value) + { + if (noteFile.FavoriteEntryItems.Add(favoriteEntryItem)) + { + favoriteEntryItemsModified.Add(favoriteEntryItem); + } + } + else + { + if (noteFile.FavoriteEntryItems.Remove(favoriteEntryItem)) + { + favoriteEntryItemsModified.Add(favoriteEntryItem); + } + } + } + foreach (var favoriteEntryItem in noteFile.FavoriteEntryItems) + { + favoriteEntryItem.FrontEntryPaths.Add(noteFile.DefaultEntryItem.DefaultEntryPath); + } + DB.Instance.SetFavoriteEntry(noteFile); + } + } + break; + } + if (favoriteEntryItemsModified.Contains(Configure.Instance.LastDefaultEntryItem)) + { + ViewModels.Instance.MainValue.Want(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/FontFamilyViewModel.cs b/Qwilight/Qwilight/ViewModel/FontFamilyViewModel.cs new file mode 100644 index 0000000..8276423 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/FontFamilyViewModel.cs @@ -0,0 +1,94 @@ +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Media; +using System.Windows.Threading; + +namespace Qwilight.ViewModel +{ + public sealed class FontFamilyViewModel : BaseViewModel + { + readonly DispatcherTimer _wantHandler; + readonly List _fontFamilyItems = new(); + FontFamilyItem? _fontFamilyItem; + string _wantInput = string.Empty; + + public override double TargetLength => 0.2; + + public override double TargetHeight => 0.5; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public int FontPosition { get; set; } + + public ObservableCollection FontFamilyCollection { get; } = new(); + + public FontFamilyItem? FontFamilyItem + { + get => _fontFamilyItem; + + set => SetProperty(ref _fontFamilyItem, value, nameof(FontFamilyItem)); + } + + public string WantInput + { + get => _wantInput; + + set => SetProperty(ref _wantInput, value, nameof(WantInput)); + } + + public void OnWant() + { + _wantHandler.Stop(); + _wantHandler.Start(); + } + + public void OnPointLower() => Close(); + + public FontFamilyViewModel() + { + foreach (var fontFamily in Fonts.SystemFontFamilies) + { + _fontFamilyItems.Add(new() + { + FontFamilyValue = fontFamily + }); + } + _wantHandler = new(DispatcherPriority.Input, HandlingUISystem.Instance.UIHandler) + { + Interval = TimeSpan.FromMilliseconds(QwilightComponent.StandardWaitMillis) + }; + _wantHandler.Tick += (sender, e) => + { + (sender as DispatcherTimer).Stop(); + SetFontFamilyCollection(); + }; + } + + public override void OnOpened() + { + base.OnOpened(); + SetFontFamilyCollection(); + } + + public override void OnCollasped() + { + base.OnCollasped(); + if (FontFamilyItem.HasValue) + { + Configure.Instance.FontFamilyValues[FontPosition] = FontFamilyItem.Value.FontFamilyValue; + Configure.Instance.SetFontFamily(); + } + } + + void SetFontFamilyCollection() + { + FontFamilyCollection.Clear(); + foreach (var fontFamilyItem in _fontFamilyItems.Where(fontFamily => fontFamily.FontFamilyNames.Any(fontFamilyName => fontFamilyName.ContainsCaselsss(WantInput)))) + { + FontFamilyCollection.Add(fontFamilyItem); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/InputPwViewModel.cs b/Qwilight/Qwilight/ViewModel/InputPwViewModel.cs new file mode 100644 index 0000000..126f2e0 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/InputPwViewModel.cs @@ -0,0 +1,74 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class InputPwViewModel : BaseViewModel + { + string _text; + string _input; + bool _isInputEditable; + + public override double TargetLength => 0.5; + + public override double TargetHeight => 0.25; + + public string Text + { + get => _text; + + set => SetProperty(ref _text, value, nameof(Text)); + } + + public string Input + { + get => _input; + + set => SetProperty(ref _input, value, nameof(Input)); + } + + public bool IsInputEditable + { + get => _isInputEditable; + + set => SetProperty(ref _isInputEditable, value, nameof(IsInputEditable)); + } + + public Action Handler { get; set; } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + OnHandle(); + } + } + + [RelayCommand] + void OnHandle() + { + Close(); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetPwWindowCipher, + Contents = new Action(inputCipher => + { + Handler(Input, inputCipher); + }) + }); + } + + [RelayCommand] + void OnQuit() => Close(); + + public override void OnOpened() + { + base.OnOpened(); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ClearPwWindowCipher + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/InputStandardControllerViewModel.cs b/Qwilight/Qwilight/ViewModel/InputStandardControllerViewModel.cs new file mode 100644 index 0000000..687dc59 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/InputStandardControllerViewModel.cs @@ -0,0 +1,196 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.Utilities; +using System.Windows; +using System.Windows.Media; +using Vortice.XInput; +using Windows.System; + +namespace Qwilight.ViewModel +{ + public sealed partial class InputStandardControllerViewModel : BaseViewModel + { + public const int LowerEntry = 0; + public const int HigherEntry = 1; + public const int LowerNoteFile = 2; + public const int HigherNoteFile = 3; + public const int LevyNoteFile = 4; + public const int Wait = 5; + public const int HandleUndo = 6; + public const int LowerMultiplier = 7; + public const int HigherMultiplier = 8; + public const int MediaMode = 9; + + public enum ControllerMode + { + DInput, XInput, WGI, MIDI + } + + int _inputPosition; + + public override double TargetHeight => 0.25; + + public Brush[] InputPaints { get; } = new Brush[11]; + + public string[] Inputs { get; } = new string[11]; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + [RelayCommand] + public void OnInputPosition(int? inputPosition) + { + if (inputPosition.HasValue) + { + SetInputPaint(_inputPosition, false); + _inputPosition = inputPosition.Value; + SetInputPaint(_inputPosition, true); + } + } + + public void OnDefaultInputLower(VirtualKey e) + { + switch (e) + { + case VirtualKey.Left: + SetInputPaint(_inputPosition, false); + if (_inputPosition == 0) + { + Close(); + } + else + { + SetInputPaint(--_inputPosition, true); + } + break; + case VirtualKey.Right: + SetInputPaint(_inputPosition, false); + if (_inputPosition == 9) + { + Close(); + } + else + { + SetInputPaint(++_inputPosition, true); + } + break; + case VirtualKey.Back: + case VirtualKey.Delete: + switch (ControllerModeValue) + { + case ControllerMode.DInput: + Configure.Instance.DInputBundlesV4.StandardInputs[_inputPosition].Data = default; + SetInput(_inputPosition, Configure.Instance.DInputBundlesV4.StandardInputs[_inputPosition]); + break; + case ControllerMode.XInput: + Configure.Instance.XInputBundlesV4.StandardInputs[_inputPosition].Data = new Gamepad + { + Buttons = GamepadButtons.None + }; + SetInput(_inputPosition, Configure.Instance.XInputBundlesV4.StandardInputs[_inputPosition]); + break; + case ControllerMode.WGI: + Configure.Instance.WGIBundlesV3.StandardInputs[_inputPosition].Data = default; + SetInput(_inputPosition, Configure.Instance.WGIBundlesV3.StandardInputs[_inputPosition]); + break; + case ControllerMode.MIDI: + Configure.Instance.MIDIBundlesV4.StandardInputs[_inputPosition].Value = default; + SetInput(_inputPosition, Configure.Instance.MIDIBundlesV4.StandardInputs[_inputPosition]); + break; + } + break; + } + } + + public void OnDInputLower(HwDInput e) + { + if (Utility.AllowInput(Configure.Instance.DInputBundlesV4, e)) + { + Configure.Instance.DInputBundlesV4.StandardInputs[_inputPosition] = e; + SetInput(_inputPosition, Configure.Instance.DInputBundlesV4.StandardInputs[_inputPosition]); + } + } + + public void OnXInputLower(HwXInput e) + { + if (Utility.AllowInput(Configure.Instance.XInputBundlesV4, e)) + { + Configure.Instance.XInputBundlesV4.StandardInputs[_inputPosition] = e; + SetInput(_inputPosition, Configure.Instance.XInputBundlesV4.StandardInputs[_inputPosition]); + } + } + + public void OnWGILower(WGI e) + { + if (Utility.AllowInput(Configure.Instance.WGIBundlesV3, e)) + { + Configure.Instance.WGIBundlesV3.StandardInputs[_inputPosition] = e; + SetInput(_inputPosition, Configure.Instance.WGIBundlesV3.StandardInputs[_inputPosition]); + } + } + + public void OnMIDILower(MIDI e) + { + if (Utility.AllowInput(Configure.Instance.MIDIBundlesV4, e)) + { + Configure.Instance.MIDIBundlesV4.StandardInputs[_inputPosition] = e; + SetInput(_inputPosition, Configure.Instance.MIDIBundlesV4.StandardInputs[_inputPosition]); + } + } + + public ControllerMode ControllerModeValue { get; set; } + + public void SetInput(int inputPosition, T toInput) + { + var input = toInput.ToString(); + if (string.IsNullOrEmpty(input)) + { + input = "❌"; + } + Inputs[inputPosition + 1] = string.Format(inputPosition switch + { + 0 => LanguageSystem.Instance.LowerEntryContents, + 1 => LanguageSystem.Instance.HigherEntryContents, + 2 => LanguageSystem.Instance.LowerNoteFileContents, + 3 => LanguageSystem.Instance.HigherNoteFileContents, + 4 => LanguageSystem.Instance.LevyNoteFileContents, + 5 => LanguageSystem.Instance.WaitContents, + 6 => LanguageSystem.Instance.HandleUndoContents, + 7 => LanguageSystem.Instance.LowerMultiplierContents, + 8 => LanguageSystem.Instance.HigherMultiplierContents, + 9 => "BGA ({0})", + _ => default + }, input); + OnPropertyChanged(nameof(Inputs)); + } + + public void SetInputPaint(int inputPosition, bool isInput) + { + InputPaints[inputPosition + 1] = isInput ? Paints.PointPaints[1] : Brushes.Transparent; + OnPropertyChanged(nameof(InputPaints)); + } + + public override void OnOpened() + { + base.OnOpened(); + for (var i = 9; i >= 0; --i) + { + SetInputPaint(i, false); + switch (ControllerModeValue) + { + case ControllerMode.DInput: + SetInput(i, Configure.Instance.DInputBundlesV4.StandardInputs[i]); + break; + case ControllerMode.XInput: + SetInput(i, Configure.Instance.XInputBundlesV4.StandardInputs[i]); + break; + case ControllerMode.WGI: + SetInput(i, Configure.Instance.WGIBundlesV3.StandardInputs[i]); + break; + case ControllerMode.MIDI: + SetInput(i, Configure.Instance.MIDIBundlesV4.StandardInputs[i]); + break; + } + } + SetInputPaint(_inputPosition = 0, true); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/InputStandardViewModel.cs b/Qwilight/Qwilight/ViewModel/InputStandardViewModel.cs new file mode 100644 index 0000000..3155697 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/InputStandardViewModel.cs @@ -0,0 +1,248 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.Utilities; +using System.Windows; +using System.Windows.Media; +using Windows.System; + +namespace Qwilight.ViewModel +{ + public sealed partial class InputStandardViewModel : BaseViewModel + { + public const int LowerMultiplier = 0; + public const int HigherMultiplier = 1; + public const int ModifyAutoMode = 2; + public const int Undo = 3; + public const int Media = 4; + public const int LowerAudioMultiplier = 5; + public const int HigherAudioMultiplier = 6; + public const int PostItem0 = 7; + public const int PostItem1 = 8; + + int _inputPosition; + bool _allowEssentialInputs; + + public override double TargetHeight => 0.25; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public Brush[] InputPaints { get; } = new Brush[10]; + + public string[] Inputs { get; } = new string[10]; + + public bool AllowEssentialInputs + { + get => _allowEssentialInputs; + + set => SetProperty(ref _allowEssentialInputs, value, nameof(AllowEssentialInputs)); + } + + [RelayCommand] + public void OnInputPosition(int? inputPosition) + { + if (inputPosition.HasValue) + { + SetInputPaint(_inputPosition, false); + _inputPosition = inputPosition.Value; + SetInputPaint(_inputPosition, true); + } + } + + public void OnDefaultInputLower(VirtualKey e) + { + switch (e) + { + case VirtualKey.Left: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + SetInputPaint(_inputPosition, false); + if (_inputPosition == 0) + { + Close(); + } + else + { + SetInputPaint(--_inputPosition, true); + } + } + break; + case VirtualKey.Right: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + SetInputPaint(_inputPosition, false); + if (_inputPosition == 8) + { + Close(); + } + else + { + SetInputPaint(++_inputPosition, true); + } + } + break; + case VirtualKey.Back: + case VirtualKey.Delete: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + Configure.Instance.DefaultInputBundlesV6.StandardInputs[_inputPosition].Data = VirtualKey.None; + SetInput(_inputPosition, Configure.Instance.DefaultInputBundlesV6.StandardInputs[_inputPosition]); + } + break; + case VirtualKey.F1: + case VirtualKey.F2: + case VirtualKey.F3: + case VirtualKey.F4: + case VirtualKey.A: + case VirtualKey.B: + case VirtualKey.C: + case VirtualKey.D: + case VirtualKey.E: + case VirtualKey.F: + case VirtualKey.G: + case VirtualKey.H: + case VirtualKey.I: + case VirtualKey.J: + case VirtualKey.K: + case VirtualKey.L: + case VirtualKey.M: + case VirtualKey.N: + case VirtualKey.O: + case VirtualKey.P: + case VirtualKey.Q: + case VirtualKey.R: + case VirtualKey.S: + case VirtualKey.T: + case VirtualKey.U: + case VirtualKey.V: + case VirtualKey.W: + case VirtualKey.X: + case VirtualKey.Y: + case VirtualKey.Z: + case VirtualKey.Number0: + case VirtualKey.Number1: + case VirtualKey.Number2: + case VirtualKey.Number3: + case VirtualKey.Number4: + case VirtualKey.Number5: + case VirtualKey.Number6: + case VirtualKey.Number7: + case VirtualKey.Number8: + case VirtualKey.Number9: + case VirtualKey.Space: + case (VirtualKey)188: + case (VirtualKey)190: + case (VirtualKey)191: + case (VirtualKey)186: + case (VirtualKey)192: + case (VirtualKey)219: + case (VirtualKey)221: + case (VirtualKey)220: + case VirtualKey.LeftControl: + case VirtualKey.Control: + case VirtualKey.LeftMenu: + case VirtualKey.Menu: + case VirtualKey.LeftShift: + case VirtualKey.RightShift: + case VirtualKey.RightControl: + case VirtualKey.Kanji: + case VirtualKey.RightMenu: + case VirtualKey.Hangul: + case (VirtualKey)222: + case (VirtualKey)187: + case (VirtualKey)189: + case VirtualKey.CapitalLock: + case VirtualKey.Insert: + case VirtualKey.Home: + case VirtualKey.End: + case VirtualKey.PageUp: + case VirtualKey.PageDown: + case VirtualKey.NumberKeyLock: + case VirtualKey.Add: + case VirtualKey.Subtract: + case VirtualKey.Multiply: + case VirtualKey.Divide: + case VirtualKey.Decimal: + case VirtualKey.NumberPad0: + case VirtualKey.NumberPad1: + case VirtualKey.NumberPad2: + case VirtualKey.NumberPad3: + case VirtualKey.NumberPad4: + case VirtualKey.NumberPad5: + case VirtualKey.NumberPad6: + case VirtualKey.NumberPad7: + case VirtualKey.NumberPad8: + case VirtualKey.NumberPad9: + case VirtualKey.Tab: + case VirtualKey.Up: + case VirtualKey.Down: + SetInputImpl(); + break; + } + void SetInputImpl() + { + var defaultInput = new DefaultInput + { + Data = e + }; + if (Utility.AllowInput(Configure.Instance.DefaultInputBundlesV6, defaultInput)) + { + Configure.Instance.DefaultInputBundlesV6.StandardInputs[_inputPosition] = defaultInput; + SetInput(_inputPosition, defaultInput); + } + } + } + + public void SetInput(int inputPosition, DefaultInput defaultInput) + { + var defaultInputText = defaultInput.ToString(); + if (string.IsNullOrEmpty(defaultInputText)) + { + defaultInputText = "❌"; + } + Inputs[inputPosition + 1] = string.Format(inputPosition switch + { + 0 => LanguageSystem.Instance.LowerMultiplierContents, + 1 => LanguageSystem.Instance.HigherMultiplierContents, + 2 => LanguageSystem.Instance.ModifyAutoModeContents, + 3 => LanguageSystem.Instance.HandleUndoContents, + 4 => "BGA ({0})", + 5 => LanguageSystem.Instance.LowerAudioMultiplierContents, + 6 => LanguageSystem.Instance.HigherAudioMultiplierContents, + 7 => LanguageSystem.Instance.PostItem0Contents, + 8 => LanguageSystem.Instance.PostItem1Contents, + _ => default + }, defaultInputText); + OnPropertyChanged(nameof(Inputs)); + } + + public void SetInputPaint(int inputPosition, bool isInput) + { + InputPaints[inputPosition + 1] = isInput ? Paints.PointPaints[1] : Brushes.Transparent; + OnPropertyChanged(nameof(InputPaints)); + } + + public override void OnOpened() + { + base.OnOpened(); + AllowEssentialInputs = false; + for (var i = Configure.Instance.DefaultInputBundlesV6.StandardInputs.Length - 1; i >= 0; --i) + { + SetInputPaint(i, false); + SetInput(i, Configure.Instance.DefaultInputBundlesV6.StandardInputs[i]); + } + _inputPosition = 0; + SetInputPaint(0, true); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/InputTextViewModel.cs b/Qwilight/Qwilight/ViewModel/InputTextViewModel.cs new file mode 100644 index 0000000..4fa33c0 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/InputTextViewModel.cs @@ -0,0 +1,46 @@ +using CommunityToolkit.Mvvm.Input; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class InputTextViewModel : BaseViewModel + { + string _text; + string _input; + + public string Text + { + get => _text; + + set => SetProperty(ref _text, value, nameof(Text)); + } + + public string Input + { + get => _input; + + set => SetProperty(ref _input, value, nameof(Input)); + } + + public override double TargetLength => 0.5; + + public override double TargetHeight => 0.2; + + public Action Handler { get; set; } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + OnHandle(); + } + } + + [RelayCommand] + void OnHandle() + { + Close(); + Handler(Input); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/InputViewModel.cs b/Qwilight/Qwilight/ViewModel/InputViewModel.cs new file mode 100644 index 0000000..f57ea64 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/InputViewModel.cs @@ -0,0 +1,866 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.Utilities; +using System.Windows; +using System.Windows.Media; +using Vortice.XInput; +using Windows.Devices.Midi; +using Windows.System; +using GamepadReading = Windows.Gaming.Input.GamepadReading; + +namespace Qwilight.ViewModel +{ + public sealed partial class InputViewModel : BaseViewModel + { + public enum ControllerMode + { + DefaultInput, DInput, XInput, WGI, MIDI + } + + readonly int[][] _inputMap = new int[17][]; + readonly int[][] _pageMap = new int[17][]; + readonly int[][][] _inputPositionMap = new int[17][][]; + ControllerMode _valueControllerMode; + Component.InputMode _inputMode; + int _inputPosition; + int _page; + int _endPage; + bool _allowEssentialsInputs; + + public override double TargetHeight => 0.3; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public TextDecorationCollection BMSFont { get; set; } + + public ControllerMode ControllerModeValue + { + get => _valueControllerMode; + + set => SetProperty(ref _valueControllerMode, value, nameof(ControllerModeValue)); + } + + public bool IsVisibleAllowEssentialsInput => ControllerModeValue == ControllerMode.DefaultInput; + + public Component.InputMode InputMode + { + get => _inputMode; + + set + { + if (SetProperty(ref _inputMode, value, nameof(InputMode))) + { + BMSFont = new[] { Component.InputMode.InputMode4, Component.InputMode.InputMode6, Component.InputMode.InputMode9, Component.InputMode.InputMode51, Component.InputMode.InputMode71, Component.InputMode.InputMode102, Component.InputMode.InputMode142 }.Contains(InputMode) ? null : TextDecorations.Strikethrough; + OnPropertyChanged(nameof(BMSFont)); + } + } + } + + public bool AllowEssentialInputs + { + get => _allowEssentialsInputs; + + set => SetProperty(ref _allowEssentialsInputs, value, nameof(AllowEssentialInputs)); + } + + public string[] Inputs { get; } = new string[11]; + + public Brush[] InputPaints { get; } = new Brush[11]; + + public Brush[] InputNotePaints { get; } = new Brush[11]; + + [RelayCommand] + public void OnInputPosition(int? inputPosition) + { + if (inputPosition.HasValue) + { + switch (ControllerModeValue) + { + case ControllerMode.DefaultInput: + InputImpl(Configure.Instance.DefaultInputBundlesV6.Inputs); + break; + case ControllerMode.DInput: + InputImpl(Configure.Instance.DInputBundlesV4.Inputs); + break; + case ControllerMode.XInput: + InputImpl(Configure.Instance.XInputBundlesV4.Inputs); + break; + case ControllerMode.WGI: + InputImpl(Configure.Instance.WGIBundlesV3.Inputs); + break; + case ControllerMode.MIDI: + InputImpl(Configure.Instance.MIDIBundlesV4.Inputs); + break; + } + + void InputImpl(T[][][] inputConfigure) + { + var inputPositionValue = _inputPositionMap[(int)_inputMode][_page][inputPosition.Value]; + SetInputPaint(_inputMap[(int)_inputMode][_inputPosition], false); + SetInputPaint(_inputMap[(int)_inputMode][inputPositionValue], true); + _inputPosition = inputPositionValue; + } + } + } + + public void OnDefaultInputLower(VirtualKey e) + { + switch (e) + { + case VirtualKey.Left: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + switch (ControllerModeValue) + { + case ControllerMode.DefaultInput: + InputImpl(Configure.Instance.DefaultInputBundlesV6.Inputs); + break; + case ControllerMode.DInput: + InputImpl(Configure.Instance.DInputBundlesV4.Inputs); + break; + case ControllerMode.XInput: + InputImpl(Configure.Instance.XInputBundlesV4.Inputs); + break; + case ControllerMode.WGI: + InputImpl(Configure.Instance.WGIBundlesV3.Inputs); + break; + case ControllerMode.MIDI: + InputImpl(Configure.Instance.MIDIBundlesV4.Inputs); + break; + } + void InputImpl(T[][][] inputConfigure) + { + SetInputPaint(_inputMap[(int)_inputMode][_inputPosition], false); + if (_inputPosition - 1 <= (_page > 0 ? _pageMap[(int)_inputMode][_page - 1] : 0)) + { + if (--_page >= 0) + { + --_inputPosition; + SetNoteInputPaint(); + for (var i = 10; i > 0; --i) + { + SetInput(i); + SetInputPaint(i, false); + } + SetInputs(Configure.Instance.DefaultInputBundlesV6.Inputs); + SetInputPaint(_inputMap[(int)_inputMode][_inputPosition], true); + } + else + { + Close(); + } + } + else + { + SetInputPaint(_inputMap[(int)_inputMode][--_inputPosition], true); + } + } + } + break; + case VirtualKey.Right: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + switch (ControllerModeValue) + { + case ControllerMode.DefaultInput: + InputImpl(Configure.Instance.DefaultInputBundlesV6.Inputs); + break; + case ControllerMode.DInput: + InputImpl(Configure.Instance.DInputBundlesV4.Inputs); + break; + case ControllerMode.XInput: + InputImpl(Configure.Instance.XInputBundlesV4.Inputs); + break; + case ControllerMode.WGI: + InputImpl(Configure.Instance.WGIBundlesV3.Inputs); + break; + case ControllerMode.MIDI: + InputImpl(Configure.Instance.MIDIBundlesV4.Inputs); + break; + } + void InputImpl(T[][][] inputConfigure) + { + SetInputPaint(_inputMap[(int)_inputMode][_inputPosition], false); + if (_inputPosition + 1 > _pageMap[(int)_inputMode][_page]) + { + if (++_page < _endPage) + { + ++_inputPosition; + SetNoteInputPaint(); + for (var i = 10; i > 0; --i) + { + SetInput(i); + SetInputPaint(i, false); + } + SetInputs(inputConfigure); + SetInputPaint(_inputMap[(int)_inputMode][_inputPosition], true); + } + else + { + Close(); + } + } + else + { + SetInputPaint(_inputMap[(int)_inputMode][++_inputPosition], true); + } + } + } + break; + case VirtualKey.Back: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + switch (ControllerModeValue) + { + case ControllerMode.DefaultInput: + InputImpl(Configure.Instance.DefaultInputBundlesV6.Inputs, input => input.Data != VirtualKey.None, i => Configure.Instance.DefaultInputBundlesV6.Inputs[(int)_inputMode][_inputPosition][i].Data = VirtualKey.None); + break; + case ControllerMode.DInput: + InputImpl(Configure.Instance.DInputBundlesV4.Inputs, input => input.Data != default, i => Configure.Instance.DInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data = default); + break; + case ControllerMode.XInput: + InputImpl(Configure.Instance.XInputBundlesV4.Inputs, input => !input.Data.Equals(default(Gamepad)), i => Configure.Instance.XInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data = default); + break; + case ControllerMode.WGI: + InputImpl(Configure.Instance.WGIBundlesV3.Inputs, input => !input.Data.Equals(default(GamepadReading)), i => Configure.Instance.WGIBundlesV3.Inputs[(int)_inputMode][_inputPosition][i].Data = default); + break; + case ControllerMode.MIDI: + InputImpl(Configure.Instance.MIDIBundlesV4.Inputs, input => input.Data != MidiMessageType.None, i => Configure.Instance.MIDIBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data = MidiMessageType.None); + break; + } + void InputImpl(T[][][] inputConfigure, Func isOK, Action onHandle) + { + for (var i = inputConfigure[(int)_inputMode][_inputPosition].Length - 1; i >= 0; --i) + { + if (isOK(inputConfigure[(int)_inputMode][_inputPosition][i])) + { + onHandle(i); + SetInput(_inputMap[(int)_inputMode][_inputPosition], inputConfigure[(int)_inputMode][_inputPosition]); + break; + } + } + } + } + break; + case VirtualKey.Delete: + if (AllowEssentialInputs) + { + SetInputImpl(); + } + else + { + switch (ControllerModeValue) + { + case ControllerMode.DefaultInput: + InputImpl(Configure.Instance.DefaultInputBundlesV6.Inputs, i => Configure.Instance.DefaultInputBundlesV6.Inputs[(int)_inputMode][_inputPosition][i].Data = VirtualKey.None); + break; + case ControllerMode.DInput: + InputImpl(Configure.Instance.DInputBundlesV4.Inputs, i => Configure.Instance.DInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data = default); + break; + case ControllerMode.XInput: + InputImpl(Configure.Instance.XInputBundlesV4.Inputs, i => Configure.Instance.XInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data = default); + break; + case ControllerMode.WGI: + InputImpl(Configure.Instance.WGIBundlesV3.Inputs, i => Configure.Instance.WGIBundlesV3.Inputs[(int)_inputMode][_inputPosition][i].Data = default); + break; + case ControllerMode.MIDI: + InputImpl(Configure.Instance.MIDIBundlesV4.Inputs, i => Configure.Instance.MIDIBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data = MidiMessageType.None); + break; + } + void InputImpl(T[][][] inputConfigure, Action onHandle) + { + for (var i = inputConfigure[(int)_inputMode][_inputPosition].Length - 1; i >= 0; --i) + { + onHandle(i); + } + SetInput(_inputMap[(int)_inputMode][_inputPosition], inputConfigure[(int)_inputMode][_inputPosition]); + } + } + break; + case VirtualKey.F1: + case VirtualKey.F2: + case VirtualKey.F3: + case VirtualKey.F4: + case VirtualKey.A: + case VirtualKey.B: + case VirtualKey.C: + case VirtualKey.D: + case VirtualKey.E: + case VirtualKey.F: + case VirtualKey.G: + case VirtualKey.H: + case VirtualKey.I: + case VirtualKey.J: + case VirtualKey.K: + case VirtualKey.L: + case VirtualKey.M: + case VirtualKey.N: + case VirtualKey.O: + case VirtualKey.P: + case VirtualKey.Q: + case VirtualKey.R: + case VirtualKey.S: + case VirtualKey.T: + case VirtualKey.U: + case VirtualKey.V: + case VirtualKey.W: + case VirtualKey.X: + case VirtualKey.Y: + case VirtualKey.Z: + case VirtualKey.Number0: + case VirtualKey.Number1: + case VirtualKey.Number2: + case VirtualKey.Number3: + case VirtualKey.Number4: + case VirtualKey.Number5: + case VirtualKey.Number6: + case VirtualKey.Number7: + case VirtualKey.Number8: + case VirtualKey.Number9: + case VirtualKey.Space: + case (VirtualKey)188: + case (VirtualKey)190: + case (VirtualKey)191: + case (VirtualKey)186: + case (VirtualKey)192: + case (VirtualKey)219: + case (VirtualKey)221: + case (VirtualKey)220: + case VirtualKey.LeftControl: + case VirtualKey.Control: + case VirtualKey.LeftMenu: + case VirtualKey.Menu: + case VirtualKey.LeftShift: + case VirtualKey.RightShift: + case VirtualKey.RightControl: + case VirtualKey.Kanji: + case VirtualKey.RightMenu: + case VirtualKey.Hangul: + case (VirtualKey)222: + case (VirtualKey)187: + case (VirtualKey)189: + case VirtualKey.CapitalLock: + case VirtualKey.Insert: + case VirtualKey.Home: + case VirtualKey.End: + case VirtualKey.PageUp: + case VirtualKey.PageDown: + case VirtualKey.NumberKeyLock: + case VirtualKey.Add: + case VirtualKey.Subtract: + case VirtualKey.Multiply: + case VirtualKey.Divide: + case VirtualKey.Decimal: + case VirtualKey.NumberPad0: + case VirtualKey.NumberPad1: + case VirtualKey.NumberPad2: + case VirtualKey.NumberPad3: + case VirtualKey.NumberPad4: + case VirtualKey.NumberPad5: + case VirtualKey.NumberPad6: + case VirtualKey.NumberPad7: + case VirtualKey.NumberPad8: + case VirtualKey.NumberPad9: + case VirtualKey.Tab: + case VirtualKey.Up: + case VirtualKey.Down: + SetInputImpl(); + break; + } + void SetInputImpl() + { + if (ControllerModeValue == ControllerMode.DefaultInput) + { + var defaultInput = new DefaultInput + { + Data = e + }; + if (Utility.AllowInput(Configure.Instance.DefaultInputBundlesV6, defaultInput, _inputMode)) + { + for (var i = 0; i < Configure.Instance.DefaultInputBundlesV6.Inputs[(int)_inputMode][_inputPosition].Length; ++i) + { + if (Configure.Instance.DefaultInputBundlesV6.Inputs[(int)_inputMode][_inputPosition][i].Data == VirtualKey.None) + { + Configure.Instance.DefaultInputBundlesV6.Inputs[(int)_inputMode][_inputPosition][i] = defaultInput; + break; + } + } + } + SetInputs(Configure.Instance.DefaultInputBundlesV6.Inputs); + } + } + } + + public void OnDInputLower(HwDInput e) + { + if (Utility.AllowInput(Configure.Instance.DInputBundlesV4, e, _inputMode)) + { + for (var i = 0; i < Configure.Instance.DInputBundlesV4.Inputs[(int)_inputMode][_inputPosition].Length; ++i) + { + if (Configure.Instance.DInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data == default) + { + Configure.Instance.DInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i] = e; + break; + } + } + } + SetInputs(Configure.Instance.DInputBundlesV4.Inputs); + } + + public void OnXInputLower(HwXInput e) + { + if (Utility.AllowInput(Configure.Instance.XInputBundlesV4, e, _inputMode)) + { + for (var i = 0; i < Configure.Instance.XInputBundlesV4.Inputs[(int)_inputMode][_inputPosition].Length; ++i) + { + if (Configure.Instance.XInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data.Equals(default(Gamepad))) + { + Configure.Instance.XInputBundlesV4.Inputs[(int)_inputMode][_inputPosition][i] = e; + break; + } + } + } + SetInputs(Configure.Instance.XInputBundlesV4.Inputs); + } + + public void OnWGILower(WGI e) + { + if (Utility.AllowInput(Configure.Instance.WGIBundlesV3, e, _inputMode)) + { + for (var i = 0; i < Configure.Instance.WGIBundlesV3.Inputs[(int)_inputMode][_inputPosition].Length; ++i) + { + if (Configure.Instance.WGIBundlesV3.Inputs[(int)_inputMode][_inputPosition][i].Data.Equals(default(GamepadReading))) + { + Configure.Instance.WGIBundlesV3.Inputs[(int)_inputMode][_inputPosition][i] = e; + break; + } + } + } + SetInputs(Configure.Instance.WGIBundlesV3.Inputs); + } + + public void OnMIDILower(MIDI e) + { + if (Utility.AllowInput(Configure.Instance.MIDIBundlesV4, e, _inputMode)) + { + for (var i = 0; i < Configure.Instance.MIDIBundlesV4.Inputs[(int)_inputMode][_inputPosition].Length; ++i) + { + if (Configure.Instance.MIDIBundlesV4.Inputs[(int)_inputMode][_inputPosition][i].Data == MidiMessageType.None) + { + Configure.Instance.MIDIBundlesV4.Inputs[(int)_inputMode][_inputPosition][i] = e; + break; + } + } + } + SetInputs(Configure.Instance.MIDIBundlesV4.Inputs); + } + + public InputViewModel() + { + _inputMap[(int)Component.InputMode.InputMode4] = new[] { default, 4, 5, 6, 7 }; + _inputMap[(int)Component.InputMode.InputMode5] = new[] { default, 4, 5, 6, 7, 8 }; + _inputMap[(int)Component.InputMode.InputMode6] = new[] { default, 3, 4, 5, 6, 7, 8 }; + _inputMap[(int)Component.InputMode.InputMode7] = new[] { default, 3, 4, 5, 6, 7, 8, 9 }; + _inputMap[(int)Component.InputMode.InputMode8] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9 }; + _inputMap[(int)Component.InputMode.InputMode9] = new[] { default, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + _inputMap[(int)Component.InputMode.InputMode10] = new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + _inputMap[(int)Component.InputMode.InputMode51] = new[] { default, 1, 4, 5, 6, 7, 8 }; + _inputMap[(int)Component.InputMode.InputMode71] = new[] { default, 1, 3, 4, 5, 6, 7, 8, 9 }; + _inputMap[(int)Component.InputMode.InputMode102] = new[] { default, + 1, 4, 5, 6, 7, 8, + 3, 4, 5, 6, 7, 10 + }; + _inputMap[(int)Component.InputMode.InputMode142] = new[] { default, + 1, 3, 4, 5, 6, 7, 8, 9, + 2, 3, 4, 5, 6, 7, 8, 10 + }; + _inputMap[(int)Component.InputMode.InputMode242] = new[] { default, + 1, 4, 5, 6, 7, 8, + 3, 4, 5, 6, 7, 8, 9, + 4, 5, 6, 7, 8, 2, 3, + 4, 5, 6, 7, 8, 10 + }; + _inputMap[(int)Component.InputMode.InputMode484] = new[] { default, + 1, 2, 4, 5, 6, 7, 8, + 3, 4, 5, 6, 7, 8, 9, + 4, 5, 6, 7, 8, + 3, 4, 5, 6, 7, 8, 9, + 4, 5, 6, 7, 8, + 3, 4, 5, 6, 7, 8, 9, + 4, 5, 6, 7, 8, + 2, 3, 4, 5, 6, 7, 8, 9, 10 + }; + _pageMap[(int)Component.InputMode.InputMode4] = new[] { 4 }; + _pageMap[(int)Component.InputMode.InputMode5] = new[] { 5 }; + _pageMap[(int)Component.InputMode.InputMode6] = new[] { 6 }; + _pageMap[(int)Component.InputMode.InputMode7] = new[] { 7 }; + _pageMap[(int)Component.InputMode.InputMode8] = new[] { 8 }; + _pageMap[(int)Component.InputMode.InputMode9] = new[] { 9 }; + _pageMap[(int)Component.InputMode.InputMode10] = new[] { 10 }; + _pageMap[(int)Component.InputMode.InputMode51] = new[] { 6 }; + _pageMap[(int)Component.InputMode.InputMode71] = new[] { 8 }; + _pageMap[(int)Component.InputMode.InputMode102] = new[] { 6, 12 }; + _pageMap[(int)Component.InputMode.InputMode142] = new[] { 8, 16 }; + _pageMap[(int)Component.InputMode.InputMode242] = new[] { 6, 13, 18, 26 }; + _pageMap[(int)Component.InputMode.InputMode484] = new[] { 7, 14, 19, 26, 31, 38, 43, 52 }; + _inputPositionMap[(int)Component.InputMode.InputMode4] = new[] { new[] { default, default, default, default, 1, 2, 3, 4, default, default, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode5] = new[] { new[] { default, default, default, default, 1, 2, 3, 4, 5, default, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode6] = new[] { new[] { default, default, default, 1, 2, 3, 4, 5, 6, default, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode7] = new[] { new[] { default, default, default, 1, 2, 3, 4, 5, 6, 7, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode8] = new[] { new[] { default, default, 1, 2, 3, 4, 5, 6, 7, 8, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode9] = new[] { new[] { default, default, 1, 2, 3, 4, 5, 6, 7, 8, 9 } }; + _inputPositionMap[(int)Component.InputMode.InputMode10] = new[] { new[] { default, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } }; + _inputPositionMap[(int)Component.InputMode.InputMode51] = new[] { new[] { default, 1, default, default, 2, 3, 4, 5, 6, default, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode71] = new[] { new[] { default, 1, default, 2, 3, 4, 5, 6, 7, 8, default } }; + _inputPositionMap[(int)Component.InputMode.InputMode102] = new[] { + new[] { default, 1, default, default, 2, 3, 4, 5, 6, default, default }, + new[] { default, default, default, 7, 8, 9, 10, 11, default, default, 12 } + }; + _inputPositionMap[(int)Component.InputMode.InputMode142] = new[] { + new[] { default, 1, default, 2, 3, 4, 5, 6, 7, 8, default }, + new[] { default, default, 9, 10, 11, 12, 13, 14, 15, default, 16 } + }; + _inputPositionMap[(int)Component.InputMode.InputMode242] = new[] { + new[] { default, 1, default, default, 2, 3, 4, 5, 6, default, default, default }, + new[] { default, default, default, 7, 8, 9, 10, 11, 12, 13, default, default }, + new[] { default, default, default, default, 14, 15, 16, 17, 18, default, default }, + new[] { default, default, 19, 20, 21, 22, 23, 24, 25, default, 26 } + }; + _inputPositionMap[(int)Component.InputMode.InputMode484] = new[] { + new[] { default, 1, 2, default, 3, 4, 5, 6, 7, default, default }, + new[] { default, default, default, 8, 9, 10, 11, 12, 13, 14, default }, + new[] { default, default, default, default, 15, 16, 17, 18, 19, default, default }, + new[] { default, default, default, 20, 21, 22, 23, 24, 25, 26, default }, + new[] { default, default, default, default, 27, 28, 29, 30, 31, default, default }, + new[] { default, default, default, 32, 33, 34, 35, 36, 37, 38, default}, + new[] { default, default, default, default, 39, 40, 41, 42, 43, default, default }, + new[] { default, default, 44, 45, 46, 47, 48, 49, 50, 51, 52 } + }; + } + + void SetInputs(T[][][] inputConfigure) + { + for (var i = (_page > 0 ? _pageMap[(int)_inputMode][_page - 1] : 0) + 1; i <= _pageMap[(int)_inputMode][_page]; ++i) + { + SetInput(_inputMap[(int)_inputMode][i], inputConfigure[(int)_inputMode][i]); + } + } + + void SetNoteInputPaint() + { + Array.Fill(InputNotePaints, null); + switch (InputMode) + { + case Component.InputMode.InputMode4: + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + break; + case Component.InputMode.InputMode5: + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case Component.InputMode.InputMode6: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case Component.InputMode.InputMode7: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case Component.InputMode.InputMode8: + InputNotePaints[2] = Paints.Paint4; + InputNotePaints[3] = Brushes.Cyan; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case Component.InputMode.InputMode9: + InputNotePaints[2] = Paints.Paint4; + InputNotePaints[3] = Brushes.Cyan; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + InputNotePaints[9] = Brushes.Cyan; + InputNotePaints[10] = Paints.Paint4; + break; + case Component.InputMode.InputMode10: + InputNotePaints[1] = Paints.Paint4; + InputNotePaints[2] = Brushes.Cyan; + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + InputNotePaints[9] = Brushes.Cyan; + InputNotePaints[10] = Paints.Paint4; + break; + case Component.InputMode.InputMode51: + InputNotePaints[1] = Paints.Paint1; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case Component.InputMode.InputMode71: + InputNotePaints[1] = Paints.Paint1; + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case Component.InputMode.InputMode102: + switch (_page) + { + case 0: + InputNotePaints[1] = Paints.Paint1; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 1: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[10] = Paints.Paint1; + break; + } + break; + case Component.InputMode.InputMode142: + switch (_page) + { + case 0: + InputNotePaints[1] = Paints.Paint1; + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case 1: + InputNotePaints[2] = Paints.Paint4; + InputNotePaints[3] = Brushes.Cyan; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + InputNotePaints[10] = Paints.Paint1; + break; + } + break; + case Component.InputMode.InputMode242: + switch (_page) + { + case 0: + InputNotePaints[1] = Paints.Paint1; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 1: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case 2: + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 3: + InputNotePaints[2] = Paints.Paint4; + InputNotePaints[3] = Brushes.Cyan; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + InputNotePaints[10] = Paints.Paint1; + break; + } + break; + case Component.InputMode.InputMode484: + switch (_page) + { + case 0: + InputNotePaints[1] = Paints.Paint1; + InputNotePaints[2] = Paints.Paint1; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 1: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case 2: + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 3: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case 4: + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 5: + InputNotePaints[3] = Paints.Paint4; + InputNotePaints[4] = Brushes.Cyan; + InputNotePaints[5] = Paints.Paint4; + InputNotePaints[6] = Brushes.Cyan; + InputNotePaints[7] = Paints.Paint4; + InputNotePaints[8] = Brushes.Cyan; + InputNotePaints[9] = Paints.Paint4; + break; + case 6: + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + break; + case 7: + InputNotePaints[2] = Paints.Paint4; + InputNotePaints[3] = Brushes.Cyan; + InputNotePaints[4] = Paints.Paint4; + InputNotePaints[5] = Brushes.Cyan; + InputNotePaints[6] = Paints.Paint4; + InputNotePaints[7] = Brushes.Cyan; + InputNotePaints[8] = Paints.Paint4; + InputNotePaints[9] = Paints.Paint1; + InputNotePaints[10] = Paints.Paint1; + break; + } + break; + } + OnPropertyChanged(nameof(InputNotePaints)); + } + + public void SetInput(int inputPosition, T[] toInputs = null) + { + var input = string.Join(", ", toInputs?.Where(toInput => !string.IsNullOrEmpty(toInput?.ToString())) ?? Array.Empty()); + if (string.IsNullOrEmpty(input) && InputNotePaints[inputPosition] != null) + { + input = "❌"; + } + Inputs[inputPosition] = input; + OnPropertyChanged(nameof(Inputs)); + } + + public void SetInputPaint(int inputPosition, bool isInput) + { + InputPaints[inputPosition] = isInput ? Paints.PointPaints[1] : Brushes.Transparent; + OnPropertyChanged(nameof(InputPaints)); + } + + public override void OnOpened() + { + base.OnOpened(); + AllowEssentialInputs = false; + _inputPosition = 1; + _page = 0; + _endPage = _pageMap[(int)_inputMode].Length; + SetNoteInputPaint(); + for (var i = 10; i > 0; --i) + { + SetInput(i); + SetInputPaint(i, false); + } + switch (ControllerModeValue) + { + case ControllerMode.DefaultInput: + InputImpl(Configure.Instance.DefaultInputBundlesV6.Inputs); + break; + case ControllerMode.DInput: + InputImpl(Configure.Instance.DInputBundlesV4.Inputs); + break; + case ControllerMode.XInput: + InputImpl(Configure.Instance.XInputBundlesV4.Inputs); + break; + case ControllerMode.WGI: + InputImpl(Configure.Instance.WGIBundlesV3.Inputs); + break; + case ControllerMode.MIDI: + InputImpl(Configure.Instance.MIDIBundlesV4.Inputs); + break; + } + void InputImpl(T[][][] inputConfigure) + { + for (var i = Component.InputCounts[(int)_inputMode] / _endPage; i > 0; --i) + { + SetInput(_inputMap[(int)_inputMode][i], inputConfigure[(int)_inputMode][i]); + } + } + SetInputPaint(_inputMap[(int)_inputMode][1], true); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/LevelViewModel.cs b/Qwilight/Qwilight/ViewModel/LevelViewModel.cs new file mode 100644 index 0000000..0c9fb26 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/LevelViewModel.cs @@ -0,0 +1,140 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.IO; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight.ViewModel +{ + public sealed partial class LevelViewModel : BaseViewModel + { + public ObservableCollection LevelItemCollection { get; } = new(); + + public override double TargetLength => 0.4; + + public override double TargetHeight => 0.8; + + public void OnInput() => OnPropertyChanged(nameof(IsTotalWantLevel)); + + public bool IsTotalWantLevel => LevelItemCollection.All(levelItem => levelItem.IsWanted); + + void SetLevelItemCollection() + { + LevelItemCollection.Clear(); + foreach (var levelID in LevelSystem.Instance.LevelCollection) + { + LevelItemCollection.Add(new LevelItem + { + LevelID = levelID, + IsWanted = Configure.Instance.WantLevelIDs.Contains(levelID) + }); + } + OnPropertyChanged(nameof(IsTotalWantLevel)); + } + + public void OnNewLevel() + { + if (IsLoaded) + { + LevelSystem.Instance.LoadJSON(true); + Configure.Instance.WantLevelIDs = LevelSystem.Instance.LevelCollection.ToArray(); + SetLevelItemCollection(); + } + } + + [RelayCommand] + void OnTotalWantLevel(bool? e) + { + if (e.HasValue) + { + foreach (var levelItem in LevelItemCollection) + { + levelItem.IsWanted = e.Value; + } + OnPropertyChanged(nameof(IsTotalWantLevel)); + } + } + + [RelayCommand] + async Task OnLoadLevel(string www) + { + if (string.IsNullOrEmpty(www)) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewInputWindow, + Contents = new object[] + { + LanguageSystem.Instance.LevelInputContents, + string.Empty, + new Action(async levelInput => + { + if (!string.IsNullOrEmpty(levelInput)) + { + await LevelSystem.Instance.LoadWww(levelInput); + } + }) + } + }); + } + else + { + await LevelSystem.Instance.LoadWww(www); + } + LevelSystem.Instance.LoadJSON(true); + } + + [RelayCommand] + async Task OnGetLevel() + { + if (Configure.Instance.LevelTargetMap.TryGetValue(Configure.Instance.WantLevelName, out var target)) + { + await LevelSystem.Instance.LoadWww(target); + LevelSystem.Instance.LoadJSON(true); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotHaveLevelTarget); + } + } + + [RelayCommand] + void OnWipeLevel() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeLevelNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Utility.WipeFile(Path.Combine(LevelSystem.EntryPath, $"{Configure.Instance.WantLevelName}.json")); + Utility.WipeFile(Path.Combine(LevelSystem.EntryPath, $"#{Configure.Instance.WantLevelName}.json")); + Configure.Instance.LevelTargetMap.Remove(Configure.Instance.WantLevelName); + var i = LevelSystem.Instance.LevelFileNames.IndexOf(Configure.Instance.WantLevelName); + LevelSystem.Instance.LevelFileNames.RemoveAt(i); + Configure.Instance.WantLevelName = LevelSystem.Instance.LevelFileNames.ElementAtOrDefault(i) ?? LevelSystem.Instance.LevelFileNames.LastOrDefault(); + } + }) + } + }); + + public override void OnOpened() + { + base.OnOpened(); + LevelSystem.Instance.LoadLevelFiles(); + SetLevelItemCollection(); + } + + public override void OnCollasped() + { + base.OnCollasped(); + Configure.Instance.WantLevelIDs = LevelItemCollection.Where(levelItem => levelItem.IsWanted).Select(levelItem => levelItem.LevelID).ToArray(); + ViewModels.Instance.MainValue.Want(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/LevelVoteViewModel.cs b/Qwilight/Qwilight/ViewModel/LevelVoteViewModel.cs new file mode 100644 index 0000000..abe352c --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/LevelVoteViewModel.cs @@ -0,0 +1,72 @@ +namespace Qwilight.ViewModel +{ + public sealed class LevelVoteViewModel : BaseViewModel + { + public override double TargetLength => 0.9; + + Uri _www0; + Uri _www1; + bool _isWww0Visible; + bool _isWww1Visible; + bool _isEdgeView0Loading; + bool _isEdgeView1Loading; + + public Uri Www0 + { + get => _www0; + + set => SetProperty(ref _www0, value, nameof(Www0)); + } + + public Uri Www1 + { + get => _www1; + + set => SetProperty(ref _www1, value, nameof(Www1)); + } + + public bool IsWww0Visible + { + get => _isWww0Visible; + + set => SetProperty(ref _isWww0Visible, value, nameof(IsWww0Visible)); + } + + public bool IsWww1Visible + { + get => _isWww1Visible; + + set => SetProperty(ref _isWww1Visible, value, nameof(IsWww1Visible)); + } + + public bool IsEdgeView0Loading + { + get => _isEdgeView0Loading; + + set => SetProperty(ref _isEdgeView0Loading, value, nameof(IsEdgeView0Loading)); + } + + public bool IsEdgeView1Loading + { + get => _isEdgeView1Loading; + + set => SetProperty(ref _isEdgeView1Loading, value, nameof(IsEdgeView1Loading)); + } + + public void OnEdgeView0Loading(bool isLoading) => IsEdgeView0Loading = isLoading; + + public void OnEdgeView1Loading(bool isLoading) => IsEdgeView1Loading = isLoading; + + public override void OnCollasped() + { + base.OnCollasped(); + ViewModels.Instance.MainValue.HandleAutoComputer(); + } + + public override void OnOpened() + { + base.OnOpened(); + ViewModels.Instance.MainValue.CloseAutoComputer(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/LongNoteModifyViewModel.cs b/Qwilight/Qwilight/ViewModel/LongNoteModifyViewModel.cs new file mode 100644 index 0000000..4f032ec --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/LongNoteModifyViewModel.cs @@ -0,0 +1,28 @@ +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class LongNoteModifyViewModel : BaseViewModel + { + public override double TargetLength => 0.2; + + public override double TargetHeight => 0.3; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public override bool ClosingCondition + { + get + { + var modeComponentValue = ViewModels.Instance.MainValue.ModeComponentValue; + if (modeComponentValue.LowestLongNoteModify > modeComponentValue.HighestLongNoteModify) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.LongNoteModifyFaultText); + return false; + } + + return base.ClosingCondition; + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/Qwilight/ViewModel/MainViewModel.cs new file mode 100644 index 0000000..99a8329 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/MainViewModel.cs @@ -0,0 +1,3640 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Ionic.Zip; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using SharpCompress.Archives; +using SharpCompress.Archives.Rar; +using SharpCompress.Archives.SevenZip; +using System.Buffers; +using System.Collections.Concurrent; +using System.Collections.Immutable; +using System.Collections.ObjectModel; +using System.Data; +using System.Data.SQLite; +using System.Diagnostics; +using System.IO; +using System.Net.Http; +using System.Security.Cryptography; +using System.Text; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; +using System.Xml.Serialization; +using UtfUnknown; +using Windows.ApplicationModel.DataTransfer; +using Windows.System; +using Windows.Win32.UI.WindowsAndMessaging; +using Xml2CSharp; +using Clipboard = Windows.ApplicationModel.DataTransfer.Clipboard; + +namespace Qwilight.ViewModel +{ + public sealed partial class MainViewModel : Model + { + public enum Mode + { + NoteFile, Computing = 2, Quit + } + + public sealed class Fading + { + public double Status { get; set; } + + public int Layer { get; set; } + + public DefaultCompute Computer { get; set; } + + public bool IsComputerStable { get; set; } + } + + readonly PausableAudioHandler _pausableAudioHandler = new(); + readonly ConcurrentDictionary _entryItems = new(); + readonly HashSet _alreadyLoadedDefaultEntryItems = new(); + readonly DispatcherTimer _loadDefaultCommentHandler = new(DispatcherPriority.Input, HandlingUISystem.Instance.UIHandler) + { + Interval = TimeSpan.FromMilliseconds(QwilightComponent.StandardUILoopMillis) + }; + readonly DispatcherTimer _loadTwilightCommentHandler = new(DispatcherPriority.Input, HandlingUISystem.Instance.UIHandler) + { + Interval = TimeSpan.FromMilliseconds(QwilightComponent.StandardUILoopMillis) + }; + readonly DispatcherTimer _autoComputerHandler = new(DispatcherPriority.Input, HandlingUISystem.Instance.UIHandler) + { + Interval = TimeSpan.FromMilliseconds(QwilightComponent.StandardWaitMillis) + }; + readonly DispatcherTimer _wantHandler = new(DispatcherPriority.Input, HandlingUISystem.Instance.UIHandler) + { + Interval = TimeSpan.FromMilliseconds(QwilightComponent.StandardWaitMillis) + }; + readonly ModeComponent _defaultModeComponentValue = new(); + readonly FileSystemWatcher _fsw = new(QwilightComponent.EdgeEntryPath) + { + EnableRaisingEvents = true + }; + DispatcherTimer _fadeInHandler; + bool _isAvailable = true; + string _twilightCommentText0 = string.Empty; + string _twilightCommentText1 = string.Empty; + string _qwilightFileName; + Mode _mode; + int _lastEntryItemID; + bool _isCommentMode; + CommentItem _defaultCommentItem; + CommentItem _twilightCommentItem; + int _entryItemPosition; + EntryItem _entryItemValue; + CancellationTokenSource _setCancelDefaultEntryItem; + int? _lastLowerMillis; + bool _wasLowerMillis = true; + bool _isUILoading; + bool _isDefaultEntryLoading; + bool _isWantInputPointed; + bool _isCommentaryInputPointed; + bool _wasSiteContainerOpened; + bool _wasCommentOpened; + bool _isDefaultCommentLoading; + bool _isTwilightCommentLoading; + bool? _twilightCommentFavor; + string _twilightCommentTotalFavor; + bool _isWowItemLoading; + string _twilightCommentary = string.Empty; + bool _isWPFViewVisible = true; + bool _isLoaded; + double _windowDPI; + + static bool IsNotModal(BaseViewModel targetViewModel = null) + { + foreach (var windowViewModel in ViewModels.Instance.WindowViewModels) + { + if (windowViewModel == targetViewModel) + { + continue; + } + if (windowViewModel.IsOpened && windowViewModel.IsModal) + { + return false; + } + } + return true; + } + + public List DefaultEntryItems { get; } = new() + { + DefaultEntryItem.Total + }; + + public bool IsBPMVisible => EntryItemValue?.NoteFile?.HasBPMMap != true; + + public bool IsBPM1Visible => EntryItemValue?.NoteFile?.HasBPMMap == true; + + bool HasNotInput(BaseViewModel targetViewModel = null) => IsNotModal(targetViewModel) && IsAvailable && (!IsWPFViewVisible || !_isWantInputPointed && !_isCommentaryInputPointed && !ViewModels.Instance.SiteContainerValue.HasPointedInput); + + public double WindowDPI + { + get => _windowDPI; + + set => SetProperty(ref _windowDPI, value, nameof(WindowDPI)); + } + + public ConcurrentDictionary EventNoteEntryItems { get; } = new(); + + public ConcurrentDictionary NoteID512s { get; } = new(); + + public ConcurrentDictionary NoteID128s { get; } = new(); + + public int NoteDrawingCount => _entryItems.Values.Sum(entryItem => entryItem.NoteFiles.Count(noteFile => noteFile.HasNoteDrawing)); + + public ObservableCollection DefaultCommentCollection { get; } = new(); + + public ObservableCollection TwilightCommentCollection { get; } = new(); + + public double Status { get; set; } + + public ObservableCollection EntryItems { get; set; } = new(); + + public ObservableCollection TotalWowItemCollection { get; } = new(); + + public ObservableCollection HighestWowItemCollection { get; } = new(); + + public ObservableCollection StandWowItemCollection { get; } = new(); + + public ObservableCollection BandWowItemCollection { get; } = new(); + + public ObservableCollection TotalAtWowItemCollection { get; } = new(); + + public ObservableCollection HighestAtWowItemCollection { get; } = new(); + + public ObservableCollection StandAtWowItemCollection { get; } = new(); + + public ObservableCollection BandAtWowItemCollection { get; } = new(); + + public ObservableCollection Ability5KWowItemCollection { get; } = new(); + + public ObservableCollection Ability7KWowItemCollection { get; } = new(); + + public ObservableCollection Ability9KWowItemCollection { get; } = new(); + + public ObservableCollection LevelWowItemCollection { get; } = new(); + + public Dictionary LastEntryItems { get; } = new(); + + public DefaultCompute Computer { get; set; } + + public AutoCompute AutoComputer { get; set; } + + public DefaultCompute FadingViewComputer + { + get + { + var fadingComputer = FadingValue.Computer; + if (FadingValue.IsComputerStable) + { + return fadingComputer; + } + else + { + if (fadingComputer.NoteFile == AutoComputer?.NoteFile) + { + return AutoComputer; + } + else + { + return fadingComputer; + } + } + } + } + + public ModeComponent ModeComponentValue { get; } = Configure.Instance.ModeComponentValue; + + public bool IsWPFViewVisible + { + get => _isWPFViewVisible; + + set + { + if (SetProperty(ref _isWPFViewVisible, value, nameof(IsWPFViewVisible))) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetD2DViewVisibility, + Contents = !value + }); + IsVital = IsComputingMode && !value; + } + } + } + + public bool IsVital { get; set; } + + public bool HasPoint { get; set; } + + public string TwilightCommentary + { + get => _twilightCommentary; + + set => SetProperty(ref _twilightCommentary, value, nameof(TwilightCommentary)); + } + + public Computing GetHandlingComputing() => IsNoteFileMode ? EntryItemValue?.NoteFile : GetHandlingComputer(); + + public DefaultCompute GetHandlingComputer() => ModeValue switch + { + Mode.NoteFile => AutoComputer, + Mode.Computing => Computer, + Mode.Quit => AutoComputer?.IsHandling == true ? AutoComputer : Computer, + _ => default + }; + + public bool IsPausing => AutoComputer?.IsPausing ?? _pausableAudioHandler.IsPausing; + + public string TwilightCommentText0 + { + get => _twilightCommentText0; + + set => SetProperty(ref _twilightCommentText0, value, nameof(TwilightCommentText0)); + } + + public string TwilightCommentText1 + { + get => _twilightCommentText1; + + set => SetProperty(ref _twilightCommentText1, value, nameof(TwilightCommentText1)); + } + + public bool IsDefaultCommentLoading + { + get => _isDefaultCommentLoading; + + set => SetProperty(ref _isDefaultCommentLoading, value, nameof(IsDefaultCommentLoading)); + } + + public bool IsTwilightCommentLoading + { + get => _isTwilightCommentLoading; + + set + { + if (SetProperty(ref _isTwilightCommentLoading, value, nameof(IsTwilightCommentLoading))) + { + OnPropertyChanged(nameof(IsEntryItemBanned)); + } + } + } + + public bool? TwilightCommentFavor + { + get => _twilightCommentFavor; + + set + { + if (SetProperty(ref _twilightCommentFavor, value)) + { + OnPropertyChanged(nameof(LowerTwilightCommentFavorPaint)); + OnPropertyChanged(nameof(HigherTwilightCommentFavorPaint)); + NotifyCanTwilightFavor(); + } + } + } + + public bool CanLowerTwilightCommentFavor => IsNoteFileNotLogical && !IsEntryItemBanned && TwilightSystem.Instance.IsSignedIn && TwilightCommentFavor != true; + + public Brush LowerTwilightCommentFavorPaint => TwilightCommentFavor == false ? Paints.Paint1 : Paints.Paint4; + + public bool CanHigherTwilightCommentFavor => IsNoteFileNotLogical && !IsEntryItemBanned && TwilightSystem.Instance.IsSignedIn && TwilightCommentFavor != false; + + public Brush HigherTwilightCommentFavorPaint => TwilightCommentFavor == true ? Paints.Paint3 : Paints.Paint4; + + public string TwilightCommentTotalFavor + { + get => _twilightCommentTotalFavor; + + set => SetProperty(ref _twilightCommentTotalFavor, value, nameof(TwilightCommentTotalFavor)); + } + + public bool IsWowLoading + { + get => _isWowItemLoading; + + set => SetProperty(ref _isWowItemLoading, value, nameof(IsWowLoading)); + } + + public void NotifyIsPausing() => OnPropertyChanged(nameof(IsPausing)); + + public Fading FadingValue { get; } = new(); + + public bool IsAvailable + { + get => _isAvailable; + + set + { + if (SetProperty(ref _isAvailable, value, nameof(IsAvailable)) && value) + { + PointEntryView(); + } + } + } + + public bool IsDefaultEntryLoading + { + get => _isDefaultEntryLoading; + + set + { + if (SetProperty(ref _isDefaultEntryLoading, value, nameof(IsDefaultEntryLoading)) && !value) + { + PointEntryView(); + } + } + } + + public bool IsUILoading + { + get => _isUILoading; + + set + { + if (SetProperty(ref _isUILoading, value, nameof(IsUILoading)) && !value) + { + PointEntryView(); + } + } + } + + public string HighestInputCountText => Utility.GetHighestInputCountText(EntryItemValue?.NoteFile?.AverageInputCount ?? default, EntryItemValue?.NoteFile?.HighestInputCount ?? default, ModeComponentValue.AudioMultiplier); + + public string BPMText => Utility.GetBPMText(EntryItemValue?.NoteFile?.BPM ?? Component.StandardBPM, ModeComponentValue.Multiplier, ModeComponentValue.AudioMultiplier); + + public string LengthText => Utility.GetLengthText(EntryItemValue?.NoteFile?.Length ?? default); + + public bool IsEntryItemEventNote => !string.IsNullOrEmpty(EntryItemValue?.EventNoteID); + + public bool IsNoteFileNotLogical => EntryItemValue?.NoteFile?.IsLogical == false; + + public bool IsNoteFileAvailable => !string.IsNullOrEmpty(EntryItemValue?.NoteFile?.NoteFilePath); + + public bool CanSaveAsBundle => (IsEntryItemEventNote || IsNoteFileNotLogical) && TwilightSystem.Instance.IsSignedIn; + + public bool HasAssistFile => !string.IsNullOrEmpty(EntryItemValue?.NoteFile?.AssistFileName); + + public bool CanModifyModeComponent => IsNoteFileMode && !IsCommentMode; + + public void NotifyCanSaveAsBundle() => OnPropertyChanged(nameof(CanSaveAsBundle)); + + public bool IsEntryItemBanned => EntryItemValue?.IsBanned != false; + + public bool CanTwilightCommentary => IsNoteFileNotLogical && !IsEntryItemBanned && TwilightSystem.Instance.IsSignedIn; + + public void NotifyCanTwilightCommentary() => OnPropertyChanged(nameof(CanTwilightCommentary)); + + public void NotifyCanTwilightFavor() + { + OnPropertyChanged(nameof(CanLowerTwilightCommentFavor)); + OnPropertyChanged(nameof(CanHigherTwilightCommentFavor)); + } + + public double DefaultLength => IsComputingMode ? UI.Instance.DefaultLength : BaseUI.Instance.DefaultLength; + + public double DefaultHeight => IsComputingMode ? UI.Instance.DefaultHeight : BaseUI.Instance.DefaultHeight; + + public bool IsNoteFileMode => ModeValue == Mode.NoteFile; + + public bool IsComputingMode => ModeValue == Mode.Computing; + + public bool IsQuitMode => ModeValue == Mode.Quit; + + public Mode ModeValue + { + get => _mode; + + set + { + if (SetProperty(ref _mode, value)) + { + OnPropertyChanged(nameof(IsNoteFileMode)); + OnPropertyChanged(nameof(IsComputingMode)); + OnPropertyChanged(nameof(IsQuitMode)); + OnPropertyChanged(nameof(CanModifyModeComponent)); + OnPropertyChanged(nameof(DefaultLength)); + OnPropertyChanged(nameof(DefaultHeight)); + OnWPFViewVisibilityModified(); + ViewModels.Instance.NotifyWindowViewModels(); + BaseUI.Instance.InitEvents(); + Configure.Instance.UIConfigureValue.NotifyInputMode(); + switch (value) + { + case Mode.NoteFile: + if (_wasSiteContainerOpened) + { + ViewModels.Instance.SiteContainerValue.Open(false); + _wasSiteContainerOpened = false; + } + if (_wasCommentOpened) + { + ViewModels.Instance.CommentValue.Open(false); + _wasCommentOpened = false; + } + NotifySystem.Instance.NotifyPending(); + break; + case Mode.Computing: + _wasSiteContainerOpened = ViewModels.Instance.SiteContainerValue.IsOpened; + ViewModels.Instance.SiteContainerValue.Close(false); + ViewModels.Instance.NoteFileValue.Close(false); + break; + case Mode.Quit: + _wasCommentOpened = ViewModels.Instance.CommentValue.IsOpened; + ViewModels.Instance.CommentValue.Close(false); + break; + } + } + } + } + + public CommentItem DefaultCommentItem + { + get => _defaultCommentItem; + + set => SetProperty(ref _defaultCommentItem, value, nameof(DefaultCommentItem)); + } + + public CommentItem TwilightCommentItem + { + get => _twilightCommentItem; + + set => SetProperty(ref _twilightCommentItem, value, nameof(TwilightCommentItem)); + } + + public int EntryItemPosition + { + get => _entryItemPosition; + + set + { + if (SetProperty(ref _entryItemPosition, value, nameof(EntryItemPosition)) && _isLoaded && value != -1) + { + Configure.Instance.LastEntryItemPositions[Configure.Instance.LastDefaultEntryItem?.DefaultEntryPath ?? string.Empty] = value; + } + } + } + + public EntryItem EntryItemValue + { + get => _entryItemValue; + + set + { + if (SetProperty(ref _entryItemValue, value, nameof(EntryItemValue))) + { + OnPropertyChanged(nameof(IsEntryItemEventNote)); + if (value != null) + { + if (ViewModels.Instance.NoteFileValue.IsOpened) + { + ViewModels.Instance.NoteFileValue.EntryItemValue = value; + } + MoveEntryView(); + if (_isLoaded) + { + LastEntryItems[Configure.Instance.LastDefaultEntryItem?.DefaultEntryPath ?? string.Empty] = value; + } + } + NotifyNoteFile(); + } + } + } + + public bool IsCommentMode + { + get => _isCommentMode; + + set + { + if (SetProperty(ref _isCommentMode, value, nameof(IsCommentMode))) + { + OnPropertyChanged(nameof(CanModifyModeComponent)); + if (value) + { + _defaultModeComponentValue.CopyAs(ModeComponentValue, null, false); + } + else + { + ModeComponentValue.CopyAs(_defaultModeComponentValue, null, false); + } + } + } + } + + public async void OnLoaded(nint handle) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetWindowedMode + }); + + StillSystem.Instance.Init(handle); + MIDISystem.Instance.HandleSystem(); + + AudioSystem.Instance.LoadDefaultAudio(); + AudioSystem.Instance.LoadBanalAudio(); + DrawingSystem.Instance.LoadDefaultDrawing(); + DrawingSystem.Instance.LoadVeilDrawing(); + + LevelSystem.Instance.LoadJSON(false); + + await ValveSystem.Instance.Init(); + await Task.Run(() => + { + BaseUI.Instance.LoadUI(null, Configure.Instance.BaseUIItemValue, false); + UI.Instance.LoadUI(null, Configure.Instance.UIItemValue, false); + + Utility.HandleLongParallel(TVSystem.Instance.HandleSystem, false); + Utility.HandleLongParallel(IlluminationSystem.Instance.HandleSystem, false); + DefaultControllerSystem.Instance.HandleSystem(); + Utility.HandleLongParallel(DrawingSystem.Instance.HandleSystem); + Utility.HandleLongParallel(TwilightSystem.Instance.HandleSystem, false); + Utility.HandleLongParallel(PlatformSystem.Instance.HandleSystem, false); + Utility.HandleLongParallel(FlintSystem.Instance.HandleSystem, false); + Utility.HandleLongParallel(() => ControllerSystem.Instance.HandleSystem(handle)); + + if (Configure.Instance.AudioMultiplierAtone) + { + AudioSystem.Instance.SetAudioMultiplierAtone(true, ModeComponentValue.AudioMultiplier); + } + + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.FadingLoadingView + }); + + if (!string.IsNullOrEmpty(Configure.Instance.ConfigureFault)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, Configure.Instance.ConfigureFault); + } + if (!string.IsNullOrEmpty(GPUConfigure.Instance.GPUConfigureFault)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, GPUConfigure.Instance.GPUConfigureFault); + } + if (!string.IsNullOrEmpty(DB.Instance.DBFault)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, DB.Instance.DBFault); + } + + if (!Configure.Instance.IsLoaded) + { + ViewModels.Instance.AssistValue.Open(); + Configure.Instance.IsLoaded = true; + } + + SetDefaultEntryItems(); + if (Configure.Instance.AutoGetQwilight) + { + GetQwilight(true); + } + + if (QwilightComponent.IsTest) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.Quit, + Contents = false + }); + } + }); + + _isLoaded = true; + } + + public void OnFileAs(DragEventArgs e) + { + var filePaths = e.Data.GetData(DataFormats.FileDrop) as string[]; + if (filePaths != null) + { + Task.Run(() => + { + var wasEventNote = false; + var lastYamlFileName = string.Empty; + DefaultEntryItem lastDefaultEntryItem = null; + foreach (var filePath in filePaths) + { + if (File.Exists(filePath)) + { + if (QwilightComponent.NoteFileFormats.Any(format => filePath.IsTailCaselsss(format))) + { + FlintNoteFile(filePath, 0); + } + else if (filePath.IsTailCaselsss(".zip")) + { + using var zipFile = ZipFile.Read(filePath); + var yamlFileName = Path.GetFileNameWithoutExtension(zipFile.Where(zipEntry => zipEntry.FileName.IsTailCaselsss(".yaml")).OrderBy(zipEntry => zipEntry.FileName).FirstOrDefault()?.FileName); + if (string.IsNullOrEmpty(yamlFileName)) + { + HandleNoteBundle(filePath); + } + else + { + var savingBundleItem = new NotifyItem + { + Text = LanguageSystem.Instance.SavingUIContents, + Variety = NotifySystem.NotifyVariety.Levying, + OnStop = isTotal => false, + }; + try + { + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingBundleItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text); + zipFile.ExtractProgress += (sender, e) => + { + savingBundleItem.LevyingStatus = e.EntriesExtracted; + savingBundleItem.QuitStatus = e.EntriesTotal; + savingBundleItem.NotifyBundleStatus(); + }; + zipFile.ExtractAll(string.IsNullOrEmpty(Path.GetDirectoryName(yamlFileName)) ? Path.Combine(QwilightComponent.UIEntryPath, yamlFileName) : QwilightComponent.UIEntryPath, ExtractExistingFileAction.OverwriteSilently); + savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savingBundleItem.Text = LanguageSystem.Instance.SavedUIContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, savingBundleItem.Text); + lastYamlFileName = yamlFileName; + } + catch (Exception e) + { + savingBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; + savingBundleItem.Text = string.Format(LanguageSystem.Instance.SaveUIFault, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, savingBundleItem.Text); + } + finally + { + savingBundleItem.OnStop = isTotal => true; + } + } + } + else if (filePath.IsTailCaselsss(".rar") || filePath.IsTailCaselsss(".7z")) + { + HandleNoteBundle(filePath); + } + else if (filePath.IsTailCaselsss(".lr2crs")) + { + var date = DateTime.Now; + using var fs = File.OpenRead(filePath); + foreach (var eventNote in (new XmlSerializer(typeof(Courselist)).Deserialize(fs) as Courselist).Course) + { + try + { + var eventNoteID = eventNote.Hash[32..]; + for (var m = eventNoteID.Length - 32; m > 0; m -= 32) + { + eventNoteID = eventNoteID.Insert(m, ":0/"); + } + eventNoteID += ":0"; + var eventNoteName = eventNote.Title; + var eventNoteVariety = DB.EventNoteVariety.MD5; + DB.Instance.SetEventNote(eventNoteID, eventNoteName, date, eventNoteVariety); + wasEventNote = true; + } + catch (SQLiteException) + { + } + } + } + } + else if (Directory.Exists(filePath)) + { + var defaultEntryItem = new DefaultEntryItem + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Default, + DefaultEntryPath = filePath, + Layer = Configure.Instance.DefaultEntryItems.Count + }; + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.ModifyDefaultEntryValue.DefaultEntryItemCollection.Add(defaultEntryItem)); + Configure.Instance.DefaultEntryItems.Add(defaultEntryItem); + lastDefaultEntryItem = defaultEntryItem; + } + } + if (wasEventNote) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.OpenedEventNotes); + LoadEventNoteEntryItems(); + Want(); + } + if (!string.IsNullOrEmpty(lastYamlFileName)) + { + ViewModels.Instance.ConfigureValue.TabPosition = 0; + ViewModels.Instance.ConfigureValue.TabPositionComputing = 1; + ViewModels.Instance.ConfigureValue.TabPositionUI = lastYamlFileName.StartsWith('@') ? 0 : 1; + ViewModels.Instance.ConfigureValue.Open(); + } + if (lastDefaultEntryItem != null) + { + HandlingUISystem.Instance.HandleParallel(() => + { + if (!IsDefaultEntryLoading) + { + Configure.Instance.LastDefaultEntryItem = lastDefaultEntryItem; + SetDefaultEntryItems(); + } + }); + } + }); + } + } + + public void OnInputWantPointed(bool isWantInputPointed) => _isWantInputPointed = isWantInputPointed; + + public void OnInputTwilightCommentaryPointed(bool isCommentaryInputPointed) => _isCommentaryInputPointed = isCommentaryInputPointed; + + public void OnSetPoint(bool hasPoint) + { + if (!hasPoint) + { + Computer?.AutoPause(); + DefaultControllerSystem.Instance.Init(); + ControllerSystem.Instance.Init(); + MIDISystem.Instance.Init(); + } + HasPoint = hasPoint; + } + + public void OnFitMode() => PointEntryView(); + + public void OnWindowDPIModified(double windowDPI) + { + WindowDPI = windowDPI; + OnModified(); + OnMove(); + } + + public void OnModified() + { + if (Configure.Instance.WindowedMode) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetWindowArea, + Contents = new Action((windowAreaPosition0, windowAreaPosition1, windowAreaLength, windowAreaHeight) => + { + Configure.Instance.WindowLengthV2 = (int)(windowAreaLength / WindowDPI); + Configure.Instance.WindowHeightV2 = (int)(windowAreaHeight / WindowDPI); + }) + }); + } + DrawingSystem.Instance.OnModified(); + } + + public void OnMove() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetWindowArea, + Contents = new Action((windowAreaPosition0, windowAreaPosition1, windowAreaLength, windowAreaHeight) => + { + Configure.Instance.WindowPosition0V2 = windowAreaPosition0; + Configure.Instance.WindowPosition1V2 = windowAreaPosition1; + }) + }); + + public void OnTwilightCommentary(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.Commentary, new + { + noteID = EntryItemValue.NoteFile.GetNoteID512(), + commentary = TwilightCommentary + }); + var avatarID = TwilightSystem.Instance.AvatarID; + var twilightCommentItem = TwilightCommentCollection.SingleOrDefault(twilightCommentItem => twilightCommentItem.AvatarWwwValue.AvatarID == avatarID); + if (twilightCommentItem != null) + { + twilightCommentItem.TwilightCommentary = string.IsNullOrEmpty(TwilightCommentary) ? string.Empty : $"💬 {TwilightCommentary}"; + } + TwilightCommentary = string.Empty; + } + } + + public void OnDefaultCommentViewInputLower(KeyEventArgs e) + { + if (e.Key == Key.Delete && DefaultCommentItem != null) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeCommentNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + var defaultCommentItem = DefaultCommentItem; + if (r == MESSAGEBOX_RESULT.IDYES && defaultCommentItem != null) + { + var defaultCommentFilePath = defaultCommentItem.CommentID; + var eventNoteID = EntryItemValue.EventNoteID; + DB.Instance.WipeComment(defaultCommentFilePath); + if (string.IsNullOrEmpty(eventNoteID)) + { + Utility.WipeFile(defaultCommentFilePath); + } + else + { + Utility.WipeFile(Path.Combine(QwilightComponent.CommentEntryPath, Path.ChangeExtension(defaultCommentFilePath, ".zip"))); + } + DefaultCommentCollection.Remove(defaultCommentItem); + } + }) + } + }); + } + } + + public void OnWant() + { + _wantHandler.Stop(); + _wantHandler.Start(); + } + + public void OnPointLower(MouseButtonEventArgs e) + { + if (IsAvailable && IsNotModal()) + { + var pointInput = e.ChangedButton; + var isAlt = pointInput == MouseButton.Right; + if (pointInput == MouseButton.Left || isAlt) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetWPFView, + Contents = new Action(view => + { + var pointPosition = e.GetPosition(view); + var pointPositionX = pointPosition.X; + var pointPositionY = pointPosition.Y; + var statusPoint = BaseUI.Instance.StatusPoint; + var inputNoteCountViewPoint = BaseUI.Instance.InputNoteCountViewPoint; + if (statusPoint?.Length > 4 && Utility.IsPoint(statusPoint, pointPositionX, pointPositionY)) + { + var statusPosition0 = statusPoint[0]; + var statusPosition1 = statusPoint[1]; + var statusLength = statusPoint[2]; + var statusHeight = statusPoint[3]; + MoveStatus(isAlt ? 0.0 : statusPoint[4] switch + { + 0 => 1 - (pointPositionY - statusPosition1) / statusHeight, + 1 => (pointPositionY - statusPosition1) / statusHeight, + 2 => 1 - (pointPositionX - statusPosition0) / statusLength, + 3 => (pointPositionX - statusPosition0) / statusLength, + _ => default, + }, e.ClickCount == 2); + } + else if (inputNoteCountViewPoint?.Length > 2 && Utility.IsPoint(inputNoteCountViewPoint, pointPositionX, pointPositionY)) + { + MoveStatus(isAlt ? 0.0 : (pointPositionX - inputNoteCountViewPoint[0]) / inputNoteCountViewPoint[2], e.ClickCount == 2); + } + }) + }); + } + if (pointInput == MouseButton.Middle) + { + MoveEntryView(); + PointEntryView(); + } + } + } + + public void SetLastDefaultEntryItem(DefaultEntryItem defaultEntryItem) + { + if (!IsDefaultEntryLoading && (Configure.Instance.LastDefaultEntryItem == null ^ defaultEntryItem == null)) + { + Configure.Instance.WantInput = string.Empty; + Configure.Instance.LastDefaultEntryItem = defaultEntryItem; + LoadDefaultEntryItem(false); + } + } + + public void OnEssentialInputLower(KeyEventArgs e) + { + if (ViewModels.Instance.InputValue.IsOpened || ViewModels.Instance.InputStandardValue.IsOpened || ViewModels.Instance.InputStandardControllerValue.IsOpened) + { + e.Handled = true; + } + } + + public void OnInputLower(KeyEventArgs e) + { + switch (e.Key) + { + case Key.System when e.SystemKey != Key.F4: + case Key.Escape: + case Key.Space: + e.Handled = true; + break; + } + } + + public async void OnEntryViewInputLower(KeyEventArgs e) + { + if (IsNoteFileMode) + { + var rawInput = e.Key; + if (rawInput == Key.C && Utility.HasInput(VirtualKey.LeftControl)) + { + var dataBundle = new DataPackage(); + if (IsEntryItemEventNote) + { + switch (EntryItemValue.EventNoteVariety) + { + case DB.EventNoteVariety.MD5: + if (EntryItemValue.NoteFiles.All(noteFile => !noteFile.IsLogical)) + { + dataBundle.SetText(string.Join('/', EntryItemValue.NoteFiles.Select(noteFile => noteFile.GetNoteID512()))); + Clipboard.SetContent(dataBundle); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, string.Join(", ", EntryItemValue.NoteFiles.Where(noteFile => !noteFile.IsLogical).Select(noteFile => noteFile.Title))); + } + foreach (var noteFile in EntryItemValue.NoteFiles.Where(noteFile => !noteFile.IsLogical)) + { + await TwilightSystem.Instance.PostWwwParallel($"{QwilightComponent.QwilightAPI}/note", noteFile.GetContents()); + } + break; + case DB.EventNoteVariety.Qwilight: + dataBundle.SetText(EntryItemValue.EventNoteID); + Clipboard.SetContent(dataBundle); + foreach (var noteFile in EntryItemValue.NoteFiles.Where(noteFile => !noteFile.IsLogical)) + { + await TwilightSystem.Instance.PostWwwParallel($"{QwilightComponent.QwilightAPI}/note", noteFile.GetContents()); + } + break; + } + } + else + { + if (IsNoteFileNotLogical) + { + dataBundle.SetText(EntryItemValue?.NoteFile?.GetNoteID512(null)); + Clipboard.SetContent(dataBundle); + } + } + } + else + { + var titleLetter = Utility.GetLetter(rawInput); + if (string.IsNullOrEmpty(titleLetter)) + { + switch (rawInput) + { + case Key.Enter: + HandleLevyNoteFile(); + break; + case Key.Left: + LowerNoteFile(); + e.Handled = true; + break; + case Key.Right: + HigherNoteFile(); + e.Handled = true; + break; + case Key.Back: + SetLastDefaultEntryItem(null); + break; + case Key.Up: + LowerEntryItem(); + e.Handled = true; + break; + case Key.Down: + HigherEntryItem(); + e.Handled = true; + break; + case Key.Delete: + if (Configure.Instance.LastDefaultEntryItem != null) + { + var eventNoteID = EntryItemValue?.EventNoteID; + if (string.IsNullOrEmpty(eventNoteID)) + { + if (IsNoteFileNotLogical) + { + if (EntryItemValue.CanWipeNoteFile && !Utility.HasInput(VirtualKey.LeftShift)) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeNoteFileNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + var targetNoteFile = EntryItemValue.NoteFile; + Utility.WipeFile(targetNoteFile.NoteFilePath); + LoadEntryItem(targetNoteFile.DefaultEntryItem, targetNoteFile.EntryItem.EntryPath); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.WipeNoteFileOK); + } + }) + } + }); + } + else + { + CloseAutoComputer("Default"); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeEntryItemNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Utility.WipeEntry(EntryItemValue.EntryPath); + LoadEntryItem(EntryItemValue.DefaultEntryItem, EntryItemValue.EntryPath); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.WipeEntryOK); + } + }) + } + }); + } + } + } + else + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeEventNoteContents, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(async r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + await DB.Instance.WipeEventNote(eventNoteID); + LoadEventNoteEntryItems(); + Want(); + } + }) + } + }); + } + } + else + { + var defaultEntryItem = EntryItemValue.DefaultEntryItem; + var defaultEntryVarietyValue = defaultEntryItem?.DefaultEntryVarietyValue; + if (defaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Default || defaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + defaultEntryItem.WipeNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Configure.Instance.DefaultEntryItems.Remove(defaultEntryItem); + SetDefaultEntryItems(); + } + }) + } + }); + } + } + break; + } + } + else + { + var foundEntryItem = EntryItems.Skip(EntryItemPosition + 1).FirstOrDefault(IsSatisfy) ?? EntryItems.FirstOrDefault(IsSatisfy); + if (foundEntryItem != null) + { + EntryItemValue = foundEntryItem; + } + + bool IsSatisfy(EntryItem entryItem) => entryItem.Title?.IsFrontCaselsss(titleLetter) == true; + } + } + } + } + + public void OnEntryViewPointingLower(MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Right) + { + ViewModels.Instance.NoteFileValue.EntryItemValue = EntryItemValue; + ViewModels.Instance.NoteFileValue.Open(); + } + } + + public void OnDefaultCommentViewModified() => OnCommentItemModified(DefaultCommentItem); + + public void OnTwilightCommentViewModified() => OnCommentItemModified(TwilightCommentItem); + + void OnCommentItemModified(CommentItem commentItem) + { + IsCommentMode = commentItem != null; + if (IsCommentMode) + { + ModeComponentValue.CopyAs(commentItem.ModeComponentValue, null, false); + } + VerifyNoteFile(ModeComponentValue.Salt); + } + + public void OnDefaultComment() + { + var defaultCommentItem = DefaultCommentItem; + if (defaultCommentItem != null) + { + if (EntryItemValue != null) + { + try + { + IsCommentMode = false; + var defaultModeComponentValue = ModeComponentValue.Clone(); + ModeComponentValue.CopyAs(defaultCommentItem.ModeComponentValue, null, false); + if (string.IsNullOrEmpty(EntryItemValue.EventNoteID)) + { + using var fs = File.OpenRead(Path.Combine(QwilightComponent.CommentEntryPath, defaultCommentItem.CommentID)); + SetQuitMode(new QuitCompute(new[] { EntryItemValue.NoteFile }, new[] { Comment.Parser.ParseFrom(fs) }, defaultModeComponentValue, defaultCommentItem, null)); + } + else + { + using var zipFile = ZipFile.Read(Path.Combine(QwilightComponent.CommentEntryPath, Path.ChangeExtension(defaultCommentItem.CommentID, ".zip"))); + SetQuitMode(new QuitCompute(EntryItemValue.NoteFiles, Enumerable.Range(0, EntryItemValue.NoteFiles.Length).Select(i => + { + var zipEntry = zipFile[i.ToString()]; + using var rms = PoolSystem.Instance.GetDataFlow((int)zipEntry.UncompressedSize); + zipEntry.Extract(rms); + rms.Position = 0; + return Comment.Parser.ParseFrom(rms); + }).ToArray(), defaultModeComponentValue, defaultCommentItem, EntryItemValue)); + } + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.FaultCommentContents, e.Message)); + } + } + } + } + + public async void OnTwilightComment() + { + var noteID = EntryItemValue?.NoteFile?.GetNoteID512(); + var commentID = TwilightCommentItem?.CommentID; + if (!string.IsNullOrEmpty(noteID) && !string.IsNullOrEmpty(commentID)) + { + using var s = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/comment?noteID={noteID}&commentID={commentID}"); + var noteFile = EntryItemValue?.NoteFile; + var twilightCommentItem = TwilightCommentItem; + if (IsNoteFileMode && noteFile?.GetNoteID512() == noteID && twilightCommentItem?.CommentID == commentID) + { + if (s.Length > 0) + { + IsCommentMode = false; + var defaultModeComponentValue = ModeComponentValue.Clone(); + ModeComponentValue.CopyAs(twilightCommentItem.ModeComponentValue, null, false); + SetQuitMode(new QuitCompute(new[] { noteFile }, new[] { Comment.Parser.ParseFrom(s) }, defaultModeComponentValue, twilightCommentItem, null)); + } + } + } + } + + public void OnLevyNoteFile(MouseButtonEventArgs e) + { + if (e.ClickCount >= 2 && e.ChangedButton == MouseButton.Left) + { + HandleLevyNoteFile(); + } + } + + [RelayCommand] + void OnSignIn() => ViewModels.Instance.SignInValue.Open(); + + [RelayCommand] + void OnLevelWindow() => ViewModels.Instance.LevelValue.Open(); + + [RelayCommand] + void OnWantWindow() => ViewModels.Instance.WantValue.Open(); + + [RelayCommand] + void OnViewMyAvatar() + { + var avatarViewModel = ViewModels.Instance.AvatarValue; + avatarViewModel.AvatarID = TwilightSystem.Instance.AvatarID; + avatarViewModel.Open(); + } + + [RelayCommand] + void OnViewMyBundle() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallBundle, TwilightSystem.Instance.AvatarID); + + [RelayCommand] + void OnNotSignIn() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.NotSignInNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + Configure.Instance.SetCipher(string.Empty); + Configure.Instance.AutoSignIn = false; + TwilightSystem.Instance.SendParallel(Event.Types.EventID.NotSignIn, null); + } + }) + } + }); + + [RelayCommand] + void OnViewFile() + { + var noteFilePath = EntryItemValue?.NoteFile?.NoteFilePath; + if (string.IsNullOrEmpty(noteFilePath)) + { + var lastDefaultEntryItem = Configure.Instance.LastDefaultEntryItem; + if (lastDefaultEntryItem != null) + { + if (lastDefaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Default || lastDefaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Essential) + { + Utility.OpenAs(lastDefaultEntryItem.DefaultEntryPath); + } + } + else + { + Utility.OpenAs(EntryItemValue?.DefaultEntryItem?.DefaultEntryPath); + } + } + else + { + Utility.OpenAs(Path.GetDirectoryName(noteFilePath)); + } + } + + [RelayCommand] + void OnViewAssistFile() + { + var noteFile = EntryItemValue.NoteFile; + var assistFilePath = Path.Combine(noteFile.EntryItem.EntryPath, noteFile.AssistFileName); + if (File.Exists(assistFilePath)) + { + var format = DB.Instance.GetFormat(noteFile); + if (format == -1) + { + var formatComputer = CharsetDetector.DetectFromFile(assistFilePath).Detected; + format = formatComputer != null && formatComputer.Confidence >= 0.875 && formatComputer.Encoding != null ? formatComputer.Encoding.CodePage : 932; + } + var assistFileViewModel = ViewModels.Instance.AssistFileValue; + assistFileViewModel.Title = noteFile.EntryItem.Title; + assistFileViewModel.Assist = File.ReadAllText(assistFilePath, Encoding.GetEncoding(format)); + assistFileViewModel.Open(); + } + } + + [RelayCommand] + void OnModeComponent(int? e) + { + if (e.HasValue) + { + ViewModels.Instance.ModifyModeComponentValue.ModeComponentVariety = e.Value; + ViewModels.Instance.ModifyModeComponentValue.Open(); + } + } + + [RelayCommand] + void OnPause() => Pause(); + + public void Pause() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.NoteFile: + if (AutoComputer != null) + { + AutoComputer.SetPause = !AutoComputer.SetPause; + } + else + { + _pausableAudioHandler.IsPausing = !_pausableAudioHandler.IsPausing; + } + break; + case Mode.Computing: + if (Computer.CanSetPosition) + { + Computer.SetPause = !Computer.SetPause; + } + break; + } + } + } + + [RelayCommand] + void OnAutoSalt() => Configure.Instance.SaltAuto = !Configure.Instance.SaltAuto; + + [RelayCommand] + void OnConfigure() => ViewModels.Instance.ConfigureValue.Open(); + + [RelayCommand] + void OnComment() => ViewModels.Instance.CommentValue.Open(); + + [RelayCommand] + void OnLowerTwilightCommentFavor() + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetFavor, new + { + noteID = EntryItemValue.NoteFile.GetNoteID512(), + favor = TwilightCommentFavor == false ? null : false as bool? + }); + LoadTwilightCommentCollection(); + } + + [RelayCommand] + void OnHigherTwilightCommentFavor() + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetFavor, new + { + noteID = EntryItemValue.NoteFile.GetNoteID512(), + favor = TwilightCommentFavor == true ? null : true as bool? + }); + LoadTwilightCommentCollection(); + } + + public MainViewModel() + { + _loadDefaultCommentHandler.Tick += async (sender, e) => + { + (sender as DispatcherTimer).Stop(); + if (EntryItemValue != null) + { + var targetNoteFiles = EntryItemValue.NoteFiles; + var commentItems = await (IsEntryItemEventNote ? DB.Instance.GetCommentItems(targetNoteFiles[0], EntryItemValue.EventNoteID, targetNoteFiles.Length) : DB.Instance.GetCommentItems(EntryItemValue.NoteFile, EntryItemValue.EventNoteID, 1)); + + DefaultCommentCollection.Clear(); + foreach (var commentItem in commentItems) + { + DefaultCommentCollection.Add(commentItem); + } + IsDefaultCommentLoading = false; + } + }; + _loadTwilightCommentHandler.Tick += async (sender, e) => + { + (sender as DispatcherTimer).Stop(); + var noteFile = EntryItemValue?.NoteFile; + if (noteFile != null) + { + var noteID = noteFile.GetNoteID512(); + var twilightWwwComment = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/comment?noteID={noteID}&avatarID={TwilightSystem.Instance.AvatarID}&language={Configure.Instance.Language}&target={Configure.Instance.UbuntuNetItemTarget}"); + if (twilightWwwComment.HasValue) + { + var twilightWwwCommentValue = twilightWwwComment.Value; + var comments = twilightWwwCommentValue.comments; + if (comments == null) + { + noteFile.IsBanned = true; + OnPropertyChanged(nameof(IsEntryItemBanned)); + } + else + { + noteFile = EntryItemValue?.NoteFile; + if (noteFile?.GetNoteID512() == noteID) + { + var commentItems = Utility.GetCommentItems(comments, noteFile); + TwilightCommentTotalFavor = twilightWwwCommentValue.totalFavor.ToString("👍 #,##0"); + TwilightCommentFavor = twilightWwwCommentValue.favor; + HandlingUISystem.Instance.HandleParallel(() => + { + TwilightCommentCollection.Clear(); + foreach (var commentItem in commentItems) + { + TwilightCommentCollection.Add(commentItem); + } + }); + var targetComment = commentItems.Where(comment => comment.AvatarWwwValue.AvatarID == TwilightSystem.Instance.AvatarID).SingleOrDefault(); + if (targetComment != null) + { + TwilightCommentText0 = (Array.IndexOf(commentItems, targetComment) + 1).ToString("##,##0"); + TwilightCommentText1 = commentItems.Length.ToString("/#,##0"); + if (noteFile.HandledValue != BaseNoteFile.Handled.Band1) + { + if (targetComment.IsP) + { + noteFile.HandledValue = BaseNoteFile.Handled.Band1; + } + else if (targetComment.ModeComponentValue.HitPointsModeValue == ModeComponent.HitPointsMode.Highest) + { + noteFile.HandledValue = BaseNoteFile.Handled.HighestClear; + } + else if (targetComment.ModeComponentValue.HitPointsModeValue == ModeComponent.HitPointsMode.Higher && noteFile.HandledValue != BaseNoteFile.Handled.HighestClear) + { + noteFile.HandledValue = BaseNoteFile.Handled.HigherClear; + } + else if (noteFile.HandledValue != BaseNoteFile.Handled.HigherClear && noteFile.HandledValue != BaseNoteFile.Handled.HighestClear) + { + noteFile.HandledValue = BaseNoteFile.Handled.Clear; + } + } + DB.Instance.SetHandled(noteFile); + } + } + } + } + IsTwilightCommentLoading = false; + } + }; + _autoComputerHandler.Tick += (sender, e) => + { + (sender as DispatcherTimer).Stop(); + if (IsNoteFileMode) + { + HandleAutoComputerImmediately(true); + } + }; + _wantHandler.Tick += (sender, e) => + { + (sender as DispatcherTimer).Stop(); + Want(); + }; + _fsw.Renamed += (sender, e) => + { + if (e.OldFullPath.IsTailCaselsss(".crdownload") && QwilightComponent.BundleFileFormats.Any(format => e.FullPath.IsTailCaselsss(format))) + { + var filePath = e.FullPath; + Utility.WaitUntilCanOpen(filePath); + var rar = filePath.IsTailCaselsss(".rar"); + var lzma = filePath.IsTailCaselsss(".7z"); + if (rar || lzma) + { + using IArchive rarLZMAFile = rar ? RarArchive.Open(filePath) : SevenZipArchive.Open(filePath); + if (rarLZMAFile.Entries.All(rarLZMAEntry => QwilightComponent.NoteFileFormats.Any(format => rarLZMAEntry.Key.IsTailCaselsss(format)))) + { + Utility.OpenAs(filePath); + } + else + { + HandleNoteBundle(filePath); + } + } + else + { + using var zipFile = ZipFile.Read(filePath); + if (zipFile.All(zipEntry => QwilightComponent.NoteFileFormats.Any(format => zipEntry.FileName.IsTailCaselsss(format)))) + { + Utility.OpenAs(filePath); + } + else + { + HandleNoteBundle(filePath); + } + } + } + }; + } + + public void HandleLevyNoteFile(EntryItem entryItemValue = null, WwwLevelData wwwLevelDataValue = null, ModeComponent defaultModeComponentValue = null) + { + if (entryItemValue != null || HasNotInput()) + { + entryItemValue ??= EntryItemValue; + + var onLevyNoteFile = entryItemValue?.NoteFile?.OnLevyNoteFile; + if (onLevyNoteFile != null) + { + onLevyNoteFile(); + } + else + { + if (ViewModels.Instance.HasSiteViewModel(siteViewModel => siteViewModel.IsNetSite)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.DefaultComputeInNetSiteFault); + } + else + { + var isSaltNoteFile = entryItemValue?.NoteFile is SaltNoteFile; + if (isSaltNoteFile) + { + SaltEntryView(); + entryItemValue = EntryItemValue; + } + + if (entryItemValue != null) + { + var eventNoteID = entryItemValue.EventNoteID; + var noteFiles = entryItemValue.NoteFiles; + var targetNoteFile = string.IsNullOrEmpty(eventNoteID) ? entryItemValue.NoteFile : noteFiles.First(); + if (string.IsNullOrEmpty(eventNoteID)) + { + Utility.HandleUIAudio("Levy Note File"); + IsCommentMode = false; + ModeComponentValue.ComputingValue = targetNoteFile; + ModeComponentValue.CanModifyMultiplier = true; + ModeComponentValue.CanModifyAudioMultiplier = true; + SetComputingMode(new(new[] { targetNoteFile }, null, defaultModeComponentValue, TwilightSystem.Instance.AvatarID, TwilightSystem.Instance.GetAvatarName(), wwwLevelDataValue, null, null, null)); + } + else + { + if (noteFiles.Any(noteFile => string.IsNullOrEmpty(noteFile.NoteFilePath))) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotAvailableEventNoteFileFault); + } + else + { + Utility.HandleUIAudio("Levy Note File"); + IsCommentMode = false; + ModeComponentValue.ComputingValue = targetNoteFile; + ModeComponentValue.CanModifyMultiplier = true; + ModeComponentValue.CanModifyAudioMultiplier = true; + SetComputingMode(new(noteFiles, null, defaultModeComponentValue, TwilightSystem.Instance.AvatarID, TwilightSystem.Instance.GetAvatarName(), wwwLevelDataValue, null, entryItemValue, null)); + } + } + } + + if (isSaltNoteFile) + { + EntryItemPosition = 1; + } + } + } + } + } + + public void Close() + { + _fsw.Dispose(); + + IsCommentMode = false; + var defaultModeComponentValue = Computer?.DefaultModeComponentValue; + if (defaultModeComponentValue != null) + { + ModeComponentValue.CopyAs(defaultModeComponentValue); + } + + Configure.Instance.Save(); + GPUConfigure.Instance.Save(); + FastDB.Instance.Save(); + + AudioSystem.Instance.Dispose(); + AudioInputSystem.Instance.Dispose(); + TwilightSystem.Instance.Dispose(); + IlluminationSystem.Instance.Dispose(); + ValveSystem.Instance.Dispose(); + + Utility.ModifyHwMode(QwilightComponent.DefaultHwMode); + + PIDClass.Instance.Dispose(); + + if (File.Exists(_qwilightFileName)) + { + if (_qwilightFileName.IsTailCaselsss(".zip")) + { + try + { + Process.Start(new ProcessStartInfo(Path.Combine(QwilightComponent.SoftwareEntryPath, "Igniter.exe"), $"\"{_qwilightFileName}\"") + { + UseShellExecute = true + }); + } + catch + { + Utility.OpenAs(_qwilightFileName); + } + } + else + { + Utility.OpenAs(_qwilightFileName); + } + } + } + + void WipeEntryItems(Func wipeEntryItemCondition, Func wipeNoteIDCondition, bool wipeEventNoteEntryItems) + { + foreach (var (entryItemID, entryItem) in _entryItems) + { + if (wipeEntryItemCondition(entryItem)) + { + _entryItems.Remove(entryItemID, out _); + } + } + if (wipeNoteIDCondition != null) + { + foreach (var (noteID, noteFile) in NoteID512s) + { + if (wipeNoteIDCondition(noteFile)) + { + NoteID512s.Remove(noteID, out _); + } + } + foreach (var (noteID, noteFile) in NoteID128s) + { + if (wipeNoteIDCondition(noteFile)) + { + NoteID128s.Remove(noteID, out _); + } + } + } + if (wipeEventNoteEntryItems) + { + EventNoteEntryItems.Clear(); + } + } + + public void LoadEventNoteEntryItems() + { + WipeEntryItems(entryItem => !string.IsNullOrEmpty(entryItem.EventNoteID), null, true); + foreach (var (eventNoteID, eventNoteName, eventNoteDate, eventNoteVariety) in DB.Instance.GetEventNote()) + { + try + { + var noteIDs = eventNoteVariety switch + { + DB.EventNoteVariety.Qwilight => NoteID512s, + DB.EventNoteVariety.MD5 => NoteID128s, + _ => default, + }; + var entryItem = new EntryItem + { + Title = eventNoteName, + EventNoteID = eventNoteID, + EventNoteName = eventNoteName, + EventNoteVariety = eventNoteVariety, + ModifiedDate = eventNoteDate, + EntryItemID = Interlocked.Increment(ref _lastEntryItemID) + }; + var noteFiles = eventNoteID.Split('/').Select(noteID => noteIDs.TryGetValue(noteID, out var noteFile) ? noteFile : new NotAvailableNoteFile(noteID, entryItem.DefaultEntryItem, entryItem)); + var (latestDate, handledCount) = DB.Instance.GetDate(default, eventNoteID); + entryItem.LatestDate = latestDate; + entryItem.HandledCount = handledCount; + entryItem.NoteFiles = noteFiles.ToArray(); + entryItem.WellNoteFiles = noteFiles.ToList(); + _entryItems[entryItem.EntryItemID] = entryItem; + EventNoteEntryItems[eventNoteID] = entryItem; + } + catch + { + } + } + } + + public void HandleNoteBundle(string filePath) + { + var savingBundleItem = new NotifyItem + { + Text = LanguageSystem.Instance.SavingFileContents, + Variety = NotifySystem.NotifyVariety.Levying, + OnStop = isTotal => false, + }; + try + { + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingBundleItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text); + var bundleEntryItem = Configure.Instance.LastDefaultEntryItem ?? DefaultEntryItem.EssentialBundle; + if (bundleEntryItem.DefaultEntryVarietyValue != DefaultEntryItem.DefaultEntryVariety.Default && bundleEntryItem.DefaultEntryVarietyValue != DefaultEntryItem.DefaultEntryVariety.Essential) + { + bundleEntryItem = DefaultEntryItem.EssentialBundle; + } + var bundleEntryPath = Path.Combine(bundleEntryItem.DefaultEntryPath, Path.GetFileNameWithoutExtension(filePath)); + Directory.CreateDirectory(bundleEntryPath); + var rar = filePath.IsTailCaselsss(".rar"); + var lzma = filePath.IsTailCaselsss(".7z"); + if (rar || lzma) + { + using IArchive rarLZMAFile = rar ? RarArchive.Open(filePath) : SevenZipArchive.Open(filePath); + foreach (var rarLZMAEntry in rarLZMAFile.Entries) + { + try + { + rarLZMAEntry.WriteToDirectory(bundleEntryPath, new() + { + ExtractFullPath = true + }); + } + catch + { + } + } + } + else + { + using var zipFile = ZipFile.Read(filePath, new() + { + Encoding = Encoding.GetEncoding(932) + }); + zipFile.ExtractProgress += (sender, e) => + { + savingBundleItem.LevyingStatus = e.EntriesExtracted; + savingBundleItem.QuitStatus = e.EntriesTotal; + savingBundleItem.NotifyBundleStatus(); + }; + zipFile.ExtractAll(bundleEntryPath, ExtractExistingFileAction.OverwriteSilently); + } + LoadEntryItem(bundleEntryItem, bundleEntryPath); + savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savingBundleItem.Text = LanguageSystem.Instance.SavedFileContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, savingBundleItem.Text); + } + catch (Exception e) + { + savingBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; + savingBundleItem.Text = string.Format(LanguageSystem.Instance.SaveFileFault, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, savingBundleItem.Text); + } + finally + { + savingBundleItem.OnStop = isTotal => true; + } + } + + void MoveStatus(double status, bool isEnter) + { + if (!_autoComputerHandler.IsEnabled && AutoComputer?.IsHandling == true) + { + AutoComputer.LevyingWait = AutoComputer.Length * status; + AutoComputer.SetUndo = true; + if (isEnter) + { + EnterAutoComputingMode(); + } + } + } + + public void EnterAutoComputingMode() + { + if (!IsComputingMode) + { + Fade(() => + { + Computer = AutoComputer; + ModeValue = Mode.Computing; + Configure.Instance.NotifyTutorial(Configure.TutorialID.ModifyAutoMode); + }, AutoComputer, true, 2); + } + } + + public void LoadDefaultEntryItem(bool isF5) + { + var lastDefaultEntryItem = Configure.Instance.LastDefaultEntryItem; + if (lastDefaultEntryItem == null) + { + Want(); + } + else + { + _setCancelDefaultEntryItem = new(); + IsDefaultEntryLoading = true; + Task.Run(() => + { + using (_setCancelDefaultEntryItem) + { + try + { + var lastDefaultEntryPath = lastDefaultEntryItem.DefaultEntryPath; + switch (lastDefaultEntryItem.DefaultEntryVarietyValue) + { + case DefaultEntryItem.DefaultEntryVariety.Total: + foreach (var defaultEntryPath in DefaultEntryItems.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Essential || defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Default)) + { + LoadDefaultEntryItemImpl(defaultEntryPath); + } + break; + case DefaultEntryItem.DefaultEntryVariety.Essential: + case DefaultEntryItem.DefaultEntryVariety.Default: + LoadDefaultEntryItemImpl(lastDefaultEntryItem); + break; + case DefaultEntryItem.DefaultEntryVariety.Favorite: + foreach (var frontEntryPath in lastDefaultEntryItem.FrontEntryPaths) + { + LoadDefaultEntryItemImpl(frontEntryPath == QwilightComponent.BundleEntryPath ? DefaultEntryItem.EssentialBundle : new() + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Default, + DefaultEntryPath = frontEntryPath + }); + } + break; + } + + void LoadDefaultEntryItemImpl(DefaultEntryItem defaultEntryItem) + { + var defaultEntryPath = defaultEntryItem.DefaultEntryPath; + if (defaultEntryPath != null) + { + var defaultEntryDate = Directory.GetLastWriteTime(defaultEntryPath); + isF5 = isF5 || defaultEntryDate > FastDB.Instance.GetDefaultEntryItemDate(defaultEntryPath); + if (isF5) + { + FastDB.Instance.SetDefaultEntryItemDate(defaultEntryPath, defaultEntryDate); + FastDB.Instance.WipeDefaultEntryItem(defaultEntryPath); + } + } + if ((isF5 && _alreadyLoadedDefaultEntryItems.Remove(defaultEntryItem)) || !_alreadyLoadedDefaultEntryItems.Contains(defaultEntryItem)) + { + WipeEntryItems(entryItem => defaultEntryItem == entryItem.DefaultEntryItem, noteFile => noteFile.DefaultEntryItem == defaultEntryItem, false); + var defaultEntryData = FastDB.Instance.GetDefaultEntryItems(defaultEntryPath); + var entryPaths = new ConcurrentBag(defaultEntryData); + var status = 0; + var endStatus = 0; + if (entryPaths.IsEmpty) + { + var defaultEntryPaths = Utility.GetEntry(defaultEntryPath); + status = 0; + endStatus = defaultEntryPaths.Length; + if (Directory.Exists(defaultEntryPath)) + { + LoadEntry(defaultEntryPath); + } + void LoadEntry(string targetEntryPath) + { + _setCancelDefaultEntryItem.Token.ThrowIfCancellationRequested(); + foreach (var entryPath in defaultEntryPath == targetEntryPath ? defaultEntryPaths : Utility.GetEntry(targetEntryPath)) + { + LoadEntry(entryPath); + if (defaultEntryPath == targetEntryPath) + { + Status = (double)Interlocked.Increment(ref status) / endStatus; + } + } + entryPaths.Add(targetEntryPath); + FastDB.Instance.SetDefaultEntryItem(defaultEntryPath, targetEntryPath); + } + } + status = 0; + endStatus = entryPaths.Count; + try + { + if (isF5) + { + foreach (var entryPath in entryPaths) + { + FastDB.Instance.WipeEntryItem(entryPath); + } + } + Utility.HandleHMP(entryPaths, Configure.Instance.LoadingBin, entryPath => + { + LoadEntryItem(defaultEntryItem, entryPath, _setCancelDefaultEntryItem); + Status = (double)Interlocked.Increment(ref status) / endStatus; + }, _setCancelDefaultEntryItem.Token); + } + catch (OperationCanceledException) + { + throw; + } + catch + { + _alreadyLoadedDefaultEntryItems.Remove(defaultEntryItem); + FastDB.Instance.WipeDefaultEntryItem(defaultEntryPath); + } + } + _alreadyLoadedDefaultEntryItems.Add(defaultEntryItem); + } + } + catch (OperationCanceledException) + { + } + finally + { + IsDefaultEntryLoading = false; + Status = 0.0; + LoadEventNoteEntryItems(); + Want(); + NotifySystem.Instance.NotifyPending(); + ViewModels.Instance.SiteContainerValue.SetComputingValues(); + } + } + }); + } + } + + public void LoadEntryItem(DefaultEntryItem defaultEntryItem, string entryPath, bool wantEntryItem = true) + { + var targetEntryPaths = new List(); + targetEntryPaths.Add(entryPath); + if (Directory.Exists(entryPath)) + { + LoadEntry(entryPath); + void LoadEntry(string targetEntryPath) + { + foreach (var entryPath in Utility.GetEntry(targetEntryPath)) + { + LoadEntry(entryPath); + } + targetEntryPaths.Add(targetEntryPath); + } + } + + var wantEntryItems = wantEntryItem ? new List() : null; + foreach (var targetEntryPath in targetEntryPaths) + { + foreach (var entryItem in _entryItems.Values.Where(entryItem => entryItem.EntryPath == targetEntryPath)) + { + _entryItems.Remove(entryItem.EntryItemID, out _); + } + FastDB.Instance.WipeEntryItem(targetEntryPath); + var entryItems = LoadEntryItem(defaultEntryItem, targetEntryPath, null); + wantEntryItems?.AddRange(entryItems); + } + LoadEventNoteEntryItems(); + Want(wantEntryItems?.LastOrDefault()); + NotifySystem.Instance.NotifyPending(); + ViewModels.Instance.SiteContainerValue.SetComputingValues(); + } + + IEnumerable LoadEntryItem(DefaultEntryItem defaultEntryItem, string entryPath, CancellationTokenSource setCancelDefaultEntryItem) + { + foreach (var (noteID, _) in NoteID512s.Where(pair => pair.Value.EntryItem.EntryPath == entryPath)) + { + NoteID512s.Remove(noteID, out _); + } + foreach (var (noteID, _) in NoteID128s.Where(pair => pair.Value.EntryItem.EntryPath == entryPath)) + { + NoteID128s.Remove(noteID, out _); + } + var tmpEntryItem = Configure.Instance.GroupEntry ? NewEntryItem() : null; + var targetNoteFiles = new List(); + var fastEntryItems = FastDB.Instance.GetEntryItems(entryPath).ToArray(); + if (fastEntryItems.Length > 0) + { + foreach (var fastEntryItem in fastEntryItems) + { + var noteFilePath = fastEntryItem.noteFilePath; + var noteID128 = fastEntryItem.noteID128; + var noteID256 = fastEntryItem.noteID256; + var noteID512 = fastEntryItem.noteID512; + for (var dataID = fastEntryItem.dataIDCount - 1; dataID >= 0; --dataID) + { + var entryItem = tmpEntryItem ?? NewEntryItem(); + var noteFile = BaseNoteFile.GetNoteFiles(noteFilePath, defaultEntryItem, entryItem, dataID)?.Single(); + if (noteFile != null) + { + try + { + noteFile.SetNoteIDs(noteID128, noteID256, noteID512); + if (!FastDB.Instance.GetNoteFile(noteFile)) + { + noteFile.SetData(Environment.TickCount, setCancelDefaultEntryItem); + } + targetNoteFiles.Add(noteFile); + } + catch (OperationCanceledException) + { + break; + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Save, $"{Path.GetFileName(noteFilePath)} ({e.Message})"); + } + } + } + } + } + else + { + foreach (var noteFilePath in Utility.GetFiles(entryPath).Where(noteFilePath => QwilightComponent.NoteFileFormats.Any(format => noteFilePath.IsTailCaselsss(format)))) + { + var entryItem = tmpEntryItem ?? NewEntryItem(); + var noteFiles = BaseNoteFile.GetNoteFiles(noteFilePath, defaultEntryItem, entryItem, -1)?.ToArray(); + if (noteFiles != null) + { + foreach (var noteFile in noteFiles) + { + try + { + if (!FastDB.Instance.GetNoteFile(noteFile)) + { + noteFile.SetData(Environment.TickCount, setCancelDefaultEntryItem); + } + targetNoteFiles.Add(noteFile); + } + catch (OperationCanceledException) + { + break; + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Save, $"{Path.GetFileName(noteFile.NoteFilePath)}:{noteFile.DataID} ({e.Message})"); + } + finally + { + FastDB.Instance.SetEntryItem(entryPath, noteFile, noteFiles.Length); + } + } + } + } + if (targetNoteFiles.Count > 0) + { + FastDB.Instance.SetEntryItem(entryPath, null, 0); + } + } + if (targetNoteFiles.Count > 0) + { + foreach (var targetNoteFile in targetNoteFiles) + { + NoteID512s[targetNoteFile.GetNoteID512()] = targetNoteFile; + NoteID128s[targetNoteFile.GetNoteID128()] = targetNoteFile; + } + if (tmpEntryItem != null) + { + targetNoteFiles.Sort((x, y) => + { + var level = x.LevelValue.CompareTo(y.LevelValue); + return level != 0 ? level : x.LevelTextValue.CompareTo(y.LevelTextValue); + }); + tmpEntryItem.NoteFiles = targetNoteFiles.ToArray(); + tmpEntryItem.CompatibleNoteFiles = tmpEntryItem.NoteFiles; + tmpEntryItem.WellNoteFiles = targetNoteFiles; + tmpEntryItem.NotePosition = Math.Min(DB.Instance.GetNotePosition(entryPath), targetNoteFiles.Count - 1); + _entryItems[tmpEntryItem.EntryItemID] = tmpEntryItem; + return new[] { tmpEntryItem }; + } + else + { + foreach (var targetNoteFile in targetNoteFiles) + { + targetNoteFile.EntryItem.NoteFiles = new[] { targetNoteFile }; + targetNoteFile.EntryItem.CompatibleNoteFiles = targetNoteFiles.ToArray(); + targetNoteFile.EntryItem.WellNoteFiles = targetNoteFile.EntryItem.NoteFiles.ToList(); + targetNoteFile.EntryItem.NotePosition = 0; + _entryItems[targetNoteFile.EntryItem.EntryItemID] = targetNoteFile.EntryItem; + } + return targetNoteFiles.Select(targetNoteFile => targetNoteFile.EntryItem); + } + } + else + { + return Array.Empty(); + } + + EntryItem NewEntryItem() => new() + { + DefaultEntryItem = defaultEntryItem, + ModifiedDate = Directory.GetLastWriteTime(entryPath), + EntryPath = entryPath, + EntryItemID = Interlocked.Increment(ref _lastEntryItemID) + }; + } + + public void InitModeComponent() + { + ModeComponentValue.InitModeComponent(); + NotifyBPMText(); + NotifyHighestInputCountText(); + OnJudgmentMeterMillisModified(); + ViewModels.Instance.SiteContainerValue.CallSetModeComponent(); + ViewModels.Instance.WwwLevelValue.WwwLevelGroupValue?.NotifyIsCompatible(); + HandleAutoComputer(); + } + + public void SaltEntryView() + { + var entryItemPosition = 1 + (EntryItems[1].IsLogical ? 1 : 0) + RandomNumberGenerator.GetInt32(EntryItems.Count - EntryItems.Count(entryItem => entryItem.IsLogical)); + if (entryItemPosition == EntryItemPosition) + { + ++entryItemPosition; + } + EntryItemValue = EntryItems.ElementAtOrDefault(entryItemPosition); + } + + public void Want(EntryItem wantEntryItem = null) + { + if (IsNoteFileMode && !IsDefaultEntryLoading) + { + HandlingUISystem.Instance.HandleParallel(() => + { + var wantInput = Configure.Instance.WantInput; + var isNotWantInput = string.IsNullOrEmpty(wantInput); + var lastDefaultEntryItem = Configure.Instance.LastDefaultEntryItem; + var validEntryItems = new List(); + var lastDefaultEntryPath = lastDefaultEntryItem?.DefaultEntryPath ?? string.Empty; + if (lastDefaultEntryItem == null) + { + validEntryItems.Add(EntryItem.DefaultEntryConfigureEntryItem); + validEntryItems.AddRange(DefaultEntryItems.Select(defaultEntryItem => defaultEntryItem.GetEntryItem(true, Interlocked.Increment(ref _lastEntryItemID))).Where(entryItem => isNotWantInput || entryItem.Title.Contains(wantInput) || entryItem.Artist.Contains(wantInput))); + EntryItems = new(validEntryItems); + OnPropertyChanged(nameof(EntryItems)); + } + else + { + var fitMode = Configure.Instance.FitModeValue; + var inputWantNoteVariety = Configure.Instance.InputWantNoteVariety; + var defaultEntryVariety = lastDefaultEntryItem.DefaultEntryVarietyValue; + var isTotalWantNoteVariety = Configure.Instance.IsTotalWantNoteVariety; + var hasEventNoteVariety = inputWantNoteVariety[(int)BaseNoteFile.NoteVariety.EventNote]; + var isDefaultEntryNotFavorite = defaultEntryVariety != DefaultEntryItem.DefaultEntryVariety.Favorite; + var isDefaultEntryLogical = defaultEntryVariety == DefaultEntryItem.DefaultEntryVariety.Total || !isDefaultEntryNotFavorite; + var entryItems = _entryItems.Values.Where(entryItem => + { + var defaultEntryItem = entryItem.DefaultEntryItem; + return defaultEntryItem?.DefaultEntryVarietyValue != DefaultEntryItem.DefaultEntryVariety.Net && (isDefaultEntryLogical || !string.IsNullOrEmpty(entryItem.EventNoteID) || lastDefaultEntryItem == defaultEntryItem); + }).ToArray(); + var isWantBannedTotal = Configure.Instance.WantBannedValue == Configure.WantBanned.Total; + var inputWantMode = Configure.Instance.InputWantMode; + var inputWantLevel = Configure.Instance.InputWantLevel; + var IsNotWantLevel = !Configure.Instance.WantLevelTextValue; + var inputWantHandled = Configure.Instance.InputWantHandled; + var lowestWantLevelTextValue = Configure.Instance.LowestWantLevelTextValue; + var highestWantLevelTextValue = Configure.Instance.HighestWantLevelTextValue; + var isNotWantBPM = !Configure.Instance.WantBPM; + var lowestWantBPM = Configure.Instance.LowestWantBPM; + var highestWantBPM = Configure.Instance.HighestWantBPM; + var isNotWantAverageInputCount = !Configure.Instance.WantAverageInputCount; + var lowestWantAverageInputCount = Configure.Instance.LowestWantAverageInputCount; + var highestWantAverageInputCount = Configure.Instance.HighestWantAverageInputCount; + var isNotWantHighestInputCount = !Configure.Instance.WantHighestInputCount; + var lowestWantHighestInputCount = Configure.Instance.LowestWantHighestInputCount; + var highestWantHighestInputCount = Configure.Instance.HighestWantHighestInputCount; + var wantLevelIDs = Configure.Instance.WantLevelIDs; + var isWantLevelSystem = Configure.Instance.WantLevelSystem; + var isNotWantLevelItem = !Configure.Instance.WantLevelIDs.Any(); + var isNotWantHellBPM = !Configure.Instance.WantHellBPM; + var levelID128s = LevelSystem.Instance.LevelID128s; + var levelID256s = LevelSystem.Instance.LevelID256s; + var levelID128NoteFiles = new Dictionary(LevelSystem.Instance.LevelID128NoteFiles); + var levelID256NoteFiles = new Dictionary(LevelSystem.Instance.LevelID256NoteFiles); + var logicalNoteFiles = new HashSet(); + var titles = new List(); + var bpmValues = new List(); + var lengthValues = new List(); + var artists = new List(); + foreach (var entryItem in entryItems) + { + var isEntryItemEventNote = !string.IsNullOrEmpty(entryItem.EventNoteID); + var wellNoteFiles = entryItem.WellNoteFiles; + wellNoteFiles.Clear(); + var noteFiles = entryItem.NoteFiles; + if (isEntryItemEventNote) + { + if (noteFiles.Any(noteFile => IsSatisfy(noteFile, true))) + { + wellNoteFiles.AddRange(noteFiles); + validEntryItems.Add(entryItem); + } + } + else + { + foreach (var noteFile in noteFiles) + { + if (!logicalNoteFiles.Contains(noteFile) && IsSatisfy(noteFile, false)) + { + wellNoteFiles.Add(noteFile); + logicalNoteFiles.Add(noteFile); + } + } + if (wellNoteFiles.Count > 0) + { + if (!wellNoteFiles.Contains(entryItem.NoteFile)) + { + entryItem.NotePosition = Array.IndexOf(noteFiles, wellNoteFiles.First()); + } + validEntryItems.Add(entryItem); + } + } + if (wellNoteFiles.Count > 0) + { + var highestLevelTextValue = double.MinValue; + var highestWantLevelID = string.Empty; + var highestInputCount = 0; + var averageInputCount = 0.0; + var totalNotes = 0; + DateTime? latestDate = null; + var handledCount = 0; + titles.Clear(); + bpmValues.Clear(); + lengthValues.Clear(); + artists.Clear(); + foreach (var wellNoteFile in wellNoteFiles) + { + levelID128NoteFiles.Remove(wellNoteFile.GetNoteID128()); + levelID256NoteFiles.Remove(wellNoteFile.GetNoteID256()); + titles.Add(Utility.GetTitle(wellNoteFile.Title)); + bpmValues.Add(wellNoteFile.BPM); + artists.Add(wellNoteFile.Artist); + lengthValues.Add(wellNoteFile.Length); + totalNotes = Math.Max(totalNotes, wellNoteFile.TotalNotes); + highestInputCount = Math.Max(highestInputCount, wellNoteFile.HighestInputCount); + averageInputCount = Math.Max(averageInputCount, wellNoteFile.AverageInputCount); + if (!isEntryItemEventNote) + { + if ((latestDate ?? DateTime.MinValue) < (wellNoteFile.LatestDate ?? DateTime.MinValue)) + { + latestDate = wellNoteFile.LatestDate; + } + var wantLevelID = wellNoteFile.WantLevelID; + if (string.IsNullOrEmpty(highestWantLevelID) || LevelSystem.Instance.WantLevelIDEquality.Compare(wantLevelID, highestWantLevelID) > 0) + { + highestWantLevelID = wantLevelID; + } + handledCount += wellNoteFile.HandledCount; + } + var levelTextValue = wellNoteFile.LevelTextValue; + if (!double.IsNaN(levelTextValue) && highestLevelTextValue < levelTextValue) + { + highestLevelTextValue = levelTextValue; + } + } + entryItem.Artist = Utility.GetFavoriteItem(artists); + entryItem.BPM = Utility.GetFavoriteItem(bpmValues); + entryItem.Length = Utility.GetFavoriteItem(lengthValues); + entryItem.TotalNotes = totalNotes; + entryItem.LevelTextValue = highestLevelTextValue; + entryItem.HighestInputCount = highestInputCount; + if (!isEntryItemEventNote) + { + entryItem.Title = Utility.GetFavoriteItem(titles); + entryItem.LatestDate = latestDate; + entryItem.HandledCount = handledCount; + entryItem.WantLevelID = highestWantLevelID; + } + fitMode.SetFittedText(entryItem); + } + } + fitMode.Fit(validEntryItems); + if (validEntryItems.Count >= 2) + { + validEntryItems.Insert(0, EntryItem.SaltEntryItem); + } + validEntryItems.Insert(0, lastDefaultEntryItem.GetEntryItem(false, Interlocked.Increment(ref _lastEntryItemID))); + if (isWantLevelSystem) + { + validEntryItems.AddRange(levelID128NoteFiles.Values.Concat(levelID256NoteFiles.Values).Where(levelNoteFile => IsAtLeastSatisfy(levelNoteFile, false)).Distinct().GroupBy(arg => arg.WantLevelID).OrderBy(wantLevelID => wantLevelID.Key, LevelSystem.Instance.WantLevelIDEquality).Select(levelNoteFiles => new EntryItem + { + Title = levelNoteFiles.Key, + NoteFiles = levelNoteFiles.ToArray(), + WellNoteFiles = levelNoteFiles.Cast().ToList(), + IsLogical = true, + EntryPath = levelNoteFiles.Key, + LogicalVarietyValue = EntryItem.LogicalVariety.Level, + EntryItemID = Interlocked.Increment(ref _lastEntryItemID) + })); + } + EntryItems = new(validEntryItems); + OnPropertyChanged(nameof(EntryItems)); + + bool IsAtLeastSatisfy(BaseNoteFile noteFile, bool isEntryItemEventNote) + { + var noteID128 = noteFile.GetNoteID128(); + var noteID256 = noteFile.GetNoteID256(); + if (isWantLevelSystem && levelID128s.TryGetValue(noteID128, out var levelID128) && (isNotWantLevelItem || wantLevelIDs.Contains(levelID128))) + { + noteFile.WantLevelID = levelID128; + } + else if (isWantLevelSystem && levelID256s.TryGetValue(noteID256, out var levelID256) && (isNotWantLevelItem || wantLevelIDs.Contains(levelID256))) + { + noteFile.WantLevelID = levelID256; + } + else + { + noteFile.WantLevelID = string.Empty; + } + return (!isWantLevelSystem || isNotWantLevelItem || !string.IsNullOrEmpty(noteFile.WantLevelID)) && + (isTotalWantNoteVariety || (hasEventNoteVariety ? isEntryItemEventNote || inputWantNoteVariety[(int)noteFile.NoteVarietyValue] : !isEntryItemEventNote && inputWantNoteVariety[(int)noteFile.NoteVarietyValue])) && + (isNotWantInput || + (noteFile.Title.ContainsCaselsss(wantInput)) || + (noteFile.Artist.ContainsCaselsss(wantInput)) || + (noteFile.LevelText.ContainsCaselsss(wantInput)) || + (noteFile.Genre.ContainsCaselsss(wantInput)) || + (noteFile.Tag.ContainsCaselsss(wantInput)) + ); + } + + bool IsSatisfy(BaseNoteFile noteFile, bool isEntryItemEventNote) + { + var levelTextValue = noteFile.LevelTextValue; + var bpm = noteFile.BPM; + var averageInputCount = noteFile.AverageInputCount; + var highestInputCount = noteFile.HighestInputCount; + return IsAtLeastSatisfy(noteFile, isEntryItemEventNote) && + (isDefaultEntryNotFavorite || noteFile.FavoriteEntryItems.Contains(lastDefaultEntryItem)) && + (isDefaultEntryLogical || noteFile.DefaultEntryItem == lastDefaultEntryItem) && + (isWantBannedTotal || !noteFile.IsBanned) && + inputWantMode[(int)noteFile.InputMode] && + inputWantLevel[(int)noteFile.LevelValue] && + inputWantHandled[(int)noteFile.HandledValue] && + (IsNotWantLevel || double.IsNaN(levelTextValue) || (lowestWantLevelTextValue <= levelTextValue && levelTextValue <= highestWantLevelTextValue)) && + (isNotWantBPM || (lowestWantBPM <= bpm && bpm <= highestWantBPM)) && + (isNotWantAverageInputCount || (lowestWantAverageInputCount <= averageInputCount && averageInputCount <= highestWantAverageInputCount)) && + (isNotWantHighestInputCount || (lowestWantHighestInputCount <= highestInputCount && highestInputCount <= highestWantHighestInputCount)) && + (isNotWantHellBPM || noteFile.IsHellBPM); + } + } + + wantEntryItem ??= LastEntryItems.GetValueOrDefault(lastDefaultEntryPath); + EntryItemValue = EntryItems.Contains(wantEntryItem) ? wantEntryItem : EntryItems.ElementAtOrDefault(Configure.Instance.LastEntryItemPositions.GetValueOrDefault(lastDefaultEntryPath)); + }); + } + } + + public void FlintNoteFile(string noteFilePath, int levyingMeter) + { + var targetNoteFile = BaseNoteFile.GetNoteFiles(noteFilePath, null, new() + { + EntryPath = Path.GetDirectoryName(noteFilePath), + }, -1).Single(); + if (targetNoteFile != null) + { + targetNoteFile.SetData(Environment.TickCount); + + var defaultModeComponentValue = ModeComponentValue.Clone(); + ModeComponentValue.InitModeComponent(); + ModeComponentValue.ComputingValue = targetNoteFile; + ModeComponentValue.CanModifyMultiplier = true; + ModeComponentValue.CanModifyAudioMultiplier = true; + SetComputingMode(new FlintCompute(targetNoteFile, defaultModeComponentValue, TwilightSystem.Instance.AvatarID, TwilightSystem.Instance.GetAvatarName(), levyingMeter)); + } + } + + void Fade(Action onFade, DefaultCompute fadingComputer, bool isFadingComputerStable, int fadingViewLayer) + { + _fadeInHandler?.Stop(); + + IsAvailable = false; + + FadingValue.Computer = fadingComputer; + FadingValue.IsComputerStable = isFadingComputerStable; + FadingValue.Layer = fadingViewLayer; + + var millis = BaseUI.Instance.FadingPropertyValues[(int)ModeValue]?[FadingValue.Layer]?.Millis; + var fadingCounter = Stopwatch.StartNew(); + new DispatcherTimer(QwilightComponent.StandardFrametime, DispatcherPriority.Render, (sender, e) => + { + if (millis > 0) + { + var millisValue = millis.Value; + FadingValue.Status = Math.Min(millisValue, fadingCounter.GetMillis()) / millisValue; + } + else + { + FadingValue.Status = 1.0; + } + + if (FadingValue.Status == 1.0) + { + (sender as DispatcherTimer).Stop(); + + FadingValue.Layer = 0; + onFade(); + + var millis = BaseUI.Instance.FadingPropertyValues[(int)ModeValue]?[FadingValue.Layer]?.Millis; + fadingCounter.Restart(); + _fadeInHandler = new(QwilightComponent.StandardFrametime, DispatcherPriority.Render, (sender, e) => + { + if (millis > 0) + { + var millisValue = millis.Value; + FadingValue.Status = 1.0 - Math.Min(millisValue, fadingCounter.GetMillis()) / millisValue; + } + else + { + FadingValue.Status = 0.0; + } + + if (FadingValue.Status == 0.0) + { + (sender as DispatcherTimer).Stop(); + + IsAvailable = true; + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointZMaxView + }); + } + }, HandlingUISystem.Instance.UIHandler); + } + }, HandlingUISystem.Instance.UIHandler); + } + + public void UndoUnitMultiplier() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.NoteFile: + ModeComponentValue.UndoUnitMultiplier(); + break; + case Mode.Computing: + Computer.ModeComponentValue.UndoUnitMultiplier(); + break; + } + } + } + + public void LowerMultiplier() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.NoteFile: + if (ModeComponentValue.LowerMultiplier()) + { + Utility.HandleUIAudio("Multiplier"); + NotifyBPMText(); + } + break; + case Mode.Computing: + Computer.LowerMultiplier(); + break; + } + } + } + + public void HigherMultiplier() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.NoteFile: + if (ModeComponentValue.HigherMultiplier()) + { + Utility.HandleUIAudio("Multiplier"); + NotifyBPMText(); + } + break; + case Mode.Computing: + Computer.HigherMultiplier(); + break; + } + } + } + + public void LowerAudioMultiplier() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.NoteFile: + if (ModeComponentValue.LowerAudioMultiplier()) + { + Utility.HandleUIAudio("Audio Multiplier"); + NotifyBPMText(); + NotifyHighestInputCountText(); + HandleAutoComputer(); + ViewModels.Instance.SiteContainerValue.CallSetModeComponent(); + } + break; + case Mode.Computing: + Computer.LowerAudioMultiplier(); + break; + } + } + } + + public void HigherAudioMultiplier() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.NoteFile: + if (ModeComponentValue.HigherAudioMultiplier()) + { + Utility.HandleUIAudio("Audio Multiplier"); + NotifyBPMText(); + NotifyHighestInputCountText(); + HandleAutoComputer(); + ViewModels.Instance.SiteContainerValue.CallSetModeComponent(); + } + break; + case Mode.Computing: + Computer.HigherAudioMultiplier(); + break; + } + } + } + + public void HigherDefaultSpinningMode() + { + if (HasNotInput()) + { + Configure.Instance.DefaultSpinningModeValue = (Configure.DefaultSpinningMode)(((int)Configure.Instance.DefaultSpinningModeValue + 3) % 4); + } + } + + public void LowerDefaultSpinningMode() + { + if (HasNotInput()) + { + Configure.Instance.DefaultSpinningModeValue = (Configure.DefaultSpinningMode)(((int)Configure.Instance.DefaultSpinningModeValue + 1) % 4); + } + } + + public void HandleModifyAutoMode() + { + if (HasNotInput()) + { + Computer.ModifyAutoMode(); + } + } + + public void HandleMediaMode() + { + if (HasNotInput()) + { + Configure.Instance.Media = !Configure.Instance.Media; + var handlingComputer = GetHandlingComputer(); + if (handlingComputer != null) + { + handlingComputer.SetWait(); + MediaSystem.Instance.HandleDefaultIfAvailable(handlingComputer); + MediaSystem.Instance.HandleIfAvailable(handlingComputer); + } + } + } + + public void LowerEntryItem() + { + if (HasNotInput() && EntryItemPosition >= 1) + { + --EntryItemPosition; + Utility.HandleUIAudio("Lower Entry Item"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.ModifyEntryItem); + } + } + + public void HigherEntryItem() + { + if (HasNotInput() && EntryItemPosition < EntryItems.Count - 1) + { + ++EntryItemPosition; + Utility.HandleUIAudio("Higher Entry Item"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.ModifyEntryItem); + } + } + + public void LowerNoteFile() + { + if (HasNotInput() && EntryItemValue?.LowerNoteFile() == true) + { + DB.Instance.SetNotePosition(EntryItemValue); + NotifyNoteFile(); + Utility.HandleUIAudio("Lower Note File"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.ModifyNoteFile); + } + } + + public void HigherNoteFile() + { + if (HasNotInput() && EntryItemValue?.HigherNoteFile() == true) + { + DB.Instance.SetNotePosition(EntryItemValue); + NotifyNoteFile(); + Utility.HandleUIAudio("Higher Note File"); + BaseUI.Instance.HandleEvent(BaseUI.EventItem.ModifyNoteFile); + } + } + + public void HandleF1() + { + if (HasNotInput(ViewModels.Instance.AssistValue)) + { + ViewModels.Instance.AssistValue.Toggle(); + } + } + + public void HandleF5() + { + if (HasNotInput() && !IsDefaultEntryLoading) + { + var lastDefaultEntryItem = Configure.Instance.LastDefaultEntryItem; + if (lastDefaultEntryItem != null) + { + if (EntryItemValue != null && !EntryItemValue.IsLogical && string.IsNullOrEmpty(EntryItemValue.EventNoteID)) + { + WeakReferenceMessenger.Default.Send((ICC)new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + string.Format(LanguageSystem.Instance.F5Notify1, lastDefaultEntryItem, Path.GetFileName(EntryItemValue.EntryPath)), + MESSAGEBOX_STYLE.MB_YESNOCANCEL | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + switch (r) + { + case MESSAGEBOX_RESULT.IDYES: + LoadDefaultEntryItem(true); + break; + case MESSAGEBOX_RESULT.IDNO: + LoadEntryItem(EntryItemValue.DefaultEntryItem, EntryItemValue.EntryPath); + break; + } + }) + } + }); + } + else + { + WeakReferenceMessenger.Default.Send((ICC)new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + string.Format(LanguageSystem.Instance.F5Notify0, Configure.Instance.LastDefaultEntryItem), + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + LoadDefaultEntryItem(true); + } + }) + } + }); + } + } + } + } + + public void HandleF6() + { + if (IsComputingMode) + { + Utility.SetUIItem(Configure.Instance.UIItemValue, Configure.Instance.UIItemValue); + } + else + { + Utility.SetBaseUIItem(Configure.Instance.BaseUIItemValue, Configure.Instance.BaseUIItemValue); + } + } + + public void HandleF7() + { + if (HasNotInput(ViewModels.Instance.VoteValue)) + { + ViewModels.Instance.VoteValue.Toggle(); + } + } + + public void HandleF8() + { + if (TwilightSystem.Instance.IsEstablished) + { + ViewModels.Instance.SiteContainerValue.Toggle(); + } + } + + public void HandleF9() + { + if (IsNoteFileMode) + { + var favoriteEntryItems = Configure.Instance.DefaultEntryItems.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite).ToArray(); + switch (favoriteEntryItems.Length) + { + case 0: + ViewModels.Instance.ModifyDefaultEntryValue.Open(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotFavoritesF10); + break; + case 1: + DefaultEntryItem favoriteEntryItemModified = null; + var targetFavoriteEntryItem = favoriteEntryItems.Single(); + var noteFiles = EntryItemValue.NoteFiles; + var setFavorites = noteFiles.Any(noteFile => !noteFile.FavoriteEntryItems.Contains(targetFavoriteEntryItem)); + foreach (var noteFile in noteFiles) + { + if (!noteFile.IsLogical) + { + if (setFavorites) + { + if (noteFile.FavoriteEntryItems.Add(targetFavoriteEntryItem)) + { + favoriteEntryItemModified = targetFavoriteEntryItem; + } + } + else + { + if (noteFile.FavoriteEntryItems.Remove(targetFavoriteEntryItem)) + { + favoriteEntryItemModified = targetFavoriteEntryItem; + } + } + foreach (var favoriteEntryItem in noteFile.FavoriteEntryItems) + { + favoriteEntryItem.FrontEntryPaths.Add(noteFile.DefaultEntryItem.DefaultEntryPath); + } + DB.Instance.SetFavoriteEntry(noteFile); + } + } + if (favoriteEntryItemModified != null) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(setFavorites ? LanguageSystem.Instance.SetFavoritesF10 : LanguageSystem.Instance.WipeFavoritesF10, favoriteEntryItemModified.FavoriteEntryName)); + if (favoriteEntryItemModified == Configure.Instance.LastDefaultEntryItem) + { + Want(); + } + } + break; + default: + HandlingUISystem.Instance.HandleParallel(() => + { + var favoriteEntryViewModel = ViewModels.Instance.FavoriteEntryValue; + if (!favoriteEntryViewModel.IsOpened) + { + favoriteEntryViewModel.EntryItem = EntryItemValue; + favoriteEntryViewModel.Mode = 1; + } + favoriteEntryViewModel.Toggle(); + }); + break; + } + } + } + + public void HandleF10() + { + if (TwilightSystem.Instance.IsSignedIn && HasNotInput(ViewModels.Instance.WwwLevelValue)) + { + ViewModels.Instance.WwwLevelValue.Toggle(); + } + } + + public void HandleF11() + { + if (HasNotInput(ViewModels.Instance.NotifyValue)) + { + ViewModels.Instance.NotifyValue.Toggle(); + } + } + + public void HandleF12() => StillSystem.Instance.Save(); + + public void HandleESC() + { + if (IsAvailable) + { + switch (ModeValue) + { + case Mode.NoteFile: + if (CloseOpenedViewModel()) + { + return; + } + if (IsCommentMode) + { + DefaultCommentItem = null; + TwilightCommentItem = null; + PointEntryView(); + return; + } + if (IsDefaultEntryLoading) + { + _setCancelDefaultEntryItem.Cancel(); + return; + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.Quit, + Contents = true + }); + break; + case Mode.Computing: + if (!CloseOpenedViewModel()) + { + if (string.IsNullOrEmpty(UI.Instance.FaultText)) + { + if (Computer.IsPausingWindowOpened) + { + Computer.Unpause(); + } + else + { + Computer.Pause(); + } + } + else + { + Computer.SetNoteFileMode(); + } + } + break; + case Mode.Quit: + if (!CloseOpenedViewModel()) + { + Computer.SetNoteFileMode(); + } + break; + } + + bool CloseOpenedViewModel() + { + var zMaxValue = int.MinValue; + BaseViewModel zMaxViewModel = null; + foreach (var windowViewModel in ViewModels.Instance.WindowViewModels) + { + var zValue = windowViewModel.Zvalue; + if (windowViewModel.IsOpened && zMaxValue < zValue) + { + zMaxValue = zValue; + zMaxViewModel = windowViewModel; + } + } + if (zMaxViewModel != null) + { + zMaxViewModel.Close(); + return true; + } + else + { + return false; + } + } + } + } + + public void HandleShift(bool isInput) + { + if (HasNotInput()) + { + if (isInput) + { + if (_wasLowerMillis && !IsCommentMode) + { + _wasLowerMillis = false; + var millis = Environment.TickCount; + if (_lastLowerMillis.HasValue) + { + if (millis - _lastLowerMillis.Value > 500) + { + _lastLowerMillis = millis; + } + else + { + InitModeComponent(); + _lastLowerMillis = null; + } + } + else + { + _lastLowerMillis = millis; + } + } + } + else + { + _wasLowerMillis = true; + } + } + } + + public void HandleSpace() + { + if (HasNotInput(ViewModels.Instance.ConfigureValue)) + { + switch (ModeValue) + { + case Mode.NoteFile: + case Mode.Computing when Computer.IsPausingWindowOpened: + case Mode.Quit: + ViewModels.Instance.ConfigureValue.Toggle(); + break; + } + } + } + + public void HandleEnter() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.Computing: + if (Computer.IsPausingWindowOpened) + { + switch (Configure.Instance.DefaultSpinningModeValue) + { + case Configure.DefaultSpinningMode.Unpause: + Computer.Unpause(); + break; + case Configure.DefaultSpinningMode.Configure: + ViewModels.Instance.ConfigureValue.Open(); + break; + case Configure.DefaultSpinningMode.Undo when Computer.CanUndo: + Computer.SetUndo = true; + break; + case Configure.DefaultSpinningMode.Stop: + Computer.Unpause(); + Computer.SetNoteFileMode(); + break; + } + } + else + { + if (Computer.IsPassable && !Computer.IsPausing) + { + Computer.SetPass = true; + } + } + break; + case Mode.Quit: + Computer.SetNoteFileMode(); + break; + } + } + } + + public void HandleInitComment() + { + if (HasNotInput()) + { + if (ViewModels.Instance.HasSiteViewModel(siteViewModel => siteViewModel.IsNetSite)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.DefaultComputeInNetSiteFault); + } + else + { + IsCommentMode = false; + var defaultModeComponentValue = Computer.DefaultModeComponentValue ?? ModeComponentValue.Clone(); + var defaultMultiplierValue = defaultModeComponentValue.MultiplierValue; + ModeComponentValue.CopyAs(Computer.ModeComponentValue, Computer.MyNoteFiles.First()); + ModeComponentValue.CanModifyMultiplier = true; + ModeComponentValue.MultiplierValue = defaultMultiplierValue; + ModeComponentValue.CanModifyAudioMultiplier = true; + SetComputingMode(new(Computer.MyNoteFiles, null, defaultModeComponentValue, TwilightSystem.Instance.AvatarID, TwilightSystem.Instance.GetAvatarName(), Computer.WwwLevelDataValue, null, Computer.EventNoteEntryItem)); + } + } + } + + public void HandleViewComment() + { + if (HasNotInput()) + { + if (Computer.IsPostableItemMode) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.PostableItemModeViewCommentFault); + } + else + { + IsCommentMode = false; + var defaultModeComponentValue = Computer.DefaultModeComponentValue ?? ModeComponentValue.Clone(); + ModeComponentValue.CopyAs(Computer.ModeComponentValue, Computer.MyNoteFiles.First(), false); + ModeComponentValue.SentMultiplier = Computer.TotallyLevyingMultiplier; + ModeComponentValue.CanModifyMultiplier = false; + ModeComponentValue.AudioMultiplier = Computer.TotallyLevyingAudioMultiplier; + ModeComponentValue.CanModifyAudioMultiplier = false; + SetComputingMode(new CommentCompute(Computer.MyNoteFiles, Computer.Comments, defaultModeComponentValue, Computer.AvatarID, Computer.AvatarName, null, Computer.EventNoteEntryItem, null, double.NaN)); + } + } + } + + public void HandleViewComment(NetItem netItem) + { + if (netItem.Comment != null && HasNotInput()) + { + IsCommentMode = false; + var defaultModeComponentValue = Computer.DefaultModeComponentValue ?? ModeComponentValue.Clone(); + ModeComponentValue.CopyAs(netItem.CommentItem.ModeComponentValue, Computer.NoteFile, false); + SetComputingMode(new CommentCompute(new[] { Computer.NoteFile }, new[] { netItem.Comment }, defaultModeComponentValue, netItem.AvatarID, netItem.AvatarName, null, null, null, Computer.LoopingCounter)); + } + } + + public void Input(T[][][] inputConfigure, T rawInput, bool isInput, DefaultCompute.InputFlag inputFlag = DefaultCompute.InputFlag.Not, byte inputPower = byte.MaxValue) + { + if (HasNotInput()) + { + var inputMap = inputConfigure[(int)Computer.InputMode]; + for (var i = inputMap.Length - 1; i > 0; --i) + { + if (Array.IndexOf(inputMap[i], rawInput) != -1) + { + Computer.Input(isInput ? i : -i, inputFlag, inputPower); + } + } + } + } + + public void PostItem(int postableItemPosition) + { + if (HasNotInput()) + { + Computer.PostItem(postableItemPosition); + } + } + + public void HandleUndo() + { + if (HasNotInput()) + { + switch (ModeValue) + { + case Mode.Computing: + if (Computer.CanUndo && Computer.IsPausingWindowOpened) + { + Computer.SetUndo = true; + } + break; + case Mode.Quit: + HandleInitComment(); + break; + } + } + } + + void MoveEntryView() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveEntryView, + Contents = EntryItemValue + }); + + public void PointEntryView() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.PointEntryView + }); + + public void OnWPFViewVisibilityModified() + { + IsWPFViewVisible = IsNoteFileMode || ViewModels.Instance.WindowViewModels.Any(windowViewModel => windowViewModel.IsOpened); + ViewModels.Instance.NotifyWindowViewModels(); + DrawingSystem.Instance.OnModified(); + var handlingComputer = GetHandlingComputer(); + if (handlingComputer != null) + { + MediaSystem.Instance.HandleDefaultIfAvailable(handlingComputer); + MediaSystem.Instance.HandleIfAvailable(handlingComputer); + } + MediaSystem.Instance.HandleDefaultIfAvailable(BaseUI.Instance); + MediaSystem.Instance.HandleIfAvailable(BaseUI.Instance); + TVSystem.Instance.HandleSystemIfAvailable(); + } + + public async void GetQwilight(bool isSilent) + { + try + { + var taehuiQwilight = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.TaehuiNetFE}/qwilight/qwilight.json"); + if (taehuiQwilight.HasValue) + { + var taehuiQwilightValue = taehuiQwilight.Value; + var date = Version.Parse(taehuiQwilightValue.date); + if (QwilightComponent.Date < date || QwilightComponent.HashText != taehuiQwilightValue.hash) + { + SaveQwilight(); + } + else if (!isSilent) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.AlreadyLatestDate, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + SaveQwilight(); + } + }) + } + }); + } + + async void SaveQwilight() + { + var data = ArrayPool.Shared.Rent(QwilightComponent.SendUnit); + var savingBundleItem = new NotifyItem + { + Text = LanguageSystem.Instance.SavingQwilightContents, + Variety = NotifySystem.NotifyVariety.Levying, + OnStop = isTotal => false + }; + try + { + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingBundleItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text); + var title = taehuiQwilightValue.title; + var tmpFileName = Path.GetTempFileName(); + var target = $"{QwilightComponent.TaehuiNetFE}/qwilight/{title}"; + using (var wwwClient = new HttpClient()) + { + using (var hrm = await wwwClient.GetAsync(target, HttpCompletionOption.ResponseHeadersRead)) + { + savingBundleItem.QuitStatus = hrm.Content.Headers.ContentLength ?? 0L; + } + using (var s = await wwwClient.GetStreamAsync(target)) + using (var fs = File.OpenWrite(tmpFileName)) + { + var length = 0; + while ((length = await s.ReadAsync(data.AsMemory(0, data.Length))) > 0) + { + await fs.WriteAsync(data.AsMemory(0, length)); + savingBundleItem.LevyingStatus += length; + savingBundleItem.NotifyBundleStatus(); + } + } + } + savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savingBundleItem.Text = LanguageSystem.Instance.SavedQwilightContents; + savingBundleItem.OnStop = isTotal => + { + Utility.WipeFile(_qwilightFileName); + return true; + }; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text); + var qwilightFileName = Path.ChangeExtension(tmpFileName, Path.GetExtension(title)); + Utility.MoveFile(tmpFileName, qwilightFileName); + _qwilightFileName = qwilightFileName; + } + catch (Exception e) + { + if (!isSilent) + { + savingBundleItem.Text = string.Format(LanguageSystem.Instance.GetQwilightFault, e.Message); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text); + } + } + finally + { + ArrayPool.Shared.Return(data); + } + } + } + } + catch (Exception e) + { + if (!isSilent) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.GetQwilightFault, e.Message)); + } + } + } + + public void WipeFavoriteEntry() + { + foreach (var entryItem in _entryItems.Values) + { + entryItem.WipeFavoriteEntry(); + } + } + + public void LoadDefaultCommentCollection() + { + HandlingUISystem.Instance.HandleParallel(DefaultCommentCollection.Clear); + IsDefaultCommentLoading = IsNoteFileNotLogical; + if (IsDefaultCommentLoading) + { + _loadDefaultCommentHandler.Stop(); + _loadDefaultCommentHandler.Start(); + } + } + + public void LoadTwilightCommentCollection() + { + HandlingUISystem.Instance.HandleParallel(TwilightCommentCollection.Clear); + TwilightCommentTotalFavor = "👍"; + TwilightCommentFavor = null; + TwilightCommentText0 = string.Empty; + TwilightCommentText1 = string.Empty; + IsTwilightCommentLoading = IsNoteFileNotLogical && !IsEntryItemBanned; + if (IsTwilightCommentLoading) + { + _loadTwilightCommentHandler.Stop(); + _loadTwilightCommentHandler.Start(); + } + } + + public async void LoadWowItemCollection() + { + IsWowLoading = true; + + var twilightWwwWow = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/wow"); + if (twilightWwwWow.HasValue) + { + var twilightWwwWowValue = twilightWwwWow.Value; + + TotalWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.totalAvatars) + { + TotalWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.HandledContents))); + } + HighestWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.highestAvatars) + { + HighestWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.CountContents))); + } + StandWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.standAvatars) + { + StandWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.StandContents))); + } + BandWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.bandAvatars) + { + BandWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.BandContents))); + } + TotalAtWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.totalAvatarsAt) + { + TotalAtWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.HandledContents))); + } + HighestAtWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.highestAvatarsAt) + { + HighestAtWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.CountContents))); + } + StandAtWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.standAvatarsAt) + { + StandAtWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.StandContents))); + } + BandAtWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.bandAvatarsAt) + { + BandAtWowItemCollection.Add(new(data, value => value.ToString(LanguageSystem.Instance.BandContents))); + } + Ability5KWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.ability5KAvatars) + { + Ability5KWowItemCollection.Add(new(data, value => value.ToString("#,##0.## Point"))); + } + Ability7KWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.ability7KAvatars) + { + Ability7KWowItemCollection.Add(new(data, value => value.ToString("#,##0.## Point"))); + } + Ability9KWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.ability9KAvatars) + { + Ability9KWowItemCollection.Add(new(data, value => value.ToString("#,##0.## Point"))); + } + LevelWowItemCollection.Clear(); + foreach (var data in twilightWwwWowValue.levelAvatars) + { + LevelWowItemCollection.Add(new(data, value => $"LV. {value}")); + } + } + + IsWowLoading = false; + } + + public void NotifyNoteFile() + { + IsCommentMode = false; + VerifyNoteFile(Configure.Instance.SetSalt ? ModeComponentValue.Salt : Environment.TickCount); + LoadCommentCollection(); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSituation, new + { + situationValue = (int)UbuntuItem.UbuntuSituation.NoteFileMode, + situationText = EntryItemValue?.NoteFile?.PlatformText ?? "Idle" + }); + } + + public void LoadCommentCollection() + { + if (!BaseUI.Instance.HasCommentPoint || ViewModels.Instance.CommentValue.IsOpened) + { + switch (Configure.Instance.CommentViewTabPosition) + { + case 0: + LoadDefaultCommentCollection(); + break; + case 1: + LoadTwilightCommentCollection(); + break; + } + } + } + + public void VerifyNoteFile(int salt) + { + if (EntryItemValue != null) + { + if (IsNoteFileNotLogical) + { + var targetNoteFile = EntryItemValue.NoteFile; + if (!FastDB.Instance.GetNoteFile(targetNoteFile) || targetNoteFile.IsSalt) + { + try + { + targetNoteFile.SetData(salt); + } + catch + { + } + } + ViewModels.Instance.SiteContainerValue.CallSetNoteFile(); + ModeComponentValue.ComputingValue = targetNoteFile; + ModeComponentValue.Salt = salt; + ModeComponentValue.SetLowestAutoLongNoteModify(); + ModeComponentValue.SetAutoPutNoteSetMillis(); + OnJudgmentMeterMillisModified(); + targetNoteFile.NotifyModel(); + } + EntryItemValue.NotifyModel(); + } + OnPropertyChanged(nameof(IsNoteFileNotLogical)); + OnPropertyChanged(nameof(IsNoteFileAvailable)); + OnPropertyChanged(nameof(HasAssistFile)); + OnPropertyChanged(nameof(LengthText)); + OnPropertyChanged(nameof(IsBPM1Visible)); + OnPropertyChanged(nameof(IsBPMVisible)); + OnPropertyChanged(nameof(IsEntryItemBanned)); + Configure.Instance.UIConfigureValue.NotifyInputMode(); + NotifyBPMText(); + NotifyHighestInputCountText(); + NotifyCanTwilightCommentary(); + NotifyCanTwilightFavor(); + NotifyCanSaveAsBundle(); + HandleAutoComputer(); + } + + public void OnJudgmentMeterMillisModified() + { + var noteFile = EntryItemValue?.NoteFile; + if (noteFile != null) + { + if (Configure.Instance.AutoJudgmentMeterMillis) + { + Configure.Instance.JudgmentMeterMillis = Math.Min + ( + Math.Abs(Component.GetJudgmentMillis(Configure.Instance.AutoJudgmentMeterMillisItemValue.Judged, ModeComponentValue, noteFile.JudgmentStage, Component.LatestJudgmentMode, Component.LatestJudgmentMap, Component.LatestLongNoteAssist, 0)), + Math.Abs(Component.GetJudgmentMillis(Configure.Instance.AutoJudgmentMeterMillisItemValue.Judged, ModeComponentValue, noteFile.JudgmentStage, Component.LatestJudgmentMode, Component.LatestJudgmentMap, Component.LatestLongNoteAssist, 1)) + ); + } + noteFile.SetJudgmentMillisTexts(ModeComponentValue); + } + } + + public void NotifyBPMText() => OnPropertyChanged(nameof(BPMText)); + + public void NotifyHighestInputCountText() => OnPropertyChanged(nameof(HighestInputCountText)); + + public override void NotifyModel() + { + base.NotifyModel(); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetNoteFileModeWindowInputs + }); + DrawingSystem.Instance.OnModified(); + BaseUI.Instance.NotifyModel(); + UI.Instance.NotifyModel(); + TwilightSystem.Instance.NotifyModel(); + Configure.Instance.NotifyModel(); + LanguageSystem.Instance.NotifyModel(); + ControllerSystem.Instance.NotifyModel(); + MIDISystem.Instance.NotifyModel(); + Configure.Instance.NotifyModel(); + AvatarTitleSystem.Instance.WipeAvatarTitles(); + ViewModels.Instance.ModifyModeComponentValue.SetModeComponentValues(); + } + + public void SetNoteFileMode(string faultText = null) + { + void HandleImpl() + { + if (Computer.DefaultModeComponentValue != null) + { + ModeComponentValue.CopyAs(Computer.DefaultModeComponentValue, Computer); + ViewModels.Instance.SiteContainerValue.CallSetModeComponent(); + } + ModeComponentValue.CanModifyMultiplier = true; + ModeComponentValue.CanModifyAudioMultiplier = true; + ModeValue = Mode.NoteFile; + Computer.AtNoteFileMode(); + EntryItemValue = null; + Want(); + if (!string.IsNullOrEmpty(faultText)) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, faultText); + } + } + switch (ModeValue) + { + case Mode.Computing: + Fade(HandleImpl, Computer, true, 1); + break; + case Mode.Quit: + Fade(HandleImpl, GetHandlingComputer(), true, 1); + break; + } + } + + public void SetComputingMode(DefaultCompute targetComputer) + { + void HandleImpl() + { + if (AutoComputer != null) + { + AudioSystem.Instance.Migrate(AutoComputer, targetComputer); + MediaSystem.Instance.Migrate(AutoComputer, targetComputer); + DrawingSystem.Instance.Migrate(AutoComputer, targetComputer); + } + else if (Computer != null) + { + AudioSystem.Instance.Migrate(Computer, targetComputer); + MediaSystem.Instance.Migrate(Computer, targetComputer); + DrawingSystem.Instance.Migrate(Computer, targetComputer); + } + var defaultComputer = Computer; + Computer = targetComputer; + Computer.HandleCompiler(); + ModeValue = Mode.Computing; + defaultComputer?.Close(); + CloseAutoComputer(); + } + switch (ModeValue) + { + case Mode.NoteFile: + Fade(HandleImpl, targetComputer, false, 1); + break; + case Mode.Computing: + HandleImpl(); + break; + case Mode.Quit: + Fade(HandleImpl, GetHandlingComputer(), true, 1); + break; + } + } + + public void SetQuitMode(DefaultCompute defaultComputer) + { + void HandleImpl() + { + defaultComputer.SetJudgmentMillis(); + defaultComputer.AtQuitMode(); + defaultComputer.NotifyCompute(); + Computer = defaultComputer; + ModeValue = Mode.Quit; + } + switch (ModeValue) + { + case Mode.NoteFile: + Fade(HandleImpl, defaultComputer, false, 0); + break; + case Mode.Computing: + Fade(HandleImpl, Computer, true, Computer.FadingViewLayer); + break; + case Mode.Quit: + HandleImpl(); + break; + } + } + + public void SetDefaultEntryItems() + { + var lastDefaultEntryItem = Configure.Instance.LastDefaultEntryItem; + Utility.SetUICollection(DefaultEntryItems, new List(Configure.Instance.DefaultEntryItems) + { + DefaultEntryItem.Total, + DefaultEntryItem.EssentialBundle + }, defaultEntryItem => + { + if (defaultEntryItem == lastDefaultEntryItem) + { + Configure.Instance.LastDefaultEntryItem = null; + } + WipeEntryItems(entryItem => defaultEntryItem == entryItem.DefaultEntryItem, noteFile => defaultEntryItem == noteFile.DefaultEntryItem, false); + _alreadyLoadedDefaultEntryItems.Remove(defaultEntryItem); + }); + DefaultEntryItems.Sort(); + LoadDefaultEntryItem(false); + } + + public void WipeLoadedDefaultEntryItems() + { + _alreadyLoadedDefaultEntryItems.Clear(); + FastDB.Instance.WipeDefaultEntryItems(); + } + + public void HandleAutoComputer() + { + _autoComputerHandler.Stop(); + _autoComputerHandler.Start(); + } + + public void HandleAutoComputerImmediately(bool doTrailerAudio) + { + if (!ViewModels.Instance.VoteValue.IsOpened && !ViewModels.Instance.LevelVoteValue.IsOpened) + { + var targetNoteFile = EntryItemValue?.NoteFile; + if (targetNoteFile != null) + { + if (targetNoteFile.IsLogical) + { + CloseAutoComputer(targetNoteFile.LogicalAudioFileName); + } + else + { + if (Configure.Instance.AutoCompute) + { + if (AutoComputer == null || !targetNoteFile.IsContinuous(AutoComputer.NoteFile) || AutoComputer.SetStop) + { + NewAutoComputer(double.NaN, false); + } + else if (targetNoteFile != AutoComputer.NoteFile || + !ModeComponentValue.IsCompatible(AutoComputer.CompatibleModeComponentValue) || + Configure.Instance.LoopUnit != AutoComputer.Comment.LoopUnit || + Configure.Instance.LoadedMedia != AutoComputer.LoadedMedia || + Configure.Instance.BanalMedia != AutoComputer.BanalMedia || Configure.Instance.AlwaysBanalMedia != AutoComputer.AlwaysBanalMedia || Configure.Instance.BanalMediaFilePath != AutoComputer.BanalMediaFilePath || + Configure.Instance.BanalFailedMedia != AutoComputer.BanalFailedMedia || Configure.Instance.AlwaysBanalFailedMedia != AutoComputer.AlwaysBanalFailedMedia || Configure.Instance.BanalFailedMediaFilePath != AutoComputer.BanalFailedMediaFilePath) + { + NewAutoComputer(AutoComputer.IsHandling ? AutoComputer.LoopingCounter : AutoComputer.LevyingWait, true); + } + else + { + if (Configure.Instance.AlwaysNotP2Position != AutoComputer.AlwaysNotP2Position || + Configure.Instance.InputMappingValue != AutoComputer.InputMappingValue) + { + Task.Run(AutoComputer.SetUIMap); + } + } + } + else + { + CloseAutoComputer("Default"); + targetNoteFile.SetConfigure(); + } + void NewAutoComputer(double levyingWait, bool doMigrate) + { + ModeComponentValue.ComputingValue = targetNoteFile; + var autoComputer = new AutoCompute(new[] { targetNoteFile }, null, TwilightSystem.Instance.AvatarID, TwilightSystem.Instance.GetAvatarName(), -1, levyingWait); + var hasTrailerAudio = doTrailerAudio && AudioSystem.Instance.HandleImmediately(Utility.GetAvailable(targetNoteFile.TrailerAudioPath, Utility.AvailableFlag.Audio), autoComputer, autoComputer.TrailerAudioHandler); + autoComputer.SetPause = hasTrailerAudio; + var defaultComputer = doMigrate ? autoComputer : null; + var isMigrate = AutoComputer != null && defaultComputer != null; + if (isMigrate) + { + AudioSystem.Instance.Migrate(AutoComputer, defaultComputer); + MediaSystem.Instance.Migrate(AutoComputer, defaultComputer); + DrawingSystem.Instance.Migrate(AutoComputer, defaultComputer); + } + CloseAutoComputer(isMigrate || !doTrailerAudio || hasTrailerAudio ? null : "Default"); + AutoComputer = autoComputer; + AutoComputer.HandleCompiler(); + if (IsComputingMode) + { + Computer.Close(); + Computer = AutoComputer; + } + } + } + } + else + { + CloseAutoComputer("Default"); + } + } + } + + public void CloseAutoComputer(string audioFileName = null) + { + _autoComputerHandler.Stop(); + AutoComputer?.Close(); + AutoComputer = null; + ClosePausableAudioHandler(audioFileName); + } + + public void ClosePausableAudioHandler(string audioFileName = null) + { + var defaultAudioVarietyValue = Configure.Instance.DefaultAudioVarietyValue; + if (audioFileName == "Default") + { + switch (defaultAudioVarietyValue) + { + case Configure.DefaultAudioVariety.Not: + audioFileName = null; + break; + case Configure.DefaultAudioVariety.Favor: + audioFileName = nameof(AudioSystem.Instance.DefaultAudio); + break; + } + } + if (_pausableAudioHandler.AudioFileName != audioFileName) + { + AudioSystem.Instance.Fade(_pausableAudioHandler, QwilightComponent.StandardWaitMillis); + if (IsNoteFileMode || audioFileName == null) + { + _pausableAudioHandler.AudioFileName = audioFileName; + _pausableAudioHandler.IsPausing = audioFileName == null; + if (audioFileName != null) + { + switch (audioFileName) + { + case nameof(AudioSystem.Instance.DefaultAudio): + AudioSystem.Instance.Handle(new() + { + AudioLevyingPosition = _pausableAudioHandler.GetAudioPosition(), + AudioItem = AudioSystem.Instance.DefaultAudio + }, AudioSystem.SEAudio, 1.0, false, _pausableAudioHandler, QwilightComponent.StandardWaitMillis); + break; + default: + Utility.HandleUIAudio(audioFileName, null, _pausableAudioHandler, QwilightComponent.StandardWaitMillis); + break; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/ModifyDefaultEntryViewModel.cs b/Qwilight/Qwilight/ViewModel/ModifyDefaultEntryViewModel.cs new file mode 100644 index 0000000..d98f5b7 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/ModifyDefaultEntryViewModel.cs @@ -0,0 +1,245 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Collections.ObjectModel; +using System.Windows.Input; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight +{ + public sealed partial class ModifyDefaultEntryViewModel : BaseViewModel + { + readonly List _defaultEntryItemCollection = new(); + readonly bool[] _groupEntryInputs = new bool[2]; + bool _defaultGroupEntry; + DefaultEntryItem _defaultEntryItem; + + public bool GroupEntry0 + { + get => _groupEntryInputs[0]; + + set + { + if (SetProperty(ref _groupEntryInputs[0], value, nameof(GroupEntry0))) + { + Configure.Instance.GroupEntry = false; + } + } + } + + public bool GroupEntry1 + { + get => _groupEntryInputs[1]; + + set + { + if (SetProperty(ref _groupEntryInputs[1], value, nameof(GroupEntry1))) + { + Configure.Instance.GroupEntry = true; + } + } + } + + public override double TargetLength => 0.6; + + public override double TargetHeight => 0.8; + + public ObservableCollection DefaultEntryItemCollection { get; } = new(); + + public DefaultEntryItem DefaultEntryItem + { + get => _defaultEntryItem; + + set + { + if (SetProperty(ref _defaultEntryItem, value, nameof(DefaultEntryItem))) + { + OnPropertyChanged(nameof(IsFavoriteEntry)); + } + } + } + + public bool IsFavoriteEntry => DefaultEntryItem?.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite; + + public void OnInputLower(KeyEventArgs e) + { + switch (e.Key) + { + case Key.Up when DefaultEntryItem != null: + var i = DefaultEntryItemCollection.IndexOf(DefaultEntryItem); + if (i > 0) + { + DefaultEntryItemCollection.Move(i, i - 1); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveDefaultEntryView, + Contents = DefaultEntryItem + }); + e.Handled = true; + break; + case Key.Down when DefaultEntryItem != null: + i = DefaultEntryItemCollection.IndexOf(DefaultEntryItem); + if (i < DefaultEntryItemCollection.Count - 1) + { + DefaultEntryItemCollection.Move(i, i + 1); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveDefaultEntryView, + Contents = DefaultEntryItem + }); + e.Handled = true; + break; + case Key.Delete when DefaultEntryItem != null: + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + DefaultEntryItem.WipeNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + i = DefaultEntryItemCollection.IndexOf(DefaultEntryItem); + DefaultEntryItemCollection.RemoveAt(i); + if (i < DefaultEntryItemCollection.Count) + { + DefaultEntryItem = DefaultEntryItemCollection[i]; + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveDefaultEntryView, + Contents = DefaultEntryItem + }); + } + }) + } + }); + break; + } + } + + [RelayCommand] + void OnNewDefaultEntry() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewEntryWindow, + Contents = new Action(fileName => + { + if (!DefaultEntryItemCollection.Any(defaultEntryItem => defaultEntryItem.DefaultEntryPath == fileName)) + { + DefaultEntryItemCollection.Add(new DefaultEntryItem + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Default, + DefaultEntryPath = fileName + }); + } + }) + }); + + [RelayCommand] + void OnNewFavoriteEntry() + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewInputWindow, + Contents = new object[] + { + LanguageSystem.Instance.NewFavoriteEntryContents, + string.Empty, + new Action(favoriteEntryName => + { + DefaultEntryItemCollection.Add(new DefaultEntryItem + { + DefaultEntryVarietyValue = DefaultEntryItem.DefaultEntryVariety.Favorite, + DefaultEntryPath = Guid.NewGuid().ToString(), + FavoriteEntryName = favoriteEntryName + }); + }) + } + }); + } + + [RelayCommand] + void OnModifyFavoriteEntryName() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewInputWindow, + Contents = new object[] + { + LanguageSystem.Instance.ModifyFavoriteEntryNameContents, + DefaultEntryItem.FavoriteEntryName, + new Action(favoriteEntryName => DefaultEntryItem.FavoriteEntryName = favoriteEntryName) + } + }); + + [RelayCommand] + void OnModifyFrontEntry() + { + ViewModels.Instance.ModifyFrontEntryValue.FavoriteEntryItem = DefaultEntryItem; + ViewModels.Instance.ModifyFrontEntryValue.Open(); + } + + [RelayCommand] + void OnFitDefaultEntry() + { + var defaultEntryCollection = new List(); + foreach (var defaultEntryItem in DefaultEntryItemCollection.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Default).OrderBy(defaultEntryItem => defaultEntryItem.ToString())) + { + defaultEntryCollection.Add(defaultEntryItem); + } + foreach (var defaultEntryItem in DefaultEntryItemCollection.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite).OrderBy(defaultEntryItem => defaultEntryItem.ToString())) + { + defaultEntryCollection.Add(defaultEntryItem); + } + DefaultEntryItemCollection.Clear(); + foreach (var defaultEntryItem in defaultEntryCollection) + { + DefaultEntryItemCollection.Add(defaultEntryItem); + } + } + + public override void OnOpened() + { + base.OnOpened(); + _defaultGroupEntry = Configure.Instance.GroupEntry; + _defaultEntryItemCollection.Clear(); + _defaultEntryItemCollection.AddRange(Configure.Instance.DefaultEntryItems); + HandlingUISystem.Instance.HandleParallel(() => + { + DefaultEntryItemCollection.Clear(); + foreach (var defaultEntryItem in _defaultEntryItemCollection) + { + DefaultEntryItemCollection.Add(defaultEntryItem); + } + }); + GroupEntry0 = !Configure.Instance.GroupEntry; + GroupEntry1 = Configure.Instance.GroupEntry; + } + + public override void OnCollasped() + { + base.OnCollasped(); + for (var i = DefaultEntryItemCollection.Count - 1; i >= 0; --i) + { + DefaultEntryItemCollection[i].Layer = i; + } + Configure.Instance.DefaultEntryItems.Clear(); + foreach (var defaultEntryItem in DefaultEntryItemCollection) + { + Configure.Instance.DefaultEntryItems.Add(defaultEntryItem); + } + if (Utility.IsItemsEqual(DefaultEntryItemCollection, _defaultEntryItemCollection) != true) + { + ViewModels.Instance.MainValue.SetDefaultEntryItems(); + } + if (_defaultGroupEntry != Configure.Instance.GroupEntry) + { + ViewModels.Instance.MainValue.WipeLoadedDefaultEntryItems(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/ModifyFrontEntryViewModel.cs b/Qwilight/Qwilight/ViewModel/ModifyFrontEntryViewModel.cs new file mode 100644 index 0000000..a9c9248 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/ModifyFrontEntryViewModel.cs @@ -0,0 +1,116 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class ModifyFrontEntryViewModel : BaseViewModel + { + FrontEntryItem? _frontEntryItemValue; + + public override double TargetLength => 0.6; + + public override double TargetHeight => 0.4; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public ObservableCollection FrontEntryItemCollection { get; } = new(); + + public DefaultEntryItem FavoriteEntryItem { get; set; } + + public FrontEntryItem? FrontEntryItemValue + { + get => _frontEntryItemValue; + + set => SetProperty(ref _frontEntryItemValue, value, nameof(FrontEntryItemValue)); + } + + public void OnInputLower(KeyEventArgs e) + { + switch (e.Key) + { + case Key.Up when FrontEntryItemValue.HasValue: + var i = FrontEntryItemCollection.IndexOf(FrontEntryItemValue.Value); + if (i > 0) + { + FrontEntryItemCollection.Move(i, i - 1); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveFrontEntryView, + Contents = FrontEntryItemValue + }); + e.Handled = true; + break; + case Key.Down when FrontEntryItemValue.HasValue: + i = FrontEntryItemCollection.IndexOf(FrontEntryItemValue.Value); + if (i < FrontEntryItemCollection.Count - 1) + { + FrontEntryItemCollection.Move(i, i + 1); + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveFrontEntryView, + Contents = FrontEntryItemValue + }); + e.Handled = true; + break; + case Key.Delete when FrontEntryItemValue.HasValue: + i = FrontEntryItemCollection.IndexOf(FrontEntryItemValue.Value); + FrontEntryItemCollection.RemoveAt(i); + if (i < FrontEntryItemCollection.Count) + { + FrontEntryItemValue = FrontEntryItemCollection[i]; + } + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.MoveFrontEntryView, + Contents = FrontEntryItemValue + }); + break; + } + } + + [RelayCommand] + void OnNewFrontEntry() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewEntryWindow, + Contents = new Action(fileName => + { + if (!FrontEntryItemCollection.Any(frontEntryItem => frontEntryItem.FrontEntryPath == fileName)) + { + FrontEntryItemCollection.Add(new FrontEntryItem + { + FrontEntryPath = fileName, + }); + } + }) + }); + + public override void OnOpened() + { + base.OnOpened(); + FrontEntryItemCollection.Clear(); + foreach (var frontEntryPath in FavoriteEntryItem.FrontEntryPaths) + { + FrontEntryItemCollection.Add(new FrontEntryItem + { + FrontEntryPath = frontEntryPath + }); + } + } + + public override void OnCollasped() + { + base.OnCollasped(); + FavoriteEntryItem.FrontEntryPaths.Clear(); + foreach (var frontEntryItemValue in FrontEntryItemCollection) + { + FavoriteEntryItem.FrontEntryPaths.Add(frontEntryItemValue.FrontEntryPath); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/ModifyModeComponentViewModel.cs b/Qwilight/Qwilight/ViewModel/ModifyModeComponentViewModel.cs new file mode 100644 index 0000000..8f98aa5 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/ModifyModeComponentViewModel.cs @@ -0,0 +1,606 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed partial class ModifyModeComponentViewModel : BaseViewModel + { + public const int AutoModeVariety = 0; + public const int NoteSaltModeVariety = 1; + public const int FaintNoteModeVariety = 2; + public const int JudgmentModeVariety = 3; + public const int HitPointsModeVariety = 4; + public const int NoteMobilityModeVariety = 5; + public const int LongNoteModeVariety = 6; + public const int InputFavorModeVariety = 7; + public const int NoteModifyModeVariety = 8; + public const int BPMModeVariety = 9; + public const int WaveModeVariety = 10; + public const int SetNoteModeVariety = 11; + public const int LowestJudgmentConditionModeVariety = 12; + + int _modeComponentValueVariety; + ModifyModeComponentItem _modeComponentItem; + List _modeComponentItems; + + public override double TargetLength => 0.5; + + public override double TargetHeight => 0.5; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public List[] ModeComponentValues { get; } = new List[13]; + + public List ModeComponentItems + { + get => _modeComponentItems; + + set => SetProperty(ref _modeComponentItems, value, nameof(ModeComponentItems)); + } + + public int ModeComponentVariety + { + get => _modeComponentValueVariety; + + set + { + _modeComponentValueVariety = value; + var noteFile = ViewModels.Instance.MainValue?.EntryItemValue?.NoteFile; + var inputMode = noteFile?.InputMode ?? default; + var autoableInputCount = Component.AutoableInputCounts[(int)inputMode]; + switch (value) + { + case AutoModeVariety: + var autoModeComponent = ModeComponentValues[AutoModeVariety][(int)ModeComponent.AutoMode.Autoable]; + if (autoableInputCount > 0 && noteFile?.AutoableNotes > 0) + { + autoModeComponent.PointedPaintID = 1; + } + else + { + autoModeComponent.PointedPaintID = 0; + } + break; + case InputFavorModeVariety: + var inputCount = Component.InputCounts[(int)inputMode]; + foreach (var inputFavorModeComponentValue in ModeComponentValues[InputFavorModeVariety]) + { + var inputFavorModeValue = (ModeComponent.InputFavorMode)inputFavorModeComponentValue.Value; + if (inputFavorModeValue != ModeComponent.InputFavorMode.Default && (Component.AutoableInputCounts[(int)inputFavorModeValue] < autoableInputCount || Component.InputCounts[(int)inputFavorModeValue] < inputCount)) + { + inputFavorModeComponentValue.PointedPaintID = 1; + } + else + { + inputFavorModeComponentValue.PointedPaintID = 0; + } + } + break; + case LongNoteModeVariety: + var longNoteModeComponent = ModeComponentValues[LongNoteModeVariety][(int)ModeComponent.LongNoteMode.Auto]; + if (noteFile?.LongNotes > 0) + { + longNoteModeComponent.PointedPaintID = 1; + } + else + { + longNoteModeComponent.PointedPaintID = 0; + } + break; + } + ModeComponentItems = ModeComponentValues[value]; + var targetModeValue = value switch + { + AutoModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.AutoModeValue, + NoteSaltModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteSaltModeValue, + FaintNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.FaintNoteModeValue, + JudgmentModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.JudgmentModeValue, + HitPointsModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.HitPointsModeValue, + NoteMobilityModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteMobilityModeValue, + LongNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.LongNoteModeValue, + InputFavorModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.InputFavorModeValue, + NoteModifyModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteModifyModeValue, + BPMModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.BPMModeValue, + WaveModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.WaveModeValue, + SetNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.SetNoteModeValue, + LowestJudgmentConditionModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.LowestJudgmentConditionModeValue, + _ => default + }; + ModeComponentItem = ModeComponentItems.Single(modeComponentItem => modeComponentItem.Value == targetModeValue); + } + } + + public ModifyModeComponentItem ModeComponentItem + { + get => _modeComponentItem; + + set + { + if (SetProperty(ref _modeComponentItem, value, nameof(ModeComponentItem)) && value != null) + { + var modeComponentValue = ViewModels.Instance.MainValue.ModeComponentValue; + switch (ModeComponentVariety) + { + case AutoModeVariety: + modeComponentValue.AutoModeValue = (ModeComponent.AutoMode)value.Value; + break; + case NoteSaltModeVariety: + modeComponentValue.NoteSaltModeValue = (ModeComponent.NoteSaltMode)value.Value; + break; + case FaintNoteModeVariety: + modeComponentValue.FaintNoteModeValue = (ModeComponent.FaintNoteMode)value.Value; + break; + case JudgmentModeVariety: + modeComponentValue.JudgmentModeValue = (ModeComponent.JudgmentMode)value.Value; + break; + case HitPointsModeVariety: + modeComponentValue.HitPointsModeValue = (ModeComponent.HitPointsMode)value.Value; + break; + case NoteMobilityModeVariety: + modeComponentValue.NoteMobilityModeValue = (ModeComponent.NoteMobilityMode)value.Value; + break; + case LongNoteModeVariety: + modeComponentValue.LongNoteModeValue = (ModeComponent.LongNoteMode)value.Value; + break; + case InputFavorModeVariety: + modeComponentValue.InputFavorModeValue = (ModeComponent.InputFavorMode)value.Value; + break; + case NoteModifyModeVariety: + modeComponentValue.NoteModifyModeValue = (ModeComponent.NoteModifyMode)value.Value; + break; + case BPMModeVariety: + modeComponentValue.BPMModeValue = (ModeComponent.BPMMode)value.Value; + break; + case WaveModeVariety: + modeComponentValue.WaveModeValue = (ModeComponent.WaveMode)value.Value; + break; + case SetNoteModeVariety: + modeComponentValue.SetNoteModeValue = (ModeComponent.SetNoteMode)value.Value; + break; + case LowestJudgmentConditionModeVariety: + modeComponentValue.LowestJudgmentConditionModeValue = (ModeComponent.LowestJudgmentConditionMode)value.Value; + break; + } + } + } + } + + public void OnPointLower() => Close(); + + [RelayCommand] + void OnModifyModeComponent(int? e) + { + if (e.HasValue) + { + ModeComponentVariety = e.Value; + } + } + + public void SetModeComponentValues() + { + for (var i = ModeComponentValues.Length - 1; i >= 0; --i) + { + ModeComponentValues[i] = new(); + } + ModeComponentValues[AutoModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.AutoMode.Default, + Data = LanguageSystem.Instance.AutoModeTexts[(int)ModeComponent.AutoMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[AutoModeVariety][(int)ModeComponent.AutoMode.Default]?.DefaultDrawing + }); + ModeComponentValues[AutoModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.AutoMode.Autoable, + Data = LanguageSystem.Instance.AutoModeTexts[(int)ModeComponent.AutoMode.Autoable], + Drawing = BaseUI.Instance.ModeComponentDrawings[AutoModeVariety][(int)ModeComponent.AutoMode.Autoable]?.DefaultDrawing + }); + ModeComponentValues[NoteSaltModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteSaltMode.Default, + Data = LanguageSystem.Instance.NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteSaltModeVariety][(int)ModeComponent.NoteSaltMode.Default]?.DefaultDrawing + }); + ModeComponentValues[NoteSaltModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteSaltMode.Symmetric, + Data = LanguageSystem.Instance.NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.Symmetric], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteSaltModeVariety][(int)ModeComponent.NoteSaltMode.Symmetric]?.DefaultDrawing + }); + ModeComponentValues[NoteSaltModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteSaltMode.InputSalt, + Data = LanguageSystem.Instance.NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.InputSalt], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteSaltModeVariety][(int)ModeComponent.NoteSaltMode.InputSalt]?.DefaultDrawing + }); + ModeComponentValues[NoteSaltModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteSaltMode.MeterSalt, + Data = LanguageSystem.Instance.NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.MeterSalt], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteSaltModeVariety][(int)ModeComponent.NoteSaltMode.MeterSalt]?.DefaultDrawing + }); + ModeComponentValues[NoteSaltModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteSaltMode.HalfInputSalt, + Data = LanguageSystem.Instance.NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.HalfInputSalt], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteSaltModeVariety][(int)ModeComponent.NoteSaltMode.HalfInputSalt]?.DefaultDrawing + }); + ModeComponentValues[NoteSaltModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteSaltMode.Salt, + Data = LanguageSystem.Instance.NoteSaltModeTexts[(int)ModeComponent.NoteSaltMode.Salt], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteSaltModeVariety][(int)ModeComponent.NoteSaltMode.Salt]?.DefaultDrawing + }); + ModeComponentValues[FaintNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.FaintNoteMode.Default, + Data = LanguageSystem.Instance.FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[FaintNoteModeVariety][(int)ModeComponent.FaintNoteMode.Default]?.DefaultDrawing + }); + ModeComponentValues[FaintNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.FaintNoteMode.Faint, + Data = LanguageSystem.Instance.FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.Faint], + Drawing = BaseUI.Instance.ModeComponentDrawings[FaintNoteModeVariety][(int)ModeComponent.FaintNoteMode.Faint]?.DefaultDrawing + }); + ModeComponentValues[FaintNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.FaintNoteMode.Fading, + Data = LanguageSystem.Instance.FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.Fading], + Drawing = BaseUI.Instance.ModeComponentDrawings[FaintNoteModeVariety][(int)ModeComponent.FaintNoteMode.Fading]?.DefaultDrawing + }); + ModeComponentValues[FaintNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.FaintNoteMode.TotalFading, + Data = LanguageSystem.Instance.FaintNoteModeTexts[(int)ModeComponent.FaintNoteMode.TotalFading], + Drawing = BaseUI.Instance.ModeComponentDrawings[FaintNoteModeVariety][(int)ModeComponent.FaintNoteMode.TotalFading]?.DefaultDrawing + }); + ModeComponentValues[JudgmentModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.JudgmentMode.Lowest, + Data = LanguageSystem.Instance.JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Lowest], + Drawing = BaseUI.Instance.ModeComponentDrawings[JudgmentModeVariety][(int)ModeComponent.JudgmentMode.Lowest]?.DefaultDrawing, + PointedPaintID = 1 + }); + ModeComponentValues[JudgmentModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.JudgmentMode.Lower, + Data = LanguageSystem.Instance.JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Lower], + Drawing = BaseUI.Instance.ModeComponentDrawings[JudgmentModeVariety][(int)ModeComponent.JudgmentMode.Lower]?.DefaultDrawing, + PointedPaintID = 1 + }); + ModeComponentValues[JudgmentModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.JudgmentMode.Default, + Data = LanguageSystem.Instance.JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[JudgmentModeVariety][(int)ModeComponent.JudgmentMode.Default]?.DefaultDrawing + }); + ModeComponentValues[JudgmentModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.JudgmentMode.Higher, + Data = LanguageSystem.Instance.JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Higher], + Drawing = BaseUI.Instance.ModeComponentDrawings[JudgmentModeVariety][(int)ModeComponent.JudgmentMode.Higher]?.DefaultDrawing + }); + ModeComponentValues[JudgmentModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.JudgmentMode.Highest, + Data = LanguageSystem.Instance.JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Highest], + Drawing = BaseUI.Instance.ModeComponentDrawings[JudgmentModeVariety][(int)ModeComponent.JudgmentMode.Highest]?.DefaultDrawing + }); + ModeComponentValues[JudgmentModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.JudgmentMode.Favor, + Data = LanguageSystem.Instance.JudgmentModeTexts[(int)ModeComponent.JudgmentMode.Favor], + Drawing = BaseUI.Instance.ModeComponentDrawings[JudgmentModeVariety][(int)ModeComponent.JudgmentMode.Favor]?.DefaultDrawing, + OnConfigure = new RelayCommand(() => + { + ViewModels.Instance.FavorJudgmentValue.Open(); + ModeComponentVariety = JudgmentModeVariety; + ModeComponentItem = ModeComponentValues[JudgmentModeVariety].Find(modeComponentItem => modeComponentItem.Value == (int)ModeComponent.JudgmentMode.Favor); + }), + PointedPaintID = 2 + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Lowest, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Lowest], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Lowest]?.DefaultDrawing, + PointedPaintID = 1 + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Lower, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Lower], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Lower]?.DefaultDrawing, + PointedPaintID = 1 + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Default, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Default]?.DefaultDrawing + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Higher, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Higher], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Higher]?.DefaultDrawing + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Highest, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Highest], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Highest]?.DefaultDrawing + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Failed, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Failed], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Failed]?.DefaultDrawing + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Favor, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Favor], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Favor]?.DefaultDrawing, + OnConfigure = new RelayCommand(() => + { + ViewModels.Instance.FavorHitPointsValue.Open(); + ModeComponentVariety = HitPointsModeVariety; + ModeComponentItem = ModeComponentValues[HitPointsModeVariety].Find(modeComponentItem => modeComponentItem.Value == (int)ModeComponent.HitPointsMode.Favor); + }), + PointedPaintID = 2 + }); + ModeComponentValues[HitPointsModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.HitPointsMode.Test, + Data = LanguageSystem.Instance.HitPointsModeTexts[(int)ModeComponent.HitPointsMode.Test], + Drawing = BaseUI.Instance.ModeComponentDrawings[HitPointsModeVariety][(int)ModeComponent.HitPointsMode.Test]?.DefaultDrawing, + PointedPaintID = 2 + }); + ModeComponentValues[NoteMobilityModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteMobilityMode.Default, + Data = LanguageSystem.Instance.NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteMobilityModeVariety][(int)ModeComponent.NoteMobilityMode.Default]?.DefaultDrawing + }); + ModeComponentValues[NoteMobilityModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteMobilityMode._4D, + Data = LanguageSystem.Instance.NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode._4D], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteMobilityModeVariety][(int)ModeComponent.NoteMobilityMode._4D]?.DefaultDrawing + }); + ModeComponentValues[NoteMobilityModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteMobilityMode._4DHD, + Data = LanguageSystem.Instance.NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode._4DHD], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteMobilityModeVariety][(int)ModeComponent.NoteMobilityMode._4DHD]?.DefaultDrawing + }); + ModeComponentValues[NoteMobilityModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteMobilityMode.Zip, + Data = LanguageSystem.Instance.NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode.Zip], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteMobilityModeVariety][(int)ModeComponent.NoteMobilityMode.Zip]?.DefaultDrawing + }); + ModeComponentValues[NoteMobilityModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteMobilityMode.ZipHD, + Data = LanguageSystem.Instance.NoteMobilityModeTexts[(int)ModeComponent.NoteMobilityMode.ZipHD], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteMobilityModeVariety][(int)ModeComponent.NoteMobilityMode.ZipHD]?.DefaultDrawing + }); + ModeComponentValues[LongNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.LongNoteMode.Default, + Data = LanguageSystem.Instance.LongNoteModeTexts[(int)ModeComponent.LongNoteMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[LongNoteModeVariety][(int)ModeComponent.LongNoteMode.Default]?.DefaultDrawing + }); + ModeComponentValues[LongNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.LongNoteMode.Auto, + Data = LanguageSystem.Instance.LongNoteModeTexts[(int)ModeComponent.LongNoteMode.Auto], + Drawing = BaseUI.Instance.ModeComponentDrawings[LongNoteModeVariety][(int)ModeComponent.LongNoteMode.Auto]?.DefaultDrawing, + PointedPaintID = 1 + }); + ModeComponentValues[LongNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.LongNoteMode.Input, + Data = LanguageSystem.Instance.LongNoteModeTexts[(int)ModeComponent.LongNoteMode.Input], + Drawing = BaseUI.Instance.ModeComponentDrawings[LongNoteModeVariety][(int)ModeComponent.LongNoteMode.Input]?.DefaultDrawing, + PointedPaintID = 2 + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Default, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Default]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode4, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode4], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode4]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode5, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode5], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode5]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode6, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode6], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode6]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode7, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode7], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode7]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode8, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode8], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode8]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode9, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode9], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode9]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode10, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode10], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode10]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode51, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode51], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode51]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode71, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode71], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode71]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode102, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode102], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode102]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode142, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode142], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode142]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode242, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode242], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode242]?.DefaultDrawing + }); + ModeComponentValues[InputFavorModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.InputFavorMode.Mode484, + Data = LanguageSystem.Instance.InputFavorModeTexts[(int)ModeComponent.InputFavorMode.Mode484], + Drawing = BaseUI.Instance.ModeComponentDrawings[InputFavorModeVariety][(int)ModeComponent.InputFavorMode.Mode484]?.DefaultDrawing + }); + ModeComponentValues[NoteModifyModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteModifyMode.Default, + Data = LanguageSystem.Instance.DefaultNoteModifyContents, + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteModifyModeVariety][(int)ModeComponent.NoteModifyMode.Default]?.DefaultDrawing + }); + ModeComponentValues[NoteModifyModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteModifyMode.InputNote, + Data = LanguageSystem.Instance.NoteModifyModeTexts[(int)ModeComponent.NoteModifyMode.InputNote], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteModifyModeVariety][(int)ModeComponent.NoteModifyMode.InputNote]?.DefaultDrawing, + PointedPaintID = 1 + }); + ModeComponentValues[NoteModifyModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.NoteModifyMode.LongNote, + Data = LanguageSystem.Instance.NoteModifyModeTexts[(int)ModeComponent.NoteModifyMode.LongNote], + Drawing = BaseUI.Instance.ModeComponentDrawings[NoteModifyModeVariety][(int)ModeComponent.NoteModifyMode.LongNote]?.DefaultDrawing, + OnConfigure = new RelayCommand(() => + { + ViewModels.Instance.LongNoteModifyValue.Open(); + ModeComponentVariety = NoteModifyModeVariety; + ModeComponentItem = ModeComponentValues[NoteModifyModeVariety].Find(modeComponentItem => modeComponentItem.Value == (int)ModeComponent.NoteModifyMode.LongNote); + }), + PointedPaintID = 2 + }); + ModeComponentValues[BPMModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.BPMMode.Default, + Data = LanguageSystem.Instance.BPMModeTexts[(int)ModeComponent.BPMMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[BPMModeVariety][(int)ModeComponent.BPMMode.Default]?.DefaultDrawing + }); + ModeComponentValues[BPMModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.BPMMode.Not, + Data = LanguageSystem.Instance.BPMModeTexts[(int)ModeComponent.BPMMode.Not], + Drawing = BaseUI.Instance.ModeComponentDrawings[BPMModeVariety][(int)ModeComponent.BPMMode.Not]?.DefaultDrawing, + PointedPaintID = 2 + }); + ModeComponentValues[WaveModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.WaveMode.Default, + Data = LanguageSystem.Instance.WaveModeTexts[(int)ModeComponent.WaveMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[WaveModeVariety][(int)ModeComponent.WaveMode.Default]?.DefaultDrawing + }); + ModeComponentValues[WaveModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.WaveMode.Counter, + Data = LanguageSystem.Instance.WaveModeTexts[(int)ModeComponent.WaveMode.Counter], + Drawing = BaseUI.Instance.ModeComponentDrawings[WaveModeVariety][(int)ModeComponent.WaveMode.Counter]?.DefaultDrawing, + PointedPaintID = 2 + }); + ModeComponentValues[SetNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.SetNoteMode.Default, + Data = LanguageSystem.Instance.SetNoteModeTexts[(int)ModeComponent.SetNoteMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[SetNoteModeVariety][(int)ModeComponent.SetNoteMode.Default]?.DefaultDrawing + }); + ModeComponentValues[SetNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.SetNoteMode.Put, + Data = LanguageSystem.Instance.SetNoteModeTexts[(int)ModeComponent.SetNoteMode.Put], + Drawing = BaseUI.Instance.ModeComponentDrawings[SetNoteModeVariety][(int)ModeComponent.SetNoteMode.Put]?.DefaultDrawing, + OnConfigure = new RelayCommand(() => + { + ViewModels.Instance.PutNoteSetValue.Open(); + ModeComponentVariety = SetNoteModeVariety; + ModeComponentItem = ModeComponentValues[SetNoteModeVariety].Find(modeComponentItem => modeComponentItem.Value == (int)ModeComponent.SetNoteMode.Put); + }), + PointedPaintID = 2 + }); + ModeComponentValues[SetNoteModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.SetNoteMode.VoidPut, + Data = LanguageSystem.Instance.SetNoteModeTexts[(int)ModeComponent.SetNoteMode.VoidPut], + Drawing = BaseUI.Instance.ModeComponentDrawings[SetNoteModeVariety][(int)ModeComponent.SetNoteMode.VoidPut]?.DefaultDrawing, + OnConfigure = new RelayCommand(() => + { + ViewModels.Instance.PutNoteSetValue.Open(); + ModeComponentVariety = SetNoteModeVariety; + ModeComponentItem = ModeComponentValues[SetNoteModeVariety].Find(modeComponentItem => modeComponentItem.Value == (int)ModeComponent.SetNoteMode.VoidPut); + }), + PointedPaintID = 2 + }); + ModeComponentValues[LowestJudgmentConditionModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.LowestJudgmentConditionMode.Default, + Data = LanguageSystem.Instance.LowestJudgmentConditionModeTexts[(int)ModeComponent.LowestJudgmentConditionMode.Default], + Drawing = BaseUI.Instance.ModeComponentDrawings[LowestJudgmentConditionModeVariety][(int)ModeComponent.LowestJudgmentConditionMode.Default]?.DefaultDrawing + }); + ModeComponentValues[LowestJudgmentConditionModeVariety].Add(new ModifyModeComponentItem + { + Value = (int)ModeComponent.LowestJudgmentConditionMode.Wrong, + Data = LanguageSystem.Instance.LowestJudgmentConditionModeTexts[(int)ModeComponent.LowestJudgmentConditionMode.Wrong], + Drawing = BaseUI.Instance.ModeComponentDrawings[LowestJudgmentConditionModeVariety][(int)ModeComponent.LowestJudgmentConditionMode.Wrong]?.DefaultDrawing + }); + } + + public override void OnCollasped() + { + base.OnCollasped(); + var mainViewModel = ViewModels.Instance.MainValue; + if (ModeComponentVariety == HitPointsModeVariety && mainViewModel.ModeComponentValue.IsGASWarning) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.GASWarning); + } + mainViewModel.OnJudgmentMeterMillisModified(); + mainViewModel.HandleAutoComputer(); + ViewModels.Instance.SiteContainerValue.CallSetModeComponent(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/NetSiteCommentViewModel.cs b/Qwilight/Qwilight/ViewModel/NetSiteCommentViewModel.cs new file mode 100644 index 0000000..ea28ab6 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/NetSiteCommentViewModel.cs @@ -0,0 +1,43 @@ + +using Qwilight.UIComponent; +using System.Collections.ObjectModel; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class NetSiteCommentViewModel : BaseViewModel + { + NetSIteCommentItems? _netSiteCommentItems; + + public ObservableCollection NetSiteCommentItemCollection { get; } = new(); + + public ObservableCollection NetSiteCommentItemsCollection { get; } = new(); + + public override double TargetLength => 0.6; + + public override double TargetHeight => 0.5; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public NetSIteCommentItems? NetSiteCommentItemsValue + { + get => _netSiteCommentItems; + + set + { + if (SetProperty(ref _netSiteCommentItems, value, nameof(NetSiteCommentItemsValue))) + { + var netSiteCommentItems = value?.NetSiteCommentItems; + if (netSiteCommentItems != null) + { + NetSiteCommentItemCollection.Clear(); + foreach (var netSiteCommentItem in netSiteCommentItems) + { + NetSiteCommentItemCollection.Add(netSiteCommentItem); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/NoteFileViewModel.cs b/Qwilight/Qwilight/ViewModel/NoteFileViewModel.cs new file mode 100644 index 0000000..99701f7 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/NoteFileViewModel.cs @@ -0,0 +1,402 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using IniParser; +using IniParser.Model; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.IO; +using System.Text; +using System.Windows; +using System.Windows.Media; +using System.Xml.Serialization; +using Windows.System; +using Xml2CSharp; + +namespace Qwilight.ViewModel +{ + public sealed partial class NoteFileViewModel : BaseViewModel + { + BaseNoteFile[] _rawNoteFileCollection; + BaseNoteFile[] _detailedNoteFileCollection; + BaseNoteFile _noteFile; + EntryItem _entryItemValue; + + public override double TargetLength => 0.8; + + public override double TargetHeight => 0.6; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public EntryItem EntryItemValue + { + get => _entryItemValue; + + set + { + if (value != null && SetProperty(ref _entryItemValue, value, nameof(EntryItemValue))) + { + OnPropertyChanged(nameof(Drawing)); + OnPropertyChanged(nameof(Title)); + _rawNoteFileCollection = value.NoteFiles; + NoteFileCollection = value.WellNoteFiles.ToArray(); + NoteFile = value.NoteFile; + } + } + } + + public bool IsNoteFileNotLogical => NoteFile?.IsLogical == false; + + public ImageSource Drawing => EntryItemValue?.DrawingInNoteFileWindow; + + public string Title => EntryItemValue?.Title; + + public BaseNoteFile NoteFile + { + get => _noteFile; + + set + { + if (value != null && SetProperty(ref _noteFile, value, nameof(NoteFile))) + { + OnPropertyChanged(nameof(IsNoteFileNotLogical)); + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.EntryItemValue.ModifyNotePosition(Array.IndexOf(_rawNoteFileCollection, value)); + mainViewModel.NotifyNoteFile(); + } + } + } + + public BaseNoteFile[] NoteFileCollection + { + get => _detailedNoteFileCollection; + + set => SetProperty(ref _detailedNoteFileCollection, value, nameof(NoteFileCollection)); + } + + public void OnPointLower() => ViewModels.Instance.MainValue.HandleLevyNoteFile(); + + [RelayCommand] + void OnEditNote() + { + var noteFile = EntryItemValue?.NoteFile; + if (noteFile?.IsLogical == false) + { + try + { + var flintFilePath = Path.Combine(QwilightComponent.SoftwareEntryPath, "Flint.exe"); + var noteFilePath = noteFile.NoteFilePath; + if (QwilightComponent.BMSNoteFileFormats.Any(format => noteFilePath.IsTailCaselsss(format))) + { + if (Utility.HasInput(VirtualKey.LeftMenu) || !File.Exists(Configure.Instance.BMSEditorFilePath)) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + new[] { ".exe" }, + new Action(fileName => + { + Configure.Instance.BMSEditorFilePath = fileName; + Edit(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.ModifyEditorContents); + }) + } + }); + } + else + { + Edit(); + } + + void Edit() + { + var bmseViewerFilePath = Path.Combine(Path.GetDirectoryName(Configure.Instance.BMSEditorFilePath), "bmse_viewer.ini"); + var bmseFilePath = Path.Combine(Path.GetDirectoryName(Configure.Instance.BMSEditorFilePath), "bmse.ini"); + var bmscFilePath = Path.Combine(Path.GetDirectoryName(Configure.Instance.BMSEditorFilePath), "iBMSC.Settings.xml"); + if (File.Exists(bmseViewerFilePath) && File.Exists(bmseFilePath)) + { + var bmseViewerText = File.ReadAllText(bmseViewerFilePath, Encoding.ASCII).Trim(Environment.NewLine.ToCharArray()) + Environment.NewLine; + var bmseViewerData = bmseViewerText.Split(Environment.NewLine).ToList(); + if (!bmseViewerData.Any(line => line == flintFilePath)) + { + var data = $""" + +Qwilight +{flintFilePath} +-P -N0 +-P -N +-S + +"""; + bmseViewerData.AddRange(data.Split(Environment.NewLine)); + Utility.SaveText(bmseViewerFilePath, bmseViewerText + data, Encoding.ASCII); + } + + var doEdit = false; + var bmseCompiler = new FileIniDataParser(); + IniData bmse; + using (var sr = File.OpenText(bmseFilePath)) + { + bmse = bmseCompiler.ReadData(sr); + var targetViewerID = (bmseViewerData.IndexOf(flintFilePath) / 6).ToString(); + if (bmse["View"]["ViewerNum"] != targetViewerID) + { + doEdit = true; + bmse["View"]["ViewerNum"] = targetViewerID; + } + } + if (doEdit) + { + using var fw = File.Open(bmseFilePath, FileMode.Create); + using var sw = new StreamWriter(fw); + bmseCompiler.WriteData(sw, bmse); + } + Utility.OpenAs(Configure.Instance.BMSEditorFilePath, $"\"{noteFilePath}\""); + } + else if (File.Exists(bmscFilePath)) + { + var doEdit = false; + var bmsdCompiler = new XmlSerializer(typeof(IBMSC)); + IBMSC bmsc; + using (var fs = File.OpenRead(bmscFilePath)) + { + bmsc = bmsdCompiler.Deserialize(fs) as IBMSC; + var targetViewerID = bmsc.Players.Player.FindIndex(line => line.Path == flintFilePath); + if (targetViewerID == -1) + { + doEdit = true; + targetViewerID = bmsc.Players.Player.Count; + bmsc.Players.Player.Add(new Player + { + Index = targetViewerID.ToString(), + Path = flintFilePath, + FromBeginning = "-P -N0 \"\"", + FromHere = "-P -N \"\"", + Stop = "-S" + }); + bmsc.Players.Count = bmsc.Players.Player.Count.ToString(); + } + if (Utility.ToInt32(bmsc.Players.CurrentPlayer) != targetViewerID) + { + doEdit = true; + bmsc.Players.CurrentPlayer = targetViewerID.ToString(); + } + } + if (doEdit) + { + using var fw = File.Open(bmscFilePath, FileMode.Create); + using var sw = new StreamWriter(fw, Encoding.Unicode); + bmsdCompiler.Serialize(sw, bmsc); + } + Utility.OpenAs(Configure.Instance.BMSEditorFilePath, $"\"{noteFilePath}\""); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.EditorConfigureFault); + } + } + } + else if (QwilightComponent.BMSONNoteFileFormats.Any(format => noteFilePath.IsTailCaselsss(format))) + { + if (Utility.HasInput(VirtualKey.LeftMenu) || !File.Exists(Configure.Instance.BMSONEditorFilePath)) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + new[] { ".exe" }, + new Action(fileName => + { + Configure.Instance.BMSONEditorFilePath = fileName; + Edit(); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.ModifyEditorContents); + }) + } + }); + } + else + { + Edit(); + } + + void Edit() + { + var bms1FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "BmsONE", "Settings.ini"); + if (File.Exists(bms1FilePath)) + { + var doEdit = false; + var bms1Compiler = new FileIniDataParser(); + IniData bms1; + using (var sr = File.OpenText(bms1FilePath)) + { + bms1 = bms1Compiler.ReadData(sr); + var targetViewer = bms1["ExternalViewer"]; + var targetViewerID = Utility.ToInt32(targetViewer["ViewerCount"]); + flintFilePath = flintFilePath.Replace(@"\", @"\\"); + if (!Enumerable.Range(0, targetViewerID).Any(i => targetViewer[$@"Viewer{i}\Path"] == flintFilePath)) + { + doEdit = true; + targetViewer[$@"Viewer{targetViewerID}\Name"] = "Qwilight"; + targetViewer[$@"Viewer{targetViewerID}\Path"] = flintFilePath; + targetViewer[$@"Viewer{targetViewerID}\Icon"] = ""; + targetViewer[$@"Viewer{targetViewerID}\ArgumentPlayLevy"] = "-P -N0 $(filename)"; + targetViewer[$@"Viewer{targetViewerID}\ArgumentPlayHere"] = "-P -N$(measure) $(filename)"; + targetViewer[$@"Viewer{targetViewerID}\ArgumentStop"] = "-S"; + targetViewer[$@"Viewer{targetViewerID}\WorkingDirectory"] = "$(exedir)"; + targetViewer["CurrentViewer"] = targetViewerID.ToString(); + targetViewer["ViewerCount"] = (targetViewerID + 1).ToString(); + } + } + if (doEdit) + { + using var fw = File.Open(bms1FilePath, FileMode.Create); + using var sw = new StreamWriter(fw, Encoding.UTF8); + bms1Compiler.WriteData(sw, bms1); + } + Utility.OpenAs(Configure.Instance.BMSONEditorFilePath, $"\"{noteFilePath}\""); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.EditorConfigureFault); + } + } + } + } + catch (Exception e) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.EditorSoftwareFault, e.Message)); + } + } + } + + [RelayCommand] + void OnModifyFavoriteEntry(int mode) + { + var favoriteEntryViewModel = ViewModels.Instance.FavoriteEntryValue; + favoriteEntryViewModel.NoteFile = NoteFile; + favoriteEntryViewModel.EntryItem = EntryItemValue; + favoriteEntryViewModel.Mode = mode; + favoriteEntryViewModel.Open(); + } + + [RelayCommand] + void OnWipeHandled(int mode) + { + switch (mode) + { + case 0: + DB.Instance.WipeHandled(NoteFile); + NoteFile.HandledValue = BaseNoteFile.Handled.Not; + break; + case 1: + foreach (var noteFile in EntryItemValue.NoteFiles) + { + DB.Instance.WipeHandled(noteFile); + noteFile.HandledValue = BaseNoteFile.Handled.Not; + } + break; + } + } + + [RelayCommand] + void OnNewEventNote() + { + var eventNoteViewModel = ViewModels.Instance.EventNoteValue; + eventNoteViewModel.NoteFileCollection.Add(EntryItemValue.NoteFile); + eventNoteViewModel.Open(); + } + + [RelayCommand] + void OnModifyEventNoteName() + { + var entryItemValue = EntryItemValue; + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewInputWindow, + Contents = new object[] + { + LanguageSystem.Instance.ModifyEventNoteNameContents, + entryItemValue.EventNoteName, + new Action(eventNoteName => + { + DB.Instance.ModifyEventNoteName(entryItemValue.EventNoteID, eventNoteName); + entryItemValue.EventNoteName = eventNoteName; + }) + } + }); + } + + [RelayCommand] + void OnSaveAsBundle() + { + if (string.IsNullOrEmpty(EntryItemValue.EventNoteID)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveAsBundle, new + { + bundleVariety = BundleItem.BundleVariety.Note, + bundleName = EntryItemValue.NoteFile.Title, + bundleEntryPath = EntryItemValue.NoteFile.NoteFilePath, + etc = string.Join('/', EntryItemValue.CompatibleNoteFiles.Select(noteFile => noteFile.GetNoteID512())) + }); + } + else + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveAsBundle, new + { + bundleVariety = BundleItem.BundleVariety.EventNote, + bundleName = EntryItemValue.EventNoteName, + bundleEntryPath = EntryItemValue.EventNoteID, + etc = EntryItemValue.EventNoteVariety switch + { + DB.EventNoteVariety.MD5 => "MD5", + DB.EventNoteVariety.Qwilight => "Qwilight", + _ => default + } + }); + } + } + + [RelayCommand] + void OnNoteFileFormatID(int? e) + { + if (e.HasValue) + { + Configure.Instance.NoteFormatID = e.Value; + var noteFile = EntryItemValue?.NoteFile; + if (noteFile != null) + { + DB.Instance.SetNoteFormat(noteFile, e.Value); + FastDB.Instance.WipeNoteFile(noteFile); + } + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.VerifyNoteFile(mainViewModel.ModeComponentValue.Salt); + } + } + + [RelayCommand] + void OnEntryItemFormatID(int? e) + { + if (e.HasValue) + { + Configure.Instance.NoteFormatID = e.Value; + var noteFiles = EntryItemValue?.NoteFiles; + if (noteFiles != null) + { + foreach (var noteFile in noteFiles) + { + if (!noteFile.IsLogical) + { + DB.Instance.SetNoteFormat(noteFile, e.Value); + FastDB.Instance.WipeNoteFile(noteFile); + } + } + } + var mainViewModel = ViewModels.Instance.MainValue; + mainViewModel.VerifyNoteFile(mainViewModel.ModeComponentValue.Salt); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/NotifyViewModel.cs b/Qwilight/Qwilight/ViewModel/NotifyViewModel.cs new file mode 100644 index 0000000..459b60e --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/NotifyViewModel.cs @@ -0,0 +1,58 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class NotifyViewModel : BaseViewModel + { + NotifyItem _toNotifyItemValue; + + public override double TargetLength => 0.8; + + public override double TargetHeight => 0.6; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public ObservableCollection NotifyItemCollection { get; } = new(); + + public NotifyItem NotifyItemValue + { + get => _toNotifyItemValue; + + set => SetProperty(ref _toNotifyItemValue, value, nameof(NotifyItemValue)); + } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Delete) + { + var toNotifyItemValue = NotifyItemValue; + if (toNotifyItemValue?.OnStop?.Invoke(false) != false) + { + NotifyItemCollection.Remove(toNotifyItemValue); + } + } + } + + public void OnPointLower(MouseButtonEventArgs e) + { + NotifyItemValue?.OnHandle?.Invoke(); + } + + [RelayCommand] + void OnWipeTotalNotify() + { + for (var i = NotifyItemCollection.Count - 1; i >= 0; --i) + { + var toNotifyItemValue = NotifyItemCollection[i]; + if (toNotifyItemValue.OnStop?.Invoke(true) != false) + { + NotifyItemCollection.Remove(toNotifyItemValue); + } + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/NotifyXamlViewModel.cs b/Qwilight/Qwilight/ViewModel/NotifyXamlViewModel.cs new file mode 100644 index 0000000..72c8ddb --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/NotifyXamlViewModel.cs @@ -0,0 +1,62 @@ +using Qwilight.UIComponent; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Input; +using System.Windows.Threading; + +namespace Qwilight.ViewModel +{ + public sealed class NotifyXamlViewModel : Model + { + public ObservableCollection NotifyXamlItemUICollection { get; } = new(); + + public List NotifyXamlItemCollection { get; } = new(); + + public void OnPointLower(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + var toNotifyXamlItem = (sender as FrameworkElement).DataContext as NotifyXamlItem; + if (toNotifyXamlItem != null) + { + toNotifyXamlItem.OnHandle?.Invoke(); + WipeNotify(toNotifyXamlItem); + } + e.Handled = true; + } + } + + public void PutNotify(NotifyXamlItem toNotifyXamlItem) + { + var targetNotifyXamlItem = NotifyXamlItemUICollection.SingleOrDefault(targetNotifyXamlItem => targetNotifyXamlItem.ID == toNotifyXamlItem.ID); + if (targetNotifyXamlItem != null) + { + targetNotifyXamlItem.Set(toNotifyXamlItem); + targetNotifyXamlItem.Handler.Stop(); + } + else + { + NotifyXamlItemUICollection.Add(toNotifyXamlItem); + lock (NotifyXamlItemCollection) + { + NotifyXamlItemCollection.Add(toNotifyXamlItem); + } + targetNotifyXamlItem = toNotifyXamlItem; + } + targetNotifyXamlItem.Handler = new DispatcherTimer(TimeSpan.FromSeconds(5), DispatcherPriority.Background, (sender, e) => + { + (sender as DispatcherTimer).Stop(); + WipeNotify(targetNotifyXamlItem); + }, HandlingUISystem.Instance.UIHandler); + } + + public void WipeNotify(NotifyXamlItem toNotifyXamlItem) + { + HandlingUISystem.Instance.HandleParallel(() => NotifyXamlItemUICollection.Remove(toNotifyXamlItem)); + lock (NotifyXamlItemCollection) + { + NotifyXamlItemCollection.Remove(toNotifyXamlItem); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/PutNoteSetViewModel.cs b/Qwilight/Qwilight/ViewModel/PutNoteSetViewModel.cs new file mode 100644 index 0000000..6b03280 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/PutNoteSetViewModel.cs @@ -0,0 +1,15 @@ +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class PutNoteSetViewModel : BaseViewModel + { + public override double TargetLength => 0.2; + + public override double TargetHeight => 0.25; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Bottom; + + public void OnMeterModified() => ViewModels.Instance.MainValue.ModeComponentValue.SetAutoPutNoteSetMillis(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/SignInViewModel.cs b/Qwilight/Qwilight/ViewModel/SignInViewModel.cs new file mode 100644 index 0000000..5b8f3a9 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/SignInViewModel.cs @@ -0,0 +1,59 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using System.Windows; +using System.Windows.Input; + +namespace Qwilight.ViewModel +{ + public sealed partial class SignInViewModel : BaseViewModel + { + public override double TargetLength => 0.2; + + public override double TargetHeight => 0.3; + + public override HorizontalAlignment TargetLengthSystem => HorizontalAlignment.Center; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Center; + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + OnSignIn(); + } + } + + [RelayCommand] + void OnSignIn() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetSignInCipher, + Contents = new Action(inputCipher => + { + Configure.Instance.SetCipher(inputCipher); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SignIn, new + { + avatarID = Configure.Instance.AvatarID, + avatarCipher = inputCipher + }); + }) + }); + + [RelayCommand] + void OnSignUp() + { + Close(); + ViewModels.Instance.SignUpValue.Open(); + } + + public override void OnOpened() + { + base.OnOpened(); + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetSignInCipher, + Contents = Configure.Instance.GetCipher() + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/SignUpViewModel.cs b/Qwilight/Qwilight/ViewModel/SignUpViewModel.cs new file mode 100644 index 0000000..f554210 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/SignUpViewModel.cs @@ -0,0 +1,74 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.Utilities; +using System.Text.RegularExpressions; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed partial class SignUpViewModel : BaseViewModel + { + public override double TargetLength => 0.2; + + public override double TargetHeight => 0.45; + + public override HorizontalAlignment TargetLengthSystem => HorizontalAlignment.Center; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Center; + + public string AvatarID { get; set; } + + public string AvatarName { get; set; } + + public string Fax { get; set; } + + public override void OnOpened() + { + base.OnOpened(); + AvatarID = string.Empty; + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.InitSignUpCipher + }); + AvatarName = string.Empty; + Fax = string.Empty; + } + + [RelayCommand] + void OnSignUp() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.GetSignUpCipher, + Contents = new Action(async (inputCipher, inputCipherTest) => + { + if (!string.IsNullOrEmpty(AvatarID) && !string.IsNullOrEmpty(inputCipher) && inputCipher == inputCipherTest && !string.IsNullOrEmpty(AvatarName) && (string.IsNullOrEmpty(Fax) || Regex.IsMatch(Fax, "^.+@.+$"))) + { + if (await TwilightSystem.Instance.PostWwwParallel($"{QwilightComponent.TaehuiNetAPI}/avatar", Utility.SetJSON(new + { + avatarID = AvatarID, + avatarCipher = inputCipher, + avatarName = AvatarName, + fax = Fax + }), "application/json")) + { + Close(); + Configure.Instance.AvatarID = AvatarID; + Configure.Instance.SetCipher(inputCipher); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SignIn, new + { + avatarID = AvatarID, + avatarCipher = inputCipher + }); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.AlreadyAvatarID); + } + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.FailedValidation); + } + }) + }); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/SiteContainerViewModel.cs b/Qwilight/Qwilight/ViewModel/SiteContainerViewModel.cs new file mode 100644 index 0000000..884e0d5 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/SiteContainerViewModel.cs @@ -0,0 +1,64 @@ +using Qwilight.View; +using System.Collections.ObjectModel; + +namespace Qwilight.ViewModel +{ + public sealed class SiteContainerViewModel : BaseViewModel + { + Site _siteView; + + public ObservableCollection SiteCollection { get; } = new(); + + public bool HasPointedInput => IsOpened && SiteValue?.HasPointedInput == true; + + public Site SiteView + { + get => _siteView; + + set => SetProperty(ref _siteView, value, nameof(SiteView)); + } + + public SiteViewModel SiteValue { get; set; } + + public override bool IsModal => false; + + public void OnSiteView() + { + SiteValue = SiteView?.DataContext as SiteViewModel; + ViewModels.Instance.HandleSiteViewModels(siteViewModel => siteViewModel.IsOpened = SiteValue == siteViewModel); + if (IsOpened) + { + SiteValue?.OnOpened(); + } + } + + public void AudioInput(byte[] data, int length) + { + var siteViewModel = SiteValue; + if (siteViewModel?.IsAudioInput == true) + { + siteViewModel.AudioInput(data, length); + } + } + + public void CallSetNoteFile() => ViewModels.Instance.HandleSiteViewModels(siteViewModel => siteViewModel.CallSetNoteFile()); + + public void CallSetModeComponent() => ViewModels.Instance.HandleSiteViewModels(siteViewModel => siteViewModel.CallUpdateModeComponent()); + + public void SetComputingValues() => ViewModels.Instance.HandleSiteViewModels(siteViewModel => siteViewModel.SetComputingValues()); + + public override void OnOpened() + { + base.OnOpened(); + OnPropertyChanged(nameof(Position1)); + if (ViewModels.Instance.HasSiteViewModel()) + { + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.HandleSiteViewModels(siteViewModel => siteViewModel.OnOpened())); + } + else + { + ViewModels.Instance.SiteWindowValue.Open(); + } + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/SiteViewModel.cs b/Qwilight/Qwilight/ViewModel/SiteViewModel.cs new file mode 100644 index 0000000..8a34c8f --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/SiteViewModel.cs @@ -0,0 +1,1185 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Google.Protobuf; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.View; +using Qwilight.View.SiteYell; +using System.Buffers; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.IO; +using System.Runtime.InteropServices.WindowsRuntime; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using Windows.ApplicationModel.DataTransfer; +using Windows.Storage.Streams; +using Windows.System; + +namespace Qwilight.ViewModel +{ + public sealed partial class SiteViewModel : Model + { + public sealed class NetSiteComputing : Computing + { + public override BaseNoteFile.NoteVariety NoteVarietyValue => default; + + public string NoteID { get; set; } + + public string WantLevelID { get; set; } = string.Empty; + + public BaseNoteFile.Handled HandledValue { get; set; } + + public ImageSource HandledWallDrawing => BaseUI.Instance.HandledWallDrawings[(int)HandledValue]; + + public bool NotHaveIt { get; set; } + + public bool IsDefault { get; set; } + + public override void OnCompiled() + { + } + + public override void OnFault(Exception e) + { + } + + public override bool Equals(object obj) => obj is NetSiteComputing netSiteComputing && NoteID == netSiteComputing.NoteID; + + public override int GetHashCode() => NoteID.GetHashCode(); + } + + public enum SiteSituation + { + Default, Compiling, Net + }; + + readonly ConcurrentDictionary _siteYellsMap = new(); + readonly LinkedList> _pendingNewSiteYellQueue = new(); + readonly List _pendingModifySiteYellQueue = new(); + readonly List _pendingWipeSiteYellQueue = new(); + NetSiteComputing _valueComputing; + NetSiteComputing _defaultNetSiteComputing; + string[] _netSiteNoteID; + string _bundleEntryPath; + double _lastPosition1BeforeCall; + bool _isSiteYellsViewLowest = true; + string _siteName; + string _siteNotify; + string _input = string.Empty; + string _siteHand; + bool _isFavorNoteFile = true; + bool _isAutoNetLevying; + bool _isNew; + bool _isNetSite; + bool _isFavorModeComponent = true; + bool _isFavorAudioMultiplier; + AvatarGroup _avatarGroupValue; + bool _isAutoSiteHand; + bool _allowTotalLevying = true; + bool _isGetNotify; + bool _isAudioInput; + SiteSituation _siteSituationValue; + int _validHunterMode; + ValidNetMode _validNetMode; + string _bundleName; + AvatarItem _avatarItemValue; + bool _hasPendingNew; + + public PostableUIItem[] PostableUIItemCollection { get; } = Enumerable.Range(0, PostableItem.Values.Length).Select(i => new PostableUIItem + { + PostableItemValue = PostableItem.Values[i] + }).ToArray(); + + public bool IsTotalWantPostableUIItem => PostableUIItemCollection.All(postableUIItem => postableUIItem.IsWanted); + + public bool IsOpened { get; set; } + + [RelayCommand] + void OnTwilightConfigure() + { + if (TwilightSystem.Instance.IsSignedIn) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallConfigure, null); + } + else + { + ViewModels.Instance.TwilightConfigure.Open(); + } + } + + [RelayCommand] + void OnSite() => ViewModels.Instance.SiteWindowValue.Toggle(); + + [RelayCommand] + void OnUbuntu() => ViewModels.Instance.UbuntuValue.Toggle(); + + [RelayCommand] + void OnQuit() + { + TwilightSystem.Instance.StopBundle(SiteID); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.QuitSite, SiteID); + } + + public void OnSetFavorNoteFile() + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetFavorNoteFile, SiteID); + } + + public void OnSetFavorModeComponent() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetFavorModeComponent, SiteID); + + public void OnSetFavorAudioMultiplier() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetFavorAudioMultiplier, SiteID); + + public void OnSetAutoSiteHand() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetAutoSiteHand, SiteID); + + public void OnInputPostableItem() + { + OnPropertyChanged(nameof(IsTotalWantPostableUIItem)); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetAllowedPostableItems, new + { + siteID = SiteID, + allowedPostableItems = PostableUIItemCollection.Where(postableUIItem => postableUIItem.IsWanted).Select(postableUIitem => (int)postableUIitem.PostableItemValue.VarietyValue).ToArray() + }); + } + + [RelayCommand] + void OnTotalWantPostableItem(bool? e) + { + if (e.HasValue) + { + foreach (var postableUIItem in PostableUIItemCollection) + { + postableUIItem.IsWanted = e.Value; + } + OnInputPostableItem(); + } + } + + public void OnInputLower(KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + if (!string.IsNullOrWhiteSpace(Input)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SiteYell, new + { + siteID = SiteID, + siteYell = Input + }); + } + Input = string.Empty; + } + } + + public async void OnEssentialInputLower(KeyEventArgs e) + { + if (e.Key == Key.V && Utility.HasInput(VirtualKey.LeftControl) && string.IsNullOrEmpty(Input)) + { + try + { + using var ras = await (await Clipboard.GetContent().GetBitmapAsync()).OpenReadAsync(); + var data = ArrayPool.Shared.Rent((int)ras.Size); + try + { + await ras.ReadAsync(data.AsBuffer(), (uint)ras.Size, InputStreamOptions.None); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.PostFile, ras.ContentType.Split("/")[1], UnsafeByteOperations.UnsafeWrap(data)); + } + finally + { + ArrayPool.Shared.Return(data); + } + e.Handled = true; + } + catch + { + } + } + } + + public void OnPointedModified(bool e) => HasPointedInput = e; + + public void OnSiteYellsViewerMove(ScrollChangedEventArgs e) + { + if (_lastPosition1BeforeCall > 0.0) + { + View.SiteYellsViewer.ScrollToVerticalOffset(View.SiteYellsViewer.ExtentHeight - View.SiteYellsViewer.ActualHeight - _lastPosition1BeforeCall); + _lastPosition1BeforeCall = 0.0; + } + else + { + var siteYellID = (SiteYellCollection.FirstOrDefault() as ISiteYell)?.SiteYellID; + if (siteYellID.HasValue && siteYellID.Value > 0 && View.SiteYellsViewer.VerticalOffset == 0.0) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.GetSiteYells, new + { + siteID = SiteID, + siteYellID = siteYellID.Value + }); + } + } + _isSiteYellsViewLowest = View.SiteYellsViewer.VerticalOffset + View.SiteYellsViewer.ActualHeight >= View.SiteYellsViewer.ExtentHeight; + } + + [RelayCommand] + void OnViewBundle() + { + AvatarItemValue?.AvatarWwwValue?.ViewBundleCommand?.Execute(null); + } + + [RelayCommand] + void OnNewUbuntu() + { + AvatarItemValue?.AvatarWwwValue?.NewUbuntuCommand?.Execute(null); + } + + [RelayCommand] + void OnViewAvatar() + { + AvatarItemValue?.AvatarWwwValue?.ViewAvatarCommand?.Execute(null); + } + + [RelayCommand] + void OnCallIO() + { + var siteAvatarID = AvatarItemValue?.AvatarID; + if (!string.IsNullOrEmpty(siteAvatarID)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallIo, new + { + avatarID = siteAvatarID, + ioMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }); + } + } + + [RelayCommand] + void OnNewSilentSite() + { + var siteAvatarID = AvatarItemValue?.AvatarID; + if (!string.IsNullOrEmpty(siteAvatarID)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.NewSilentSite, siteAvatarID); + } + } + + [RelayCommand] + void OnExileAvatar() + { + var siteAvatarID = AvatarItemValue?.AvatarID; + if (!string.IsNullOrEmpty(siteAvatarID)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.ExileAvatar, new + { + siteID = SiteID, + avatarID = siteAvatarID + }); + } + } + + [RelayCommand] + void OnSetSiteHand() + { + var siteAvatarID = AvatarItemValue?.AvatarID; + if (!string.IsNullOrEmpty(siteAvatarID)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSiteHand, new + { + siteID = SiteID, + avatarID = siteAvatarID + }); + } + } + + [RelayCommand] + void OnLevying() => HandleLevyingInput(false); + + [RelayCommand] + void OnSaveAsNetBundle() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveAsBundle, new + { + bundleVariety = BundleItem.BundleVariety.Net, + bundleEntryPath = _bundleEntryPath, + etc = SiteID + }); + + [RelayCommand] + void OnSaveNetBundle() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SaveBundle, new + { + etc = SiteID, + bundleName = Path.GetFileNameWithoutExtension(BundleName) + }); + + [RelayCommand] + void OnStopSiteNet() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.QuitNet, SiteID); + + [RelayCommand] + void OnSetValidHunterMode() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetValidHunterMode, SiteID); + + [RelayCommand] + void OnNetSIteComments() => TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallNetSiteComments, SiteID); + + [RelayCommand] + void OnSetSiteName() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewInputWindow, + Contents = new object[] + { + LanguageSystem.Instance.SetSiteNameContents, + SiteName, + new Action(siteName => TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetSiteName, new + { + siteID = SiteID, + siteName = siteName + })) + } + }); + + [RelayCommand] + void OnPostFile() => WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewFileWindow, + Contents = new object[] + { + Array.Empty(), + new Action(async fileName =>TwilightSystem.Instance.SendParallel(Event.Types.EventID.PostFile, Path.GetFileName(fileName), UnsafeByteOperations.UnsafeWrap(await File.ReadAllBytesAsync(fileName)))) + } + }); + + public ModeComponent ModeComponentValue { get; } = new(); + + public ObservableCollection SiteYellCollection { get; } = new(); + + public ObservableCollection AvatarItemCollection { get; } = new(); + + public ObservableCollection ComputingValues { get; } = new(); + + public AvatarGroup[] AvatarGroupCollection { get; } = Enumerable.Range(0, 5).Select(data => new AvatarGroup + { + Data = data + }).ToArray(); + + public ValidNetMode[] ValidNetModeCollection { get; } = Enumerable.Range(0, 5).Select(data => new ValidNetMode + { + Data = data + }).ToArray(); + + public NetSiteComputing ComputingValue + { + get => _valueComputing; + + set + { + if (SetProperty(ref _valueComputing, value, nameof(ComputingValue))) + { + OnPropertyChanged(nameof(LengthText)); + NotifyComputedValues(); + } + } + } + + public bool AllowSiteHandLevying => !AllowTotalLevying || AvatarItemCollection.All(avatarItem => avatarItem.IsMe || avatarItem.AvatarID.StartsWith('@') || avatarItem.AvatarConfigureValue == AvatarItem.AvatarConfigure.Levying); + + public bool IsSiteHand => SiteHand == TwilightSystem.Instance.AvatarID; + + public bool HasPointedInput { get; set; } + + public bool IsGetNotify + { + get => _isGetNotify; + + set => SetProperty(ref _isGetNotify, value, nameof(IsGetNotify)); + } + + public bool IsAudioInput + { + get => _isAudioInput; + + set + { + if (SetProperty(ref _isAudioInput, value, nameof(IsAudioInput))) + { + NotifyIsSendingAudioInput(); + } + } + } + + public bool IsFavorNoteFile + { + get => _isFavorNoteFile; + + set => SetProperty(ref _isFavorNoteFile, value, nameof(IsFavorNoteFile)); + } + + public bool IsAutoNetLevying + { + get => _isAutoNetLevying; + + set => SetProperty(ref _isAutoNetLevying, value, nameof(IsAutoNetLevying)); + } + + public bool IsFavorModeComponent + { + get => _isFavorModeComponent; + + set => SetProperty(ref _isFavorModeComponent, value, nameof(IsFavorModeComponent)); + } + + public bool IsFavorAudioMultiplier + { + get => _isFavorAudioMultiplier; + + set + { + if (SetProperty(ref _isFavorAudioMultiplier, value, nameof(IsFavorAudioMultiplier))) + { + OnPropertyChanged(nameof(BPMText)); + } + } + } + + public bool IsAutoSiteHand + { + get => _isAutoSiteHand; + + set => SetProperty(ref _isAutoSiteHand, value, nameof(IsAutoSiteHand)); + } + + public bool AllowTotalLevying + { + get => _allowTotalLevying; + + set + { + if (SetProperty(ref _allowTotalLevying, value, nameof(AllowTotalLevying))) + { + OnPropertyChanged(nameof(AllowSiteHandLevying)); + } + } + } + + public int ValidHunterMode + { + get => _validHunterMode; + + set + { + if (SetProperty(ref _validHunterMode, value, nameof(ValidHunterMode))) + { + OnPropertyChanged(nameof(ValidHunterModeText)); + } + } + } + + public string ValidHunterModeText => ValidHunterMode switch + { + 0 => LanguageSystem.Instance.StandValidHunterModeText, + 1 => LanguageSystem.Instance.PointValidHunterModeText, + 2 => LanguageSystem.Instance.BandValidHunterModeText, + _ => default, + }; + + public string BundleName + { + get => _bundleName; + + set + { + if (SetProperty(ref _bundleName, value, nameof(BundleName))) + { + OnPropertyChanged(nameof(CanSaveNetBundle)); + } + } + } + + public AvatarGroup AvatarGroupValue + { + get => _avatarGroupValue; + + set + { + if (SetProperty(ref _avatarGroupValue, value, nameof(AvatarGroupValue))) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetAvatarGroup, new + { + siteID = SiteID, + avatarGroup = value.Data + }); + } + } + } + + public ValidNetMode ValidNetModeValue + { + get => _validNetMode; + + set + { + if (SetProperty(ref _validNetMode, value, nameof(ValidNetModeValue))) + { + OnPropertyChanged(nameof(CanSetPostableItems)); + if (IsSiteHand) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetValidNetMode, new + { + siteID = SiteID, + validNetMode = value.Data + }); + } + } + } + } + + public bool WasNotify { get; set; } + + public bool IsEditable { get; set; } + + public bool CanAudioInput { get; set; } + + public Site View { get; set; } + + public string HighestInputCountText => Utility.GetHighestInputCountText(ComputingValue?.AverageInputCount ?? 0.0, ComputingValue?.HighestInputCount ?? 0, IsFavorAudioMultiplier ? 1.0 : ModeComponentValue.AudioMultiplier); + + public string BPMText => IsFavorAudioMultiplier ? $"{ComputingValue?.BPM ?? Component.StandardBPM} BPM" : Utility.GetBPMText(ComputingValue?.BPM ?? Component.StandardBPM, ModeComponentValue.AudioMultiplier); + + public string LengthText => Utility.GetLengthText(ComputingValue?.Length ?? 0.0); + + public bool IsSendingAudioInput => IsAudioInput && Configure.Instance.AudioInput; + + public void NotifyComputedValues() + { + OnPropertyChanged(nameof(HighestInputCountText)); + OnPropertyChanged(nameof(BPMText)); + } + + public void NotifyIsSendingAudioInput() => OnPropertyChanged(nameof(IsSendingAudioInput)); + + public bool IsNew + { + get => _isNew; + + set => SetProperty(ref _isNew, value, nameof(SiteName)); + } + + public bool IsNetSite + { + get => _isNetSite; + + set => SetProperty(ref _isNetSite, value, nameof(IsNetSite)); + } + + public string SiteName + { + get => IsNew ? $"{_siteName} 💬" : _siteName; + + set => SetProperty(ref _siteName, value, nameof(SiteName)); + } + + public string SiteNotify + { + get => _siteNotify; + + set => SetProperty(ref _siteNotify, value, nameof(SiteNotify)); + } + + public string SiteID { get; set; } + + public string Input + { + get => _input; + + set => SetProperty(ref _input, value, nameof(Input)); + } + + public bool IsIdle => SiteSituationValue == SiteSituation.Default; + + public bool CanSaveNetBundle => !string.IsNullOrEmpty(BundleName) && IsIdle; + + public bool CanSetTwilightConfigures => IsSiteHand && IsIdle; + + public bool CanSetPostableItems => IsSiteHand && IsIdle && ValidNetModeValue.Data > 0; + + public bool CanSiteHandLevying => IsSiteHand && IsIdle; + + public bool CanStopSiteNet => IsSiteHand && !IsIdle; + + public SiteSituation SiteSituationValue + { + get => _siteSituationValue; + + set + { + if (SetProperty(ref _siteSituationValue, value, nameof(SiteSituationValue))) + { + OnPropertyChanged(nameof(IsIdle)); + OnPropertyChanged(nameof(CanSaveNetBundle)); + OnPropertyChanged(nameof(CanSetTwilightConfigures)); + OnPropertyChanged(nameof(CanSetPostableItems)); + OnPropertyChanged(nameof(CanSiteHandLevying)); + OnPropertyChanged(nameof(CanStopSiteNet)); + } + } + } + + public AvatarItem AvatarItemValue + { + get => _avatarItemValue; + + set => SetProperty(ref _avatarItemValue, value, nameof(AvatarItemValue)); + } + + public string SiteHand + { + get => _siteHand; + + set + { + if (SetProperty(ref _siteHand, value)) + { + OnPropertyChanged(nameof(IsSiteHand)); + OnPropertyChanged(nameof(IsIdle)); + OnPropertyChanged(nameof(CanSetTwilightConfigures)); + OnPropertyChanged(nameof(CanSetPostableItems)); + OnPropertyChanged(nameof(CanSiteHandLevying)); + OnPropertyChanged(nameof(CanStopSiteNet)); + } + } + } + + public JSON.TwilightCallSiteAvatar? PendingCallSiteAvatarData { get; set; } + + public void SetCallSiteAvatarData(JSON.TwilightCallSiteAvatar pendingCallSiteAvatarData) + { + var siteHand = pendingCallSiteAvatarData.siteHand; + SiteName = Utility.GetSiteName(pendingCallSiteAvatarData.siteName); + SiteHand = siteHand; + SiteSituationValue = (SiteSituation)pendingCallSiteAvatarData.situationValue; + Utility.SetUICollection(AvatarItemCollection, pendingCallSiteAvatarData.data.Select(data => + { + var avatarID = data.avatarID; + return new AvatarItem(avatarID) + { + AvatarConfigureValue = (AvatarItem.AvatarConfigure)data.avatarConfigure, + IsSiteHand = !string.IsNullOrEmpty(siteHand) && avatarID == siteHand, + IsMe = Utility.GetDefaultAvatarID(avatarID) == TwilightSystem.Instance.AvatarID, + AvatarName = data.avatarName, + AvatarGroupValue = new() + { + Data = data.avatarGroup + }, + IsValve = data.isValve, + IsAudioInput = data.isAudioInput + }; + }).ToArray(), null, null, (valueItem, targetItem) => + { + valueItem.AvatarConfigureValue = targetItem.AvatarConfigureValue; + valueItem.IsSiteHand = targetItem.IsSiteHand; + valueItem.IsMe = targetItem.IsMe; + valueItem.AvatarGroupValue = targetItem.AvatarGroupValue; + valueItem.IsAudioInput = targetItem.IsAudioInput; + }); + OnPropertyChanged(nameof(AllowSiteHandLevying)); + if (pendingCallSiteAvatarData.setNoteFile) + { + CallSetNoteFile(); + } + } + + public JSON.TwilightCallSiteNet PendingCallSiteNetData { get; set; } + + public void SetComputingValues(JSON.TwilightCallSiteNet twilightCallSiteNet = null) + { + if (IsNetSite) + { + var mainViewModel = ViewModels.Instance.MainValue; + if (twilightCallSiteNet != null) + { + var noteID = twilightCallSiteNet.noteID; + _defaultNetSiteComputing = new() + { + NoteID = noteID, + IsDefault = true, + Title = twilightCallSiteNet.title, + Artist = twilightCallSiteNet.artist, + LevelText = twilightCallSiteNet.levelText, + LevelValue = twilightCallSiteNet.level, + Genre = twilightCallSiteNet.genre, + JudgmentStage = twilightCallSiteNet.judgmentStage, + HitPointsValue = twilightCallSiteNet.hitPointsValue, + TotalNotes = twilightCallSiteNet.totalNotes, + LongNotes = twilightCallSiteNet.longNotes, + AutoableNotes = twilightCallSiteNet.autoableNotes, + TrapNotes = twilightCallSiteNet.trapNotes, + HighestInputCount = twilightCallSiteNet.highestInputCount, + Length = twilightCallSiteNet.length, + BPM = twilightCallSiteNet.bpm, + LowestBPM = twilightCallSiteNet.lowestBPM, + HighestBPM = twilightCallSiteNet.highestBPM, + InputMode = twilightCallSiteNet.inputMode, + WantLevelID = twilightCallSiteNet.wantLevelID, + HandledValue = mainViewModel.NoteID512s.TryGetValue(noteID, out var netSiteNoteFile) ? netSiteNoteFile.HandledValue : BaseNoteFile.Handled.Not, + IsAutoLongNote = twilightCallSiteNet.isAutoLongNote + }; + _netSiteNoteID = twilightCallSiteNet.noteIDs; + _bundleEntryPath = twilightCallSiteNet.bundleEntryPath; + BundleName = twilightCallSiteNet.bundleName; + ModeComponentValue.ComputingValue = _defaultNetSiteComputing; + } + _defaultNetSiteComputing.NotHaveIt = !mainViewModel.NoteID512s.ContainsKey(_defaultNetSiteComputing.NoteID); + HandlingUISystem.Instance.HandleParallel(() => + { + var noteID = ComputingValue?.NoteID; + ComputingValues.Clear(); + ComputingValues.Add(_defaultNetSiteComputing); + foreach (var netSiteNoteID in _netSiteNoteID) + { + if (netSiteNoteID != _defaultNetSiteComputing.NoteID && mainViewModel.NoteID512s.TryGetValue(netSiteNoteID, out var netSiteNoteFile)) + { + var netSiteComputing = new NetSiteComputing(); + netSiteComputing.NoteID = netSiteNoteID; + netSiteComputing.Title = netSiteNoteFile.Title; + netSiteComputing.Artist = netSiteNoteFile.Artist; + netSiteComputing.LevelText = netSiteNoteFile.LevelText; + netSiteComputing.LevelValue = netSiteNoteFile.LevelValue; + netSiteComputing.Genre = netSiteNoteFile.Genre; + netSiteComputing.JudgmentStage = netSiteNoteFile.JudgmentStage; + netSiteComputing.HitPointsValue = netSiteNoteFile.HitPointsValue; + netSiteComputing.TotalNotes = netSiteNoteFile.TotalNotes; + netSiteComputing.LongNotes = netSiteNoteFile.LongNotes; + netSiteComputing.AutoableNotes = netSiteNoteFile.AutoableNotes; + netSiteComputing.TrapNotes = netSiteNoteFile.TrapNotes; + netSiteComputing.HighestInputCount = netSiteNoteFile.HighestInputCount; + netSiteComputing.Length = netSiteNoteFile.Length; + netSiteComputing.BPM = netSiteNoteFile.BPM; + netSiteComputing.LowestBPM = netSiteNoteFile.LowestBPM; + netSiteComputing.HighestBPM = netSiteNoteFile.HighestBPM; + netSiteComputing.InputMode = netSiteNoteFile.InputMode; + netSiteComputing.WantLevelID = netSiteNoteFile.WantLevelID; + netSiteComputing.HandledValue = netSiteNoteFile.HandledValue; + ComputingValues.Add(netSiteComputing); + } + } + ComputingValue = IsSiteHand ? _defaultNetSiteComputing : ComputingValues.FirstOrDefault(valueComputing => valueComputing.NoteID == noteID) ?? ComputingValues.First(); + }); + } + } + + public void SetAllowedPostableItems(JSON.TwilightCallSiteNet twilightCallSiteNet) + { + foreach (var postableUIItem in PostableUIItemCollection) + { + postableUIItem.IsWanted = twilightCallSiteNet.allowedPostableItems.Contains((int)postableUIItem.PostableItemValue.VarietyValue); + } + OnPropertyChanged(nameof(IsTotalWantPostableUIItem)); + } + + public void SetCallSiteNetData(JSON.TwilightCallSiteNet pendingTwilightCallSiteNetData) + { + IsFavorNoteFile = pendingTwilightCallSiteNetData.isFavorNoteFile; + IsFavorModeComponent = pendingTwilightCallSiteNetData.isFavorModeComponent; + IsFavorAudioMultiplier = pendingTwilightCallSiteNetData.isFavorAudioMultiplier; + ValidHunterMode = pendingTwilightCallSiteNetData.validHunterMode; + ValidNetModeValue = new() + { + Data = pendingTwilightCallSiteNetData.validNetMode + }; + SetAllowedPostableItems(pendingTwilightCallSiteNetData); + IsAutoSiteHand = pendingTwilightCallSiteNetData.isAutoSiteHand; + if (IsSiteHand) + { + SetComputingValues(pendingTwilightCallSiteNetData); + } + else + { + HandlingUISystem.Instance.HandleParallel(() => + { + var lastComputingValues = ComputingValues.ToArray(); + SetComputingValues(pendingTwilightCallSiteNetData); + if (IsAutoNetLevying && lastComputingValues.Except(ComputingValues).Any()) + { + HandleLevyingInput(true); + } + if (ViewModels.Instance.SiteContainerValue.IsOpened && IsOpened) + { + var mainViewModel = ViewModels.Instance.MainValue; + if (mainViewModel.NoteID512s.TryGetValue(ComputingValue.NoteID, out var noteFile)) + { + mainViewModel.EntryItemValue = noteFile.EntryItem; + } + } + }); + } + } + + public JSON.TwilightCallSiteModeComponent? PendingCallSiteModeComponentData { get; set; } + + public void SetCallSiteModeComponentData(JSON.TwilightCallSiteModeComponent pendingTwilightCallModeComponentData) + { + ModeComponentValue.CopyAsJSON(pendingTwilightCallModeComponentData.modeComponentData); + NotifyComputedValues(); + } + + public void HandleLevyingInput(bool isSilent) + { + if (ComputingValue != null && ViewModels.Instance.MainValue.NoteID512s.ContainsKey(ComputingValue.NoteID)) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.LevyNet, SiteID); + } + else if (!isSilent) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.HasNotNetNoteFile); + } + } + + public void CallSetNoteFile() + { + if (IsNetSite && IsSiteHand) + { + var entryItemValue = ViewModels.Instance.MainValue.EntryItemValue; + var noteFile = entryItemValue?.NoteFile; + if (noteFile?.IsLogical == false) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetNoteFile, new + { + siteID = SiteID, + noteID = noteFile.GetNoteID512(), + noteIDs = IsFavorNoteFile ? noteFile.EntryItem.CompatibleNoteFiles.Select(noteFile => noteFile.GetNoteID512()) : new[] { noteFile.GetNoteID512() }, + title = noteFile.Title, + artist = noteFile.Artist, + genre = noteFile.Genre, + levelText = noteFile.LevelText, + level = noteFile.LevelValue, + wantLevelID = noteFile.WantLevelID, + judgmentStage = noteFile.JudgmentStage, + hitPointsValue = noteFile.HitPointsValue, + totalNotes = noteFile.TotalNotes, + longNotes = noteFile.LongNotes, + autoableNotes = noteFile.AutoableNotes, + trapNotes = noteFile.TrapNotes, + highestInputCount = noteFile.HighestInputCount, + length = noteFile.Length, + bpm = noteFile.BPM, + lowestBPM = noteFile.LowestBPM, + highestBPM = noteFile.HighestBPM, + inputMode = noteFile.InputMode, + isAutoLongNote = noteFile.IsAutoLongNote, + bundleEntryPath = noteFile.EntryItem.EntryPath + }); + } + } + } + + public void CallUpdateModeComponent() + { + if (IsNetSite && IsSiteHand) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetModeComponent, new + { + siteID = SiteID, + data = ViewModels.Instance.MainValue.ModeComponentValue.GetJSON() + }); + } + } + + public void NewSiteYells(ICollection siteYells, bool isGetSiteYell) + { + var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; + var targetAvatarID = TwilightSystem.Instance.AvatarID; + var isMySiteYell = siteYells.Any(data => data.avatarID == targetAvatarID); + var pendingNewSiteYells = siteYells.Select(data => new Func(() => + { + var avatarID = data.avatarID; + var avatarName = data.avatarName; + var date = DateTimeOffset.FromUnixTimeMilliseconds(data.date).LocalDateTime.ToLongTimeString(); + var siteYellID = data.siteYellID; + var siteYell = data.siteYell; + switch (avatarName) + { + case "@Enter": + return new EnterSiteYell(avatarID, siteYell, date, siteYellID); + case "@Quit": + return new QuitSiteYell(avatarID, siteYell, date, siteYellID); + case "@Site": + return new NewSiteYell(avatarID, siteYell, date, siteYellID); + case "@Net": + return new NewNetSiteYell(avatarID, siteYell, date, siteYellID); + case "@Comment": + return new CommentSiteYell(siteYell, date, siteYellID); + case "@Notify": + SiteNotify = siteYell; + return new TaehuiSiteYell(siteYell, date, siteYellID); + case "@Invite": + return new InviteSiteYell(avatarID, siteYell, date, siteYellID); + case "@TV": + return new TVSiteYell(avatarID, siteYell, date, siteYellID); + case "@Wiped": + return new WipedSiteYell(avatarID, siteYell, date, siteYellID); + case "": + return new NotifySiteYell(siteYell, siteYellID); + default: + var href = Utility.CompileSiteYells(siteYell); + var position = href.IndexOf('?'); + switch (Utility.GetAvailable(position != -1 ? href.Substring(0, position) : href)) + { + case Utility.AvailableFlag.Audio: + return new AudioSiteYell(avatarID, avatarName, date, siteYell, href, siteYellID); + case Utility.AvailableFlag.Media: + return new MediaSiteYell(avatarID, avatarName, date, siteYell, href, siteYellID); + case Utility.AvailableFlag.Drawing: + return new DrawingSiteYell(avatarID, avatarName, date, siteYell, href, siteYellID); + default: + return new DefaultSiteYell(avatarID, avatarName, date, siteYell, href, siteYellID); + } + } + })); + if (siteContainerViewModel.IsOpened && IsOpened) + { + HandlingUISystem.Instance.HandleParallel(() => + { + if (isGetSiteYell) + { + foreach (var pendingNewSiteYell in pendingNewSiteYells.Reverse()) + { + SiteYellCollection.Insert(0, PutPlatformSiteYell(pendingNewSiteYell())); + } + } + else + { + foreach (var pendingNewSiteYell in pendingNewSiteYells) + { + SiteYellCollection.Add(PutPlatformSiteYell(pendingNewSiteYell())); + } + } + if (isGetSiteYell) + { + _lastPosition1BeforeCall = View.SiteYellsViewer.ExtentHeight - View.SiteYellsViewer.ActualHeight; + } + else if (isMySiteYell || _isSiteYellsViewLowest) + { + View.SiteYellsViewer.ScrollToEnd(); + } + }); + } + else + { + lock (_pendingNewSiteYellQueue) + { + if (isGetSiteYell) + { + foreach (var pendingNewSiteYell in pendingNewSiteYells.Reverse()) + { + _pendingNewSiteYellQueue.AddFirst(pendingNewSiteYell); + } + } + else + { + foreach (var putSiteYell in pendingNewSiteYells) + { + _pendingNewSiteYellQueue.AddLast(putSiteYell); + } + } + } + } + } + + public void ModifySiteYell(JSON.TwilightModifySiteYell twilightModifySiteYell) + { + var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; + var targetAvatarID = TwilightSystem.Instance.AvatarID; + var pendingModifySiteYell = new Action(() => + { + if (_siteYellsMap.TryGetValue(twilightModifySiteYell.siteYellID, out var siteYell)) + { + siteYell.SiteYell = twilightModifySiteYell.siteYell; + } + }); + if (siteContainerViewModel.IsOpened && IsOpened) + { + pendingModifySiteYell(); + } + else + { + lock (_pendingModifySiteYellQueue) + { + _pendingModifySiteYellQueue.Add(pendingModifySiteYell); + } + } + } + + public void WipeSiteYell(JSON.TwilightWipeSiteYell twilightWipeSiteYell) + { + var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; + var targetAvatarID = TwilightSystem.Instance.AvatarID; + var pendingWipeSiteYell = new Action(() => + { + if (_siteYellsMap.TryGetValue(twilightWipeSiteYell.siteYellID, out var siteYell)) + { + HandlingUISystem.Instance.HandleParallel(() => + { + var i = SiteYellCollection.IndexOf(siteYell); + SiteYellCollection.Remove(siteYell); + SiteYellCollection.Insert(i, new WipedSiteYell(siteYell.AvatarID, siteYell.AvatarName, siteYell.Date, siteYell.SiteYellID)); + }); + } + }); + if (siteContainerViewModel.IsOpened && IsOpened) + { + pendingWipeSiteYell(); + } + else + { + lock (_pendingWipeSiteYellQueue) + { + _pendingWipeSiteYellQueue.Add(pendingWipeSiteYell); + } + } + } + + public void Notify(JSON.TwilightSiteYellItem siteYell) + { + if (IsGetNotify) + { + if (!WasNotify && !ViewModels.Instance.SiteContainerValue.IsOpened) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, siteYell.ToString(), false); + WasNotify = true; + } + } + } + + ISiteYell PutPlatformSiteYell(ISiteYell siteYell) + { + var siteYellID = siteYell.SiteYellID; + if (siteYellID != -1) + { + _siteYellsMap[siteYellID] = siteYell; + } + return siteYell; + } + + public void OnOpened() + { + if (IsOpened) + { + WasNotify = false; + lock (_pendingNewSiteYellQueue) + { + if (_pendingNewSiteYellQueue.Count > 0) + { + foreach (var pendingNewSiteYell in _pendingNewSiteYellQueue) + { + SiteYellCollection.Add(PutPlatformSiteYell(pendingNewSiteYell())); + } + _pendingNewSiteYellQueue.Clear(); + } + } + lock (_pendingModifySiteYellQueue) + { + if (_pendingModifySiteYellQueue.Count > 0) + { + foreach (var pendingModifySiteYell in _pendingModifySiteYellQueue) + { + pendingModifySiteYell(); + } + _pendingModifySiteYellQueue.Clear(); + } + } + lock (_pendingWipeSiteYellQueue) + { + if (_pendingWipeSiteYellQueue.Count > 0) + { + foreach (var pendingWipeSiteYell in _pendingWipeSiteYellQueue) + { + pendingWipeSiteYell(); + } + _pendingWipeSiteYellQueue.Clear(); + } + } + if (_isSiteYellsViewLowest) + { + View.SiteYellsViewer.ScrollToEnd(); + } + if (IsNew) + { + IsNew = false; + } + } + if (PendingCallSiteAvatarData.HasValue) + { + var pendingCallSiteAvatarData = PendingCallSiteAvatarData.Value; + PendingCallSiteAvatarData = null; + SetCallSiteAvatarData(pendingCallSiteAvatarData); + } + if (PendingCallSiteNetData != null) + { + var pendingSetSiteNetData = PendingCallSiteNetData; + PendingCallSiteNetData = null; + SetCallSiteNetData(pendingSetSiteNetData); + } + if (PendingCallSiteModeComponentData.HasValue) + { + var pendingCallSiteModeComponentData = PendingCallSiteModeComponentData.Value; + PendingCallSiteModeComponentData = null; + SetCallSiteModeComponentData(pendingCallSiteModeComponentData); + } + if (_hasPendingNew) + { + _hasPendingNew = false; + IsNew = true; + } + } + + public void SetSiteAvatar(JSON.TwilightCallSiteAvatar pendingCallSiteAvatarData) + { + if (ViewModels.Instance.SiteContainerValue.IsOpened) + { + SetCallSiteAvatarData(pendingCallSiteAvatarData); + } + else + { + PendingCallSiteAvatarData = pendingCallSiteAvatarData; + } + } + + public void SetSiteNet(JSON.TwilightCallSiteNet pendingCallSiteNetData) + { + if (ViewModels.Instance.SiteContainerValue.IsOpened) + { + SetCallSiteNetData(pendingCallSiteNetData); + } + else + { + PendingCallSiteNetData = pendingCallSiteNetData; + } + } + + public void SetSiteModeComponent(JSON.TwilightCallSiteModeComponent pendingCallSiteModeComponentData) + { + if (ViewModels.Instance.SiteContainerValue.IsOpened) + { + SetCallSiteModeComponentData(pendingCallSiteModeComponentData); + } + else + { + PendingCallSiteModeComponentData = pendingCallSiteModeComponentData; + } + } + + public void SetNew() + { + if (!IsOpened) + { + if (ViewModels.Instance.SiteContainerValue.IsOpened) + { + IsNew = true; + } + else + { + _hasPendingNew = true; + } + } + } + + public void AudioInput(byte[] data, int length) => TwilightSystem.Instance.SendParallel(Event.Types.EventID.AudioInput, SiteID, UnsafeByteOperations.UnsafeWrap(data.AsMemory(0, length))); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/SiteWindowViewModel.cs b/Qwilight/Qwilight/ViewModel/SiteWindowViewModel.cs new file mode 100644 index 0000000..7b79b34 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/SiteWindowViewModel.cs @@ -0,0 +1,180 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed partial class SiteWindowViewModel : BaseViewModel + { + SiteItem _siteItem; + Timer _getSitesHandler; + + public ObservableCollection SiteItemCollection { get; } = new(); + + public override double TargetLength => 0.6; + + public override double TargetHeight => 0.5; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public SiteItem SiteItem + { + get => _siteItem; + + set => SetProperty(ref _siteItem, value, nameof(SiteItem)); + } + + [RelayCommand] + void OnNewNetSite() + { + var mainViewModel = ViewModels.Instance.MainValue; + var entryItemValue = mainViewModel.EntryItemValue; + var noteFile = entryItemValue?.NoteFile; + if (noteFile?.IsLogical == false) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewPwWindow, + Contents = new object[] + { + LanguageSystem.Instance.NewNetSiteContents, + noteFile.Title, + true, + new Action((input, inputCipher) => + { + var modeComponentValue = mainViewModel.ModeComponentValue; + TwilightSystem.Instance.SendParallel(Event.Types.EventID.NewSite, new + { + siteName = input, + siteCipher = inputCipher, + isNetSite = true, + data = modeComponentValue.GetJSON(), + noteID = noteFile.GetNoteID512(), + noteIDs = noteFile.EntryItem.CompatibleNoteFiles.Select(noteFile => noteFile.GetNoteID512()), + title = noteFile.Title, + artist = noteFile.Artist, + genre = noteFile.Genre, + levelText = noteFile.LevelText, + level = noteFile.LevelValue, + wantLevelID = noteFile.WantLevelID, + judgmentStage = noteFile.JudgmentStage, + hitPointsValue = noteFile.HitPointsValue, + totalNotes = noteFile.TotalNotes, + longNotes = noteFile.LongNotes, + autoableNotes = noteFile.AutoableNotes, + trapNotes = noteFile.TrapNotes, + highestInputCount = noteFile.HighestInputCount, + length = noteFile.Length, + bpm = noteFile.BPM, + lowestBPM = noteFile.LowestBPM, + highestBPM = noteFile.HighestBPM, + inputMode = noteFile.InputMode, + isAutoLongNote = noteFile.IsAutoLongNote, + bundleEntryPath = noteFile.EntryItem.EntryPath, + allowedPostableItems = Enumerable.Range(0, PostableItem.Values.Length).ToArray() + }); + }) + } + }); + } + else + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotValidNoteFile); + } + } + + [RelayCommand] + void OnNewSite() + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewPwWindow, + Contents = new object[] + { + LanguageSystem.Instance.NewSiteContents, + string.Empty, + true, + new Action((input, inputCipher) => + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.NewSite, new + { + siteName = input, + siteCipher = inputCipher, + isNetSite = false + }); + }) + } + }); + } + + public void OnEnterSite() + { + var siteItem = SiteItem; + if (siteItem != null) + { + if (siteItem.HasCipher) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewPwWindow, + Contents = new object[] + { + LanguageSystem.Instance.EnterSiteCipherContents, + siteItem.SiteName, + false, + new Action((input, inputCipher) => TwilightSystem.Instance.SendParallel(Event.Types.EventID.EnterSite, new + { + siteID = siteItem.SiteID, + siteCipher = inputCipher + })) + } + }); + } + else + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.EnterSite, new + { + siteID = siteItem.SiteID, + siteCipher = string.Empty + }); + } + } + } + + public override void OnOpened() + { + base.OnOpened(); + _getSitesHandler = new(async state => + { + if (IsOpened) + { + var twilightWwwSites = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/sites"); + if (twilightWwwSites != null) + { + Utility.SetUICollection(SiteItemCollection, twilightWwwSites.Select(data => new SiteItem + { + SiteID = data.siteID, + SiteName = Utility.GetSiteName(data.siteName), + SiteConfigure = data.siteConfigure, + HasCipher = data.hasCipher, + AvatarCountText = data.avatarCount.ToString(LanguageSystem.Instance.AvatarCountContents) + }).ToArray(), null, null, (siteItem, targetItem) => + { + siteItem.SiteName = targetItem.SiteName; + siteItem.AvatarCountText = targetItem.AvatarCountText; + }); + } + } + }, null, TimeSpan.Zero, TimeSpan.FromSeconds(1)); + } + + public override void OnCollasped() + { + base.OnCollasped(); + _getSitesHandler.Dispose(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/TwilightConfigureViewModel.cs b/Qwilight/Qwilight/ViewModel/TwilightConfigureViewModel.cs new file mode 100644 index 0000000..37658df --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/TwilightConfigureViewModel.cs @@ -0,0 +1,70 @@ +using Qwilight.UIComponent; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed class TwilightConfigureViewModel : BaseViewModel + { + SilentSiteCompetence _silentSiteCompetence; + NotifyUbuntuCompetence _toNotifyUbuntuCompetence; + BundleCompetence _defaultBundleCompetence; + IOCompetence _ioCompetence; + NotifySaveBundleCompetence _toNotifySaveBundleCompetence; + + public override double TargetLength => 0.6; + + public override double TargetHeight => 0.5; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public SilentSiteCompetence SilentSiteCompetence + { + get => _silentSiteCompetence; + + set => SetProperty(ref _silentSiteCompetence, value, nameof(SilentSiteCompetence)); + } + + public NotifyUbuntuCompetence NotifyUbuntuCompetence + { + get => _toNotifyUbuntuCompetence; + + set => SetProperty(ref _toNotifyUbuntuCompetence, value, nameof(NotifyUbuntuCompetence)); + } + + + public BundleCompetence DefaultBundleCompetence + { + get => _defaultBundleCompetence; + + set => SetProperty(ref _defaultBundleCompetence, value, nameof(DefaultBundleCompetence)); + } + + + public IOCompetence IOCompetence + { + get => _ioCompetence; + + set => SetProperty(ref _ioCompetence, value, nameof(IOCompetence)); + } + + public NotifySaveBundleCompetence NotifySaveBundleCompetence + { + get => _toNotifySaveBundleCompetence; + + set => SetProperty(ref _toNotifySaveBundleCompetence, value, nameof(NotifySaveBundleCompetence)); + } + + public override void OnCollasped() + { + base.OnCollasped(); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetConfigure, new + { + silentSiteCompetence = SilentSiteCompetence.Data, + toNotifyUbuntuCompetence = NotifyUbuntuCompetence.Data, + defaultBundleCompetence = DefaultBundleCompetence.Data, + ioCompetence = IOCompetence.Data, + toNotifySaveBundleCompetence = NotifySaveBundleCompetence.Data + }); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/UbuntuViewModel.cs b/Qwilight/Qwilight/ViewModel/UbuntuViewModel.cs new file mode 100644 index 0000000..f00f8f9 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/UbuntuViewModel.cs @@ -0,0 +1,107 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.UIComponent; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Input; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight.ViewModel +{ + public sealed partial class UbuntuViewModel : BaseViewModel + { + UbuntuItem _ubuntuItem; + Timer _getUbuntuHandler; + + public ObservableCollection UbuntuCollection { get; } = new(); + + public void OnUbuntuView(KeyEventArgs e) + { + var ubuntuID = UbuntuItem?.AvatarID; + if (e.Key == Key.Delete && ubuntuID != null) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.ViewAllowWindow, + Contents = new object[] + { + LanguageSystem.Instance.WipeUbuntuNotify, + MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, + new Action(r => + { + if (r == MESSAGEBOX_RESULT.IDYES) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.WipeUbuntu, ubuntuID); + } + }) + } + }); + } + } + + [RelayCommand] + void OnCallIO() + { + var ubuntuID = UbuntuItem?.AvatarID; + if (ubuntuID != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallIo, new + { + avatarID = ubuntuID, + ioMillis = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }); + } + } + + [RelayCommand] + void OnViewBundle() + { + var ubuntuID = UbuntuItem?.AvatarID; + if (ubuntuID != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallBundle, ubuntuID); + } + } + + [RelayCommand] + void OnNewSilentSite() + { + var ubuntuID = UbuntuItem?.AvatarID; + if (ubuntuID != null) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.NewSilentSite, ubuntuID); + } + } + + public override double TargetLength => 0.5; + + public override double TargetHeight => 0.5; + + public override VerticalAlignment TargetHeightSystem => VerticalAlignment.Top; + + public UbuntuItem UbuntuItem + { + get => _ubuntuItem; + + set => SetProperty(ref _ubuntuItem, value, nameof(UbuntuItem)); + } + + public override void OnOpened() + { + base.OnOpened(); + _getUbuntuHandler = new(state => + { + if (IsOpened) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.CallUbuntu, null); + } + }, null, TimeSpan.Zero, TimeSpan.FromSeconds(1)); + } + + public override void OnCollasped() + { + base.OnCollasped(); + _getUbuntuHandler.Dispose(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/ViewModels.cs b/Qwilight/Qwilight/ViewModel/ViewModels.cs new file mode 100644 index 0000000..cbd07f5 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/ViewModels.cs @@ -0,0 +1,176 @@ +using System.Collections.Concurrent; + +namespace Qwilight.ViewModel +{ + public sealed class ViewModels + { + readonly ConcurrentDictionary _siteViewModels = new(); + + public static readonly ViewModels Instance = QwilightComponent.GetBuiltInData(nameof(ViewModels)); + + public BaseViewModel[] WindowViewModels { get; } + + public MainViewModel MainValue { get; } = new(); + + public SignInViewModel SignInValue { get; } = new(); + + public SignUpViewModel SignUpValue { get; } = new(); + + public ConfigureViewModel ConfigureValue { get; } = new(); + + public CommentViewModel CommentValue { get; } = new(); + + public ModifyDefaultEntryViewModel ModifyDefaultEntryValue { get; } = new(); + + public FavoriteEntryViewModel FavoriteEntryValue { get; } = new(); + + public BundleViewModel BundleValue { get; } = new(); + + public UbuntuViewModel UbuntuValue { get; } = new(); + + public SiteContainerViewModel SiteContainerValue { get; } = new(); + + public SiteWindowViewModel SiteWindowValue { get; } = new(); + + public InputViewModel InputValue { get; } = new(); + + public TwilightConfigureViewModel TwilightConfigure { get; } = new(); + + public AssistViewModel AssistValue { get; } = new(); + + public AssistFileViewModel AssistFileValue { get; } = new(); + + public NoteFileViewModel NoteFileValue { get; } = new(); + + public InputStandardControllerViewModel InputStandardControllerValue { get; } = new(); + + public InputStandardViewModel InputStandardValue { get; } = new(); + + public NotifyViewModel NotifyValue { get; } = new(); + + public NetSiteCommentViewModel NetSiteCommentValue { get; } = new(); + + public EqualizerViewModel EqualizerValue { get; } = new(); + + public FavorJudgmentViewModel FavorJudgmentValue { get; } = new(); + + public LongNoteModifyViewModel LongNoteModifyValue { get; } = new(); + + public EventNoteViewModel EventNoteValue { get; } = new(); + + public ModifyFrontEntryViewModel ModifyFrontEntryValue { get; } = new(); + + public ModifyModeComponentViewModel ModifyModeComponentValue { get; } = new(); + + public FontFamilyViewModel FontFamilyValue { get; } = new(); + + public LevelViewModel LevelValue { get; } = new(); + + public PutNoteSetViewModel PutNoteSetValue { get; } = new(); + + public InputTextViewModel InputTextValue { get; } = new(); + + public InputPwViewModel InputPwValue { get; } = new(); + + public VoteViewModel VoteValue { get; } = new(); + + public NotifyXamlViewModel NotifyXamlValue { get; } = new(); + + public FavorHitPointsViewModel FavorHitPointsValue { get; } = new(); + + public ColorViewModel ColorValue { get; } = new(); + + public WwwLevelViewModel WwwLevelValue { get; } = new(); + + public AvatarViewModel AvatarValue { get; } = new(); + + public AvatarTitleViewModel AvatarTitleValue { get; } = new(); + + public AvatarEdgeViewModel AvatarEdgeValue { get; } = new(); + + public WantViewModel WantValue { get; } = new(); + + public LevelVoteViewModel LevelVoteValue { get; } = new(); + + public ViewModels() + { + WindowViewModels = new BaseViewModel[] { + SignInValue, + SignUpValue, + ConfigureValue, + CommentValue, + BundleValue, + UbuntuValue, + SiteContainerValue, + SiteWindowValue, + ModifyDefaultEntryValue, + InputValue, + TwilightConfigure, + AssistValue, + AssistFileValue, + NoteFileValue, + InputStandardControllerValue, + InputStandardValue, + NotifyValue, + NetSiteCommentValue, + FavoriteEntryValue, + EqualizerValue, + FavorJudgmentValue, + LongNoteModifyValue, + EventNoteValue, + ModifyFrontEntryValue, + ModifyModeComponentValue, + FontFamilyValue, + LevelValue, + PutNoteSetValue, + InputTextValue, + InputPwValue, + VoteValue, + FavorHitPointsValue, + ColorValue, + WwwLevelValue, + AvatarValue, + AvatarTitleValue, + AvatarEdgeValue, + WantValue, + LevelVoteValue + }; + } + + public void HandleSiteViewModels(Action onHandle) + { + foreach (var siteViewModel in _siteViewModels.Values) + { + onHandle(siteViewModel); + } + } + + public void NotifyWindowViewModels() + { + foreach (var windowViewModel in WindowViewModels) + { + windowViewModel.NotifyArea(); + windowViewModel.NotifyIsOpened(); + } + } + + public SiteViewModel GetSiteViewModel(string siteID) => _siteViewModels.GetValueOrDefault(siteID); + + public SiteViewModel NewSiteViewModel(string siteID) + { + var siteViewModel = new SiteViewModel(); + _siteViewModels[siteID] = siteViewModel; + return siteViewModel; + } + + public SiteViewModel WipeSiteViewModel(string siteID) + { + _siteViewModels.TryRemove(siteID, out var siteViewModel); + return siteViewModel; + } + + public bool HasSiteViewModel(Func onCondition = null) => onCondition != null ? _siteViewModels.Values.Any(onCondition) : _siteViewModels.Count > 0; + + public void WipeSiteViewModels() => _siteViewModels.Clear(); + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/VoteViewModel.cs b/Qwilight/Qwilight/ViewModel/VoteViewModel.cs new file mode 100644 index 0000000..7685389 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/VoteViewModel.cs @@ -0,0 +1,148 @@ +using CommunityToolkit.Mvvm.Messaging; +using Qwilight.NoteFile; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Windows.Media; + +namespace Qwilight.ViewModel +{ + public sealed class VoteViewModel : BaseViewModel + { + public override double TargetLength => 0.9; + + VoteComputing _valueComputing; + string _voteName; + bool _isEdgeViewLoading; + bool _isVoteGroupsLoading; + bool _isVoteGroupLoading; + + public sealed class VoteComputing : Computing + { + public override BaseNoteFile.NoteVariety NoteVarietyValue => VoteNoteVariety; + + public BaseNoteFile.NoteVariety VoteNoteVariety { get; set; } + + public Brush PointedPaint => Paints.DefaultPointedPaint; + + public string Www { get; set; } + + public bool IsFavorite { get; set; } + + public override void OnCompiled() + { + } + + public override void OnFault(Exception e) + { + } + } + + public ObservableCollection ComputingValues { get; } = new(); + + public VoteComputing ComputingValue + { + get => _valueComputing; + + set + { + if (SetProperty(ref _valueComputing, value, nameof(ComputingValue)) && value != null) + { + WeakReferenceMessenger.Default.Send(new() + { + IDValue = ICC.ID.SetVoteWindowEdgeView, + Contents = value.Www + }); + } + } + } + + public bool IsVoteGroupLoading + { + get => _isVoteGroupLoading; + + set => SetProperty(ref _isVoteGroupLoading, value, nameof(IsVoteGroupLoading)); + } + + public bool IsEdgeViewLoading + { + get => _isEdgeViewLoading; + + set => SetProperty(ref _isEdgeViewLoading, value, nameof(IsEdgeViewLoading)); + } + + public override bool OpeningCondition => ViewModels.Instance.MainValue.IsNoteFileMode; + + public ObservableCollection VoteNames { get; } = new(); + + public string VoteName + { + get => _voteName; + + set + { + if (SetProperty(ref _voteName, value, nameof(VoteName))) + { + GetVoteComputings(); + async void GetVoteComputings() + { + IsVoteGroupLoading = true; + + var twilightWwwVotes = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/vote?voteName={value}"); + if (twilightWwwVotes != null && VoteName == value) + { + Utility.SetUICollection(ComputingValues, twilightWwwVotes.Select(data => new VoteComputing + { + Www = data.www, + IsFavorite = data.isFavorite, + Title = data.title, + Artist = data.artist, + Genre = data.genre, + VoteNoteVariety = data.noteVariety + }).ToArray()); + } + + IsVoteGroupLoading = false; + } + } + } + } + + public bool IsVoteGroupsLoading + { + get => _isVoteGroupsLoading; + + set => SetProperty(ref _isVoteGroupsLoading, value, nameof(IsVoteGroupsLoading)); + } + + public void OnEdgeViewLoading(bool isLoading) + { + IsEdgeViewLoading = isLoading; + } + + public override void OnCollasped() + { + base.OnCollasped(); + ViewModels.Instance.MainValue.HandleAutoComputer(); + } + + public override async void OnOpened() + { + base.OnOpened(); + ViewModels.Instance.MainValue.CloseAutoComputer(); + + IsVoteGroupsLoading = true; + + var voteNames = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/vote"); + if (voteNames != null) + { + HandlingUISystem.Instance.HandleParallel(() => + { + Utility.SetUICollection(VoteNames, voteNames); + VoteName = VoteName ?? VoteNames.FirstOrDefault(); + }); + } + + IsVoteGroupsLoading = false; + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/WantViewModel.cs b/Qwilight/Qwilight/ViewModel/WantViewModel.cs new file mode 100644 index 0000000..ff84aea --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/WantViewModel.cs @@ -0,0 +1,316 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.NoteFile; +using System.Windows; + +namespace Qwilight.ViewModel +{ + public sealed partial class WantViewModel : BaseViewModel + { + public override double TargetLength => 0.9; + + public override double TargetHeight => 0.8; + + [RelayCommand] + void OnHellBPM() => Configure.Instance.WantHellBPM = !Configure.Instance.WantHellBPM; + + [RelayCommand] + void OnCompatible() => Configure.Instance.WantBannedValue = (Configure.WantBanned)(((int)Configure.Instance.WantBannedValue + 1) % 2); + + [RelayCommand] + void OnWantNoteVariety(int e) + { + Configure.Instance.InputWantNoteVariety[e] = !Configure.Instance.InputWantNoteVariety[e]; + OnPropertyChanged(nameof(NoteVarietyBMS)); + OnPropertyChanged(nameof(NoteVarietyBMSON)); + OnPropertyChanged(nameof(NoteVarietyEventNote)); + OnPropertyChanged(nameof(IsTotalWantNoteVariety)); + } + + [RelayCommand] + void OnTotalWantNoteVariety(bool? e) + { + if (e.HasValue) + { + for (var i = Configure.Instance.InputWantNoteVariety.Length - 1; i >= 0; --i) + { + Configure.Instance.InputWantNoteVariety[i] = e.Value; + } + OnPropertyChanged(nameof(NoteVarietyBMS)); + OnPropertyChanged(nameof(NoteVarietyBMSON)); + OnPropertyChanged(nameof(NoteVarietyEventNote)); + OnPropertyChanged(nameof(IsTotalWantNoteVariety)); + } + } + + [RelayCommand] + void OnWantHandled(int e) + { + Configure.Instance.InputWantHandled[e] = !Configure.Instance.InputWantHandled[e]; + OnPropertyChanged(nameof(HandledNot)); + OnPropertyChanged(nameof(HandledClear)); + OnPropertyChanged(nameof(HandledBand1)); + OnPropertyChanged(nameof(HandledF)); + OnPropertyChanged(nameof(HandledHigherClear)); + OnPropertyChanged(nameof(HandledHighestClear)); + OnPropertyChanged(nameof(IsTotalWantHandled)); + } + + [RelayCommand] + void OnTotalWantHandled(bool? e) + { + if (e.HasValue) + { + for (var i = Configure.Instance.InputWantHandled.Length - 1; i >= 0; --i) + { + Configure.Instance.InputWantHandled[i] = e.Value; + } + OnPropertyChanged(nameof(HandledNot)); + OnPropertyChanged(nameof(HandledClear)); + OnPropertyChanged(nameof(HandledBand1)); + OnPropertyChanged(nameof(HandledF)); + OnPropertyChanged(nameof(HandledHigherClear)); + OnPropertyChanged(nameof(HandledHighestClear)); + OnPropertyChanged(nameof(IsTotalWantHandled)); + } + } + + [RelayCommand] + void OnWantMode(int e) + { + Configure.Instance.InputWantMode[e] = !Configure.Instance.InputWantMode[e]; + OnPropertyChanged(nameof(Mode4)); + OnPropertyChanged(nameof(Mode5)); + OnPropertyChanged(nameof(Mode6)); + OnPropertyChanged(nameof(Mode7)); + OnPropertyChanged(nameof(Mode8)); + OnPropertyChanged(nameof(Mode9)); + OnPropertyChanged(nameof(Mode51)); + OnPropertyChanged(nameof(Mode71)); + OnPropertyChanged(nameof(Mode10)); + OnPropertyChanged(nameof(Mode102)); + OnPropertyChanged(nameof(Mode142)); + OnPropertyChanged(nameof(Mode242)); + OnPropertyChanged(nameof(Mode484)); + OnPropertyChanged(nameof(IsTotalWantMode)); + } + + [RelayCommand] + void OnTotalWantMode(bool? e) + { + if (e.HasValue) + { + for (var i = Configure.Instance.InputWantMode.Length - 1; i >= 0; --i) + { + Configure.Instance.InputWantMode[i] = e.Value; + } + OnPropertyChanged(nameof(Mode4)); + OnPropertyChanged(nameof(Mode5)); + OnPropertyChanged(nameof(Mode6)); + OnPropertyChanged(nameof(Mode7)); + OnPropertyChanged(nameof(Mode8)); + OnPropertyChanged(nameof(Mode9)); + OnPropertyChanged(nameof(Mode51)); + OnPropertyChanged(nameof(Mode71)); + OnPropertyChanged(nameof(Mode10)); + OnPropertyChanged(nameof(Mode102)); + OnPropertyChanged(nameof(Mode142)); + OnPropertyChanged(nameof(Mode242)); + OnPropertyChanged(nameof(Mode484)); + OnPropertyChanged(nameof(IsTotalWantMode)); + } + } + + [RelayCommand] + void OnWantLevel(int e) + { + Configure.Instance.InputWantLevel[e] = !Configure.Instance.InputWantLevel[e]; + OnPropertyChanged(nameof(Level0)); + OnPropertyChanged(nameof(Level1)); + OnPropertyChanged(nameof(Level2)); + OnPropertyChanged(nameof(Level3)); + OnPropertyChanged(nameof(Level4)); + OnPropertyChanged(nameof(Level5)); + OnPropertyChanged(nameof(IsTotalWantLevel)); + } + + [RelayCommand] + void OnTotalWantLevel(bool? e) + { + if (e.HasValue) + { + for (var i = Configure.Instance.InputWantLevel.Length - 1; i >= 0; --i) + { + Configure.Instance.InputWantLevel[i] = e.Value; + } + OnPropertyChanged(nameof(Level0)); + OnPropertyChanged(nameof(Level1)); + OnPropertyChanged(nameof(Level2)); + OnPropertyChanged(nameof(Level3)); + OnPropertyChanged(nameof(Level4)); + OnPropertyChanged(nameof(Level5)); + OnPropertyChanged(nameof(IsTotalWantLevel)); + } + } + + public void OnLowestWantLevelTextValue() + { + Configure.Instance.HighestWantLevelTextValue = Math.Max(Configure.Instance.LowestWantLevelTextValue, Configure.Instance.HighestWantLevelTextValue); + Configure.Instance.LowestWantLevelTextValue = Math.Min(Configure.Instance.LowestWantLevelTextValue, Configure.Instance.HighestWantLevelTextValue); + } + + public void OnHighestWantLevelTextValue() + { + Configure.Instance.LowestWantLevelTextValue = Math.Min(Configure.Instance.LowestWantLevelTextValue, Configure.Instance.HighestWantLevelTextValue); + Configure.Instance.HighestWantLevelTextValue = Math.Max(Configure.Instance.LowestWantLevelTextValue, Configure.Instance.HighestWantLevelTextValue); + } + + [RelayCommand] + void OnLevelWindow() => ViewModels.Instance.LevelValue.Open(); + + public void OnLowestWantBPM() + { + Configure.Instance.HighestWantBPM = Math.Max(Configure.Instance.LowestWantBPM, Configure.Instance.HighestWantBPM); + Configure.Instance.LowestWantBPM = Math.Min(Configure.Instance.LowestWantBPM, Configure.Instance.HighestWantBPM); + } + + public void OnHighestWantBPM() + { + Configure.Instance.LowestWantBPM = Math.Min(Configure.Instance.LowestWantBPM, Configure.Instance.HighestWantBPM); + Configure.Instance.HighestWantBPM = Math.Max(Configure.Instance.LowestWantBPM, Configure.Instance.HighestWantBPM); + } + + public void OnLowestWantAverageInputCount() + { + Configure.Instance.HighestWantAverageInputCount = Math.Max(Configure.Instance.LowestWantAverageInputCount, Configure.Instance.HighestWantAverageInputCount); + Configure.Instance.LowestWantAverageInputCount = Math.Min(Configure.Instance.LowestWantAverageInputCount, Configure.Instance.HighestWantAverageInputCount); + } + + public void OnHighestWantAverageInputCount() + { + Configure.Instance.LowestWantAverageInputCount = Math.Min(Configure.Instance.LowestWantAverageInputCount, Configure.Instance.HighestWantAverageInputCount); + Configure.Instance.HighestWantAverageInputCount = Math.Max(Configure.Instance.LowestWantAverageInputCount, Configure.Instance.HighestWantAverageInputCount); + } + + public void OnLowestWantHighestInputCount() + { + Configure.Instance.HighestWantHighestInputCount = Math.Max(Configure.Instance.LowestWantHighestInputCount, Configure.Instance.HighestWantHighestInputCount); + Configure.Instance.LowestWantHighestInputCount = Math.Min(Configure.Instance.LowestWantHighestInputCount, Configure.Instance.HighestWantHighestInputCount); + } + + public void OnHighestWantHighestInputCount() + { + Configure.Instance.LowestWantHighestInputCount = Math.Min(Configure.Instance.LowestWantHighestInputCount, Configure.Instance.HighestWantHighestInputCount); + Configure.Instance.HighestWantHighestInputCount = Math.Max(Configure.Instance.LowestWantHighestInputCount, Configure.Instance.HighestWantHighestInputCount); + } + + public Thickness NoteVarietyBMS => new Thickness(Configure.Instance.InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.BMS] ? 1.0 : 0.0); + + public Thickness NoteVarietyBMSON => new Thickness(Configure.Instance.InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.BMSON] ? 1.0 : 0.0); + + public Thickness NoteVarietyEventNote => new Thickness(Configure.Instance.InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.EventNote] ? 1.0 : 0.0); + + public bool IsTotalWantNoteVariety => Configure.Instance.InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.BMS] || + Configure.Instance.InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.BMSON] || + Configure.Instance.InputWantNoteVariety[(int)BaseNoteFile.NoteVariety.EventNote]; + + public Thickness HandledNot => new Thickness(Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.Not] ? 1.0 : 0.0); + + public Thickness HandledClear => new Thickness(Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.Clear] ? 1.0 : 0.0); + + public Thickness HandledBand1 => new Thickness(Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.Band1] ? 1.0 : 0.0); + + public Thickness HandledF => new Thickness(Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.F] ? 1.0 : 0.0); + + public Thickness HandledHigherClear => new Thickness(Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.HigherClear] ? 1.0 : 0.0); + + public Thickness HandledHighestClear => new Thickness(Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.HighestClear] ? 1.0 : 0.0); + + public bool IsTotalWantHandled => Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.Not] || + Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.Clear] || + Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.Band1] || + Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.F] || + Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.HigherClear] || + Configure.Instance.InputWantHandled[(int)BaseNoteFile.Handled.HighestClear]; + + public Thickness Level0 => new Thickness(Configure.Instance.InputWantLevel[(int)BaseNoteFile.Level.Level0] ? 1.0 : 0.0); + + public Thickness Level1 => new Thickness(Configure.Instance.InputWantLevel[(int)BaseNoteFile.Level.Level1] ? 1.0 : 0.0); + + public Thickness Level2 => new Thickness(Configure.Instance.InputWantLevel[(int)BaseNoteFile.Level.Level2] ? 1.0 : 0.0); + + public Thickness Level3 => new Thickness(Configure.Instance.InputWantLevel[(int)BaseNoteFile.Level.Level3] ? 1.0 : 0.0); + + public Thickness Level4 => new Thickness(Configure.Instance.InputWantLevel[(int)BaseNoteFile.Level.Level4] ? 1.0 : 0.0); + + public Thickness Level5 => new Thickness(Configure.Instance.InputWantLevel[(int)BaseNoteFile.Level.Level5] ? 1.0 : 0.0); + + public bool IsTotalWantLevel => Configure.Instance.InputWantLevel.Any(inputWantLevel => inputWantLevel); + + public Thickness Mode4 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode4] ? 1.0 : 0.0); + + public Thickness Mode5 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode5] ? 1.0 : 0.0); + + public Thickness Mode6 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode6] ? 1.0 : 0.0); + + public Thickness Mode7 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode7] ? 1.0 : 0.0); + + public Thickness Mode8 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode8] ? 1.0 : 0.0); + + public Thickness Mode9 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode9] ? 1.0 : 0.0); + + public Thickness Mode51 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode51] ? 1.0 : 0.0); + + public Thickness Mode71 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode71] ? 1.0 : 0.0); + + public Thickness Mode10 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode10] ? 1.0 : 0.0); + + public Thickness Mode102 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode102] ? 1.0 : 0.0); + + public Thickness Mode142 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode142] ? 1.0 : 0.0); + + public Thickness Mode242 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode242] ? 1.0 : 0.0); + + public Thickness Mode484 => new Thickness(Configure.Instance.InputWantMode[(int)Component.InputMode.InputMode484] ? 1.0 : 0.0); + + public bool IsTotalWantMode => Configure.Instance.InputWantMode.Any(inputWantMode => inputWantMode); + + public override bool ClosingCondition + { + get + { + if (!IsTotalWantNoteVariety) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotWantNoteVarietyContents); + return false; + } + + if (!IsTotalWantHandled) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotWantHandledContents); + return false; + } + + if (!IsTotalWantLevel) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotWantLevelContents); + return false; + } + + if (!IsTotalWantMode) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotWantModeContents); + return false; + } + + return base.ClosingCondition; + } + } + + public override void OnCollasped() + { + base.OnCollasped(); + Configure.Instance.NotifyInputWantWindowPaint(); + ViewModels.Instance.MainValue.Want(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/ViewModel/WwwLevelViewModel.cs b/Qwilight/Qwilight/ViewModel/WwwLevelViewModel.cs new file mode 100644 index 0000000..775ce80 --- /dev/null +++ b/Qwilight/Qwilight/ViewModel/WwwLevelViewModel.cs @@ -0,0 +1,159 @@ +using CommunityToolkit.Mvvm.Input; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using System.Collections.ObjectModel; +using System.Net; + +namespace Qwilight.ViewModel +{ + public sealed partial class WwwLevelViewModel : BaseViewModel + { + WwwLevelAvatar _wwwLevelAvatarValue; + WwwLevelGroup _wwwLevelGroupValue; + bool _isAvatarIDsLoading; + bool _isLevelGroupsLoading; + bool _isLevelGroupLoading; + + [RelayCommand] + void OnWwwLevelTest() => WwwLevelAvatarValue = null; + + [RelayCommand] + void OnViewBundle() => WwwLevelAvatarValue?.AvatarWwwValue?.ViewBundleCommand?.Execute(null); + + [RelayCommand] + void OnNewUbuntu() => WwwLevelAvatarValue?.AvatarWwwValue?.NewUbuntuCommand?.Execute(null); + + [RelayCommand] + void OnViewAvatar() => WwwLevelAvatarValue?.AvatarWwwValue?.ViewAvatarCommand?.Execute(null); + + public bool IsLevelGroupLoading + { + get => _isLevelGroupLoading; + + set => SetProperty(ref _isLevelGroupLoading, value, nameof(IsLevelGroupLoading)); + } + + public override double TargetLength => 0.9; + + public string[] HandledLevelIDs { get; set; } + + public WwwLevelAvatar WwwLevelAvatarValue + { + get => _wwwLevelAvatarValue; + + set + { + if (SetProperty(ref _wwwLevelAvatarValue, value, nameof(WwwLevelAvatar))) + { + GetWwwLevelGroups(); + async void GetWwwLevelGroups() + { + IsLevelGroupsLoading = true; + + var avatarID = value?.AvatarWwwValue?.AvatarID ?? string.Empty; + var levelNames = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/level?avatarID={WebUtility.UrlEncode(avatarID)}"); + if (levelNames != null && (WwwLevelAvatarValue?.AvatarWwwValue?.AvatarID ?? string.Empty) == avatarID) + { + Utility.SetUICollection(WwwLevelGroupCollection, levelNames.Select(levelName => new WwwLevelGroup + { + LevelName = levelName + }).ToArray()); + WwwLevelGroupValue ??= WwwLevelGroupCollection.FirstOrDefault(); + } + + IsLevelGroupsLoading = false; + } + } + } + } + + public ObservableCollection WwwLevelGroupCollection { get; } = new(); + + public ObservableCollection WwwLevelAvatarCollection { get; } = new(); + + public bool IsAvatarIDsLoading + { + get => _isAvatarIDsLoading; + + set => SetProperty(ref _isAvatarIDsLoading, value, nameof(IsAvatarIDsLoading)); + } + + public bool IsLevelGroupsLoading + { + get => _isLevelGroupsLoading; + + set => SetProperty(ref _isLevelGroupsLoading, value, nameof(IsLevelGroupLoading)); + } + + public WwwLevelGroup WwwLevelGroupValue + { + get => _wwwLevelGroupValue; + + set + { + if (SetProperty(ref _wwwLevelGroupValue, value, nameof(WwwLevelGroupValue)) && value != null) + { + GetWwwLevelItems(); + async void GetWwwLevelItems() + { + IsLevelGroupLoading = true; + + var levelName = value.LevelName; + var twilightWwwLevels = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/level?levelName={WebUtility.UrlEncode(levelName)}"); + if (twilightWwwLevels != null && WwwLevelGroupValue?.LevelName == levelName) + { + var wwwLevelItemCollection = value.WwwLevelItemCollection; + Utility.SetUICollection(wwwLevelItemCollection, twilightWwwLevels.Select(twilightWwwLevel => + { + var levelID = twilightWwwLevel.levelID; + return new WwwLevelItem + { + LevelID = levelID, + Title = twilightWwwLevel.title, + Comment = twilightWwwLevel.comment, + LevelText = twilightWwwLevel.levelText, + LevelValue = twilightWwwLevel.level, + Handled = HandledLevelIDs.Contains(levelID), + Avatars = twilightWwwLevel.avatars + }; + }).ToArray()); + value.WwwLevelItemValue ??= wwwLevelItemCollection.FirstOrDefault(); + } + + IsLevelGroupLoading = false; + } + } + } + } + + public override bool OpeningCondition => ViewModels.Instance.MainValue.IsNoteFileMode; + + public override async void OnOpened() + { + base.OnOpened(); + IsAvatarIDsLoading = true; + var twilightWwwLevelAvatars = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/level?avatarIDMe={WebUtility.UrlEncode(TwilightSystem.Instance.AvatarID)}"); + if (twilightWwwLevelAvatars.HasValue) + { + var twilightWwwLevelAvatarsValue = twilightWwwLevelAvatars.Value; + + Utility.SetUICollection(WwwLevelAvatarCollection, twilightWwwLevelAvatarsValue.avatars.Select(avatar => new WwwLevelAvatar + { + AvatarWwwValue = new AvatarWww(avatar.avatarID), + AvatarName = avatar.avatarName + }).ToArray()); + + HandledLevelIDs = twilightWwwLevelAvatarsValue.levelIDs; + HandlingUISystem.Instance.HandleParallel(() => WwwLevelAvatarValue ??= WwwLevelAvatarCollection.FirstOrDefault()); + + IsAvatarIDsLoading = false; + } + } + + public override void OnCollasped() + { + base.OnCollasped(); + ViewModels.Instance.MainValue.Want(); + } + } +} \ No newline at end of file diff --git a/Qwilight/Qwilight/XOR/XORFloat64.cs b/Qwilight/Qwilight/XOR/XORFloat64.cs new file mode 100644 index 0000000..1c6e530 --- /dev/null +++ b/Qwilight/Qwilight/XOR/XORFloat64.cs @@ -0,0 +1,22 @@ +using System.Security.Cryptography; + +namespace Qwilight.XOR +{ + public struct XORFloat64 + { + long _value; + int _salt; + + XORFloat64(double value) + { + _salt = RandomNumberGenerator.GetInt32(int.MaxValue); + _value = BitConverter.DoubleToInt64Bits(value) ^ _salt; + } + + double GetValue() => BitConverter.Int64BitsToDouble(_value ^ _salt); + + public static implicit operator double(XORFloat64 value) => value.GetValue(); + + public static implicit operator XORFloat64(double value) => new XORFloat64(value); + } +} diff --git a/Qwilight/Qwilight/XOR/XORInt32.cs b/Qwilight/Qwilight/XOR/XORInt32.cs new file mode 100644 index 0000000..0910c6c --- /dev/null +++ b/Qwilight/Qwilight/XOR/XORInt32.cs @@ -0,0 +1,22 @@ +using System.Security.Cryptography; + +namespace Qwilight.XOR +{ + public struct XORInt32 + { + int _value; + int _salt; + + XORInt32(int value) + { + _salt = RandomNumberGenerator.GetInt32(int.MaxValue); + _value = value ^ _salt; + } + + int GetValue() => _value ^ _salt; + + public static implicit operator int(XORInt32 value) => value.GetValue(); + + public static implicit operator XORInt32(int value) => new XORInt32(value); + } +} diff --git a/Qwilight/Xml2CSharp/Courselist.cs b/Qwilight/Xml2CSharp/Courselist.cs new file mode 100644 index 0000000..1bfbe42 --- /dev/null +++ b/Qwilight/Xml2CSharp/Courselist.cs @@ -0,0 +1,31 @@ +/* + Licensed under the Apache License, Version 2.0 + + http://www.apache.org/licenses/LICENSE-2.0 + */ +using System; +using System.Xml.Serialization; +using System.Collections.Generic; +namespace Xml2CSharp +{ + [XmlRoot(ElementName = "course")] + public class Course + { + [XmlElement(ElementName = "title")] + public string Title { get; set; } + [XmlElement(ElementName = "line")] + public string Line { get; set; } + [XmlElement(ElementName = "hash")] + public string Hash { get; set; } + [XmlElement(ElementName = "type")] + public string Type { get; set; } + } + + [XmlRoot(ElementName = "courselist")] + public class Courselist + { + [XmlElement(ElementName = "course")] + public List Course { get; set; } + } + +} diff --git a/Qwilight/Xml2CSharp/IBMSC.cs b/Qwilight/Xml2CSharp/IBMSC.cs new file mode 100644 index 0000000..e93bb3f --- /dev/null +++ b/Qwilight/Xml2CSharp/IBMSC.cs @@ -0,0 +1,517 @@ +/* + Licensed under the Apache License, Version 2.0 + + http://www.apache.org/licenses/LICENSE-2.0 + */ +using System; +using System.Xml.Serialization; +using System.Collections.Generic; +namespace Xml2CSharp +{ + [XmlRoot(ElementName = "Form")] + public class Form + { + [XmlAttribute(AttributeName = "WindowState")] + public string WindowState { get; set; } + [XmlAttribute(AttributeName = "Width")] + public string Width { get; set; } + [XmlAttribute(AttributeName = "Height")] + public string Height { get; set; } + [XmlAttribute(AttributeName = "Top")] + public string Top { get; set; } + [XmlAttribute(AttributeName = "Left")] + public string Left { get; set; } + } + + [XmlRoot(ElementName = "Recent")] + public class Recent + { + [XmlAttribute(AttributeName = "Recent0")] + public string Recent0 { get; set; } + [XmlAttribute(AttributeName = "Recent1")] + public string Recent1 { get; set; } + [XmlAttribute(AttributeName = "Recent2")] + public string Recent2 { get; set; } + [XmlAttribute(AttributeName = "Recent3")] + public string Recent3 { get; set; } + [XmlAttribute(AttributeName = "Recent4")] + public string Recent4 { get; set; } + } + + [XmlRoot(ElementName = "Edit")] + public class Edit + { + [XmlAttribute(AttributeName = "NTInput")] + public string NTInput { get; set; } + [XmlAttribute(AttributeName = "Language")] + public string Language { get; set; } + [XmlAttribute(AttributeName = "ErrorCheck")] + public string ErrorCheck { get; set; } + [XmlAttribute(AttributeName = "AutoFocusMouseEnter")] + public string AutoFocusMouseEnter { get; set; } + [XmlAttribute(AttributeName = "FirstClickDisabled")] + public string FirstClickDisabled { get; set; } + [XmlAttribute(AttributeName = "ShowFileName")] + public string ShowFileName { get; set; } + [XmlAttribute(AttributeName = "MiddleButtonMoveMethod")] + public string MiddleButtonMoveMethod { get; set; } + [XmlAttribute(AttributeName = "AutoSaveInterval")] + public string AutoSaveInterval { get; set; } + [XmlAttribute(AttributeName = "PreviewOnClick")] + public string PreviewOnClick { get; set; } + [XmlAttribute(AttributeName = "ClickStopPreview")] + public string ClickStopPreview { get; set; } + } + + [XmlRoot(ElementName = "Save")] + public class Save + { + [XmlAttribute(AttributeName = "TextEncoding")] + public string TextEncoding { get; set; } + [XmlAttribute(AttributeName = "BMSGridLimit")] + public string BMSGridLimit { get; set; } + [XmlAttribute(AttributeName = "BeepWhileSaved")] + public string BeepWhileSaved { get; set; } + [XmlAttribute(AttributeName = "BPMx1296")] + public string BPMx1296 { get; set; } + [XmlAttribute(AttributeName = "STOPx1296")] + public string STOPx1296 { get; set; } + } + + [XmlRoot(ElementName = "WAV")] + public class WAV + { + [XmlAttribute(AttributeName = "WAVMultiSelect")] + public string WAVMultiSelect { get; set; } + [XmlAttribute(AttributeName = "WAVChangeLabel")] + public string WAVChangeLabel { get; set; } + [XmlAttribute(AttributeName = "BeatChangeMode")] + public string BeatChangeMode { get; set; } + } + + [XmlRoot(ElementName = "ShowHide")] + public class ShowHide + { + [XmlAttribute(AttributeName = "showMenu")] + public string ShowMenu { get; set; } + [XmlAttribute(AttributeName = "showTB")] + public string ShowTB { get; set; } + [XmlAttribute(AttributeName = "showOpPanel")] + public string ShowOpPanel { get; set; } + [XmlAttribute(AttributeName = "showStatus")] + public string ShowStatus { get; set; } + [XmlAttribute(AttributeName = "showLSplit")] + public string ShowLSplit { get; set; } + [XmlAttribute(AttributeName = "showRSplit")] + public string ShowRSplit { get; set; } + } + + [XmlRoot(ElementName = "Grid")] + public class Grid + { + [XmlAttribute(AttributeName = "gSnap")] + public string GSnap { get; set; } + [XmlAttribute(AttributeName = "gWheel")] + public string GWheel { get; set; } + [XmlAttribute(AttributeName = "gPgUpDn")] + public string GPgUpDn { get; set; } + [XmlAttribute(AttributeName = "gShow")] + public string GShow { get; set; } + [XmlAttribute(AttributeName = "gShowS")] + public string GShowS { get; set; } + [XmlAttribute(AttributeName = "gShowBG")] + public string GShowBG { get; set; } + [XmlAttribute(AttributeName = "gShowM")] + public string GShowM { get; set; } + [XmlAttribute(AttributeName = "gShowV")] + public string GShowV { get; set; } + [XmlAttribute(AttributeName = "gShowMB")] + public string GShowMB { get; set; } + [XmlAttribute(AttributeName = "gShowC")] + public string GShowC { get; set; } + [XmlAttribute(AttributeName = "gBPM")] + public string GBPM { get; set; } + [XmlAttribute(AttributeName = "gSTOP")] + public string GSTOP { get; set; } + [XmlAttribute(AttributeName = "gSCROLL")] + public string GSCROLL { get; set; } + [XmlAttribute(AttributeName = "gBLP")] + public string GBLP { get; set; } + [XmlAttribute(AttributeName = "gP2")] + public string GP2 { get; set; } + [XmlAttribute(AttributeName = "gCol")] + public string GCol { get; set; } + [XmlAttribute(AttributeName = "gDivide")] + public string GDivide { get; set; } + [XmlAttribute(AttributeName = "gSub")] + public string GSub { get; set; } + [XmlAttribute(AttributeName = "gSlash")] + public string GSlash { get; set; } + [XmlAttribute(AttributeName = "gxHeight")] + public string GxHeight { get; set; } + [XmlAttribute(AttributeName = "gxWidth")] + public string GxWidth { get; set; } + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "WaveForm")] + public class WaveForm + { + [XmlAttribute(AttributeName = "wLock")] + public string WLock { get; set; } + [XmlAttribute(AttributeName = "wPosition")] + public string WPosition { get; set; } + [XmlAttribute(AttributeName = "wLeft")] + public string WLeft { get; set; } + [XmlAttribute(AttributeName = "wWidth")] + public string WWidth { get; set; } + [XmlAttribute(AttributeName = "wPrecision")] + public string WPrecision { get; set; } + } + + [XmlRoot(ElementName = "Player")] + public class Player + { + [XmlAttribute(AttributeName = "Index")] + public string Index { get; set; } + [XmlAttribute(AttributeName = "Path")] + public string Path { get; set; } + [XmlAttribute(AttributeName = "FromBeginning")] + public string FromBeginning { get; set; } + [XmlAttribute(AttributeName = "FromHere")] + public string FromHere { get; set; } + [XmlAttribute(AttributeName = "Stop")] + public string Stop { get; set; } + } + + [XmlRoot(ElementName = "Player")] + public class Players + { + [XmlElement(ElementName = "Player")] + public List Player { get; set; } + [XmlAttribute(AttributeName = "Count")] + public string Count { get; set; } + [XmlAttribute(AttributeName = "CurrentPlayer")] + public string CurrentPlayer { get; set; } + } + + [XmlRoot(ElementName = "Column")] + public class Column + { + [XmlAttribute(AttributeName = "Index")] + public string Index { get; set; } + [XmlAttribute(AttributeName = "Width")] + public string Width { get; set; } + [XmlAttribute(AttributeName = "Title")] + public string Title { get; set; } + [XmlAttribute(AttributeName = "NoteColor")] + public string NoteColor { get; set; } + [XmlAttribute(AttributeName = "TextColor")] + public string TextColor { get; set; } + [XmlAttribute(AttributeName = "LongNoteColor")] + public string LongNoteColor { get; set; } + [XmlAttribute(AttributeName = "LongTextColor")] + public string LongTextColor { get; set; } + [XmlAttribute(AttributeName = "BG")] + public string BG { get; set; } + } + + [XmlRoot(ElementName = "Columns")] + public class Columns + { + [XmlElement(ElementName = "Column")] + public List Column { get; set; } + } + + [XmlRoot(ElementName = "ColumnTitle")] + public class ColumnTitle + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "ColumnTitleFont")] + public class ColumnTitleFont + { + [XmlAttribute(AttributeName = "Name")] + public string Name { get; set; } + [XmlAttribute(AttributeName = "Size")] + public string Size { get; set; } + [XmlAttribute(AttributeName = "Style")] + public string Style { get; set; } + } + + [XmlRoot(ElementName = "Bg")] + public class Bg + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "Sub")] + public class Sub + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "VLine")] + public class VLine + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "MLine")] + public class MLine + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "BGMWav")] + public class BGMWav + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "SelBox")] + public class SelBox + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSCursor")] + public class TSCursor + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSHalf")] + public class TSHalf + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSDeltaMouseOver")] + public class TSDeltaMouseOver + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSMouseOver")] + public class TSMouseOver + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSSel")] + public class TSSel + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSBPM")] + public class TSBPM + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "TSBPMFont")] + public class TSBPMFont + { + [XmlAttribute(AttributeName = "Name")] + public string Name { get; set; } + [XmlAttribute(AttributeName = "Size")] + public string Size { get; set; } + [XmlAttribute(AttributeName = "Style")] + public string Style { get; set; } + } + + [XmlRoot(ElementName = "MiddleDeltaRelease")] + public class MiddleDeltaRelease + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kHeight")] + public class KHeight + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kFont")] + public class KFont + { + [XmlAttribute(AttributeName = "Name")] + public string Name { get; set; } + [XmlAttribute(AttributeName = "Size")] + public string Size { get; set; } + [XmlAttribute(AttributeName = "Style")] + public string Style { get; set; } + } + + [XmlRoot(ElementName = "kMFont")] + public class KMFont + { + [XmlAttribute(AttributeName = "Name")] + public string Name { get; set; } + [XmlAttribute(AttributeName = "Size")] + public string Size { get; set; } + [XmlAttribute(AttributeName = "Style")] + public string Style { get; set; } + } + + [XmlRoot(ElementName = "kLabelVShift")] + public class KLabelVShift + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kLabelHShift")] + public class KLabelHShift + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kLabelHShiftL")] + public class KLabelHShiftL + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kMouseOver")] + public class KMouseOver + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kMouseOverE")] + public class KMouseOverE + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kSelected")] + public class KSelected + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "kOpacity")] + public class KOpacity + { + [XmlAttribute(AttributeName = "Value")] + public string Value { get; set; } + } + + [XmlRoot(ElementName = "VisualSettings")] + public class VisualSettings + { + [XmlElement(ElementName = "ColumnTitle")] + public ColumnTitle ColumnTitle { get; set; } + [XmlElement(ElementName = "ColumnTitleFont")] + public ColumnTitleFont ColumnTitleFont { get; set; } + [XmlElement(ElementName = "Bg")] + public Bg Bg { get; set; } + [XmlElement(ElementName = "Grid")] + public Grid Grid { get; set; } + [XmlElement(ElementName = "Sub")] + public Sub Sub { get; set; } + [XmlElement(ElementName = "VLine")] + public VLine VLine { get; set; } + [XmlElement(ElementName = "MLine")] + public MLine MLine { get; set; } + [XmlElement(ElementName = "BGMWav")] + public BGMWav BGMWav { get; set; } + [XmlElement(ElementName = "SelBox")] + public SelBox SelBox { get; set; } + [XmlElement(ElementName = "TSCursor")] + public TSCursor TSCursor { get; set; } + [XmlElement(ElementName = "TSHalf")] + public TSHalf TSHalf { get; set; } + [XmlElement(ElementName = "TSDeltaMouseOver")] + public TSDeltaMouseOver TSDeltaMouseOver { get; set; } + [XmlElement(ElementName = "TSMouseOver")] + public TSMouseOver TSMouseOver { get; set; } + [XmlElement(ElementName = "TSSel")] + public TSSel TSSel { get; set; } + [XmlElement(ElementName = "TSBPM")] + public TSBPM TSBPM { get; set; } + [XmlElement(ElementName = "TSBPMFont")] + public TSBPMFont TSBPMFont { get; set; } + [XmlElement(ElementName = "MiddleDeltaRelease")] + public MiddleDeltaRelease MiddleDeltaRelease { get; set; } + [XmlElement(ElementName = "kHeight")] + public KHeight KHeight { get; set; } + [XmlElement(ElementName = "kFont")] + public KFont KFont { get; set; } + [XmlElement(ElementName = "kMFont")] + public KMFont KMFont { get; set; } + [XmlElement(ElementName = "kLabelVShift")] + public KLabelVShift KLabelVShift { get; set; } + [XmlElement(ElementName = "kLabelHShift")] + public KLabelHShift KLabelHShift { get; set; } + [XmlElement(ElementName = "kLabelHShiftL")] + public KLabelHShiftL KLabelHShiftL { get; set; } + [XmlElement(ElementName = "kMouseOver")] + public KMouseOver KMouseOver { get; set; } + [XmlElement(ElementName = "kMouseOverE")] + public KMouseOverE KMouseOverE { get; set; } + [XmlElement(ElementName = "kSelected")] + public KSelected KSelected { get; set; } + [XmlElement(ElementName = "kOpacity")] + public KOpacity KOpacity { get; set; } + } + + [XmlRoot(ElementName = "iBMSC")] + public class IBMSC + { + [XmlElement(ElementName = "Form")] + public Form Form { get; set; } + [XmlElement(ElementName = "Recent")] + public Recent Recent { get; set; } + [XmlElement(ElementName = "Edit")] + public Edit Edit { get; set; } + [XmlElement(ElementName = "Save")] + public Save Save { get; set; } + [XmlElement(ElementName = "WAV")] + public WAV WAV { get; set; } + [XmlElement(ElementName = "ShowHide")] + public ShowHide ShowHide { get; set; } + [XmlElement(ElementName = "Grid")] + public Grid Grid { get; set; } + [XmlElement(ElementName = "WaveForm")] + public WaveForm WaveForm { get; set; } + [XmlElement(ElementName = "Player")] + public Players Players { get; set; } + [XmlElement(ElementName = "Columns")] + public Columns Columns { get; set; } + [XmlElement(ElementName = "VisualSettings")] + public VisualSettings VisualSettings { get; set; } + [XmlAttribute(AttributeName = "Major")] + public string Major { get; set; } + [XmlAttribute(AttributeName = "Minor")] + public string Minor { get; set; } + [XmlAttribute(AttributeName = "Build")] + public string Build { get; set; } + } + +} diff --git a/Qwilight/app.manifest b/Qwilight/app.manifest new file mode 100644 index 0000000..47dc036 --- /dev/null +++ b/Qwilight/app.manifest @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + true + permonitorv2 + true + + + + + + + + diff --git a/Qwilight/protoc-gen-js.exe b/Qwilight/protoc-gen-js.exe new file mode 100644 index 0000000..586cc3d --- /dev/null +++ b/Qwilight/protoc-gen-js.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebdfd095c2d68aa3d8c9ec5b5bc2ee7f053c759c5a6978dcc701b27a6f3f5f86 +size 2860032 diff --git a/Qwilight/protoc.cmd b/Qwilight/protoc.cmd new file mode 100644 index 0000000..7d0c6f5 --- /dev/null +++ b/Qwilight/protoc.cmd @@ -0,0 +1,3 @@ +protoc --plugin=.\protoc-gen-js --csharp_out=Qwilight --java_out=../../../../IdeaProjects/Twilight/src/main/java --kotlin_out=../../../../IdeaProjects/Twilight/src/main/kotlin --js_out=import_style=commonjs,binary:../../taehui/qwilight-fe/src Event.proto +protoc --csharp_out=Qwilight --java_out=../../../../IdeaProjects/Twilight/src/main/java --kotlin_out=../../../../IdeaProjects/Twilight/src/main/kotlin Comment.proto +PAUSE \ No newline at end of file diff --git a/Qwilight/protoc.exe b/Qwilight/protoc.exe new file mode 100644 index 0000000..7ebb219 --- /dev/null +++ b/Qwilight/protoc.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:940790b62b3c5c1fa783926e0eb2323b7ca20ed4910abe2a0ee136e0a9619606 +size 11554537 diff --git a/Qwilight/sdk/tools/ContentBuilder/scripts/simple_app_build.vdf b/Qwilight/sdk/tools/ContentBuilder/scripts/simple_app_build.vdf new file mode 100644 index 0000000..7b4d5f4 --- /dev/null +++ b/Qwilight/sdk/tools/ContentBuilder/scripts/simple_app_build.vdf @@ -0,0 +1,21 @@ +"AppBuild" +{ + "AppID" "1910130" // your AppID + "Desc" "This is a simple build script" // internal description for this build + + "ContentRoot" "..\..\..\..\bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64\publish\" // root content folder, relative to location of this file + "BuildOutput" "..\output\" // build output folder for build logs and build cache files + + "Depots" + { + "1910131" // your DepotID + { + "FileMapping" + { + "LocalPath" "*" // all files from contentroot folder + "DepotPath" "." // mapped into the root of the depot + "recursive" "1" // include all subfolders + } + } + } +} \ No newline at end of file diff --git a/Test/Test.csproj b/Test/Test.csproj new file mode 100644 index 0000000..6adbe11 --- /dev/null +++ b/Test/Test.csproj @@ -0,0 +1,41 @@ + + + net7.0-windows10.0.22621.0 + enable + enable + false + true + x64;ARM64 + true + + + + $(DefineConstants);X64 + x64 + win10-x64 + + + + $(DefineConstants);ARM64 + ARM64 + win10-arm64 + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + diff --git a/Test/Test/Compiler/CompilerTest.cs b/Test/Test/Compiler/CompilerTest.cs new file mode 100644 index 0000000..8d5a745 --- /dev/null +++ b/Test/Test/Compiler/CompilerTest.cs @@ -0,0 +1,62 @@ +using Qwilight; +using Qwilight.Compiler; +using Qwilight.Compute; +using Qwilight.NoteFile; +using Qwilight.UIComponent; +using Qwilight.Utilities; +using Qwilight.ViewModel; +using System.Text; +using Xunit; + +namespace Test.Compiler +{ + [Collection("Test")] + public sealed class CompilerTest + { + [Fact] + public void Compile() + { + ViewModels.Instance.MainValue.ModeComponentValue.Salt = 0; + var defaultEntryItem = new DefaultEntryItem(); + Parallel.ForEach(Utility.GetFiles(QwilightComponent.BundleEntryPath).Where(noteFilePath => QwilightComponent.NoteFileFormats.Any(format => noteFilePath.EndsWith(format, StringComparison.InvariantCultureIgnoreCase))).SelectMany(noteFilePath => BaseNoteFile.GetNoteFiles(noteFilePath, defaultEntryItem, new EntryItem + { + DefaultEntryItem = defaultEntryItem, + EntryPath = Path.GetDirectoryName(noteFilePath) + }, -1)).ToArray(), noteFile => + { + var targetCompiler = BaseCompiler.GetCompiler(noteFile, null); + var defaultComputer = new TestCompute(noteFile); + targetCompiler.Compile(defaultComputer); + var lines = File.ReadAllLines(Path.ChangeExtension(noteFile.NoteFilePath, ".txt"), Encoding.UTF8); + Assert.Equal(defaultComputer.IsAutoLongNote.ToString(), lines[0]); + Assert.Equal(defaultComputer.IsBanned.ToString(), lines[1]); + Assert.Equal(defaultComputer.InputMode.ToString(), lines[2]); + Assert.Equal(defaultComputer.Genre, lines[3]); + Assert.Equal(defaultComputer.Artist, lines[4]); + Assert.Equal(defaultComputer.Title, lines[5]); + Assert.Equal(defaultComputer.LevelText, lines[6]); + Assert.Equal(defaultComputer.LevelTextValue.ToString(), lines[7]); + Assert.Equal(defaultComputer.LevyingBPM.ToString(), lines[8]); + Assert.Equal(defaultComputer.BPM.ToString(), lines[9]); + Assert.Equal(defaultComputer.Length.ToString(), lines[10]); + Assert.Equal(defaultComputer.TotalNotes.ToString(), lines[11]); + Assert.Equal(defaultComputer.AutoableNotes.ToString(), lines[12]); + Assert.Equal(defaultComputer.TrapNotes.ToString(), lines[13]); + Assert.Equal(defaultComputer.LongNotes.ToString(), lines[14]); + Assert.Equal(defaultComputer.JudgmentStage.ToString(), lines[15]); + Assert.Equal(defaultComputer.HitPointsValue.ToString(), lines[16]); + Assert.Equal(defaultComputer.LevelValue.ToString(), lines[17]); + Assert.Equal(defaultComputer.NoteDrawingName, lines[18]); + Assert.Equal(defaultComputer.BannerDrawingName, lines[19]); + Assert.Equal(defaultComputer.TrailerAudioName, lines[20]); + Assert.Equal(defaultComputer.AudioLevyingPosition.ToString(), lines[21]); + Assert.Equal(defaultComputer.IsSalt.ToString(), lines[22]); + Assert.Equal(defaultComputer.Tag, lines[23]); + Assert.Equal(defaultComputer.LowestBPM.ToString(), lines[24]); + Assert.Equal(defaultComputer.HighestBPM.ToString(), lines[25]); + Assert.Equal(defaultComputer.HighestInputCount.ToString(), lines[26]); + Assert.Equal(defaultComputer.IsHellBPM.ToString(), lines[27]); + }); + } + } +} diff --git a/Test/Test/System/BaseUI/BaseUITest.cs b/Test/Test/System/BaseUI/BaseUITest.cs new file mode 100644 index 0000000..c0e4099 --- /dev/null +++ b/Test/Test/System/BaseUI/BaseUITest.cs @@ -0,0 +1,20 @@ +using Qwilight; +using Xunit; + +namespace Test +{ + [Collection("Test")] + public sealed class BaseUITest + { + [Fact] + public void LoadUI() + { + BaseUI.Instance.LoadUIFiles(); + foreach (var value in BaseUI.Instance.UIItems) + { + BaseUI.Instance.LoadUI(null, value, false); + Assert.Null(BaseUI.Instance.FaultText); + } + } + } +} diff --git a/Test/Test/System/UI/UITest.cs b/Test/Test/System/UI/UITest.cs new file mode 100644 index 0000000..ba02f42 --- /dev/null +++ b/Test/Test/System/UI/UITest.cs @@ -0,0 +1,20 @@ +using Qwilight; +using Xunit; + +namespace Test +{ + [Collection("Test")] + public sealed class UITest + { + [Fact] + public void LoadUI() + { + UI.Instance.LoadUIFiles(); + foreach (var value in UI.Instance.UIItems) + { + UI.Instance.LoadUI(null, value, false); + Assert.Null(UI.Instance.FaultText); + } + } + } +} diff --git a/Test/Test/Test.cs b/Test/Test/Test.cs new file mode 100644 index 0000000..6c3a88a --- /dev/null +++ b/Test/Test/Test.cs @@ -0,0 +1,66 @@ +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.Windows.ApplicationModel.DynamicDependency; +using Moq; +using Qwilight; +using Qwilight.ViewModel; +using System.Text; +using Windows.UI; +using Xunit; + +namespace Test +{ + [CollectionDefinition("Test")] + public sealed class TestCollection : ICollectionFixture + { + } + + public sealed class Test + { + public Test() + { + Bootstrap.Initialize(65540U); + + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + + HandlingUISystem.Instance.Init(e => { }); + + var audioSystem = new Mock(); + audioSystem.Setup(arg => arg.Init()); + + var drawingSystem = new Mock(); + drawingSystem.Setup(arg => arg.Init()); + drawingSystem.Setup(arg => arg.GetFont()).Returns(new CanvasTextFormat()); + drawingSystem.Setup(arg => arg.SetFaintPaints(It.IsAny(), It.IsAny(), It.IsAny())); + drawingSystem.Setup(arg => arg.SetFontFamily(It.IsAny())); + drawingSystem.Setup(arg => arg.SetFontLevel(It.IsAny(), It.IsAny())); + drawingSystem.Setup(arg => arg.SetFontSystem(It.IsAny(), It.IsAny(), It.IsAny())); + + QwilightComponent.OnGetBuiltInData = data => data switch + { + nameof(DB) => new DB(), + nameof(AudioSystem) => audioSystem.Object, + nameof(DrawingSystem) => drawingSystem.Object, + nameof(LanguageSystem) => new LanguageSystem(), + nameof(Configure) => new Configure(), + nameof(ViewModels) => new ViewModels(), + nameof(UI) => new UI(), + nameof(BaseUI) => new BaseUI(), + nameof(TwilightSystem) => new TwilightSystem(), + nameof(ControllerSystem) => new ControllerSystem(), + nameof(MIDISystem) => new MIDISystem(), + _ => default + }; + + Directory.CreateDirectory(QwilightComponent.BundleEntryPath); + Directory.CreateDirectory(QwilightComponent.CommentEntryPath); + Directory.CreateDirectory(QwilightComponent.EdgeEntryPath); + Directory.CreateDirectory(QwilightComponent.FaultEntryPath); + Directory.CreateDirectory(QwilightComponent.MediaEntryPath); + Directory.CreateDirectory(LevelSystem.EntryPath); + + Configure.Instance.Load(); + DB.Instance.Load(); + } + } +} diff --git a/Test/Test/Utilities/ColorUtilityTest.cs b/Test/Test/Utilities/ColorUtilityTest.cs new file mode 100644 index 0000000..9eda15c --- /dev/null +++ b/Test/Test/Utilities/ColorUtilityTest.cs @@ -0,0 +1,34 @@ +using Microsoft.UI; +using Qwilight.Utilities; +using Xunit; + +namespace Test.Utilities +{ + [Collection("Test")] + public sealed class ColorUtilityTest + { + [Fact] + public void ModifyColor() + { + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Black), Colors.Black); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Red), Colors.Red); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Orange), Colors.Orange); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Yellow), Colors.Yellow); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Green), Colors.Green); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Blue), Colors.Blue); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Indigo), Colors.Indigo); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.Purple), Colors.Purple); + Assert.Equal(Utility.ModifyColor(System.Windows.Media.Colors.White), Colors.White); + + Assert.Equal(Utility.ModifyColor(Colors.Black), System.Windows.Media.Colors.Black); + Assert.Equal(Utility.ModifyColor(Colors.Red), System.Windows.Media.Colors.Red); + Assert.Equal(Utility.ModifyColor(Colors.Orange), System.Windows.Media.Colors.Orange); + Assert.Equal(Utility.ModifyColor(Colors.Yellow), System.Windows.Media.Colors.Yellow); + Assert.Equal(Utility.ModifyColor(Colors.Green), System.Windows.Media.Colors.Green); + Assert.Equal(Utility.ModifyColor(Colors.Blue), System.Windows.Media.Colors.Blue); + Assert.Equal(Utility.ModifyColor(Colors.Indigo), System.Windows.Media.Colors.Indigo); + Assert.Equal(Utility.ModifyColor(Colors.Purple), System.Windows.Media.Colors.Purple); + Assert.Equal(Utility.ModifyColor(Colors.White), System.Windows.Media.Colors.White); + } + } +} diff --git a/Test/Test/Utilities/DateUtilityTest.cs b/Test/Test/Utilities/DateUtilityTest.cs new file mode 100644 index 0000000..2374744 --- /dev/null +++ b/Test/Test/Utilities/DateUtilityTest.cs @@ -0,0 +1,30 @@ +using Qwilight.Utilities; +using Xunit; + +namespace Test.Utilities +{ + [Collection("Test")] + public sealed class DateUtilityTest + { + [Fact] + public void IsLowerDate() + { + Assert.False(Utility.IsLowerDate(new Version(1, 0, 0), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(1, 0, 1), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(1, 1, 0), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(1, 1, 1), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(2, 0, 0), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(2, 0, 1), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(2, 1, 0), 1, 0, 0)); + Assert.False(Utility.IsLowerDate(new Version(2, 1, 1), 1, 0, 0)); + + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 1, 0, 1)); + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 1, 1, 0)); + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 1, 1, 1)); + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 2, 0, 0)); + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 2, 0, 1)); + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 2, 1, 0)); + Assert.True(Utility.IsLowerDate(new Version(1, 0, 0), 2, 1, 1)); + } + } +} diff --git a/Test/Test/Utilities/UtilityTest.cs b/Test/Test/Utilities/UtilityTest.cs new file mode 100644 index 0000000..b937f13 --- /dev/null +++ b/Test/Test/Utilities/UtilityTest.cs @@ -0,0 +1,97 @@ +using Qwilight.Compute; +using Qwilight.Utilities; +using Xunit; + +namespace Test.Utilities +{ + [Collection("Test")] + public sealed class UtilityTest + { + [Fact] + public void GetFavoriteItem() + { + Assert.Equal(9, Utility.GetFavoriteItem(new List + { + 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9 + })); + } + + [Fact] + public void GetQuitStatusValue() + { + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.0, 0, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.D, Utility.GetQuitStatusValue(0.0, 0, 1.0, 1)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.8, 0, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.C, Utility.GetQuitStatusValue(0.8, 0, 1.0, 1)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.85, 0, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.B, Utility.GetQuitStatusValue(0.85, 0, 1.0, 1)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.9, 0, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.A, Utility.GetQuitStatusValue(0.9, 0, 1.0, 1)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.95, 0, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.APlus, Utility.GetQuitStatusValue(0.95, 0, 1.0, 1)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.95, 900000, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.S, Utility.GetQuitStatusValue(0.95, 900000, 1.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.APlus, Utility.GetQuitStatusValue(0.95, 900000, 1.0, 2)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(1.0, 900000, 0.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.SPlus, Utility.GetQuitStatusValue(1.0, 900000, 1.0, 1)); + Assert.Equal(DefaultCompute.QuitStatus.APlus, Utility.GetQuitStatusValue(1.0, 900000, 1.0, 2)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(0.95, 1800000, 0.0, 2)); + Assert.Equal(DefaultCompute.QuitStatus.S, Utility.GetQuitStatusValue(0.95, 1800000, 1.0, 2)); + + Assert.Equal(DefaultCompute.QuitStatus.F, Utility.GetQuitStatusValue(1.0, 1800000, 0.0, 2)); + Assert.Equal(DefaultCompute.QuitStatus.SPlus, Utility.GetQuitStatusValue(1.0, 1800000, 1.0, 2)); + } + + [Fact] + public void CompileSiteYells() + { + Assert.Equal("http://taehui.ddns.net", Utility.CompileSiteYells("http://taehui.ddns.net")); + Assert.Equal("https://taehui.ddns.net", Utility.CompileSiteYells("https://taehui.ddns.net")); + Assert.Equal("mailto://taehui@taehui.ddns.net", Utility.CompileSiteYells("mailto://taehui@taehui.ddns.net")); + Assert.Equal(string.Empty, Utility.CompileSiteYells("taehui.ddns.net")); + } + + [Fact] + public void Into() + { + var valueMap = new Dictionary>(); + + Utility.Into(valueMap, 0, 0); + Assert.Single(valueMap); + Assert.Single(valueMap[0]); + Utility.Into(valueMap, 0, 1); + Assert.Single(valueMap); + Assert.Equal(2, valueMap[0].Count); + Utility.Into(valueMap, 0, 2); + Assert.Single(valueMap); + Assert.Equal(3, valueMap[0].Count); + + Utility.Into(valueMap, 1, 0); + Assert.Equal(2, valueMap.Count); + Assert.Single(valueMap[1]); + Utility.Into(valueMap, 1, 1); + Assert.Equal(2, valueMap.Count); + Assert.Equal(2, valueMap[1].Count); + Utility.Into(valueMap, 1, 2); + Assert.Equal(2, valueMap.Count); + Assert.Equal(3, valueMap[1].Count); + + Utility.Into(valueMap, 2, 0); + Assert.Equal(3, valueMap.Count); + Assert.Single(valueMap[2]); + Utility.Into(valueMap, 2, 1); + Assert.Equal(3, valueMap.Count); + Assert.Equal(2, valueMap[2].Count); + Utility.Into(valueMap, 2, 2); + Assert.Equal(3, valueMap.Count); + Assert.Equal(3, valueMap[2].Count); + } + } +} diff --git a/Xwindow/Xwindow.cpp b/Xwindow/Xwindow.cpp new file mode 100644 index 0000000..52e508d --- /dev/null +++ b/Xwindow/Xwindow.cpp @@ -0,0 +1,49 @@ +#include + +#pragma comment(lib, "shlwapi") + +#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") + +using namespace std; + +LRESULT lpfn(int code, WPARAM wParam, LPARAM lParam) { + auto vkCode = ((KBDLLHOOKSTRUCT*)lParam)->vkCode; + return vkCode == VK_LWIN || vkCode == VK_RWIN ? TRUE : FALSE; +} + +DWORD lpStartAddress(LPVOID lpThreadParameter) { + auto idThread = (DWORD*)lpThreadParameter; + while (true) + { + if (!PathFileExists(__wargv[1]) || DeleteFileW(__wargv[1])) { + PostThreadMessage(*idThread, WM_QUIT, NULL, NULL); + } + Sleep(1000); + } + + return EXIT_SUCCESS; +} + +int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { + SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + + if (__argc < 2 || !PathFileExists(__wargv[1]) || DeleteFileW(__wargv[1])) { + MessageBoxW(NULL, L"Cannot run Xwindow alone", L"Qwilight", MB_ICONWARNING); + return EXIT_FAILURE; + } + + auto hhk = SetWindowsHookExW(WH_KEYBOARD_LL, lpfn, NULL, NULL); + + auto idThread = GetCurrentThreadId(); + CreateThread(NULL, 0, lpStartAddress, &idThread, 0, NULL); + + MSG msg; + while (GetMessage(&msg, NULL, NULL, NULL)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + UnhookWindowsHookEx(hhk); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/Xwindow/Xwindow.ico b/Xwindow/Xwindow.ico new file mode 100644 index 0000000..6761de8 --- /dev/null +++ b/Xwindow/Xwindow.ico Binary files differ diff --git a/Xwindow/Xwindow.rc b/Xwindow/Xwindow.rc new file mode 100644 index 0000000..e4882cb --- /dev/null +++ b/Xwindow/Xwindow.rc Binary files differ diff --git a/Xwindow/Xwindow.vcxproj b/Xwindow/Xwindow.vcxproj new file mode 100644 index 0000000..af63477 --- /dev/null +++ b/Xwindow/Xwindow.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + ARM64 + + + Debug + x64 + + + Release + ARM64 + + + Release + x64 + + + + 16.0 + Win32Proj + {40df1ca3-b540-43f4-9302-f4663f21c466} + Xwindow + 10.0 + + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + + + true + $(Platform)\$(Configuration)\ + + + true + $(Platform)\$(Configuration)\ + + + false + $(Platform)\$(Configuration)\ + + + false + $(Platform)\$(Configuration)\ + + + + Level3 + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + + + + + Level3 + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + + + + + Level3 + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + true + true + + + + + Level3 + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Xwindow/resource.h b/Xwindow/resource.h new file mode 100644 index 0000000..dd7f0ce --- /dev/null +++ b/Xwindow/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++���� ������ ���� �����Դϴ�. +// Xwindow.rc���� ���ǰ� �ֽ��ϴ�. +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif