Skip to content

Commit

Permalink
fix some metadata stored by the ruleset identity manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Flutterish committed Dec 29, 2021
1 parent e7b20fe commit 0ffbc38
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions osu.Game.Rulesets.RurusettoAddon/API/RulesetIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ public async Task<RulesetDetail> RequestDetail () {
return null; // TODO report failure
}
}

public override string ToString ()
=> $"{Name}";
}

public enum Source {
Expand Down
28 changes: 22 additions & 6 deletions osu.Game.Rulesets.RurusettoAddon/RulesetIdentityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ private async Task<IEnumerable<RulesetIdentity>> requestIdentities () {
API = API,
Name = entry.Name,
Slug = entry.Slug,
ListingEntry = entry
ListingEntry = entry,
IsModifiable = true
} );

var filename = Path.GetFileName( entry.Download );
Expand Down Expand Up @@ -111,29 +112,44 @@ private async Task<IEnumerable<RulesetIdentity>> requestIdentities () {

if ( storage != null ) {
foreach ( var path in storage.GetFiles( "./rulesets", "osu.Game.Rulesets.*.dll" ) ) {
if ( !localPaths.ContainsKey( storage.GetFullPath( path ) ) ) {
if ( localPaths.TryGetValue( storage.GetFullPath( path ), out var id ) ) {
// we already know its there then
}
else if ( webFilenames.TryGetValue( Path.GetFileName( path ), out id ) ) {
id.IsPresentLocally = true;
id.IsModifiable = true;
id.LocalPath = storage.GetFullPath( path );
id.HasImportFailed = true;
}
else {
identities.Add( new() {
Source = Source.Local,
API = API,
Name = Path.GetFileName( path ).Split( '.' ).SkipLast( 1 ).Last(),
IsPresentLocally = true,
HasImportFailed = true,
LocalPath = storage.GetFullPath( path )
LocalPath = storage.GetFullPath( path ),
IsModifiable = true
} );
}
}
}
}
else if ( storage != null ) {
foreach ( var path in storage.GetFiles( "./rulesets", "osu.Game.Rulesets.*.dll" ) ) {
if ( !webFilenames.ContainsKey( Path.GetFileName( path ) ) ) {
if ( webFilenames.TryGetValue( Path.GetFileName( path ), out var id ) ) {
id.IsPresentLocally = true;
id.LocalPath = storage.GetFullPath( path );
id.IsModifiable = true;
}
else {
identities.Add( new() {
Source = Source.Local,
API = API,
Name = Path.GetFileName( path ).Split( '.' ).SkipLast( 1 ).Last(),
IsPresentLocally = true,
IsModifiable = true,
LocalPath = storage.GetFullPath( path )
LocalPath = storage.GetFullPath( path ),
IsModifiable = true
} );
}
}
Expand Down

0 comments on commit 0ffbc38

Please sign in to comment.