LightSaber Core

The Core sub-library provides basic functionalities for all other sub-libraries. No external dependencies. The following files are delivered:

ccCore.pas
Over 200 functions for:

  • String manipulation (string conversions, sub-string detection, word manipulation, cut, copy, split, wrap, etc)
  • Programmer helpers
  • Form manipulation
  • Easy message boxes
  • DateTime utilities
  • etc etc etc etc etc

ccIO.pas
Super useful functions for file/folder/disk manipulation:

  • Copy files
  • Check existence of files & folders
  • File name processing
  • Get special Windows folders (Desktop, My Documents, etc)
  • Prompt user to select a file/folder
  • Find specified files (*.jpg for example) in a folder and all its sub-folders
  • Increment the numbers in a filename (good for incremental backups, for example)
  • Read text from files to a string variable
  • Compare files
  • Merge files
  • Sort lines in a file
  • Drive manipulation (IsDiskInDrive, etc)
  • etc

ccAppData.pas
Application-wide functions:

  • Get application’s AppData folder (the folder where we save temporary, app-related and ini files)
  • Get application’s command line parameters
  • Detect if the application is running for the first time in a computer
  • Application self-restart
  • Application self-delete
  • etc

Note: When you construct the TAppData object you need to give your application name as to the constructor. The class will use that name to automatically determine the INI file name/path which is %AppData%\AppName.Ini.

ccStreamBuff.pas
Extends TBufferedFileStream. It may be used as a drop-in replacement for TFileStream.
It adds new functionality that does not exist in Delphi’s original stream classes:

  • Read/WriteBoolean
  • Read/WriteString (Ansi/Unicode)
  • Read/WriteInteger
  • Read/WriteCardinal
  • Read/WriteDate
  • Read/Write mac files (inverted byte endianness)
  • etc

ccBinary.pas

  • String to hex, hex to string conversions (and many others)
  • Binary numbers (endianness) swapping
  • Data serialization
  • Bit manipulation (set bit, etc)
  • Reverse bits
  • Endianess
  • etc

ccWinVersion.pas
This library expands the TOSVersion. Use it to get Windows version.

Example of functions: IsWindowsXP…IsWindows7, IsWindows7Up, IsWindows8, IsWindows10,

ccINIFile
Features:

  • Extends the capabilities of TIniFile
  • Functions for easily accessing application’s default INI file.

The cherry on the top of the cake

Do you have forms with lots of controls (like checkboxes/radiobuttons) and you want to save their status to disk on shutdown and resume the program (GUI) exactly from where you left on application startup? You can do it with a single call to: SaveForm/LoadForm.

Example:

  • Call SaveForm(MySettingsForm) when the form is destroyed
  • Call LoadForm(MySettingsForm) when the form is created.

This full demo app demonstrates how to save/load the GUI with just two lines of code: GitHub.com/GabrielOnDelphi/Dephi-LightSaber-GUI_AutoSave

Scroll to Top