mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 16:27:21 +08:00
Simplify file storing
This commit is contained in:
parent
31dc5c97f2
commit
0df474accb
@ -65,10 +65,6 @@ namespace osu.Game.IO
|
||||
data.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
if (existing == null)
|
||||
// SaveChanges is performed in Reference.
|
||||
Connection.FileInfo.Add(info);
|
||||
|
||||
if (reference || existing == null)
|
||||
Reference(info);
|
||||
|
||||
@ -79,9 +75,9 @@ namespace osu.Game.IO
|
||||
{
|
||||
foreach (var f in files.GroupBy(f => f.ID))
|
||||
{
|
||||
var refetch = Connection.Find<FileInfo>(f.First().ID);
|
||||
var refetch = Connection.Find<FileInfo>(f.First().ID) ?? f.First();
|
||||
refetch.ReferenceCount += f.Count();
|
||||
Connection.Update(refetch);
|
||||
Connection.FileInfo.Update(refetch);
|
||||
}
|
||||
|
||||
Connection.SaveChanges();
|
||||
|
Loading…
x
Reference in New Issue
Block a user