M.
van Renswoude
X²Utils
Introduction
Overview
X²Utils is an open-source set of utility classes and functions released under the zlib/libpng license, a copy of which is shown below. It's main function is reusability and convenience; anything which is used often deserves a spot in the library, assuming it is written with portability in mind.
The official website for X²Utils is located at http://x2utils.kamadev.net/. Contributions to the source code are appreciated, and after reviewing will be committed to the Subversion repository.
Documentation
The documentation for X²Utils is kept both as in-source comments and external docBook format. The in-source comments can be used in combination with Delphi Component Help Builder to generate reference documentation. The docBook sources must be kept in sync manually, but allow for detailed explanation of the various functions.
License
Copyright (c) 2004 X²Software This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
This notice may not be removed or altered from any source distribution.
Environment information
X2UtApp.pas
Contains a TX2App class which can be initiated as a singleton using the App() function. It provides information related to the application, such as the executable path and version information.
Note that you should not free the return value of the App() function, the unit's finalization clause takes care of destroying the object when the application closes. This makes it suitable to use the App() function in a way similar to Delphi's Application object.
Using the App function
MyDataFileLocation := App.Path + 'data.ini';
The version information is accessible through App.Version. It contains the version numbers and various build flags as specified in the project options. You can also access the version strings through App.Version.Strings, which contain information such as the product name and copyright.
Useful for display purposes is the App.FormatVersion() function. It returns a string with the version information in the format "vX.X.X". If the optional Build parameter is set to True (default), "build X" is appended as well.
X2UtOS.pas
Similar to X2UtApp.pas, this unit contains a TX2OS class which you can access using the OS() function. It provides information about the Operating System the application currently runs on.
OS.Version is an enumeration of versions recognized by X2UtOS. Extended information if available through OS.VersionEx, and an OS.FormatVersion() is provided for display purposes as well.