Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Set()

override void System.Data.Common.ObjectStorage.Set ( int recordNo,
object value )
inline

Definition at line 290 of file ObjectStorage.cs.

291 {
292 if (_nullValue == value)
293 {
294 _values[recordNo] = null;
295 return;
296 }
298 {
300 return;
301 }
302 Type type = value.GetType();
303 if (_dataType == typeof(Guid) && type == typeof(string))
304 {
305 _values[recordNo] = new Guid((string)value);
306 return;
307 }
308 if (_dataType == typeof(byte[]))
309 {
310 if (type == typeof(bool))
311 {
312 _values[recordNo] = BitConverter.GetBytes((bool)value);
313 return;
314 }
315 if (type == typeof(char))
316 {
317 _values[recordNo] = BitConverter.GetBytes((char)value);
318 return;
319 }
320 if (type == typeof(short))
321 {
322 _values[recordNo] = BitConverter.GetBytes((short)value);
323 return;
324 }
325 if (type == typeof(int))
326 {
327 _values[recordNo] = BitConverter.GetBytes((int)value);
328 return;
329 }
330 if (type == typeof(long))
331 {
332 _values[recordNo] = BitConverter.GetBytes((long)value);
333 return;
334 }
335 if (type == typeof(ushort))
336 {
337 _values[recordNo] = BitConverter.GetBytes((ushort)value);
338 return;
339 }
340 if (type == typeof(uint))
341 {
342 _values[recordNo] = BitConverter.GetBytes((uint)value);
343 return;
344 }
345 if (type == typeof(ulong))
346 {
347 _values[recordNo] = BitConverter.GetBytes((ulong)value);
348 return;
349 }
350 if (type == typeof(float))
351 {
352 _values[recordNo] = BitConverter.GetBytes((float)value);
353 return;
354 }
355 if (type == typeof(double))
356 {
357 _values[recordNo] = BitConverter.GetBytes((double)value);
358 return;
359 }
360 throw ExceptionBuilder.StorageSetFailed();
361 }
362 throw ExceptionBuilder.StorageSetFailed();
363 }
virtual bool IsInstanceOfType([NotNullWhen(true)] object? o)
Definition Type.cs:1020

References System.Data.Common.DataStorage._dataType, System.Data.Common.DataStorage._nullValue, System.Data.Common.ObjectStorage._values, System.Xml.Dictionary, System.BitConverter.GetBytes(), System.Type.GetType(), System.Data.Common.Guid, System.Type.IsInstanceOfType(), System.Data.ExceptionBuilder.StorageSetFailed(), System.type, and System.value.