public ClassDescriber(Type type, IDescribersFinder finder) { _Default = null; _Type = type; _TypeSet = finder; _Fields = (from field in _Type.GetFields() where field.IsStatic == false && field.IsPublic orderby field.Name select field).ToArray(); }
public TypeIdentifier(Type type, IDescribersFinder finder) { if (_IsPoint(type)) { Describers = new ITypeDescriber[0]; } else if (_IsDelegate(type)) { Describers = new ITypeDescriber[0]; } else if (_IsEnum(type)) { Describers = new[] { new EnumDescriber(type) }; } else if (_IsNumber(type)) { Describers = new[] { new NumberDescriber(type) }; } else if (_IsByteArray(type)) { NumberDescriber byteDescriber = new NumberDescriber(typeof(int)); Describers = new ITypeDescriber[] { new ByteArrayDescriber(byteDescriber), byteDescriber }; } else if (_IsBuffer(type)) { Describers = new ITypeDescriber[] { new BufferDescriber(type) }; } else if (_IsBittable(type)) { Describers = new ITypeDescriber[] { new BlittableDescriber(type) }; } else if (_IsString(type)) { BufferDescriber chars = new BufferDescriber(typeof(char[])); Describers = new ITypeDescriber[] { new StringDescriber(chars), chars }; } else if (_IsArray(type)) { Describers = new ITypeDescriber[] { new ArrayDescriber(type, finder) }; } else if (_IsClass(type)) { Describers = new ITypeDescriber[] { new ClassDescriber(type, finder) }; } else { throw new Exception("Unrecognized type " + type.FullName); } }
public ArrayDescriber(Type type, IDescribersFinder finder) { _TypeSet = finder; _Default = null; _Type = type; var elementType = type.GetElementType(); try { if (!elementType.IsClass) { _DefaultElement = Activator.CreateInstance(elementType); } else { _DefaultElement = null; } } catch (Exception ex) { throw new DescriberException(typeof(ArrayDescriber), _Type, "_DefaultElement", ex); } }
public DescriberProvider(IKeyDescriber key_describer, IDescribersFinder type_finder) { KeyDescriber = key_describer; TypeDescriberFinders = type_finder; }
public DescriberProvider(IDescribersFinder finder) : this(finder.Get(), finder) { }
public StringKeyDescriber(ITypeFinder type_finder, IDescribersFinder describers_finder) { _TypeFinder = type_finder; _TypeDescriber = describers_finder.Get(typeof(string)); }