private static Stream LoadCsvStream(StaticDataType type) { var assembly = Assembly.GetExecutingAssembly(); var resourceName = string.Format("Common.static_data.{0}.txt", type.ToString().ToLower()); return(assembly.GetManifestResourceStream(resourceName)); }
public EoiDataType(StaticDataType staticType) { if (staticType == null) { Invalid = true; return; } _staticType = staticType; Id = staticType.Id; }
private static IEnumerable <T> GetStaticData <T>(StaticDataType type, Func <string, T> factory) { using (var strm = LoadCsvStream(type)) using (var reader = new StreamReader(strm)) { reader.ReadLine(); // skip header var line = reader.ReadLine(); while (!string.IsNullOrWhiteSpace(line)) { yield return(factory(line)); line = reader.ReadLine(); } } }
internal static EoiDataType GetType(StaticDataType product) { return(_eoiDataTypes.FirstOrDefault(x => Equals(product, x.GetStaticType()))); }