IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
Archive.cs
Go to the documentation of this file.
1using System.Runtime.InteropServices;
4using Microsoft.Win32.SafeHandles;
5
7
38public class Archive : ArchiveBase, IDisposable, IHasSafeHandle
39{
40 private static readonly Dictionary<Backend.Types.peak_icv_archive_value_type, ArchiveValueKind> _sValueKindMap =
41 new()
42 {
43 { Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_BOOL, ArchiveValueKind.Bool },
44 {
45 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_BOOL_ARRAY,
46 ArchiveValueKind.BoolArray
47 },
48 { Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_INT, ArchiveValueKind.Int64 },
49 {
50 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_INT_ARRAY,
51 ArchiveValueKind.Int64Array
52 },
53 {
54 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_DOUBLE,
55 ArchiveValueKind.Double
56 },
57 {
58 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_DOUBLE_ARRAY,
59 ArchiveValueKind.DoubleArray
60 },
61 {
62 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_STRING,
63 ArchiveValueKind.String
64 },
65 {
66 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_STRING_ARRAY,
67 ArchiveValueKind.StringArray
68 },
69 {
70 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_ARCHIVE,
71 ArchiveValueKind.Archive
72 },
73 {
74 Backend.Types.peak_icv_archive_value_type.PEAK_ICV_ARCHIVE_VALUE_TYPE_ARCHIVE_ARRAY,
75 ArchiveValueKind.ArchiveArray
76 }
77 };
78
79 private bool _disposed;
80
81 internal Handle _handle;
82
83 internal Archive(Handle handle)
84 {
85 _handle = handle;
86 }
87
95 public Archive()
96 {
97 var handle = new Handle();
98 DllHelper.ExecuteAndMapReturnCodes(() =>
99 CInterface.peak_icv_Archive_Create(ref handle));
100 _handle = handle;
101 }
102
107 public void Dispose()
108 {
109 if (_disposed)
110 {
111 return;
112 }
113
114 _disposed = true;
115 _handle.Dispose();
116 GC.SuppressFinalize(this);
117 }
118
119 SafeHandle IHasSafeHandle.Handle => _handle;
120
131 public override bool HasKey(string key)
132 {
133 var hasKey = false;
134 DllHelper.ExecuteAndMapReturnCodes(() =>
135 CInterface.peak_icv_Archive_HasKey(_handle, Utils.ToUtf8(key), ref hasKey));
136 return hasKey;
137 }
138
149 public override ArchiveValueKind GetValueKind(string key)
150 {
151 var type = 0;
152 DllHelper.ExecuteAndMapReturnCodes(() =>
153 CInterface.peak_icv_Archive_GetValueType(_handle, Utils.ToUtf8(key), ref type));
154
155 return _sValueKindMap[(Backend.Types.peak_icv_archive_value_type) type];
156 }
157
165 public override IReadOnlyList<string> GetKeys()
166 {
167 nuint keyCount = 0;
168 DllHelper.ExecuteAndMapReturnCodes(() =>
169 CInterface.peak_icv_Archive_GetKeys_GetCount(_handle, ref keyCount));
170
171 var list = new List<string>((int) keyCount);
172
173 for (nuint i = 0; i < keyCount; i++)
174 {
175 nuint elementSize = 0;
176 nuint i1 = i;
177 DllHelper.ExecuteAndMapReturnCodes(() =>
178 CInterface.peak_icv_Archive_GetKeysElement_GetSizeInBytes(_handle, i1, ref elementSize));
179
180 var data = new byte[elementSize];
181 DllHelper.ExecuteAndMapReturnCodes(() =>
182 CInterface.peak_icv_Archive_GetKeysElement(_handle, i1, data, elementSize));
183
184 list.Add(Utils.FromUtf8(data));
185 }
186
187 return list;
188 }
189
200 public override void SetBool(string key, bool value)
201 {
202 DllHelper.ExecuteAndMapReturnCodes(() =>
203 CInterface.peak_icv_Archive_SetBool(_handle, Utils.ToUtf8(key), value));
204 }
205
216 public override bool GetBool(string key)
217 {
218 var value = false;
219 DllHelper.ExecuteAndMapReturnCodes(() =>
220 CInterface.peak_icv_Archive_GetBool(_handle, Utils.ToUtf8(key), ref value));
221 return value;
222 }
223
234 public override void SetInt64(string key, long value)
235 {
236 DllHelper.ExecuteAndMapReturnCodes(() =>
237 CInterface.peak_icv_Archive_SetInt(_handle, Utils.ToUtf8(key), value));
238 }
239
250 public override long GetInt64(string key)
251 {
252 long value = 0;
253 DllHelper.ExecuteAndMapReturnCodes(() =>
254 CInterface.peak_icv_Archive_GetInt(_handle, Utils.ToUtf8(key), ref value));
255 return value;
256 }
257
268 public override void SetDouble(string key, double value)
269 {
270 DllHelper.ExecuteAndMapReturnCodes(() =>
271 CInterface.peak_icv_Archive_SetDouble(_handle, Utils.ToUtf8(key), value));
272 }
273
284 public override double GetDouble(string key)
285 {
286 double value = 0;
287 DllHelper.ExecuteAndMapReturnCodes(() =>
288 CInterface.peak_icv_Archive_GetDouble(_handle, Utils.ToUtf8(key), ref value));
289 return value;
290 }
291
302 public override void SetString(string key, string value)
303 {
304 DllHelper.ExecuteAndMapReturnCodes(() =>
305 CInterface.peak_icv_Archive_SetString(_handle, Utils.ToUtf8(key), Utils.ToUtf8(value)));
306 }
307
318 public override string GetString(string key)
319 {
320 nuint size = 0;
321 var utf8Key = Utils.ToUtf8(key);
322 DllHelper.ExecuteAndMapReturnCodes(() =>
323 CInterface.peak_icv_Archive_GetString_GetSizeInBytes(_handle, utf8Key, ref size));
324
325 var data = new byte[size];
326 DllHelper.ExecuteAndMapReturnCodes(() =>
327 CInterface.peak_icv_Archive_GetString(_handle, utf8Key, data, size));
328
329 return Utils.FromUtf8(data);
330 }
331
345 public override void SetArchive(string key, IArchive value)
346 {
347 if (value is not Archive arch)
348 {
349 throw new IcvNullPointerException("Given archive or archive type is invalid.");
350 }
351
352 DllHelper.ExecuteAndMapReturnCodes(() =>
353 CInterface.peak_icv_Archive_SetArchive(_handle, Utils.ToUtf8(key), arch._handle));
354 }
355
366 public override IArchive GetArchive(string key)
367 {
368 var subArchiveHandle = new Handle();
369 DllHelper.ExecuteAndMapReturnCodes(() =>
370 CInterface.peak_icv_Archive_GetArchive(_handle, Utils.ToUtf8(key), ref subArchiveHandle));
371 return new Archive(subArchiveHandle);
372 }
373
386 public override int GetArrayCount(string key)
387 {
388 return GetArrayCount(Utils.ToUtf8(key));
389 }
390
391 private int GetArrayCount(byte[] key)
392 {
393 nuint count = 0;
394 DllHelper.ExecuteAndMapReturnCodes(() =>
395 CInterface.peak_icv_Archive_GetArray_GetCount(_handle, key, ref count));
396 return (int) count;
397 }
398
409 public override void SetBoolArray(string key, IEnumerable<bool> value)
410 {
411 var array = value.ToArray() ?? throw new IcvNullPointerException(nameof(value));
412 var byteArray = array.Select(x => (byte) (x ? 1 : 0)).ToArray();
413
414 DllHelper.ExecuteAndMapReturnCodes(() =>
415 CInterface.peak_icv_Archive_SetBoolArray(_handle, Utils.ToUtf8(key), byteArray, (nuint) array.Length));
416 }
417
428 public override IReadOnlyList<bool> GetBoolArray(string key)
429 {
430 var utf8Key = Utils.ToUtf8(key);
431 var arrayCount = GetArrayCount(utf8Key);
432 var values = new byte[arrayCount];
433 DllHelper.ExecuteAndMapReturnCodes(() =>
434 CInterface.peak_icv_Archive_GetBoolArray(_handle, utf8Key, values, (nuint) arrayCount));
435 return values.Select(x => x > 0).ToList();
436 }
437
448 public override void SetInt64Array(string key, IEnumerable<long> value)
449 {
450 var array = value.ToArray() ?? throw new IcvNullPointerException(nameof(value));
451 DllHelper.ExecuteAndMapReturnCodes(() =>
452 CInterface.peak_icv_Archive_SetIntArray(_handle, Utils.ToUtf8(key), array, (nuint) array.Length));
453 }
454
465 public override IReadOnlyList<long> GetInt64Array(string key)
466 {
467 var utf8Key = Utils.ToUtf8(key);
468 var arrayCount = GetArrayCount(utf8Key);
469 var values = new long[arrayCount];
470 DllHelper.ExecuteAndMapReturnCodes(() =>
471 CInterface.peak_icv_Archive_GetIntArray(_handle, utf8Key, values, (nuint) arrayCount));
472 return values;
473 }
474
485 public override void SetDoubleArray(string key, IEnumerable<double> value)
486 {
487 var array = value.ToArray() ?? throw new IcvNullPointerException(nameof(value));
488 DllHelper.ExecuteAndMapReturnCodes(() =>
489 CInterface.peak_icv_Archive_SetDoubleArray(_handle, Utils.ToUtf8(key), array, (nuint) array.Length));
490 }
491
502 public override IReadOnlyList<double> GetDoubleArray(string key)
503 {
504 var utf8Key = Utils.ToUtf8(key);
505 var arrayCount = GetArrayCount(utf8Key);
506 var values = new double[arrayCount];
507 DllHelper.ExecuteAndMapReturnCodes(() =>
508 CInterface.peak_icv_Archive_GetDoubleArray(_handle, utf8Key, values, (nuint) arrayCount));
509 return values;
510 }
511
522 public override void SetStringArray(string key, IEnumerable<string> value)
523 {
524 List<string> values = value.ToList() ?? throw new IcvNullPointerException(nameof(value));
525
526 var stringPointers = new IntPtr[values.Count];
527 var allocatedStrings = new List<IntPtr>();
528
529 try
530 {
531 for (var i = 0; i < values.Count; i++)
532 {
533 var entry = values[i] ?? throw new IcvNullPointerException($"{nameof(values)}[{i}]");
534
535 var bytes = Utils.ToUtf8(entry);
536
537 IntPtr strPtr = Marshal.AllocHGlobal(bytes.Length);
538 Marshal.Copy(bytes, 0, strPtr, bytes.Length);
539
540 allocatedStrings.Add(strPtr);
541 stringPointers[i] = strPtr;
542 }
543
544 IntPtr arrayPtr = Marshal.AllocHGlobal(IntPtr.Size * values.Count);
545
546 try
547 {
548 Marshal.Copy(stringPointers, 0, arrayPtr, values.Count);
549
550 DllHelper.ExecuteAndMapReturnCodes(() =>
551 CInterface.peak_icv_Archive_SetStringArray(_handle, Utils.ToUtf8(key), arrayPtr,
552 (nuint) values.Count));
553 }
554 finally
555 {
556 Marshal.FreeHGlobal(arrayPtr);
557 }
558 }
559 finally
560 {
561 foreach (IntPtr ptr in allocatedStrings)
562 {
563 Marshal.FreeHGlobal(ptr);
564 }
565 }
566 }
567
578 public override IReadOnlyList<string> GetStringArray(string key)
579 {
580 var utf8Key = Utils.ToUtf8(key);
581 var arrayCount = GetArrayCount(utf8Key);
582 var values = new List<string>(arrayCount);
583
584 for (var i = 0; i < arrayCount; i++)
585 {
586 nuint length = 0;
587 var index = (nuint) i;
588
589 DllHelper.ExecuteAndMapReturnCodes(() => CInterface.peak_icv_Archive_GetStringArrayElement_GetSizeInBytes(
590 _handle, utf8Key, index,
591 ref length));
592
593 var data = new byte[length];
594 DllHelper.ExecuteAndMapReturnCodes(() =>
595 CInterface.peak_icv_Archive_GetStringArrayElement(_handle, utf8Key, index, data, length));
596 values.Add(Utils.FromUtf8(data));
597 }
598
599 return values;
600 }
601
618 public override void SetArchiveArray(string key, IEnumerable<IArchive> value)
619 {
620 List<IArchive> values = value.ToList() ?? throw new IcvNullPointerException(nameof(value));
621
622 IntPtr[] handles = SafeHandles.ExtractHandles(
623 values,
624 obj => obj is not Archive arch
625 ? throw new IcvNullPointerException("Invalid archive type in array.")
626 : arch._handle,
627 out Action release);
628 try
629 {
630 var utf8Key = Utils.ToUtf8(key);
631 DllHelper.ExecuteAndMapReturnCodes(() =>
632 {
633 unsafe
634 {
635 fixed (IntPtr* ptr = handles)
636 {
637 return (Backend.Types.peak_icv_status) CInterface.peak_icv_Archive_SetArchiveArray(_handle,
638 utf8Key, (IntPtr) ptr, (nuint) values.Count);
639 }
640 }
641 });
642 }
643 finally
644 {
645 release();
646 }
647 }
648
659 public override IReadOnlyList<IArchive> GetArchiveArray(string key)
660 {
661 var utf8Key = Utils.ToUtf8(key);
662 var arrayCount = GetArrayCount(utf8Key);
663
664 if (arrayCount == 0)
665 {
666 return Array.Empty<IArchive>();
667 }
668
669 var archivePointers = new IntPtr[arrayCount];
670 DllHelper.ExecuteAndMapReturnCodes(() =>
671 {
672 unsafe
673 {
674 fixed (IntPtr* ptr = archivePointers)
675 {
676 return (Backend.Types.peak_icv_status) CInterface.peak_icv_Archive_GetArchiveArray(_handle,
677 utf8Key, (IntPtr) ptr, (nuint) arrayCount);
678 }
679 }
680 });
681
682 return archivePointers.Select(x => new Archive(new Handle(x))).ToList();
683 }
684
692 public override IArchive CreateArchive()
693 {
694 var handle = new Handle();
695 DllHelper.ExecuteAndMapReturnCodes(() =>
696 CInterface.peak_icv_Archive_Create(ref handle));
697 return new Archive(handle);
698 }
699
700 internal sealed class Handle : SafeHandleZeroOrMinusOneIsInvalid
701 {
702 internal Handle() : base(true)
703 {
704 }
705
706 internal Handle(IntPtr handle) : base(true)
707 {
708 SetHandle(handle);
709 }
710
711 protected override bool ReleaseHandle()
712 {
713 Backend.Types.peak_icv_status ret = CInterface.peak_icv_Archive_Destroy(handle);
714 return ret == 0;
715 }
716 }
717
718 private static class CInterface
719 {
720 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
721 public static extern Backend.Types.peak_icv_status peak_icv_Archive_Create(ref Handle archiveHandle);
722
723 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
724 public static extern Backend.Types.peak_icv_status peak_icv_Archive_Destroy(IntPtr archiveHandle);
725
726 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
727 public static extern Backend.Types.peak_icv_status peak_icv_Archive_HasKey(Handle archiveHandle,
728 byte[] key,
729 [MarshalAs(UnmanagedType.I1)] ref bool hasKey);
730
731 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
732 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetKeys_GetCount(
733 Handle archiveHandle, ref nuint size);
734
735 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
736 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetKeysElement_GetSizeInBytes(
737 Handle archiveHandle, nuint index, ref nuint size);
738
739 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
740 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetKeysElement(
741 Handle archiveHandle, nuint index, byte[] data, nuint size);
742
743 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
744 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetValueType(
745 Handle archiveHandle, byte[] key, ref int type);
746
747 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
748 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetArray_GetCount(
749 Handle archiveHandle, byte[] key, ref nuint count);
750
751 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
752 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetInt(
753 Handle archiveHandle, byte[] key, ref long value);
754
755 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
756 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetInt(
757 Handle archiveHandle, byte[] key, long value);
758
759 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
760 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetIntArray(
761 Handle archiveHandle, byte[] key, long[] values, nuint size);
762
763 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
764 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetIntArray(
765 Handle archiveHandle, byte[] key, long[] values, nuint size);
766
767 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
768 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetDouble(
769 Handle archiveHandle, byte[] key, ref double value);
770
771 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
772 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetDouble(
773 Handle archiveHandle, byte[] key, double value);
774
775 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
776 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetDoubleArray(
777 Handle archiveHandle, byte[] key, double[] values, nuint size);
778
779 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
780 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetDoubleArray(
781 Handle archiveHandle, byte[] key, double[] values, nuint size);
782
783 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
784 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetBool(
785 Handle archiveHandle, byte[] key, [MarshalAs(UnmanagedType.I1)] ref bool value);
786
787 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
788 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetBool(
789 Handle archiveHandle, byte[] key, [MarshalAs(UnmanagedType.I1)] bool value);
790
791 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
792 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetBoolArray(
793 Handle archiveHandle, byte[] key,
794 byte[] values,
795 nuint size);
796
797 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
798 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetBoolArray(
799 Handle archiveHandle, byte[] key,
800 byte[] values,
801 nuint size);
802
803 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
804 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetString_GetSizeInBytes(
805 Handle archiveHandle, byte[] key, ref nuint size);
806
807 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
808 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetString(
809 Handle archiveHandle, byte[] key, byte[] data, nuint size);
810
811 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
812 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetString(
813 Handle archiveHandle, byte[] key, byte[] data);
814
815 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
816 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetStringArrayElement_GetSizeInBytes(
817 Handle archiveHandle, byte[] key, nuint index, ref nuint size);
818
819 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
820 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetStringArrayElement(
821 Handle archiveHandle, byte[] key, nuint index, byte[] data, nuint size);
822
823 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
824 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetStringArray(
825 Handle archiveHandle, byte[] key, IntPtr data, nuint size);
826
827 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
828 public static extern Backend.Types.peak_icv_status peak_icv_Archive_GetArchive(
829 Handle archiveHandle, byte[] key, ref Handle subArchive);
830
831 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
832 public static extern Backend.Types.peak_icv_status peak_icv_Archive_SetArchive(
833 Handle archiveHandle, byte[] key, Handle subArchive);
834
835 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
836 public static extern int peak_icv_Archive_GetArchiveArray(
837 Handle archiveHandle,
838 byte[] key,
839 IntPtr subArchiveHandles,
840 nuint size);
841
842 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
843 public static extern int peak_icv_Archive_SetArchiveArray(
844 Handle archiveHandle,
845 byte[] key,
846 IntPtr subArchiveHandles,
847 nuint size);
848 }
849}
Base class for IArchive implementations.
Occurs when attempting to access an object or value via an uninitialized or null pointer.
Definition Exception.cs:115
A key-value store that implements the IArchive interface.
Definition Archive.cs:39
override void SetInt64Array(string key, IEnumerable< long > value)
Sets an array of integer values.
Definition Archive.cs:448
override long GetInt64(string key)
Returns the integer value.
Definition Archive.cs:250
override IReadOnlyList< long > GetInt64Array(string key)
Returns the array of integer values.
Definition Archive.cs:465
override IReadOnlyList< string > GetKeys()
Returns all keys stored in the archive.
Definition Archive.cs:165
override IReadOnlyList< bool > GetBoolArray(string key)
Returns the array of boolean values.
Definition Archive.cs:428
override IReadOnlyList< double > GetDoubleArray(string key)
Returns the array of double precision floating point values.
Definition Archive.cs:502
override void SetInt64(string key, long value)
Sets an integer value.
Definition Archive.cs:234
override void SetArchiveArray(string key, IEnumerable< IArchive > value)
Sets an array of nested archives.
Definition Archive.cs:618
void Dispose()
Releases all resources used by the Archive class.
Definition Archive.cs:107
override void SetString(string key, string value)
Sets a string value.
Definition Archive.cs:302
override void SetDouble(string key, double value)
Sets a double precision floating point value.
Definition Archive.cs:268
override IArchive CreateArchive()
Creates a new archive instance.
Definition Archive.cs:692
override double GetDouble(string key)
Returns the double precision floating point value.
Definition Archive.cs:284
override bool GetBool(string key)
Returns the boolean value.
Definition Archive.cs:216
Archive()
Constructs an empty Archive instance.
Definition Archive.cs:95
override void SetBoolArray(string key, IEnumerable< bool > value)
Sets an array of boolean values.
Definition Archive.cs:409
override IReadOnlyList< IArchive > GetArchiveArray(string key)
Returns the array of nested archives.
Definition Archive.cs:659
override void SetStringArray(string key, IEnumerable< string > value)
Sets an array of string values.
Definition Archive.cs:522
override void SetDoubleArray(string key, IEnumerable< double > value)
Sets an array of double precision floating point values.
Definition Archive.cs:485
override bool HasKey(string key)
Checks whether a key exists in the archive.
Definition Archive.cs:131
override IArchive GetArchive(string key)
Returns the nested archive.
Definition Archive.cs:366
override int GetArrayCount(string key)
Returns the number of elements in an array value.
Definition Archive.cs:386
override ArchiveValueKind GetValueKind(string key)
Returns the kind of value stored under a key.
Definition Archive.cs:149
override void SetArchive(string key, IArchive value)
Sets a nested archive.
Definition Archive.cs:345
override string GetString(string key)
Returns the string value.
Definition Archive.cs:318
override IReadOnlyList< string > GetStringArray(string key)
Returns the array of string values.
Definition Archive.cs:578
override void SetBool(string key, bool value)
Sets a boolean value.
Definition Archive.cs:200
ArchiveValueKind
Represents the type of value stored in an IArchive.
Definition IArchive.cs:34
Represents a hierarchical, strongly-typed key-value archive.
Definition IArchive.cs:79