7 Commits

Author SHA1 Message Date
Matt Nadareski
ca58343c30 Bump version 2024-10-01 12:32:33 -04:00
Matt Nadareski
2f637e0012 Remove ValueTuple requirement 2024-10-01 01:41:43 -04:00
Matt Nadareski
80172942fd Mark extended TAR header info 2024-09-26 14:08:55 -04:00
Matt Nadareski
aa0960b42f Separate entry from archive in TAR 2024-09-26 13:45:49 -04:00
Matt Nadareski
2554f64277 Add layout for TAR header 2024-09-26 12:15:59 -04:00
Matt Nadareski
4c5c960915 Slight tweak to TAR header (nw) 2024-09-26 12:03:20 -04:00
Matt Nadareski
1cb49163dd Upate MinValueTupleBridge to 0.2.1 2024-09-25 10:46:16 -04:00
8 changed files with 103 additions and 41 deletions

View File

@@ -4,7 +4,7 @@ namespace SabreTools.Models.Charts
{
/// <see href="https://github.com/TheNathannator/GuitarGame_ChartFormats/tree/main/doc/FileFormats/song.ini"/>
/// <remarks>[song]/[Song]</remarks>
internal class SongIni
public class SongIni
{
#region Song/Chart Metadata

View File

@@ -0,0 +1,16 @@
namespace SabreTools.Models.Charts
{
/// <see href="https://github.com/TheNathannator/GuitarGame_ChartFormats/blob/main/doc/FileFormats/Other/Frets%20on%20Fire%20X/Careers.md"/>
public class Tier
{
/// <summary>
/// Display name of the tier.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Name used for associating a song with this tier, and for checking unlock requirements.
/// </summary>
public string? UnlockId { get; set; }
}
}

View File

@@ -1,10 +1,8 @@
using System.Collections.Generic;
namespace SabreTools.Models.Charts
{
/// <see href="https://github.com/TheNathannator/GuitarGame_ChartFormats/blob/main/doc/FileFormats/Other/Frets%20on%20Fire%20X/Careers.md"/>
/// <remarks>[titles]</remarks>
internal class TitlesIni
public class TitlesIni
{
/// <summary>
/// A space-separated list of .ini sections to include in the career.
@@ -13,9 +11,8 @@ namespace SabreTools.Models.Charts
public string[]? SectionList { get; set; }
/// <summary>
/// `name` - Display name of the tier.
/// `unlock_id` - Name used for associating a song with this tier, and for checking unlock requirements.
/// This entry points to other sections that should be used as part of the career.
/// </summary>
public Dictionary<string, (string? Name, string? UnlockId)>? Sections { get; set; }
public Tier[]? Sections { get; set; }
}
}

View File

@@ -6,7 +6,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.4.9</Version>
<Version>1.4.10</Version>
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
<!-- Package Properties -->
@@ -39,15 +39,6 @@
<None Include="../README.md" Pack="true" PackagePath="" />
</ItemGroup>
<!-- Support for old .NET versions -->
<ItemGroup
Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`))">
<PackageReference Include="MinValueTupleBridge" Version="0.2.0" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`))">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@@ -1,10 +1,12 @@
using System.Collections.Generic;
namespace SabreTools.Models.TAR
{
public sealed class Archive
{
/// <summary>
/// File header
/// 1 or more entries
/// </summary>
public Header? Header { get; set; }
public List<Entry>? Entries { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace SabreTools.Models.TAR
{
public sealed class Block
{
public readonly byte[] Data = new byte[512];
}
}

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace SabreTools.Models.TAR
{
public sealed class Entry
{
/// <summary>
/// Entry header
/// </summary>
public Header? Header { get; set; }
/// <summary>
/// 0 or more blocks representing the content
/// </summary>
public List<Block>? Blocks { get; set; }
}
}

View File

@@ -1,85 +1,117 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.TAR
{
/// <see href="https://www.ibm.com/docs/en/aix/7.3?topic=files-tarh-file"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// File name
/// File name without a forward slash
/// </summary>
public string? FileName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string? FileName;
/// <summary>
/// File mode
/// </summary>
public Mode Mode { get; set; }
/// <remarks>Octal string representation</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public byte[]? Mode;
/// <summary>
/// <summary>
/// Owner's numeric user ID
/// </summary>
public uint UID { get; set; }
/// <remarks>Octal string representation</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public byte[]? UID;
/// <summary>
/// Owner's numeric user ID
/// <summary>
/// Owner's numeric group ID
/// </summary>
public uint GID { get; set; }
/// <remarks>Octal string representation</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public byte[]? GID;
/// <summary>
/// File size in bytes
/// </summary>
public ulong Size { get; set; }
/// <remarks>Octal string representation</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public byte[]? Size;
/// <summary>
/// Last modification time in numeric Unix time format
/// </summary>
public ulong ModifiedTime { get; set; }
/// <remarks>Octal string representation</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public byte[]? ModifiedTime;
/// <summary>
/// Checksum for header record
/// </summary>
public ushort Checksum { get; set; }
/// <remarks>Octal string representation</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public byte[]? Checksum;
/// <summary>
/// Link indicator (file type) / Type flag
/// </summary>
public TypeFlag TypeFlag { get; set; }
public TypeFlag TypeFlag;
/// <summary>
/// Name of linked file
/// Linked path name or file name
/// </summary>
public string? LinkName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string? LinkName;
#region USTAR Extension
/// <summary>
/// UStar indicator, "ustar", then NUL
/// </summary>
public string? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)]
public string? Magic;
/// <summary>
/// UStar version, "00"
/// </summary>
public string? Version { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)]
public string? Version;
/// <summary>
/// Owner user name
/// </summary>
public string? UserName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string? UserName;
/// <summary>
/// Owner group name
/// </summary>
public string? GroupName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string? GroupName;
/// <summary>
/// Device major number
/// </summary>
public string? DevMajor { get; set; }
/// <remarks>Octal string representation(?)</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? DevMajor;
/// <summary>
/// Device minor number
/// </summary>
public string? DevMinor { get; set; }
/// <remarks>Octal string representation(?)</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? DevMinor;
/// <summary>
/// Filename prefix
/// Path name without trailing slashes
/// </summary>
public string? Prefix { get; set; }
/// <remarks>155 bytes</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 155)]
public string? Prefix;
#endregion
}
}