예제 #1
0
        /// <summary>
        /// Used by the JSON.stringify to transform objects prior to serialization.
        /// </summary>
        /// <param name="thisObj"> The object that is being operated on. </param>
        /// <param name="key"> Unused. </param>
        /// <returns> The date as a serializable string. </returns>
        public static object ToJSON(ObjectInstance thisObj, string key)
        {
            var number = TypeConverter.ToPrimitive(thisObj, PrimitiveTypeHint.Number);

            if (number is double && (double.IsInfinity((double)number) || double.IsNaN((double)number)))
            {
                return(Null.Value);
            }
            return(thisObj.CallMemberFunction("toISOString"));
        }
예제 #2
0
파일: Hashlinks.cs 프로젝트: hollow87/Zorbo
        public object Decode(object a, ObjectInstance b)
        {
            if (b is Hashlink)
            {
                return(((Hashlink)b).Decode(a));
            }

            else if (b.Prototype is Hashlink)
            {
                return(b.CallMemberFunction("decode", a));
            }

            return(null);
        }
예제 #3
0
파일: Hashlinks.cs 프로젝트: hollow87/Zorbo
        public string Encode(ObjectInstance a)
        {
            if (a is Hashlink)
            {
                return(((Hashlink)a).Encode());
            }

            else if (a.Prototype is Hashlink)
            {
                return(TypeConverter.ConvertTo <string>(Engine, a.CallMemberFunction("encode", a)));
            }

            return(string.Empty);
        }