gbCodeLib - Import Source Code
Source code can be imported into the gbCodeLib database from the gbCodeLib server or from other
text source files already existing on the local PC (such as HTML files, Java source code files, VB source code files, etc.)
To import data from the gbCodeLib server simply press the "Download Snippet" toolbar button. The complete list of
snippets on the server will be downloaded and compared to the local gbCodeLib database. Any server snippets which
are different than the snippets will be listed in a frame at the bottom of the gbCodeLib window. Simply
check the snippets to be imported into the local database and press the "Add Selected Snippets" button on the toolbar.
To import data from files on the local PC just press the "Import Source Code" toolbar button to call up a file
selection dialog window. Select the file and press "Open" to see a list of the source code snippets that gbCodeLib
was able to identify in the selected file and which are not found in the current gbCodeLib database.
Again, check the snippets to be imported into the local database and press the "Add Selected Snippets" button on the toolbar.
Additional information on importing source code is provided below.
The Import menu selections include:

- Server Snippets
Downloads current snippets from server for selection/import into the local database
- Local Snippets
Allows use to select and search local language source code files for snippets for selection/import into the local database
- Import Selected Snippets
Adds selected snippets to the current database. All imported snippets are placed in a category called 'Imports'.
Additional details of importing source code is provided below.
gbCodeLib Server
The database distributed with gbCodeLib is updated regularly - with new code snippets,
code improvements, or updates to the tutorials. With gbCodeLib you can access the
snippets on the server and display those that are different from the ones in your local database.
You may then select any or all for import into your local database.
Simply press the 'Download Snippets' button on the toolbar to access a list of current
server snippets which are different from your local database. The 'Online Source Code Update'
frame (see the image below) will be displayed at the bottom of the main window
(if the Search frame is visible it will be temporarily replaced by the Online Source Code Update frame).
Click on a snippet to see its code in the textbox to the right of the snippet list.
Once the snippets have been downloaded from the server and displayed, simply check the
snippets you want to import and press the Import button from the toolbar. By default,
no snippets are selected.
(click to enlarge)
For convenience several functions are available as a context sensitive menu in the
snippet list. Right-mouse click a snippet to get the following menu selections:
- Select All
Selects all server snippets
- Unselect All
Unselects all snippets
- Display Only Snippets With Matching Titles
Limits the display to only those server snippets with a title identical to
a snippet already in the current snippet database.
Also, the server snippet source code can quickly be transferred to the source
code editor by right-mouse clicking on the server snippet source code and
selecting the "Replace Tree Code" menu selection.
Local Language Source Code Files
gbCodeLib can currently read the language source file for Visual Basic, Perl, Java, and C++
and extract source code. Other languages files are being added. In particular, the language
files are read and subroutine, function, and class source code is extracted as follows:
All imported snippets are placed in the Language category called 'Imports'.
- VB
Files with extensions .bas and .frm are read. Both Sub and Function code is extracted
for import into gbCodeLib.
- Perl
Files with extensions .pl are read. Sub code is extracted for import into gbCodeLib.
- Java
Files with extensions .java are read. 'class' code is extracted for import
into gbCodeLib.
- HTML / JavaScript
Files with extensions .htm and .html are read. JavaScripts (<script></script<) and HTML
tags (<style></style>, <form></form>, and <table></table>)
are extracted for import into gbCodeLib.
- C++
Files with extensions .h and .cpp are read. 'class' code is extracted for import
into gbCodeLib.
Support for other languages are being added regularly. If you'd like gbCodeLib to support a
particular file type, just let me know.
(click to enlarge)
Prior Versions of gbCodeLib Databases
gbCodeLib can also read .txt files and extract any gbCodeLib-formatted source code.
- gbCodeLib Versions 5-6
gbCodeLib versions 5/6 used different file formats than that of version 8. To
import version 5/6 databases, rename the version 5/6 database from 'gbcodelib.txt'
to 'gbcodelib.gb5'. Then use the Import Local Source Code option on the toolbar.
The file selection dialog window will recognize the *.gb5 files.
- gbCodeLib Version 7
The gbCodeLib version 7 database uses the same format as that of version 8.
Before creating new version 8 snippets, simply copy the version 7 database
(file name: gbcodelib.txt) over the version 8 database file of the same name.
Or, use the Import Local Source Code feature and select the ver7 'gbcodelib.txt'.
Search List Context Menu
For convenience several functions are available as a context sensitive menu in the
snippet list. Right-mouse click a snippet to get the following menu selections:
- Select All
Selects all local snippets
- Unselect All
Unselects all snippets
- Display Only Snippets With Matching Titles
Limits the display to only those local snippets with a title identical to
a snippet already in the current snippet database.
Also, the local snippet source code can quickly be transferred to the source
code editor by right-mouse clicking on the local snippet source code and
selecting the "Replace Tree Code" menu selection.
|