public static void RegisterIfNeeded(DataFileTypeInfo elemTypeInfo) { if (!DataFileTypeInfo.ContainsType(GetTypeName(elemTypeInfo))) { new DataFileIDictWrapper <T>(elemTypeInfo).RegisterTypeInfo(GetTypeName(elemTypeInfo)); } }
public static void RegisterIfNeeded() { if (!DataFileTypeInfo.ContainsType(TYPENAME)) { new DataFileGUIDWrapper().RegisterTypeInfo(TYPENAME); } }
public static BaseDataFile CreateFromEnumDict <TEnum>(DataFileTypeInfo elemTypeInfo, Dictionary <TEnum, T> value) where TEnum : struct { return(new DataFileIDictWrapper <T>(elemTypeInfo) { Value = new Dictionary <int, T>(value.ToDictionary(p => p.Key.GetHashCode(), q => q.Value)) }); // abusing the fact that GetHasCode of an 32bit enum returns the enum value }
public static BaseDataFile Create(DataFileTypeInfo elemTypeInfo, Dictionary <int, T> value) { return(new DataFileIDictWrapper <T>(elemTypeInfo) { Value = value }); }
public static BaseDataFile Create(DataFileTypeInfo elemTypeInfo, List <T> value) { return(new DataFileListWrapper <T>(elemTypeInfo) { Value = value }); }
public static string GetTypeName(DataFileTypeInfo elemTypeInfo) { return($"WIDICT<{elemTypeInfo.TypeName}>"); }
public DataFileIDictWrapper(DataFileTypeInfo elemTypeInfo) { _typeName = GetTypeName(elemTypeInfo); _elemTypeInfo = elemTypeInfo; }