Home

Awesome

Delphi-LightSaber

Short description

Contains useful Delphi functions. Lightweight (only 10000 lines of code) alternative to Jedi library.

Delphi Library

Description

This repository contains a group of general-purpose Delphi libraries, that make your life easier. The library also wants to be a lightweight replacement for the mammoth Delphi Jedi library.
Simple, crystal clear, non-obfuscated, fully commented and curated code. No (direct) external dependencies. More than 15 years of development have been put in this library.
Click the 'Watch' button if you want to get notified about updates.

More like this


Structure

This repository contains the following libraries:

Each library depends on the previous one, in the order specified above.
LightSaber Core does not depend on any other library.
Therefore, if you want the Log library, you need to compile also the Core library. Your code could use directly the bottom library (Core) or higher libraries in the hierarchy, depending on your requirements:

If you only need the only one library (for example, the Core library), you can of course delete the rest of the libraries. More about my libraries here.


Road Map

The LightSaber Graphics, LightSaber Visual Controls was added in 2023, as promissed. The Proteus library will be added as soon as my free time allows it.

This library will be expanded if it gets enough Stars.
Click the 'Star' button (top-right corner) if you like this library.
Over 100 files are waiting to be cured and added: graphichs, simple encryption, internet functions (including file download routines), HTML manipulation, image manipulation, registry, math and LOTS of visual components!

This library is freeware (see included copyright notice). The library cannot be used in Russia!


Installation

Double click the LightSaber.groupproj to load it in Delphi. In Project Manager, right click on the group (top) and select "Build all" in the popup menu.


Files in CoreLib

ccCore.pas
Over 200 functions for:

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

ccAppData.pas
Application-wide functions:

ccStreamBuff.pas
Extends TBufferedFileStream.
This class adds new functionality that does not exist in Delphi's original stream classes:

ccStreamFile.pas
Expansion class for Delphi classical TFileStream.
Allows you to directly read/write bytes, cardinals, words, integers, strings to a (binary) files.
Now replaced by ccStreamBuff.

ccBinary.pas

ccWinVersion.pas
This library expands the TOSVersion.
Use it to get Windows version.
Example of functions:

ccINIFile
Features:

Setup:
Before using it you must set the ccAppData.AppName global var.
The class will use that name to automatically determine the INI file name/path which is %AppData%\AppName.Ini.
Example: If the AppName is set to "DelphiLightSaber" the ini file will be "c:\Users\UserName\AppData\Roaming\DelphiLightSaber\DelphiLightSaber.ini"

And... the cherry on the top of the cake was left at the end!

Resume application's GUI state via ccINIFileVCL.pas

Do you have applications with forms with lots of controls (like checkboxes/radiobuttons) and you want to save its status to disk on shutdown and resume exaclty from where you left on application startup with just one function call?
Use SaveForm/LoadForm.

Example:

A full demo app that demonstrates how to save/load the GUI with just two lines of code can be found here: github.com/GodModeUser/Dephi-LightSaber-GUI_AutoSave


External dependencies

Some parts (especially the graphic part) of LightSaber depends on external libraries. HOWEVER, those dependencies are disabled by default, so you don't need to install any extra libraries in order to use LightSaber. But in this case, some functionality (Exif support for JPG images, Fast Jpeg decoder, and support for Jpeg2000) of LightSaber will not be available, but the impact will be minimal. To enable the support for the above-mentioned features, install the libraries (see links below) and then add these "defines" in your project's settings: CCRExif;FastJpg;jpg2000.
The "Conditional defines" field is in your project options: Right-click your project, and choose "Project options -> Delphi compiler -> All configurations -> Conditional defines".

https://github.com/esmondb/ccr-exif/
https://github.com/galfar/PasJpeg2000
http://www.marktg.com/jpegdec/


Filename convention

The following filename convention is used in LightSaber libraries:

Example:

More like this