Skip to content

Commit 366b74f

Browse files
authored
v1.3.0 (#3)
* Added new icon * Added new icon * Updated version * Added style to context menu, fixing bug * New filter window * Added export window * Full changelog on released section. * Fixed null exception when load old config file. * Updated resources * Fix textbox readonly issue.
1 parent 37db82a commit 366b74f

28 files changed

Lines changed: 1072 additions & 110 deletions

App.xaml

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@
4646
</Style>
4747

4848
<Image x:Key="SettingIcon" Source="/TMP.NET;component/Resources/setting_icon.png" Width="40" Height="40" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
49-
<Image x:Key="WrenchIcon" Source="/TMP.NET;component/Resources/wrench_icon.png" Width="18" Height="18" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
49+
<Image x:Key="WrenchIcon" Source="/TMP.NET;component/Resources/wrench_icon.png" Width="16" Height="16" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
5050
<Image x:Key="SaveIcon" Source="/TMP.NET;component/Resources/save_icon.png" Width="20" Height="20" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
5151
<Image x:Key="XIcon" Source="/TMP.NET;component/Resources/x_icon.png" Width="18" Height="18" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
5252
<Image x:Key="TrashIcon" Source="/TMP.NET;component/Resources/trash_icon.png" Width="28" Height="28" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
53-
<Image x:Key="ShortcutIcon" Source="/TMP.NET;component/Resources/shortcut-logo.png" Width="28" Height="28" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
53+
<Image x:Key="ShortcutIcon" Source="/TMP.NET;component/Resources/shortcut-logo.png" Width="24" Height="24" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
5454
<Image x:Key="ImportIcon" Source="/TMP.NET;component/Resources/import_icon.png" Width="15" Height="15" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
5555
<Image x:Key="DeleteImage" Source="/TMP.NET;component/Resources/delete_image_icon.png" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
56+
<Image x:Key="ExportIcon" Source="/TMP.NET;component/Resources/export_icon.png" Width="15" Height="15" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
57+
<Image x:Key="FilterIcon" Source="/TMP.NET;component/Resources/filter_icon.png" HorizontalAlignment="Left" Height="13" VerticalAlignment="Top" Width="21" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
58+
<Image x:Key="FolderOpenIcon" Source="/TMP.NET;component/Resources/folder_open_icon.png" HorizontalAlignment="Left" Height="18" VerticalAlignment="Top" Width="18" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased"/>
5659

5760
<FontFamily x:Key="GlobalFont"> pack://application:,,,/Fonts/#Rubik </FontFamily>
5861

@@ -70,12 +73,78 @@
7073
<Trigger Property="IsMouseOver"
7174
Value="True">
7275
<Setter Property="Background"
73-
Value="White"/>
76+
Value="Transparent"/>
7477
</Trigger>
7578
</ControlTemplate.Triggers>
7679
</ControlTemplate>
7780
</Setter.Value>
7881
</Setter>
7982
</Style>
83+
84+
<Style x:Key="{x:Type ContextMenu}" TargetType="{x:Type ContextMenu}">
85+
<Setter Property="Foreground" Value="White"/>
86+
<Setter Property="OverridesDefaultStyle" Value="True"/>
87+
<Setter Property="SnapsToDevicePixels" Value="True"/>
88+
<Setter Property="FontFamily" Value="{StaticResource GlobalFont}"/>
89+
<Setter Property="FontSize" Value="12"/>
90+
<Setter Property="Template">
91+
<Setter.Value>
92+
<ControlTemplate TargetType="{x:Type ContextMenu}">
93+
<Border Background="#0D1430" CornerRadius="7, 7, 8, 8" BorderBrush="#1B4772" BorderThickness="2" Opacity="1">
94+
<StackPanel ClipToBounds="True" Orientation="Vertical" IsItemsHost="True" Margin="5,4,5,4"/>
95+
</Border>
96+
</ControlTemplate>
97+
</Setter.Value>
98+
</Setter>
99+
</Style>
100+
<ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
101+
<Border Name="Border" >
102+
<Grid>
103+
<ContentPresenter Margin="6,3,6,3" ContentSource="Header" RecognizesAccessKey="True" />
104+
</Grid>
105+
</Border>
106+
</ControlTemplate>
107+
108+
<Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}">
109+
<Setter Property="Background" Value="#0D1430"/>
110+
<Setter Property="Foreground" Value="White"/>
111+
<Setter Property="FontFamily" Value="{StaticResource GlobalFont}"/>
112+
<Setter Property="Template">
113+
<Setter.Value>
114+
<ControlTemplate TargetType="ToolTip">
115+
<Border Background="{TemplateBinding Background}"
116+
BorderBrush="#1B4772"
117+
BorderThickness="1"
118+
CornerRadius="5"
119+
Margin="4">
120+
<ContentPresenter Margin="8"
121+
HorizontalAlignment="Left"
122+
VerticalAlignment="Top"
123+
TextBlock.Foreground="{TemplateBinding Foreground}"
124+
TextBlock.TextAlignment="Left"/>
125+
</Border>
126+
</ControlTemplate>
127+
</Setter.Value>
128+
</Setter>
129+
</Style>
130+
131+
<Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
132+
<Setter Property="ContextMenu">
133+
<Setter.Value>
134+
<ContextMenu Style="{StaticResource {x:Type ContextMenu}}">
135+
<MenuItem Command="ApplicationCommands.Copy" />
136+
<MenuItem Command="ApplicationCommands.Cut" />
137+
<Separator/>
138+
<MenuItem Command="ApplicationCommands.Paste" />
139+
</ContextMenu>
140+
</Setter.Value>
141+
</Setter>
142+
143+
<Style.Resources>
144+
<Style TargetType="{x:Type Border}">
145+
<Setter Property="CornerRadius" Value="3" />
146+
</Style>
147+
</Style.Resources>
148+
</Style>
80149
</Application.Resources>
81150
</Application>

