Category Archives: Libraries

LangLib MultiDB

LangLib MultiDB

LangLib is a software library to localize .NET applications (WinForms and WPF).

The localization data is saved to a SQLite / MySQL / PostgreSQL or Microsoft SQL server database.

So there is no need for Language resource files anymore!

 

Features

  • Current version 1.1.0.4 (14.10.2018)
  • Database is internally auto-constructed by the LangLib library. The default location is applications product name in the directory %LOCALAPPDATA%.
  • System.Windows.Forms or System.Windows.Controls.* namespaces are defaults to which the library will enumerate.
  • Denied property names are supported.
  • Adding additional namespaces is supported.
  • A localization software is included with the library.
  • A static caching system is used to prevent useless database queries after a form or window is once enumerated.
  • Support for changing the language in runtime.
  • Software architectures supported by System.Data.SQlite are supported.
  • A static and and instance based message localization is supported. Any message can contain formatting supported by string.Format method.
  • The “dump” of language enumeration is indicated to the library by a command line argument by –dbLang or –dbLang=cu-RE (ISO 639-1).
  • Full XML documentation (public/private)
  • A possibility to launch the localization application from the command line

 

Requirements

  • A Microsoft® Windows® supporting .NET Framework v.4.5.1 (possibly downgradable by modifying the source project settings)
  • LGPL v3 compatible application

 

Changes

  • v.1.0.0.3 (10.08.2015)
  • Fixed depency to Visual C++ Redistributable Package
  • v.1.0.0.4 (29.08.2015)
  • Moved to conditional loading on System.Data.SQLite. This removes the need to create separate x86/x64 binary releases.
  • V.1.1.0.0 (15.09.2015)
  • Added support for MySQL, PostgreSQL and Microsoft SQL server databases.
  • Language database can be dumped to insert/update clauses for databases supported by this library (SQLite, Microsoft SQL server, PostgreSQL server and SQLite)
  • SQLite support is still the default and requires no configuration changes for an existing application.
  • Database can be configured by in-build software called “SecureDatabaseSetting”, which uses new version of the ConfLib and its “SECURE:” definition.
  • Database table creation can now be left for the user. Sample scripts are included. Software table creation can be set to conditional in the ConfLib config file.
  • Cultures are not always dumped into a database on application start, this happens only when command line argument –dbLang is defined.
  • All connections, data readers, etc. are ADO.NET providers. (System.Data.SQLClient, Npgsql, MySql.Data.MySqlClient, System.Data.SQLite).
  • V.1.1.0.1 (03.11.2015)
  • Added x:Uid / Uid support for WPF localization.
  • v.1.1.0.4 (14.10.2018)
  • Added possibility to launch the localization application from the command line

 

Screenshots

A WPF application in design mode and running localized side by side (Microsoft Visual Studio Express 2013 for Windows Desktop)

 A LangLib SecureDatabaseSettings executable running under the Windows Forms application. Notice that the icon and the [product name] is adapted from the “calling” software.

A SQLite Spy software displaying the generated database of the database configuration. See that all vital information is encrypted with a local account setting so if you copy the file to another computer or to another account on the same computer the sensitive data will not decrypt.

 

The localization helper application also has some new features which first of them is the login screen

The second feature is to dump data to all supported database types (as in generate script)

 

 

Download

Source, GitHub

NuGet

Instructions

Instructions

{phocadownload view=file|id=48|target=s}

{phocadownload view=file|id=49|target=s}

Database creation

{phocadownload view=file|id=44|target=s}

{phocadownload view=file|id=46|target=s}

Table creation

{phocadownload view=file|id=45|target=s}

{phocadownload view=file|id=47|target=s}

WPF localization using Uid / x:Uid

{phocadownload view=file|id=57|target=s}

{phocadownload view=file|id=58|target=s}

ErrorLogger

A .NET Framework library for logging application errors (handled/unhandled) and messages the application “want’s” to log.

Features

  • Current version 1.0.0.4 (12.03.2019)
  • Logs application errors/exceptions unhandled automatically.
  • Logs handled errors/exceptions if the user wants to do so in the exception catch block.
  • Logs messages given by the user at a point of code.
  • Logged errors go to a file called “%LOCALAPPDATA%\[Application product name]\trace_error.log”.
  • Logged messages go to a file called “%LOCALAPPDATA%\[Application product name]\app_messages.log”.
  • A thread that truncates the log from the beginning of the file to about 10000 lines depending on the next “MESSAGE BEGIN..” line hourly if necessary.
  • Full XML documentation is included (public/private)
  • A sample application is included (both WPF and WinForms).

Notes

I developed this library while tracing the bug that lead to a crash of the SimpleBackup software because of the missing Visual C++ Redistributable Package.

Requirements

  • A Microsoft® Windows® supporting .NET Framework v.4.5 (possibly downgradable by modifying the source project settings)
  • LGPL v3 compatible application

Changes

  • v.1.0.0.1 (20.10.2015)
  • Fixed app_messages.log truncation on application start
  • Added product name and version to be logged as well
  • v.1.0.0.4 (12.03.2019)
  • Fixed file sharing issue if multiple instance of a same program were active

Screenshots

 A text editor showing trace_error.log file

 A text editor showing app_messages.log file

 A WPF sample application

Using in an application

WinForms

