public List <Symbol> GetAllSymbols() { string directory = Path.GetDirectoryName(DatabaseInfoClass.CsvFilesPath()); IEnumerable <string> files = Directory.EnumerateFiles(directory, "*.*") .Where(s => s.EndsWith(".csv", StringComparison.OrdinalIgnoreCase) || s.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) || s.EndsWith(".tiff ", StringComparison.OrdinalIgnoreCase)); List <Symbol> listStocksName = new List <Symbol>(); foreach (string fileName in files) { listStocksName.Add(new Symbol() { NamePersian = Path.GetFileNameWithoutExtension(fileName) }); } return(listStocksName); }
public List <PointData> GetStockData(string stockName) { if (allStocksData.ContainsKey(stockName)) { return(allStocksData[stockName]); } List <PointData> listPointData = new List <PointData>(); HandWrittenSymbolInfo stocksInfo = new HandWrittenSymbolInfo(); List <string> allStocksName = new List <string>(); allStocksName.AddRange(stocksInfo.GetAllSymbols().Select(x => x.NamePersian)); if (!allStocksName.Contains(stockName)) { return(listPointData); } string fileName = DatabaseInfoClass.CsvFilesPath() + stockName + ".csv"; listPointData = readData(fileName); allStocksData.Add(stockName, listPointData); return(listPointData); }