| 1109 | } |
| 1110 | |
| 1111 | static void SetAt(Nan::NAN_METHOD_ARGS_TYPE info) { |
| 1112 | HandleScope scope; |
| 1113 | |
| 1114 | if (!NodeRT::Utils::IsWinRtWrapperOf< |
| 1115 | ::Windows::Foundation::Collections::IVector<T> ^>(info.This())) { |
| 1116 | return; |
| 1117 | } |
| 1118 | |
| 1119 | VectorWrapper<T>* wrapper = |
| 1120 | VectorWrapper<T>::Unwrap<VectorWrapper<T>>(info.This()); |
| 1121 | |
| 1122 | if (info.Length() == 2 && info[0]->IsUint32() && |
| 1123 | wrapper->_checkTypeFunc(info[1])) { |
| 1124 | try { |
| 1125 | unsigned int index = info[0]->Uint32Value(); |
| 1126 | |
| 1127 | if (index >= wrapper->_instance->Size) { |
| 1128 | return; |
| 1129 | } |
| 1130 | |
| 1131 | T item = wrapper->_convertToTypeFunc(info[1]); |
| 1132 | |
| 1133 | wrapper->_instance->SetAt(index, item); |
| 1134 | } catch (Platform::Exception ^ exception) { |
| 1135 | NodeRT::Utils::ThrowWinRtExceptionInJs(exception); |
| 1136 | return; |
| 1137 | } |
| 1138 | } else { |
| 1139 | Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString( |
| 1140 | L"Bad arguments: no suitable overload found"))); |
| 1141 | return; |
| 1142 | } |
| 1143 | |
| 1144 | return; |
| 1145 | } |
| 1146 | |
| 1147 | static void First(Nan::NAN_METHOD_ARGS_TYPE info) { |
| 1148 | HandleScope scope; |