diff --git a/.gitignore b/.gitignore index b53e532..8afdcb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,87 @@ ## 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 -.vs/ +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* # Build results - [Dd]ebug/ +[Dd]ebugPublic/ [Rr]elease/ +[Rr]eleases/ x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ [Bb]in/ [Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# 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 +nunit-*.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/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio *_i.c *_p.c -*_i.h +*_h.h *.ilk *.meta *.obj +*.iobj *.pch *.pdb +*.ipdb *.pgc *.pgd *.rsp @@ -37,27 +91,40 @@ x64/ *.tlh *.tmp *.tmp_proj +*_wpftmp.csproj *.log *.vspscc *.vssscc .builds *.pidb -*.log *.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 @@ -67,69 +134,321 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# 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 -*.Publish.xml -*.pubxml +*.[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 -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -packages/ -## TODO: If the tool you use requires repositories.config, also uncomment the next line -!packages/repositories.config +# 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/ -# Windows Azure Build Output +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# 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 -# Windows Store app package directory +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ # Others -sql/ -*.Cache ClientBin/ -[Ss]tyle[Cc]op.* -![Ss]tyle[Cc]op.targets ~$* *~ *.dbmdl -*.[Pp]ublish.xml - +*.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 ;-) +# 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 -App_Data/*.mdf -App_Data/*.ldf +*.mdf +*.ldf +*.ndf -# ========================= -# Windows detritus -# ========================= +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl -# Windows image file caches +# 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/ + +# 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 + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files Thumbs.db ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump # Folder config file -Desktop.ini +[Dd]esktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ -# Mac desktop service store files -.DS_Store +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp -_NCrunch* \ No newline at end of file +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..5d8722e --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,6 @@ + + + enable + 11.0.2 + + diff --git a/ServerSelector.Desktop/Program.cs b/ServerSelector.Desktop/Program.cs new file mode 100644 index 0000000..317854a --- /dev/null +++ b/ServerSelector.Desktop/Program.cs @@ -0,0 +1,24 @@ +using System; + +using Avalonia; +using Avalonia.ReactiveUI; + +namespace ServerSelector.Desktop; + +class Program +{ + // Initialization code. Don't use any Avalonia, third-party APIs or any + // SynchronizationContext-reliant code before AppMain is called: things aren't initialized + // yet and stuff might break. + [STAThread] + public static void Main(string[] args) => BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); + + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .WithInterFont() + .LogToTrace() + .UseReactiveUI(); +} diff --git a/ServerSelector.Desktop/ServerSelector.Desktop.csproj b/ServerSelector.Desktop/ServerSelector.Desktop.csproj new file mode 100644 index 0000000..88057f7 --- /dev/null +++ b/ServerSelector.Desktop/ServerSelector.Desktop.csproj @@ -0,0 +1,20 @@ + + + WinExe + + net8.0 + enable + true + app.manifest + True + + + + + + + + + + diff --git a/ServerSelector.Desktop/app.manifest b/ServerSelector.Desktop/app.manifest new file mode 100644 index 0000000..e0ce8d0 --- /dev/null +++ b/ServerSelector.Desktop/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/ServerSelector/App.axaml b/ServerSelector/App.axaml new file mode 100644 index 0000000..9fc9a59 --- /dev/null +++ b/ServerSelector/App.axaml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ServerSelector/App.axaml.cs b/ServerSelector/App.axaml.cs new file mode 100644 index 0000000..3e3f94a --- /dev/null +++ b/ServerSelector/App.axaml.cs @@ -0,0 +1,36 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; + +using ServerSelector.ViewModels; +using ServerSelector.Views; + +namespace ServerSelector; + +public partial class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new MainWindow + { + DataContext = new MainViewModel() + }; + } + else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) + { + singleViewPlatform.MainView = new MainView + { + DataContext = new MainViewModel() + }; + } + + base.OnFrameworkInitializationCompleted(); + } +} diff --git a/ServerSelector/Assets/avalonia-logo.ico b/ServerSelector/Assets/avalonia-logo.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/ServerSelector/Assets/avalonia-logo.ico differ diff --git a/ServerSelector/ServerSelector.csproj b/ServerSelector/ServerSelector.csproj new file mode 100644 index 0000000..d705e14 --- /dev/null +++ b/ServerSelector/ServerSelector.csproj @@ -0,0 +1,36 @@ + + + net8.0 + enable + latest + + + + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + Always + + + diff --git a/ServerSelector/ServerSwitcher.cs b/ServerSelector/ServerSwitcher.cs new file mode 100644 index 0000000..a446ba2 --- /dev/null +++ b/ServerSelector/ServerSwitcher.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace ServerSelector +{ + public class ServerSwitcher + { + public static bool IsUsingOfficalServer() + { + var hostsFile = File.ReadAllText("C:\\Windows\\System32\\drivers\\etc\\hosts"); + return !hostsFile.Contains("cloud.nikke-kr.com"); + } + + public static void SaveCfg(bool useOffical, string gamePath, string launcherPath) + { + string sodiumLib = AppDomain.CurrentDomain.BaseDirectory + "sodium.dll"; + string gameSodium = gamePath + "/nikke_Data/Plugins/x86_64/sodium.dll"; + string sodiumBackup = gameSodium + ".bak"; + string hostsFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "drivers/etc/hosts"); + var CAcert = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "myCA.pem"); + + string launcherCertList = launcherPath + "/intl_service/cacert.pem"; + string gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/cacert.pem"; + + + // TODO: allow changing ip address + if (useOffical) + { + var txt = File.ReadAllText(hostsFilePath); + + // remove stuff + + int startIdx = txt.IndexOf("127.0.0.1 cloud.nikke-kr.com"); + int endIdx = txt.IndexOf("y.io") + 3; + txt = txt.Substring(0, startIdx) + txt.Substring(endIdx); + + File.WriteAllText(hostsFilePath, txt); + + + // remove cert + X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); + store.Open(OpenFlags.ReadWrite); + store.Remove(new X509Certificate2(X509Certificate2.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx"))); + store.Close(); + + // restore sodium + if (!File.Exists(sodiumBackup)) + { + throw new Exception("sodium backup does not exist"); + } + File.Copy(sodiumBackup, gameSodium, true); + } + else + { + // add to hosts file + string hosts = @"127.0.0.1 cloud.nikke-kr.com +127.0.0.1 global-lobby.nikke-kr.com +127.0.0.1 aws-na-dr.intlgame.com +127.0.0.1 sg-vas.intlgame.com +127.0.0.1 aws-na.intlgame.com +127.0.0.1 common-web.intlgame.com +127.0.0.1 li-sg.intlgame.com +127.0.0.1 data-aws-na.intlgame.com +255.255.221.21 sentry.io"; + + if (!File.ReadAllText(hostsFilePath).Contains("global-lobby.nikke-kr.com")) + { + using StreamWriter w = File.AppendText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "drivers/etc/hosts")); + w.WriteLine(hosts); + } + + + // trust CA + X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); + store.Open(OpenFlags.ReadWrite); + store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx"))); + store.Close(); + + // update sodium lib + + if (!File.Exists(gameSodium)) + { + throw new Exception("expected sodium library to exist at path " + gameSodium); + } + + // copy backup if sodium size is correct + var sod = File.ReadAllBytes(gameSodium); + if (sod.Length <= 307200) + { + // orignal file size, copy backup + File.WriteAllBytes(sodiumBackup, sod); + } + + // write new sodium library + File.WriteAllBytes(gameSodium, File.ReadAllBytes(sodiumLib)); + + + // update launcher/game ca cert list + + var certList1 = File.ReadAllText(launcherCertList); + certList1 += "\nGood SSL Ca\n===============================\n"; + certList1 += CAcert; + File.WriteAllText(launcherCertList, certList1); + + var certList2 = File.ReadAllText(gameCertList); + certList2 += "\nGood SSL Ca\n===============================\n"; + certList2 += CAcert; + File.WriteAllText(gameCertList, certList2); + } + } + } +} diff --git a/ServerSelector/ViewModels/MainViewModel.cs b/ServerSelector/ViewModels/MainViewModel.cs new file mode 100644 index 0000000..3ddb391 --- /dev/null +++ b/ServerSelector/ViewModels/MainViewModel.cs @@ -0,0 +1,6 @@ +namespace ServerSelector.ViewModels; + +public class MainViewModel : ViewModelBase +{ + public string Greeting => "Welcome to Avalonia!"; +} diff --git a/ServerSelector/ViewModels/ViewModelBase.cs b/ServerSelector/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..c1afccd --- /dev/null +++ b/ServerSelector/ViewModels/ViewModelBase.cs @@ -0,0 +1,7 @@ +using ReactiveUI; + +namespace ServerSelector.ViewModels; + +public class ViewModelBase : ReactiveObject +{ +} diff --git a/ServerSelector/Views/MainView.axaml b/ServerSelector/Views/MainView.axaml new file mode 100644 index 0000000..68778bb --- /dev/null +++ b/ServerSelector/Views/MainView.axaml @@ -0,0 +1,42 @@ + + + + + + + + + Game path: + C:\NIKKE\NIKKE\game + + + + Launcher path: + C:\NIKKE\Launcher + + + + + Server: + + + + Official + Local + + + + + + + + diff --git a/ServerSelector/Views/MainView.axaml.cs b/ServerSelector/Views/MainView.axaml.cs new file mode 100644 index 0000000..793b126 --- /dev/null +++ b/ServerSelector/Views/MainView.axaml.cs @@ -0,0 +1,37 @@ +using Avalonia.Controls; +using System; +using System.Runtime.InteropServices; +using System.Security.Principal; + +namespace ServerSelector.Views; + +public partial class MainView : UserControl +{ + public MainView() + { + InitializeComponent(); + CmbServerSelection.SelectedIndex = ServerSwitcher.IsUsingOfficalServer() ? 0 : 1; + } + + private void Save_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) + { + try + { + ServerSwitcher.SaveCfg(CmbServerSelection.SelectedIndex == 0, txtGamePath.Text, txtLauncherPath.Text); + } + catch(Exception ex) + { + ShowWarningMsg("Failed to save configuration: " + ex.ToString(), "Error"); + } + } + + // for some stupid reason avalonia does not support message boxes. + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type); + + public static void ShowWarningMsg(string text, string title) + { + MessageBox(IntPtr.Zero, text, title, 0x00000030); + } +} diff --git a/ServerSelector/Views/MainWindow.axaml b/ServerSelector/Views/MainWindow.axaml new file mode 100644 index 0000000..7f4ea9e --- /dev/null +++ b/ServerSelector/Views/MainWindow.axaml @@ -0,0 +1,12 @@ + + + diff --git a/ServerSelector/Views/MainWindow.axaml.cs b/ServerSelector/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..6a5f0fb --- /dev/null +++ b/ServerSelector/Views/MainWindow.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace ServerSelector.Views; + +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } +} diff --git a/ServerSelector/myCA.pem b/ServerSelector/myCA.pem new file mode 100644 index 0000000..d8827a1 --- /dev/null +++ b/ServerSelector/myCA.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDazCCAlOgAwIBAgIUZtfukOBnP/EnpNeODfZtnJychpQwDQYJKoZIhvcNAQEL +BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA3MDMyMDA0MzdaFw0yNjEw +MDYyMDA0MzdaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw +HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDGD6bSRP60u1ZYB3HpfrTa4aw+C0cVcez2vIz5Kyy7 +DeMsNy4BA9mW+jhb+fU2UcrfS/890mHGTKWMeJqBL4kHo6jQdvaq9EP7JfQezDPi +6Qzro/En1ruscn8ckZ46jskNjsKgy/YaitAvRt2zUrVfdNIT1l7IPYCARUw9t+FE +UQJXVqmQEWX0gx1zv49uqZdNVeKraZzQim+18h8LmHfAeUN3251dIlQgX727O/pe +TTMNigtgBmKs29++DwIBwi1uIcM2nr/jyBrBGSDEdknKlWNLYD8WVLjnHYheID4f +0xDQBOP7eN+FLaCAI/dkxaUcWfLG0jVxQl+YQxWe0eoxAgMBAAGjUzBRMB0GA1Ud +DgQWBBR3fQt9iIxxmWUJdaDUvkQo1g2mKTAfBgNVHSMEGDAWgBR3fQt9iIxxmWUJ +daDUvkQo1g2mKTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB8 +3HwhH1HmKdZpqSsHLmKt4tW7FCpcjrG29WzKMUi5POIGlgqI1MfO5QLe8IUGEVhK +uosOrZmDH5kF8aIGqHYii/o/MHw2p6eHg49hsKRQEU8trN5r3GQbZL0ce0hDTQL0 +dVntSJJ4Pb+Qgm20P4sDPEoFoQ1u2utsYztW6wpw0ksTJtcO2BfMQM/k7egJEv/S +ZRhhl6yA131AI5JSHk3SnUQ/xL1kGL2p6Wixo9accLAcej00+gaDNgxHw1F6OjUt ++XsO807Rqx3TnQwHZyHSijFxSId2JLEO7oCkNeDuuKlU7rb4sh0YIYWWZgS/dG0n +jEOkU1vp7loFpqFdWYVy +-----END CERTIFICATE----- diff --git a/ServerSelector/sodium.dll b/ServerSelector/sodium.dll new file mode 100644 index 0000000..5546e97 Binary files /dev/null and b/ServerSelector/sodium.dll differ diff --git a/nksrv.sln b/nksrv.sln index 62226a8..089bf40 100644 --- a/nksrv.sln +++ b/nksrv.sln @@ -7,16 +7,28 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nksrv", "nksrv\nksrv.csproj EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataFixupUtil", "DataFixupUtil\DataFixupUtil.csproj", "{13124DFB-448B-4F4F-A479-537EE067D836}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtobufViewUtil", "ProtobufViewUtil\ProtobufViewUtil.csproj", "{FDEDD0D6-9C02-4E58-8110-04E8D5639881}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtobufViewUtil", "ProtobufViewUtil\ProtobufViewUtil.csproj", "{FDEDD0D6-9C02-4E58-8110-04E8D5639881}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerSelector", "ServerSelector\ServerSelector.csproj", "{EC613C24-8A35-42E8-92C1-9A8431F74F58}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerSelector.Desktop", "ServerSelector.Desktop\ServerSelector.Desktop.csproj", "{01D0A73A-A881-439D-9318-54DB5B00D6F5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + DebugDLL|Any CPU = DebugDLL|Any CPU + DebugDLL|x64 = DebugDLL|x64 + DebugDLL|x86 = DebugDLL|x86 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 + ReleaseDLL|Any CPU = ReleaseDLL|Any CPU + ReleaseDLL|x64 = ReleaseDLL|x64 + ReleaseDLL|x86 = ReleaseDLL|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -25,40 +37,128 @@ Global {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Debug|x64.Build.0 = Debug|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Debug|x86.ActiveCfg = Debug|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Debug|x86.Build.0 = Debug|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.DebugDLL|Any CPU.ActiveCfg = Debug|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.DebugDLL|Any CPU.Build.0 = Debug|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.DebugDLL|x64.ActiveCfg = Debug|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.DebugDLL|x64.Build.0 = Debug|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.DebugDLL|x86.ActiveCfg = Debug|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.DebugDLL|x86.Build.0 = Debug|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Release|Any CPU.ActiveCfg = Release|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Release|Any CPU.Build.0 = Release|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Release|x64.ActiveCfg = Release|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Release|x64.Build.0 = Release|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Release|x86.ActiveCfg = Release|Any CPU {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.Release|x86.Build.0 = Release|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.ReleaseDLL|Any CPU.ActiveCfg = Release|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.ReleaseDLL|Any CPU.Build.0 = Release|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.ReleaseDLL|x64.ActiveCfg = Release|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.ReleaseDLL|x64.Build.0 = Release|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU + {5C24A07E-9B8D-4625-BF91-0E9CCBEF5CB0}.ReleaseDLL|x86.Build.0 = Release|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Debug|Any CPU.Build.0 = Debug|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Debug|x64.ActiveCfg = Debug|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Debug|x64.Build.0 = Debug|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Debug|x86.ActiveCfg = Debug|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Debug|x86.Build.0 = Debug|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.DebugDLL|Any CPU.ActiveCfg = Debug|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.DebugDLL|Any CPU.Build.0 = Debug|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.DebugDLL|x64.ActiveCfg = Debug|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.DebugDLL|x64.Build.0 = Debug|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.DebugDLL|x86.ActiveCfg = Debug|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.DebugDLL|x86.Build.0 = Debug|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Release|Any CPU.ActiveCfg = Release|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Release|Any CPU.Build.0 = Release|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Release|x64.ActiveCfg = Release|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Release|x64.Build.0 = Release|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Release|x86.ActiveCfg = Release|Any CPU {13124DFB-448B-4F4F-A479-537EE067D836}.Release|x86.Build.0 = Release|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.ReleaseDLL|Any CPU.ActiveCfg = Release|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.ReleaseDLL|Any CPU.Build.0 = Release|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.ReleaseDLL|x64.ActiveCfg = Release|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.ReleaseDLL|x64.Build.0 = Release|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU + {13124DFB-448B-4F4F-A479-537EE067D836}.ReleaseDLL|x86.Build.0 = Release|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Debug|Any CPU.Build.0 = Debug|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Debug|x64.ActiveCfg = Debug|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Debug|x64.Build.0 = Debug|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Debug|x86.ActiveCfg = Debug|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Debug|x86.Build.0 = Debug|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.DebugDLL|Any CPU.ActiveCfg = Debug|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.DebugDLL|Any CPU.Build.0 = Debug|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.DebugDLL|x64.ActiveCfg = Debug|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.DebugDLL|x64.Build.0 = Debug|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.DebugDLL|x86.ActiveCfg = Debug|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.DebugDLL|x86.Build.0 = Debug|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Release|Any CPU.ActiveCfg = Release|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Release|Any CPU.Build.0 = Release|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Release|x64.ActiveCfg = Release|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Release|x64.Build.0 = Release|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Release|x86.ActiveCfg = Release|Any CPU {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.Release|x86.Build.0 = Release|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.ReleaseDLL|Any CPU.ActiveCfg = Release|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.ReleaseDLL|Any CPU.Build.0 = Release|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.ReleaseDLL|x64.ActiveCfg = Release|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.ReleaseDLL|x64.Build.0 = Release|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU + {FDEDD0D6-9C02-4E58-8110-04E8D5639881}.ReleaseDLL|x86.Build.0 = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Debug|x64.ActiveCfg = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Debug|x64.Build.0 = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Debug|x86.ActiveCfg = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Debug|x86.Build.0 = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.DebugDLL|Any CPU.ActiveCfg = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.DebugDLL|Any CPU.Build.0 = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.DebugDLL|x64.ActiveCfg = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.DebugDLL|x64.Build.0 = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.DebugDLL|x86.ActiveCfg = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.DebugDLL|x86.Build.0 = Debug|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Release|Any CPU.Build.0 = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Release|x64.ActiveCfg = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Release|x64.Build.0 = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Release|x86.ActiveCfg = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.Release|x86.Build.0 = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.ReleaseDLL|Any CPU.ActiveCfg = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.ReleaseDLL|Any CPU.Build.0 = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.ReleaseDLL|x64.ActiveCfg = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.ReleaseDLL|x64.Build.0 = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU + {EC613C24-8A35-42E8-92C1-9A8431F74F58}.ReleaseDLL|x86.Build.0 = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Debug|x64.ActiveCfg = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Debug|x64.Build.0 = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Debug|x86.ActiveCfg = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Debug|x86.Build.0 = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.DebugDLL|Any CPU.ActiveCfg = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.DebugDLL|Any CPU.Build.0 = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.DebugDLL|x64.ActiveCfg = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.DebugDLL|x64.Build.0 = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.DebugDLL|x86.ActiveCfg = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.DebugDLL|x86.Build.0 = Debug|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Release|Any CPU.Build.0 = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Release|x64.ActiveCfg = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Release|x64.Build.0 = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Release|x86.ActiveCfg = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.Release|x86.Build.0 = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|Any CPU.ActiveCfg = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|Any CPU.Build.0 = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x64.ActiveCfg = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x64.Build.0 = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU + {01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {EC613C24-8A35-42E8-92C1-9A8431F74F58} = {4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0} + {01D0A73A-A881-439D-9318-54DB5B00D6F5} = {4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F779F2DC-B207-4091-83B8-0EA250461DCE} EndGlobalSection diff --git a/nksrv/LobbyServer/Msgs/User/EnterLobbyServer.cs b/nksrv/LobbyServer/Msgs/User/EnterLobbyServer.cs index 83588f7..31b4d47 100644 --- a/nksrv/LobbyServer/Msgs/User/EnterLobbyServer.cs +++ b/nksrv/LobbyServer/Msgs/User/EnterLobbyServer.cs @@ -27,8 +27,8 @@ namespace nksrv.LobbyServer.Msgs.User response.SynchroLv = 1; response.OutpostBattleLevel = user.OutpostBattleLevel; response.OutpostBattleTime = new NetOutpostBattleTime() { MaxBattleTime = 864000000000, MaxOverBattleTime = 12096000000000, BattleTime = battleTimeMs }; - response.CommanderRoomJukeboxBgm = new NetJukeboxBgm() { JukeboxTableId = 8989001, Type = NetJukeboxBgmType.JukeboxTableId, Location = NetJukeboxLocation.CommanderRoom }; - response.LobbyJukeboxBgm = new NetJukeboxBgm() { JukeboxTableId = 8989001, Type = NetJukeboxBgmType.JukeboxTableId, Location = NetJukeboxLocation.Lobby }; + response.CommanderRoomJukeboxBgm = new NetJukeboxBgm() { JukeboxTableId = 10, Type = NetJukeboxBgmType.JukeboxTableId, Location = NetJukeboxLocation.CommanderRoom }; + response.LobbyJukeboxBgm = new NetJukeboxBgm() { JukeboxTableId = 10, Type = NetJukeboxBgmType.JukeboxTableId, Location = NetJukeboxLocation.Lobby }; // Add default slot data if (user.RepresentationTeamData.Slots.Count == 0) diff --git a/nksrv/Program.cs b/nksrv/Program.cs index 2d69dc6..5931e53 100644 --- a/nksrv/Program.cs +++ b/nksrv/Program.cs @@ -49,7 +49,7 @@ namespace nksrv } private static WebServer CreateWebServer() { - var cert = new X509Certificate2(new X509Certificate(@"C:\Users\Misha\nkcert\site.pfx")); + var cert = new X509Certificate2(new X509Certificate(AppDomain.CurrentDomain.BaseDirectory + @"site.pfx")); var server = new WebServer(o => o .WithUrlPrefixes("https://*:443", "http://*:80")