private static string get_default_file() { qqq_file_util utils = new qqq_file_util(); utils.create_if_path_not_exist(); string fname = utils.build(); if (utils.check_file_exists() == false) { StockFetch obj = new StockFetch(); obj.AwkMode = true; obj.OutputFileName = fname; obj.DownloadData(_sym); } return utils.build(); }
static void Main(string[] args) { string result = "OK"; if (args.Length == 0) { result = "ERROR"; goto main_exit; } string sym = args[0]; string spath = Environment.CurrentDirectory; string sfilename = "qqq.csv"; StockFetch obj = new StockFetch(); obj.AwkMode = true; obj.OutputFileName = Path.Combine(spath, sfilename); { // write stockname string stockname_fname = get_stockname_file(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(stockname_fname)) { file.WriteLine(sym); } } Match e = Regex.Match(sym, ".TO"); if (e.Success) { if (obj.DownloadData(sym) == false) { result = "ERROR"; goto main_exit; } } else { if (obj.DownloadData2(sym, get_tmp_file()) == false) { result = "ERROR"; goto main_exit; } } main_exit: Console.WriteLine(result); }