public string Format(string format, params object[] args)
{
StringBuilder formatted = new StringBuilder ();
int? offset = 0;
while (offset != null) {
int lastOffset = offset.Value;
offset = FindStartMarker (offset.Value, format);
try {
if (offset != null) {
formatted.Append (format.Substring (lastOffset, offset.Value - lastOffset));
offset++;
string currentFormatPacket = GetFormatPacket (ref offset, format);
formatted.Append (FormatPacket (currentFormatPacket, args));
} else {
formatted.Append (format.Substring (lastOffset));
}
} catch (Exception) {
if (_throwException)
throw;
}
}
return formatted.ToString ();
}