7 Commits

35 changed files with 715 additions and 1098 deletions

View File

@@ -128,11 +128,9 @@ public static class FAT
{
// exFAT
case "EXFAT ":
return false;
// NTFS
case "NTFS " when bootable == 0xAA55 && numberOfFats == 0 && fatSectors == 0:
return false;
// QNX4
case "FQNX4FS ":
@@ -171,7 +169,6 @@ public static class FAT
rootEntries > 0 &&
fatSectors > 0 &&
bpbSignature is 0x28 or 0x29:
return sectors == 0 ? bigSectors <= imageSectors : sectors <= imageSectors;
// BPB
case 1 when correctSpc &&
@@ -233,14 +230,14 @@ public static class FAT
{
for(var c = 0; c < 11; c++)
{
if(rootDir[c + e] < 0x20 && rootDir[c + e] != 0x00 && rootDir[c + e] != 0x05 ||
rootDir[c + e] == 0xFF ||
rootDir[c + e] == 0x2E)
{
validRootDir = false;
if((rootDir[c + e] >= 0x20 || rootDir[c + e] == 0x00 || rootDir[c + e] == 0x05) &&
rootDir[c + e] != 0xFF &&
rootDir[c + e] != 0x2E)
continue;
break;
}
validRootDir = false;
break;
}
if(!validRootDir) break;

View File

@@ -25,9 +25,9 @@ public sealed class Fuse : FileSystem
public Fuse(Vfs vfs)
{
_directoryCache = new ConcurrentDictionary<long, List<DirectoryEntry>>();
_directoryCache = [];
_lastHandle = 0;
_fileStatHandleCache = new ConcurrentDictionary<long, Stat>();
_fileStatHandleCache = [];
Name = "romrepomgrfs";
_vfs = vfs;
}

View File

@@ -197,7 +197,7 @@ public class Vfs : IDisposable
if(cachedMachines != null) return cachedMachines;
cachedMachines = new ConcurrentDictionary<string, CachedMachine>();
cachedMachines = [];
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
@@ -233,7 +233,7 @@ public class Vfs : IDisposable
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
cachedMachineFiles = new ConcurrentDictionary<string, CachedFile>();
cachedMachineFiles = [];
foreach(FileByMachine machineFile in ctx.FilesByMachines.Where(fbm => fbm.Machine.Id == id && fbm.File.IsInRepo)
.Include(fileByMachine => fileByMachine.File))
@@ -269,7 +269,7 @@ public class Vfs : IDisposable
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
cachedMachineDisks = new ConcurrentDictionary<string, CachedDisk>();
cachedMachineDisks = [];
foreach(DiskByMachine machineDisk in ctx.DisksByMachines
.Where(dbm => dbm.Machine.Id == id &&
@@ -303,7 +303,7 @@ public class Vfs : IDisposable
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
cachedMachineMedias = new ConcurrentDictionary<string, CachedMedia>();
cachedMachineMedias = [];
foreach(MediaByMachine machineMedia in ctx.MediasByMachines
.Where(mbm => mbm.Machine.Id == id &&

View File

@@ -514,35 +514,35 @@ public sealed class DatImporter
? ctx.Disks
.FromSqlRaw($"SELECT DISTINCT f.* FROM Disks AS f, [{tmpDiskMd5Table}] AS t WHERE f.Md5 = t.Md5")
.ToDictionary(f => f.Md5)
: new Dictionary<string, DbDisk>();
: [];
Dictionary<string, DbDisk> pendingDisksBySha1 =
disksHaveSha1
? ctx.Disks
.FromSqlRaw($"SELECT DISTINCT f.* FROM Disks AS f, [{tmpDiskSha1Table}] AS t WHERE f.Sha1 = t.Sha1")
.ToDictionary(f => f.Sha1)
: new Dictionary<string, DbDisk>();
: [];
Dictionary<string, DbMedia> pendingMediasByMd5 =
mediasHaveMd5
? ctx.Medias
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaMd5Table}] AS t WHERE f.Md5 = t.Md5")
.ToDictionary(f => f.Md5)
: new Dictionary<string, DbMedia>();
: [];
Dictionary<string, DbMedia> pendingMediasBySha1 =
mediasHaveSha1
? ctx.Medias
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaSha1Table}] AS t WHERE f.Sha1 = t.Sha1")
.ToDictionary(f => f.Sha1)
: new Dictionary<string, DbMedia>();
: [];
Dictionary<string, DbMedia> pendingMediasBySha256 =
mediasHaveSha256
? ctx.Medias
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaSha256Table}] AS t WHERE f.Sha256 = t.Sha256")
.ToDictionary(f => f.Sha256)
: new Dictionary<string, DbMedia>();
: [];
var pendingFilesByCrc = new Dictionary<string, DbFile>();
var pendingFilesByMd5 = new Dictionary<string, DbFile>();

View File

@@ -1,21 +1,21 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:RomRepoMgr"
xmlns:resources="clr-namespace:RomRepoMgr.Resources"
x:Class="RomRepoMgr.App">
<Application.DataTemplates>
<local:ViewLocator />
</Application.DataTemplates>
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
<FluentTheme /> <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
</Application.Styles>
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem Header="_About"
<NativeMenuItem Header="{x:Static resources:Localization.HelpMenuAboutText}"
Click="OnAboutClicked" />
<NativeMenuItem Header="_Preferences"
<NativeMenuItem Header="{x:Static resources:Localization.NativeMenuPreferencesText}"
Click="OnPreferencesClicked" />
<NativeMenuItem Header="_Quit"
<NativeMenuItem Header="{x:Static resources:Localization.NativeMenuQuitText}"
Click="OnQuitClicked" />
</NativeMenu>
</NativeMenu.Menu>

File diff suppressed because it is too large Load Diff

View File

@@ -372,4 +372,10 @@ Tardará mucho tiempo...</value>
<data name="UpdateStatsTitle" xml:space="preserve">
<value>Actualizando estadísticas de sets de ROMs</value>
</data>
<data name="NativeMenuPreferencesText" xml:space="preserve">
<value>_Preferencias</value>
</data>
<data name="NativeMenuQuitText" xml:space="preserve">
<value>_Salir</value>
</data>
</root>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
@@ -379,4 +380,10 @@ This will take a long time...</value>
<data name="RetrievingRomSetsFromDatabase" xml:space="preserve">
<value>Retrieving ROM sets from database...</value>
</data>
<data name="NativeMenuPreferencesText" xml:space="preserve">
<value>_Preferences</value>
</data>
<data name="NativeMenuQuitText" xml:space="preserve">
<value>_Quit</value>
</data>
</root>

View File

@@ -98,34 +98,7 @@ public sealed class AboutViewModel : ViewModelBase
void ExecuteWebsiteCommand()
{
var process = new Process
{
StartInfo =
{
UseShellExecute = false,
CreateNoWindow = true,
Arguments = "https://www.claunia.com"
}
};
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
process.StartInfo.FileName = "cmd";
process.StartInfo.Arguments = $"/c start {process.StartInfo.Arguments.Replace("&", "^&")}";
}
else if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
process.StartInfo.FileName = "xdg-open";
else if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
process.StartInfo.FileName = "open";
else
{
if(Debugger.IsAttached) throw new ArgumentOutOfRangeException();
return;
}
process.Start();
_ = _view.Launcher.LaunchUriAsync(new Uri("https://www.claunia.com"));
}
void ExecuteLicenseCommand()

View File

@@ -28,7 +28,7 @@ using Avalonia.Markup.Xaml;
namespace RomRepoMgr.Views;
public sealed class About : Window
public sealed partial class About : Window
{
public About() => InitializeComponent();

View File

@@ -28,7 +28,7 @@ using Avalonia.Markup.Xaml;
namespace RomRepoMgr.Views;
public sealed class EditDat : Window
public sealed partial class EditDat : Window
{
public EditDat() => InitializeComponent();

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class ExportDat : Window
public sealed partial class ExportDat : Window
{
public ExportDat() => InitializeComponent();

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class ExportRoms : Window
public sealed partial class ExportRoms : Window
{
public ExportRoms() => InitializeComponent();

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class ImportDat : Window
public sealed partial class ImportDat : Window
{
public ImportDat() => InitializeComponent();

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class ImportDatFolder : Window
public sealed partial class ImportDatFolder : Window
{
public ImportDatFolder() => InitializeComponent();

View File

@@ -28,7 +28,7 @@ using Avalonia.Markup.Xaml;
namespace RomRepoMgr.Views;
public sealed class ImportRomFolder : Window
public sealed partial class ImportRomFolder : Window
{
public ImportRomFolder() => InitializeComponent();

View File

@@ -29,7 +29,7 @@ using Avalonia.Markup.Xaml;
namespace RomRepoMgr.Views;
public class MainWindow : Window
public sealed partial class MainWindow : Window
{
public MainWindow()
{

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class RemoveDat : Window
public sealed partial class RemoveDat : Window
{
public RemoveDat() => InitializeComponent();

View File

@@ -28,7 +28,7 @@ using Avalonia.Markup.Xaml;
namespace RomRepoMgr.Views;
public sealed class SettingsDialog : Window
public sealed partial class SettingsDialog : Window
{
public SettingsDialog() => InitializeComponent();

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class SplashWindow : Window
public sealed partial class SplashWindow : Window
{
public SplashWindow() => InitializeComponent();

View File

@@ -30,7 +30,7 @@ using RomRepoMgr.ViewModels;
namespace RomRepoMgr.Views;
public sealed class UpdateStats : Window
public sealed partial class UpdateStats : Window
{
public UpdateStats() => InitializeComponent();

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AvaloniaCI" value="https://www.myget.org/F/avalonia-ci/api/v2"/>
</packageSources>
</configuration>