| | | 1 | | //======================================================================= |
| | | 2 | | // RecordValues.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | namespace Chronicler; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Helper for reading and writing leaf values during a chronicler pass. |
| | | 12 | | /// </summary> |
| | | 13 | | public static class RecordValues |
| | | 14 | | { |
| | | 15 | | /// <inheritdoc cref="IChronicler.LookValue{T}(ref T, string, T)" path="/*[not(self::param)]"/> |
| | | 16 | | /// <param name="chronicler">The active pass supplied to <see cref="IRecordable.RecordData"/>.</param> |
| | | 17 | | /// <param name="value">The value to write on save. On load, receives the decoded value or the declared default for |
| | | 18 | | /// <param name="name">The stable field name shared by saving and loading.</param> |
| | | 19 | | /// <param name="defaultValue">The schema default. The built-in transports omit null values and values equal to this |
| | | 20 | | public static void Look<T>(IChronicler chronicler, ref T value, string name, T? defaultValue = default) |
| | | 21 | | { |
| | 224458 | 22 | | chronicler.LookValue(ref value, name, defaultValue); |
| | 224456 | 23 | | } |
| | | 24 | | } |