//
// DatEntry.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace NosSmooth.Data.NOSFiles.Parsers.Dat;
///
/// An entry for a .
///
public struct DatEntry
{
private readonly IReadOnlyList _data;
///
/// Initializes a new instance of the struct.
///
/// The key of the entry.
/// The data of the entry.
public DatEntry(string key, IReadOnlyList data)
{
Key = key;
_data = data;
}
///
/// Gets the key of the entry.
///
public string Key { get; }
///
/// Read a value on the given index.
///
/// The index to read at.
/// The type.
/// Read value.
public T Read(int index)
{
return (T)Convert.ChangeType(_data[index], typeof(T));
}
///
/// Get the values of the current entry.
///
///
/// Skips the header.
///
/// An array with the values.
public string[] GetValues()
{
return _data.Skip(1).ToArray();
}
}