1414using Vanara . PInvoke ;
1515using Windows . System ;
1616using Windows . Win32 ;
17- using Windows . Win32 . Foundation ;
1817using Windows . Win32 . Storage . FileSystem ;
19- using static Vanara . PInvoke . Kernel32 ;
2018using COMPRESSION_FORMAT = Windows . Win32 . Storage . FileSystem . COMPRESSION_FORMAT ;
2119using HRESULT = Vanara . PInvoke . HRESULT ;
2220using HWND = Vanara . PInvoke . HWND ;
@@ -28,6 +26,7 @@ namespace Files.App.Helpers
2826 /// </summary>
2927 public static partial class Win32Helper
3028 {
29+ [ Obsolete ( $ "Use { nameof ( STATask ) } instead.") ]
3130 public static Task StartSTATask ( Func < Task > func )
3231 {
3332 var taskCompletionSource = new TaskCompletionSource ( ) ;
@@ -62,6 +61,7 @@ public static Task StartSTATask(Func<Task> func)
6261 return taskCompletionSource . Task ;
6362 }
6463
64+ [ Obsolete ( $ "Use { nameof ( STATask ) } instead.") ]
6565 public static Task StartSTATask ( Action action )
6666 {
6767 var taskCompletionSource = new TaskCompletionSource ( ) ;
@@ -96,6 +96,7 @@ public static Task StartSTATask(Action action)
9696 return taskCompletionSource . Task ;
9797 }
9898
99+ [ Obsolete ( $ "Use { nameof ( STATask ) } instead.") ]
99100 public static Task < T ? > StartSTATask < T > ( Func < T > func )
100101 {
101102 var taskCompletionSource = new TaskCompletionSource < T ? > ( ) ;
@@ -131,6 +132,7 @@ public static Task StartSTATask(Action action)
131132 return taskCompletionSource . Task ;
132133 }
133134
135+ [ Obsolete ( $ "Use { nameof ( STATask ) } instead.") ]
134136 public static Task < T ? > StartSTATask < T > ( Func < Task < T > > func )
135137 {
136138 var taskCompletionSource = new TaskCompletionSource < T ? > ( ) ;
@@ -189,6 +191,7 @@ public static Task StartSTATask(Action action)
189191 return await GetUwpAssoc ( ) ?? GetDesktopAssoc ( ) ;
190192 }
191193
194+ [ Obsolete ( $ "Use { nameof ( WindowsStorageHelpers . TryExtractStringFromExecutable ) } instead.") ]
192195 public static string ExtractStringFromDLL ( string file , int number )
193196 {
194197 var lib = Kernel32 . LoadLibrary ( file ) ;
@@ -228,12 +231,6 @@ public static string ExtractStringFromDLL(string file, int number)
228231
229232 private static readonly object _iconOverlayLock = new object ( ) ;
230233
231- /// <summary>
232- /// Returns overlay for given file or folder
233- /// </summary>
234- /// <param name="path"></param>
235- /// <param name="isDirectory"></param>
236- /// <returns></returns>
237234 public static byte [ ] ? GetIconOverlay ( string path , bool isDirectory )
238235 {
239236 var shFileInfo = new Shell32 . SHFILEINFO ( ) ;
@@ -287,16 +284,7 @@ public static string ExtractStringFromDLL(string file, int number)
287284 /// <summary>
288285 /// Returns an icon if returnIconOnly is true, otherwise a thumbnail will be returned if available.
289286 /// </summary>
290- /// <param name="path"></param>
291- /// <param name="size"></param>
292- /// <param name="isFolder"></param>
293- /// <param name="iconOptions"></param>
294- /// <returns></returns>
295- public static byte [ ] ? GetIcon (
296- string path ,
297- int size ,
298- bool isFolder ,
299- IconOptions iconOptions )
287+ public static byte [ ] ? GetIcon ( string path , int size , bool isFolder , IconOptions iconOptions )
300288 {
301289 byte [ ] ? iconData = null ;
302290
@@ -454,6 +442,7 @@ public static bool RunPowershellCommand(string command, PowerShellExecutionOptio
454442
455443 private static readonly ConcurrentDictionary < ( string File , int Index , int Size ) , IconFileInfo > _iconCache = new ( ) ;
456444
445+ [ Obsolete ( $ "Use { nameof ( WindowsStorageHelpers . TryExtractImageFromExecutable ) } instead.") ]
457446 public static IList < IconFileInfo > ExtractSelectedIconsFromDLL ( string file , IList < int > indexes , int iconSize = 48 )
458447 {
459448 var iconsList = new List < IconFileInfo > ( ) ;
@@ -483,6 +472,7 @@ public static IList<IconFileInfo> ExtractSelectedIconsFromDLL(string file, IList
483472 return iconsList ;
484473 }
485474
475+ [ Obsolete ( $ "Use { nameof ( WindowsStorageHelpers . TryExtractImageFromExecutable ) } instead.") ]
486476 public static IList < IconFileInfo > ? ExtractIconsFromDLL ( string file )
487477 {
488478 var iconsList = new List < IconFileInfo > ( ) ;
@@ -517,6 +507,7 @@ public static IList<IconFileInfo> ExtractSelectedIconsFromDLL(string file, IList
517507 return iconsList ;
518508 }
519509
510+ [ Obsolete ( $ "Use { nameof ( WindowsStorageHelpers . TrySetFolderIcon ) } instead.") ]
520511 public static bool SetCustomDirectoryIcon ( string ? folderPath , string ? iconFile , int iconIndex = 0 )
521512 {
522513 if ( folderPath is null )
@@ -537,6 +528,7 @@ public static bool SetCustomDirectoryIcon(string? folderPath, string? iconFile,
537528 return success ;
538529 }
539530
531+ [ Obsolete ( $ "Use { nameof ( WindowsStorageHelpers . TrySetShortcutIcon ) } instead.") ]
540532 public static bool SetCustomFileIcon ( string ? filePath , string ? iconFile , int iconIndex = 0 )
541533 {
542534 if ( filePath is null )
@@ -547,6 +539,7 @@ public static bool SetCustomFileIcon(string? filePath, string? iconFile, int ico
547539 return success ;
548540 }
549541
542+ [ Obsolete ( $ "Use { nameof ( WindowsStorageHelpers . TryShowFormatDriveDialog ) } instead.") ]
550543 public static Task OpenFormatDriveDialog ( string drive )
551544 {
552545 // Format requires elevation
@@ -571,6 +564,7 @@ public static Task<bool> MountVhdDisk(string vhdPath)
571564 return RunPowershellCommandAsync ( $ "-command \" Mount-DiskImage -ImagePath '{ vhdPath } '\" ", PowerShellExecutionOptions . Elevated | PowerShellExecutionOptions . Hidden ) ;
572565 }
573566
567+ [ Obsolete ( $ "Don't use this method any more.") ]
574568 public static Bitmap ? GetBitmapFromHBitmap ( HBITMAP hBitmap )
575569 {
576570 try
0 commit comments