Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Net;
- using System.IO;
- namespace ForAll
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Download process started");
- if (!File.Exists("download.txt"))
- {
- Console.WriteLine("File 'download.txt' is not exist");
- Console.WriteLine("Press 'Enter' to continue");
- Console.ReadKey(true);
- return;
- }
- Console.WriteLine("\nProcess:\n");
- string line;
- StreamReader file = new System.IO.StreamReader("download.txt");
- while ((line = file.ReadLine()) != null)
- {
- WebClient client = new WebClient();
- try
- {
- Console.WriteLine("\tLoading: " + line);
- client.DownloadFile(line, "models/" + EditText(line));
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- Console.WriteLine("Press 'Enter' to continue");
- Console.ReadKey(true);
- return;
- }
- }
- file.Close();
- Console.WriteLine("All files loaded!\nPress 'Enter' to continue");
- Console.ReadKey(true);
- }
- public static string EditText(string text)
- {
- for (int j = text.Length - 1; j != 0; j--) if (text[j] == '/') return text.Remove(0,j+1);
- return text;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement