Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
YuCat-OVO committed Mar 13, 2024
2 parents 565135a + dee1b60 commit a2d5844
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 30 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/dotnet-ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
name: .NET CI

on:
workflow_dispatch:
push:
branches: [ master ]
branches: [master, dev]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:
runs-on: windows-latest

env:
SOLUTION: src/Playnite.Extensions.sln

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

# required for LangVersion 10
- name: Setup .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Clear local NuGet cache (workaround for failed restores on windows-latest)
run: dotnet clean $env:SOLUTION && dotnet nuget locals all --clear
- name: Restore dependencies
run: dotnet restore $env:SOLUTION
- name: Build
run: dotnet build $env:SOLUTION --no-restore
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

# required for LangVersion 10
- name: Setup .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Clear local NuGet cache (workaround for failed restores on windows-latest)
run: dotnet clean $env:SOLUTION && dotnet nuget locals all --clear

- name: Restore dependencies
run: dotnet restore $env:SOLUTION

- name: Build
run: dotnet build $env:SOLUTION --no-restore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Mono auto generated files
mono_crash.*
.mono/

# Build results
[Dd]ebug/
Expand Down
20 changes: 17 additions & 3 deletions src/GameManagement/GameManagementPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -115,9 +115,9 @@ private List<Game> UninstallGames(GameMenuItemActionArgs args)
_logger.LogDebug("Removing {Directory}", game.InstallDirectory);
Directory.Delete(game.InstallDirectory, true);
}
catch (IOException)
catch (IOException ex)
{
_logger.LogError("The directory {Directory} could not be deleted.", game.InstallDirectory);
_logger.LogError("The directory {Directory} could not be deleted. {ex}", game.InstallDirectory, ex);
}
game.IsInstalled = false;
actuallyUninstalledGames.Add(game);
Expand Down Expand Up @@ -178,4 +178,18 @@ public override IEnumerable<SidebarItem> GetSidebarItems()
Visible = true,
};
}

public override IEnumerable<MainMenuItem> GetMainMenuItems(GetMainMenuItemsArgs args)
{
yield return new MainMenuItem
{
Description = "Remove unknown games.",
Action = (_) => RemoveUnknownGamesAction(),
};
}
private void RemoveUnknownGamesAction()
{
return;
}

}
10 changes: 5 additions & 5 deletions src/GameManagement/StorageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace GameManagement;
public class StorageInfo
{
private readonly IPlayniteAPI _playniteAPI;

public List<GameStorage> Games { get; set; } = new();

public string TotalSize => $"Total Size: {Games.Sum(x => x.SizeOnDisk).ToFileSizeString()}";
Expand Down Expand Up @@ -63,6 +62,7 @@ private static long GetDirectorySize(string path)

private static bool GameHasInstallDirectory(Game game)
{
Console.WriteLine("Checking {Directory}", game.InstallDirectory);
return !string.IsNullOrWhiteSpace(game.InstallDirectory) && Directory.Exists(game.InstallDirectory);
}

Expand All @@ -72,9 +72,9 @@ public void UpdateStorageInfoForAllNewGames()
.Where(dbGame => !Games.Any(savedGame => savedGame.GameId.Equals(dbGame.Id)))
.Where(GameHasInstallDirectory)
.Select(x => new TempStorage(x, new GameStorage(_playniteAPI)
{
GameId = x.Id
})).ToArray();
{
GameId = x.Id
})).ToArray();

ParallelHelper.ForEach<TempStorage, CalculateStorageStruct>(games);

Expand Down Expand Up @@ -130,5 +130,5 @@ public GameStorage(IPlayniteAPI playniteAPI)

[DontSerialize] public string FileSizeString => SizeOnDisk.ToFileSizeString();

[DontSerialize] public string GameName => PlayniteAPI?.Database.Games.First(x => x.Id.Equals(GameId)).Name ?? string.Empty;
[DontSerialize] public string GameName => PlayniteAPI?.Database.Games.First(x => x.Id.Equals(GameId)).Name ?? "Unknown Game";
}

0 comments on commit a2d5844

Please sign in to comment.