sdckey

EnScript Filters - Using the Constructor / Destructor

Sep 10th, 2020 (edited)
123
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MainClass {
  2.  
  3.   typedef                                            long[]                                            LongArray;
  4.  
  5.   LongArray                                          Sizes;
  6.  
  7.   MainClass() :
  8.     Sizes()
  9.   {
  10.     SystemClass::ClearConsole(1);
  11.     Console.WriteLine("Constructor called");
  12.   }
  13.  
  14.   bool Main(EntryClass e) {
  15.     Console.WriteLine("Checking {0}", e.ItemPath());
  16.     Sizes.Add(e.LogicalSize());
  17.     return true;
  18.   }
  19.  
  20.   ~MainClass()
  21.   {
  22.     Console.WriteLine("Destructor started.");
  23.     Sizes.Sort(SORTENABLED | SORTNODUPE);
  24.     Console.WriteLine("Unique sizes processed:\n");
  25.     foreach (long size in Sizes)
  26.     {
  27.       Console.WriteLine("\t{0}", size);
  28.     }
  29.     Console.WriteLine();
  30.     Console.WriteLine("Destructor finished.");
  31.   }
  32. }
  33.  
RAW Paste Data