Advertisement
Stillkill

DiscordImageCacheConverter

Feb 24th, 2019
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Threading.Tasks;
  4. using System.Collections.Generic;
  5.  
  6. namespace DiscordCacheConverter
  7. {
  8.     class Program
  9.     {
  10.  
  11.         static void Main(string[] args)
  12.         {
  13.            
  14.             Console.WriteLine(@"WARNING: This executable must be placed in your \AppData\Roaming\discord\Cache directory");
  15.             Console.WriteLine("This program will overwrite all files in current directory, so make sure it's in the right one. Close now if you are unsure.");
  16.             Console.WriteLine("Press any key to continue");
  17.             Console.ReadKey();
  18.             Console.WriteLine("Starting Conversion of image cache to readable state...");
  19.             Converter converter = new Converter();
  20.         }
  21.     }
  22.  
  23.     public class Converter
  24.     {
  25.         readonly string BasePath = AppDomain.CurrentDomain.BaseDirectory;
  26.         string[] Files;
  27.         public Converter()
  28.         {
  29.             Files = Directory.GetFiles(BasePath);
  30.             Run();
  31.         }
  32.  
  33.         private void Run()
  34.         {
  35.             foreach (string file in Files)
  36.             {
  37.                 if (file.Contains("f_"))
  38.                 {
  39.                     Console.WriteLine($"Found file {file}");
  40.                     Console.WriteLine("Converting...");
  41.                     File.Move(file, $"{file}.png");
  42.                     Console.WriteLine("Completed Conversion");
  43.                     Console.WriteLine($"File saved as {file}.png");
  44.                 }
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement