示例#1
0
        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);
                        }
                    }
                }
            }
        }
示例#2
0
        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);
            }
        }