public override string GenerateSerializerCode(Type type)
    {
        var fields = ClassFieldFilter.GetClassFieldInfo(type);

        return(GenSerializerClassCodeByTemplate(
                   type,
                   FieldReferencedTypes(fields).Union(TypeNameReferencedTypes(type)).ToArray(),
                   string.Format("new {0}()", type.Name),
                   GenFieldReadCode(fields),
                   GenFieldWriteCode(fields)));
    }
    public override bool inspect(ref object data, Type type, string name, string path)
    {
        var fields = ClassFieldFilter.GetClassFieldInfo(type);
        //inspect the fields
        bool changed = false;

        foreach (var fieldinfo in fields)
        {
            object value     = fieldinfo.GetValue(data);
            Type   valueType = value != null?value.GetType() : fieldinfo.FieldType;

            if (DataInspectorUtility.inspect(ref value, valueType, fieldinfo.Name, path))
            {
                fieldinfo.SetValue(data, value);
                changed = true;
            }
        }
        return(changed);
    }
    public override Type[] DirectlyUsedTypesExcludeSelf(Type type)
    {
        var fields = ClassFieldFilter.GetClassFieldInfo(type);

        return(fields.Select(f => f.FieldType).ToArray());
    }