Site Contents

Intro & News

E-mail Contact

RSS 2.0 Feed

Development

Developer Books

Developer Links

Developer Tools

Microsoft Links

Check .NET Version

Comment Reflower

NDoc 2.0 Alpha

Region Tools

Struct Performance

WPF Performance

Weird .NET Issues

Miscellaneous

Structured Documents

FrameMaker & DITA

Windows & High DPI

Other Links

Other Software

Subscriptions

Projects

Tektosyne

Class Diagrammer

Hexkit

Star Chess

Civilization IV

Civilization V


Tektosyne Library

The Tektosyne Library for the .NET Framework offers a variety of types and methods to supplement the .NET Base Class Library. The library ships as two separate assemblies, Tektosyne.Core and Tektosyne.Windows. A brief overview follows; please refer to the class reference for details.

The library and all examples in the documentation are written in C#. The Tektosyne Library for the .NET Framework and its documentation are © 2002–2012 by Christoph Nahr but available for free download under the MIT license.

Tektosyne.Core

Tektosyne.Core requires only the four BCL “core” assemblies, enabling compatibility with a wide range of target environments – see System Requirements for details. Tektosyne.Core provides the bulk of the library’s functionality, including the following:

  • Collections: generic “braided” tree, generic quadtree, extensions of BCL collections with read-only wrappers
  • Sorting: standard sorting algorithms and binary search for IList<T> collections
  • Natural string sorting, i.e. numerical sorting of digit-only substrings
  • Geometric primitives: Point/Vector, Size, Line, Rect with various coordinate types
  • Geometric algorithms: convex hull, multi-line intersection, point in polygon, Voronoi diagram and Delaunay triangulation
  • Graph algorithms: A* pathfinding, path coverage, flood fill, line of sight
  • Planar subdivision represented as doubly-connected edge list, with support for dynamic modification, fast point location, and pathfinding
  • Rectangular grid of regular polygons (squares or hexagons), with pathfinding support
  • An implementation of the Mersenne Twister pseudo-random number generator
  • Mathematical helper methods, including a library of Fortran 90 functions
  • Specialized exception types and ThrowHelper methods for common error scenarios

Tektosyne.Windows

Tektosyne.Windows requires a multitude of BCL assemblies that are exclusive to the .NET Framework 4 on Windows, such as the Windows Presentation Foundation (WPF) and interoperation with the unmanaged Win32 API. Its additional features include the following:

  • Hosting a NumericUpDown control with error provider and tooltip in a WPF window
  • Manipulating a WriteableBitmap’s pixel data with or without a secondary buffer
  • Searching visual and logical WPF trees for children or parents of a specific type
  • Wrappers for the Simple MAPI protocol to send e-mail messages with attachments
  • Many other utility types & methods that I needed at one time or another

Limitations

Tektosyne.Core and Tektosyne.Windows both produce IL code that not verifiable. The library is compiled in “unsafe” mode to facilitate efficient hash code generation in Tektosyne.Core, and various other tasks (Win32 interoperation, bitmap manipulation) in Tektosyne.Windows. If you require verifiable IL code for security reasons, you must pull out the stuff you need and recompile without the “unsafe” flag. Several classes in both assemblies are also not CLS compliant due to the use of unsigned integers.

Moreover, Tektosyne.Windows targets desktop applications running with “Full Trust”. If you are targeting a more limited permission set, such as Silverlight deployment, you will need to test the desired classes and methods for compatibility with that permission set.

Orthodox .NET programmers will also disagree with my coding style. While I’m using FxCop to check my code, I take the liberty to ignore any warnings I consider irrelevant. In particular, many types contain public or protected instance fields where a property wrapper makes no sense (and possibly impedes performance if the JIT compiler fails to inline the property accessor – which can actually happen).

System Requirements

To deploy a program that uses the full Tektosyne library, or the precompiled assemblies in the Code Package, you need a Microsoft Windows system capable of running the Microsoft .NET Framework 4.0 Client Profile. This includes Windows XP SP3, Windows Vista SP1 or later, Windows 7, Windows Server 2003 SP2, and Windows Server 2008 & R2 with Internet Explorer 5.01 or later.

To create a program that uses the full Tektosyne library, you also need either Microsoft Visual Studio 2010 or the free Microsoft Windows SDK 7.1 for Windows 7 and .NET 4.0. Both have the same system requirements as the .NET Framework 4.0 itself, but the Windows SDK also requires that you first install the full .NET Framework 4.0 – not just the Client Profile.

