Initial commit
This commit is contained in:
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
363
.gitignore
vendored
Normal file
363
.gitignore
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
13
.idea/.idea.Valheim Dashboard/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.Valheim Dashboard/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/modules.xml
|
||||
/.idea.Valheim Dashboard.iml
|
||||
/contentModel.xml
|
||||
/projectSettingsUpdater.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
17
.idea/.idea.Valheim Dashboard/.idea/avalonia.xml
generated
Normal file
17
.idea/.idea.Valheim Dashboard/.idea/avalonia.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AvaloniaProject">
|
||||
<option name="projectPerEditor">
|
||||
<map>
|
||||
<entry key="Valheim Dashboard/App.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/DashboardView.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/ErsterStart.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/ErsterStartView.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/FTPView.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/LizenzView.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/MainWindow.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
<entry key="Valheim Dashboard/Views/ServerSettingsView.axaml" value="Valheim Dashboard/Valheim Dashboard.csproj" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/.idea.Valheim Dashboard/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.Valheim Dashboard/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
4
.idea/.idea.Valheim Dashboard/.idea/vcs.xml
generated
Normal file
4
.idea/.idea.Valheim Dashboard/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings" defaultProject="true" />
|
||||
</project>
|
||||
16
Valheim Dashboard.sln
Normal file
16
Valheim Dashboard.sln
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Valheim Dashboard", "Valheim Dashboard\Valheim Dashboard.csproj", "{BDB3822A-2776-4E4A-8A1A-14BD902A66EE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BDB3822A-2776-4E4A-8A1A-14BD902A66EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BDB3822A-2776-4E4A-8A1A-14BD902A66EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BDB3822A-2776-4E4A-8A1A-14BD902A66EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BDB3822A-2776-4E4A-8A1A-14BD902A66EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
103
Valheim Dashboard/Animationen.cs
Normal file
103
Valheim Dashboard/Animationen.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using static Avalonia.Visual;
|
||||
using Avalonia.Styling;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
public class Animationen
|
||||
{
|
||||
|
||||
public static void RunSlideAnimation(double offset,Animatable ziel)
|
||||
{
|
||||
var animation = new Animation
|
||||
{
|
||||
Duration = TimeSpan.FromSeconds(0.5),
|
||||
FillMode = FillMode.Forward,
|
||||
Children =
|
||||
{
|
||||
new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0),
|
||||
Setters =
|
||||
{
|
||||
new Setter(TranslateTransform.YProperty, 0.0) // Startposition
|
||||
}
|
||||
},
|
||||
new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0),
|
||||
Setters =
|
||||
{
|
||||
new Setter(TranslateTransform.YProperty, offset) // Endposition
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
animation.RunAsync(ziel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void FadeOutAnimation(Control control, double durationSeconds = 0.5)
|
||||
{
|
||||
|
||||
var fadeOutAnimation = new Animation
|
||||
{
|
||||
Duration = TimeSpan.FromSeconds(durationSeconds),
|
||||
FillMode = FillMode.Forward,
|
||||
Children =
|
||||
{
|
||||
new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0),
|
||||
Setters = { new Setter(OpacityProperty, 1.0) }
|
||||
},
|
||||
new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0),
|
||||
Setters = { new Setter(OpacityProperty, 0.0) }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fadeOutAnimation.RunAsync(control);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class DoubleOffsetConverter : IValueConverter
|
||||
{
|
||||
public static readonly DoubleOffsetConverter Instance = new DoubleOffsetConverter();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is double doubleValue && parameter is string stringParameter && double.TryParse(stringParameter, out double offset))
|
||||
{
|
||||
return doubleValue + offset;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
23
Valheim Dashboard/App.axaml
Normal file
23
Valheim Dashboard/App.axaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="Valheim_Dashboard.App"
|
||||
xmlns:local="using:Valheim_Dashboard"
|
||||
xmlns:views="using:Valheim_Dashboard.Views"
|
||||
xmlns:viewModels="using:Valheim_Dashboard.ViewModels"
|
||||
RequestedThemeVariant="Default">
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
<DataTemplate DataType="viewModels:MainWindowViewModel">
|
||||
<views:MainWindow/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="viewModels:ErsterStartViewModel">
|
||||
<views:ErsterStartView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="viewModels:FtpViewModel">
|
||||
<views:FtpView/>
|
||||
</DataTemplate>
|
||||
</Application.DataTemplates>
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
31
Valheim Dashboard/App.axaml.cs
Normal file
31
Valheim Dashboard/App.axaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
using Valheim_Dashboard.Views;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
// ViewModelLocator im Ressourcenverzeichnis registrieren
|
||||
Resources.Add("Locator", new ViewModelLocator());
|
||||
|
||||
desktop.MainWindow = new MainWindow
|
||||
{
|
||||
DataContext = (Resources["Locator"] as ViewModelLocator)?.MainWindowViewModel,
|
||||
};
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
BIN
Valheim Dashboard/Assets/avalonia-logo.ico
Normal file
BIN
Valheim Dashboard/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
38
Valheim Dashboard/AtomTable.cs
Normal file
38
Valheim Dashboard/AtomTable.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
public class AtomTable
|
||||
{
|
||||
private static readonly Dictionary<string, ushort> AtomDictionary = new();
|
||||
private static ushort CurrentAtomValue = 1; // Startwert für Atoms
|
||||
|
||||
public static ushort AddAtom(string atomString)
|
||||
{
|
||||
lock (AtomDictionary)
|
||||
{
|
||||
if (AtomDictionary.ContainsKey(atomString))
|
||||
{
|
||||
return AtomDictionary[atomString];
|
||||
}
|
||||
|
||||
ushort newAtom = CurrentAtomValue++;
|
||||
AtomDictionary[atomString] = newAtom;
|
||||
return newAtom;
|
||||
}
|
||||
}
|
||||
|
||||
public static ushort FindAtom(string atomString)
|
||||
{
|
||||
lock (AtomDictionary)
|
||||
{
|
||||
if (AtomDictionary.TryGetValue(atomString, out ushort atom))
|
||||
{
|
||||
return atom;
|
||||
}
|
||||
|
||||
// Rückgabe 0 wie bei `GlobalFindAtom` in Windows, wenn nicht gefunden
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
145
Valheim Dashboard/FtpClient.cs
Normal file
145
Valheim Dashboard/FtpClient.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard
|
||||
{
|
||||
|
||||
public class FtpItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsDirectory { get; set; }
|
||||
}
|
||||
public class FtpClient
|
||||
{
|
||||
private readonly string _ftpServer;
|
||||
private readonly string _username;
|
||||
private readonly string _password;
|
||||
|
||||
public FtpClient(string ftpServer, string username, string password)
|
||||
{
|
||||
_ftpServer = ftpServer.EndsWith("/") ? ftpServer : ftpServer + "/";
|
||||
_username = username;
|
||||
_password = password;
|
||||
FolderClickedCommand = ViewModel.FolderClickedCommand;
|
||||
}
|
||||
private FtpViewModel ViewModel;
|
||||
|
||||
|
||||
|
||||
|
||||
public ReactiveCommand<FtpItem, Unit> FolderClickedCommand { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Listet die Inhalte eines Ordners (Dateien und Unterordner) auf (Async-Version).
|
||||
/// </summary>
|
||||
|
||||
|
||||
public async Task<List<FtpItem>> ListDirectoryDetailsAsync(string path = "")
|
||||
{
|
||||
var request = CreateFtpWebRequest(path, WebRequestMethods.Ftp.ListDirectoryDetails);
|
||||
|
||||
using var response = (FtpWebResponse)await request.GetResponseAsync();
|
||||
using var reader = new StreamReader(response.GetResponseStream());
|
||||
|
||||
var result = new List<FtpItem>();
|
||||
string line;
|
||||
while ((line = await reader.ReadLineAsync()) != null)
|
||||
{
|
||||
// Beispiel: In Unix-Listings beginnt eine Zeile mit "d", wenn es ein Verzeichnis ist.
|
||||
bool isDirectory = line.StartsWith("d");
|
||||
|
||||
// Der Dateiname befindet sich üblicherweise am Ende der Zeile.
|
||||
// Dies kann je nach FTP-Server variieren.
|
||||
string[] tokens = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string fileName = tokens[tokens.Length - 1];
|
||||
|
||||
result.Add(new FtpItem { Name = fileName, IsDirectory = isDirectory });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Erstellt einen Ordner auf dem FTP-Server (Async).
|
||||
/// </summary>
|
||||
public async Task CreateDirectoryAsync(string path)
|
||||
{
|
||||
var request = CreateFtpWebRequest(path, WebRequestMethods.Ftp.MakeDirectory);
|
||||
using var response = (FtpWebResponse)await request.GetResponseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lädt eine Datei vom FTP-Server herunter (Async).
|
||||
/// </summary>
|
||||
public async Task DownloadFileAsync(string remoteFilePath, string localFilePath)
|
||||
{
|
||||
var request = CreateFtpWebRequest(remoteFilePath, WebRequestMethods.Ftp.DownloadFile);
|
||||
|
||||
using var response = (FtpWebResponse)await request.GetResponseAsync();
|
||||
using var responseStream = response.GetResponseStream();
|
||||
using var fileStream = new FileStream(localFilePath, FileMode.Create);
|
||||
|
||||
await responseStream.CopyToAsync(fileStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lädt eine Datei auf den FTP-Server hoch (Async).
|
||||
/// </summary>
|
||||
public async Task UploadFileAsync(string localFilePath, string remoteFilePath)
|
||||
{
|
||||
var request = CreateFtpWebRequest(remoteFilePath, WebRequestMethods.Ftp.UploadFile);
|
||||
request.ContentLength = new FileInfo(localFilePath).Length;
|
||||
|
||||
using var requestStream = await request.GetRequestStreamAsync();
|
||||
using var fileStream = new FileStream(localFilePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
await fileStream.CopyToAsync(requestStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Löscht eine Datei vom FTP-Server (Async).
|
||||
/// </summary>
|
||||
public async Task DeleteFileAsync(string remoteFilePath)
|
||||
{
|
||||
var request = CreateFtpWebRequest(remoteFilePath, WebRequestMethods.Ftp.DeleteFile);
|
||||
using var response = (FtpWebResponse)await request.GetResponseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Löscht einen Ordner vom FTP-Server (Async).
|
||||
/// </summary>
|
||||
public async Task DeleteDirectoryAsync(string remoteDirectoryPath)
|
||||
{
|
||||
var request = CreateFtpWebRequest(remoteDirectoryPath, WebRequestMethods.Ftp.RemoveDirectory);
|
||||
using var response = (FtpWebResponse)await request.GetResponseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hilfsmethode zum Erstellen eines FtpWebRequest.
|
||||
/// </summary>
|
||||
private FtpWebRequest CreateFtpWebRequest(string path, string method)
|
||||
{
|
||||
var uri = new Uri(_ftpServer + path);
|
||||
var request = (FtpWebRequest)WebRequest.Create(uri);
|
||||
request.Method = method;
|
||||
request.Credentials = new NetworkCredential(_username, _password);
|
||||
request.UseBinary = true;
|
||||
request.UsePassive = true;
|
||||
request.KeepAlive = false;
|
||||
return request;
|
||||
}
|
||||
|
||||
public async Task<List<FtpItem>> OpenFolderAsync(string folderPath)
|
||||
{
|
||||
return await ListDirectoryDetailsAsync(folderPath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
70
Valheim Dashboard/HWID.cs
Normal file
70
Valheim Dashboard/HWID.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
class HWID
|
||||
{
|
||||
public static string GetHWID()
|
||||
{
|
||||
string rawData = "";
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
rawData = GetWindowsHWID();
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
rawData = GetLinuxHWID();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException("Unsupported OS");
|
||||
}
|
||||
|
||||
return ComputeHash(rawData);
|
||||
}
|
||||
|
||||
private static string GetWindowsHWID()
|
||||
{
|
||||
string machineGuid = GetRegistryValue(@"SOFTWARE\Microsoft\Cryptography", "MachineGuid");
|
||||
string uuid = GetRegistryValue(@"SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\0001", "HwProfileGuid");
|
||||
|
||||
return $"{machineGuid}-{uuid}";
|
||||
}
|
||||
|
||||
private static string GetRegistryValue(string path, string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(path))
|
||||
{
|
||||
return regKey?.GetValue(key)?.ToString();
|
||||
}
|
||||
}
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
private static string GetLinuxHWID()
|
||||
{
|
||||
return ReadFile("/etc/machine-id") ?? ReadFile("/var/lib/dbus/machine-id");
|
||||
}
|
||||
|
||||
private static string ReadFile(string path)
|
||||
{
|
||||
try { return File.ReadAllText(path).Trim(); }
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
private static string ComputeHash(string input)
|
||||
{
|
||||
using (SHA256 sha256 = SHA256.Create())
|
||||
{
|
||||
byte[] hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(input));
|
||||
return BitConverter.ToString(hash).Replace("-", "").ToLower();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1206
Valheim Dashboard/KeyAuth.cs
Normal file
1206
Valheim Dashboard/KeyAuth.cs
Normal file
File diff suppressed because it is too large
Load Diff
15
Valheim Dashboard/Language.cs
Normal file
15
Valheim Dashboard/Language.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Globalization;
|
||||
using System.Resources;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
public class Language
|
||||
{
|
||||
private static readonly ResourceManager ResourceManager = new ResourceManager("Valheim_Dashboard.Languages.Resources", typeof(Language).Assembly);
|
||||
|
||||
public static string GetString(string key)
|
||||
{
|
||||
return ResourceManager.GetString(key, CultureInfo.CurrentUICulture) ?? $"[{key}]";
|
||||
}
|
||||
|
||||
}
|
||||
125
Valheim Dashboard/Languages/Resources.Designer.cs
generated
Normal file
125
Valheim Dashboard/Languages/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,125 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Valheim_Dashboard.Languages {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Valheim_Dashboard.Languages.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Für die Synchronisierung steht das Plugin oder FTP zur verfügung..
|
||||
/// </summary>
|
||||
internal static string Server_Schritt_1 {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_Schritt_1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Für das Plugin trage hier deine Server IP und Port ein. Standart mäßig läuft es auf dem standart Valheim Port: 2456. Achte darauf das der Port offen ist. Also am besten den selben wie der Server :).
|
||||
/// </summary>
|
||||
internal static string Server_Schritt_2 {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_Schritt_2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Anschließen kannst du die Verbindung prüfen! Bedenke das der Server mit dem Plugin bereits online sein muss. Es wird wie jedes andere Plugin / Mod bei BepInEx installiert..
|
||||
/// </summary>
|
||||
internal static string Server_Schritt_3 {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_Schritt_3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to FTP geht auch! Dazu musst du nur IP, Port, Benutzername, Passwort eintragen. Die daten siehst du in deinem Server Panel vom Hoster..
|
||||
/// </summary>
|
||||
internal static string Server_Schritt_4 {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_Schritt_4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Anschließend klicke auf Verbindung Prüfen. .
|
||||
/// </summary>
|
||||
internal static string Server_Schritt_5 {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_Schritt_5", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Nun musst du nur den BepInEx ordner auswählen..
|
||||
/// </summary>
|
||||
internal static string Server_Schritt_6 {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_Schritt_6", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Willkommen !.
|
||||
/// </summary>
|
||||
internal static string Willkommen {
|
||||
get {
|
||||
return ResourceManager.GetString("Willkommen", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Valheim Dashboard/Languages/Resources.resx
Normal file
42
Valheim Dashboard/Languages/Resources.resx
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<root>
|
||||
<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: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.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Willkommen" xml:space="preserve">
|
||||
<value>Willkommen !</value>
|
||||
</data>
|
||||
<data name="Server_Schritt_1" xml:space="preserve">
|
||||
<value>Für die Synchronisierung steht das Plugin oder FTP zur verfügung.</value>
|
||||
</data>
|
||||
<data name="Server_Schritt_2" xml:space="preserve">
|
||||
<value>Für das Plugin trage hier deine Server IP und Port ein. Standart mäßig läuft es auf dem standart Valheim Port: 2456. Achte darauf das der Port offen ist. Also am besten den selben wie der Server :)</value>
|
||||
</data>
|
||||
<data name="Server_Schritt_3" xml:space="preserve">
|
||||
<value>Anschließen kannst du die Verbindung prüfen! Bedenke das der Server mit dem Plugin bereits online sein muss. Es wird wie jedes andere Plugin / Mod bei BepInEx installiert.</value>
|
||||
</data>
|
||||
<data name="Server_Schritt_4" xml:space="preserve">
|
||||
<value>FTP geht auch! Dazu musst du nur IP, Port, Benutzername, Passwort eintragen. Die daten siehst du in deinem Server Panel vom Hoster.</value>
|
||||
</data>
|
||||
<data name="Server_Schritt_5" xml:space="preserve">
|
||||
<value>Anschließend klicke auf Verbindung Prüfen. </value>
|
||||
</data>
|
||||
<data name="Server_Schritt_6" xml:space="preserve">
|
||||
<value>Nun musst du nur den BepInEx ordner auswählen.</value>
|
||||
</data>
|
||||
</root>
|
||||
36
Valheim Dashboard/Program.cs
Normal file
36
Valheim Dashboard/Program.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
sealed class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Logs in eine Datei schreiben
|
||||
var logFilePath = "logs.txt";
|
||||
var writer = new StreamWriter(logFilePath);
|
||||
writer.AutoFlush = true;
|
||||
//Console.SetOut(writer);
|
||||
|
||||
Console.WriteLine("Die Anwendung wird gestartet...");
|
||||
|
||||
BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
86
Valheim Dashboard/Settings.cs
Normal file
86
Valheim Dashboard/Settings.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
public class Settings
|
||||
{
|
||||
private static readonly string AppName = "ValheimDashboard";
|
||||
private static readonly string SettingsFileName = "settings.json";
|
||||
private static readonly string ConfigPath = CreatePath();
|
||||
|
||||
public static string CreatePath()
|
||||
{
|
||||
string basePath;
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
basePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); // %AppData%
|
||||
}
|
||||
else // Linux
|
||||
{
|
||||
basePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".config");
|
||||
}
|
||||
|
||||
// Anwendungspfad erstellen
|
||||
string appPath = Path.Combine(basePath, AppName);
|
||||
Directory.CreateDirectory(appPath); // Pfad erstellen, falls er nicht existiert
|
||||
return appPath;
|
||||
}
|
||||
|
||||
public static string SettingsPath()
|
||||
{
|
||||
return Path.Combine(ConfigPath, SettingsFileName);
|
||||
}
|
||||
|
||||
public static void SettingsSave(string name, string value)
|
||||
{
|
||||
// Vorhandenes JSON lesen (falls existent)
|
||||
Dictionary<string, string> settings;
|
||||
if (File.Exists(SettingsPath()))
|
||||
{
|
||||
string existingJson = File.ReadAllText(SettingsPath());
|
||||
settings = JsonSerializer.Deserialize<Dictionary<string, string>>(existingJson) ?? new Dictionary<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
// Neuen Schlüssel-Wert hinzufügen/überschreiben
|
||||
settings[name] = value;
|
||||
|
||||
// Änderungen speichern
|
||||
string json = JsonSerializer.Serialize(settings, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(SettingsPath(), json);
|
||||
}
|
||||
|
||||
public static string? SettingsLoad(string name, bool force_reload = false)
|
||||
{
|
||||
string filePath = SettingsPath();
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
string json = File.ReadAllText(filePath);
|
||||
|
||||
using JsonDocument doc = JsonDocument.Parse(json);
|
||||
JsonElement root = doc.RootElement;
|
||||
|
||||
if (root.TryGetProperty(name, out JsonElement nameProperty))
|
||||
{
|
||||
return nameProperty.GetString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
284
Valheim Dashboard/TutorialManager.cs
Normal file
284
Valheim Dashboard/TutorialManager.cs
Normal file
@@ -0,0 +1,284 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Media;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace Valheim_Dashboard
|
||||
{
|
||||
public class TutorialManager
|
||||
{
|
||||
private readonly Window _mainWindow;
|
||||
|
||||
public TutorialManager(Window mainWindow)
|
||||
{
|
||||
_mainWindow = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow));
|
||||
}
|
||||
|
||||
|
||||
public void HighlightControl(Control target, bool highlight)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
if (target is Button button)
|
||||
{
|
||||
button.BorderBrush = Brushes.Gold;
|
||||
button.BorderThickness = new Thickness(2);
|
||||
}
|
||||
|
||||
// Weitere visuelle Anpassungen hier
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target is Button button)
|
||||
{
|
||||
button.BorderBrush = Brushes.Transparent;
|
||||
button.BorderThickness = new Thickness(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Highlight ein Element mit einem animierten Rahmen
|
||||
public void HighlightElement(Control element, Brush borderBrush, double thickness = 3)
|
||||
{
|
||||
|
||||
if (element is Button button)
|
||||
{
|
||||
button.BorderBrush = borderBrush;
|
||||
button.BorderThickness = new Thickness(thickness);
|
||||
}
|
||||
|
||||
if (element is TextBox textBox)
|
||||
{
|
||||
textBox.BorderBrush = borderBrush;
|
||||
textBox.BorderThickness = new Thickness(thickness);
|
||||
}
|
||||
|
||||
if (element is Expander expander)
|
||||
{
|
||||
|
||||
|
||||
Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
var overlayLayer = _mainWindow.FindControl<Canvas>("OverlayLayer");
|
||||
if (overlayLayer == null)
|
||||
{
|
||||
Console.WriteLine("Overlay-Layer (Canvas) nicht gefunden.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Ziel-Element Position berechnen
|
||||
var targetPosition = expander.TranslatePoint(new Point(0, 0), overlayLayer);
|
||||
if (targetPosition.HasValue)
|
||||
{
|
||||
var highlightBorder = new Border
|
||||
{
|
||||
BorderBrush = borderBrush,
|
||||
BorderThickness = new Thickness(thickness),
|
||||
Background = Brushes.Transparent,
|
||||
Width = expander.Bounds.Width + thickness * 2,
|
||||
Height = expander.Bounds.Height + thickness * 2
|
||||
};
|
||||
|
||||
overlayLayer.Children.Add(highlightBorder);
|
||||
Canvas.SetLeft(highlightBorder, targetPosition.Value.X - thickness);
|
||||
Canvas.SetTop(highlightBorder, targetPosition.Value.Y - thickness);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Konnte die Position der Zielkontrolle nicht berechnen.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SmoothScrollToControl(ScrollViewer scrollViewer, Control target, int duration = 300)
|
||||
{
|
||||
|
||||
var targetPosition = target.TranslatePoint(new Point(0, 0), scrollViewer);
|
||||
|
||||
double startOffset = scrollViewer.Offset.Y;
|
||||
double delta = targetPosition.Value.Y - startOffset;
|
||||
|
||||
int frames = duration / 16; // 16ms pro Frame
|
||||
for (int i = 0; i <= frames; i++)
|
||||
{
|
||||
double progress = (double)i / frames;
|
||||
double easedProgress = EasingFunction(progress); // Optional: Easing-Funktion
|
||||
scrollViewer.Offset = new Vector(scrollViewer.Offset.X, startOffset + (delta * easedProgress));
|
||||
await Task.Delay(16);
|
||||
}
|
||||
}
|
||||
|
||||
private double EasingFunction(double t)
|
||||
{
|
||||
return t * t * (3 - 2 * t); // Standard Smoothing (EaseInOut)
|
||||
}
|
||||
|
||||
|
||||
// Öffnen eines Expanders
|
||||
public void OpenExpander(Expander expander)
|
||||
{
|
||||
if (expander != null)
|
||||
{
|
||||
expander.IsExpanded = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseExpander(Expander expander)
|
||||
{
|
||||
if (expander != null)
|
||||
{
|
||||
expander.IsExpanded = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Schreibe Text in ein Textfeld (z. B. TextBox)
|
||||
public void WriteText(TextBox textBox, string text)
|
||||
{
|
||||
if (textBox != null)
|
||||
{
|
||||
textBox.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
// Simuliere einen Button-Klick
|
||||
public void ClickButton(Button button)
|
||||
{
|
||||
if (button != null)
|
||||
{
|
||||
button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // Simuliere Klick
|
||||
}
|
||||
}
|
||||
|
||||
public enum SpeechBubblePosition
|
||||
{
|
||||
Top,
|
||||
Bottom,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Zeige eine Sprechblase mit einem Weiter-Button
|
||||
public void ShowSpeechBubble(Control target, SpeechBubblePosition position, string text, Action onNext = null)
|
||||
{
|
||||
Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
var overlayLayer = _mainWindow.FindControl<Canvas>("OverlayLayer");
|
||||
if (overlayLayer == null)
|
||||
{
|
||||
Console.WriteLine("Overlay-Layer (Canvas) nicht gefunden.");
|
||||
return;
|
||||
}
|
||||
|
||||
var speechBubble = new Border
|
||||
{
|
||||
Background = Brushes.DarkGray,
|
||||
BorderBrush = Brushes.Black,
|
||||
BorderThickness = new Thickness(2),
|
||||
CornerRadius = new CornerRadius(8),
|
||||
Width = 250,
|
||||
Padding = new Thickness(10),
|
||||
Child = new StackPanel
|
||||
{
|
||||
Children =
|
||||
{
|
||||
new TextBlock
|
||||
{
|
||||
Text = text,
|
||||
Foreground = Brushes.White,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Margin = new Thickness(0, 0, 0, 10)
|
||||
},
|
||||
new Button
|
||||
{
|
||||
IsHitTestVisible = true,
|
||||
Content = "Weiter",
|
||||
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
|
||||
Command = ReactiveUI.ReactiveCommand.Create(() =>
|
||||
{
|
||||
overlayLayer.Children.Clear();
|
||||
onNext?.Invoke();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Positionierung relativ zum Ziel
|
||||
|
||||
var targetPosition = target.TranslatePoint(new Point(0, 0), overlayLayer);
|
||||
if (targetPosition.HasValue)
|
||||
{
|
||||
overlayLayer.Children.Add(speechBubble);
|
||||
|
||||
// Bildschirm- oder Overlay-Größen abrufen
|
||||
var overlayBounds = overlayLayer.Bounds;
|
||||
|
||||
double finalX = targetPosition.Value.X;
|
||||
double finalY = targetPosition.Value.Y;
|
||||
|
||||
// Manuelle Layout-Berechnung
|
||||
speechBubble.Measure(Size.Infinity); // Grenze für unendliche Größe setzen
|
||||
speechBubble.Arrange(new Rect(0, 0, speechBubble.DesiredSize.Width, speechBubble.DesiredSize.Height));
|
||||
|
||||
// Nach Layout-Berechnung gewünschte Maße abrufen
|
||||
double speechBubbleWidth = speechBubble.Bounds.Width > 0 ? speechBubble.Bounds.Width : speechBubble.DesiredSize.Width;
|
||||
double speechBubbleHeight = speechBubble.Bounds.Height > 0 ? speechBubble.Bounds.Height : speechBubble.DesiredSize.Height;
|
||||
|
||||
|
||||
// Position basierend auf dem Parameter "position" berechnen
|
||||
switch (position)
|
||||
{
|
||||
case SpeechBubblePosition.Top:
|
||||
finalX = targetPosition.Value.X + (target.Bounds.Width / 2) - (speechBubbleWidth / 2);
|
||||
finalY = targetPosition.Value.Y - speechBubbleHeight - 10;
|
||||
break;
|
||||
|
||||
case SpeechBubblePosition.Bottom:
|
||||
finalX = targetPosition.Value.X + (target.Bounds.Width / 2) - (speechBubbleWidth / 2);
|
||||
finalY = targetPosition.Value.Y + target.Bounds.Height + 10;
|
||||
break;
|
||||
|
||||
case SpeechBubblePosition.Left:
|
||||
finalX = targetPosition.Value.X - speechBubbleWidth - 10;
|
||||
finalY = targetPosition.Value.Y;
|
||||
break;
|
||||
|
||||
case SpeechBubblePosition.Right:
|
||||
finalX = targetPosition.Value.X + target.Bounds.Width + 10;
|
||||
finalY = targetPosition.Value.Y;
|
||||
break;
|
||||
}
|
||||
|
||||
// Dynamisch prüfen, ob das Popup im Sichtbereich ist
|
||||
if (finalX < 0) finalX = 0; // Zu weit links
|
||||
if (finalX + speechBubble.Width > overlayBounds.Width) finalX = overlayBounds.Width - speechBubble.Width; // Zu weit rechts
|
||||
if (finalY < 0) finalY = 0; // Zu weit oben
|
||||
if (finalY + speechBubble.Height > overlayBounds.Height) finalY = overlayBounds.Height - speechBubble.Height; // Zu weit unten
|
||||
|
||||
// Position setzen
|
||||
Canvas.SetLeft(speechBubble, finalX);
|
||||
Canvas.SetTop(speechBubble, finalY);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Konnte die Position der Zielkontrolle nicht berechnen.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
43
Valheim Dashboard/Valheim Dashboard.csproj
Normal file
43
Valheim Dashboard/Valheim Dashboard.csproj
Normal file
@@ -0,0 +1,43 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.3" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.2.3">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Languages\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Languages\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
33
Valheim Dashboard/ViewLocator.cs
Normal file
33
Valheim Dashboard/ViewLocator.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard;
|
||||
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
public Control? Build(object? param)
|
||||
{
|
||||
if (param is null)
|
||||
return null;
|
||||
|
||||
var viewModelType = param.GetType();
|
||||
var name = viewModelType.FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
|
||||
|
||||
// Verwenden Sie die Assembly des ViewModels, um die View zu finden
|
||||
var viewType = viewModelType.Assembly.GetType(name);
|
||||
|
||||
|
||||
if (viewType != null)
|
||||
{
|
||||
return (Control)Activator.CreateInstance(viewType)!;
|
||||
}
|
||||
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
public bool Match(object? data)
|
||||
{
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
6
Valheim Dashboard/ViewModels/DashboardViewModel.cs
Normal file
6
Valheim Dashboard/ViewModels/DashboardViewModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Valheim_Dashboard.ViewModels;
|
||||
|
||||
public class DashboardViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
28
Valheim Dashboard/ViewModels/ErsterStartViewModel.cs
Normal file
28
Valheim Dashboard/ViewModels/ErsterStartViewModel.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Avalonia;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Valheim_Dashboard.ViewModels;
|
||||
|
||||
public class ErsterStartViewModel : ViewModelBase
|
||||
{
|
||||
private bool _startAnimation;
|
||||
public bool StartAnimation
|
||||
{
|
||||
get => _startAnimation;
|
||||
set => this.RaiseAndSetIfChanged(ref _startAnimation, value);
|
||||
}
|
||||
|
||||
|
||||
private Point _animationTargetPosition;
|
||||
public Point AnimationTargetPosition
|
||||
{
|
||||
get => _animationTargetPosition;
|
||||
set => this.RaiseAndSetIfChanged(ref _animationTargetPosition, value);
|
||||
}
|
||||
|
||||
public ErsterStartViewModel()
|
||||
{
|
||||
StartAnimation = true; // Property auf true setzen
|
||||
}
|
||||
|
||||
}
|
||||
102
Valheim Dashboard/ViewModels/FTPViewModel.cs
Normal file
102
Valheim Dashboard/ViewModels/FTPViewModel.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Valheim_Dashboard.ViewModels
|
||||
{
|
||||
public class FtpViewModel : ViewModelBase
|
||||
{
|
||||
public static FtpClient _ftpClient;
|
||||
|
||||
// Speichert den aktuellen FTP-Pfad
|
||||
private string _currentPath = "/";
|
||||
|
||||
public string CurrentPath
|
||||
{
|
||||
get => _currentPath;
|
||||
set => this.RaiseAndSetIfChanged(ref _currentPath, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ObservableCollection, die jetzt FtpItem-Objekte enthält
|
||||
public ObservableCollection<FtpItem> Files { get; } = new();
|
||||
|
||||
// Liste für FTP-Dateien und Ordner
|
||||
// public ObservableCollection<string> Files { get; } = new();
|
||||
|
||||
// Befehl zum Laden des Verzeichnisses
|
||||
public ReactiveCommand<Unit, Unit> LoadFtpCommand { get; }
|
||||
|
||||
// Command, der ausgeführt wird, wenn ein Ordner geklickt wird
|
||||
public ReactiveCommand<FtpItem, Unit> FolderClickedCommand { get; }
|
||||
|
||||
|
||||
public FtpViewModel()
|
||||
{
|
||||
|
||||
|
||||
// Befehl für das Neuladen des Verzeichnisses
|
||||
LoadFtpCommand = ReactiveCommand.CreateFromTask(LoadFtpDirectory);
|
||||
|
||||
// Command, der beim Klick auf einen Ordner ausgeführt wird
|
||||
// FolderClickedCommand = ReactiveCommand.Create<FtpItem>(OnFolderClicked);
|
||||
FolderClickedCommand = ReactiveCommand.Create<FtpItem>(item =>
|
||||
{
|
||||
// Logik für den Klick auf das Folder-Item
|
||||
Console.WriteLine($"Folder {item.Name} clicked!");
|
||||
});
|
||||
|
||||
// Beim Erstellen direkt FTP-Verzeichnis laden
|
||||
LoadFtpCommand.Execute().Subscribe();
|
||||
Files.Add(new FtpItem { Name = "TestFile.txt", IsDirectory = false });
|
||||
|
||||
}
|
||||
|
||||
private async Task LoadFtpDirectory()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Verwende die neue Methode, um detaillierte Informationen zu erhalten
|
||||
var items = await _ftpClient.ListDirectoryDetailsAsync(CurrentPath);
|
||||
|
||||
// Sortiere: Ordner zuerst, dann Dateien, jeweils alphabetisch
|
||||
var sortedItems = items
|
||||
.OrderBy(item => item.IsDirectory ? 0 : 1)
|
||||
.ThenBy(item => item.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
// Hier gehen wir davon aus, dass du z. B. eine ObservableCollection vom Typ string hast.
|
||||
// Du kannst aber auch deine ObservableCollection umstellen, sodass du FtpItem-Objekte speicherst.
|
||||
Files.Clear();
|
||||
foreach (var item in sortedItems)
|
||||
{
|
||||
Console.WriteLine($"Item geladen: {item.Name}");
|
||||
// Je nach Bedarf kannst du hier den Namen oder auch weitere Infos anzeigen.
|
||||
Files.Add(item);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Fehler beim Laden des FTP-Verzeichnisses: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFolderClicked(FtpItem item)
|
||||
{
|
||||
Console.WriteLine("OrdnerKlick");
|
||||
if (item.IsDirectory)
|
||||
{
|
||||
// Beispiel: Den aktuellen Pfad serweitern und das neue Verzeichnis laden
|
||||
// Je nach Bedarf kannst du hier auch Navigation oder andere Logik einbauen
|
||||
CurrentPath = System.IO.Path.Combine(CurrentPath, item.Name);
|
||||
// Neues Verzeichnis laden
|
||||
LoadFtpCommand.Execute().Subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
29
Valheim Dashboard/ViewModels/LizenzViewModel.cs
Normal file
29
Valheim Dashboard/ViewModels/LizenzViewModel.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Valheim_Dashboard.ViewModels;
|
||||
|
||||
public class LizenzViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
public string LizenzKey { get; set; }
|
||||
|
||||
private string _verifizierungsAntwort;
|
||||
public string VerifizierungsAntwort
|
||||
{
|
||||
get => _verifizierungsAntwort;
|
||||
set
|
||||
{
|
||||
if (_verifizierungsAntwort != value)
|
||||
{
|
||||
_verifizierungsAntwort = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string? name = null)
|
||||
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
|
||||
}
|
||||
84
Valheim Dashboard/ViewModels/MainWindowViewModel.cs
Normal file
84
Valheim Dashboard/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using ReactiveUI;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
using Valheim_Dashboard.Views;
|
||||
|
||||
namespace Valheim_Dashboard.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ViewModelLocator _locator;
|
||||
private ViewModelBase _currentViewModel;
|
||||
private LizenzView _lizenzView;
|
||||
|
||||
|
||||
public MainWindowViewModel(ViewModelLocator locator)
|
||||
{
|
||||
_locator = locator;
|
||||
|
||||
// Initialer ViewModel über Locator setzen
|
||||
if (Settings.SettingsLoad("LizenzKey") != null) {
|
||||
|
||||
|
||||
|
||||
// Lizenzkey aus den Einstellungen laden
|
||||
string lizenzKey = Settings.SettingsLoad("LizenzKey");
|
||||
var lizenzViewModel = _locator.LizenzViewModel;
|
||||
lizenzViewModel.LizenzKey = lizenzKey; // Lizenzkey übergeben
|
||||
_currentViewModel = lizenzViewModel;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentViewModel = _locator.ErsterStartViewModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ViewModelBase CurrentViewModel
|
||||
{
|
||||
get => _currentViewModel;
|
||||
set => this.RaiseAndSetIfChanged(ref _currentViewModel, value);
|
||||
}
|
||||
|
||||
public void SwitchToErsterStart()
|
||||
{
|
||||
CurrentViewModel = _locator.ErsterStartViewModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SwitchToLizenzView()
|
||||
{
|
||||
|
||||
CurrentViewModel = _locator.LizenzViewModel;
|
||||
}
|
||||
|
||||
public void SwitchToServerSettings()
|
||||
{
|
||||
|
||||
CurrentViewModel = _locator.ServerSettingsViewModel;
|
||||
}
|
||||
|
||||
public void SwitchToDashboard()
|
||||
{
|
||||
CurrentViewModel = _locator.DashboardViewModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void SwitchToFTP(FtpClient ftpClient)
|
||||
{
|
||||
// var ftpViewModel = new FtpViewModel(ftpClient);
|
||||
// var ftpView = new FTPView(ftpViewModel);
|
||||
CurrentViewModel = _locator.FtpViewModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
76
Valheim Dashboard/ViewModels/ServerSettingsViewModel.cs
Normal file
76
Valheim Dashboard/ViewModels/ServerSettingsViewModel.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using ReactiveUI;
|
||||
using Valheim_Dashboard.Views;
|
||||
|
||||
namespace Valheim_Dashboard.ViewModels;
|
||||
|
||||
public class ServerSettingsViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
// Eigenschaften für Plugin
|
||||
private string? _pluginIp;
|
||||
|
||||
public string? PluginIp
|
||||
{
|
||||
get => _pluginIp;
|
||||
set => this.RaiseAndSetIfChanged(ref _pluginIp, value);
|
||||
}
|
||||
|
||||
private string? _pluginPort;
|
||||
|
||||
public string? PluginPort
|
||||
{
|
||||
get => _pluginPort;
|
||||
set => this.RaiseAndSetIfChanged(ref _pluginPort, value);
|
||||
}
|
||||
|
||||
// Eigenschaften für FTP
|
||||
private string? _ftpIp;
|
||||
|
||||
public string? FtpIp
|
||||
{
|
||||
get => _ftpIp;
|
||||
set => this.RaiseAndSetIfChanged(ref _ftpIp, value);
|
||||
}
|
||||
|
||||
private string? _ftpPort;
|
||||
|
||||
public string? FtpPort
|
||||
{
|
||||
get => _ftpPort;
|
||||
set => this.RaiseAndSetIfChanged(ref _ftpPort, value);
|
||||
}
|
||||
|
||||
private string? _ftpUsername;
|
||||
|
||||
public string? FtpUsername
|
||||
{
|
||||
get => _ftpUsername;
|
||||
set => this.RaiseAndSetIfChanged(ref _ftpUsername, value);
|
||||
}
|
||||
|
||||
private string? _ftpPassword;
|
||||
|
||||
public string? FtpPassword
|
||||
{
|
||||
get => _ftpPassword;
|
||||
set => this.RaiseAndSetIfChanged(ref _ftpPassword, value);
|
||||
}
|
||||
|
||||
private readonly TutorialManager _tutorialManager;
|
||||
private Window? _window;
|
||||
public ServerSettingsViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
7
Valheim Dashboard/ViewModels/ViewModelBase.cs
Normal file
7
Valheim Dashboard/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Valheim_Dashboard.ViewModels;
|
||||
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
16
Valheim Dashboard/ViewModels/ViewModelLocator.cs
Normal file
16
Valheim Dashboard/ViewModels/ViewModelLocator.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard
|
||||
{
|
||||
public class ViewModelLocator
|
||||
{
|
||||
public MainWindowViewModel MainWindowViewModel => new MainWindowViewModel(this);
|
||||
public ErsterStartViewModel ErsterStartViewModel => new ErsterStartViewModel();
|
||||
public LizenzViewModel LizenzViewModel => new LizenzViewModel(); // Hinzugefügt
|
||||
public ServerSettingsViewModel ServerSettingsViewModel => new ServerSettingsViewModel(); // Hinzugefügt
|
||||
public DashboardViewModel DashboardViewModel => new DashboardViewModel(); // Hinzugefügt
|
||||
public FtpViewModel FtpViewModel => new FtpViewModel(); // Hinzugefügt
|
||||
|
||||
public ViewModelLocator() { }
|
||||
}
|
||||
}
|
||||
8
Valheim Dashboard/Views/DashboardView.axaml
Normal file
8
Valheim Dashboard/Views/DashboardView.axaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Valheim_Dashboard.Views.DashboardView">
|
||||
Fashboard
|
||||
</UserControl>
|
||||
13
Valheim Dashboard/Views/DashboardView.axaml.cs
Normal file
13
Valheim Dashboard/Views/DashboardView.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
public partial class DashboardView : UserControl
|
||||
{
|
||||
public DashboardView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
28
Valheim Dashboard/Views/ErsterStartView.axaml
Normal file
28
Valheim Dashboard/Views/ErsterStartView.axaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
|
||||
x:Class="Valheim_Dashboard.Views.ErsterStartView">
|
||||
|
||||
<Grid>
|
||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="20">
|
||||
<TextBlock x:Name="WelcomeTextBlock" Text="Herzlich Willkommen" FontSize="36" FontWeight="Bold" HorizontalAlignment="Center">
|
||||
<TextBlock.Effect>
|
||||
<DropShadowEffect
|
||||
Color="Gray"
|
||||
BlurRadius="8"
|
||||
OffsetX="4"
|
||||
OffsetY="4"
|
||||
/>
|
||||
</TextBlock.Effect>
|
||||
</TextBlock>
|
||||
<TextBlock Text="Vielen Dank für Ihr Vertrauen" FontSize="24" HorizontalAlignment="Center"/>
|
||||
<TextBlock x:Name="HinweisTextBlock" Text="Klicken Sie hier für weiter" FontSize="18" HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<Button x:Name="WeiterButton" Content="Weiter" HorizontalAlignment="Right" VerticalAlignment="Bottom" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="10" Width="100" Height="100"
|
||||
Click="Weiter_Click">
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
122
Valheim Dashboard/Views/ErsterStartView.axaml.cs
Normal file
122
Valheim Dashboard/Views/ErsterStartView.axaml.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Reactive.Linq;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Styling;
|
||||
using ReactiveUI;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
using static Valheim_Dashboard.Animationen;
|
||||
using Valheim_Dashboard.Views;
|
||||
|
||||
namespace Valheim_Dashboard.Views
|
||||
{
|
||||
public partial class ErsterStartView : ReactiveUserControl<ErsterStartViewModel>
|
||||
{
|
||||
|
||||
|
||||
|
||||
public ErsterStartView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
Console.WriteLine("erster start view");
|
||||
// Animation starten, wenn ViewModel-Property sich ändert
|
||||
this.WhenAnyValue(x => x.ViewModel.StartAnimation)
|
||||
.Where(startAnimation => startAnimation)
|
||||
.Subscribe(_ => StartAnimation());
|
||||
|
||||
this.WhenAnyValue(x => x.ViewModel.AnimationTargetPosition)
|
||||
.Subscribe(pos =>
|
||||
{
|
||||
if(HinweisTextBlock != null && WeiterButton != null) {
|
||||
double offsetX = pos.X - WeiterButton.Bounds.X - 200;
|
||||
double offsetY = pos.Y - WeiterButton.Bounds.Y - 150;
|
||||
HinweisTextBlock.RenderTransform = new TranslateTransform(offsetX, offsetY);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void StartAnimation()
|
||||
{
|
||||
|
||||
var hinweisTextBlock = this.FindControl<TextBlock>("HinweisTextBlock");
|
||||
var weiterButton = this.FindControl<Button>("WeiterButton");
|
||||
|
||||
|
||||
Console.WriteLine($"HinweisTextBlock: {hinweisTextBlock != null}");
|
||||
Console.WriteLine($"WeiterButton: {weiterButton != null}");
|
||||
|
||||
if (hinweisTextBlock != null)
|
||||
{
|
||||
var animation = new Animation
|
||||
{
|
||||
Duration = TimeSpan.FromSeconds(2),
|
||||
Delay = TimeSpan.FromSeconds(2)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
animation.Children.Add(new KeyFrame
|
||||
{
|
||||
|
||||
Cue = new Cue(0d),
|
||||
Setters =
|
||||
{
|
||||
new Setter(TextBlock.OpacityProperty, 1.0)
|
||||
}
|
||||
});
|
||||
|
||||
animation.Children.Add(new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1d),
|
||||
Setters =
|
||||
{
|
||||
new Setter(TextBlock.OpacityProperty, 0.2)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// RenderTransform VOR animation.RunAsync setzen!
|
||||
hinweisTextBlock.RenderTransform = new ScaleTransform(1, 1);
|
||||
|
||||
|
||||
animation.RunAsync(hinweisTextBlock);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
private void Weiter_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Console.WriteLine("weiter geklickt");
|
||||
Console.WriteLine(this.Parent.Parent.Parent);
|
||||
|
||||
if (this.Parent.Parent.Parent is MainWindow mainWindow)
|
||||
{
|
||||
if(mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
mainWindowViewModel.SwitchToLizenzView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
53
Valheim Dashboard/Views/FTPView.axaml
Normal file
53
Valheim Dashboard/Views/FTPView.axaml
Normal file
@@ -0,0 +1,53 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Valheim_Dashboard"
|
||||
xmlns:vm="clr-namespace:Valheim_Dashboard.ViewModels"
|
||||
xmlns:views="clr-namespace:Valheim_Dashboard.Views"
|
||||
mc:Ignorable="d"
|
||||
x:Name="root"
|
||||
x:Class="Valheim_Dashboard.Views.FtpView"
|
||||
x:DataType="vm:FtpViewModel"
|
||||
>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- TextBox für den aktuellen FTP-Pfad -->
|
||||
<TextBox x:Name="CurrentPathTextBox"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsEnabled="False"
|
||||
Height="100"
|
||||
Margin="50,0,50,0"
|
||||
Text="{Binding CurrentPath}"/>
|
||||
|
||||
<!-- ScrollViewer mit ListBox -->
|
||||
<ScrollViewer x:Name="ftp_ScrollVie2"
|
||||
Grid.Row="1"
|
||||
Background="Brown"
|
||||
Margin="50,0,50,50">
|
||||
<ListBox x:Name="FtpFileList" ItemsSource="{Binding Files}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button
|
||||
|
||||
CommandParameter="{Binding}"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
HorizontalAlignment="Stretch">
|
||||
<TextBlock Text="{Binding Name}" Foreground="Green" />
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
50
Valheim Dashboard/Views/FTPView.axaml.cs
Normal file
50
Valheim Dashboard/Views/FTPView.axaml.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
using KeyAuth;
|
||||
using ReactiveUI;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
public partial class FtpView : ReactiveUserControl<FtpViewModel>
|
||||
{
|
||||
public FtpView()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
// Aktivierungslogik für Bindings
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
// Binde den aktuellen Pfad an die TextBox
|
||||
this.OneWayBind(ViewModel, vm => vm.CurrentPath, v => v.CurrentPathTextBox_.Text)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
// Konvertiere die ObservableCollection<string> zu IEnumerable<object>
|
||||
this.OneWayBind(ViewModel, vm => vm.Files, v => v.FtpFileList_.ItemsSource)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
private TextBox CurrentPathTextBox_ => this.FindControl<TextBox>("CurrentPathTextBox");
|
||||
private ListBox FtpFileList_ => this.FindControl<ListBox>("FtpFileList");
|
||||
}
|
||||
151
Valheim Dashboard/Views/LizenzView.axaml
Normal file
151
Valheim Dashboard/Views/LizenzView.axaml
Normal file
@@ -0,0 +1,151 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
|
||||
x:Class="Valheim_Dashboard.Views.LizenzView">
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
x:Name="ueberschrift"
|
||||
Text="Bitte trage deinen Lizenzkey ein"
|
||||
FontSize="36"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,50,0,0"
|
||||
>
|
||||
<TextBlock.Effect>
|
||||
<DropShadowEffect
|
||||
Color="Gray"
|
||||
BlurRadius="8"
|
||||
OffsetX="4"
|
||||
OffsetY="4"
|
||||
/>
|
||||
</TextBlock.Effect>
|
||||
</TextBlock>
|
||||
|
||||
|
||||
<TextBox x:Name="LizenzKeyTextBox"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Text="Lizenzkey eingeben"
|
||||
IsEnabled="true"
|
||||
Height="100"
|
||||
Margin="50,0,200,0"
|
||||
/>
|
||||
<Button
|
||||
x:Name="verifizieren_button"
|
||||
Content="Verifizieren"
|
||||
Width="100"
|
||||
Height="100"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsVisible="true"
|
||||
IsEnabled="False"
|
||||
Margin="0,0,50,0"
|
||||
Click="Verifizieren_button_OnClick"
|
||||
/>
|
||||
|
||||
<StackPanel Grid.Row="0"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,100,0,0"
|
||||
Height="200"
|
||||
>
|
||||
<TextBlock
|
||||
x:Name="verbindung_lizenz_server"
|
||||
Text="Verbindung zum Lizenz Server wird hergestellt"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
IsVisible="false"
|
||||
>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
x:Name="verbindung_fehler_lizenz_server"
|
||||
Text="Verbindung konnte nicht hergestellt werden"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
IsVisible="false"
|
||||
>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock
|
||||
x:Name="verbindung_erfolgreich_lizenz_server"
|
||||
Text="Verbindung erfolgreich Hergestellt"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
IsVisible="false"
|
||||
>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
x:Name="lizenz_prüfung"
|
||||
Text="Lizenz wird überprüft"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="false"
|
||||
>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
x:Name="lizenz_erfolgreich"
|
||||
Text="Lizenz erfolgreich aktiviert!"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="false"
|
||||
>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
x:Name="lizenz_fehler"
|
||||
Text="Lizenz konnte nicht aktiviert werden!"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="false"
|
||||
>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
x:Name="weiter"
|
||||
Content="Weiter"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="10"
|
||||
Width="100"
|
||||
Height="100"
|
||||
IsVisible="False"
|
||||
Click="Weiter_Click">
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
144
Valheim Dashboard/Views/LizenzView.axaml.cs
Normal file
144
Valheim Dashboard/Views/LizenzView.axaml.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using KeyAuth;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
public partial class LizenzView : UserControl
|
||||
{
|
||||
public LizenzView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
LizenzKeyTextBox.GotFocus += (sender, e) =>
|
||||
{
|
||||
if (LizenzKeyTextBox.Text == "Lizenzkey eingeben")
|
||||
{
|
||||
LizenzKeyTextBox.Text = "";
|
||||
verifizieren_button.IsEnabled = true;
|
||||
}else if (LizenzKeyTextBox.Text != "Lizenzkey eingeben" || LizenzKeyTextBox.Text != "")
|
||||
{
|
||||
verifizieren_button.IsEnabled = true;
|
||||
|
||||
verbindung_lizenz_server.IsVisible = false;
|
||||
verbindung_erfolgreich_lizenz_server.IsVisible = false;
|
||||
verbindung_fehler_lizenz_server.IsVisible = false;
|
||||
lizenz_prüfung.IsVisible = false;
|
||||
lizenz_fehler.IsVisible = false;
|
||||
lizenz_erfolgreich.IsVisible = false;
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void SetAndCheckLizenz(string lizenzKey)
|
||||
{
|
||||
LizenzKeyTextBox.Text = lizenzKey;
|
||||
VerifyKey();
|
||||
}
|
||||
|
||||
private void Verifizieren_button_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (LizenzKeyTextBox.Text != "")
|
||||
{
|
||||
//Animationen.RunSlideAnimation(-60, ueberschrift);
|
||||
//Animationen.RunSlideAnimation(-120, LizenzKeyTextBox);
|
||||
//Animationen.FadeOutAnimation(verifizieren_button, 0.3D);
|
||||
verifizieren_button.IsEnabled = false;
|
||||
|
||||
|
||||
|
||||
//Animationen.RunSlideAnimation(-100, StatusTextBlock);
|
||||
VerifyKey();
|
||||
}
|
||||
}
|
||||
|
||||
public async void VerifyKey()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
verbindung_lizenz_server.IsVisible = true;
|
||||
await Task.Run(KeyAuthApp.init);
|
||||
|
||||
if (!KeyAuthApp.response.success)
|
||||
{
|
||||
verbindung_fehler_lizenz_server.IsVisible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
verbindung_erfolgreich_lizenz_server.IsVisible = true;
|
||||
}
|
||||
|
||||
string key = LizenzKeyTextBox.Text;
|
||||
|
||||
lizenz_prüfung.IsVisible = true;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
KeyAuthApp.license(key);
|
||||
return 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (!KeyAuthApp.response.success)
|
||||
{
|
||||
lizenz_fehler.IsVisible = true;
|
||||
Console.WriteLine(KeyAuthApp.response.message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.SettingsSave("LizenzKey", LizenzKeyTextBox.Text);
|
||||
lizenz_erfolgreich.IsVisible = true;
|
||||
weiter.IsVisible = true;
|
||||
}
|
||||
}catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("error" + ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static api KeyAuthApp = new api(
|
||||
name: "Valheim Dashboard", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
|
||||
ownerid: "sS0sZlXiY5", // Account ID
|
||||
secret: "6e83db8b463d0a3822b002f8d06dbe51d07c8f0481bda05038291eac5d74eb0f",
|
||||
version: "1.0" // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
|
||||
//path: @"Your_Path_Here" // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s
|
||||
);
|
||||
|
||||
|
||||
public static string[] lizenz_name;
|
||||
|
||||
private void Weiter_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Console.WriteLine("weiter geklickt");
|
||||
if (this.Parent.Parent.Parent is MainWindow mainWindow)
|
||||
{
|
||||
if(mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
lizenz_name = LizenzKeyTextBox.Text.Split('-');
|
||||
|
||||
|
||||
if (lizenz_name[2] == "A")
|
||||
{
|
||||
mainWindowViewModel.SwitchToServerSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(KeyAuthApp.var(lizenz_name[1]));
|
||||
mainWindowViewModel.SwitchToDashboard();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Valheim Dashboard/Views/MainWindow.axaml
Normal file
22
Valheim Dashboard/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,22 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Valheim_Dashboard.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
|
||||
x:Class="Valheim_Dashboard.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel" CanResize="false"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="Valheim_Dashboard">
|
||||
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
<Grid>
|
||||
<ContentControl Content="{Binding CurrentViewModel}" />
|
||||
<Canvas Name="OverlayLayer" IsHitTestVisible="True" />
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
11
Valheim Dashboard/Views/MainWindow.axaml.cs
Normal file
11
Valheim Dashboard/Views/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
103
Valheim Dashboard/Views/ServerSettingsView.axaml
Normal file
103
Valheim Dashboard/Views/ServerSettingsView.axaml
Normal file
@@ -0,0 +1,103 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:Valheim_Dashboard.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
|
||||
x:Class="Valheim_Dashboard.Views.ServerSettingsView"
|
||||
x:DataType="viewModels:ServerSettingsViewModel">
|
||||
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
x:Name="ueberschrift"
|
||||
Text="Servereinstellungen"
|
||||
FontSize="36"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
Opacity="100"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,50,0,0"
|
||||
>
|
||||
<TextBlock.Effect>
|
||||
<DropShadowEffect
|
||||
Color="Gray"
|
||||
BlurRadius="8"
|
||||
OffsetX="4"
|
||||
OffsetY="4"
|
||||
/>
|
||||
</TextBlock.Effect>
|
||||
</TextBlock>
|
||||
|
||||
<Grid Grid.Row="1" Margin="0,50,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="9*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5*"/>
|
||||
<ColumnDefinition Width="5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Plugin-Einstellungen -->
|
||||
<Expander Header="Plugin" x:Name="Plugin" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Margin="50,0,25,0" >
|
||||
<StackPanel Spacing="5" HorizontalAlignment="Center">
|
||||
<TextBlock Text="IP-Adresse:" />
|
||||
<TextBox x:Name="plugin_ip" Text="{Binding PluginIp}" Width="200" />
|
||||
|
||||
<TextBlock Text="Port:" />
|
||||
<TextBox x:Name="plugin_port" Text="{Binding PluginPort}" Width="200" />
|
||||
<Button x:Name="plugin_prüfen" Click="Plugin_prüfen_OnClick" Width="200">Verbindung Prüfen</Button>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<!-- FTP-Einstellungen -->
|
||||
<Expander Header="FTP" x:Name="FTP" HorizontalAlignment="Stretch" MaxHeight="500" VerticalAlignment="Top" Width="565" Grid.Row="0" Grid.Column="1" Margin="25, 0,50,0" >
|
||||
<ScrollViewer x:Name="ftp_scroll">
|
||||
<StackPanel Spacing="5" HorizontalAlignment="Center">
|
||||
<TextBlock Text="IP-Adresse:" />
|
||||
<TextBox x:Name="ftp_ip" Text="{Binding FtpIp}" Width="200" />
|
||||
|
||||
<TextBlock Text="Port:" />
|
||||
<TextBox x:Name="ftp_port" Text="{Binding FtpPort}" Width="200" />
|
||||
|
||||
<TextBlock Text="Benutzername:" />
|
||||
<TextBox x:Name="ftp_benutzername" Text="{Binding FtpUsername}" Width="200" />
|
||||
|
||||
<TextBlock Text="Passwort:" />
|
||||
<TextBox x:Name="ftp_passwort" Text="{Binding FtpPassword}" Width="200" PasswordChar="*" />
|
||||
<Button x:Name="ftp_prüfen" Click="Ftp_prüfen_OnClick" Width="200">Verbindung Prüfen</Button>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Expander>
|
||||
|
||||
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
x:Name="weiter"
|
||||
Content="Weiter"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="10"
|
||||
Width="100"
|
||||
Height="100"
|
||||
IsVisible="true"
|
||||
Click="Weiter_OnClick">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
249
Valheim Dashboard/Views/ServerSettingsView.axaml.cs
Normal file
249
Valheim Dashboard/Views/ServerSettingsView.axaml.cs
Normal file
@@ -0,0 +1,249 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Tmds.DBus.Protocol;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
public partial class ServerSettingsView : UserControl
|
||||
{
|
||||
|
||||
|
||||
private TutorialManager _tutorialManager;
|
||||
|
||||
public ServerSettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.Initialized += (sender, e) =>
|
||||
{
|
||||
var window = this.VisualRoot as Window;
|
||||
|
||||
if (window == null)
|
||||
throw new InvalidOperationException("Das übergeordnete Element ist kein Fenster.");
|
||||
|
||||
// TutorialManager direkt im Code-Behind initialisieren
|
||||
_tutorialManager = new TutorialManager(window);
|
||||
|
||||
// Beispiel: Ein Tutorial starten
|
||||
// StartTutorial();
|
||||
};
|
||||
}
|
||||
|
||||
public void StartTutorial()
|
||||
{
|
||||
var pluginExpander = Plugin;
|
||||
var pluginIpTextBox = plugin_ip;
|
||||
var pluginPortTextBox = plugin_port;
|
||||
var pluginUeberpruefen = plugin_prüfen;
|
||||
var ftpExpander = FTP;
|
||||
var ftpIpTextBox = ftp_ip;
|
||||
var ftpPortTextBox = ftp_port;
|
||||
var ftpBenutzernameTextBox = ftp_benutzername;
|
||||
var ftpPasswortTextBox = ftp_passwort;
|
||||
var ftpUeberpruefen = ftp_prüfen;
|
||||
|
||||
// Schritt 1: Sprechblase anzeigen: Öffnen des Plugin-Expanders oder FTP-Expanders
|
||||
_tutorialManager.HighlightElement(pluginExpander, new SolidColorBrush(Colors.Yellow));
|
||||
_tutorialManager.HighlightElement(ftpExpander, new SolidColorBrush(Colors.Yellow));
|
||||
_tutorialManager.ShowSpeechBubble(pluginExpander, TutorialManager.SpeechBubblePosition.Top, Language.GetString("Server_Schritt_1"), () =>
|
||||
{
|
||||
// Schritt 2: Plugin-Expander öffnen und Sprechblase ändern
|
||||
_tutorialManager.OpenExpander(pluginExpander);
|
||||
_tutorialManager.HighlightElement(pluginExpander, new SolidColorBrush(Colors.Transparent));
|
||||
_tutorialManager.HighlightElement(ftpExpander, new SolidColorBrush(Colors.Transparent));
|
||||
// Beide Felder hervorheben
|
||||
_tutorialManager.HighlightElement(pluginIpTextBox, new SolidColorBrush(Colors.LightBlue));
|
||||
_tutorialManager.HighlightElement(pluginPortTextBox, new SolidColorBrush(Colors.LightBlue));
|
||||
|
||||
_tutorialManager.ShowSpeechBubble(pluginExpander, TutorialManager.SpeechBubblePosition.Right,Language.GetString("Server_Schritt_2"), () =>
|
||||
{
|
||||
// Schritt 3: Beispielwerte in IP- und Port-Felder eintragen
|
||||
pluginIpTextBox.Text = "127.0.0.1";
|
||||
pluginPortTextBox.Text = "2456";
|
||||
_tutorialManager.HighlightElement(pluginUeberpruefen, new SolidColorBrush(Colors.LightBlue));
|
||||
|
||||
|
||||
|
||||
// Nächste Sprechblase: Warten auf Weiter!
|
||||
_tutorialManager.ShowSpeechBubble(pluginExpander, TutorialManager.SpeechBubblePosition.Right,Language.GetString("Server_Schritt_3"), () =>
|
||||
{
|
||||
// Schritt 4: Nächste Aktion einleiten (falls notwendig)
|
||||
_tutorialManager.ClickButton(pluginUeberpruefen);
|
||||
Task.Delay(2000);
|
||||
pluginUeberpruefen.Background = new SolidColorBrush(Colors.Green);
|
||||
pluginUeberpruefen.Content = "Erfolgreich Verbunden!";
|
||||
|
||||
_tutorialManager.ShowSpeechBubble(ftpExpander, TutorialManager.SpeechBubblePosition.Left,
|
||||
Language.GetString("Server_Schritt_4"),
|
||||
() =>
|
||||
{
|
||||
_tutorialManager.CloseExpander(pluginExpander);
|
||||
_tutorialManager.HighlightElement(pluginIpTextBox, new SolidColorBrush(Colors.Transparent));
|
||||
_tutorialManager.HighlightElement(pluginPortTextBox, new SolidColorBrush(Colors.Transparent));
|
||||
_tutorialManager.HighlightElement(pluginUeberpruefen, new SolidColorBrush(Colors.Transparent));
|
||||
pluginIpTextBox.Text = "";
|
||||
pluginPortTextBox.Text = "";
|
||||
pluginUeberpruefen.Background = new SolidColorBrush(Colors.Gray);
|
||||
pluginUeberpruefen.Content = "Verbindung Prüfen";
|
||||
_tutorialManager.OpenExpander(ftpExpander);
|
||||
_tutorialManager.HighlightElement(ftpIpTextBox, new SolidColorBrush(Colors.LightBlue));
|
||||
_tutorialManager.HighlightElement(ftpPortTextBox, new SolidColorBrush(Colors.LightBlue));
|
||||
_tutorialManager.HighlightElement(ftpBenutzernameTextBox, new SolidColorBrush(Colors.LightBlue));
|
||||
_tutorialManager.HighlightElement(ftpPasswortTextBox, new SolidColorBrush(Colors.LightBlue));
|
||||
|
||||
_tutorialManager.ShowSpeechBubble(ftpExpander, TutorialManager.SpeechBubblePosition.Left,
|
||||
Language.GetString("Server_Schritt_5"),
|
||||
async () =>
|
||||
{
|
||||
|
||||
_tutorialManager.WriteText(ftpIpTextBox, "127.0.0.1");
|
||||
_tutorialManager.WriteText(ftpPortTextBox, "21");
|
||||
_tutorialManager.WriteText(ftpBenutzernameTextBox, "ftpUser");
|
||||
_tutorialManager.WriteText(ftpPasswortTextBox, "123456789");
|
||||
|
||||
await _tutorialManager.SmoothScrollToControl(ftp_scroll, ftpUeberpruefen);
|
||||
Task.Delay(2000);
|
||||
|
||||
_tutorialManager.ClickButton(ftpUeberpruefen);
|
||||
ftpUeberpruefen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftpUeberpruefen.Content = "Verbindung Erfolgreich";
|
||||
|
||||
_tutorialManager.ShowSpeechBubble(ftpExpander,
|
||||
TutorialManager.SpeechBubblePosition.Left,
|
||||
Language.GetString("Server_Schritt_6"),
|
||||
() =>
|
||||
{
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
private void Weiter_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.Parent.Parent.Parent is MainWindow mainWindow) {
|
||||
if (mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
|
||||
mainWindowViewModel.SwitchToFTP(ftpClient);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DataPluginJson
|
||||
{
|
||||
public string ModVersion { get; set; }
|
||||
public string PluginVersion { get; set; }
|
||||
public string HashPlugins { get; set; }
|
||||
public string HashConfig { get; set; }
|
||||
public string HashClientSide { get; set; }
|
||||
public string OldConfigFiles { get; set; }
|
||||
public string OldConfigFolder { get; set; }
|
||||
public string OldConfigFolderFiles { get; set; }
|
||||
public string OldPluginFiles { get; set; }
|
||||
public string OldPluginFolder { get; set; }
|
||||
public string OldPluginFolderFiles { get; set; }
|
||||
public string ConfigFilestoDelete { get; set; }
|
||||
public string ConfigFoldertoDelete { get; set; }
|
||||
public string ConfigFolderFilestoDelete { get; set; }
|
||||
public string PluginFilestoDelete { get; set; }
|
||||
public string PluginFoldertoDelete { get; set; }
|
||||
public string PluginFolderFilestoDelete { get; set; }
|
||||
public string OldClientSideConfigFiles { get; set; }
|
||||
public string OldClientSideConfigFolder { get; set; }
|
||||
public string OldClientSideConfigFolderFiles { get; set; }
|
||||
public string OldClientSidePluginFiles { get; set; }
|
||||
public string OldClientSidePluginFolder { get; set; }
|
||||
public string OldClientSidePluginFolderFiles { get; set; }
|
||||
public string ClientSideConfigFilestoDelete { get; set; }
|
||||
public string ClientSideConfigFoldertoDelete { get; set; }
|
||||
public string ClientSideConfigFolderFilestoDelete { get; set; }
|
||||
public string ClientSidePluginFilestoDelete { get; set; }
|
||||
public string ClientSidePluginFoldertoDelete { get; set; }
|
||||
public string ClientSidePluginFolderFilestoDelete { get; set; }
|
||||
}
|
||||
|
||||
|
||||
private async void Plugin_prüfen_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
HttpClient PluginClient = new HttpClient();
|
||||
|
||||
try
|
||||
{
|
||||
var response = await PluginClient.GetAsync("http://amp.tbs-server.de:2456");
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var data = await response.Content.ReadFromJsonAsync<DataPluginJson>();
|
||||
plugin_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
plugin_prüfen.Content = "Verbindung Erfolgreich";
|
||||
Debug.WriteLine(data.ModVersion);
|
||||
}else
|
||||
{
|
||||
plugin_prüfen.Background = new SolidColorBrush(Colors.Red);
|
||||
plugin_prüfen.Content = "Verbindung Fehlgeschlagen";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
plugin_prüfen.Background = new SolidColorBrush(Colors.Red);
|
||||
plugin_prüfen.Content = "Verbindung Fehlgeschlagen";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private FtpClient ftpClient;
|
||||
private async void Ftp_prüfen_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{Console.WriteLine(ftp_ip.Text + ftp_port.Text + ftp_benutzername.Text + ftp_passwort.Text);
|
||||
|
||||
//ftpClient = new FtpClient("ftp://"+ ftp_ip.Text + ":" +ftp_port.Text, ftp_benutzername.Text, ftp_passwort.Text);
|
||||
FtpViewModel._ftpClient = new FtpClient("ftp://192.168.178.34:21", "tbs_ftp", "JLI_._nTH-DyG53Se9");
|
||||
var files = await ftpClient.ListDirectoryDetailsAsync();
|
||||
|
||||
if (files != null && files.Count > 0)
|
||||
{
|
||||
var name = "tbs";
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich1";
|
||||
Console.WriteLine(files);
|
||||
LizenzView.KeyAuthApp.webhook("aHtrWbrxrZ", "&name="+ LizenzView.lizenz_name[1] +"&data=testabc", "");
|
||||
Console.WriteLine(LizenzView.KeyAuthApp.response.message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich2";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Fehler beim Verbinden: {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
18
Valheim Dashboard/app.manifest
Normal file
18
Valheim Dashboard/app.manifest
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="Valheim_Dashboard.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user