Exemple #1
0
        //When the name is 'FromJson' and argument is identical, it's used automatically.
        static object FromJson(System.Type type, FastJson.JsonParser parser)
        {
            CipherInt i = new CipherInt();

            i.value = (int)(parser.ReadUInt32() ^ 0x12345678U);
            return(i);
        }
Exemple #2
0
        //When the name is 'ToJson' and argument is identical, it's used automatically.
        static void ToJson(StringBuilder sb, object obj)
        {
            CipherInt i = (CipherInt)obj;
            uint      n = (uint)i.value ^ 0x12345678U;

            sb.Append(n.ToString());
        }
Exemple #3
0
    void Start()
    {
        CipherInt i = new CipherInt();

        i.value = 123;

        string json = FastJson.Serialize(i);

        Debug.Log(json);

        CipherInt d = FastJson.Deserialize <CipherInt>(json);

        Debug.Log(d.value);
    }