Compare commits
No commits in common. "a70590d92a7564bdbf6fff7c551c15b44e455f0b" and "f7fbdee568f488aed4656b3b06d82f606796404e" have entirely different histories.
a70590d92a
...
f7fbdee568
@ -9,7 +9,6 @@
|
|||||||
</Button>
|
</Button>
|
||||||
<TextBox Text="Some cool text here" Margin="5" />
|
<TextBox Text="Some cool text here" Margin="5" />
|
||||||
<TextBox Watermark="This is a watermark" Margin="5" />
|
<TextBox Watermark="This is a watermark" Margin="5" />
|
||||||
<CheckBox Content="sldkflskdf" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
|
|
||||||
@ -268,30 +267,4 @@
|
|||||||
<Style Selector="Button.icon:pressed">
|
<Style Selector="Button.icon:pressed">
|
||||||
<Setter Property="Foreground" Value="{StaticResource SPT_DarkGrayBlue}"></Setter>
|
<Setter Property="Foreground" Value="{StaticResource SPT_DarkGrayBlue}"></Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Checkbox Styles -->
|
|
||||||
<Style Selector="CheckBox">
|
|
||||||
<Setter Property="Foreground" Value="White"/>
|
|
||||||
<Style.Resources>
|
|
||||||
<SolidColorBrush x:Key="CheckBoxCheckBackgroundStrokeUnchecked" Color="DimGray"/>
|
|
||||||
</Style.Resources>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="CheckBox:pointerover /template/ ContentPresenter#ContentPresenter">
|
|
||||||
<Setter Property="Foreground" Value="White"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="CheckBox:checked /template/ ContentPresenter#ContentPresenter">
|
|
||||||
<Setter Property="Foreground" Value="White"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="CheckBox:pointerover /template/ Border#NormalRectangle">
|
|
||||||
<Setter Property="BorderBrush" Value="{StaticResource SPT_Yellow}"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="CheckBox:checked /template/ Border#NormalRectangle">
|
|
||||||
<Setter Property="BorderBrush" Value="{StaticResource SPT_Yellow}"/>
|
|
||||||
<Setter Property="Background" Value="{StaticResource SPT_DarkGrayBlue}"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="CheckBox:checked /template/ Path#CheckGlyph">
|
|
||||||
<Setter Property="Fill" Value="{StaticResource SPT_Yellow}"/>
|
|
||||||
</Style>
|
|
||||||
</Styles>
|
</Styles>
|
@ -98,29 +98,33 @@ public static class FileHelper
|
|||||||
{
|
{
|
||||||
Log.Debug($"Starting StreamAssemblyResourceOut, resourcename: {resourceName}, outputFilePath: {outputFilePath}");
|
Log.Debug($"Starting StreamAssemblyResourceOut, resourcename: {resourceName}, outputFilePath: {outputFilePath}");
|
||||||
var assembly = Assembly.GetExecutingAssembly();
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
Log.Debug($"1");
|
||||||
|
|
||||||
FileInfo outputFile = new FileInfo(outputFilePath);
|
FileInfo outputFile = new FileInfo(outputFilePath);
|
||||||
|
Log.Debug($"2");
|
||||||
if (outputFile.Exists)
|
if (outputFile.Exists)
|
||||||
{
|
{
|
||||||
|
Log.Debug($"3");
|
||||||
outputFile.Delete();
|
outputFile.Delete();
|
||||||
}
|
}
|
||||||
|
Log.Debug($"4");
|
||||||
if (!outputFile.Directory.Exists)
|
if (!outputFile.Directory.Exists)
|
||||||
{
|
{
|
||||||
|
Log.Debug($"5");
|
||||||
Directory.CreateDirectory(outputFile.Directory.FullName);
|
Directory.CreateDirectory(outputFile.Directory.FullName);
|
||||||
}
|
}
|
||||||
|
Log.Debug($"6");
|
||||||
var resName = assembly.GetManifestResourceNames().First(x => x.EndsWith(resourceName));
|
var resName = assembly.GetManifestResourceNames().First(x => x.EndsWith(resourceName));
|
||||||
|
Log.Debug($"7");
|
||||||
using (FileStream fs = File.Create(outputFilePath))
|
using (FileStream fs = File.Create(outputFilePath))
|
||||||
using (Stream s = assembly.GetManifestResourceStream(resName))
|
using (Stream s = assembly.GetManifestResourceStream(resName))
|
||||||
{
|
{
|
||||||
|
Log.Debug($"8");
|
||||||
s.CopyTo(fs);
|
s.CopyTo(fs);
|
||||||
}
|
}
|
||||||
|
Log.Debug($"9");
|
||||||
outputFile.Refresh();
|
outputFile.Refresh();
|
||||||
|
Log.Debug(outputFile.Exists.ToString());
|
||||||
return outputFile.Exists;
|
return outputFile.Exists;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
param (
|
|
||||||
[string]$installPath
|
|
||||||
)
|
|
||||||
|
|
||||||
$desktop = Join-Path $env:USERPROFILE "Desktop"
|
|
||||||
|
|
||||||
$launcherExe = gci $installPath | where {$_.Name -like "*.Launcher.exe"} | select -ExpandProperty FullName
|
|
||||||
$serverExe = gci $installPath | where {$_.Name -like "*.Server.exe"} | select -ExpandProperty FullName
|
|
||||||
|
|
||||||
$launcherShortcut = Join-Path $desktop "SPT.Launcher.lnk"
|
|
||||||
$serverShortcut = Join-Path $desktop "SPT.Server.lnk"
|
|
||||||
|
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
|
||||||
|
|
||||||
$launcher = $WshShell.CreateShortcut($launcherShortcut)
|
|
||||||
$launcher.TargetPath = $launcherExe
|
|
||||||
$launcher.WorkingDirectory = $installPath
|
|
||||||
$launcher.Save()
|
|
||||||
|
|
||||||
$server = $WshShell.CreateShortcut($serverShortcut)
|
|
||||||
$server.TargetPath = $serverExe
|
|
||||||
$server.WorkingDirectory = $installPath
|
|
||||||
$server.Save()
|
|
@ -43,7 +43,7 @@ while (-not $copied) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Remove-Item $destination -ErrorAction SilentlyContinue
|
Remove-Item $destination -ErrorAction SilentlyContinue
|
||||||
Copy-Item $source $destination -ErrorAction SilentlyContinue
|
Copy-Item $source $destination
|
||||||
|
|
||||||
if (Test-Path $destination) {
|
if (Test-Path $destination) {
|
||||||
$sLength = (Get-Item $source).Length
|
$sLength = (Get-Item $source).Length
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
<PackageIcon>icon.ico</PackageIcon>
|
<PackageIcon>icon.ico</PackageIcon>
|
||||||
<ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon>
|
||||||
<Configurations>Debug;Release;TEST</Configurations>
|
<Configurations>Debug;Release;TEST</Configurations>
|
||||||
<AssemblyVersion>2.83</AssemblyVersion>
|
<AssemblyVersion>2.82</AssemblyVersion>
|
||||||
<FileVersion>2.83</FileVersion>
|
<FileVersion>2.82</FileVersion>
|
||||||
<Company>SPT</Company>
|
<Company>SPT</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -26,8 +26,6 @@
|
|||||||
<EmbeddedResource Include="Resources\update.ps1"/>
|
<EmbeddedResource Include="Resources\update.ps1"/>
|
||||||
<None Remove="Resources\7z.dll"/>
|
<None Remove="Resources\7z.dll"/>
|
||||||
<EmbeddedResource Include="Resources\7z.dll"/>
|
<EmbeddedResource Include="Resources\7z.dll"/>
|
||||||
<None Remove="Resources\add_shortcuts.ps1" />
|
|
||||||
<EmbeddedResource Include="Resources\add_shortcuts.ps1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Diagnostics;
|
using Avalonia;
|
||||||
using Avalonia;
|
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using SPTInstaller.CustomControls;
|
using SPTInstaller.CustomControls;
|
||||||
@ -10,7 +9,6 @@ using System.Windows.Input;
|
|||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
using SPTInstaller.Models;
|
|
||||||
|
|
||||||
namespace SPTInstaller.ViewModels;
|
namespace SPTInstaller.ViewModels;
|
||||||
|
|
||||||
@ -40,14 +38,6 @@ public class MessageViewModel : ViewModelBase
|
|||||||
set => this.RaiseAndSetIfChanged(ref _showCloseButton, value);
|
set => this.RaiseAndSetIfChanged(ref _showCloseButton, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _showOptions;
|
|
||||||
|
|
||||||
public bool ShowOptions
|
|
||||||
{
|
|
||||||
get => _showOptions;
|
|
||||||
set => this.RaiseAndSetIfChanged(ref _showOptions, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _cacheInfoText;
|
private string _cacheInfoText;
|
||||||
|
|
||||||
public string CacheInfoText
|
public string CacheInfoText
|
||||||
@ -64,20 +54,6 @@ public class MessageViewModel : ViewModelBase
|
|||||||
set => this.RaiseAndSetIfChanged(ref _clipCommandText, value);
|
set => this.RaiseAndSetIfChanged(ref _clipCommandText, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _addShortcuts;
|
|
||||||
public bool AddShortcuts
|
|
||||||
{
|
|
||||||
get => _addShortcuts;
|
|
||||||
set => this.RaiseAndSetIfChanged(ref _addShortcuts, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _openInstallFolder = true;
|
|
||||||
public bool OpenInstallFolder
|
|
||||||
{
|
|
||||||
get => _openInstallFolder;
|
|
||||||
set => this.RaiseAndSetIfChanged(ref _openInstallFolder, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand CopyLogFileToClipboard => ReactiveCommand.CreateFromTask(async () =>
|
public ICommand CopyLogFileToClipboard => ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
@ -121,7 +97,8 @@ public class MessageViewModel : ViewModelBase
|
|||||||
|
|
||||||
public ICommand CloseCommand { get; set; } = ReactiveCommand.Create(() =>
|
public ICommand CloseCommand { get; set; } = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopApp)
|
if (Application.Current.ApplicationLifetime is
|
||||||
|
Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
|
||||||
{
|
{
|
||||||
desktopApp.MainWindow.Close();
|
desktopApp.MainWindow.Close();
|
||||||
}
|
}
|
||||||
@ -133,64 +110,6 @@ public class MessageViewModel : ViewModelBase
|
|||||||
Message = result.Message;
|
Message = result.Message;
|
||||||
ClipCommandText = "Copy installer log to clipboard";
|
ClipCommandText = "Copy installer log to clipboard";
|
||||||
|
|
||||||
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopApp)
|
|
||||||
{
|
|
||||||
var data = ServiceHelper.Get<InternalData?>();
|
|
||||||
|
|
||||||
desktopApp.MainWindow.Closing += (_, _) =>
|
|
||||||
{
|
|
||||||
if (ShowOptions)
|
|
||||||
{
|
|
||||||
if (OpenInstallFolder)
|
|
||||||
{
|
|
||||||
Process.Start(new ProcessStartInfo()
|
|
||||||
{
|
|
||||||
FileName = "explorer.exe",
|
|
||||||
Arguments = data.TargetInstallPath
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AddShortcuts)
|
|
||||||
{
|
|
||||||
var shortcuts = new FileInfo(Path.Join(DownloadCacheHelper.CachePath, "add_shortcuts.ps1"));
|
|
||||||
|
|
||||||
if (!FileHelper.StreamAssemblyResourceOut("add_shortcuts.ps1", shortcuts.FullName))
|
|
||||||
{
|
|
||||||
Log.Fatal("Failed to prepare shortcuts file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!File.Exists(shortcuts.FullName))
|
|
||||||
{
|
|
||||||
Log.Fatal("Shortcuts file not found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Information("Running add shortcuts script ...");
|
|
||||||
|
|
||||||
Process.Start(new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = "powershell.exe",
|
|
||||||
CreateNoWindow = true,
|
|
||||||
ArgumentList =
|
|
||||||
{
|
|
||||||
"-ExecutionPolicy", "Bypass", "-File", $"{shortcuts.FullName}", $"{data.TargetInstallPath}"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File.Copy(App.LogPath, Path.Join(data.TargetInstallPath, "spt-installer.log"), true);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Error(ex, "Failed to copy installer log to install path");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
CacheInfoText = "Getting cache size ...";
|
CacheInfoText = "Getting cache size ...";
|
||||||
@ -203,7 +122,6 @@ public class MessageViewModel : ViewModelBase
|
|||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
Log.Information(Message);
|
Log.Information(Message);
|
||||||
ShowOptions = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,AUTO,*" RowDefinitions="*,AUTO,20,AUTO,20,Auto,Auto,*"
|
<Grid ColumnDefinitions="*,AUTO,*" RowDefinitions="*,AUTO,20,AUTO,20,Auto,*"
|
||||||
Classes.error="{Binding HasErrors}">
|
Classes.error="{Binding HasErrors}">
|
||||||
|
|
||||||
<Label Grid.Column="1" Grid.Row="1"
|
<Label Grid.Column="1" Grid.Row="1"
|
||||||
@ -35,18 +35,12 @@
|
|||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
Padding="20 10" />
|
Padding="20 10" />
|
||||||
|
|
||||||
<StackPanel Grid.Row="5" Grid.Column="1" Orientation="Horizontal" Spacing="10">
|
<Button Grid.Row="5" Grid.Column="1" Classes="link" Content="{Binding ClipCommandText}"
|
||||||
<CheckBox IsChecked="{Binding OpenInstallFolder}" Content="Open Install Folder" IsVisible="{Binding ShowOptions}"/>
|
Command="{Binding CopyLogFileToClipboard}" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
<CheckBox IsChecked="{Binding AddShortcuts}" Content="Add Desktop Shortcuts" IsVisible="{Binding ShowOptions}"/>
|
/>
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<cc:CacheInfo Grid.Row="7" Grid.ColumnSpan="3" Padding="10" Margin="10 0 0 0"
|
<cc:CacheInfo Grid.Row="6" Grid.ColumnSpan="3" Padding="10" Margin="10 0 0 0"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}"
|
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}" />
|
||||||
/>
|
|
||||||
|
|
||||||
<Button Grid.Row="7" Grid.Column="2" Classes="link" Content="{Binding ClipCommandText}"
|
|
||||||
Command="{Binding CopyLogFileToClipboard}" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
|
||||||
/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
Loading…
x
Reference in New Issue
Block a user