public static void Read(this IDictionary <string, string> _this, AssetStream stream) { int count = stream.ReadInt32(); for (int i = 0; i < count; i++) { string key = stream.ReadStringAligned(); string value = stream.ReadStringAligned(); _this.Add(key, value); } }
public static Tuple <string, T> ReadTupleStringT <T>(this AssetStream stream) where T : IAssetReadable, new() { string value = stream.ReadStringAligned(); T t = new T(); t.Read(stream); return(new Tuple <string, T>(value, t)); }
public static void Read <T>(this IDictionary <string, T> _this, AssetStream stream, Func <T> instantiator) where T : IAssetReadable { int count = stream.ReadInt32(); for (int i = 0; i < count; i++) { string key = stream.ReadStringAligned(); T value = instantiator(); value.Read(stream); _this.Add(key, value); } }
public static KeyValuePair <string, T>[] ReadStringKVPArray <T>(this AssetStream stream) where T : IAssetReadable, new() { int count = stream.ReadInt32(); KeyValuePair <string, T>[] array = new KeyValuePair <string, T> [count]; for (int i = 0; i < count; i++) { string key = stream.ReadStringAligned(); T value = new T(); value.Read(stream); KeyValuePair <string, T> kvp = new KeyValuePair <string, T>(key, value); array[i] = kvp; } return(array); }