mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Bit of a first draft of a launcher
This commit is contained in:
parent
e4551115e5
commit
759e959764
1163
Wabbajack.Launcher/Annotations.cs
Normal file
1163
Wabbajack.Launcher/Annotations.cs
Normal file
File diff suppressed because it is too large
Load Diff
9
Wabbajack.Launcher/App.xaml
Normal file
9
Wabbajack.Launcher/App.xaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Application x:Class="Wabbajack.Launcher.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:Wabbajack.Launcher"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
17
Wabbajack.Launcher/App.xaml.cs
Normal file
17
Wabbajack.Launcher/App.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Wabbajack.Launcher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
10
Wabbajack.Launcher/AssemblyInfo.cs
Normal file
10
Wabbajack.Launcher/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
23
Wabbajack.Launcher/MainWindow.xaml
Normal file
23
Wabbajack.Launcher/MainWindow.xaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<Window x:Class="Wabbajack.Launcher.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Wabbajack.Launcher"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Wabbajack Launcher" Height="320" Width="600"
|
||||||
|
WindowStyle="None"
|
||||||
|
Background="#121212"
|
||||||
|
BorderThickness="0"
|
||||||
|
AllowsTransparency="False"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="275"></RowDefinition>
|
||||||
|
<RowDefinition Height="45"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Image Grid.Row="0" Source="Wabba_Mouth_Small.png"></Image>
|
||||||
|
<Label Grid.Row="1" Foreground="White" FontSize="20" Content="{Binding Status}"></Label>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
29
Wabbajack.Launcher/MainWindow.xaml.cs
Normal file
29
Wabbajack.Launcher/MainWindow.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Wabbajack.Launcher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
DataContext = new MainWindowVM();
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
95
Wabbajack.Launcher/MainWindowVM.cs
Normal file
95
Wabbajack.Launcher/MainWindowVM.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Wabbajack.Launcher.Annotations;
|
||||||
|
|
||||||
|
namespace Wabbajack.Launcher
|
||||||
|
{
|
||||||
|
public class MainWindowVM : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
[NotifyPropertyChangedInvocator]
|
||||||
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _status = "Checking for Updates";
|
||||||
|
private string _version;
|
||||||
|
|
||||||
|
public string Status
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_status = value;
|
||||||
|
OnPropertyChanged("Status");
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainWindowVM()
|
||||||
|
{
|
||||||
|
Task.Run(CheckForUpdates);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task CheckForUpdates()
|
||||||
|
{
|
||||||
|
_version = "0.9.17.0";
|
||||||
|
|
||||||
|
var base_folder = Path.Combine(Directory.GetCurrentDirectory());
|
||||||
|
|
||||||
|
if (File.Exists(Path.Combine(base_folder, _version, "Wabbajack.exe")))
|
||||||
|
FinishAndExit();
|
||||||
|
|
||||||
|
var wc = new WebClient();
|
||||||
|
wc.DownloadProgressChanged += UpdateProgress;
|
||||||
|
var data = await wc.DownloadDataTaskAsync(new Uri("https://build.wabbajack.org/0.9.17.0.zip"));
|
||||||
|
|
||||||
|
using (var zip = new ZipArchive(new MemoryStream(data), ZipArchiveMode.Read))
|
||||||
|
{
|
||||||
|
foreach (var entry in zip.Entries)
|
||||||
|
{
|
||||||
|
Status = $"Extracting: {entry.Name}";
|
||||||
|
var outPath = Path.Combine(base_folder, entry.FullName);
|
||||||
|
if (!Directory.Exists(Path.GetDirectoryName(outPath)))
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(outPath));
|
||||||
|
|
||||||
|
if (entry.FullName.EndsWith("/") || entry.FullName.EndsWith("\\"))
|
||||||
|
continue;
|
||||||
|
await using var o = entry.Open();
|
||||||
|
await using var of = File.Create(outPath);
|
||||||
|
await o.CopyToAsync(of);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FinishAndExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FinishAndExit()
|
||||||
|
{
|
||||||
|
Status = "Launching...";
|
||||||
|
var wj_folder = Path.Combine(Directory.GetCurrentDirectory(), _version);
|
||||||
|
var info = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = Path.Combine(wj_folder, "Wabbajack.exe"),
|
||||||
|
WorkingDirectory = wj_folder,
|
||||||
|
};
|
||||||
|
Process.Start(info);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateProgress(object sender, DownloadProgressChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Status = $"Downloading ({e.ProgressPercentage}%)...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Wabbajack.Launcher/Resources/Icons/wabbajack.ico
Normal file
BIN
Wabbajack.Launcher/Resources/Icons/wabbajack.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 KiB |
BIN
Wabbajack.Launcher/Wabba_Mouth_Small.png
Normal file
BIN
Wabbajack.Launcher/Wabba_Mouth_Small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
25
Wabbajack.Launcher/Wabbajack.Launcher.csproj
Normal file
25
Wabbajack.Launcher/Wabbajack.Launcher.csproj
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>Resources\Icons\wabbajack.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Wabba_Mouth_Small.png" />
|
||||||
|
<Resource Include="Wabba_Mouth_Small.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -38,6 +38,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Test", "Wabbajack
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.CLI", "Wabbajack.CLI\Wabbajack.CLI.csproj", "{685D8BB1-D178-4D2C-85C7-C54A36FB7454}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.CLI", "Wabbajack.CLI\Wabbajack.CLI.csproj", "{685D8BB1-D178-4D2C-85C7-C54A36FB7454}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.Launcher", "Wabbajack.Launcher\Wabbajack.Launcher.csproj", "{D6856DBF-C959-4867-A8A8-343DA2D2715E}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -118,6 +120,14 @@ Global
|
|||||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|Any CPU.ActiveCfg = Release|x64
|
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.ActiveCfg = Release|x64
|
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.ActiveCfg = Release|x64
|
||||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.Build.0 = Release|x64
|
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.Build.0 = Release|x64
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
2
Wabbajack.sln.DotSettings
Normal file
2
Wabbajack.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Wabbajack_002ELauncher_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -14,9 +14,9 @@
|
|||||||
<StartupObject></StartupObject>
|
<StartupObject></StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>Resources\Icons\wabbajack.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\Icons\wabbajack.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
Loading…
Reference in New Issue
Block a user