public void Write(MutagenWriter writer, int item, long length) { switch (length) { case 1: writer.Write((byte)item); break; case 2: writer.Write((ushort)item); break; case 4: writer.Write(item); break; default: throw new NotImplementedException(); } }
public void Dispose() { _tributary.Position = 0; if (_tributary.Length <= ushort.MaxValue) { using (HeaderExport.Subrecord(_writer, _mainRecord)) { _tributary.CopyTo(_writer.BaseStream); } } else { using (HeaderExport.Subrecord(_writer, _extraLengthRecord)) { _writer.Write(checked ((uint)_tributary.Length)); } _writer.Write(_mainRecord.TypeInt); _writer.WriteZeros(2); _tributary.CopyTo(_writer.BaseStream); } }
public void WriteNullable( MutagenWriter writer, ITranslatedStringGetter?item, StringBinaryType binaryType, StringsSource source) { if (item == null) { return; } if (writer.MetaData.StringsWriter == null) { writer.Write( item.String ?? string.Empty, binaryType: binaryType); } else { writer.Write(writer.MetaData.StringsWriter.Register(item, source)); } }
public void Write( MutagenWriter writer, string item, RecordType header, StringBinaryType binaryType = StringBinaryType.NullTerminate) { using (HeaderExport.Header(writer, header, ObjectType.Subrecord)) { writer.Write( item, binaryType: binaryType); } }
public void WriteNullable( MutagenWriter writer, string?item, StringBinaryType binaryType = StringBinaryType.NullTerminate) { if (item == null) { return; } writer.Write( item, binaryType: binaryType); }
public static void Write(MutagenWriter writer, float?item, FloatIntegerType integerType, double multiplier) { if (item == null) { return; } switch (integerType) { case FloatIntegerType.UInt: writer.Write((uint)Math.Round(item.Value / multiplier)); break; case FloatIntegerType.UShort: writer.Write((ushort)Math.Round(item.Value / multiplier)); break; case FloatIntegerType.Byte: writer.Write((byte)Math.Round(item.Value / multiplier)); break; default: throw new NotImplementedException(); } }
public void WriteNullable( MutagenWriter writer, string?item, RecordType header, StringBinaryType binaryType = StringBinaryType.NullTerminate) { if (item == null) { return; } using (HeaderExport.Header(writer, header, ObjectType.Subrecord)) { writer.Write( item, binaryType: binaryType); } }
public void Write( MutagenWriter writer, string item, RecordType header, StringBinaryType binaryType = StringBinaryType.NullTerminate) { try { using (HeaderExport.Header(writer, header, ObjectType.Subrecord)) { writer.Write( item, binaryType: binaryType); } } catch (Exception ex) { throw SubrecordException.Factory(ex, header); } }
public void WriteNullable( MutagenWriter writer, string?item, RecordType header, StringBinaryType binaryType = StringBinaryType.NullTerminate) { if (item == null) { return; } try { using (HeaderExport.Header(writer, header, ObjectType.Subrecord)) { writer.Write( item, binaryType: binaryType); } } catch (Exception ex) { throw SubrecordException.Enrich(ex, header); } }
public void Write( MutagenWriter writer, ReadOnlyMemorySlice <byte>?item, RecordType header, RecordType overflowRecord) { try { if (!item.HasValue) { return; } if (item.Value.Length > ushort.MaxValue) { using (HeaderExport.Subrecord(writer, overflowRecord)) { writer.Write(item.Value.Length); } using (HeaderExport.Subrecord(writer, header)) { } Write(writer, item.Value.Span); } else { using (HeaderExport.Subrecord(writer, header)) { Write(writer, item.Value.Span); } } } catch (Exception ex) { throw SubrecordException.Enrich(ex, header); } }
public void Write(MutagenWriter writer, ReadOnlySpan <byte> item) { writer.Write(item); }
public override void Write(MutagenWriter writer, RecordType item) { writer.Write(item.TypeInt); }
public override void Write(MutagenWriter writer, Color item) { writer.Write(item, ColorBinaryType.Alpha); }
public void Write( MutagenWriter writer, string item) { writer.Write(item, binaryType: StringBinaryType.NullTerminate); }
public override void Write(MutagenWriter writer, DateTime item) { writer.Write(new byte[4]); }
public override void Write(MutagenWriter writer, ushort item) { writer.Write(item); }
public override void Write(MutagenWriter writer, double item) { writer.Write(item); }
public override void Write(MutagenWriter writer, P3Int item) { writer.Write(item.X); writer.Write(item.Y); writer.Write(item.Z); }
public override void Write(MutagenWriter writer, P2Int16 item) { writer.Write(item.X); writer.Write(item.Y); }
public override void Write(MutagenWriter writer, MemorySlice <byte> item) { writer.Write(item); }
public override void Write(MutagenWriter writer, long item) { writer.Write(item); }
public void Write(MutagenWriter writer, ReadOnlyMemorySlice <byte> item) { writer.Write(item.Span); }