OpenSimTools / AMS2CM

Automobilista 2 Content Manager
https://www.racedepartment.com/downloads/automobilista-2-content-manager.59727/
MIT License
36 stars 3 forks source link

Sequence contains more than one matching element #118

Open paoloambrosio opened 6 months ago

paoloambrosio commented 6 months ago

[!IMPORTANT] When removing a library (storage folder) from the Steam UI, it is not removed from steamapps\libraryfolder.vdf. Until we understand how Steam determines if a library is active or not, and where that information is stored, there is nothing that can be done to fix this.

On startup, CM display this error:

Sequence contains more than one matching element
   at AMS2CM.GUI.App.ThrowingModManager.FetchState() in D:\a\AMS2CM\AMS2CM\src\GUI\App.xaml.cs:line 72
   at AMS2CM.GUI.MainWindow.SyncModListView() in D:\a\AMS2CM\AMS2CM\src\GUI\MainWindow.xaml.cs:line 74
   at AMS2CM.GUI.MainWindow.Root_Loaded(Object sender, RoutedEventArgs e) in D:\a\AMS2CM\AMS2CM\src\GUI\MainWindow.xaml.cs:line 31
   at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler.EventState.<GetEventInvoke>b__1_0(Object sender, RoutedEventArgs e)
   at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)

Steps to reproduce the issue:

Reason for the error is that steamapps\libraryfolder.vdf still contains the old location despite it having been removed!

"libraryfolders"
{
    "0"
    {
        "path"      "C:\\Program Files (x86)\\Steam"
        "label"     ""
        "contentid"     "8836340582293123977"
        "totalsize"     "0"
        "update_clean_bytes_tally"      "465057161"
        "time_last_update_corruption"       "0"
        "apps"
        {
            "228980"        "159585466"
        }
    }
    "1"
    {
        "path"      "X:\\SteamLibrary"
        "label"     ""
        "contentid"     "1667562575883360818"
        "totalsize"     "470599856128"
        "update_clean_bytes_tally"      "41364098416"
        "time_last_update_corruption"       "1701430242"
        "apps"
        {
            "1066890"       "123720443666"
        }
    }
    "2"
    {
        "path"      "X:\\Games\\SteamLibrary"
        "label"     ""
        "contentid"     "1667562575883360818"
        "totalsize"     "470599856128"
        "update_clean_bytes_tally"      "43860647"
        "time_last_update_corruption"       "0"
        "apps"
        {
            "1066890"       "123720443666"
        }
    }
}

Workarounds: