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