-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Once again, lots and lots of changes
Gotta start the new year with 0 local changes.
- Loading branch information
1 parent
5f4e04a
commit 5f3961c
Showing
88 changed files
with
2,014 additions
and
820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
Source/HedgeModManager.UI/CLI/Commands/CliCommandContinueUpdate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using HedgeModManager.UI.Controls.Modals; | ||
using HedgeModManager.UI.ViewModels; | ||
using System.Diagnostics; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace HedgeModManager.UI.CLI.Commands; | ||
|
||
[CliCommand("continue-update", null, [typeof(int), typeof(int), typeof(string)], "Performs the manager update step", "")] | ||
public class CliCommandContinueUpdate : ICliCommand | ||
{ | ||
public int ProcessID = 0; | ||
public int Stage = 0; | ||
public string TargetDir = string.Empty; | ||
|
||
public bool Execute(List<CommandLine.Command> commands, CommandLine.Command command) | ||
{ | ||
ProcessID = (int)command.Inputs[0]; | ||
Stage = (int)command.Inputs[1]; | ||
TargetDir = (string)command.Inputs[2]; | ||
|
||
try | ||
{ | ||
var process = Process.GetProcessById(ProcessID); | ||
process?.WaitForExit(TimeSpan.FromMinutes(2)); | ||
// Wait for any debuggers to close | ||
Thread.Sleep(1000); | ||
} | ||
catch { } | ||
|
||
switch (Stage) | ||
{ | ||
case 0: // Copy files | ||
var updateDir = Program.InstallLocation; | ||
|
||
if (Directory.Exists(TargetDir)) | ||
Directory.Delete(TargetDir, true); | ||
foreach (var subDir in Directory.GetDirectories(updateDir, "*", SearchOption.AllDirectories)) | ||
{ | ||
var targetSubDir = TargetDir + subDir[updateDir.Length..]; | ||
Directory.CreateDirectory(targetSubDir); | ||
foreach (var file in Directory.GetFiles(subDir)) | ||
File.Copy(file, Path.Combine(targetSubDir, Path.GetFileName(file))); | ||
} | ||
// Root files | ||
foreach (var file in Directory.GetFiles(updateDir)) | ||
File.Copy(file, Path.Combine(TargetDir, Path.GetFileName(file))); | ||
|
||
string exePath = Path.Combine(TargetDir, "HedgeModManager.UI.exe"); | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
exePath = Path.Combine(TargetDir, "HedgeModManager.UI"); | ||
string args = "--continue-update"; | ||
args += $" {Process.GetCurrentProcess().Id}"; | ||
args += $" 1"; | ||
args += $" \"{updateDir}\""; | ||
Process.Start(new ProcessStartInfo(exePath, args) { UseShellExecute = true }); Environment.Exit(0); | ||
|
||
Environment.Exit(0); | ||
break; | ||
case 1: // Clean up | ||
if (Directory.Exists(TargetDir)) | ||
Directory.Delete(TargetDir, true); | ||
break; | ||
} | ||
return true; | ||
} | ||
|
||
public Task ExecuteUI(MainWindowViewModel mainWindowViewModel) => Task.CompletedTask; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<cp:ButtonUserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:cb="using:HedgeModManager.UI.Controls.Basic" | ||
xmlns:cp="using:HedgeModManager.UI.Controls.Primitives" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:materialIcons="using:Material.Icons.Avalonia" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="36" d:DesignHeight="36" | ||
x:Class="HedgeModManager.UI.Controls.Basic.Button"> | ||
<Border Classes.enabled="{Binding IsEnabled, RelativeSource={RelativeSource AncestorType=cb:Button}}" | ||
Classes.buttonBorder="True" | ||
MinWidth="36" MinHeight="36" Cursor="Hand" | ||
BorderBrush="{DynamicResource Button.BorderBrush}" | ||
BorderThickness="1" CornerRadius="8" | ||
PointerPressed="OnPointerPressed" | ||
PointerReleased="OnPointerReleased"> | ||
<StackPanel Orientation="Horizontal" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<materialIcons:MaterialIcon Kind="{Binding Icon, RelativeSource={RelativeSource AncestorType=cb:Button}}" | ||
IsVisible="{Binding UseIcon, RelativeSource={RelativeSource AncestorType=cb:Button}}" | ||
Width="24" Height="24" Margin="16,4,0,4" /> | ||
<TextBlock Text="{Binding Text, RelativeSource={RelativeSource AncestorType=cb:Button}, Converter={StaticResource StringLocalizeConverter}}" | ||
Margin="16,4,16,4" | ||
VerticalAlignment="Center" /> | ||
</StackPanel> | ||
<Border.Transitions> | ||
<Transitions> | ||
<BrushTransition Property="Background" Duration="0:0:0.1"/> | ||
</Transitions> | ||
</Border.Transitions> | ||
<Border.Styles> | ||
<Style Selector="Border.buttonBorder"> | ||
<Setter Property="Background" Value="{DynamicResource Button.BackgroundBrush}"/> | ||
<Style Selector="^:pointerover"> | ||
<Setter Property="Background" Value="{DynamicResource Button.HoverBrush}" /> | ||
</Style> | ||
<Style Selector="^ TextBlock"> | ||
<Setter Property="Foreground" Value="{DynamicResource Text.DisabledBrush}" /> | ||
</Style> | ||
<Style Selector="^.enabled TextBlock"> | ||
<Setter Property="Foreground" Value="{DynamicResource Text.NormalBrush}" /> | ||
</Style> | ||
<Style Selector="^ materialIcons|MaterialIcon"> | ||
<Setter Property="Foreground" Value="{DynamicResource Text.DisabledBrush}" /> | ||
</Style> | ||
<Style Selector="^.enabled materialIcons|MaterialIcon"> | ||
<Setter Property="Foreground" Value="{DynamicResource Text.NormalBrush}" /> | ||
</Style> | ||
</Style> | ||
<Style Selector=":pressed Border.buttonBorder"> | ||
<Setter Property="Background" Value="{DynamicResource Button.PressedBrush}"/> | ||
</Style> | ||
</Border.Styles> | ||
</Border> | ||
</cp:ButtonUserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Avalonia; | ||
using HedgeModManager.UI.Controls.Primitives; | ||
using Material.Icons; | ||
|
||
namespace HedgeModManager.UI.Controls.Basic; | ||
|
||
public partial class Button : ButtonUserControl | ||
{ | ||
public static readonly StyledProperty<string> TextProperty = | ||
AvaloniaProperty.Register<Button, string>(nameof(Text), string.Empty); | ||
|
||
public static readonly StyledProperty<bool> UseIconProperty = | ||
AvaloniaProperty.Register<Button, bool>(nameof(UseIcon), false); | ||
|
||
public static readonly StyledProperty<MaterialIconKind> IconProperty = | ||
AvaloniaProperty.Register<Button, MaterialIconKind>(nameof(Icon), MaterialIconKind.Abacus); | ||
|
||
public string Text | ||
{ | ||
get => GetValue(TextProperty); | ||
set => SetValue(TextProperty, value); | ||
} | ||
|
||
public bool UseIcon | ||
{ | ||
get => GetValue(UseIconProperty); | ||
set => SetValue(UseIconProperty, value); | ||
} | ||
|
||
public MaterialIconKind Icon | ||
{ | ||
get => GetValue(IconProperty); | ||
set => SetValue(IconProperty, value); | ||
} | ||
|
||
public Button() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.