public string filePath; //full path to positions data file //c'tor public PositionsDataFileOps(DataOps dataOps, PositionsDataTableOps dto) { this.dataOps = dataOps; this.dto = dto; this.label = dataOps.cBot.Label; //used for building path for data files //build directory and file paths string desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); string dir = label + "_data"; dirPath = Path.Combine(desktopFolder, dir); fileName = label + "_" + dataOps.cBot.Symbol.Code + ".dat"; filePath = Path.Combine(dirPath, fileName); //check for existance of directory, create if none if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } //if there is not file, make an empty one to allow program to run if (!File.Exists(filePath)) { WriteDataTableToCSV(dto.BuildDataTableSchema(), filePath, ','); } }
//c'tor public DataOps(MultiStage3 cBot) { this.cBot = cBot; pdto = new PositionsDataTableOps(this); //dependency for dfo pdfo = new PositionsDataFileOps(this, pdto); }