Exemplo n.º 1
0
 public static void WriteMetaArrayData(this JsonHelperWriter json, string type, int size = -1)
 {
     json.WriteStartMetadata(META.ARRAYTYPE);
     json.WriteProperty(META.TYPE_FULLNAME, type);
     if (type == META.ARRAYTYPE_ARRAY)
     {
         json.WriteProperty(META.ARRAYTYPE_ARRAY_SIZE, size);
     }
     json.WriteEndMetadata();
 }
Exemplo n.º 2
0
    public static void WriteMetaExternal(this JsonHelperWriter json, string path, string @in = META.EXTERNAL_IN_RESOURCES)
    {
        json.WriteStartMetadata(META.EXTERNAL);

        if (@in != META.EXTERNAL_IN_RESOURCES)
        {
            json.WriteProperty(META.EXTERNAL_IN, @in);
        }
        json.WriteProperty(META.EXTERNAL_PATH, path);

        json.WriteEndMetadata();
    }
Exemplo n.º 3
0
    public static bool TryWriteMetaReference(this JsonHelperWriter json, object obj, bool register = false)
    {
        int id = json.GetReferenceID(obj);

        if (id != META.REF_NONE)
        {
            json.WriteStartMetadata(META.REF);

            json.WriteProperty(META.REF_ID, id);
            json.WriteProperty(META.REF_TYPE, json.GetReferenceType(id, obj));

            json.WriteEndMetadata();
            return(true);
        }

        if (register)
        {
            json.RegisterReference(obj);
        }
        return(false);
    }
Exemplo n.º 4
0
    private static void WriteMetaType_(this JsonHelperWriter json, Type type, string metaType)
    {
        json.WriteStartMetadata(metaType);

        json.WriteProperty(META.TYPE_FULLNAME, type.FullName);

        /*string ns = type.Namespace;
         * if (ns != null) {
         *  json.WritePropertyName(META.TYPE_SPLIT);
         *  json.WriteStartArray();
         *  json.Write(ns);
         *  json.Write(type.Name);
         *  json.WriteEndArray();
         * }*/
        Type[] genparams = type.GetGenericArguments();
        if (genparams.Length != 0)
        {
            json.WriteProperty(META.TYPE_GENPARAMS, genparams);
        }

        json.WriteEndMetadata();
    }