public void Register(IRegistryEntry <TEntry> entry) { if (!Entries.TryAdd(entry.Location, () => entry)) { throw new DuplicateNameException("An item with this location has already been registered!"); } }
public CsvLineRegistryEntryWithIsin_FormatterForCsv() { _cultureInfo = CultureInfo.CurrentCulture; _validregistryEntry = new RegistryEntryBuilder() .SetIsin("DE0005408116") .SetName("Aareal Bank AG") .SetOwnInvestorLink("http://www.aareal-bank.com/investor-relations/") .SetStockExchangeLink("http://www.boerse-frankfurt.de/de/aktien/aareal+bank+ag+ag+DE0005408116") .SetPosition(Position.NoPosition.ToString()) .SetFinancialReport(new FinancialReportBuilder() .SetEPS(2.08m) .SetMonthsInReport(6) .SetNextReportDate(DateTime.Now.AddDays(1).Date) .Build()) .Build(); _validResult = $"\"Aareal Bank AG\"" + ";DE0005408116" + $@";http://www.boerse-frankfurt.de/de/aktien/aareal+bank+ag+ag+DE0005408116" + $@";http://www.aareal-bank.com/investor-relations/" + $";\"{2.08m.ToString(_cultureInfo)}\"" + ";6" + $";{DateTime.Now.AddDays(1).Date.ToString(_cultureInfo)}" + $";NoPosition"; }
public static string FormatForCSV(IRegistryEntry entry, string separator, CultureInfo cultureInfo) { if (entry is null) { throw new ArgumentNullException(nameof(entry)); } if (string.IsNullOrEmpty(separator)) { throw new ArgumentNullException(nameof(separator)); } if (cultureInfo is null) { throw new ArgumentNullException(nameof(cultureInfo)); } return(string.Join(separator, new string[] { entry.Name.WrapWithQuotes(), entry.Isin, entry.StockExchangeLink?.ToString(), entry.OwnInvestorLink?.ToString(), entry.FinancialReport?.EPS.ToString(cultureInfo).WrapWithQuotes(), entry.FinancialReport?.MonthsInReport.ToString(), entry.FinancialReport?.NextReportDate.ToString(cultureInfo), entry.Position.ToString() })); }
public static bool TryParseFromCsv( string[] input, CultureInfo cultureInfo, out IRegistryEntry result) { result = null; try { if (input.Length != 8 || string.IsNullOrWhiteSpace(input[0]) || string.IsNullOrWhiteSpace(input[1])) { return(false); } result = new RegistryEntryBuilder() .SetName(input[0]) .SetIsin(input[1]) .SetStockExchangeLink(input[2]) .SetOwnInvestorLink(input[3]) .SetFinancialReport(new FinancialReportBuilder() .SetEPS(input[4]) .SetMonthsInReport(input[5]) .SetNextReportDate(input[6]) .Build()) .Build(); return(true); } catch (Exception) { return(false); } }
public virtual bool TryGet(ResourceLocation location, out IRegistryEntry <TEntry> value) { if (Entries.TryGetValue(location, out var factory)) { value = factory(); return(true); } value = default; return(false); }
private bool RegistryItemIsInteresting(IRegistryEntry entry) => entry.FinancialReport?.EPS >= 0 || entry.Position != Position.NoPosition;
public bool Equals(IRegistryEntry other) => other != null && Isin == other.Isin;