2019-01-26 00:39:37 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-09-10 05:08:12 +00:00
|
|
|
|
using System.Text;
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles.BinaryFormat.Chunks
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-06-08 03:43:28 +00:00
|
|
|
|
public class META : IBinaryFileChunk
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-05-17 06:14:04 +00:00
|
|
|
|
public Dictionary<string, string> Data = new Dictionary<string, string>();
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
2020-07-13 01:19:30 +00:00
|
|
|
|
public void Load(BinaryRobloxFileReader reader)
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-06-08 03:43:28 +00:00
|
|
|
|
BinaryRobloxFile file = reader.File;
|
|
|
|
|
int numEntries = reader.ReadInt32();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < numEntries; i++)
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-06-08 03:43:28 +00:00
|
|
|
|
string key = reader.ReadString();
|
|
|
|
|
string value = reader.ReadString();
|
|
|
|
|
Data.Add(key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
file.META = this;
|
|
|
|
|
}
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
2020-07-13 01:19:30 +00:00
|
|
|
|
public void Save(BinaryRobloxFileWriter writer)
|
2019-06-08 03:43:28 +00:00
|
|
|
|
{
|
|
|
|
|
writer.Write(Data.Count);
|
|
|
|
|
|
2020-07-13 01:19:30 +00:00
|
|
|
|
foreach (var pair in Data)
|
2019-06-08 03:43:28 +00:00
|
|
|
|
{
|
2020-07-13 01:19:30 +00:00
|
|
|
|
writer.WriteString(pair.Key);
|
|
|
|
|
writer.WriteString(pair.Value);
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-10 05:08:12 +00:00
|
|
|
|
|
|
|
|
|
public void WriteInfo(StringBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
builder.AppendLine($"- NumEntries: {Data.Count}");
|
|
|
|
|
|
|
|
|
|
foreach (var pair in Data)
|
|
|
|
|
{
|
|
|
|
|
string key = pair.Key,
|
|
|
|
|
value = pair.Value;
|
|
|
|
|
|
|
|
|
|
builder.AppendLine($" - {key}: {value}");
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|