0

For My current works I need to Mark some Files and folders as uploaded and rest are not yet uploaded, I wish to change the File/Folder or some overlay images to achieve the goal. I've changed the Folder Icon as expected by using the following code:

 public static void ChangeFolderIcon(string folderPath, string iconPath)
 {
     if (File.Exists(folderPath + @"\desktop.ini"))
     {
         File.Delete(folderPath + @"\desktop.ini");
     }
     StreamWriter sWritter = File.CreateText(folderPath + @"\desktop.ini");
     sWritter.WriteLine("[.ShellClassInfo]");         
     sWritter.WriteLine("IconFile=" + iconPath);
     sWritter.WriteLine("IconIndex=0");
     sWritter.Close();
     sWritter.Dispose();
     File.SetAttributes(folderPath + @"\desktop.ini", File.GetAttributes(folderPath + @"\desktop.ini") | FileAttributes.Hidden);
     File.SetAttributes(folderPath, File.GetAttributes(folderPath) | FileAttributes.System);
 }

I had Tried some solutions(1,2 etc.) but nothing help me to change the file icon, or overlay the file icon. Is there any possibility to do this in c# or by referring some c++ libraries to the C#.

Please note : I'm not using any UI, The complete process is done through Console Application.

sujith karivelil
  • 28,671
  • 6
  • 55
  • 88
  • 1
    *"to Mark some Files and folders as uploaded"* - and you want to use windows explorer to view this information? The easiest is to write own software, which you have to run to see that (TreeView + DirectoryInfo/FileInfo + custom icons). In explorer file icon associated with type. You can add some temproral extension to mark files which are not yet processes (e.g. `.tobeprocessed` and associate custom icon with that type of files). – Sinatr Jul 14 '16 at 06:48
  • @Sinatr : I don't have any UI, Its console application – sujith karivelil Jul 14 '16 at 06:51
  • 1
    How do you see icons in console application? It doesn't matter how you processing files, only where you want to see that info (processed/not processed files and folders). My point is what having small tool for this is the right way to go. You could have another console application, which shows that status as text (displaying list of completed and/or not completed files), but of course it make sense to have UI to see that. – Sinatr Jul 14 '16 at 06:51
  • I can't see( and i don't), that's why i wish to change the Icon in windows explorer – sujith karivelil Jul 14 '16 at 06:52
  • @un-lucky lets write explorer extension, or in way like Sinatr. Your project is in wrong place – Jacek Cz Jul 14 '16 at 06:55
  • @RawN: if i got C++ code i will add it as reference to my solution. that's why i have included that Tag. is there anything wrong with that? – sujith karivelil Jul 14 '16 at 07:05

0 Answers0