The library in WinForms must be “bound” before any forms are created (Program.cs).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using VPKSoft.ErrorLogger; // reguired

namespace WinFormsTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            ExceptionLogger.Bind(); // bind before any visual objects are created
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
            ExceptionLogger.UnBind(); // unbind so the truncate thread is stopped successfully
        }
    }
}

WPF

The library can be “bound” in the main window constructor.

using VPKSoft.ErrorLogger; // reguired

namespace WPFTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            ExceptionLogger.Bind(); // bind
            ExceptionLogger.LogMessage("Application start: " + System.Windows.Application.ResourceAssembly.GetName().Name);
        }
    }

The library can be “unbound” in the main window’s Closing event.

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // unbind so the truncate thread is stopped successfully
            ExceptionLogger.UnBind();
        }

Download

FlagsISO

A .NET library containing 260 different country (and other) flags.

Features

  • Current version 1.1.5 (28.05.22)
  • Includes 260 different country (and other) flags.
  • The country (and other) flags int the library are in 4 different sizes: 16×16, 24×24, 32×32 and 64×64 an custom size via SVG (flag-icons).
  • There are three types of country (and other) flags in the library: flat and “lovely glossy finish” as PNG files and the third option is SVG files.
  • The library can be called the get a flag with System.Globalization.CultureInfo, System.Globalization.RegionInfo and a two letter ISO country name.
  • Full XML documentation is included (public/private)
  • A sample application is included.
  • WinForms: Contains a ComboBox control for country selection (ComboBoxCountrySelect).
  • Eto.Forms: Contains a DropDown control for country selection (ComboBoxCountrySelect).

Notes, third party and thanks

 

Requirements

  • A Microsoft® Windows® supporting .NET Framework v.4.8 for the WinForms version of the library or a Linux®, macOS® or Microsoft® Windows® supporting .NET 6 for the Eto.Forms implementation.
  • MIT compatible application for the library and MIT compatibility for flag icons.

Screenshots

The sample application displaying a flag in a “lovely glossy finish” sized 64×64 pixels.

An Eto.Forms sample application in Linux (GTK)

An Eto.Forms sample application in Windows (WPF)

Download

LangLib

LangLib

LangLib is a software library to localize .NET applications (WinForms and WPF).

The localization data is saved to a SQLite database. Possibly I’ll add support to other databases in the future.

So there is no need for Language resource files anymore!

Features

  • Current version 1.0.1.2 (14.10.2018)
  • Database is internally auto-constructed by the LangLib library. The default location is applications product name in the directory %LOCALAPPDATA%.
  • System.Windows.Forms or System.Windows.Controls.* namespaces are defaults to which the library will enumerate.
  • Denied property names are supported.
  • Adding additional namespaces is supported.
  • A localization software is included with the library.
  • A static caching system is used to prevent useless database queries after a form or window is once enumerated.
  • Support for changing the language in runtime.
  • Software architectures supported by System.Data.SQlite are supported.
  • For the source code only x86 and x64 are configured.
  • A static and and instance based message localization is supported. Any message can contain formatting supported by string.Format method.
  • The “dump” of language enumeration is indicated to the library by a command line argument by –dbLang or –dbLang=cu-RE (ISO 639-1).
  • Full XML documentation (public/private)
  • A possibility to launch the localization application from the command line

Requirements

  • A Microsoft® Windows® supporting .NET Framework v.4.5.1 (possibly downgradable by modifying the source project settings)
  • LGPL v3 compatible application

Changes

  • Fixed exception when getting a message without parameters. This message will now be returned without internal string.Format.
  • Added new method DBLangEngine class: List<CultureInfo> GetLocalizedCultures().
  • Fixed depency to Visual C++ Redistributable Package
  • 1.0.0.5 (04.11.2015)
  • Added x:Uid / Uid support for WPF localization.
  • v.1.0.0.x (??.??.????)
  • Bug fixes
  • v.1.0.1.2 (14.10.2018)
  • Added possibility to launch the localization application from the command line

Screenshots

A WPF application in design mode and running localized side by side (Microsoft Visual Studio Express 2013 for Windows Desktop)

The localization helper applicatiob running for a WinForms project

Download

Instructions

ConfLib

ConfLib

A library to store .NET application settings into a SQLite database.

 

Features

  • Current version 1.0.0.8 (29.09.2019)
  • Support storing application configuration options into multiple categories (database tables).
  • A category is described as a path using slash(/) character as a separator.
  • All configuration values are stored as text. You can decide the formatting.
  • Automatically creates a SQLite database based on the applications product name – no additional scripting is required.
  • Includes a full XML documentation. Please do correct me if the English is bad sealed

 

Requirements

  • A Microsoft® Windows® supporting .NET Framework v.4.6.1
  • LGPL v3 compatible application

 

Changes

  • (10.08.2015) Fixed depency to Visual C++ Redistributable Package
  • (20.08.2015) Moved to conditional loading on System.Data.SQLite. This removes the need to create separate x86/x64 binary releases
  • (08.09.2015) Added possibility to encrypt values (using System.Security.Cryptography.ProtectedData with DataProtectionScope.CurrentUser)
  • (29.09.2019) Added SettingsBase class to ease up the usage of the library.

Screenshot

A test application

 

 A SQLite Spy software displaying the generated database of the test application

Help

 

Download

Source, GitHub

 

NuGet