Try to get DLC name if missing and not using SteamDB
This commit is contained in:
parent
1d69b7b45a
commit
8a4e601236
@ -111,31 +111,31 @@ namespace auto_creamapi.Services
|
|||||||
MyLogger.Log.Debug($"Type for Steam App {steamApp.Name}: \"{steamAppDetails.Type}\"");
|
MyLogger.Log.Debug($"Type for Steam App {steamApp.Name}: \"{steamAppDetails.Type}\"");
|
||||||
if (steamAppDetails.Type == "game" | steamAppDetails.Type == "demo")
|
if (steamAppDetails.Type == "game" | steamAppDetails.Type == "demo")
|
||||||
{
|
{
|
||||||
steamAppDetails?.DLC.ForEach(x =>
|
steamAppDetails.DLC.ForEach(x =>
|
||||||
{
|
{
|
||||||
var result = _cache.FirstOrDefault(y => y.AppId.Equals(x)) ??
|
var result = _cache.FirstOrDefault(y => y.AppId.Equals(x));
|
||||||
new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};
|
if (result == null)
|
||||||
|
{
|
||||||
|
var dlcDetails = AppDetails.GetAsync(x).Result;
|
||||||
|
result = dlcDetails != null
|
||||||
|
? new SteamApp { AppId = dlcDetails.SteamAppId, Name = dlcDetails.Name }
|
||||||
|
: new SteamApp { AppId = x, Name = $"Unknown DLC {x}" };
|
||||||
|
}
|
||||||
|
|
||||||
dlcList.Add(result);
|
dlcList.Add(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
||||||
MyLogger.Log.Information("Got DLC successfully...");
|
MyLogger.Log.Information("Got DLC successfully...");
|
||||||
|
|
||||||
|
if (!useSteamDb) return dlcList;
|
||||||
|
|
||||||
// Get DLC from SteamDB
|
// Get DLC from SteamDB
|
||||||
// Get Cloudflare cookie
|
// Get Cloudflare cookie
|
||||||
// Scrape and parse HTML page
|
// Scrape and parse HTML page
|
||||||
// Add missing to DLC list
|
// Add missing to DLC list
|
||||||
if (useSteamDb)
|
|
||||||
{
|
|
||||||
var steamDbUri = new Uri($"https://steamdb.info/app/{steamApp.AppId}/dlc/");
|
var steamDbUri = new Uri($"https://steamdb.info/app/{steamApp.AppId}/dlc/");
|
||||||
|
|
||||||
/* var handler = new ClearanceHandler();
|
|
||||||
|
|
||||||
var client = new HttpClient(handler);
|
|
||||||
|
|
||||||
var content = client.GetStringAsync(steamDbUri).Result;
|
|
||||||
MyLogger.Log.Debug(content); */
|
|
||||||
|
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
||||||
|
|
||||||
@ -182,7 +182,6 @@ namespace auto_creamapi.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
||||||
MyLogger.Log.Information("Got DLC from SteamDB successfully...");
|
MyLogger.Log.Information("Got DLC from SteamDB successfully...");
|
||||||
}
|
}
|
||||||
@ -191,7 +190,6 @@ namespace auto_creamapi.Services
|
|||||||
MyLogger.Log.Error("Could not get DLC from SteamDB!");
|
MyLogger.Log.Error("Could not get DLC from SteamDB!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MyLogger.Log.Error("Could not get DLC: Steam App is not of type: \"Game\"");
|
MyLogger.Log.Error("Could not get DLC: Steam App is not of type: \"Game\"");
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
xmlns:vm="clr-namespace:auto_creamapi.ViewModels"
|
xmlns:vm="clr-namespace:auto_creamapi.ViewModels"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
|
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
|
||||||
xmlns:converters="clr-namespace:auto_creamapi.Converters"
|
xmlns:converters="clr-namespace:auto_creamapi.Converters"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="720" d:DesignWidth="560">
|
||||||
<views:MvxWpfView.Resources>
|
<views:MvxWpfView.Resources>
|
||||||
<converters:ListOfDLcToStringNativeConverter x:Key="DlcConv" />
|
<converters:ListOfDLcToStringNativeConverter x:Key="DlcConv" />
|
||||||
</views:MvxWpfView.Resources>
|
</views:MvxWpfView.Resources>
|
||||||
@ -27,7 +28,7 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<wcl:WatermarkTextBox Text="{Binding DllPath}" Watermark="Path to game's steam_api(64).dll..."
|
<wcl:WatermarkTextBox Text="{Binding DllPath}" Watermark="Path to game's steam_api(64).dll..."
|
||||||
Margin="10,11,55,0" TextWrapping="NoWrap" VerticalAlignment="Top" Padding="0"
|
Margin="10,10,55,0" TextWrapping="NoWrap" VerticalAlignment="Top" Padding="0"
|
||||||
Grid.Row="0" IsReadOnly="True" IsReadOnlyCaretVisible="True">
|
Grid.Row="0" IsReadOnly="True" IsReadOnlyCaretVisible="True">
|
||||||
<!--MouseDoubleClick="{Binding Path=OpenFileCommand}"-->
|
<!--MouseDoubleClick="{Binding Path=OpenFileCommand}"-->
|
||||||
<wcl:WatermarkTextBox.InputBindings>
|
<wcl:WatermarkTextBox.InputBindings>
|
||||||
@ -95,7 +96,7 @@
|
|||||||
Text="{Binding Dlcs, Converter={StaticResource DlcConv}, Mode=TwoWay}"
|
Text="{Binding Dlcs, Converter={StaticResource DlcConv}, Mode=TwoWay}"
|
||||||
Margin="10,10,10,0" Watermark="List of DLCs...
0000 = DLC Name"
|
Margin="10,10,10,0" Watermark="List of DLCs...
0000 = DLC Name"
|
||||||
TextWrapping="Wrap" AcceptsReturn="True"
|
TextWrapping="Wrap" AcceptsReturn="True"
|
||||||
VerticalScrollBarVisibility="Visible" Padding="0"
|
VerticalScrollBarVisibility="Visible" Padding="5,5,5,5"
|
||||||
FontFamily="../resources/#Courier Prime" Grid.Row="3" />
|
FontFamily="../resources/#Courier Prime" Grid.Row="3" />
|
||||||
<Button Content="Get DLCs for AppID" Margin="0,10,10,10" Height="19.96" HorizontalAlignment="Right"
|
<Button Content="Get DLCs for AppID" Margin="0,10,10,10" Height="19.96" HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom" Width="108" Command="{Binding GetListOfDlcCommand}" Grid.Row="4" />
|
VerticalAlignment="Bottom" Width="108" Command="{Binding GetListOfDlcCommand}" Grid.Row="4" />
|
||||||
|
Loading…
Reference in New Issue
Block a user