Skip to content

Commit 324e7c6

Browse files
committed
Create Steam Screenshots extension
1 parent e8bd1ed commit 324e7c6

28 files changed

+1105
-15
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AddonId: SteamScreenshots_8e77fe31-5e62-41e2-8fa2-64844cfd5b6b
2+
Packages:
1.32 MB
Loading
42.2 KB
Loading

source/Metadata/VNDBNexus/Converters/ConvertersUtilities.cs renamed to source/Common/PluginsCommon/Converters/ConvertersUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Threading.Tasks;
88
using System.Windows.Media.Imaging;
99

10-
namespace VNDBNexus.Converters
10+
namespace PluginsCommon.Converters
1111
{
1212
public static class ConvertersUtilities
1313
{

source/Metadata/VNDBNexus/Converters/ImageUriToBitmapImageConverter.cs renamed to source/Common/PluginsCommon/Converters/ImageUriToBitmapImageConverter.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111
using System.Windows.Media.Imaging;
1212
using TemporaryCache;
1313

14-
namespace VNDBNexus.Converters
14+
namespace PluginsCommon.Converters
1515
{
1616
public class ImageUriToBitmapImageConverter : IValueConverter
1717
{
1818
private readonly string _storageDirectory;
19+
private readonly bool _useLocalPathForFilenames;
1920
private static readonly CacheManager<string, BitmapImage> _imagesCacheManager = new CacheManager<string, BitmapImage>(TimeSpan.FromSeconds(60));
2021

21-
public ImageUriToBitmapImageConverter(string storageDirectory)
22+
public ImageUriToBitmapImageConverter(string storageDirectory, bool useLocalPathForFilenames = false)
2223
{
2324
_storageDirectory = storageDirectory;
25+
_useLocalPathForFilenames = useLocalPathForFilenames;
2426
}
2527

2628
public async Task<bool> DownloadUriToStorageAsync(Uri uri)
@@ -54,14 +56,21 @@ private string GetUriStorageLocation(Uri uri)
5456
return GetFilenameStorageLocation(fileName);
5557
}
5658

57-
private string GetFilenameStorageLocation(string fileName)
59+
private string GetUriStorageFilename(Uri uri)
5860
{
59-
return Path.Combine(_storageDirectory, Paths.GetSafePathName(fileName));
61+
if (_useLocalPathForFilenames)
62+
{
63+
return Paths.ReplaceInvalidCharacters(Path.GetFileName(uri.LocalPath));
64+
}
65+
else
66+
{
67+
return Paths.ReplaceInvalidCharacters(uri.ToString().Replace(@"https://", string.Empty));
68+
}
6069
}
6170

62-
private string GetUriStorageFilename(Uri uri)
71+
private string GetFilenameStorageLocation(string fileName)
6372
{
64-
return Paths.ReplaceInvalidCharacters(uri.ToString().Replace(@"https://", string.Empty));
73+
return Path.Combine(_storageDirectory, Paths.GetSafePathName(fileName));
6574
}
6675

6776
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

source/Common/PluginsCommon/PluginsCommon.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@
5252
<ItemGroup>
5353
<Compile Include="BindingTools.cs" />
5454
<Compile Include="Converters\BooleanToOpacityConverter.cs" />
55+
<Compile Include="Converters\ConvertersUtilities.cs" />
5556
<Compile Include="Converters\EnumerableStringJoinConverter.cs" />
5657
<Compile Include="Converters\EnumToListConverter.cs" />
5758
<Compile Include="Converters\EnumToStringConverter.cs" />
59+
<Compile Include="Converters\ImageUriToBitmapImageConverter.cs" />
5860
<Compile Include="Converters\InvertedEnumValueToVisibilityConverter.cs" />
5961
<Compile Include="Converters\EnumValueToVisibilityConverter.cs" />
6062
<Compile Include="Converters\EqualityToVisibilityConverter.cs" />

source/Common/SteamCommon/Models/SteamAppDetailsResponse.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ public class Metacritic
6666

6767
public class Screenshot
6868
{
69-
public int id;
70-
public string path_thumbnail;
71-
public string path_full;
69+
[SerializationPropertyName("id")]
70+
public int Id { get; set; }
71+
[SerializationPropertyName("path_thumbnail")]
72+
public Uri PathThumbnail { get; set; }
73+
[SerializationPropertyName("path_full")]
74+
public Uri PathFull { get; set; }
7275
}
7376

7477
public class Movie
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
4+
<Application.Resources>
5+
<ResourceDictionary>
6+
<Style x:Key="BaseTextBlockStyle" TargetType="TextBlock" />
7+
<ResourceDictionary.MergedDictionaries>
8+
<ResourceDictionary Source="Localization/en_US.xaml" />
9+
</ResourceDictionary.MergedDictionaries>
10+
</ResourceDictionary>
11+
</Application.Resources>
12+
</Application>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:sys="clr-namespace:System;assembly=mscorlib">
4+
<sys:String x:Key="LOC_SteamScreenshots_ScreenshotsLabel">Screenshots</sys:String>
5+
<sys:String x:Key="LOC_SteamScreenshots_SteamScreenshotsLabel">Steam screenshots</sys:String>
6+
<sys:String x:Key="LOC_SteamScreenshots_SelectedScreenshotPositionFormat">{0} of {1}</sys:String>
7+
<sys:String x:Key="LOC_SteamScreenshots_MoveBackLabel">Back</sys:String>
8+
<sys:String x:Key="LOC_SteamScreenshots_MoveNextLabel">Next</sys:String>
9+
</ResourceDictionary>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("SteamScreenshots")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("SteamScreenshots")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("8e77fe31-5e62-41e2-8fa2-64844cfd5b6b")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)