Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EnableExplicit
- If OpenConsole()
- EnableGraphicalConsole(1)
- If OpenPreferences("Checksums.ini") Or CreatePreferences("checksums.ini")
- If ExamineDirectory(0, GetPathPart(ProgramFilename()), "*.*")
- While NextDirectoryEntry(0)
- If DirectoryEntryType(0) = #PB_DirectoryEntry_File And DirectoryEntryName(0) <> "checksums.ini" And DirectoryEntryName(0) <> "checksums.exe"
- ConsoleColor(7, 0)
- PrintN("--- " + DirectoryEntryName(0) + " ---")
- PreferenceGroup(DirectoryEntryName(0))
- If ReadPreferenceInteger("CRC", 0)
- If ReadPreferenceInteger("CRC", 0) = CRC32FileFingerprint(DirectoryEntryName(0))
- ConsoleColor(8, 0) : Print("CRC - ") : ConsoleColor(2, 0) : PrintN("OK")
- Else
- ConsoleColor(8, 0) : Print("CRC - ") : ConsoleColor(4, 0) : PrintN("Fail")
- EndIf
- Else
- WritePreferenceInteger("CRC", CRC32FileFingerprint(DirectoryEntryName(0)))
- ConsoleColor(8, 0) : Print("CRC - ") : ConsoleColor(5, 0) : PrintN("calculated")
- EndIf
- If Len(ReadPreferenceString("MD5", ""))
- If ReadPreferenceString("MD5", "") = MD5FileFingerprint(DirectoryEntryName(0))
- ConsoleColor(8, 0) : Print("MD5 - ") : ConsoleColor(2, 0) : PrintN("OK")
- Else
- ConsoleColor(8, 0) : Print("MD5 - ") : ConsoleColor(4, 0) : PrintN("Fail")
- EndIf
- Else
- WritePreferenceString("MD5", MD5FileFingerprint(DirectoryEntryName(0)))
- ConsoleColor(8, 0) : Print("MD5 - ") : ConsoleColor(5, 0) : PrintN("calculated")
- EndIf
- If Len(ReadPreferenceString("SHA1", ""))
- If ReadPreferenceString("SHA1", "") = SHA1FileFingerprint(DirectoryEntryName(0))
- ConsoleColor(8, 0) : Print("SHA1 - ") : ConsoleColor(2, 0) : PrintN("OK")
- Else
- ConsoleColor(8, 0) : Print("SHA1 - ") : ConsoleColor(4, 0) : PrintN("Fail")
- EndIf
- Else
- WritePreferenceString("SHA1", SHA1FileFingerprint(DirectoryEntryName(0)))
- ConsoleColor(8, 0) : Print("SHA1 - ") : ConsoleColor(5, 0) : PrintN("calculated")
- EndIf
- EndIf
- Wend
- EndIf
- ClosePreferences()
- EndIf
- ConsoleColor(7, 0)
- Print("Press Enter to continue ...")
- Input()
- CloseConsole()
- End
- EndIf
Add Comment
Please, Sign In to add comment