App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public App() : base()
4444

4545
void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
4646
{
47-
TMP.NET.MainWindow.log.Warn("Checking update failed", e.Exception);
47+
TMP.NET.MainWindow.log.Fatal("PROGRAM CRASH", e.Exception);
4848
MessageBox.Show("Unhandled exception occurred: \n" + e.Exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
4949
}
5050

Modules/CaptureHandler.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace TMP.NET.Modules
88
{
9+
/// <summary>
10+
/// Class for handling ScreenCapture process.
11+
/// </summary>
912
internal class CaptureHandler
1013
{
1114

@@ -30,6 +33,11 @@ public struct RECT
3033
public int Bottom;
3134
}
3235

36+
/// <summary>
37+
/// Take ScreenCapture from <paramref name="process"/>.
38+
/// </summary>
39+
/// <param name="process"></param>
40+
/// <returns><see cref="Bitmap"/> from captured <paramref name="process"/>.</returns>
3341
public static Bitmap TakeScreenshot(Process process)
3442
{
3543
IntPtr handle = process.MainWindowHandle;
@@ -52,6 +60,11 @@ public static Bitmap TakeScreenshot(Process process)
5260
return screenshot;
5361
}
5462

63+
/// <summary>
64+
/// Check if process window is focused or not.
65+
/// </summary>
66+
/// <param name="proc"></param>
67+
/// <returns> <see langword="True"/> if window is focused, otherwise is <see langword="False"/>.</returns>
5568
public static bool IsWindowFocused(Process proc)
5669
{
5770
IntPtr foregroundWindow = GetForegroundWindow();

Modules/Config.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace TMP.NET.Modules
44
{
5+
/// <summary>
6+
/// Stores information for other technical settings and configurations
7+
/// </summary>
58
[Serializable]
69
public class Config
710
{
@@ -10,6 +13,8 @@ public class Config
1013
private int _TextractorDelay = 3000;
1114
private bool _EnabledRichPresence = true;
1215
private bool _AutoCheckUpdate = true;
16+
private bool _EnabledScreenshot = true;
17+
private FilterConfig _FilterConfig = new FilterConfig();
1318
public string x86Directory { get; set; }
1419
public string x64Directory { get; set; }
1520
public bool DisableTextractor { get { return _DisableTextractor; } set { _DisableTextractor = value; } }
@@ -23,5 +28,18 @@ public class Config
2328
public double Left { get; set; }
2429
public bool Maximized { get; set; }
2530
public bool AutoCheckUpdate { get { return _AutoCheckUpdate; } set { _AutoCheckUpdate = value; } }
31+
public bool EnabledScreenshot { get { return _EnabledScreenshot; } set { _EnabledScreenshot = value; } }
32+
public bool UncompressedArtwork { get; set; }
33+
public FilterConfig filterConfig { get { return _FilterConfig; } set { _FilterConfig = value; } }
34+
/// <summary>
35+
/// Stores information for filter and sort settings in the library view
36+
/// </summary>
37+
public class FilterConfig
38+
{
39+
private int _FilterIndex = 0;
40+
private int _SortIndex = 0;
41+
public int FilterIndex { get { return _FilterIndex; } set { _FilterIndex = value; } }
42+
public int SortIndex { get { return _SortIndex;} set { _SortIndex = value; } }
43+
}
2644
}
2745
}

Modules/FilterController.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.Collections.ObjectModel;
3+
using System.Linq;
4+
using System.Windows.Controls;
5+
using System.Windows.Data;
6+
7+
namespace TMP.NET.Modules
8+
{
9+
/// <summary>
10+
/// Controlling ListView sort filter
11+
/// </summary>
12+
internal class FilterController
13+
{
14+
private Config.FilterConfig filterSetting;
15+
private ObservableCollection<GameList> i_List = new ObservableCollection<GameList>();
16+
private ListView LV_List;
17+
18+
/// <summary>
19+
/// Constructor
20+
/// </summary>
21+
/// <param name="filterConfig"></param>
22+
/// <param name="i_List"></param>
23+
/// <param name="LV_List"></param>
24+
public FilterController(Config.FilterConfig filterConfig, ObservableCollection<GameList> i_List, ListView LV_List)
25+
{
26+
this.filterSetting = filterConfig;
27+
this.i_List = i_List;
28+
this.LV_List = LV_List;
29+
}
30+
31+
public void FilterControl()
32+
{
33+
try
34+
{
35+
if (filterSetting.SortIndex == 0)
36+
{
37+
switch (filterSetting.FilterIndex)
38+
{
39+
case 0:
40+
i_List = new ObservableCollection<GameList>(i_List.OrderBy(item => item.GameName));
41+
break;
42+
case 1:
43+
i_List = new ObservableCollection<GameList>(i_List.OrderBy(item => item.Playtime));
44+
break;
45+
default:
46+
i_List = new ObservableCollection<GameList>(i_List.OrderByDescending(item => item.Tracker));
47+
break;
48+
}
49+
}
50+
else
51+
{
52+
switch (filterSetting.FilterIndex)
53+
{
54+
case 0:
55+
i_List = new ObservableCollection<GameList>(i_List.OrderByDescending(item => item.GameName));
56+
break;
57+
case 1:
58+
i_List = new ObservableCollection<GameList>(i_List.OrderByDescending(item => item.Playtime));
59+
break;
60+
default:
61+
i_List = new ObservableCollection<GameList>(i_List.OrderBy(item => item.Tracker));
62+
break;
63+
}
64+
}
65+
}
66+
catch(Exception ex)
67+
{
68+
Console.WriteLine(ex.Message);
69+
}
70+
71+
// Refresh ListView
72+
LV_List.ItemsSource = i_List;
73+
CollectionViewSource.GetDefaultView(i_List).Refresh();
74+
}
75+
}
76+
}

Modules/GameList.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace TMP.NET.Modules
99
{
10+
/// <summary>
11+
/// Stores all information on games that have been added to the library
12+
/// </summary>
1013
[Serializable]
1114
public class GameList
1215
{
@@ -16,6 +19,11 @@ public class GameList
1619
public ImageSource IconPath { get { return IconPathMethod(); } }
1720

1821
#region Method
22+
/// <summary>
23+
/// Convert image icon to base-64 string
24+
/// </summary>
25+
/// <param name="imageSource"></param>
26+
/// <returns>Base64String of the icon image</returns>
1927
public string IconToBase64String(ImageSource imageSource)
2028
{
2129
var bitmapSource = (BitmapSource)imageSource;
@@ -29,7 +37,11 @@ public string IconToBase64String(ImageSource imageSource)
2937
return Convert.ToBase64String(memoryStream.ToArray());
3038
}
3139
}
32-
40+
/// <summary>
41+
/// Extract icon from executable file
42+
/// </summary>
43+
/// <param name="GamePath"></param>
44+
/// <returns>ImageSource of the icon of an executable file</returns>
3345
public ImageSource ExtractIconFromExe(string GamePath)
3446
{
3547
try
@@ -47,7 +59,10 @@ public ImageSource ExtractIconFromExe(string GamePath)
4759
return null;
4860
}
4961
}
50-
62+
/// <summary>
63+
/// Re-convert icon from base-64 string to bitmap image
64+
/// </summary>
65+
/// <returns>ImageSource of the icon of an executable file</returns>
5166
public BitmapImage IconPathMethod()
5267
{
5368
if (IconBase64 == null)
@@ -77,7 +92,10 @@ public BitmapImage IconPathMethod()
7792
return image;
7893
}
7994
}
80-
95+
/// <summary>
96+
/// Re-converts background image from base-64 string to bitmap image
97+
/// </summary>
98+
/// <returns>The BitmapImage that was converted to a base-64 string</returns>
8199
public BitmapImage BackgroundPath()
82100
{
83101
if (BackgroundBase64 == null)
@@ -113,5 +131,7 @@ public BitmapImage BackgroundPath()
113131
public string GUID { get; set; }
114132
public string BackgroundDir { get; set; }
115133
public string IconBase64 { get; set; }
134+
public DateTime DateCreated { get; set; }
135+
public Version DatabaseVersion { get; set; }
116136
}
117137
}

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
// You can specify all the values or you can default the Build and Revision Numbers
5454
// by using the '*' as shown below:
5555
// [assembly: AssemblyVersion("1.0.*")]
56-
[assembly: AssemblyVersion("1.2.1.1")]
57-
[assembly: AssemblyFileVersion("1.2.1.1")]
56+
[assembly: AssemblyVersion("1.3.0.1")]
57+
[assembly: AssemblyFileVersion("1.3.0.1")]
5858
[assembly: Guid("1A4C6931-E14B-482E-93F7-7E6E10DD9E69")]
5959
[assembly: NeutralResourcesLanguage("en")]

Resources/export_icon.png

2.88 KB
Loading

Resources/filter_icon.png

1.29 KB
Loading

Resources/folder_open_icon.png

7.83 KB
Loading

0 commit comments

Comments
 (0)