Krzysztof Krysiński 1 settimana fa
parent
commit
904a6a963e
1 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 11 3
      src/PixiEditor.Platform.Steam/SteamIdentityProvider.cs

+ 11 - 3
src/PixiEditor.Platform.Steam/SteamIdentityProvider.cs

@@ -12,6 +12,7 @@ public class SteamIdentityProvider : IIdentityProvider
     public IUser User { get; private set; }
     public bool IsLoggedIn { get; private set; }
     public Uri? EditProfileUrl { get; } = new Uri("https://store.steampowered.com/login/");
+
     public bool IsValid
     {
         get
@@ -40,7 +41,10 @@ public class SteamIdentityProvider : IIdentityProvider
         var ownedContent = GetOwnedDlcs();
         var user = new SteamUser()
         {
-            Username = username, AvatarUrl = avatar, Id = id.m_SteamID, IsLoggedIn = true,
+            Username = username,
+            AvatarUrl = avatar,
+            Id = id.m_SteamID,
+            IsLoggedIn = true,
             OwnedProducts = ownedContent,
         };
 
@@ -79,7 +83,8 @@ public class SteamIdentityProvider : IIdentityProvider
                 using SKBitmap bitmap = new SKBitmap((int)width, (int)height);
                 var allocated = GCHandle.Alloc(image, GCHandleType.Pinned);
                 var info = new SKImageInfo((int)width, (int)height, SKColorType.Rgba8888, SKAlphaType.Premul);
-                bitmap.InstallPixels(info, allocated.AddrOfPinnedObject(), bitmap.RowBytes, delegate { allocated.Free(); }, null);
+                bitmap.InstallPixels(info, allocated.AddrOfPinnedObject(), bitmap.RowBytes,
+                    delegate { allocated.Free(); }, null);
                 using FileStream stream = new FileStream(cache, FileMode.Create);
                 bitmap.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
             }
@@ -96,8 +101,11 @@ public class SteamIdentityProvider : IIdentityProvider
         for (int i = 0; i < dlcCount; i++)
         {
             bool success = SteamApps.BGetDLCDataByIndex(i, out AppId_t appId, out bool available, out string name, 128);
-            if (success && available)
+            if (success)
             {
+                bool owned = SteamApps.BIsDlcInstalled(appId);
+                if (!owned)
+                    continue;
                 ownedDlcs.Add(new ProductData(appId.m_AppId.ToString(), name));
             }
         }