mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
[Refactor] Use collection expression.
This commit is contained in:
@@ -25,9 +25,9 @@ public sealed class Fuse : FileSystem
|
|||||||
|
|
||||||
public Fuse(Vfs vfs)
|
public Fuse(Vfs vfs)
|
||||||
{
|
{
|
||||||
_directoryCache = new ConcurrentDictionary<long, List<DirectoryEntry>>();
|
_directoryCache = [];
|
||||||
_lastHandle = 0;
|
_lastHandle = 0;
|
||||||
_fileStatHandleCache = new ConcurrentDictionary<long, Stat>();
|
_fileStatHandleCache = [];
|
||||||
Name = "romrepomgrfs";
|
Name = "romrepomgrfs";
|
||||||
_vfs = vfs;
|
_vfs = vfs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class Vfs : IDisposable
|
|||||||
|
|
||||||
if(cachedMachines != null) return cachedMachines;
|
if(cachedMachines != null) return cachedMachines;
|
||||||
|
|
||||||
cachedMachines = new ConcurrentDictionary<string, CachedMachine>();
|
cachedMachines = [];
|
||||||
|
|
||||||
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
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);
|
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)
|
foreach(FileByMachine machineFile in ctx.FilesByMachines.Where(fbm => fbm.Machine.Id == id && fbm.File.IsInRepo)
|
||||||
.Include(fileByMachine => fileByMachine.File))
|
.Include(fileByMachine => fileByMachine.File))
|
||||||
@@ -269,7 +269,7 @@ public class Vfs : IDisposable
|
|||||||
|
|
||||||
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
||||||
|
|
||||||
cachedMachineDisks = new ConcurrentDictionary<string, CachedDisk>();
|
cachedMachineDisks = [];
|
||||||
|
|
||||||
foreach(DiskByMachine machineDisk in ctx.DisksByMachines
|
foreach(DiskByMachine machineDisk in ctx.DisksByMachines
|
||||||
.Where(dbm => dbm.Machine.Id == id &&
|
.Where(dbm => dbm.Machine.Id == id &&
|
||||||
@@ -303,7 +303,7 @@ public class Vfs : IDisposable
|
|||||||
|
|
||||||
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
||||||
|
|
||||||
cachedMachineMedias = new ConcurrentDictionary<string, CachedMedia>();
|
cachedMachineMedias = [];
|
||||||
|
|
||||||
foreach(MediaByMachine machineMedia in ctx.MediasByMachines
|
foreach(MediaByMachine machineMedia in ctx.MediasByMachines
|
||||||
.Where(mbm => mbm.Machine.Id == id &&
|
.Where(mbm => mbm.Machine.Id == id &&
|
||||||
|
|||||||
@@ -514,35 +514,35 @@ public sealed class DatImporter
|
|||||||
? ctx.Disks
|
? ctx.Disks
|
||||||
.FromSqlRaw($"SELECT DISTINCT f.* FROM Disks AS f, [{tmpDiskMd5Table}] AS t WHERE f.Md5 = t.Md5")
|
.FromSqlRaw($"SELECT DISTINCT f.* FROM Disks AS f, [{tmpDiskMd5Table}] AS t WHERE f.Md5 = t.Md5")
|
||||||
.ToDictionary(f => f.Md5)
|
.ToDictionary(f => f.Md5)
|
||||||
: new Dictionary<string, DbDisk>();
|
: [];
|
||||||
|
|
||||||
Dictionary<string, DbDisk> pendingDisksBySha1 =
|
Dictionary<string, DbDisk> pendingDisksBySha1 =
|
||||||
disksHaveSha1
|
disksHaveSha1
|
||||||
? ctx.Disks
|
? ctx.Disks
|
||||||
.FromSqlRaw($"SELECT DISTINCT f.* FROM Disks AS f, [{tmpDiskSha1Table}] AS t WHERE f.Sha1 = t.Sha1")
|
.FromSqlRaw($"SELECT DISTINCT f.* FROM Disks AS f, [{tmpDiskSha1Table}] AS t WHERE f.Sha1 = t.Sha1")
|
||||||
.ToDictionary(f => f.Sha1)
|
.ToDictionary(f => f.Sha1)
|
||||||
: new Dictionary<string, DbDisk>();
|
: [];
|
||||||
|
|
||||||
Dictionary<string, DbMedia> pendingMediasByMd5 =
|
Dictionary<string, DbMedia> pendingMediasByMd5 =
|
||||||
mediasHaveMd5
|
mediasHaveMd5
|
||||||
? ctx.Medias
|
? ctx.Medias
|
||||||
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaMd5Table}] AS t WHERE f.Md5 = t.Md5")
|
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaMd5Table}] AS t WHERE f.Md5 = t.Md5")
|
||||||
.ToDictionary(f => f.Md5)
|
.ToDictionary(f => f.Md5)
|
||||||
: new Dictionary<string, DbMedia>();
|
: [];
|
||||||
|
|
||||||
Dictionary<string, DbMedia> pendingMediasBySha1 =
|
Dictionary<string, DbMedia> pendingMediasBySha1 =
|
||||||
mediasHaveSha1
|
mediasHaveSha1
|
||||||
? ctx.Medias
|
? ctx.Medias
|
||||||
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaSha1Table}] AS t WHERE f.Sha1 = t.Sha1")
|
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaSha1Table}] AS t WHERE f.Sha1 = t.Sha1")
|
||||||
.ToDictionary(f => f.Sha1)
|
.ToDictionary(f => f.Sha1)
|
||||||
: new Dictionary<string, DbMedia>();
|
: [];
|
||||||
|
|
||||||
Dictionary<string, DbMedia> pendingMediasBySha256 =
|
Dictionary<string, DbMedia> pendingMediasBySha256 =
|
||||||
mediasHaveSha256
|
mediasHaveSha256
|
||||||
? ctx.Medias
|
? ctx.Medias
|
||||||
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaSha256Table}] AS t WHERE f.Sha256 = t.Sha256")
|
.FromSqlRaw($"SELECT DISTINCT f.* FROM Medias AS f, [{tmpMediaSha256Table}] AS t WHERE f.Sha256 = t.Sha256")
|
||||||
.ToDictionary(f => f.Sha256)
|
.ToDictionary(f => f.Sha256)
|
||||||
: new Dictionary<string, DbMedia>();
|
: [];
|
||||||
|
|
||||||
var pendingFilesByCrc = new Dictionary<string, DbFile>();
|
var pendingFilesByCrc = new Dictionary<string, DbFile>();
|
||||||
var pendingFilesByMd5 = new Dictionary<string, DbFile>();
|
var pendingFilesByMd5 = new Dictionary<string, DbFile>();
|
||||||
|
|||||||
Reference in New Issue
Block a user