public async Task TestGetLinks() { Assert.IsTrue(await UploadGIG.LogIn()); var links = await UploadGIG.GetLinks("MISM"); foreach (var link in links) { Trace.WriteLine(link); } Assert.IsTrue(links.Any()); }
private async Task <bool> Login(LoginFlag flag) { Message = ""; try { var loginTasks = new List <Task>(); if (!ImgChili.LoggedIn && flag.HasFlag(LoginFlag.ImgChili)) { loginTasks.Add(ImgChili.LogIn()); } if (!ImgRock.LoggedIn && flag.HasFlag(LoginFlag.ImgRock)) { loginTasks.Add(ImgRock.LogIn()); } if (!PixSense.LoggedIn && flag.HasFlag(LoginFlag.PixSense)) { loginTasks.Add(PixSense.LogIn()); } Task <bool> megaLoginTask = null; if (!MegaLoggedIn && flag.HasFlag(LoginFlag.MEGA)) { megaLoginTask = MEGA.LogIn(); loginTasks.Add(megaLoginTask); } Task <bool> rapidgatorLoginTask = null; if (!RapidgatorLoggedIn && flag.HasFlag(LoginFlag.Rapidgator)) { rapidgatorLoginTask = Rapidgator.LogIn(); loginTasks.Add(rapidgatorLoginTask); } Task <bool> uploadGIGLoginTask = null; if (!UploadGIGLoggedIn && flag.HasFlag(LoginFlag.UploadGIG)) { uploadGIGLoginTask = UploadGIG.LogIn(); loginTasks.Add(uploadGIGLoginTask); } if (!Zippyshare.LoggedIn && flag.HasFlag(LoginFlag.Zippyshare)) { loginTasks.Add(Zippyshare.LogIn()); } Task <bool> blogLoginTask = null; if (!BloggerLoggedIn && flag.HasFlag(LoginFlag.Blogger)) { blogLoginTask = Blogger.LogIn(); loginTasks.Add(blogLoginTask); } await Task.WhenAll(loginTasks); if (megaLoginTask != null) { MegaLoggedIn = await megaLoginTask; } if (rapidgatorLoginTask != null) { RapidgatorLoggedIn = await rapidgatorLoginTask; } if (uploadGIGLoginTask != null) { UploadGIGLoggedIn = await uploadGIGLoginTask; } if (blogLoginTask != null) { BloggerLoggedIn = await blogLoginTask; } } catch (Exception ex) { Message = ex.Message; Logger.ErrorException(ex.Message, ex); } Message = "Login done"; var ret = true; if (flag.HasFlag(LoginFlag.ImgChili)) { ret &= ImgChili.LoggedIn; } if (flag.HasFlag(LoginFlag.ImgRock)) { ret &= ImgRock.LoggedIn; } if (flag.HasFlag(LoginFlag.PixSense)) { ret &= PixSense.LoggedIn; } if (flag.HasFlag(LoginFlag.MEGA)) { ret &= MegaLoggedIn; } if (flag.HasFlag(LoginFlag.Rapidgator)) { ret &= RapidgatorLoggedIn; } if (flag.HasFlag(LoginFlag.UploadGIG)) { ret &= UploadGIGLoggedIn; } if (flag.HasFlag(LoginFlag.Zippyshare)) { ret &= Zippyshare.LoggedIn; } if (flag.HasFlag(LoginFlag.Blogger)) { ret &= BloggerLoggedIn; } CanUpload = ret; return(ret); }
public async Task TestLogin() { Assert.IsTrue(await UploadGIG.LogIn()); }