// based on default .NET ToString implementation (write the full name of data type). static void DefaultWriter(T Value, char *Buffer, ref int BufferLength) { if (s_TypeName == null) { var Type = typeof(T); s_TypeName = Type.Name; s_TypeNamesspace = Type.Namespace; } if (!string.IsNullOrEmpty(s_TypeNamesspace)) { StringStream.Write(s_TypeNamesspace, Buffer, ref BufferLength); Buffer[BufferLength++] = '.'; } StringStream.Write(s_TypeName, Buffer, ref BufferLength); }
public static void WriteFracPart(float FracPart, char *Buffer, ref int BufferLength, int MinDecimalDigits = 0, int MaxDecimalDigits = int.MaxValue) { var NumberFormat = CultureInfo.CurrentCulture.NumberFormat; int DecimalDigtis = 0; if (FracPart > 0) { StringStream.Write(NumberFormat.NumberDecimalSeparator, Buffer, ref BufferLength); int DecimalSeparatorIndex = BufferLength; int Exponent = 10; float TmpFracPart = FracPart; while (TmpFracPart > 0) { DecimalDigtis++; if (DecimalDigtis > MaxDecimalDigits) { return; } TmpFracPart = Modf(FracPart * Exponent, out int IntPart); Buffer[BufferLength++] = (char)((IntPart % 10) + '0'); Exponent *= 10; } } while (DecimalDigtis < MinDecimalDigits) { DecimalDigtis++; Buffer[BufferLength++] = '0'; } }
public static void WriteNegativeSign(char *Buffer, ref int BufferLength) { var NumberFormat = CultureInfo.CurrentCulture.NumberFormat; StringStream.Write(NumberFormat.NegativeSign, Buffer, ref BufferLength); }
public void Write(char *Buffer, ref int BufferLength) { StringStream.Write(Field, Buffer, ref BufferLength); }