예제 #1
0
파일: Program.cs 프로젝트: PoLaKoSz/Ncore
        public static void Main(string[] args)
        {
            UserConfig userConfig = LoadCredentialsFromFile();

            NcoreClient nCore = GetAuthenticatedClientFor(userConfig)
                                .ConfigureAwait(false).GetAwaiter().GetResult();

            Thread.Sleep(TimeSpan.FromSeconds(2));

            ISearchResultContainer resultContainer = nCore.Search.List()
                                                     .GetAwaiter().GetResult();

            Thread.Sleep(TimeSpan.FromSeconds(2));

            ISearchResultContainer innaResults = nCore.Search.For("Inna")
                                                 .ConfigureAwait(false).GetAwaiter().GetResult();

            IEnumerable <HitAndRunTorrent> hitAndRunTorrents = nCore.HitAndRuns.List()
                                                               .ConfigureAwait(false).GetAwaiter().GetResult();

            Torrent torrent = nCore.Torrent.Get(1683491)
                              .ConfigureAwait(false).GetAwaiter().GetResult();

            FileStream destination = new FileStream($"{torrent.UploadName}.torrent", FileMode.CreateNew);

            torrent.DownloadAsFileTo(destination)
            .ConfigureAwait(false).GetAwaiter().GetResult();

            Console.Read();
        }
예제 #2
0
파일: Program.cs 프로젝트: PoLaKoSz/Ncore
        private static async Task <NcoreClient> GetAuthenticatedClientFor(UserConfig userConfig)
        {
            NcoreClient client = new NcoreClient();
            await client.Login.AuthenticateWith(userConfig).ConfigureAwait(false);

            return(client);
        }
예제 #3
0
        protected NcoreClient GetAuthenticatedClient()
        {
            var client = new NcoreClient(Web);

            SetServerResponse("LoginEndPoint", "authenticated");

            client.Login.AuthenticateWith(new UserConfig(null, null, null))
            .ConfigureAwait(false).GetAwaiter().GetResult();

            return(client);
        }