The Code Package also includes a suite of unit tests. You will need the free NUnit unit testing framework if you wish to run them.

Tektosyne.Core Requirements

Tektosyne.Core requires only four BCL assemblies: mscorlib.dll, System.dll, System.Core.dll, and System.Xml.dll. These four “core” assemblies are the minimum requirement for a Portable Class Library, and they are also supported by Mono. All Tektosyne.Core types should therefore work on any platform with any degree of .NET 4 compatibility, including Silverlight 4, Windows Phone 7, and XNA Framework 4.

Note: The Tektosyne.Core project and precompiled assembly in the download package is not actually a Portable Class Library, as Microsoft has yet to finalize this feature. Therefore, unless you’re targeting the .NET Framework 4 on Windows, you will have to create a new project for Tektosyne.Core with the desired target environment, and copy the individual source code files to the new project.

Windows 8 Metro. The Tektosyne.Core library is currently not compatible with the .NET subset that is available to Metro apps. The current Windows 8 Developer Preview removes an amazing number of types and methods from the full BCL, including ones that are required by the Portable Class Library definition and even by .NET design guidelines. The sheer amount of changes is baffling and seemingly pointless; I can only hope that the final release of Windows 8 will add back some of the missing features. Until then, you’ll have to manually change any non-conforming Tektosyne code if you want to build Metro apps.

Update 2011-11-20. Microsoft now appears to be reducing the feature set of Portable Class Libraries to match that of the Metro BCL, rather than expanding the Metro feature set to cover the four “core” BCL assemblies. This is very annoying and may prevent me from converting Tektosyne.Core to a Portable Class Library, given how extremely restrictive Metro is. We won’t know for sure until Windows 8 is released, however.

Project Information

Consult the following links for more information on the Tektosyne library. Copies of the ReadMe and WhatsNew files are included with the code package.

  • The ReadMe file contains the copyright notice and technical details on the project.
  • The WhatsNew file contains the annotated version history of the project.

We also have some executables that show the Tektosyne library in action:

  • The Code Package itself contains a small test program for various features, called Tektosyne.GuiTest.
  • Hexkit is a larger application that exercises most Tektosyne classes, although largely excluding computational geometry. The Hexkit User’s Guide describes the PolygonGrid class which is the basis for Hexkit’s game maps.

Tektosyne.GuiTest contains a useful feature that helps with the creation of tiled maps based on real-world terrain. Choose Geometry: Save & Print Grid to show a dialog that allows you to save or print grids of arbitrary size that are composed of squares or hexagons of any side length and orientation.

You can print a grid on transparent film and overlay it on an atlas page to determine your map layout, or you can save a grid to a PNG file and use your favorite paint program to superimpose it on an image file with your real-world map. This is how I created the “Roman Empire” and “Battle of Crécy” demo scenarios that ship with Hexkit.

Download Files

The current version of the Tektosyne library is 5.5.6, released on 09 January 2012.

Code Package

The current code package is Tektosyne.zip (1.17 MB). This is a standard ZIP archive containing subdirectories and long file names. The archive includes all source code files, the XML documentation file generated by the C# compiler, and the library and test projects precompiled in release mode.

User’s Guide

The current User’s Guide is TektosyneGuide.pdf (398 KB). This guide presents an overview of the library’s contents, organized into thematically related groups. Unusual features such as the graph algorithms are covered in greater detail.

The current version is 1.02, released on 09 January 2012. You need the free Adobe Reader, available at the Adobe website, to view or print this PDF document.

Class Reference

The current class reference is TektosyneClasses.chm (6.69 MB). This file was created from XML source code comments using the free Sandcastle help compiler. To view the class reference, you need Microsoft’s HTML Help Viewer (which should be present on most systems).

What’s up with the silly name?

Hey, do you have any idea how hard it is to come up with a pretentious Greek name that isn’t already taken?

The project was originally called the “Toolbox Libary” for the .NET Framework. Unfortunately, this was not a very distinctive name. You couldn’t use the library with any project that defined its own Toolbox namespace (not inconceivable by any means), and some people even thought the library was related to the Toolbox window of the Visual Studio IDE.

Tektosyne is sufficiently unique to avoid such confusion. Moreover, ή τεκτοσυνη (hē tektosynē) means “the art of building” which seems not entirely inappropriate for a toolbox library.


This page was last updated on 09 January 2012.
Current version available at http://www.kynosarges.org/