Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eb188321af | |||
| 030f680b96 | |||
| ba8153e6b4 |
@@ -21,7 +21,7 @@ public static class LauncherConVar
|
|||||||
"WizDen",
|
"WizDen",
|
||||||
[
|
[
|
||||||
"https://harpy.durenko.tatar/auth-api/",
|
"https://harpy.durenko.tatar/auth-api/",
|
||||||
"https://auth.fallback.spacestation14.com/"
|
"https://auth.fallback.spacestation14.com/",
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
|
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
|
||||||
<PackageReference Include="libsodium" Version="1.0.20"/>
|
<PackageReference Include="libsodium" Version="1.0.20"/>
|
||||||
|
<PackageReference Include="Robust.Natives" Version="0.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Layout;
|
||||||
|
using Avalonia.Media;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Nebula.Launcher.ViewModels;
|
using Nebula.Launcher.ViewModels;
|
||||||
using Nebula.Launcher.ViewModels.Pages;
|
using Nebula.Launcher.ViewModels.Pages;
|
||||||
|
using Nebula.Launcher.ViewModels.Popup;
|
||||||
using Nebula.Shared;
|
using Nebula.Shared;
|
||||||
using Nebula.Shared.Models;
|
using Nebula.Shared.Models;
|
||||||
using Nebula.Shared.Services;
|
using Nebula.Shared.Services;
|
||||||
@@ -15,7 +20,7 @@ namespace Nebula.Launcher.ServerListProviders;
|
|||||||
public sealed partial class FavoriteServerListProvider : IServerListProvider, IServerListDirtyInvoker
|
public sealed partial class FavoriteServerListProvider : IServerListProvider, IServerListDirtyInvoker
|
||||||
{
|
{
|
||||||
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
|
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
|
||||||
[GenerateProperty] private RestService RestService { get; }
|
[GenerateProperty] private IServiceProvider ServiceProvider { get; }
|
||||||
[GenerateProperty] private ServerViewContainer ServerViewContainer { get; }
|
[GenerateProperty] private ServerViewContainer ServerViewContainer { get; }
|
||||||
|
|
||||||
private List<IFilterConsumer> _serverLists = [];
|
private List<IFilterConsumer> _serverLists = [];
|
||||||
@@ -44,13 +49,15 @@ public sealed partial class FavoriteServerListProvider : IServerListProvider, IS
|
|||||||
ServerViewContainer.Get(s.ToRobustUrl())
|
ServerViewContainer.Get(s.ToRobustUrl())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_serverLists.Add(new AddFavoriteButton(ServiceProvider));
|
||||||
|
|
||||||
IsLoaded = true;
|
IsLoaded = true;
|
||||||
OnLoaded?.Invoke();
|
OnLoaded?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddFavorite(ServerEntryModelView entryModelView)
|
public void AddFavorite(ServerEntryModelView entryModelView)
|
||||||
{
|
{
|
||||||
entryModelView.IsFavorite = true;
|
|
||||||
AddFavorite(entryModelView.Address);
|
AddFavorite(entryModelView.Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +66,7 @@ public sealed partial class FavoriteServerListProvider : IServerListProvider, IS
|
|||||||
var servers = GetFavoriteEntries();
|
var servers = GetFavoriteEntries();
|
||||||
servers.Add(robustUrl.ToString());
|
servers.Add(robustUrl.ToString());
|
||||||
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
|
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
|
||||||
|
ServerViewContainer.Get(robustUrl).IsFavorite = true;
|
||||||
Dirty?.Invoke();
|
Dirty?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,4 +85,27 @@ public sealed partial class FavoriteServerListProvider : IServerListProvider, IS
|
|||||||
|
|
||||||
private void Initialise(){}
|
private void Initialise(){}
|
||||||
private void InitialiseInDesignMode(){}
|
private void InitialiseInDesignMode(){}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AddFavoriteButton: Border, IFilterConsumer{
|
||||||
|
|
||||||
|
private Button _addFavoriteButton = new Button();
|
||||||
|
public AddFavoriteButton(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
Margin = new Thickness(5, 5, 5, 20);
|
||||||
|
Background = new SolidColorBrush(Color.Parse("#222222"));
|
||||||
|
CornerRadius = new CornerRadius(20f);
|
||||||
|
_addFavoriteButton.HorizontalAlignment = HorizontalAlignment.Center;
|
||||||
|
_addFavoriteButton.Click += (sender, args) =>
|
||||||
|
{
|
||||||
|
serviceProvider.GetService<PopupMessageService>()!.Popup(
|
||||||
|
serviceProvider.GetService<AddFavoriteViewModel>()!);
|
||||||
|
};
|
||||||
|
_addFavoriteButton.Content = "Add Favorite";
|
||||||
|
Child = _addFavoriteButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ProcessFilter(ServerFilter? serverFilter)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,12 @@ public partial class MainViewModel : ViewModelBase
|
|||||||
PopupMessageService.OnCloseRequired += OnPopupCloseRequired;
|
PopupMessageService.OnCloseRequired += OnPopupCloseRequired;
|
||||||
|
|
||||||
CheckMigration();
|
CheckMigration();
|
||||||
|
|
||||||
|
if (!VCRuntimeDllChecker.AreVCRuntimeDllsPresent())
|
||||||
|
{
|
||||||
|
OnPopupRequired("VC runtime dlls are not present on this computer. Install VC runtime dlls.");
|
||||||
|
Helper.OpenBrowser("https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckMigration()
|
private void CheckMigration()
|
||||||
@@ -209,4 +215,29 @@ public partial class MainViewModel : ViewModelBase
|
|||||||
|
|
||||||
CurrentPopup = viewModelBase;
|
CurrentPopup = viewModelBase;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class VCRuntimeDllChecker
|
||||||
|
{
|
||||||
|
public static bool AreVCRuntimeDllsPresent()
|
||||||
|
{
|
||||||
|
if (!OperatingSystem.IsWindows()) return true;
|
||||||
|
|
||||||
|
string systemDir = Environment.SystemDirectory;
|
||||||
|
string[] requiredDlls = {
|
||||||
|
"msvcp140.dll",
|
||||||
|
"vcruntime140.dll"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var dll in requiredDlls)
|
||||||
|
{
|
||||||
|
var path = Path.Combine(systemDir, dll);
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Nebula.Launcher.ServerListProviders;
|
||||||
using Nebula.Launcher.ViewModels.Pages;
|
using Nebula.Launcher.ViewModels.Pages;
|
||||||
using Nebula.Launcher.Views.Pages;
|
using Nebula.Launcher.Views.Pages;
|
||||||
using Nebula.Shared.Services;
|
using Nebula.Shared.Services;
|
||||||
@@ -28,6 +29,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
|
|||||||
public override PopupMessageService PopupMessageService { get; }
|
public override PopupMessageService PopupMessageService { get; }
|
||||||
[GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; }
|
[GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; }
|
||||||
[GenerateProperty] private DebugService DebugService { get; }
|
[GenerateProperty] private DebugService DebugService { get; }
|
||||||
|
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
|
||||||
public override string Title => "Add to favorite";
|
public override string Title => "Add to favorite";
|
||||||
public override bool IsClosable => true;
|
public override bool IsClosable => true;
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var uri = IpInput.ToRobustUrl();
|
var uri = IpInput.ToRobustUrl();
|
||||||
|
FavoriteServerListProvider.AddFavorite(uri);
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIDisposable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa6b7f037ba7b44df80b8d3aa7e58eeb2e8e938_003F98_003Fd1b23281_003FIDisposable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIDisposable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa6b7f037ba7b44df80b8d3aa7e58eeb2e8e938_003F98_003Fd1b23281_003FIDisposable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonSerializer_002ERead_002EString_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F27c4858128168eda568c1334d70d5241efb9461e2a3209258a04deee5d9c367_003FJsonSerializer_002ERead_002EString_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonSerializer_002ERead_002EString_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F27c4858128168eda568c1334d70d5241efb9461e2a3209258a04deee5d9c367_003FJsonSerializer_002ERead_002EString_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AListBox_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3a6cdc26ff4d30986a9a16b6bbc9bb6a7f2657431c82cde5c66dd377cf51e2b_003FListBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AListBox_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3a6cdc26ff4d30986a9a16b6bbc9bb6a7f2657431c82cde5c66dd377cf51e2b_003FListBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANativeLibrary_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F88c2c65e1618f68cb5969f70dfc0986e9571015ac8d487b18d26e89c926264_003FNativeLibrary_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANativeLibrary_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F49393f3cda2f9a5c2fa811fc9179dcbaf5bd94d9dc8afc76aaff2bc23287f3_003FNativeLibrary_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObservableCollection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3e2c48e6b3ec8b39cf721287f93972c7f3df25d306753bcc539eaad73126c68_003FObservableCollection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObservableCollection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3e2c48e6b3ec8b39cf721287f93972c7f3df25d306753bcc539eaad73126c68_003FObservableCollection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APanel_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9b699722324e3615b57977447b25bf953fccb2d6e912ae584f16b7e691ad9d3_003FPanel_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APanel_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9b699722324e3615b57977447b25bf953fccb2d6e912ae584f16b7e691ad9d3_003FPanel_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AParallel_002EForEachAsync_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc1d1ed6be2d5d4de542b4af5b36e82f6d1d1a389a35a4e4f9748d137d1c651_003FParallel_002EForEachAsync_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AParallel_002EForEachAsync_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc1d1ed6be2d5d4de542b4af5b36e82f6d1d1a389a35a4e4f9748d137d1c651_003FParallel_002EForEachAsync_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
|||||||
Reference in New Issue
Block a user