public void Download(DownloadFiles f) { string root = f.ROOT; string[] EBook = f.EBOOK; if (EBook != null) { string path = root; if (root != "" && root[root.Length - 1] != Path.DirectorySeparatorChar) { path += Path.DirectorySeparatorChar; } string nameFile; foreach (string eb in EBook) { if (eb != null) { nameFile = Path.GetRandomFileName(); using (StreamWriter sw = new StreamWriter(path + nameFile + ".txt")) { sw.WriteLine(eb); } } } } }
private void downloadToolStripMenuItem_Click(object sender, EventArgs e) { var cancelSource = new CancellationTokenSource(); if (Request()) { DownloadFiles window = new DownloadFiles(this, myFileWebResponse.Length, Root(lwOnline)); string path = Root(WhichListView()); if (path != "" && path[path.Length - 1] != Path.DirectorySeparatorChar) { path += Path.DirectorySeparatorChar; } window.Show(); window.Download(myFileWebResponse, path); } }