Projektdateien hinzufügen.
This commit is contained in:
3
Valheim Mod Sync Desktop/App.config
Normal file
3
Valheim Mod Sync Desktop/App.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
</configuration>
|
||||
39
Valheim Mod Sync Desktop/App.xaml
Normal file
39
Valheim Mod Sync Desktop/App.xaml
Normal file
@@ -0,0 +1,39 @@
|
||||
<Application x:Class="Valheim_Mod_Sync_Desktop.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:local="clr-namespace:Valheim_Mod_Sync_Desktop"
|
||||
xmlns:views="clr-namespace:Valheim_Mod_Sync_Desktop.Views"
|
||||
xmlns:viewmodels="clr-namespace:Valheim_Mod_Sync_Desktop.ViewModels"
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary x:Name="ThemeDictionary">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Skins/Light.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Name="LanguageDictionary1">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Language/German.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||
<ResourceDictionary Source="/Skins/Overwrite_Styles.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<DataTemplate DataType="{x:Type viewmodels:SyncViewModel}">
|
||||
<views:SyncControl/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodels:KontaktViewModel}">
|
||||
<views:Kontakt/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodels:SetupViewModel}">
|
||||
<views:Setup/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodels:FTPViewModel}">
|
||||
<views:FTP/>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
181
Valheim Mod Sync Desktop/App.xaml.cs
Normal file
181
Valheim Mod Sync Desktop/App.xaml.cs
Normal file
@@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
DispatcherUnhandledException += App_DispatcherUnhandledException;
|
||||
}
|
||||
|
||||
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
// Erstellen Sie den Crash-Bericht.
|
||||
var crashReport = CreateCrashReport(e.Exception);
|
||||
|
||||
// Zeigen Sie eine Benutzeroberfläche an, um den Benutzer aufzufordern, den Bericht zu senden.
|
||||
var result = ShowCrashReportDialog(crashReport);
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
// Senden Sie den Bericht an die URL.
|
||||
SendCrashReport(crashReport, "https://vms.tbs-server.de/crashreport.php");
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void SendCrashReport(string crashReport, string url)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
NameValueCollection data = new NameValueCollection();
|
||||
data["crashReport"] = crashReport;
|
||||
data["Lizenz"] = Valheim_Mod_Sync_Desktop.Properties.Settings.Default.Lizenz;
|
||||
byte[] responseBytes = client.UploadValues(url, "POST", data);
|
||||
NameValueCollection response = HttpUtility.ParseQueryString(Encoding.UTF8.GetString(responseBytes));
|
||||
if (response.ToString() == "true")
|
||||
{
|
||||
// Zeigen Sie eine Benachrichtigung an, dass der Crash-Bericht erfolgreich gesendet wurde.
|
||||
MessageBox.Show((string)Application.Current.FindResource("CrashGesendet"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Zeigen Sie eine Benachrichtigung an, dass beim Senden des Crash-Berichts ein Fehler aufgetreten ist.
|
||||
MessageBox.Show((string)Application.Current.FindResource("CrashFehler"));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
// Zeigen Sie eine Benachrichtigung an, dass beim Senden des Crash-Berichts ein Fehler aufgetreten ist.
|
||||
MessageBox.Show("Error sending crash report: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private string CreateCrashReport(Exception exception)
|
||||
{
|
||||
|
||||
|
||||
var report = new StringBuilder();
|
||||
report.AppendLine("Crash report:");
|
||||
report.AppendLine();
|
||||
report.AppendLine("Lizenz: " + Valheim_Mod_Sync_Desktop.Properties.Settings.Default.Lizenz);
|
||||
report.AppendLine();
|
||||
report.AppendLine("Exception type: " + exception.GetType().FullName);
|
||||
report.AppendLine("Exception message: " + exception.Message);
|
||||
report.AppendLine();
|
||||
report.AppendLine("Stack trace:");
|
||||
report.AppendLine(exception.StackTrace);
|
||||
|
||||
|
||||
if (exception.InnerException != null)
|
||||
{
|
||||
report.AppendLine();
|
||||
report.AppendLine("Inner exception type: " + exception.InnerException.GetType().FullName);
|
||||
report.AppendLine("Inner exception message: " + exception.InnerException.Message);
|
||||
report.AppendLine();
|
||||
report.AppendLine("Inner stack trace:");
|
||||
report.AppendLine(exception.InnerException.StackTrace);
|
||||
}
|
||||
|
||||
string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
string configPath = Path.Combine(localAppDataPath, "tbS-server");
|
||||
File.WriteAllText(configPath + "/CrashReport.txt", report.ToString());
|
||||
|
||||
return report.ToString();
|
||||
}
|
||||
|
||||
private bool ShowCrashReportDialog(string crashReport)
|
||||
{
|
||||
var window = new Crash();
|
||||
return window.ShowDialog() == true;
|
||||
}
|
||||
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
|
||||
if (e.Args.Length == 1 && e.Args[0] == "--config-reset")
|
||||
{
|
||||
if (File.Exists(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath))
|
||||
{
|
||||
File.Delete(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
|
||||
|
||||
}
|
||||
|
||||
MessageBox.Show("Config deleted, please re-open VMS and Configure");
|
||||
|
||||
this.Shutdown();
|
||||
|
||||
|
||||
} else if (e.Args.Length == 1 && e.Args[0] == "--crashreport-send")
|
||||
{
|
||||
// Senden des Letzen CrashReports
|
||||
|
||||
string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
string configPath = Path.Combine(localAppDataPath, "tbS-server");
|
||||
string crashReport = File.ReadAllText(configPath + "/CrashReport.txt");
|
||||
|
||||
SendCrashReport(crashReport, "https://vms.tbs-server.de/crashreport.php");
|
||||
this.Shutdown();
|
||||
|
||||
} else {
|
||||
MainWindow wnd = new MainWindow();
|
||||
//wnd.Show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ResourceDictionary ThemeDictionary
|
||||
{
|
||||
get { return Resources.MergedDictionaries[0]; }
|
||||
}
|
||||
|
||||
public void ChangeTheme(Uri uri)
|
||||
{
|
||||
ThemeDictionary.MergedDictionaries.Clear();
|
||||
ThemeDictionary.MergedDictionaries.Add(new ResourceDictionary() { Source = uri });
|
||||
}
|
||||
|
||||
|
||||
public ResourceDictionary LanguageDictionary
|
||||
{
|
||||
get { return Resources.MergedDictionaries[1]; }
|
||||
}
|
||||
|
||||
public void ChangeLanguage(Uri uri)
|
||||
{
|
||||
|
||||
LanguageDictionary.MergedDictionaries.Clear();
|
||||
LanguageDictionary.MergedDictionaries.Add(new ResourceDictionary() { Source = uri });
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Valheim Mod Sync Desktop/AssemblyInfo.cs
Normal file
10
Valheim Mod Sync Desktop/AssemblyInfo.cs
Normal file
@@ -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)
|
||||
)]
|
||||
76
Valheim Mod Sync Desktop/Benachrichtigung.xaml
Normal file
76
Valheim Mod Sync Desktop/Benachrichtigung.xaml
Normal file
@@ -0,0 +1,76 @@
|
||||
<Window x:Class="Valheim_Mod_Sync_Desktop.Benachrichtigung"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
x:Name="BenachrichtigungsFenster"
|
||||
Title="Valheim Mod Sync Error" Height="200" Width="400" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen" Icon="/files/tbs.ico">
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
<StackPanel
|
||||
x:Name="header"
|
||||
Height="25px"
|
||||
Background="{DynamicResource BackgroundHeader}" Margin="0,0,0,175"
|
||||
Orientation="Horizontal"
|
||||
MouseLeftButtonDown="header_MouseLeftButtonDown"
|
||||
>
|
||||
|
||||
<Label
|
||||
Content="Valheim Mod Sync"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
Width="130px"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="miniBtn"
|
||||
MouseLeftButtonDown="miniBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Minus}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="220,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="exitBtn"
|
||||
MouseLeftButtonDown="exitBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Close}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,25,0,0" Height="Auto" Width="Auto">
|
||||
<TextBlock x:Name="send" Visibility="Collapsed" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" MaxWidth="380" Height="Auto" TextWrapping="Wrap" TextAlignment="Center" FontSize="14" Text="{DynamicResource BenachrichtigungSend}"/>
|
||||
<TextBlock x:Name="name" Visibility="Collapsed" Text="{DynamicResource BenachrichtigungName}" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0"/>
|
||||
<TextBlock x:Name="email" Visibility="Collapsed" Text="{DynamicResource BenachrichtigungEmail}" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0"/>
|
||||
<TextBlock x:Name="message" Visibility="Collapsed" Text="{DynamicResource BenachrichtigungNachricht}" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0"/>
|
||||
<TextBlock x:Name="keininternet" Visibility="Collapsed" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0" TextAlignment="Center" Text="{DynamicResource BenachrichtigungInternet}"/>
|
||||
<TextBlock x:Name="error" Visibility="Collapsed" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0" TextAlignment="Center" Text="{DynamicResource BenachrichtigungFehler}"/>
|
||||
<TextBlock x:Name="startkeininternet" Visibility="Collapsed" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0" TextAlignment="Center" Text="{DynamicResource BenachrichtigungStartKeinInternet}"/>
|
||||
<TextBlock x:Name="startvalheim" Visibility="Collapsed" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" FontSize="14" Margin="0 10 0 0" TextAlignment="Center" Text="{DynamicResource BenachrichtigungStartValheim}"/>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
113
Valheim Mod Sync Desktop/Benachrichtigung.xaml.cs
Normal file
113
Valheim Mod Sync Desktop/Benachrichtigung.xaml.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Benachrichtigung.xaml
|
||||
/// </summary>
|
||||
public partial class Benachrichtigung : Window
|
||||
{
|
||||
public Benachrichtigung(bool Name, bool Email, bool Message, bool Send, bool KeinInternet, bool Error, bool StartKeinInternet, bool StartValheim)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Name)
|
||||
{
|
||||
name.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (Email)
|
||||
{
|
||||
email.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if(Message)
|
||||
{
|
||||
message.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (Send && !KeinInternet)
|
||||
{
|
||||
send.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (KeinInternet)
|
||||
{
|
||||
keininternet.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (Error)
|
||||
{
|
||||
error.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (StartKeinInternet)
|
||||
{
|
||||
startkeininternet.Visibility = Visibility.Visible;
|
||||
MainWindow.LizenzReturn = "false";
|
||||
}
|
||||
|
||||
if (StartValheim)
|
||||
{
|
||||
startvalheim.Visibility = Visibility.Visible;
|
||||
BenachrichtigungsFenster.KeyDown += OnKeyDownHandler;
|
||||
Keyboard.Focus(BenachrichtigungsFenster);
|
||||
ValheimStart();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private bool abort = false;
|
||||
|
||||
private async void ValheimStart()
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
if (abort == false)
|
||||
{
|
||||
var uri = "steam://rungameid/892970";
|
||||
var psi = new ProcessStartInfo();
|
||||
psi.UseShellExecute = true;
|
||||
psi.FileName = uri;
|
||||
Process.Start(psi);
|
||||
this.Close();
|
||||
Application.Current.MainWindow.Close();
|
||||
}else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnKeyDownHandler(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
abort = true;
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Close Button
|
||||
private void exitBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
//Minimize Button
|
||||
private void miniBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
//Header Move
|
||||
private void header_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Valheim Mod Sync Desktop/Commands/UpdateViewCommand.cs
Normal file
48
Valheim Mod Sync Desktop/Commands/UpdateViewCommand.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Valheim_Mod_Sync_Desktop.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.Commands
|
||||
{
|
||||
class UpdateViewCommand : ICommand
|
||||
{
|
||||
private MainViewModel viewModel;
|
||||
|
||||
public UpdateViewCommand(MainViewModel viewModel)
|
||||
{
|
||||
this.viewModel = viewModel;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
|
||||
if (parameter.ToString() == "SyncView")
|
||||
{
|
||||
viewModel.SelectedViewModel = new SyncViewModel();
|
||||
}
|
||||
else if (parameter.ToString() == "Kontakt")
|
||||
{
|
||||
viewModel.SelectedViewModel = new KontaktViewModel();
|
||||
}
|
||||
else if (parameter.ToString() == "Setup")
|
||||
{
|
||||
viewModel.SelectedViewModel = new SetupViewModel();
|
||||
}
|
||||
else if (parameter.ToString() == "FTP")
|
||||
{
|
||||
viewModel.SelectedViewModel = new FTPViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
92
Valheim Mod Sync Desktop/Crash.xaml
Normal file
92
Valheim Mod Sync Desktop/Crash.xaml
Normal file
@@ -0,0 +1,92 @@
|
||||
<Window x:Class="Valheim_Mod_Sync_Desktop.Crash"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
x:Name="BenachrichtigungsFenster"
|
||||
Title="Valheim Mod Sync Error" Height="200" Width="400" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen" Icon="/files/tbs.ico">
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
<StackPanel
|
||||
x:Name="header"
|
||||
Height="25px"
|
||||
Background="{DynamicResource BackgroundHeader}" Margin="0,0,0,175"
|
||||
Orientation="Horizontal"
|
||||
MouseLeftButtonDown="header_MouseLeftButtonDown"
|
||||
>
|
||||
|
||||
<Label
|
||||
Content="Valheim Mod Sync"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
Width="130px"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="miniBtn"
|
||||
MouseLeftButtonDown="miniBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Minus}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="220,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="exitBtn"
|
||||
MouseLeftButtonDown="exitBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Close}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,25,0,0" Height="Auto" Width="Auto">
|
||||
|
||||
<TextBlock FontSize="14" HorizontalAlignment="Center" Foreground="{DynamicResource HeaderTextColor}" FontWeight="Bold" TextAlignment="Center" Text="{DynamicResource CrashBenachrichtigung}"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,10"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Margin="0 150 0 0">
|
||||
<Button Content="{DynamicResource CrashSenden}"
|
||||
IsDefault="True"
|
||||
Width="100"
|
||||
Margin="0 0 5 0"
|
||||
Click="SendReportButton_Click"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
/>
|
||||
<Button Content="{DynamicResource CrashNichtSenden}"
|
||||
IsCancel="True"
|
||||
Width="100"
|
||||
Click="CancelButton_Click"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
47
Valheim Mod Sync Desktop/Crash.xaml.cs
Normal file
47
Valheim Mod Sync Desktop/Crash.xaml.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Benachrichtigung.xaml
|
||||
/// </summary>
|
||||
public partial class Crash : Window
|
||||
{
|
||||
public Crash()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SendReportButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
}
|
||||
|
||||
//Close Button
|
||||
private void exitBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
//Minimize Button
|
||||
private void miniBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
//Header Move
|
||||
private void header_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Valheim Mod Sync Desktop/Ladescreen.xaml
Normal file
42
Valheim Mod Sync Desktop/Ladescreen.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<Window x:Class="Valheim_Mod_Sync_Desktop.Ladescreen"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
Title="Valheim Mod Sync Lizenz" Height="200" Width="400" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen" Icon="/files/tbs.ico">
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
<StackPanel
|
||||
x:Name="header"
|
||||
Height="25px"
|
||||
Background="{DynamicResource BackgroundHeader}" Margin="0,0,0,175"
|
||||
Orientation="Horizontal"
|
||||
MouseLeftButtonDown="header_MouseLeftButtonDown"
|
||||
|
||||
>
|
||||
<Label
|
||||
Content="Valheim Mod Sync"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
Width="130px"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
<Image Source="/files/tbs.png" Margin="118,30,118,32"/>
|
||||
|
||||
<ProgressBar Name="ProgressBar" Minimum="0" Maximum="100" Value="0" Margin="10,173,10,7" Height="20" MinWidth="380" Width="380" Background="Transparent"/>
|
||||
<TextBox Name="ProgressName" Height="15" Margin="15,173,15,7" Padding="1" FontSize="10" TextAlignment="Center" IsEnabled="False" BorderBrush="{x:Null}" />
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
56
Valheim Mod Sync Desktop/Ladescreen.xaml.cs
Normal file
56
Valheim Mod Sync Desktop/Ladescreen.xaml.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
|
||||
public partial class Ladescreen : Window
|
||||
{
|
||||
|
||||
public Ladescreen()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void SetProgress(int progress)
|
||||
{
|
||||
// Aktualisiere die Fortschrittsanzeige
|
||||
ProgressBar.Value = progress;
|
||||
}
|
||||
|
||||
public void SetProgressName(string progressName)
|
||||
{
|
||||
// Aktualisiere die Fortschrittsanzeige
|
||||
ProgressName.Text = progressName;
|
||||
}
|
||||
|
||||
|
||||
//Header Move
|
||||
private void header_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
69
Valheim Mod Sync Desktop/Language/English.xaml
Normal file
69
Valheim Mod Sync Desktop/Language/English.xaml
Normal file
@@ -0,0 +1,69 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime">
|
||||
<system:String x:Key="Theme">Theme:</system:String>
|
||||
<system:String x:Key="Server">Server:</system:String>
|
||||
<system:String x:Key="Sprache">Language:</system:String>
|
||||
<system:String x:Key="Kontakt">Contact</system:String>
|
||||
<system:String x:Key="Lizenz_Deaktivieren">Deactivate License</system:String>
|
||||
<system:String x:Key="StartMenuVerknuepfung">Start Menu Shortcut</system:String>
|
||||
<!--Sync Fenster-->
|
||||
<system:String x:Key="Sync">Synchronize</system:String>
|
||||
<system:String x:Key="SyncUpdate">Update</system:String>
|
||||
<system:String x:Key="StartValheim">Start Valheim</system:String>
|
||||
<system:String x:Key="Changelog">Changelog error</system:String>
|
||||
<system:String x:Key="ChangelogIO">Changelog v</system:String>
|
||||
<system:String x:Key="ValheimPfad">Valheim Path:</system:String>
|
||||
<system:String x:Key="PfadButton">Select</system:String>
|
||||
<system:String x:Key="SyncInternet" xml:space="preserve">No internet connection available. Please check your connection and restart the program. No update check.</system:String>
|
||||
<system:String x:Key="SyncPfadError" xml:space="preserve">Please choose a Path first.</system:String>
|
||||
<system:String x:Key="SyncStartDownload" xml:space="preserve"> Beginn Download...</system:String>
|
||||
<system:String x:Key="SyncFertigDownload" xml:space="preserve"> Download finished, unzip files...</system:String>
|
||||
<system:String x:Key="SyncFertigEntpacken" xml:space="preserve"> Files successfully extracted.</system:String>
|
||||
<system:String x:Key="SyncKeinClientUpdate" xml:space="preserve"> Latest client version.</system:String>
|
||||
<system:String x:Key="SyncVerfügbarClientUpdate" xml:space="preserve"> VMS Update Available! Latest Version: </system:String>
|
||||
<system:String x:Key="SyncKeinModUpdate" xml:space="preserve">Latest mods and configs </system:String>
|
||||
<system:String x:Key="SyncVerfügbarModUpdate" xml:space="preserve">Mod and Config Update Available!! Please sync!</system:String>
|
||||
<system:String x:Key="ServerTBSError" xml:space="preserve"> The VMS Server is currently unavailable. Thus, not all functions are available.</system:String>
|
||||
<system:String x:Key="ServerModServerError" xml:space="preserve">The Valheim server is currently unavailable. Therefore, no synchronization / update check for mods / configs can take place. Please check you config IP:Port.</system:String>
|
||||
<system:String x:Key="ServerModKonfigurieren" xml:space="preserve">Please enter the IP:Port of the VMS plugin in the settings! Then restart the program.</system:String>
|
||||
<system:String x:Key="SyncClientStartUpdate" xml:space="preserve"> Start Update Download Update...</system:String>
|
||||
<system:String x:Key="SyncClientUpdateError" xml:space="preserve">Failed to download. Please check internet and try again. If the problem persists, please report error! Please use Menu -> Contact or send an email to: shop@ tbs-server.de </system:String>
|
||||
<system:String x:Key="SyncClientUpdateFertig" xml:space="preserve"> Download complete. Valheim Mod Sync will restart. </system:String>
|
||||
<system:String x:Key="DownloadError" xml:space="preserve"> Error downloading. Please check your internet connection.</system:String>
|
||||
<system:String x:Key="SyncDeleteOldFiles" xml:space="preserve"> Delete files that got removed from server.</system:String>
|
||||
<system:String x:Key="SyncDeleteOldFolder" xml:space="preserve"> Delete folder that got removed from server.</system:String>
|
||||
<system:String x:Key="SyncVerfügbarModUpdateZuWeit" xml:space="preserve"> The modpack versions are too far apart. To avoid problems, the config and plugins folder is backed up and cleaned up. The backup will be removed the next time you synchronize!!! With Click on Synchronize the process will start.</system:String>
|
||||
<system:String x:Key="SyncVerfügbarModUpdateSicherung" xml:space="preserve"> Backup started. Fuses are located in:</system:String>
|
||||
<system:String x:Key="SyncKeinPluginUpdate" xml:space="preserve"> Latest plugin version on server!</system:String>
|
||||
<system:String x:Key="SyncVerfügbarPluginUpdate" xml:space="preserve"> Plugin update available!!! Please contact server admin!</system:String>
|
||||
<!--Kontakt Fenster-->
|
||||
<system:String x:Key="KontaktSenden">Send</system:String>
|
||||
<system:String x:Key="KontaktFehler">Bug</system:String>
|
||||
<system:String x:Key="KontaktVorschlag">Suggestion</system:String>
|
||||
<system:String x:Key="KontaktBetreff">Select:</system:String>
|
||||
<system:String x:Key="KontaktName">Name*:</system:String>
|
||||
<system:String x:Key="KontaktEmail">E-Mail*:</system:String>
|
||||
<system:String x:Key="KontaktNachricht">Message*:</system:String>
|
||||
<!--Benachrichtigung Fenser-->
|
||||
<system:String x:Key="BenachrichtigungSend" xml:space="preserve">Message has been sent. We'll get back to you as soon as possible.</system:String>
|
||||
<system:String x:Key="BenachrichtigungName" xml:space="preserve">You dont instert your Name!</system:String>
|
||||
<system:String x:Key="BenachrichtigungEmail" xml:space="preserve">You dont instert a valid E-Mail!</system:String>
|
||||
<system:String x:Key="BenachrichtigungNachricht" xml:space="preserve">You forget to write a message!</system:String>
|
||||
<system:String x:Key="BenachrichtigungInternet" xml:space="preserve">Apparently you don't have internet at the moment... We're saving the message! And try to send them at the next start! Otherwise please contact us directly via email shop@tbs-server.de </system:String>
|
||||
<system:String x:Key="BenachrichtigungFehler" xml:space="preserve">Unfortunately, an error occurred while sending... We'll try again at the next start!</system:String>
|
||||
<system:String x:Key="BenachrichtigungStartKeinInternet" xml:space="preserve">Apparently you currently have no internet... So we can't check your license. Check your connection and restart the program.</system:String>
|
||||
<system:String x:Key="BenachrichtigungStartValheim" xml:space="preserve">Starging Valheim, press ESC to abort</system:String>
|
||||
<!--Lizenz Fenster-->
|
||||
<system:String x:Key="LizenzButton" xml:space="preserve">Confirm</system:String>
|
||||
<system:String x:Key="LizenzText" xml:space="preserve">License:</system:String>
|
||||
<system:String x:Key="LizenzKeyBereitsAktiviert" xml:space="preserve">The license has already been activated on another PC. Please deactivate the license under https://tbs-server.de in the "My Account" area. </system:String>
|
||||
<system:String x:Key="LizenzKeyAktiviert" xml:space="preserve">Program successfully activated. Starting program.</system:String>
|
||||
<system:String x:Key="LizenzKeyFehler" xml:space="preserve">Please check your license entry. If you don't find an error, contact us at: https://tbs-server.de/kontakt or by mail shop@tbs-server.de We'll get back to you as soon as possible!</system:String>
|
||||
<!--Crash Benachrichtigung-->
|
||||
<system:String x:Key="CrashBenachrichtigung" xml:space="preserve">A crash has occurred in the application. Do you want to send a crash report?</system:String>
|
||||
<system:String x:Key="CrashSenden" xml:space="preserve">Send</system:String>
|
||||
<system:String x:Key="CrashNichtSenden" xml:space="preserve">Abbort</system:String>
|
||||
<system:String x:Key="CrashGesendet" xml:space="preserve">Crash report submitted successfully. If there are any questions, the license purchaser will be contacted.</system:String>
|
||||
<system:String x:Key="CrashFehler" xml:space="preserve">Crash report was not transmitted. Please contact tbS. Use the contact form on the website for this.</system:String>
|
||||
</ResourceDictionary>
|
||||
76
Valheim Mod Sync Desktop/Language/German.xaml
Normal file
76
Valheim Mod Sync Desktop/Language/German.xaml
Normal file
@@ -0,0 +1,76 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime">
|
||||
<system:String x:Key="Theme">Design:</system:String>
|
||||
<system:String x:Key="Server">Server:</system:String>
|
||||
<system:String x:Key="Sprache">Sprache:</system:String> <!--LinkesMenü-->
|
||||
<system:String x:Key="Kontakt">Kontakt</system:String>
|
||||
<system:String x:Key="Lizenz_Deaktivieren">Lizenz Deaktivieren</system:String>
|
||||
<system:String x:Key="StartMenuVerknuepfung">Startmenü Verknüpfung</system:String>
|
||||
<!--Sync Fenster-->
|
||||
<system:String x:Key="Sync">Synchronisieren</system:String>
|
||||
<system:String x:Key="SyncUpdate">Update</system:String>
|
||||
<system:String x:Key="StartValheim">Valheim Starten</system:String>
|
||||
<system:String x:Key="Changelog">Changelog error</system:String>
|
||||
<system:String x:Key="ChangelogIO">Changelog v</system:String>
|
||||
<system:String x:Key="ValheimPfad">Valheim Pfad:</system:String>
|
||||
<system:String x:Key="PfadButton">Auswählen</system:String>
|
||||
<system:String x:Key="SyncInternet" xml:space="preserve">Keine Internetverbindung vorhanden. Bitte Überprüfe deine verbindung und starte das Programm neu. Keine Update Überprüfung.</system:String>
|
||||
<system:String x:Key="SyncPfadError" xml:space="preserve"> Bitte wähle zuerst ein Pfad aus.</system:String>
|
||||
<system:String x:Key="SyncStartDownload" xml:space="preserve"> Starte Download...</system:String>
|
||||
<system:String x:Key="SyncFertigDownload" xml:space="preserve"> Download abgeschlossen, entpacke Dateien...</system:String>
|
||||
<system:String x:Key="SyncFertigEntpacken" xml:space="preserve"> Dateien erfolgreich entpackt.</system:String>
|
||||
<system:String x:Key="SyncKeinClientUpdate" xml:space="preserve"> Aktuellste Client-Version.</system:String>
|
||||
<system:String x:Key="SyncVerfügbarClientUpdate" xml:space="preserve"> VMS Update Verfügbar! Neuste Version: </system:String>
|
||||
<system:String x:Key="SyncKeinModUpdate" xml:space="preserve">Aktuellste Mods und Configs</system:String>
|
||||
<system:String x:Key="SyncVerfügbarModUpdate" xml:space="preserve">Mod- und Config-Update verfügbar! Bitte synchronisieren!</system:String>
|
||||
<system:String x:Key="ServerTBSError" xml:space="preserve"> Der VMS Server ist aktuell nicht erreichbar. Somit stehen nicht alle funktionen zur Vefügung.</system:String>
|
||||
<system:String x:Key="ServerModServerError" xml:space="preserve">Der Valheim Server ist aktuell nicht erreichbar. Somit kann keine Synchronisierung / Update prüfung für Mods / Konfigs statt finden. Bitte prüfe deine konfig IP:Port</system:String>
|
||||
<system:String x:Key="ServerModKonfigurieren" xml:space="preserve">Bitte gib die IP:Port vom VMS-Plugin in den Einstellungen ein! Starte danach das Programm neu.</system:String>
|
||||
<system:String x:Key="SyncClientStartUpdate" xml:space="preserve"> Start Update Download Update...</system:String>
|
||||
<system:String x:Key="SyncClientUpdateError" xml:space="preserve">Fehler beim Downloaden. Bitte Internet überprüfen und erneut versuchen. Sollte das Problem weiterhin auftreten, bitte Fehler melden! Benutze dafür Bitte Menü -> Kontakt oder sende eine E-Mail an: shop@tbs-server.de</system:String>
|
||||
<system:String x:Key="SyncClientUpdateFertig" xml:space="preserve"> Download fertig. Valheim Mod Sync wird neu gestartet.</system:String>
|
||||
<system:String x:Key="DownloadError" xml:space="preserve"> Fehler beim Herunterladen. Bitte überprüfe deine Internet verbindung.</system:String>
|
||||
<system:String x:Key="SyncDeleteOldFiles" xml:space="preserve"> Lösche Dateien die vom Server entfernt wurden.</system:String>
|
||||
<system:String x:Key="SyncDeleteOldFolder" xml:space="preserve"> Lösche Ordner die vom Server entfernt wurden.</system:String>
|
||||
<system:String x:Key="SyncVerfügbarModUpdateZuWeit" xml:space="preserve"> Die Modpack - Versionen liegen zu weit auseinander. Um Probleme zu vermeiden wird der Config und Plugins ordner gesichert und bereinigt. Die Sicherung wird beim nächsten Synchronisieren entfernt!!! Mit Klick auf Synchronisieren wird der vorgang gestartet.</system:String>
|
||||
<system:String x:Key="SyncVerfügbarModUpdateSicherung" xml:space="preserve"> Sicherung gestartet. Sicherungen befinden sich in: </system:String>
|
||||
<system:String x:Key="SyncKeinPluginUpdate" xml:space="preserve"> Aktuellste Plugin version auf Server!</system:String>
|
||||
<system:String x:Key="SyncVerfügbarPluginUpdate" xml:space="preserve"> Plugin update verfügbar!!! Bitte Server-Admin Kontaktieren!</system:String>
|
||||
<!--Kontakt Fenster-->
|
||||
<system:String x:Key="KontaktSenden">Senden</system:String>
|
||||
<system:String x:Key="KontaktFehler">Fehler</system:String>
|
||||
<system:String x:Key="KontaktVorschlag">Vorschlag</system:String>
|
||||
<system:String x:Key="KontaktBetreff">Auswählen:</system:String>
|
||||
<system:String x:Key="KontaktName">Name*:</system:String>
|
||||
<system:String x:Key="KontaktEmail">E-Mail*:</system:String>
|
||||
<system:String x:Key="KontaktNachricht">Nachricht*:</system:String>
|
||||
<!--Benachrichtigung Fenster-->
|
||||
<system:String x:Key="BenachrichtigungSend" xml:space="preserve">Nachricht wurde gesendet. Wir melden uns so schnell wie möglich bei dir.</system:String>
|
||||
<system:String x:Key="BenachrichtigungName" xml:space="preserve">Du hast deinen Namen nicht angegeben!</system:String>
|
||||
<system:String x:Key="BenachrichtigungEmail" xml:space="preserve">Du hast keine gültige E-Mail angegeben!</system:String>
|
||||
<system:String x:Key="BenachrichtigungNachricht" xml:space="preserve">Du hast die Nachricht vergessen!</system:String>
|
||||
<system:String x:Key="BenachrichtigungInternet" xml:space="preserve">Anscheiend hast du aktuell kein Internet... Wir speichern die Nachricht! Und versuchen sie beim nächsten Start zu senden! Ansonsten kontaktiere uns doch bitte direkt per E-Mail shop@tbs-server.de</system:String>
|
||||
<system:String x:Key="BenachrichtigungFehler" xml:space="preserve">Leider ist ein Fehler beim Senden aufgetreten... Wir versuchen es beim nächsten start erneut!</system:String>
|
||||
<system:String x:Key="BenachrichtigungStartKeinInternet" xml:space="preserve">Anscheinend hast du aktuell kein Internet. Somit können wir deine Lizenz nicht prüfen. Prüfe deine Verbindung und starte das Programm neu.</system:String>
|
||||
<system:String x:Key="BenachrichtigungStartValheim" xml:space="preserve">Starte Valheim, drücke ESC zum abbrechen</system:String>
|
||||
<!--Lizenz Fenster-->
|
||||
<system:String x:Key="LizenzButton" xml:space="preserve">Bestätigen</system:String>
|
||||
<system:String x:Key="LizenzText" xml:space="preserve">Lizenz:</system:String>
|
||||
<system:String x:Key="LizenzKeyBereitsAktiviert" xml:space="preserve">Die Lizenz wurde bereits aktiviert auf einem anderem PC. Bitte deaktiviere die Lizenz unter https://tbs-server.de in dem bereich "Mein Konto".</system:String>
|
||||
<system:String x:Key="LizenzKeyAktiviert" xml:space="preserve">Programm erfolgreich aktiviert. Starte Programm.</system:String>
|
||||
<system:String x:Key="LizenzKeyFehler" xml:space="preserve">Bitte überprüfe deine Lizenz eingabe. Solltest du keinen Fehler finden, kontaktiere uns unter: https://tbs-server.de/kontakt oder per Mail shop@tbs-server.de Wir melden uns schnellst möglich zurück!</system:String>
|
||||
<!--Crash Fenser-->
|
||||
<system:String x:Key="CrashBenachrichtigung" xml:space="preserve">Ein Fehler wurde in der Anwendung festgestellt. Möchtest du den Bericht senden?</system:String>
|
||||
<system:String x:Key="CrashSenden" xml:space="preserve">Senden</system:String>
|
||||
<system:String x:Key="CrashNichtSenden" xml:space="preserve">Abbruch</system:String>
|
||||
<system:String x:Key="CrashGesendet" xml:space="preserve">Absturzbericht wurde erfolgreich übertragen. Bei Rückfragen wird der Käufer der Lizenz kontaktiert.</system:String>
|
||||
<system:String x:Key="CrashFehler" xml:space="preserve">Absturzbericht wurde nicht übertragen. Bitte treten sie mit tbS in kontakt. Nutzen sie dafür das Kontakt - Formular auf der website.</system:String>
|
||||
<!--Setup Fenster-->
|
||||
<system:String x:Key="SetupBeenden" xml:space="preserve">Setup Beenden</system:String>
|
||||
<system:String x:Key="SetupIPWeiter" xml:space="preserve">IP Übermitteln</system:String>
|
||||
<system:String x:Key="SetupTextAdmin" xml:space="preserve">Dies ist die erste Lizenz die aktiviert wurde. Somit ist dies jetzt die Admin-Lizenz. Alle anderen Lizenz schlüssel übernehmen automatisch die eingetragene Server-IP:Port. Die Server-IP:Port kann jederzeit im Menü geändert werden! Danach müssen alle anderen Clients neustarten um die Server-IP:Port zu erhalten. Mit klick auf Setup Beenden, werden die daten Übertragen.</system:String>
|
||||
<system:String x:Key="SetupIPFehler" xml:space="preserve"> Bitte trage eine Server-IP:Port ein!</system:String>
|
||||
<system:String x:Key="ServerIPUebertragenFehler" xml:space="preserve"> Übertragung fehlgeschlagen! Bitte erneut versuchen!</system:String>
|
||||
<system:String x:Key="ServerIPUebertragen" xml:space="preserve"> Die Server-IP wurde erfolgreich eingetragen. Starte nun bitte den Server oder starte diesen Neu damit sich der Server verifizieren kann und das Plugin aktiv ist. Danach klicke auf Setup Beenden. </system:String>
|
||||
</ResourceDictionary>
|
||||
127
Valheim Mod Sync Desktop/Lizenz.xaml
Normal file
127
Valheim Mod Sync Desktop/Lizenz.xaml
Normal file
@@ -0,0 +1,127 @@
|
||||
<Window x:Class="Valheim_Mod_Sync_Desktop.Lizenz"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
Title="Valheim Mod Sync Lizenz" Height="200" Width="400" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen" Icon="/files/tbs.ico">
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
<StackPanel
|
||||
x:Name="header"
|
||||
Height="25px"
|
||||
Background="{DynamicResource BackgroundHeader}" Margin="0,0,0,175"
|
||||
Orientation="Horizontal"
|
||||
MouseLeftButtonDown="header_MouseLeftButtonDown"
|
||||
>
|
||||
|
||||
<Label
|
||||
Content="Valheim Mod Sync"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
Width="130px"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="miniBtn"
|
||||
MouseLeftButtonDown="miniBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Minus}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="220,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="exitBtn"
|
||||
MouseLeftButtonDown="exitBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Close}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
<TextBox
|
||||
x:Name="LizenzKey"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="70,35,0,0"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Width="315"
|
||||
Height="24"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
BorderBrush="{x:Null}" Cursor="IBeam"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
Margin="15,38,0,0"
|
||||
Text="{DynamicResource LizenzText}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="outputlizenz"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,69,0,0"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Width="370"
|
||||
Height="85"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
Cursor="IBeam"
|
||||
IsReadOnly="False"
|
||||
/>
|
||||
|
||||
<Button
|
||||
x:Name="bestätigen"
|
||||
Content="{DynamicResource LizenzButton}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,163,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Click="bestätigen_Click"
|
||||
/>
|
||||
<ComboBox
|
||||
x:Name="Sprache"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}"
|
||||
BorderThickness="0"
|
||||
Width="100"
|
||||
Height="45"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
BorderBrush="{DynamicResource HeaderTextColor}"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
Margin="285,150,15,5"
|
||||
SelectionChanged="Sprache_SelectionChanged"
|
||||
>
|
||||
<ComboBoxItem>German</ComboBoxItem>
|
||||
<ComboBoxItem>English</ComboBoxItem>
|
||||
</ComboBox>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
173
Valheim Mod Sync Desktop/Lizenz.xaml.cs
Normal file
173
Valheim Mod Sync Desktop/Lizenz.xaml.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
|
||||
public partial class Lizenz : Window
|
||||
{
|
||||
public class LizenzReturn
|
||||
{
|
||||
public bool success { get; set; }
|
||||
public LizenzDetail data { get; set; }
|
||||
}
|
||||
|
||||
public class LizenzDetail
|
||||
{
|
||||
public int timesActivatedMax { get; set; }
|
||||
public int remainingActivations { get; set; }
|
||||
public int timesActivated { get; set; }
|
||||
public string hwid { get; set; }
|
||||
}
|
||||
|
||||
public Lizenz()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Sprache.Text = Properties.Settings.Default.Sprache;
|
||||
|
||||
}
|
||||
|
||||
//Close Button
|
||||
private void exitBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
MainWindow.LizenzReturn = "false";
|
||||
}
|
||||
|
||||
//Minimize Button
|
||||
private void miniBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
//Header Move
|
||||
private void header_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
|
||||
//Save Sprache
|
||||
private void Sprache_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ComboBoxItem sprachItem = (ComboBoxItem)Sprache.SelectedItem;
|
||||
string sprachvalue = sprachItem.Content.ToString();
|
||||
Properties.Settings.Default.Sprache = sprachvalue;
|
||||
Properties.Settings.Default.Save();
|
||||
var app1 = (App)Application.Current;
|
||||
app1.ChangeLanguage(new Uri("/Language/" + sprachvalue + ".xaml", UriKind.RelativeOrAbsolute));
|
||||
|
||||
}
|
||||
|
||||
private async void bestätigen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var LizenzKeyClean = LizenzKey.Text.Replace(" ", "");
|
||||
|
||||
try
|
||||
{
|
||||
string html = string.Empty;
|
||||
string url = @"https://tbs-server.de//wp-json/lmfwc/v2/licenses/validate/" + LizenzKeyClean;
|
||||
string encoded = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1")
|
||||
.GetBytes(Properties.Settings.Default.benutzername + ":" + Properties.Settings.Default.passwort));
|
||||
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
request.Headers.Add("Authorization", "Basic " + encoded);
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
html = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
LizenzReturn lizenz_return = JsonSerializer.Deserialize<LizenzReturn>(html);
|
||||
//Debug.WriteLine(lizenz_return.success);
|
||||
//Debug.WriteLine(lizenz_return.data.timesActivated);
|
||||
//Debug.WriteLine(lizenz_return.data.timesActivatedMax);
|
||||
//Debug.WriteLine(lizenz_return.data.remainingActivations);
|
||||
//Debug.WriteLine(lizenz_return.data.hwid);
|
||||
//Debug.WriteLine(html);
|
||||
|
||||
if (lizenz_return.data.timesActivated != lizenz_return.data.timesActivatedMax && lizenz_return.data.remainingActivations != 0)
|
||||
{
|
||||
string html1 = string.Empty;
|
||||
|
||||
string url1 = @"https://tbs-server.de//wp-json/lmfwc/v2/licenses/activate/" + LizenzKeyClean + "?hwid=" + HardwareID();
|
||||
HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create(url1);
|
||||
request1.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
request1.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(Properties.Settings.Default.benutzername + ":" + Properties.Settings.Default.passwort));
|
||||
|
||||
using (HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse())
|
||||
using (Stream stream1 = response1.GetResponseStream())
|
||||
using (StreamReader reader1 = new StreamReader(stream1))
|
||||
{
|
||||
html1 = reader1.ReadToEnd();
|
||||
}
|
||||
|
||||
|
||||
outputlizenz.Text = (string)Application.Current.FindResource("LizenzKeyAktiviert");
|
||||
MainWindow.LizenzReturn = "true";
|
||||
Properties.Settings.Default.Lizenz = LizenzKeyClean;
|
||||
Properties.Settings.Default.Save();
|
||||
await Task.Delay(2000);
|
||||
this.Close();
|
||||
}
|
||||
else if (lizenz_return.data.hwid != HardwareID())
|
||||
{
|
||||
outputlizenz.Text = (string)Application.Current.FindResource("LizenzKeyBereitsAktiviert");
|
||||
}
|
||||
else if (lizenz_return.data.hwid == HardwareID())
|
||||
{
|
||||
Properties.Settings.Default.Lizenz = LizenzKeyClean;
|
||||
Properties.Settings.Default.Save();
|
||||
outputlizenz.Text = (string)Application.Current.FindResource("LizenzKeyAktiviert");
|
||||
MainWindow.LizenzReturn = "true";
|
||||
Properties.Settings.Default.Lizenz = LizenzKeyClean;
|
||||
Properties.Settings.Default.Save();
|
||||
await Task.Delay(2000);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
outputlizenz.Text = (string)Application.Current.FindResource("LizenzKeyFehler");
|
||||
}
|
||||
}
|
||||
|
||||
public static string HardwareID()
|
||||
{
|
||||
string location = @"SOFTWARE\Microsoft\Cryptography";
|
||||
string name = "MachineGuid";
|
||||
|
||||
using (RegistryKey localMachineX64View =
|
||||
RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
|
||||
{
|
||||
using (RegistryKey rk = localMachineX64View.OpenSubKey(location))
|
||||
{
|
||||
if (rk == null)
|
||||
throw new KeyNotFoundException(
|
||||
string.Format("Key Not Found: {0}", location));
|
||||
|
||||
object machineGuid = rk.GetValue(name);
|
||||
if (machineGuid == null)
|
||||
throw new IndexOutOfRangeException(
|
||||
string.Format("Index Not Found: {0}", name));
|
||||
|
||||
return machineGuid.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
252
Valheim Mod Sync Desktop/MainWindow.xaml
Normal file
252
Valheim Mod Sync Desktop/MainWindow.xaml
Normal file
@@ -0,0 +1,252 @@
|
||||
<Window x:Class="Valheim_Mod_Sync_Desktop.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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_Mod_Sync_Desktop"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
mc:Ignorable="d"
|
||||
Title="Valheim Mod Sync" MinHeight="450" Height="450" MinWidth="800" Width="800" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen" Icon="/files/tbs.ico"
|
||||
>
|
||||
<materialDesign:DrawerHost x:Name="DrawerHostMain"
|
||||
IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked }" BottomDrawerBackground="{x:Null}"
|
||||
>
|
||||
<materialDesign:DrawerHost.LeftDrawerContent>
|
||||
<StackPanel MinWidth="220" Background="{DynamicResource BackgroundHeader}">
|
||||
<ToggleButton
|
||||
Style="{StaticResource MaterialDesignHamburgerToggleButton}"
|
||||
x:Name="Test123"
|
||||
DockPanel.Dock="Top"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="16"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}"
|
||||
Command="{x:Static materialDesign:DrawerHost.CloseDrawerCommand}"
|
||||
CommandParameter="{x:Static Dock.Left}"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
Margin="8 0 0 0"
|
||||
Text="{DynamicResource Theme}"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
TextDecorations="Underline"
|
||||
FontWeight="Bold"
|
||||
/>
|
||||
|
||||
<ComboBox
|
||||
x:Name="Theme"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}"
|
||||
BorderThickness="0"
|
||||
Width="200"
|
||||
Height="50"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
BorderBrush="{DynamicResource HeaderTextColor}"
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
SelectionChanged="theme_SelectionChanged"
|
||||
>
|
||||
<ComboBoxItem>Light</ComboBoxItem>
|
||||
<ComboBoxItem>Dark</ComboBoxItem>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Margin="8 8 0 0"
|
||||
Text="{DynamicResource Server}"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
TextDecorations="Underline"
|
||||
FontWeight="Bold"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="Server"
|
||||
Margin="0 10 0 0"
|
||||
BorderThickness="0"
|
||||
VerticalContentAlignment="Center"
|
||||
Padding="10 0 10 0"
|
||||
Width="200"
|
||||
Height="40"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
BorderBrush="{DynamicResource HeaderTextColor}"
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
TextChanged="Server_TextChanged"
|
||||
CaretBrush="{DynamicResource HeaderTextColor}"
|
||||
Cursor="Arrow"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
Margin="8 8 0 0"
|
||||
Text="{DynamicResource Sprache}"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
TextDecorations="Underline"
|
||||
FontWeight="Bold"
|
||||
/>
|
||||
|
||||
<ComboBox
|
||||
x:Name="Sprache"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}"
|
||||
BorderThickness="0"
|
||||
Width="200"
|
||||
Height="50"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
BorderBrush="{DynamicResource HeaderTextColor}"
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
SelectionChanged="Sprache_SelectionChanged"
|
||||
>
|
||||
<ComboBoxItem>German</ComboBoxItem>
|
||||
<ComboBoxItem>English</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<TextBlock
|
||||
Margin="8 8 0 0"
|
||||
Text="Valheim Autostart:"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
TextDecorations="Underline"
|
||||
FontWeight="Bold"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
x:Name="Autostart"
|
||||
Style="{StaticResource MaterialDesignCheckBox}"
|
||||
Margin="190 -15 0 0"
|
||||
Background="{DynamicResource HeaderTextColor}"
|
||||
Click="Autostart_Click"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
Margin="8 8 0 0"
|
||||
Text="{DynamicResource StartMenuVerknuepfung}"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
TextDecorations="Underline"
|
||||
FontWeight="Bold"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
x:Name="StartmenueVerknuepfung"
|
||||
Style="{StaticResource MaterialDesignCheckBox}"
|
||||
Margin="190 -15 0 0"
|
||||
Background="{DynamicResource HeaderTextColor}"
|
||||
Click="StartmenueVerknuepfung_Click"
|
||||
/>
|
||||
|
||||
<Button
|
||||
x:Name="Kontakt"
|
||||
Content="{DynamicResource Kontakt}"
|
||||
Click="KontaktButton_Click"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,35,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
Command="{x:Static materialDesign:DrawerHost.CloseDrawerCommand}"
|
||||
CommandParameter="{x:Static Dock.Left}"
|
||||
/>
|
||||
|
||||
<Button
|
||||
x:Name="Lizenz_Deaktivieren"
|
||||
Content="{DynamicResource Lizenz_Deaktivieren}"
|
||||
Click="Lizenz_Deaktivieren_Click"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
Command="{x:Static materialDesign:DrawerHost.CloseDrawerCommand}"
|
||||
CommandParameter="{x:Static Dock.Left}"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
</materialDesign:DrawerHost.LeftDrawerContent>
|
||||
<Grid>
|
||||
|
||||
<materialDesign:ColorZone
|
||||
x:Name="header"
|
||||
Padding="16"
|
||||
Background="{DynamicResource BackgroundHeader}"
|
||||
MouseLeftButtonDown="header_MouseLeftButtonDown"
|
||||
>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
>
|
||||
|
||||
|
||||
|
||||
<ToggleButton
|
||||
x:Name="MenuToggleButton"
|
||||
Style="{DynamicResource MaterialDesignHamburgerToggleButton}"
|
||||
Foreground="{DynamicResource MenuToggleButtonColor}"
|
||||
Command="{x:Static materialDesign:DrawerHost.OpenDrawerCommand}"
|
||||
CommandParameter="{x:Static Dock.Left}"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="Back"
|
||||
Content="{materialDesign:PackIcon Kind=ArrowLeft, Size=30}"
|
||||
VerticalAlignment="Center"
|
||||
MouseLeftButtonDown="Back_MouseLeftButtonDown"
|
||||
Foreground="{DynamicResource MenuToggleButtonColor}" Width="37" Height="37"
|
||||
Visibility="Collapsed"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Margin="32 0 0 0"
|
||||
Text="Valheim Mod Sync."
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
TextDecorations="Underline"
|
||||
FontWeight="Bold"
|
||||
FontSize="16"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="miniBtn"
|
||||
MouseLeftButtonDown="miniBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Minus}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="510,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="exitBtn"
|
||||
MouseLeftButtonDown="exitBtn_MouseLeftButtonDown"
|
||||
Content="{materialDesign:PackIcon Close}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource CloseMinimizeColor}"
|
||||
Cursor="Hand"
|
||||
/>
|
||||
</StackPanel>
|
||||
</materialDesign:ColorZone>
|
||||
<Grid
|
||||
Height="25px" Margin="0,0,0,356" Grid.Row="1"
|
||||
Background="{DynamicResource BackgroundHeader}"
|
||||
x:Name="MenüGrid"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80*" ></ColumnDefinition>
|
||||
<ColumnDefinition Width="61*" ></ColumnDefinition>
|
||||
<ColumnDefinition Width="19*"/>
|
||||
<ColumnDefinition Width="80*" ></ColumnDefinition>
|
||||
<ColumnDefinition Width="80*" ></ColumnDefinition>
|
||||
<ColumnDefinition Width="80*" ></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" x:Name="Sync_Menu" Click="Sync_Menu_Click" Background="Transparent" BorderBrush="Transparent" Margin="0,0,0,-7">Sync</Button>
|
||||
<Button Grid.Column="1" x:Name="Mods_View" Click="Mods_View_Click" Background="Transparent" BorderBrush="Transparent" Height="32" VerticalAlignment="Top" Grid.ColumnSpan="2">Mods</Button>
|
||||
<Button Grid.Column="4" x:Name="Lizenzen_View" Click="Lizenzen_View_Click" Background="Transparent" BorderBrush="Transparent" Height="32" VerticalAlignment="Top">Lizenzen</Button>
|
||||
<Button Grid.Column="5" x:Name="Einstellungen_View" Click="Einstellungen_View_Click" Background="Transparent" BorderBrush="Transparent" Margin="0,0,0,-7">Einstellungen</Button>
|
||||
|
||||
</Grid>
|
||||
<ContentControl x:Name="contentControl" Content="{Binding SelectedViewModel}" Grid.Row="1" Margin="0,25,0,0"/>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</materialDesign:DrawerHost>
|
||||
</Window>
|
||||
554
Valheim Mod Sync Desktop/MainWindow.xaml.cs
Normal file
554
Valheim Mod Sync Desktop/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,554 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Text.Json;
|
||||
using System.IO;
|
||||
using Application = System.Windows.Application;
|
||||
using Valheim_Mod_Sync_Desktop.ViewModels;
|
||||
using Valheim_Mod_Sync_Desktop.Views;
|
||||
using IWshRuntimeLibrary;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Valheim_Mod_Sync_Desktop.Properties;
|
||||
using System.Diagnostics;
|
||||
using System.Configuration;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
public class LizenzReturn
|
||||
{
|
||||
public bool success { get; set; }
|
||||
public LizenzDetail data { get; set; }
|
||||
}
|
||||
|
||||
public class LizenzDetail
|
||||
{
|
||||
public int timesActivatedMax { get; set; }
|
||||
public int remainingActivations { get; set; }
|
||||
public int timesActivated { get; set; }
|
||||
public string hwid { get; set; }
|
||||
}
|
||||
|
||||
public class LizenzReturnDeactivate
|
||||
{
|
||||
public bool success { get; set; }
|
||||
public LizenzDetailDeactivate data { get; set; }
|
||||
}
|
||||
|
||||
public class LizenzDetailDeactivate
|
||||
{
|
||||
public int timesActivatedMax { get; set; }
|
||||
public int remainingActivations { get; set; }
|
||||
public int timesActivated { get; set; }
|
||||
public string hwid { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static string LizenzReturn { get; set; }
|
||||
private MainViewModel viewModel;
|
||||
private Ladescreen _splashScreen;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
viewModel = new MainViewModel();
|
||||
DataContext = viewModel;
|
||||
Loaded += Loadedfinish;
|
||||
|
||||
// Erstelle den Splashscreen und zeige ihn an
|
||||
_splashScreen = new Ladescreen();
|
||||
_splashScreen.Show();
|
||||
_splashScreen.SetProgress(0);
|
||||
// Starte den Hintergrundprozess
|
||||
Task.Run(async () =>
|
||||
{
|
||||
// Führe die Aufgabe aus
|
||||
await DoLongTaskAsync();
|
||||
|
||||
// Schließe den Splashscreen
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
this.Show();
|
||||
_splashScreen.Close();
|
||||
Debug.WriteLine("show");
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private async Task DoLongTaskAsync()
|
||||
{
|
||||
|
||||
await UpdateProgressAsync(10);
|
||||
await UpdateProgressNameAsync("Prüfe Config");
|
||||
Debug.WriteLine("10");
|
||||
//Debug.WriteLine(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
|
||||
//Übernehmem der alten Config beim ersten Start
|
||||
if (Properties.Settings.Default.ErsterStart)
|
||||
{
|
||||
Properties.Settings.Default.Upgrade();
|
||||
Properties.Settings.Default.ErsterStart = false;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
}
|
||||
|
||||
// Aktualisiere den Fortschritt
|
||||
await UpdateProgressAsync(30);
|
||||
await UpdateProgressNameAsync("Lade Config");
|
||||
Debug.WriteLine("30");
|
||||
//Read config
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Hier kommt Ihr Code rein
|
||||
Theme.Text = Properties.Settings.Default.Theme;
|
||||
Server.Text = Properties.Settings.Default.Server;
|
||||
Sprache.Text = Properties.Settings.Default.Sprache;
|
||||
Autostart.IsChecked = Properties.Settings.Default.Autostart;
|
||||
StartmenueVerknuepfung.IsChecked = Properties.Settings.Default.Verknuepfung;
|
||||
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
Debug.WriteLine("Fehler: " + ex.Message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Aktualisiere den Fortschritt
|
||||
await UpdateProgressAsync(50);
|
||||
await UpdateProgressNameAsync("Prüfe Internetzugang");
|
||||
Debug.WriteLine("50");
|
||||
//prüfe verbindung
|
||||
if (SyncControl.IsConnectionAvailable())
|
||||
{
|
||||
//prüfe lizenz
|
||||
// Aktualisiere den Fortschritt
|
||||
|
||||
await UpdateProgressAsync(60);
|
||||
await UpdateProgressNameAsync("Prüfe Lizenz");
|
||||
Debug.WriteLine("60");
|
||||
await Prüfung();
|
||||
// Aktualisiere den Fortschritt
|
||||
await UpdateProgressAsync(70);
|
||||
await UpdateProgressNameAsync("Prüfe ob Server IP gesetzt");
|
||||
Debug.WriteLine("70");
|
||||
PrüfungServerIP();
|
||||
|
||||
|
||||
// Aktualisiere den Fortschritt
|
||||
await UpdateProgressAsync(80);
|
||||
Debug.WriteLine("80");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Benachrichtigung modalWindow = new Benachrichtigung(false, false, false, false, false, false, true, false);
|
||||
modalWindow.ShowDialog();
|
||||
|
||||
if (LizenzReturn == "false")
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Aktualisiere den Fortschritt
|
||||
await UpdateProgressAsync(90);
|
||||
await UpdateProgressNameAsync("Prüfe Einstellungen");
|
||||
Debug.WriteLine("90");
|
||||
//check autostart
|
||||
SyncControl.CheckUpdateAutostart();
|
||||
// Aktualisiere den Fortschritt
|
||||
await UpdateProgressAsync(95);
|
||||
await UpdateProgressNameAsync("Lade Anwendung");
|
||||
Debug.WriteLine("95");
|
||||
|
||||
await UpdateProgressAsync(100);
|
||||
await UpdateProgressNameAsync("Fertig");
|
||||
Debug.WriteLine("100");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async Task UpdateProgressAsync(int progress)
|
||||
{
|
||||
// Aktualisiere den Fortschritt
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_splashScreen.SetProgress(progress);
|
||||
});
|
||||
|
||||
// Warte eine kurze Zeit, damit die Fortschrittsleiste aktualisiert wird
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
private async Task UpdateProgressNameAsync(string progressName)
|
||||
{
|
||||
// Aktualisiere den Fortschritt
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_splashScreen.SetProgressName(progressName);
|
||||
});
|
||||
|
||||
// Warte eine kurze Zeit, damit die Fortschrittsleiste aktualisiert wird
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
//Wenn fertig geladen
|
||||
|
||||
private void Loadedfinish(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Properties.Settings.Default.Server == "..." && admin || !Properties.Settings.Default.Server.Contains(":") && admin)
|
||||
{
|
||||
contentControl.Content = new SetupViewModel();
|
||||
MenüGrid.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
if (!admin)
|
||||
{
|
||||
Server.IsEnabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Prüfung
|
||||
private async Task Prüfung()
|
||||
{
|
||||
|
||||
|
||||
if (Properties.Settings.Default.Lizenz == "")
|
||||
{
|
||||
|
||||
|
||||
Lizenz modalWindow = null;
|
||||
await Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
modalWindow = new Lizenz();
|
||||
modalWindow.ShowDialog();
|
||||
});
|
||||
|
||||
if (LizenzReturn == "false")
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
// Schließen des Splashscreens
|
||||
_splashScreen.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_splashScreen.Close();
|
||||
});
|
||||
((MainWindow)Application.Current.MainWindow).Close();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}else
|
||||
{
|
||||
string html = string.Empty;
|
||||
string url = @"https://tbs-server.de/wp-json/lmfwc/v2/licenses/validate/" + Properties.Settings.Default.Lizenz;
|
||||
string encoded = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1")
|
||||
.GetBytes(Properties.Settings.Default.benutzername + ":" + Properties.Settings.Default.passwort));
|
||||
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
request.Headers.Add("Authorization", "Basic " + encoded);
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
html = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
LizenzReturn lizenz_return = JsonSerializer.Deserialize<LizenzReturn>(html);
|
||||
|
||||
if (lizenz_return.data.hwid != Lizenz.HardwareID())
|
||||
{
|
||||
Lizenz modalWindow = new Lizenz();
|
||||
modalWindow.ShowDialog();
|
||||
|
||||
if (LizenzReturn == "false")
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LizenzIPReturn_
|
||||
{
|
||||
public string Admin { get; set; }
|
||||
public string IP_Alt { get; set; }
|
||||
public string IP { get; set; }
|
||||
}
|
||||
|
||||
private bool admin;
|
||||
|
||||
//Prüfung ServerIP
|
||||
private void PrüfungServerIP()
|
||||
{
|
||||
|
||||
string html = string.Empty;
|
||||
string url = @"https://tbs-server.de//wp-json/lmfwc/v2/vms/check_server_ip/" + Properties.Settings.Default.Lizenz;
|
||||
string encoded = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1")
|
||||
.GetBytes(Properties.Settings.Default.benutzername + ":" + Properties.Settings.Default.passwort));
|
||||
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
request.Headers.Add("Authorization", "Basic " + encoded);
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
html = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
LizenzIPReturn_ lizenzip_return_ = JsonSerializer.Deserialize<LizenzIPReturn_>(html);
|
||||
admin = (lizenzip_return_.Admin == "true") ? true : false;
|
||||
|
||||
if (!lizenzip_return_.IP.Equals("0") | lizenzip_return_.IP.Contains(":"))
|
||||
{
|
||||
Properties.Settings.Default.Server = lizenzip_return_.IP;
|
||||
Properties.Settings.Default.ModVersion = 0;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Server.Text = lizenzip_return_.IP;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Properties.Settings.Default.Server = "...";
|
||||
Properties.Settings.Default.ModVersion = 0;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Close Button
|
||||
private void exitBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
//Minimize Button
|
||||
private void miniBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
//Header Move
|
||||
private void header_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
|
||||
//Save Theme Change to Config
|
||||
private void theme_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ComboBoxItem typeItem = (ComboBoxItem)Theme.SelectedItem;
|
||||
string value = typeItem.Content.ToString();
|
||||
Properties.Settings.Default.Theme = value;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
var app = (App)Application.Current; app.ChangeTheme(new Uri("/Skins/" + value + ".xaml", UriKind.RelativeOrAbsolute));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Save Sprache
|
||||
private void Sprache_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ComboBoxItem sprachItem = (ComboBoxItem)Sprache.SelectedItem;
|
||||
string sprachvalue = sprachItem.Content.ToString();
|
||||
Properties.Settings.Default.Sprache = sprachvalue;
|
||||
Properties.Settings.Default.Save();
|
||||
var app1 = (App)Application.Current;
|
||||
app1.ChangeLanguage(new Uri("/Language/" + sprachvalue + ".xaml", UriKind.RelativeOrAbsolute));
|
||||
|
||||
}
|
||||
|
||||
//Save Server
|
||||
private void Server_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (Server.Text != Properties.Settings.Default.Server)
|
||||
{
|
||||
//Debug.WriteLine("change");
|
||||
Properties.Settings.Default.ModVersion = 0;
|
||||
Properties.Settings.Default.Server = Server.Text;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Save state Autostart
|
||||
private void Autostart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.Autostart = (bool)Autostart.IsChecked;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
//Kontakt Button
|
||||
private void KontaktButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
contentControl.Content = new Kontakt();
|
||||
MenuToggleButton.Visibility = Visibility.Collapsed;
|
||||
Back.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
//Zurück Button
|
||||
private void Back_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
contentControl.Content = new SyncControl();
|
||||
Back.Visibility = Visibility.Collapsed;
|
||||
MenuToggleButton.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
//Verknüpfung Hinzufügen / Löschen
|
||||
private void StartmenueVerknuepfung_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.Verknuepfung = (bool)StartmenueVerknuepfung.IsChecked;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
string pathToExe = Directory.GetCurrentDirectory() + "/" + System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe";
|
||||
string programs_path = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
|
||||
string appStartMenuOrdner = "tbs-server.de";
|
||||
string appStartMenuPath = Path.Combine(programs_path, appStartMenuOrdner, "Valheim Mod Sync");
|
||||
string settingsLink = Path.Combine(appStartMenuPath, "Valheim Mod Sync.lnk");
|
||||
|
||||
if (StartmenueVerknuepfung.IsChecked == true)
|
||||
{
|
||||
if (!Directory.Exists(appStartMenuPath))
|
||||
{
|
||||
Directory.CreateDirectory(appStartMenuPath);
|
||||
}
|
||||
|
||||
new WebClient().DownloadFile("https://vms.tbs-server.de/vms.ico", appStartMenuPath+"/vms.ico");
|
||||
|
||||
WshShell shellClass = new WshShell();
|
||||
|
||||
IWshShortcut shortcut = (IWshShortcut)shellClass.CreateShortcut(settingsLink);
|
||||
shortcut.TargetPath = pathToExe;
|
||||
shortcut.WorkingDirectory = Directory.GetCurrentDirectory();
|
||||
shortcut.IconLocation = appStartMenuPath+"/vms.ico";
|
||||
shortcut.Description = "Valheim Mod Sync";
|
||||
shortcut.Save();
|
||||
}else
|
||||
{
|
||||
if (Directory.Exists(appStartMenuPath))
|
||||
{
|
||||
System.IO.File.Delete(settingsLink);
|
||||
System.IO.File.Delete(appStartMenuPath + "/vms.ico");
|
||||
Directory.Delete(appStartMenuPath);
|
||||
if (!Directory.EnumerateFileSystemEntries(Path.Combine(programs_path, appStartMenuOrdner)).Any())
|
||||
{
|
||||
Directory.Delete(Path.Combine(programs_path, appStartMenuOrdner));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Lizenz_Deaktivieren_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string html = string.Empty;
|
||||
string url = @"https://tbs-server.de//wp-json/lmfwc/v2/licenses/deactivate/" + Properties.Settings.Default.Lizenz;
|
||||
string encoded = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1")
|
||||
.GetBytes(Properties.Settings.Default.benutzername + ":" + Properties.Settings.Default.passwort));
|
||||
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
request.Headers.Add("Authorization", "Basic " + encoded);
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
html = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
LizenzReturnDeactivate lizenz_return_deactivate = JsonSerializer.Deserialize<LizenzReturnDeactivate>(html);
|
||||
|
||||
|
||||
if (lizenz_return_deactivate.data.timesActivated != lizenz_return_deactivate.data.timesActivatedMax && lizenz_return_deactivate.success == true)
|
||||
{
|
||||
|
||||
Properties.Settings.Default.Lizenz = "";
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//outputlizenz.Text = (string)Application.Current.FindResource("LizenzKeyFehler");
|
||||
}
|
||||
}
|
||||
|
||||
private void Sync_Menu_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
contentControl.Content = new SyncControl();
|
||||
MenüAktivBorder();
|
||||
Sync_Menu.SetResourceReference(Button.BackgroundProperty, "BackgroundGrid");
|
||||
}
|
||||
|
||||
private void Mods_View_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
contentControl.Content = new FTP();
|
||||
MenüAktivBorder();
|
||||
Mods_View.SetResourceReference(Button.BackgroundProperty, "BackgroundGrid");
|
||||
}
|
||||
|
||||
private void Lizenzen_View_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
contentControl.Content = new Lizenzen();
|
||||
MenüAktivBorder();
|
||||
Mods_View.SetResourceReference(Button.BackgroundProperty, "BackgroundGrid");
|
||||
}
|
||||
|
||||
private void Einstellungen_View_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
contentControl.Content = new Kontakt();
|
||||
MenüAktivBorder();
|
||||
//Einstellungen_View.Background = Brushes.Red;
|
||||
Einstellungen_View.SetResourceReference(Button.BackgroundProperty, "BackgroundGrid");
|
||||
|
||||
}
|
||||
|
||||
private void MenüAktivBorder()
|
||||
{
|
||||
foreach (var child in MenüGrid.Children)
|
||||
{
|
||||
if (child is Button button)
|
||||
{
|
||||
button.Background = Brushes.Transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Valheim Mod Sync Desktop/Properties/.resx
Normal file
101
Valheim Mod Sync Desktop/Properties/.resx
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
152
Valheim Mod Sync Desktop/Properties/Settings.Designer.cs
generated
Normal file
152
Valheim Mod Sync Desktop/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,152 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.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;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Light")]
|
||||
public string Theme {
|
||||
get {
|
||||
return ((string)(this["Theme"]));
|
||||
}
|
||||
set {
|
||||
this["Theme"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("...")]
|
||||
public string Server {
|
||||
get {
|
||||
return ((string)(this["Server"]));
|
||||
}
|
||||
set {
|
||||
this["Server"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool Autostart {
|
||||
get {
|
||||
return ((bool)(this["Autostart"]));
|
||||
}
|
||||
set {
|
||||
this["Autostart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("...")]
|
||||
public string Pfad {
|
||||
get {
|
||||
return ((string)(this["Pfad"]));
|
||||
}
|
||||
set {
|
||||
this["Pfad"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public int ModVersion {
|
||||
get {
|
||||
return ((int)(this["ModVersion"]));
|
||||
}
|
||||
set {
|
||||
this["ModVersion"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("German")]
|
||||
public string Sprache {
|
||||
get {
|
||||
return ((string)(this["Sprache"]));
|
||||
}
|
||||
set {
|
||||
this["Sprache"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool ErsterStart {
|
||||
get {
|
||||
return ((bool)(this["ErsterStart"]));
|
||||
}
|
||||
set {
|
||||
this["ErsterStart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string Lizenz {
|
||||
get {
|
||||
return ((string)(this["Lizenz"]));
|
||||
}
|
||||
set {
|
||||
this["Lizenz"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool Verknuepfung {
|
||||
get {
|
||||
return ((bool)(this["Verknuepfung"]));
|
||||
}
|
||||
set {
|
||||
this["Verknuepfung"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("ck_f225a03d33849d1ca1e9d0de7e680c2bb82acbcd")]
|
||||
public string benutzername {
|
||||
get {
|
||||
return ((string)(this["benutzername"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("cs_02957c7f433035f4498ee991c69142f912a3ab0e")]
|
||||
public string passwort {
|
||||
get {
|
||||
return ((string)(this["passwort"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Valheim Mod Sync Desktop/Properties/Settings.settings
Normal file
39
Valheim Mod Sync Desktop/Properties/Settings.settings
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Valheim_Mod_Sync_Desktop.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Theme" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Light</Value>
|
||||
</Setting>
|
||||
<Setting Name="Server" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">...</Value>
|
||||
</Setting>
|
||||
<Setting Name="Autostart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="Pfad" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">...</Value>
|
||||
</Setting>
|
||||
<Setting Name="ModVersion" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="Sprache" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">German</Value>
|
||||
</Setting>
|
||||
<Setting Name="ErsterStart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="Lizenz" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="Verknuepfung" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="benutzername" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">ck_f225a03d33849d1ca1e9d0de7e680c2bb82acbcd</Value>
|
||||
</Setting>
|
||||
<Setting Name="passwort" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">cs_02957c7f433035f4498ee991c69142f912a3ab0e</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
7
Valheim Mod Sync Desktop/Properties/launchSettings.json
Normal file
7
Valheim Mod Sync Desktop/Properties/launchSettings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Valheim Mod Sync Desktop": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Valheim Mod Sync Desktop/Skins/Dark.xaml
Normal file
16
Valheim Mod Sync Desktop/Skins/Dark.xaml
Normal file
@@ -0,0 +1,16 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<SolidColorBrush x:Key="BackgroundGrid" Color="#FF252525"/>
|
||||
<SolidColorBrush x:Key="BackgroundHeader" Color="#FF1E1E1E"/>
|
||||
<SolidColorBrush x:Key="MenuToggleButtonColor" Color="#FFA4A4A4"/>
|
||||
<SolidColorBrush x:Key="HeaderTextColor" Color="#FFA4A4A4"/>
|
||||
<SolidColorBrush x:Key="CloseMinimizeColor" Color="#FFa4a4a4"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundColor" Color="#FF1E1E1E"/>
|
||||
<SolidColorBrush x:Key="ButtonTextColor" Color="#FFA4A4A4"/>
|
||||
<SolidColorBrush x:Key="TextBoxBackgroundColor" Color="#FF1E1E1E"/>
|
||||
<SolidColorBrush x:Key="TextBoxTextColor" Color="#FFA4A4A4"/>
|
||||
<SolidColorBrush x:Key="MaterialDesignPaper" Color="#ff252525"/>
|
||||
<SolidColorBrush x:Key="MaterialDesignCheckBoxOff" Color="#ffa4a4a4"/>
|
||||
<SolidColorBrush x:Key="CheckBoxFilled" Color="#ff252525"/>
|
||||
</ResourceDictionary>
|
||||
17
Valheim Mod Sync Desktop/Skins/Light.xaml
Normal file
17
Valheim Mod Sync Desktop/Skins/Light.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<SolidColorBrush x:Key="BackgroundGrid" Color="#FF7e7e7e"/>
|
||||
<SolidColorBrush x:Key="BackgroundHeader" Color="#FF676767"/>
|
||||
<SolidColorBrush x:Key="MenuToggleButtonColor" Color="Black"/>
|
||||
<SolidColorBrush x:Key="HeaderTextColor" Color="Black"/>
|
||||
<SolidColorBrush x:Key="CloseMinimizeColor" Color="Black"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundColor" Color="#FF676767"/>
|
||||
<SolidColorBrush x:Key="ButtonTextColor" Color="Black"/>
|
||||
<SolidColorBrush x:Key="TextBoxBackgroundColor" Color="#FF676767"/>
|
||||
<SolidColorBrush x:Key="TextBoxTextColor" Color="Black"/>
|
||||
<SolidColorBrush x:Key="MaterialDesignPaper" Color="#ff7e7e7e"/>
|
||||
<SolidColorBrush x:Key="MaterialDesignCheckBoxOff" Color="Black"/>
|
||||
<SolidColorBrush x:Key="CheckBoxFilled" Color="#ff7e7e7e"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
118
Valheim Mod Sync Desktop/Skins/Overwrite_Styles.xaml
Normal file
118
Valheim Mod Sync Desktop/Skins/Overwrite_Styles.xaml
Normal file
@@ -0,0 +1,118 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:materialDesign="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
|
||||
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf">
|
||||
|
||||
|
||||
<Style x:Key="MaterialDesignFilledComboBox" BasedOn="{StaticResource MaterialDesignFilledComboBox}" TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="wpf:TextFieldAssist.UnderlineBrush" Value="Transparent" />
|
||||
|
||||
|
||||
</Style>
|
||||
|
||||
|
||||
|
||||
<Style x:Key="MaterialDesignCheckBox" BasedOn="{StaticResource MaterialDesignCheckBox}" TargetType="{x:Type CheckBox}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/>
|
||||
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
|
||||
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type CheckBox}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="Click">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="InteractionEllipse">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="InteractionEllipse">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="InteractionEllipse">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="InteractionEllipse">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InteractionEllipse">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Viewbox Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}"
|
||||
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
FlowDirection="LeftToRight" >
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path x:Name="Graphic"
|
||||
Data="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"
|
||||
Fill="{DynamicResource MaterialDesignCheckBoxOff}" />
|
||||
|
||||
<Ellipse x:Name="InteractionEllipse" Fill="{TemplateBinding Foreground}" Width="0" Height="0" Canvas.Top="12" Canvas.Left="12" Opacity="0" RenderTransformOrigin="0.5,0.5"
|
||||
IsHitTestVisible="False">
|
||||
<Ellipse.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
<SkewTransform/>
|
||||
<RotateTransform/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</Ellipse.RenderTransform>
|
||||
</Ellipse>
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsPressed}" Value="true" />
|
||||
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:RippleAssist.IsDisabled)}" Value="false" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Click}"/>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="HasContent" Value="true">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
|
||||
<Setter Property="Padding" Value="4,2,0,0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true"/>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Data" TargetName="Graphic" Value="M19,19H5V5H15V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V11H19M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" />
|
||||
<Setter Property="Fill" TargetName="Graphic" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Fill" TargetName="Graphic" Value="{DynamicResource MaterialDesignCheckBoxDisabled}" />
|
||||
<Setter Property="Opacity" Value="0.56"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="{x:Null}">
|
||||
<Setter Property="Data" TargetName="Graphic" Value="M6,13L6,11L18,11L18,13M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" />
|
||||
<Setter Property="Fill" TargetName="Graphic" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="Validation.HasError" Value="true">
|
||||
<Setter Property="Fill" TargetName="Graphic" Value="{DynamicResource MaterialDesignValidationErrorBrush}" />
|
||||
<Setter Property="Control.Foreground" TargetName="contentPresenter" Value="{DynamicResource MaterialDesignValidationErrorBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
99
Valheim Mod Sync Desktop/Valheim Mod Sync Desktop.csproj
Normal file
99
Valheim Mod Sync Desktop/Valheim Mod Sync Desktop.csproj
Normal file
@@ -0,0 +1,99 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>Valheim_Mod_Sync_Desktop</RootNamespace>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>files\tbs.ico</ApplicationIcon>
|
||||
<Version>1.0.0.6</Version>
|
||||
<Authors>Tobias Röhrich</Authors>
|
||||
<Company>tbS-Server</Company>
|
||||
<Product>Valheim Mod Sync</Product>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<StartupObject>Valheim_Mod_Sync_Desktop.App</StartupObject>
|
||||
<PackageId>Valheim-Mod-Sync</PackageId>
|
||||
<SignAssembly>False</SignAssembly>
|
||||
|
||||
<DelaySign>False</DelaySign>
|
||||
<Copyright>tbS-server.de</Copyright>
|
||||
<PackageProjectUrl>https://tbs-server.de</PackageProjectUrl>
|
||||
<Description>Synchronsiere zwischen deinem Valheim Server und Client die Mods und Konfigs!</Description>
|
||||
<FileVersion></FileVersion>
|
||||
<Title>Valheim Mod Sync</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="files\tbs.ico" />
|
||||
<None Remove="files\tbs.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<COMReference Include="IWshRuntimeLibrary">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<Guid>f935dc20-1cf0-11d0-adb9-00c04fd58a0b</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.3.0" />
|
||||
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
|
||||
<PackageReference Include="ShowMeTheXAML.MSBuild" Version="2.0.0" />
|
||||
<PackageReference Include="SSH.NET" Version="2024.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="files\tbs.ico" />
|
||||
<Resource Include="files\tbs.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Crash.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Ladescreen.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Lizenz.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\Lizenzen.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\FTP.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Ladescreen.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Lizenz.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
Valheim Mod Sync Desktop/ViewModels/BaseViewModel.cs
Normal file
19
Valheim Mod Sync Desktop/ViewModels/BaseViewModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class BaseViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void onPopertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Valheim Mod Sync Desktop/ViewModels/FTPViewModel.cs
Normal file
13
Valheim Mod Sync Desktop/ViewModels/FTPViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class FTPViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
12
Valheim Mod Sync Desktop/ViewModels/KontaktViewModel.cs
Normal file
12
Valheim Mod Sync Desktop/ViewModels/KontaktViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class KontaktViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
13
Valheim Mod Sync Desktop/ViewModels/LizenzenViewModel.cs
Normal file
13
Valheim Mod Sync Desktop/ViewModels/LizenzenViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class LizenzenViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
39
Valheim Mod Sync Desktop/ViewModels/MainViewModel.cs
Normal file
39
Valheim Mod Sync Desktop/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Valheim_Mod_Sync_Desktop.Commands;
|
||||
using static Valheim_Mod_Sync_Desktop.MainWindow;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class MainViewModel : BaseViewModel
|
||||
{
|
||||
|
||||
private BaseViewModel _selectedViewModel = new SyncViewModel();
|
||||
|
||||
public BaseViewModel SelectedViewModel
|
||||
{
|
||||
get { return _selectedViewModel; }
|
||||
set { onPopertyChanged(nameof(SelectedViewModel)); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ICommand UpdateViewCommand { get; set; }
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
UpdateViewCommand = new UpdateViewCommand(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
14
Valheim Mod Sync Desktop/ViewModels/SetupViewModel.cs
Normal file
14
Valheim Mod Sync Desktop/ViewModels/SetupViewModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class SetupViewModel : BaseViewModel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
Valheim Mod Sync Desktop/ViewModels/SyncViewModel.cs
Normal file
13
Valheim Mod Sync Desktop/ViewModels/SyncViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.ViewModels
|
||||
{
|
||||
class SyncViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
40
Valheim Mod Sync Desktop/Views/FTP.xaml
Normal file
40
Valheim Mod Sync Desktop/Views/FTP.xaml
Normal file
@@ -0,0 +1,40 @@
|
||||
<UserControl x:Class="Valheim_Mod_Sync_Desktop.Views.FTP"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
xmlns:local="clr-namespace:Valheim_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="356" d:DesignWidth="800"
|
||||
>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="10">
|
||||
<Button Content="Aktualisieren" Click="LoadFileList_Click"/>
|
||||
<Button Content="Download" Click="DownloadButton_Click"/>
|
||||
<Button Content="Upload" Click="UploadButton_Click"/>
|
||||
<Button Content="Löschen" Click="DeleteButton_Click"/>
|
||||
<Button Content="Bearbeiten" Click="EditButton_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
<ListView x:Name="fileList" SelectionChanged="FileList_SelectionChanged" Margin="0,0,0,243" Grid.Row="1">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
|
||||
<GridViewColumn Header="Typ" DisplayMemberBinding="{Binding Type}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<Button Content="Zurück" Click="BackButton_Click" HorizontalAlignment="Left" Margin="486,0,0,0" VerticalAlignment="Center" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
259
Valheim Mod Sync Desktop/Views/FTP.xaml.cs
Normal file
259
Valheim Mod Sync Desktop/Views/FTP.xaml.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Win32;
|
||||
using Renci.SshNet;
|
||||
using Renci.SshNet.Common;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.Views
|
||||
{
|
||||
|
||||
public partial class FTP : System.Windows.Controls.UserControl
|
||||
{
|
||||
private string ftpUrl = "amp.tbs-server.de";
|
||||
private int port = 2229;
|
||||
private string username = "tbS";
|
||||
private string password = "JLI_._nTH-DyG53Se9";
|
||||
|
||||
public FTP()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
LoadFileList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private string currentDirectory = "/";
|
||||
|
||||
private void LoadFileList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var connectionInfo = new ConnectionInfo(ftpUrl, port, username,
|
||||
new PasswordAuthenticationMethod(username, password));
|
||||
|
||||
using (var client = new SftpClient(connectionInfo))
|
||||
{
|
||||
client.Connect();
|
||||
|
||||
var files = client.ListDirectory(currentDirectory)
|
||||
.Where(item => !item.IsDirectory) // Filtern Sie nur Dateien
|
||||
.Select(item => new FTPFile(item.Name)) // Erstellen Sie FTPFile Objekte für jede Datei
|
||||
.ToList();
|
||||
|
||||
fileList.ItemsSource = files;
|
||||
}
|
||||
}
|
||||
catch (SshAuthenticationException authEx)
|
||||
{
|
||||
MessageBox.Show("Fehler bei der Authentifizierung: " + authEx.Message);
|
||||
}
|
||||
catch (SshException sshEx)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Verbinden zum SFTP-Server: " + sshEx.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Allgemeiner Fehler: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void FileList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var selectedItem = fileList.SelectedItem as FTPFile;
|
||||
if (selectedItem != null && selectedItem.IsDirectory)
|
||||
{
|
||||
currentDirectory += selectedItem.Name + "/";
|
||||
LoadFileList();
|
||||
}
|
||||
}
|
||||
|
||||
private void BackButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (currentDirectory != "/")
|
||||
{
|
||||
currentDirectory = currentDirectory.TrimEnd('/');
|
||||
var lastIndex = currentDirectory.LastIndexOf('/');
|
||||
currentDirectory = currentDirectory.Substring(0, lastIndex + 1);
|
||||
LoadFileList();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadFileList_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadFileList();
|
||||
}
|
||||
|
||||
private void DownloadButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FTPFile selectedFile = fileList.SelectedItem as FTPFile;
|
||||
if (selectedFile != null)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.FileName = selectedFile.Name;
|
||||
|
||||
if (saveFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string localFilePath = saveFileDialog.FileName;
|
||||
|
||||
try
|
||||
{
|
||||
// FTP-Verbindung herstellen
|
||||
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpUrl + selectedFile.Name);
|
||||
request.Method = WebRequestMethods.Ftp.DownloadFile;
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
|
||||
// Datei herunterladen
|
||||
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
using (FileStream localFileStream = new FileStream(localFilePath, FileMode.Create))
|
||||
{
|
||||
responseStream.CopyTo(localFileStream);
|
||||
}
|
||||
|
||||
MessageBox.Show("Datei erfolgreich heruntergeladen!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Herunterladen der Datei: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UploadButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string localFilePath = openFileDialog.FileName;
|
||||
string fileName = Path.GetFileName(localFilePath);
|
||||
|
||||
try
|
||||
{
|
||||
// FTP-Verbindung herstellen
|
||||
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpUrl + fileName);
|
||||
request.Method = WebRequestMethods.Ftp.UploadFile;
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
|
||||
// Dateiinhalt lesen
|
||||
byte[] fileContents = File.ReadAllBytes(localFilePath);
|
||||
// Anfrage vorbereiten
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
{
|
||||
// Dateiinhalt auf den FTP-Server hochladen
|
||||
requestStream.Write(fileContents, 0, fileContents.Length);
|
||||
}
|
||||
|
||||
MessageBox.Show("Datei erfolgreich hochgeladen!");
|
||||
LoadFileList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Hochladen der Datei: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FTPFile selectedFile = fileList.SelectedItem as FTPFile;
|
||||
if (selectedFile != null)
|
||||
{
|
||||
if (MessageBox.Show("Möchten Sie die Datei '" + selectedFile.Name + "' wirklich löschen?", "Löschen bestätigen", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
// FTP-Verbindung herstellen
|
||||
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpUrl + selectedFile.Name);
|
||||
request.Method = WebRequestMethods.Ftp.DeleteFile;
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
|
||||
// Datei löschen
|
||||
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
|
||||
{
|
||||
MessageBox.Show("Datei erfolgreich gelöscht!");
|
||||
LoadFileList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Löschen der Datei: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EditButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FTPFile selectedFile = fileList.SelectedItem as FTPFile;
|
||||
if (selectedFile != null && selectedFile.IsEditable)
|
||||
{
|
||||
try
|
||||
{
|
||||
// FTP-Verbindung herstellen
|
||||
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpUrl + selectedFile.Name);
|
||||
request.Method = WebRequestMethods.Ftp.DownloadFile;
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
|
||||
// Datei herunterladen
|
||||
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(responseStream))
|
||||
{
|
||||
string fileContent = reader.ReadToEnd();
|
||||
|
||||
// Hier können Sie den Dateiinhalt bearbeiten
|
||||
// ...
|
||||
|
||||
// Beispiel: Anzeigen des bearbeiteten Inhalts in einem Dialogfeld
|
||||
MessageBox.Show("Bearbeiteter Inhalt:\n\n" + fileContent);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Bearbeiten der Datei: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FTPFile
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsDirectory { get; set; }
|
||||
public bool IsEditable { get; set; }
|
||||
|
||||
public FTPFile(string line)
|
||||
{
|
||||
var fileInfo = line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var isDirectory = fileInfo[0][0] == 'd';
|
||||
|
||||
// Setze Name-Eigenschaft
|
||||
Name = fileInfo[fileInfo.Length - 1];
|
||||
|
||||
// Setze IsDirectory-Eigenschaft
|
||||
IsDirectory = isDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
155
Valheim Mod Sync Desktop/Views/Kontakt.xaml
Normal file
155
Valheim Mod Sync Desktop/Views/Kontakt.xaml
Normal file
@@ -0,0 +1,155 @@
|
||||
<UserControl x:Class="Valheim_Mod_Sync_Desktop.Views.Kontakt"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
xmlns:local="clr-namespace:Valheim_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="381" d:DesignWidth="800"
|
||||
>
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
|
||||
<Button
|
||||
x:Name="Send"
|
||||
Content="{DynamicResource KontaktSenden}"
|
||||
Click="Send_Click"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,342,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="Message"
|
||||
TextWrapping="Wrap"
|
||||
Width="770"
|
||||
Margin="15,91,15,54"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
SelectionTextBrush="{x:Null}"
|
||||
SelectionBrush="{DynamicResource TextBoxBackgroundColor}"
|
||||
CaretBrush="{x:Null}"
|
||||
Cursor="IBeam"
|
||||
Padding="10 10 10 10"
|
||||
/>
|
||||
<RadioButton
|
||||
x:Name="Bug"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="109,9,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
IsChecked="true"
|
||||
>
|
||||
<RadioButton.Content>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Text="{DynamicResource KontaktFehler}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
Margin="0, -3, 0, 0"
|
||||
/>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Name="Suggestion"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="194,9,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
>
|
||||
<RadioButton.Content>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Text="{DynamicResource KontaktVorschlag}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
Margin="0,-3,0,0"
|
||||
/>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
Margin="15,10,0,0"
|
||||
Text="{DynamicResource KontaktBetreff}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="Name"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="69,35,0,0"
|
||||
Text=""
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Width="288"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}" Cursor="IBeam"
|
||||
/>
|
||||
|
||||
<Label
|
||||
Content="{DynamicResource KontaktName}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="15,35,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
<TextBox
|
||||
x:Name="Email"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="431,35,0,0"
|
||||
Text=""
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Width="354"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
/>
|
||||
<Label
|
||||
Content="{DynamicResource KontaktEmail}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,35,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
<Label
|
||||
Content="{DynamicResource KontaktNachricht}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="15,65,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
188
Valheim Mod Sync Desktop/Views/Kontakt.xaml.cs
Normal file
188
Valheim Mod Sync Desktop/Views/Kontakt.xaml.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Valheim_Mod_Sync_Desktop.ViewModels;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für BugSuggestion.xaml
|
||||
/// </summary>
|
||||
public partial class Kontakt : UserControl
|
||||
{
|
||||
public Kontakt()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
private async void Send_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var Betreff = "";
|
||||
if (Bug.IsChecked == true)
|
||||
{
|
||||
Betreff = "Fehler";
|
||||
}else
|
||||
{
|
||||
Betreff = "Vorschlag";
|
||||
}
|
||||
|
||||
bool name = false;
|
||||
bool email = false;
|
||||
bool message = false;
|
||||
bool send = false;
|
||||
bool keininternet = false;
|
||||
bool error = false;
|
||||
|
||||
if (Name.Text == "")
|
||||
{
|
||||
name = true;
|
||||
}
|
||||
|
||||
if (Email.Text == "" | !Email.Text.Contains('@') | !Email.Text.Contains('.'))
|
||||
{
|
||||
email = true;
|
||||
}
|
||||
|
||||
if (Message.Text == "")
|
||||
{
|
||||
message = true;
|
||||
}
|
||||
|
||||
if (!SyncControl.IsConnectionAvailable())
|
||||
|
||||
{
|
||||
keininternet = true;
|
||||
|
||||
var mailcomplete = new MailComplete
|
||||
{
|
||||
Name = Name.Text,
|
||||
Email = Email.Text,
|
||||
Betreff = Betreff,
|
||||
Message = Message.Text
|
||||
};
|
||||
|
||||
string fileName = "Message.json";
|
||||
string jsonString = JsonSerializer.Serialize(mailcomplete);
|
||||
File.WriteAllText(fileName, jsonString);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Name.Text != "" && Email.Text != "" && Email.Text.Contains('@') && Email.Text.Contains('.') && Message.Text != "" && !keininternet)
|
||||
{
|
||||
send = true;
|
||||
}
|
||||
|
||||
|
||||
if (send)
|
||||
{
|
||||
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{ "Betreff", "VMS : "+ Betreff},
|
||||
{ "Message", Message.Text },
|
||||
{ "Name", Name.Text },
|
||||
{ "Email", Email.Text }
|
||||
};
|
||||
try {
|
||||
|
||||
HttpClient client = new HttpClient();
|
||||
//var content = new FormUrlEncodedContent(values);
|
||||
|
||||
var jsonDictionary = JsonSerializer.Serialize(values);
|
||||
var content = new StringContent(jsonDictionary, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("https://vms.tbs-server.de/", content);
|
||||
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
Debug.WriteLine(responseString);
|
||||
}catch
|
||||
{
|
||||
error = true;
|
||||
var mailcomplete = new MailComplete
|
||||
{
|
||||
Name = Name.Text,
|
||||
Email = Email.Text,
|
||||
Betreff = Betreff,
|
||||
Message = Message.Text
|
||||
};
|
||||
|
||||
string fileName = "Message.json";
|
||||
string jsonString = JsonSerializer.Serialize(mailcomplete);
|
||||
File.WriteAllText(fileName, jsonString);
|
||||
}
|
||||
}
|
||||
|
||||
if (name | email | message | send | keininternet | error )
|
||||
{
|
||||
//DataContext = new MainViewModel();
|
||||
//MainWindow mainWindow = new MainWindow();
|
||||
//mainWindow.contentControl.Content = new SyncControl();
|
||||
|
||||
|
||||
Benachrichtigung modalWindow = new Benachrichtigung(name, email, message, send, keininternet, error, false, false);
|
||||
modalWindow.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task MessageSend()
|
||||
{
|
||||
bool error = false;
|
||||
|
||||
string fileName = "Message.json";
|
||||
MailComplete mail_read = JsonSerializer.Deserialize<MailComplete>(File.ReadAllText(fileName));
|
||||
|
||||
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{ "Betreff", "VMS : "+ mail_read.Betreff},
|
||||
{ "Message", mail_read.Message},
|
||||
{ "Name", mail_read.Name},
|
||||
{ "Email", mail_read.Email}
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
HttpClient client = new HttpClient();
|
||||
//var content = new FormUrlEncodedContent(values);
|
||||
var jsonDictionary = JsonSerializer.Serialize(values);
|
||||
var content = new StringContent(jsonDictionary, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await client.PostAsync("https://vms.tbs-server.de/", content);
|
||||
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
}catch
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
|
||||
bool send = false;
|
||||
|
||||
if (!error)
|
||||
{
|
||||
send = true;
|
||||
File.Delete("Message.json");
|
||||
}
|
||||
|
||||
Benachrichtigung modalWindow = new Benachrichtigung(false, false, false, send, false, error, false, false);
|
||||
modalWindow.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
public class MailComplete
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Betreff { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
59
Valheim Mod Sync Desktop/Views/Lizenzen.xaml
Normal file
59
Valheim Mod Sync Desktop/Views/Lizenzen.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<UserControl x:Class="Valheim_Mod_Sync_Desktop.Views.Lizenzen"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
xmlns:local="clr-namespace:Valheim_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="356" d:DesignWidth="800"
|
||||
>
|
||||
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
|
||||
<ListView x:Name="fileList" Margin="0,0,0,0" Grid.Row="0" BorderBrush="Black" BorderThickness="1">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridView.ColumnHeaderContainerStyle>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="Black"/>
|
||||
</Style>
|
||||
</GridView.ColumnHeaderContainerStyle>
|
||||
<GridViewColumn Header="Lizenz" DisplayMemberBinding="{Binding Name}" Width="250" />
|
||||
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Typ1e}" Width="150"/>
|
||||
<GridViewColumn Header="Aktivierungsstatus" DisplayMemberBinding="{Binding Typ2e}" Width="250"/>
|
||||
<GridViewColumn Header="" DisplayMemberBinding="{Binding Typ3e}" Width="150"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
|
||||
<Button
|
||||
Content="Übernehmen"
|
||||
Click="Übernehmen_Click"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Row="1"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}"
|
||||
Cursor="Hand"
|
||||
Margin="0,257,0,0" RenderTransformOrigin="0.477,-8.399"
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
47
Valheim Mod Sync Desktop/Views/Lizenzen.xaml.cs
Normal file
47
Valheim Mod Sync Desktop/Views/Lizenzen.xaml.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Win32;
|
||||
using Renci.SshNet;
|
||||
using Renci.SshNet.Common;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.Views
|
||||
{
|
||||
|
||||
public partial class Lizenzen : System.Windows.Controls.UserControl
|
||||
{
|
||||
|
||||
public Lizenzen()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Übernehmen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
73
Valheim Mod Sync Desktop/Views/Setup.xaml
Normal file
73
Valheim Mod Sync Desktop/Views/Setup.xaml
Normal file
@@ -0,0 +1,73 @@
|
||||
<UserControl x:Class="Valheim_Mod_Sync_Desktop.Views.Setup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
xmlns:local="clr-namespace:Valheim_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="381" d:DesignWidth="800"
|
||||
>
|
||||
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
|
||||
<Button
|
||||
x:Name="SetupBeenden"
|
||||
Content="{DynamicResource SetupIPWeiter}"
|
||||
Click="SetupIPUebertragen"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,343,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="output"
|
||||
TextWrapping="Wrap"
|
||||
Text="{DynamicResource SetupTextAdmin}"
|
||||
Width="770"
|
||||
Margin="15,54,15,54"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
SelectionTextBrush="{x:Null}"
|
||||
SelectionBrush="{x:Null}"
|
||||
CaretBrush="{x:Null}"
|
||||
IsReadOnly="True" Cursor="IBeam"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
Margin="15,19,0,0"
|
||||
Text="{DynamicResource Server}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="ServerIP"
|
||||
IsReadOnly="false"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="114,16,0,0"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Width="671"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
SelectionTextBrush="{x:Null}"
|
||||
SelectionBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
FontSize="14" Cursor="IBeam"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
113
Valheim Mod Sync Desktop/Views/Setup.xaml.cs
Normal file
113
Valheim Mod Sync Desktop/Views/Setup.xaml.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Valheim_Mod_Sync_Desktop.Commands;
|
||||
using Valheim_Mod_Sync_Desktop.ViewModels;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop.Views
|
||||
{
|
||||
public class LizenzIPReturn
|
||||
{
|
||||
public string admin { get; set; }
|
||||
public string IP_Alt { get; set; }
|
||||
public string IP { get; set; }
|
||||
}
|
||||
|
||||
public partial class Setup : UserControl
|
||||
{
|
||||
public Setup()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
private void SetupIPUebertragen(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ServerIP.Text == null || !ServerIP.Text.Contains(":"))
|
||||
{
|
||||
output.Text += (string)Application.Current.FindResource("SetupIPFehler");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var LizenzKey = Properties.Settings.Default.Lizenz;
|
||||
var ServerIPClean = ServerIP.Text.Replace(" ", "");
|
||||
|
||||
try
|
||||
{
|
||||
string html = string.Empty;
|
||||
string url = @"https://tbs-server.de//wp-json/lmfwc/v2/vms/check_server_ip/" + LizenzKey + "/" + ServerIPClean;
|
||||
string encoded = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1")
|
||||
.GetBytes(Properties.Settings.Default.benutzername + ":" + Properties.Settings.Default.passwort));
|
||||
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
request.Headers.Add("Authorization", "Basic " + encoded);
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
html = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
LizenzIPReturn lizenzip_return = JsonSerializer.Deserialize<LizenzIPReturn>(html);
|
||||
//Debug.WriteLine(lizenz_return.success);
|
||||
//Debug.WriteLine(lizenz_return.data.timesActivated);
|
||||
//Debug.WriteLine(lizenz_return.data.timesActivatedMax);
|
||||
//Debug.WriteLine(lizenz_return.data.remainingActivations);
|
||||
//Debug.WriteLine(lizenz_return.data.hwid);
|
||||
//Debug.WriteLine(html);
|
||||
|
||||
if (lizenzip_return.IP_Alt != lizenzip_return.IP)
|
||||
{
|
||||
|
||||
output.Text += (string)Application.Current.FindResource("ServerIPUebertragen");
|
||||
ServerIP.IsEnabled = false;
|
||||
SetupBeenden.Content = Application.Current.FindResource("SetupBeenden");
|
||||
SetupBeenden.Click -= new RoutedEventHandler(SetupIPUebertragen);
|
||||
SetupBeenden.Click += new RoutedEventHandler(SetupBeenden_);
|
||||
Properties.Settings.Default.Server = ServerIPClean;
|
||||
Properties.Settings.Default.ModVersion = 0;
|
||||
Properties.Settings.Default.Save();
|
||||
MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;
|
||||
mainWindow.Server.Text = ServerIPClean;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Text += (string)Application.Current.FindResource("ServerIPUebertragenFehler");
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
//output.Text = (string)Application.Current.FindResource("LizenzKeyFehler");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupBeenden_(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainViewModel mainViewModel = (MainViewModel)Application.Current.MainWindow.DataContext;
|
||||
mainViewModel.SelectedViewModel = new SyncViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Valheim Mod Sync Desktop/Views/SyncControl.xaml
Normal file
95
Valheim Mod Sync Desktop/Views/SyncControl.xaml
Normal file
@@ -0,0 +1,95 @@
|
||||
<UserControl x:Class="Valheim_Mod_Sync_Desktop.Views.SyncControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
xmlns:local="clr-namespace:Valheim_Mod_Sync_Desktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="381" d:DesignWidth="800"
|
||||
>
|
||||
|
||||
<Grid
|
||||
Background="{DynamicResource BackgroundGrid}"
|
||||
>
|
||||
|
||||
<Button
|
||||
x:Name="Sync_Update"
|
||||
Content="{DynamicResource Sync}"
|
||||
Click="Sync"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,343,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="output"
|
||||
TextWrapping="Wrap"
|
||||
Width="770"
|
||||
Margin="15,54,15,54"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
SelectionTextBrush="{x:Null}"
|
||||
SelectionBrush="{x:Null}"
|
||||
CaretBrush="{x:Null}"
|
||||
IsReadOnly="True" Cursor="IBeam"
|
||||
/>
|
||||
|
||||
<Label
|
||||
x:Name="Changelog"
|
||||
Content="{DynamicResource Changelog}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="656,350,0,0"
|
||||
VerticalAlignment="Top"
|
||||
MouseLeftButtonDown="Changelog_MouseLeftButtonDown"
|
||||
Foreground="{DynamicResource ButtonTextColor}" Cursor="Hand"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
Margin="15,19,0,0"
|
||||
Text="{DynamicResource ValheimPfad}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource HeaderTextColor}"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"
|
||||
/>
|
||||
|
||||
<TextBox
|
||||
x:Name="Pfad"
|
||||
IsReadOnly="True"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="114,16,0,0"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Width="554"
|
||||
Background="{DynamicResource TextBoxBackgroundColor}"
|
||||
SelectionTextBrush="{x:Null}"
|
||||
SelectionBrush="{x:Null}"
|
||||
Foreground="{DynamicResource TextBoxTextColor}"
|
||||
BorderBrush="{x:Null}"
|
||||
FontSize="14" Cursor="IBeam"
|
||||
/>
|
||||
|
||||
<Button
|
||||
x:Name="Auswählen_Pfad"
|
||||
Content="{DynamicResource PfadButton}"
|
||||
Click="Auswählen_Pfad_Click"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="684,16,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource ButtonTextColor}"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonBackgroundColor}"
|
||||
Height="24" Cursor="Hand"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
1158
Valheim Mod Sync Desktop/Views/SyncControl.xaml.cs
Normal file
1158
Valheim Mod Sync Desktop/Views/SyncControl.xaml.cs
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Valheim Mod Sync Desktop/files/tbs.ico
Normal file
BIN
Valheim Mod Sync Desktop/files/tbs.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Valheim Mod Sync Desktop/files/tbs.png
Normal file
BIN
Valheim Mod Sync Desktop/files/tbs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.0 KiB |
Reference in New Issue
Block a user