Initial commit

This commit is contained in:
tbS
2025-08-01 23:28:27 +02:00
commit 7120c81089
44 changed files with 4084 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Valheim_Dashboard.Views.DashboardView">
Fashboard
</UserControl>

View File

@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Valheim_Dashboard.Views;
public partial class DashboardView : UserControl
{
public DashboardView()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,28 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
x:Class="Valheim_Dashboard.Views.ErsterStartView">
<Grid>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="20">
<TextBlock x:Name="WelcomeTextBlock" Text="Herzlich Willkommen" FontSize="36" FontWeight="Bold" HorizontalAlignment="Center">
<TextBlock.Effect>
<DropShadowEffect
Color="Gray"
BlurRadius="8"
OffsetX="4"
OffsetY="4"
/>
</TextBlock.Effect>
</TextBlock>
<TextBlock Text="Vielen Dank für Ihr Vertrauen" FontSize="24" HorizontalAlignment="Center"/>
<TextBlock x:Name="HinweisTextBlock" Text="Klicken Sie hier für weiter" FontSize="18" HorizontalAlignment="Center" />
</StackPanel>
<Button x:Name="WeiterButton" Content="Weiter" HorizontalAlignment="Right" VerticalAlignment="Bottom" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="10" Width="100" Height="100"
Click="Weiter_Click">
</Button>
</Grid>
</UserControl>

View File

@@ -0,0 +1,122 @@
using System;
using System.Reactive.Linq;
using Avalonia.Animation;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.ReactiveUI;
using Avalonia.Styling;
using ReactiveUI;
using Valheim_Dashboard.ViewModels;
using static Valheim_Dashboard.Animationen;
using Valheim_Dashboard.Views;
namespace Valheim_Dashboard.Views
{
public partial class ErsterStartView : ReactiveUserControl<ErsterStartViewModel>
{
public ErsterStartView()
{
InitializeComponent();
this.WhenActivated(disposables =>
{
Console.WriteLine("erster start view");
// Animation starten, wenn ViewModel-Property sich ändert
this.WhenAnyValue(x => x.ViewModel.StartAnimation)
.Where(startAnimation => startAnimation)
.Subscribe(_ => StartAnimation());
this.WhenAnyValue(x => x.ViewModel.AnimationTargetPosition)
.Subscribe(pos =>
{
if(HinweisTextBlock != null && WeiterButton != null) {
double offsetX = pos.X - WeiterButton.Bounds.X - 200;
double offsetY = pos.Y - WeiterButton.Bounds.Y - 150;
HinweisTextBlock.RenderTransform = new TranslateTransform(offsetX, offsetY);
}
});
});
}
private void StartAnimation()
{
var hinweisTextBlock = this.FindControl<TextBlock>("HinweisTextBlock");
var weiterButton = this.FindControl<Button>("WeiterButton");
Console.WriteLine($"HinweisTextBlock: {hinweisTextBlock != null}");
Console.WriteLine($"WeiterButton: {weiterButton != null}");
if (hinweisTextBlock != null)
{
var animation = new Animation
{
Duration = TimeSpan.FromSeconds(2),
Delay = TimeSpan.FromSeconds(2)
};
animation.Children.Add(new KeyFrame
{
Cue = new Cue(0d),
Setters =
{
new Setter(TextBlock.OpacityProperty, 1.0)
}
});
animation.Children.Add(new KeyFrame
{
Cue = new Cue(1d),
Setters =
{
new Setter(TextBlock.OpacityProperty, 0.2)
}
});
// RenderTransform VOR animation.RunAsync setzen!
hinweisTextBlock.RenderTransform = new ScaleTransform(1, 1);
animation.RunAsync(hinweisTextBlock);
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void Weiter_Click(object sender, RoutedEventArgs e)
{
Console.WriteLine("weiter geklickt");
Console.WriteLine(this.Parent.Parent.Parent);
if (this.Parent.Parent.Parent is MainWindow mainWindow)
{
if(mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
{
mainWindowViewModel.SwitchToLizenzView();
}
}
}
}
}

View File

@@ -0,0 +1,53 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Valheim_Dashboard"
xmlns:vm="clr-namespace:Valheim_Dashboard.ViewModels"
xmlns:views="clr-namespace:Valheim_Dashboard.Views"
mc:Ignorable="d"
x:Name="root"
x:Class="Valheim_Dashboard.Views.FtpView"
x:DataType="vm:FtpViewModel"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- TextBox für den aktuellen FTP-Pfad -->
<TextBox x:Name="CurrentPathTextBox"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
IsEnabled="False"
Height="100"
Margin="50,0,50,0"
Text="{Binding CurrentPath}"/>
<!-- ScrollViewer mit ListBox -->
<ScrollViewer x:Name="ftp_ScrollVie2"
Grid.Row="1"
Background="Brown"
Margin="50,0,50,50">
<ListBox x:Name="FtpFileList" ItemsSource="{Binding Files}">
<ListBox.ItemTemplate>
<DataTemplate>
<Button
CommandParameter="{Binding}"
Background="Transparent"
BorderBrush="Transparent"
HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Name}" Foreground="Green" />
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Grid>
</UserControl>

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Reactive;
using System.Reactive.Disposables;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using KeyAuth;
using ReactiveUI;
using Valheim_Dashboard.ViewModels;
namespace Valheim_Dashboard.Views;
public partial class FtpView : ReactiveUserControl<FtpViewModel>
{
public FtpView()
{
InitializeComponent();
// Aktivierungslogik für Bindings
this.WhenActivated(disposables =>
{
// Binde den aktuellen Pfad an die TextBox
this.OneWayBind(ViewModel, vm => vm.CurrentPath, v => v.CurrentPathTextBox_.Text)
.DisposeWith(disposables);
// Konvertiere die ObservableCollection<string> zu IEnumerable<object>
this.OneWayBind(ViewModel, vm => vm.Files, v => v.FtpFileList_.ItemsSource)
.DisposeWith(disposables);
});
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private TextBox CurrentPathTextBox_ => this.FindControl<TextBox>("CurrentPathTextBox");
private ListBox FtpFileList_ => this.FindControl<ListBox>("FtpFileList");
}

View File

@@ -0,0 +1,151 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
x:Class="Valheim_Dashboard.Views.LizenzView">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
x:Name="ueberschrift"
Text="Bitte trage deinen Lizenzkey ein"
FontSize="36"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
VerticalAlignment="Top"
Margin="0,50,0,0"
>
<TextBlock.Effect>
<DropShadowEffect
Color="Gray"
BlurRadius="8"
OffsetX="4"
OffsetY="4"
/>
</TextBlock.Effect>
</TextBlock>
<TextBox x:Name="LizenzKeyTextBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Text="Lizenzkey eingeben"
IsEnabled="true"
Height="100"
Margin="50,0,200,0"
/>
<Button
x:Name="verifizieren_button"
Content="Verifizieren"
Width="100"
Height="100"
HorizontalAlignment="Right"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
IsVisible="true"
IsEnabled="False"
Margin="0,0,50,0"
Click="Verifizieren_button_OnClick"
/>
<StackPanel Grid.Row="0"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
Margin="0,100,0,0"
Height="200"
>
<TextBlock
x:Name="verbindung_lizenz_server"
Text="Verbindung zum Lizenz Server wird hergestellt"
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
IsVisible="false"
>
</TextBlock>
<TextBlock
x:Name="verbindung_fehler_lizenz_server"
Text="Verbindung konnte nicht hergestellt werden"
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
IsVisible="false"
>
</TextBlock>
<TextBlock
x:Name="verbindung_erfolgreich_lizenz_server"
Text="Verbindung erfolgreich Hergestellt"
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
IsVisible="false"
>
</TextBlock>
<TextBlock
x:Name="lizenz_prüfung"
Text="Lizenz wird überprüft"
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
VerticalAlignment="Center"
IsVisible="false"
>
</TextBlock>
<TextBlock
x:Name="lizenz_erfolgreich"
Text="Lizenz erfolgreich aktiviert!"
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
VerticalAlignment="Center"
IsVisible="false"
>
</TextBlock>
<TextBlock
x:Name="lizenz_fehler"
Text="Lizenz konnte nicht aktiviert werden!"
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
VerticalAlignment="Center"
IsVisible="false"
>
</TextBlock>
</StackPanel>
<Button
Grid.Row="0"
x:Name="weiter"
Content="Weiter"
HorizontalAlignment="Right"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
FontWeight="Bold"
VerticalAlignment="Bottom"
Margin="10"
Width="100"
Height="100"
IsVisible="False"
Click="Weiter_Click">
</Button>
</Grid>
</UserControl>

View File

@@ -0,0 +1,144 @@
using System;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Interactivity;
using KeyAuth;
using Valheim_Dashboard.ViewModels;
namespace Valheim_Dashboard.Views;
public partial class LizenzView : UserControl
{
public LizenzView()
{
InitializeComponent();
LizenzKeyTextBox.GotFocus += (sender, e) =>
{
if (LizenzKeyTextBox.Text == "Lizenzkey eingeben")
{
LizenzKeyTextBox.Text = "";
verifizieren_button.IsEnabled = true;
}else if (LizenzKeyTextBox.Text != "Lizenzkey eingeben" || LizenzKeyTextBox.Text != "")
{
verifizieren_button.IsEnabled = true;
verbindung_lizenz_server.IsVisible = false;
verbindung_erfolgreich_lizenz_server.IsVisible = false;
verbindung_fehler_lizenz_server.IsVisible = false;
lizenz_prüfung.IsVisible = false;
lizenz_fehler.IsVisible = false;
lizenz_erfolgreich.IsVisible = false;
}
};
}
public void SetAndCheckLizenz(string lizenzKey)
{
LizenzKeyTextBox.Text = lizenzKey;
VerifyKey();
}
private void Verifizieren_button_OnClick(object? sender, RoutedEventArgs e)
{
if (LizenzKeyTextBox.Text != "")
{
//Animationen.RunSlideAnimation(-60, ueberschrift);
//Animationen.RunSlideAnimation(-120, LizenzKeyTextBox);
//Animationen.FadeOutAnimation(verifizieren_button, 0.3D);
verifizieren_button.IsEnabled = false;
//Animationen.RunSlideAnimation(-100, StatusTextBlock);
VerifyKey();
}
}
public async void VerifyKey()
{
try
{
verbindung_lizenz_server.IsVisible = true;
await Task.Run(KeyAuthApp.init);
if (!KeyAuthApp.response.success)
{
verbindung_fehler_lizenz_server.IsVisible = true;
}
else
{
verbindung_erfolgreich_lizenz_server.IsVisible = true;
}
string key = LizenzKeyTextBox.Text;
lizenz_prüfung.IsVisible = true;
await Task.Run(() =>
{
KeyAuthApp.license(key);
return 0;
});
if (!KeyAuthApp.response.success)
{
lizenz_fehler.IsVisible = true;
Console.WriteLine(KeyAuthApp.response.message);
}
else
{
Settings.SettingsSave("LizenzKey", LizenzKeyTextBox.Text);
lizenz_erfolgreich.IsVisible = true;
weiter.IsVisible = true;
}
}catch (Exception ex)
{
Console.WriteLine("error" + ex);
}
}
public static api KeyAuthApp = new api(
name: "Valheim Dashboard", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
ownerid: "sS0sZlXiY5", // Account ID
secret: "6e83db8b463d0a3822b002f8d06dbe51d07c8f0481bda05038291eac5d74eb0f",
version: "1.0" // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
//path: @"Your_Path_Here" // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s
);
public static string[] lizenz_name;
private void Weiter_Click(object sender, RoutedEventArgs e)
{
Console.WriteLine("weiter geklickt");
if (this.Parent.Parent.Parent is MainWindow mainWindow)
{
if(mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
{
lizenz_name = LizenzKeyTextBox.Text.Split('-');
if (lizenz_name[2] == "A")
{
mainWindowViewModel.SwitchToServerSettings();
}
else
{
Console.WriteLine(KeyAuthApp.var(lizenz_name[1]));
mainWindowViewModel.SwitchToDashboard();
}
}
}
}
}

View File

@@ -0,0 +1,22 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Valheim_Dashboard.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
x:Class="Valheim_Dashboard.Views.MainWindow"
x:DataType="vm:MainWindowViewModel" CanResize="false"
Icon="/Assets/avalonia-logo.ico"
Title="Valheim_Dashboard">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<vm:MainWindowViewModel/>
</Design.DataContext>
<Grid>
<ContentControl Content="{Binding CurrentViewModel}" />
<Canvas Name="OverlayLayer" IsHitTestVisible="True" />
</Grid>
</Window>

View File

@@ -0,0 +1,11 @@
using Avalonia.Controls;
namespace Valheim_Dashboard.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,103 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:Valheim_Dashboard.ViewModels"
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
x:Class="Valheim_Dashboard.Views.ServerSettingsView"
x:DataType="viewModels:ServerSettingsViewModel">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
x:Name="ueberschrift"
Text="Servereinstellungen"
FontSize="36"
FontWeight="Bold"
HorizontalAlignment="Center"
Opacity="100"
VerticalAlignment="Top"
Margin="0,50,0,0"
>
<TextBlock.Effect>
<DropShadowEffect
Color="Gray"
BlurRadius="8"
OffsetX="4"
OffsetY="4"
/>
</TextBlock.Effect>
</TextBlock>
<Grid Grid.Row="1" Margin="0,50,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="9*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<!-- Plugin-Einstellungen -->
<Expander Header="Plugin" x:Name="Plugin" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Margin="50,0,25,0" >
<StackPanel Spacing="5" HorizontalAlignment="Center">
<TextBlock Text="IP-Adresse:" />
<TextBox x:Name="plugin_ip" Text="{Binding PluginIp}" Width="200" />
<TextBlock Text="Port:" />
<TextBox x:Name="plugin_port" Text="{Binding PluginPort}" Width="200" />
<Button x:Name="plugin_prüfen" Click="Plugin_prüfen_OnClick" Width="200">Verbindung Prüfen</Button>
</StackPanel>
</Expander>
<!-- FTP-Einstellungen -->
<Expander Header="FTP" x:Name="FTP" HorizontalAlignment="Stretch" MaxHeight="500" VerticalAlignment="Top" Width="565" Grid.Row="0" Grid.Column="1" Margin="25, 0,50,0" >
<ScrollViewer x:Name="ftp_scroll">
<StackPanel Spacing="5" HorizontalAlignment="Center">
<TextBlock Text="IP-Adresse:" />
<TextBox x:Name="ftp_ip" Text="{Binding FtpIp}" Width="200" />
<TextBlock Text="Port:" />
<TextBox x:Name="ftp_port" Text="{Binding FtpPort}" Width="200" />
<TextBlock Text="Benutzername:" />
<TextBox x:Name="ftp_benutzername" Text="{Binding FtpUsername}" Width="200" />
<TextBlock Text="Passwort:" />
<TextBox x:Name="ftp_passwort" Text="{Binding FtpPassword}" Width="200" PasswordChar="*" />
<Button x:Name="ftp_prüfen" Click="Ftp_prüfen_OnClick" Width="200">Verbindung Prüfen</Button>
</StackPanel>
</ScrollViewer>
</Expander>
<Button
Grid.Row="1"
Grid.Column="1"
x:Name="weiter"
Content="Weiter"
HorizontalAlignment="Right"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
FontWeight="Bold"
VerticalAlignment="Bottom"
Margin="10"
Width="100"
Height="100"
IsVisible="true"
Click="Weiter_OnClick">
</Button>
</Grid>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,249 @@
using System;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Net.Http.Json;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Tmds.DBus.Protocol;
using Valheim_Dashboard.ViewModels;
namespace Valheim_Dashboard.Views;
public partial class ServerSettingsView : UserControl
{
private TutorialManager _tutorialManager;
public ServerSettingsView()
{
InitializeComponent();
this.Initialized += (sender, e) =>
{
var window = this.VisualRoot as Window;
if (window == null)
throw new InvalidOperationException("Das übergeordnete Element ist kein Fenster.");
// TutorialManager direkt im Code-Behind initialisieren
_tutorialManager = new TutorialManager(window);
// Beispiel: Ein Tutorial starten
// StartTutorial();
};
}
public void StartTutorial()
{
var pluginExpander = Plugin;
var pluginIpTextBox = plugin_ip;
var pluginPortTextBox = plugin_port;
var pluginUeberpruefen = plugin_prüfen;
var ftpExpander = FTP;
var ftpIpTextBox = ftp_ip;
var ftpPortTextBox = ftp_port;
var ftpBenutzernameTextBox = ftp_benutzername;
var ftpPasswortTextBox = ftp_passwort;
var ftpUeberpruefen = ftp_prüfen;
// Schritt 1: Sprechblase anzeigen: Öffnen des Plugin-Expanders oder FTP-Expanders
_tutorialManager.HighlightElement(pluginExpander, new SolidColorBrush(Colors.Yellow));
_tutorialManager.HighlightElement(ftpExpander, new SolidColorBrush(Colors.Yellow));
_tutorialManager.ShowSpeechBubble(pluginExpander, TutorialManager.SpeechBubblePosition.Top, Language.GetString("Server_Schritt_1"), () =>
{
// Schritt 2: Plugin-Expander öffnen und Sprechblase ändern
_tutorialManager.OpenExpander(pluginExpander);
_tutorialManager.HighlightElement(pluginExpander, new SolidColorBrush(Colors.Transparent));
_tutorialManager.HighlightElement(ftpExpander, new SolidColorBrush(Colors.Transparent));
// Beide Felder hervorheben
_tutorialManager.HighlightElement(pluginIpTextBox, new SolidColorBrush(Colors.LightBlue));
_tutorialManager.HighlightElement(pluginPortTextBox, new SolidColorBrush(Colors.LightBlue));
_tutorialManager.ShowSpeechBubble(pluginExpander, TutorialManager.SpeechBubblePosition.Right,Language.GetString("Server_Schritt_2"), () =>
{
// Schritt 3: Beispielwerte in IP- und Port-Felder eintragen
pluginIpTextBox.Text = "127.0.0.1";
pluginPortTextBox.Text = "2456";
_tutorialManager.HighlightElement(pluginUeberpruefen, new SolidColorBrush(Colors.LightBlue));
// Nächste Sprechblase: Warten auf Weiter!
_tutorialManager.ShowSpeechBubble(pluginExpander, TutorialManager.SpeechBubblePosition.Right,Language.GetString("Server_Schritt_3"), () =>
{
// Schritt 4: Nächste Aktion einleiten (falls notwendig)
_tutorialManager.ClickButton(pluginUeberpruefen);
Task.Delay(2000);
pluginUeberpruefen.Background = new SolidColorBrush(Colors.Green);
pluginUeberpruefen.Content = "Erfolgreich Verbunden!";
_tutorialManager.ShowSpeechBubble(ftpExpander, TutorialManager.SpeechBubblePosition.Left,
Language.GetString("Server_Schritt_4"),
() =>
{
_tutorialManager.CloseExpander(pluginExpander);
_tutorialManager.HighlightElement(pluginIpTextBox, new SolidColorBrush(Colors.Transparent));
_tutorialManager.HighlightElement(pluginPortTextBox, new SolidColorBrush(Colors.Transparent));
_tutorialManager.HighlightElement(pluginUeberpruefen, new SolidColorBrush(Colors.Transparent));
pluginIpTextBox.Text = "";
pluginPortTextBox.Text = "";
pluginUeberpruefen.Background = new SolidColorBrush(Colors.Gray);
pluginUeberpruefen.Content = "Verbindung Prüfen";
_tutorialManager.OpenExpander(ftpExpander);
_tutorialManager.HighlightElement(ftpIpTextBox, new SolidColorBrush(Colors.LightBlue));
_tutorialManager.HighlightElement(ftpPortTextBox, new SolidColorBrush(Colors.LightBlue));
_tutorialManager.HighlightElement(ftpBenutzernameTextBox, new SolidColorBrush(Colors.LightBlue));
_tutorialManager.HighlightElement(ftpPasswortTextBox, new SolidColorBrush(Colors.LightBlue));
_tutorialManager.ShowSpeechBubble(ftpExpander, TutorialManager.SpeechBubblePosition.Left,
Language.GetString("Server_Schritt_5"),
async () =>
{
_tutorialManager.WriteText(ftpIpTextBox, "127.0.0.1");
_tutorialManager.WriteText(ftpPortTextBox, "21");
_tutorialManager.WriteText(ftpBenutzernameTextBox, "ftpUser");
_tutorialManager.WriteText(ftpPasswortTextBox, "123456789");
await _tutorialManager.SmoothScrollToControl(ftp_scroll, ftpUeberpruefen);
Task.Delay(2000);
_tutorialManager.ClickButton(ftpUeberpruefen);
ftpUeberpruefen.Background = new SolidColorBrush(Colors.Green);
ftpUeberpruefen.Content = "Verbindung Erfolgreich";
_tutorialManager.ShowSpeechBubble(ftpExpander,
TutorialManager.SpeechBubblePosition.Left,
Language.GetString("Server_Schritt_6"),
() =>
{
});
});
});
});
});
});
}
private void Weiter_OnClick(object? sender, RoutedEventArgs e)
{
if (this.Parent.Parent.Parent is MainWindow mainWindow) {
if (mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
{
mainWindowViewModel.SwitchToFTP(ftpClient);
}
}
}
public class DataPluginJson
{
public string ModVersion { get; set; }
public string PluginVersion { get; set; }
public string HashPlugins { get; set; }
public string HashConfig { get; set; }
public string HashClientSide { get; set; }
public string OldConfigFiles { get; set; }
public string OldConfigFolder { get; set; }
public string OldConfigFolderFiles { get; set; }
public string OldPluginFiles { get; set; }
public string OldPluginFolder { get; set; }
public string OldPluginFolderFiles { get; set; }
public string ConfigFilestoDelete { get; set; }
public string ConfigFoldertoDelete { get; set; }
public string ConfigFolderFilestoDelete { get; set; }
public string PluginFilestoDelete { get; set; }
public string PluginFoldertoDelete { get; set; }
public string PluginFolderFilestoDelete { get; set; }
public string OldClientSideConfigFiles { get; set; }
public string OldClientSideConfigFolder { get; set; }
public string OldClientSideConfigFolderFiles { get; set; }
public string OldClientSidePluginFiles { get; set; }
public string OldClientSidePluginFolder { get; set; }
public string OldClientSidePluginFolderFiles { get; set; }
public string ClientSideConfigFilestoDelete { get; set; }
public string ClientSideConfigFoldertoDelete { get; set; }
public string ClientSideConfigFolderFilestoDelete { get; set; }
public string ClientSidePluginFilestoDelete { get; set; }
public string ClientSidePluginFoldertoDelete { get; set; }
public string ClientSidePluginFolderFilestoDelete { get; set; }
}
private async void Plugin_prüfen_OnClick(object? sender, RoutedEventArgs e)
{
HttpClient PluginClient = new HttpClient();
try
{
var response = await PluginClient.GetAsync("http://amp.tbs-server.de:2456");
if (response.IsSuccessStatusCode)
{
var data = await response.Content.ReadFromJsonAsync<DataPluginJson>();
plugin_prüfen.Background = new SolidColorBrush(Colors.Green);
plugin_prüfen.Content = "Verbindung Erfolgreich";
Debug.WriteLine(data.ModVersion);
}else
{
plugin_prüfen.Background = new SolidColorBrush(Colors.Red);
plugin_prüfen.Content = "Verbindung Fehlgeschlagen";
}
}
catch (Exception ex)
{
plugin_prüfen.Background = new SolidColorBrush(Colors.Red);
plugin_prüfen.Content = "Verbindung Fehlgeschlagen";
}
}
private FtpClient ftpClient;
private async void Ftp_prüfen_OnClick(object? sender, RoutedEventArgs e)
{
try
{Console.WriteLine(ftp_ip.Text + ftp_port.Text + ftp_benutzername.Text + ftp_passwort.Text);
//ftpClient = new FtpClient("ftp://"+ ftp_ip.Text + ":" +ftp_port.Text, ftp_benutzername.Text, ftp_passwort.Text);
FtpViewModel._ftpClient = new FtpClient("ftp://192.168.178.34:21", "tbs_ftp", "JLI_._nTH-DyG53Se9");
var files = await ftpClient.ListDirectoryDetailsAsync();
if (files != null && files.Count > 0)
{
var name = "tbs";
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
ftp_prüfen.Content = "Verbindung Erfolgreich1";
Console.WriteLine(files);
LizenzView.KeyAuthApp.webhook("aHtrWbrxrZ", "&name="+ LizenzView.lizenz_name[1] +"&data=testabc", "");
Console.WriteLine(LizenzView.KeyAuthApp.response.message);
}
else
{
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
ftp_prüfen.Content = "Verbindung Erfolgreich2";
}
}
catch (Exception ex)
{
Console.WriteLine($"Fehler beim Verbinden: {ex.Message}");
}
}
}