public static void ReadArgs <T1, T2>(this IJSValueReader reader, out T1 arg1, out T2 arg2)
        {
            bool success = reader.ValueType == JSValueType.Array;

            arg1 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T1>() : default(T1);
            arg2 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T2>() : default(T2);
            _    = success && reader.SkipArrayToEnd();
        }
        public static void ReadArgs <T1, T2, T3, T4, T5>(this IJSValueReader reader,
                                                         out T1 arg1, out T2 arg2, out T3 arg3, out T4 arg4, out T5 arg5)
        {
            bool success = reader.ValueType == JSValueType.Array;

            arg1 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T1>() : default(T1);
            arg2 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T2>() : default(T2);
            arg3 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T3>() : default(T3);
            arg4 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T4>() : default(T4);
            arg5 = reader.GetNextArrayItem(ref success) ? reader.ReadValue <T5>() : default(T5);
            _    = success && reader.SkipArrayToEnd();
        }
        public static bool SkipArrayToEnd(this IJSValueReader reader)
        {
            while (reader.GetNextArrayItem())
            {
                reader.ReadValue <JSValue>(); // Read and ignore the value
            }

            return(true);
        }
Ejemplo n.º 4
0
        private static List <JSValue> ReadArrayItems(IJSValueReader reader)
        {
            var items = new List <JSValue>();

            while (reader.GetNextArrayItem())
            {
                items.Add(ReadValue(reader));
            }

            return(items);
        }
 public static void ReadValue <T>(this IJSValueReader reader, out List <T> value)
 {
     value = new List <T>();
     if (reader.ValueType == JSValueType.Array)
     {
         while (reader.GetNextArrayItem())
         {
             value.Add(reader.ReadValue <T>());
         }
     }
 }
Ejemplo n.º 6
0
        private static JSValueArray InternalReadArrayFrom(IJSValueReader reader)
        {
            var jsArray = new JSValueArray();

            while (reader.GetNextArrayItem())
            {
                jsArray.Add(InternalReadFrom(reader));
            }

            return(jsArray);
        }
 public static bool GetNextArrayItem(this IJSValueReader reader, ref bool success)
 {
     return(success = success && reader.GetNextArrayItem());
 }