@@ -92,11 +92,11 @@ public static Win32AppInfo Get()
92
92
if ( IsAlphaBitmap ( bmp , out var bmpData ) )
93
93
{
94
94
var alphaBitmap = GetAlphaBitmapFromBitmapData ( bmpData ) ;
95
- iconPath = SaveIconToAppPath ( alphaBitmap , appId ) ;
95
+ iconPath = SaveIconToAppPath ( alphaBitmap , aumid ) ;
96
96
}
97
97
else
98
98
{
99
- iconPath = SaveIconToAppPath ( bmp , appId ) ;
99
+ iconPath = SaveIconToAppPath ( bmp , aumid ) ;
100
100
}
101
101
}
102
102
catch
@@ -122,7 +122,7 @@ public static Win32AppInfo Get()
122
122
if ( string . IsNullOrWhiteSpace ( iconPath ) )
123
123
{
124
124
// We use the one from the process
125
- iconPath = ExtractAndObtainIconFromCurrentProcess ( process , appId ) ;
125
+ iconPath = ExtractAndObtainIconFromCurrentProcess ( process , aumid ) ;
126
126
}
127
127
128
128
return new Win32AppInfo ( )
@@ -155,12 +155,12 @@ private static string GetDisplayNameFromCurrentProcess(Process process)
155
155
return process . ProcessName ;
156
156
}
157
157
158
- private static string ExtractAndObtainIconFromCurrentProcess ( Process process , string appId )
158
+ private static string ExtractAndObtainIconFromCurrentProcess ( Process process , string aumid )
159
159
{
160
- return ExtractAndObtainIconFromPath ( process . MainModule . FileName , appId ) ;
160
+ return ExtractAndObtainIconFromPath ( process . MainModule . FileName , aumid ) ;
161
161
}
162
162
163
- private static string ExtractAndObtainIconFromPath ( string pathToExtract , string appId )
163
+ private static string ExtractAndObtainIconFromPath ( string pathToExtract , string aumid )
164
164
{
165
165
try
166
166
{
@@ -169,7 +169,7 @@ private static string ExtractAndObtainIconFromPath(string pathToExtract, string
169
169
170
170
using ( var bmp = icon . ToBitmap ( ) )
171
171
{
172
- return SaveIconToAppPath ( bmp , appId ) ;
172
+ return SaveIconToAppPath ( bmp , aumid ) ;
173
173
}
174
174
}
175
175
catch
@@ -178,11 +178,11 @@ private static string ExtractAndObtainIconFromPath(string pathToExtract, string
178
178
}
179
179
}
180
180
181
- private static string SaveIconToAppPath ( Bitmap bitmap , string appId )
181
+ private static string SaveIconToAppPath ( Bitmap bitmap , string aumid )
182
182
{
183
183
try
184
184
{
185
- var path = Path . Combine ( GetAppDataFolderPath ( appId ) , "Icon.png" ) ;
185
+ var path = Path . Combine ( GetAppDataFolderPath ( aumid ) , "Icon.png" ) ;
186
186
187
187
// Ensure the directories exist
188
188
Directory . CreateDirectory ( Path . GetDirectoryName ( path ) ) ;
@@ -201,9 +201,9 @@ private static string SaveIconToAppPath(Bitmap bitmap, string appId)
201
201
/// Gets the app data folder path within the ToastNotificationManagerCompat folder, used for storing icon assets and any additional data.
202
202
/// </summary>
203
203
/// <returns>Returns a string of the absolute folder path.</returns>
204
- public static string GetAppDataFolderPath ( string appId )
204
+ public static string GetAppDataFolderPath ( string aumid )
205
205
{
206
- string conciseAumid = appId . Contains ( " \\ " ) ? GenerateGuid ( appId ) : appId ;
206
+ string conciseAumid = aumid . Contains ( ' \\ ' ) || aumid . Contains ( '/' ) ? GenerateGuid ( aumid ) : aumid ;
207
207
208
208
return Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "ToastNotificationManagerCompat" , "Apps" , conciseAumid ) ;
209
209
}
0 commit comments