1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public bool txt_file_generate(Dictionary<int, string> dic_val) { FolderBrowserDialog my_diaglog = new FolderBrowserDialog(); string save_path = string.Empty; bool save_ok; string val = null; string file_name = DateTime.Now.ToString("yyyyMMddHHmmss") + "_Accurtestlogs.txt"; if (my_diaglog.ShowDialog() == DialogResult.OK) { save_path = my_diaglog.SelectedPath + "\\" + file_name; } FileStream fs = new FileStream(save_path, FileMode.Append); StreamWriter sw = null; sw = new StreamWriter(fs); foreach (KeyValuePair<int, string> pair in dic_val) { sw.WriteLine(pair.Value); } sw.Close(); fs.Close(); save_ok = true; return save_ok; }
|