This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGmadHeader.cs
78 lines (68 loc) · 2.52 KB
/
GmadHeader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace GmadFileFormat
{
/// <summary>
/// A GMAD addon file
/// </summary>
public readonly partial struct GmadHeader
{
/// <summary>
/// The information of the author that created this GMAD file
/// </summary>
public AuthorInfo Author { get; }
/// <summary>
/// The description of the addon in this GMAD file
/// </summary>
public String Description { get; }
/// <summary>
/// The files contained in this GMAD file
/// </summary>
public ImmutableArray<File> Files { get; }
/// <summary>
/// The version of this file's GMAD format
/// </summary>
public Int16 FormatVersion { get; }
/// <summary>
/// The name of the addon in this GMAd file
/// </summary>
public String Name { get; }
/// <summary>
/// The timestamp that this GMAD file was generated at
/// </summary>
public UInt64 Timestamp { get; }
/// <summary>
/// The version of this addon
/// </summary>
public Int32 Version { get; }
/// <summary>
/// How far into the GMAD file the addon's files are
/// </summary>
public Int64 FilesOffset { get; }
/// <summary>
/// Initializes a new GMAD file
/// </summary>
/// <param name="author"></param>
/// <param name="description"></param>
/// <param name="files"></param>
/// <param name="formatVersion"></param>
/// <param name="name"></param>
/// <param name="timestamp"></param>
/// <param name="version"></param>
/// <param name="filesOffset"></param>
internal GmadHeader ( AuthorInfo author, String description, IEnumerable<File> files, Int16 formatVersion, String name, UInt64 timestamp, Int32 version, Int64 filesOffset )
{
if ( files is null )
throw new ArgumentNullException ( nameof ( files ) );
this.Author = author;
this.Description = description ?? throw new ArgumentNullException ( nameof ( description ) );
this.Files = files.ToImmutableArray ( );
this.FormatVersion = formatVersion;
this.Name = name ?? throw new ArgumentNullException ( nameof ( name ) );
this.Timestamp = timestamp;
this.Version = version;
this.FilesOffset = filesOffset;
}
}
}