Skip to content

Portable Tool for an Ideal Windows Setup

add T4 generator for XAML image resources

Greedeks8464539dcfd1
diff --git a/.Source/GTweak/Assets/Images/ImageResources.tt b/.Source/GTweak/Assets/Images/ImageResources.tt
new file mode 100644
index 00000000..daa68f1b
--- /dev/null
+++ b/.Source/GTweak/Assets/Images/ImageResources.tt
@@ -0,0 +1,31 @@
+<#@ template language="C#" hostspecific="true" #>
+<#@ output extension=".xaml" #>
+<#@ import namespace="System" #>
+<#@ import namespace="System.IO" #>
+<#@ import namespace="System.Linq" #>
+<#@ assembly name="System.Core" #>
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+<#
+ string imagesRoot = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Host.TemplateFile), "."));
+
+ foreach (string folder in Directory.GetDirectories(imagesRoot).OrderBy(d => d))
+ {
+ string folderName = Path.GetFileName(folder);
+#>
+ <!--#region <#= folderName #> -->
+<#
+ foreach (string file in Directory.GetFiles(folder, "*.png").OrderBy(f => f))
+ {
+#>
+ <BitmapImage x:Key="Img_<#= Path.GetFileNameWithoutExtension(file) #>" UriSource="/GTweak;component/Assets/Images/<#= folderName #>/<#= Path.GetFileName(file) #>"/>
+<#
+ }
+#>
+ <!--#endregion -->
+
+<#
+ }
+#>
+</ResourceDictionary>
\ No newline at end of file
diff --git a/.Source/GTweak/Assets/Images/ImageResources.xaml b/.Source/GTweak/Assets/Images/ImageResources.xaml
index 79f5f5b8..8c4df87d 100644
--- a/.Source/GTweak/Assets/Images/ImageResources.xaml
+++ b/.Source/GTweak/Assets/Images/ImageResources.xaml
@@ -1,6 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <!--#region AddonsFiles -->
+ <BitmapImage x:Key="Img_BatFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/BatFile.png"/>
+ <BitmapImage x:Key="Img_CmdFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/CmdFile.png"/>
+ <BitmapImage x:Key="Img_PowershellFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/PowershellFile.png"/>
+ <BitmapImage x:Key="Img_RegistryFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/RegistryFile.png"/>
+ <!--#endregion -->
+
+ <!--#region DownloadApps -->
<BitmapImage x:Key="Img_Amd" UriSource="/GTweak;component/Assets/Images/DownloadApps/Amd.png"/>
<BitmapImage x:Key="Img_Autoruns" UriSource="/GTweak;component/Assets/Images/DownloadApps/Autoruns.png"/>
<BitmapImage x:Key="Img_CPUz" UriSource="/GTweak;component/Assets/Images/DownloadApps/CPUz.png"/>
@@ -12,14 +20,9 @@
<BitmapImage x:Key="Img_NvidiaPI" UriSource="/GTweak;component/Assets/Images/DownloadApps/NvidiaPI.png"/>
<BitmapImage x:Key="Img_Occt" UriSource="/GTweak;component/Assets/Images/DownloadApps/Occt.png"/>
<BitmapImage x:Key="Img_Rufus" UriSource="/GTweak;component/Assets/Images/DownloadApps/Rufus.png"/>
+ <!--#endregion -->
- <BitmapImage x:Key="Img_BatFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/BatFile.png"/>
- <BitmapImage x:Key="Img_CmdFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/CmdFile.png"/>
- <BitmapImage x:Key="Img_PowershellFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/PowershellFile.png"/>
- <BitmapImage x:Key="Img_RegistryFile" UriSource="/GTweak;component/Assets/Images/AddonsFiles/RegistryFile.png"/>
-
- <BitmapImage x:Key="Img_SandTimer" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/SandTimer.png"/>
-
+ <!--#region PreinstalledApps -->
<BitmapImage x:Key="Img_3DBuilder" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/3DBuilder.png"/>
<BitmapImage x:Key="Img_Alarms" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Alarms.png"/>
<BitmapImage x:Key="Img_BingFinance" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/BingFinance.png"/>
@@ -73,6 +76,7 @@
<BitmapImage x:Key="Img_Plex" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Plex.png"/>
<BitmapImage x:Key="Img_PrimeVideo" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/PrimeVideo.png"/>
<BitmapImage x:Key="Img_QuickAssist" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/QuickAssist.png"/>
+ <BitmapImage x:Key="Img_SandTimer" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/SandTimer.png"/>
<BitmapImage x:Key="Img_ScreenSketch" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/ScreenSketch.png"/>
<BitmapImage x:Key="Img_Shazam" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Shazam.png"/>
<BitmapImage x:Key="Img_SkypeApp" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/SkypeApp.png"/>
@@ -83,14 +87,15 @@
<BitmapImage x:Key="Img_Todos" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Todos.png"/>
<BitmapImage x:Key="Img_TuneInRadio" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/TuneInRadio.png"/>
<BitmapImage x:Key="Img_TwitterX" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/TwitterX.png"/>
- <BitmapImage x:Key="Img_Video" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Video.png"/>
<BitmapImage x:Key="Img_Viber" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Viber.png"/>
- <BitmapImage x:Key="Img_WebMediaExtensions" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/WebMediaExtensions.png"/>
- <BitmapImage x:Key="Img_Widgets" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Widgets.png"/>
- <BitmapImage x:Key="Img_WhiteBoard" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/WhiteBoard.png"/>
+ <BitmapImage x:Key="Img_Video" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Video.png"/>
<BitmapImage x:Key="Img_Wallet" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Wallet.png"/>
+ <BitmapImage x:Key="Img_WebMediaExtensions" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/WebMediaExtensions.png"/>
<BitmapImage x:Key="Img_WhatsApp" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/WhatsApp.png"/>
+ <BitmapImage x:Key="Img_WhiteBoard" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/WhiteBoard.png"/>
+ <BitmapImage x:Key="Img_Widgets" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Widgets.png"/>
<BitmapImage x:Key="Img_Xbox" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/Xbox.png"/>
<BitmapImage x:Key="Img_YandexMusic" UriSource="/GTweak;component/Assets/Images/PreinstalledApps/YandexMusic.png"/>
-
+ <!--#endregion -->
+
</ResourceDictionary>
\ No newline at end of file
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index a130bb6e..1d7d4124 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -251,8 +251,11 @@
<SubType>Designer</SubType>
</Page>
<Page Include="Assets\Images\ImageResources.xaml">
- <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>ImageResources.tt</DependentUpon>
+ <SubType>Designer</SubType>
</Page>
<Page Include="Assets\UserControls\Card.xaml">
<SubType>Designer</SubType>
@@ -637,6 +640,10 @@
<Resource Include="Assets\Images\DownloadApps\DiskMark.png" />
<Resource Include="Assets\Images\DownloadApps\CPUz.png" />
<Resource Include="Assets\Images\DownloadApps\Rufus.png" />
+ <Content Include="Assets\Images\ImageResources.tt">
+ <Generator>TextTemplatingFileGenerator</Generator>
+ <LastGenOutput>ImageResources.xaml</LastGenOutput>
+ </Content>
<Content Include="Properties\AssemblyInfo.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>AssemblyInfo.cs</LastGenOutput>