- tweak: View autogenerator
This commit is contained in:
6
Nebula.Launcher/Models/Auth/AuthServerCredentials.cs
Normal file
6
Nebula.Launcher/Models/Auth/AuthServerCredentials.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Nebula.Launcher.Models.Auth;
|
||||
|
||||
public sealed record AuthServerCredentials(
|
||||
string Name,
|
||||
string[] Servers
|
||||
);
|
||||
11
Nebula.Launcher/Models/Auth/ProfileAuthCredentials.cs
Normal file
11
Nebula.Launcher/Models/Auth/ProfileAuthCredentials.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Nebula.Launcher.Models.Auth;
|
||||
|
||||
public sealed record ProfileAuthCredentials(
|
||||
string Login,
|
||||
string Password,
|
||||
string AuthServer,
|
||||
[property: JsonIgnore] ICommand OnSelect = default!,
|
||||
[property: JsonIgnore] ICommand OnDelete = default!);
|
||||
32
Nebula.Launcher/Models/ContentLogConsumer.cs
Normal file
32
Nebula.Launcher/Models/ContentLogConsumer.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Nebula.Launcher.ProcessHelper;
|
||||
using Nebula.Launcher.ViewModels.Popup;
|
||||
using Nebula.Shared.Services;
|
||||
|
||||
namespace Nebula.Launcher.Models;
|
||||
|
||||
public sealed class ContentLogConsumer : IProcessLogConsumer
|
||||
{
|
||||
private readonly LogPopupModelView _currLog;
|
||||
private readonly PopupMessageService _popupMessageService;
|
||||
|
||||
public ContentLogConsumer(LogPopupModelView currLog, PopupMessageService popupMessageService)
|
||||
{
|
||||
_currLog = currLog;
|
||||
_popupMessageService = popupMessageService;
|
||||
}
|
||||
|
||||
public void Out(string text)
|
||||
{
|
||||
_currLog.Append(text);
|
||||
}
|
||||
|
||||
public void Error(string text)
|
||||
{
|
||||
_currLog.Append(text);
|
||||
}
|
||||
|
||||
public void Fatal(string text)
|
||||
{
|
||||
_popupMessageService.Popup("Fatal error while stop instance:" + text);
|
||||
}
|
||||
}
|
||||
8
Nebula.Launcher/Models/IFilterConsumer.cs
Normal file
8
Nebula.Launcher/Models/IFilterConsumer.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Nebula.Launcher.ViewModels.Pages;
|
||||
|
||||
namespace Nebula.Launcher.Models;
|
||||
|
||||
public interface IFilterConsumer
|
||||
{
|
||||
public void ProcessFilter(ServerFilter? serverFilter);
|
||||
}
|
||||
40
Nebula.Launcher/Models/LogInfo.cs
Normal file
40
Nebula.Launcher/Models/LogInfo.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Nebula.Launcher.Models;
|
||||
|
||||
public sealed class LogInfo
|
||||
{
|
||||
public string Category { get; set; } = "LOG";
|
||||
public IBrush CategoryColor { get; set; } = Brush.Parse("#424242");
|
||||
public string Message { get; set; } = "";
|
||||
|
||||
public static LogInfo FromString(string input)
|
||||
{
|
||||
var matches = Regex.Matches(input, @"(\[(?<c>.*)\] (?<m>.*))|(?<m>.*)");
|
||||
var category = "All";
|
||||
|
||||
if (matches[0].Groups.TryGetValue("c", out var c)) category = c.Value;
|
||||
|
||||
var color = Brush.Parse("#444444");
|
||||
|
||||
switch (category)
|
||||
{
|
||||
case "DEBG":
|
||||
color = Brush.Parse("#2436d4");
|
||||
break;
|
||||
case "ERRO":
|
||||
color = Brush.Parse("#d42436");
|
||||
break;
|
||||
case "INFO":
|
||||
color = Brush.Parse("#0ab3c9");
|
||||
break;
|
||||
}
|
||||
|
||||
var message = matches[0].Groups["m"].Value;
|
||||
return new LogInfo
|
||||
{
|
||||
Category = category, Message = message, CategoryColor = color
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user