public SerializationContext(TypeModelRegistry typeModelRegistry, object rootObject, FlatBufferBuilder builder)
 {
     _typeModelRegistry = typeModelRegistry;
     _rootObject        = rootObject;
     _rootTypeModel     = _typeModelRegistry.GetTypeModel(rootObject.GetType());
     _builder           = builder;
 }
Exemplo n.º 2
0
 internal TypeModel(TypeModelRegistry registry, string typeName, Type clrType, BaseType baseType, BaseType elementType = BaseType.None)
 {
     _registry    = registry;
     _typeName    = typeName;
     _clrType     = clrType;
     _baseType    = baseType;
     _elementType = elementType;
     _isEnum      = typeof(Enum).IsAssignableFrom(_clrType) && _baseType != BaseType.Union;
 }
        /// <summary>
        /// Initializes an instance of the FlatBuffersSchemaTypeWriter class
        /// </summary>
        /// <param name="typeModelRegistry">TypeRegistry to use as the Type source</param>
        /// <param name="writer">TextWriter write the schema to</param>
        /// /// <param name="options">Options to use when writing the schema</param>
        public FlatBuffersSchemaTypeWriter(TypeModelRegistry typeModelRegistry, TextWriter writer, FlatBuffersSchemaTypeWriterOptions options)
        {
            _typeModelRegistry = typeModelRegistry;
            _writer            = writer;
            _options           = options;

            var newline = options.LineTerminator == FlatBuffersSchemaWriterLineTerminatorType.Lf ? "\n" : "\r\n";

            _writer.NewLine = newline;

            _indent  = new string(_options.IndentType == FlatBuffersSchemaWriterIndentType.Spaces ? ' ' : '\t', _options.IndentCount);
            _bracing = _options.BracingStyle == FlatBuffersSchemaWriterBracingStyle.Egyptian ? " {" : string.Format("{0}{{", newline);
        }
 public DeserializationContext(TypeModelRegistry typeModelRegistry, Type rootObjectType, ByteBuffer buffer)
 {
     _typeModelRegistry = typeModelRegistry;
     _rootTypeModel     = _typeModelRegistry.GetTypeModel(rootObjectType);
     _buffer            = buffer;
 }
 /// <summary>
 /// Initializes an instance of the <see cref="FlatBuffersSerializer"/> class
 /// </summary>
 /// <param name="typeModelRegistry"><see cref="TypeModelRegistry"/> used for type resolution</param>
 public FlatBuffersSerializer(TypeModelRegistry typeModelRegistry)
 {
     _typeModelRegistry = typeModelRegistry;
 }
 /// <summary>
 /// Initializes an instance of the <see cref="FlatBuffersSchemaGenerator"/> class
 /// </summary>
 /// <param name="typeModelRegistry">The <see cref="TypeModelRegistry"/> used to resolve <see cref="Type"/> into <see cref="TypeModel"/></param>
 public FlatBuffersSchemaGenerator(TypeModelRegistry typeModelRegistry)
 {
     _typeModelRegistry = typeModelRegistry;
 }
 internal FlatBuffersSchema(TypeModelRegistry typeModelRegistry)
 {
     _typeModelRegistry = typeModelRegistry;
 }