Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
ShujianDou authored Jul 31, 2020
1 parent 3c467fe commit 94af2e1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions CS/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class Program
static String lnk;
static void Main(string[] args)
{
Download.ConRow = Console.CursorTop;
Download.ConCol = Console.CursorLeft;
Storage.wc = new WebClient();
Storage.wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
Storage.client = new HttpClient();
//Console.ReadLine();
for (int idx = 0; idx < args.Length; idx++)
Expand All @@ -44,24 +47,32 @@ static void Main(string[] args)
}
}
}

lnk = args[args.Length - 1];
Storage.Aniname = lnk;

if (dwnld && Search)
{
fileDestDirectory = (Directory.GetCurrentDirectory() + $"\\vidstream\\{args[args.Length - 1]}");
Directory.CreateDirectory(Directory.GetCurrentDirectory() + $"\\vidstream\\{args[args.Length - 1]}");
fileDestDirectory = (Directory.GetCurrentDirectory() + $"\\vidstream\\{lnk}");
Directory.CreateDirectory(Directory.GetCurrentDirectory() + $"\\vidstream\\{lnk}");
}
else if(dwnld)
throw new Exception("Can not have download option without Search option");

if (Search)
lnk = VidStreamingMain.Search(args[args.Length - 1]);
else
lnk = args[args.Length - 1];

Storage.Aniname = lnk;
VidStreamingMain.FindAllVideos(lnk, dwnld, fileDestDirectory);

//Console.ReadLine();
}

private static void Wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
Console.WriteLine("AA");
Download.WriteAt($"{e.BytesReceived}/{e.TotalBytesToReceive}", 0, Download.ConCol);
}

~Program()
{
Storage.client.Dispose();
Expand Down

0 comments on commit 94af2e1

Please sign in to comment.