2019-01-26 00:39:37 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
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
|
|
|
|
|
2019-06-08 03:43:28 +00:00
|
|
|
|
public void LoadFromReader(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
|
|
|
|
|
2019-06-08 03:43:28 +00:00
|
|
|
|
public BinaryRobloxFileChunk SaveAsChunk(BinaryRobloxFileWriter writer)
|
|
|
|
|
{
|
|
|
|
|
writer.StartWritingChunk(this);
|
|
|
|
|
writer.Write(Data.Count);
|
|
|
|
|
|
|
|
|
|
foreach (var kvPair in Data)
|
|
|
|
|
{
|
|
|
|
|
writer.WriteString(kvPair.Key);
|
|
|
|
|
writer.WriteString(kvPair.Value);
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
2019-06-08 03:43:28 +00:00
|
|
|
|
|
|
|
|
|
return writer.FinishWritingChunk();
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|