Skip to content
33 changes: 33 additions & 0 deletions GenHub/GenHub/Common/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using GenHub.Common.ViewModels.Dialogs;
using GenHub.Core.Constants;
using GenHub.Core.Interfaces.Common;
using GenHub.Core.Interfaces.Notifications;
using GenHub.Core.Messages;
Expand Down Expand Up @@ -416,4 +420,33 @@ partial void OnSelectedTabChanged(NavigationTab value)

SaveSelectedTab(value);
}

/// <summary>
/// Copies the application version to the clipboard.
/// </summary>
[RelayCommand]
private async Task CopyVersionToClipboard()
{
try
{
var lifetime = Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime;
var mainWindow = lifetime?.MainWindow;
var topLevel = mainWindow != null ? TopLevel.GetTopLevel(mainWindow) : null;

if (topLevel?.Clipboard != null)
{
await topLevel.Clipboard.SetTextAsync(AppConstants.FullDisplayVersion);
notificationService.ShowSuccess("Copied", "Version copied to clipboard.", 3000);
}
else
{
notificationService.ShowError("Error", "Clipboard not available.", 3000);
}
}
catch (Exception ex)
{
logger?.LogError(ex, "Failed to copy version to clipboard");
notificationService.ShowError("Error", "Failed to copy version to clipboard.", 3000);
}
}
}
19 changes: 13 additions & 6 deletions GenHub/GenHub/Common/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,19 @@
<Grid Grid.Row="1">
<ContentControl Content="{Binding CurrentTabViewModel}" />
<!-- Version label in bottom right corner -->
<TextBlock Text="{x:Static constants:AppConstants.DisplayVersion}"
FontSize="9"
Foreground="#808080"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0,0,10,5" />
<Button Command="{Binding CopyVersionToClipboardCommand}"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0,0,10,5"
Padding="0"
Background="Transparent"
BorderThickness="0"
Cursor="Hand"
ToolTip.Tip="Click to copy version to clipboard">
<TextBlock Text="{x:Static constants:AppConstants.DisplayVersion}"
Comment thread
undead2146 marked this conversation as resolved.
Outdated
FontSize="9"
Foreground="#808080" />
</Button>
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Comment thread
undead2146 marked this conversation as resolved.
</Grid>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,12 @@ private async Task<OperationResult<ReconciliationResult>> ReconcileBulkManifestR
}
else
{
var error = $"Failed to update profile '{profile.Name}': {updateResult.FirstError}";
logger.LogWarning("Failed to update profile '{ProfileName}': {Error}", profile.Name, updateResult.FirstError);
failedProfiles.Add(profile.Name);
}
}
catch (Exception ex)
{
var error = $"Error reconciling profile '{profile.Name}': {ex.Message}";
logger.LogError(ex, "Error reconciling profile '{ProfileName}': {Message}", profile.Name, ex.Message);
failedProfiles.Add(profile.Name);
}
Expand Down Expand Up @@ -608,14 +606,12 @@ private async Task<OperationResult<ReconciliationResult>> ReconcileManifestRemov
}
else
{
var error = $"Failed to update profile '{profile.Name}': {updateResult.FirstError}";
logger.LogWarning("Failed to update profile '{ProfileName}': {Error}", profile.Name, updateResult.FirstError);
failedProfiles.Add(profile.Name);
}
}
catch (Exception ex)
{
var error = $"Error removing manifest from profile '{profile.Name}': {ex.Message}";
logger.LogError(ex, "Error removing manifest from profile '{ProfileName}': {Message}", profile.Name, ex.Message);
failedProfiles.Add(profile.Name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ private async Task<OperationResult<ContentManifest>> StoreManifestOnlyAsync(
{
FileOperationsService.DeleteFileIfExists(manifestPath);

// Clean up the content dir created for source.path mapping
var contentDir = Path.Combine(_storageRoot, DirectoryNames.Data, manifest.Id.Value);
if (Directory.Exists(contentDir))
Directory.Delete(contentDir, recursive: true);
Comment thread
undead2146 marked this conversation as resolved.
Outdated
Comment thread
undead2146 marked this conversation as resolved.
Outdated

Comment thread
undead2146 marked this conversation as resolved.
// Untrack manifest if we failed to save its metadata but had already tracked/refreshed references.
await _referenceTracker.UntrackManifestAsync(manifest.Id, CancellationToken.None);
}
Expand Down
50 changes: 25 additions & 25 deletions GenHub/GenHub/Features/Settings/Views/SettingsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,31 +409,6 @@
<TextBlock Text="Select application color theme (More coming soon)"
Classes="setting-description" />
</StackPanel>

<!-- Auto Update Check -->
<StackPanel Spacing="8">
<CheckBox Content="Check for updates on startup"
IsChecked="{Binding AutoCheckForUpdatesOnStartup}" />
<TextBlock Text="Automatically check for GenHub updates when the application starts"
Classes="setting-description" Margin="24,0,0,0" />
</StackPanel>

<!-- Settings File Path -->
<StackPanel Spacing="8">
<TextBlock Text="Settings File Location" Classes="setting-label" />
<Grid ColumnDefinitions="*,Auto">
<TextBox Grid.Column="0"
Text="{Binding SettingsFilePath}"
Watermark="Default (platform-dependent)"
LostFocus="OnTextBoxLostFocus" />
<Button Grid.Column="1"
Content="Browse"
Command="{Binding BrowseSettingsFilePathCommand}"
Classes="browse-button" />
</Grid>
<TextBlock Text="Specify a custom location for your settings file. Leave empty for auto-detection."
Classes="setting-description" />
</StackPanel>
</StackPanel>
</Border>
</Expander>
Expand Down Expand Up @@ -480,6 +455,23 @@
Command="{Binding OpenCasPoolDirectoryCommand}"
Classes="secondary-button" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"/>
</Grid>

<!-- Settings File Path -->
<StackPanel Spacing="8">
<TextBlock Text="Settings File Location" Classes="setting-label" />
<Grid ColumnDefinitions="*,Auto">
<TextBox Grid.Column="0"
Text="{Binding SettingsFilePath}"
Watermark="Default (platform-dependent)"
LostFocus="OnTextBoxLostFocus" />
<Button Grid.Column="1"
Content="Browse"
Command="{Binding BrowseSettingsFilePathCommand}"
Classes="browse-button" />
</Grid>
<TextBlock Text="Specify a custom location for your settings file. Leave empty for auto-detection."
Classes="setting-description" />
</StackPanel>
</StackPanel>
</Border>
</Expander>
Expand Down Expand Up @@ -734,6 +726,14 @@
ToolTip.Tip="Browse available updates and subscribe to Pull Requests" />


<!-- Auto Update Check -->
<StackPanel Spacing="8">
<CheckBox Content="Check for updates on startup"
IsChecked="{Binding AutoCheckForUpdatesOnStartup}" />
<TextBlock Text="Automatically check for GenHub updates when the application starts"
Classes="setting-description" Margin="24,0,0,0" />
</StackPanel>

<!-- GitHub PAT for Artifact Access -->
<Border Background="#1E1E1E" CornerRadius="4" Padding="15" BorderBrush="#4E4E4E" BorderThickness="1">
<StackPanel Spacing="12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ await Parallel.ForEachAsync(
async (fileGroup, ct) =>
{
// For each destination path, process files in priority order (lowest to highest)
// Priority: GameInstallation (0) < GameClient (1) < Mod (2)
// Priority: GameInstallation (10) < Addon (40) < GameClient (50) < Patch (90) < Mod (100)
// This ensures higher priority content overwrites lower priority
var orderedFiles = fileGroup
.OrderBy(item => item.Manifest.ContentType)
.OrderBy(item => ContentTypePriority.GetPriority(item.Manifest.ContentType))
.ToList();
Comment thread
undead2146 marked this conversation as resolved.

// Process all versions of this file in priority order
Expand Down
Loading