mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-25 06:14:31 +00:00
Update mafiles removal logic and changelog URL generation
- Fixed crash: MaFiles collection in MainVM is now a new ObservableCollection. Manual removal from collection is omitted - Improved logic for moving mafiles to "removed": file extension is now always correct and name conflicts are handled more reliably - Github workflow: Changelog URL in update.xml now uses repository name only for correct links - On MaFiles collection change, PerformQuery is called to update search results - Fixed parameter order in mafiles renaming result string to match localization
This commit is contained in:
@@ -34,7 +34,7 @@ jobs:
|
||||
<item>
|
||||
<version>${{ steps.ver.outputs.version }}</version>
|
||||
<url>https://github.com/${{ github.repository }}/releases/download/${{ steps.ver.outputs.version }}/NebulaAuth.${{ steps.ver.outputs.version }}.zip</url>
|
||||
<changelog>https://achiez.github.io/${{ github.repository }}/changelog/${{ steps.ver.outputs.version }}.html</changelog>
|
||||
<changelog>https://achiez.github.io/${{ github.event.repository.name }}/changelog/${{ steps.ver.outputs.version }}.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
EOF
|
||||
@@ -62,4 +62,4 @@ jobs:
|
||||
|
||||
- name: Skip message
|
||||
if: steps.diff.outputs.no_changes == 'true'
|
||||
run: echo "No changes in version or update.xml — skipping release preparation."
|
||||
run: echo "No changes in version or update.xml - skipping release preparation."
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.IO;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using System.IO;
|
||||
|
||||
namespace NebulaAuth.Model.Mafiles;
|
||||
|
||||
internal static class MafilesStorageHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns <see cref="Mafile.Filename" /> or creates a new one and updates the property.
|
||||
/// Returns <see cref="Mafile.Filename" /> or creates a new one and updates the property. <see cref="Mafile.Filename"/> is always not <see langword="null"/> after this method call.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -148,13 +148,15 @@ public static class Storage
|
||||
public static void MoveToRemoved(Mafile data)
|
||||
{
|
||||
var sourcePath = MafilesStorageHelper.GetOrUpdateMafilePath(data);
|
||||
var destinationPath = Path.Combine(DIR_REMOVED_MAFILES, data.Filename + ".mafile");
|
||||
var destinationPathFinal = destinationPath;
|
||||
var fileName = Path.GetFileNameWithoutExtension(data.Filename!);
|
||||
var destinationPathBase = Path.Combine(DIR_REMOVED_MAFILES, fileName);
|
||||
var destinationPathFinal = Path.ChangeExtension(destinationPathBase, MafileNamingStrategy.DEF_EXTENSION);
|
||||
var i = 0;
|
||||
while (File.Exists(destinationPathFinal))
|
||||
{
|
||||
i++;
|
||||
destinationPathFinal = destinationPath + $" ({i})";
|
||||
destinationPathFinal = destinationPathBase + $" ({i})";
|
||||
destinationPathFinal = Path.ChangeExtension(destinationPathFinal, MafileNamingStrategy.DEF_EXTENSION);
|
||||
}
|
||||
|
||||
File.Copy(sourcePath, destinationPathFinal, false);
|
||||
|
||||
@@ -33,7 +33,7 @@ public partial class MainVM : ObservableObject
|
||||
public bool IsMafileSelected => SelectedMafile != null;
|
||||
public DialogHost CurrentDialogHost { get; set; } = null!;
|
||||
|
||||
[ObservableProperty] private ObservableCollection<Mafile> _maFiles = Storage.MaFiles;
|
||||
[ObservableProperty] private ObservableCollection<Mafile> _maFiles = new(Storage.MaFiles);
|
||||
|
||||
private Mafile? _selectedMafile;
|
||||
|
||||
@@ -115,7 +115,7 @@ public partial class MainVM : ObservableObject
|
||||
|
||||
private void MaFilesOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
SearchText = string.Empty;
|
||||
PerformQuery();
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,6 @@ public partial class MainVM : ObservableObject
|
||||
if (result.Success)
|
||||
{
|
||||
Storage.MoveToRemoved(selectedMafile);
|
||||
MaFiles.Remove(selectedMafile);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -86,7 +86,7 @@ public partial class SettingsVM : ObservableObject
|
||||
{
|
||||
var l = GetLoc("PartialSuccess");
|
||||
RenameResultText =
|
||||
string.Format(l, result.Total, result.Renamed, result.Errors, result.Conflict, result.BackupFileName);
|
||||
string.Format(l, result.Total, result.Renamed, result.Conflict, result.Errors, result.BackupFileName);
|
||||
}
|
||||
|
||||
string GetLoc(string key)
|
||||
|
||||
Reference in New Issue
Block a user