Code Style Guide¶
Code Layout¶
In general, Blitzableiter code follows the Intellisense suggestions from Microsoft Visual Studio. You can find the settings to import into Visual Studio here: BlitzableiterStyle.vssettings
Writing Your Own¶
Before you develop any new classes, especially for basic types, please check how the same functionality was implemented by others! Otherwise, we end up with 50 implementations of the same functionality in 59 different classes. Nobody wants to maintain that.
SWF Library¶
SWF Types to .NET Types¶
All things that get encoded in SWF are to be stored in native .NET platform types. Here are some examples:- UI32 becomes UInt32
- SI32 becomes Int32
- UI30 becomes UInt32
- Flags becomes bool
Reserved Fields¶
During parsing, we make sure that any reserved field has the value defined in the SWF specification. There is, however, no need to store reserved fields in the class representing the SWF element we currently parse. If the reserved field is supposed to be 0, verify it is during parsing and simply write a 0 during generation.
Exceptions¶
Any exception generated during the operation of the SWF library must be part of the SWF library. If, for example, an issue is detected during parsing, an SwfFormatException has to be thrown. Do not throw System type exceptions.
SwfFormatException ex = new SwfFormatException("your complaint here");
log.Error( ex );
throw ex;
Logging and log4net¶
Please check the log4net FAQ: http://logging.apache.org/log4net/release/faq.html
Custom appenders are best explained here: http://bytes.com/topic/net/answers/606523-how-can-i-create-custom-appender-log4net