Guest User

Untitled

a guest
Aug 1st, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EnableExplicit
  2.  
  3. If OpenConsole()
  4.   EnableGraphicalConsole(1)
  5.   If OpenPreferences("Checksums.ini") Or CreatePreferences("checksums.ini")
  6.     If ExamineDirectory(0, GetPathPart(ProgramFilename()), "*.*")
  7.       While NextDirectoryEntry(0)
  8.         If DirectoryEntryType(0) = #PB_DirectoryEntry_File And DirectoryEntryName(0) <> "checksums.ini" And DirectoryEntryName(0) <> "checksums.exe"
  9.           ConsoleColor(7, 0)
  10.           PrintN("--- " + DirectoryEntryName(0) + " ---")
  11.           PreferenceGroup(DirectoryEntryName(0))
  12.           If ReadPreferenceInteger("CRC", 0)
  13.             If ReadPreferenceInteger("CRC", 0) = CRC32FileFingerprint(DirectoryEntryName(0))
  14.               ConsoleColor(8, 0) : Print("CRC - ") : ConsoleColor(2, 0) : PrintN("OK")
  15.             Else
  16.               ConsoleColor(8, 0) : Print("CRC - ") : ConsoleColor(4, 0) : PrintN("Fail")
  17.             EndIf
  18.           Else
  19.             WritePreferenceInteger("CRC", CRC32FileFingerprint(DirectoryEntryName(0)))
  20.             ConsoleColor(8, 0) : Print("CRC - ") : ConsoleColor(5, 0) : PrintN("calculated")
  21.           EndIf
  22.           If Len(ReadPreferenceString("MD5", ""))
  23.             If ReadPreferenceString("MD5", "") = MD5FileFingerprint(DirectoryEntryName(0))
  24.               ConsoleColor(8, 0) : Print("MD5 - ") : ConsoleColor(2, 0) : PrintN("OK")
  25.             Else
  26.               ConsoleColor(8, 0) : Print("MD5 - ") : ConsoleColor(4, 0) : PrintN("Fail")
  27.             EndIf
  28.           Else
  29.             WritePreferenceString("MD5", MD5FileFingerprint(DirectoryEntryName(0)))
  30.             ConsoleColor(8, 0) : Print("MD5 - ") : ConsoleColor(5, 0) : PrintN("calculated")
  31.           EndIf
  32.           If Len(ReadPreferenceString("SHA1", ""))
  33.             If ReadPreferenceString("SHA1", "") = SHA1FileFingerprint(DirectoryEntryName(0))
  34.               ConsoleColor(8, 0) : Print("SHA1 - ") : ConsoleColor(2, 0) : PrintN("OK")
  35.             Else
  36.               ConsoleColor(8, 0) : Print("SHA1 - ") : ConsoleColor(4, 0) : PrintN("Fail")
  37.             EndIf
  38.           Else
  39.             WritePreferenceString("SHA1", SHA1FileFingerprint(DirectoryEntryName(0)))
  40.             ConsoleColor(8, 0) : Print("SHA1 - ") : ConsoleColor(5, 0) : PrintN("calculated")
  41.           EndIf
  42.         EndIf
  43.       Wend
  44.     EndIf
  45.     ClosePreferences()
  46.   EndIf
  47.   ConsoleColor(7, 0)
  48.   Print("Press Enter to continue ...")
  49.   Input()
  50.   CloseConsole()
  51.   End
  52. EndIf
Add Comment
Please, Sign In to add comment