public async Task <IActionResult> Index() { MovieClient client = new MovieClient(_configuration); List <MovieViewModel> movieViewModels = await client.GetMovies(); return(View(movieViewModels)); }
public MainWindow() { InitializeComponent(); proxyClient = new MovieClient("1stEP"); // proxyClient.ClientCredentials.UserName.UserName = "******"; proxyClient.Open(); synchronizationContext = SynchronizationContext.Current; }
public ActionResult MovieList() { using (((WindowsIdentity)User.Identity).Impersonate()) { proxyClient = new MovieClient("1stEP"); proxyClient.Open(); IEnumerable <MovieData> data = proxyClient.GetDirectorNames(); proxyClient.Close(); } return(View()); }
private void Button_Click_1(object sender, RoutedEventArgs e) { EndpointAddress address = new EndpointAddress("net.tcp://localhost:8010/MovieService"); Binding binding = new NetTcpBinding(); MovieClient proxyClient = new MovieClient(binding, address); IEnumerable <MovieData> data = proxyClient.GetDirectorNames(); if (data != null) { LstDirectors.ItemsSource = data; } proxyClient.Close(); }
public HttpResponseMessage Get() { var Movies = new List <ResponseModel>(); try { WebClient wc = new WebClient(); wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); var v = wc.OpenRead(new Uri("http://www.voirfilms.ws/film-en-streaming")); List <ResponseModel> responses = new List <ResponseModel>(); if (v != null) { MovieClient client = new MovieClient(); string expression = "<a href=\"\\/(?<link>.+)\" title=\"film (?<film>.+)\">"; TextReader tr = new StreamReader(v); string content = tr.ReadToEnd(); Regex regex = new Regex(expression, RegexOptions.IgnoreCase); MatchCollection mc = regex.Matches(content); foreach (Match match in mc) { responses.Add(client.GetMovieInfo(match.Groups["film"].Value)); var res = client.GetMovieInfo(match.Groups["film"].Value); if (res != null) { res.DownloadbleUrl = match.Groups["link"].Value.Replace(".htm", string.Empty); Movies.Add(res); } } } HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.OK); var result = NewtonsoftJsonSerializer.Default.Serialize(Movies); hrm.Content = new StringContent(result); hrm.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(hrm); } catch (Exception e) { HttpResponseMessage hrmKo = new HttpResponseMessage(HttpStatusCode.OK); hrmKo.Content = new StringContent(e.Message); return(hrmKo); } }
private async Task LoadMoviesAsync() { var apiKey = ConfigurationManager.AppSettings["tmdb:ApiKey"]; var movieClient = new MovieClient(apiKey); var searchedMovie = TextBox1.Text; try { var movies = await movieClient.SearchMovieAsync(searchedMovie); MoviesDataList.DataSource = movies; MoviesDataList.DataBind(); } catch (Exception e) { TextBox1.Text = e.Message; } }
private async Task LoadMoviesAsync() { var environmentKey = Environment.GetEnvironmentVariable("TMDB_API_KEY"); var movieClient = new MovieClient(environmentKey); var searchedMovie = TextBox1.Text; try { var movies = await movieClient.SearchMovieAsync(searchedMovie); MoviesDataList.DataSource = movies.Results; MoviesDataList.DataBind(); } catch (Exception e) { TextBox1.Text = e.Message; } }
protected virtual void InitRestClients() { RestClient = new RestClient(RootUrl + "api/"); RestClient.AddDefaultHeader("Authentication", ApiKey); RestClient.AddDefaultHeader("X-Api-Key", ApiKey); Blacklist = new ClientBase <BlacklistResource>(RestClient, ApiKey); Commands = new CommandClient(RestClient, ApiKey); DownloadClients = new DownloadClientClient(RestClient, ApiKey); History = new ClientBase <HistoryResource>(RestClient, ApiKey); HostConfig = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host"); Indexers = new IndexerClient(RestClient, ApiKey); NamingConfig = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming"); Notifications = new NotificationClient(RestClient, ApiKey); Profiles = new ClientBase <ProfileResource>(RestClient, ApiKey); Releases = new ReleaseClient(RestClient, ApiKey); RootFolders = new ClientBase <RootFolderResource>(RestClient, ApiKey); Movies = new MovieClient(RestClient, ApiKey); Tags = new ClientBase <TagResource>(RestClient, ApiKey); WantedMissing = new ClientBase <MovieResource>(RestClient, ApiKey, "wanted/missing"); WantedCutoffUnmet = new ClientBase <MovieResource>(RestClient, ApiKey, "wanted/cutoff"); }
static async Task Main(string[] args) { using var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new MovieClient(channel); using var streamingCall = client.StarWarsIntro(new Empty()); try { Console.Clear(); await foreach (var data in streamingCall.ResponseStream.ReadAllAsync()) { Console.WriteLine(data.Frame); } } catch (RpcException ex) when(ex.StatusCode == StatusCode.Cancelled) { Console.WriteLine("Stream cancelled."); } Console.WriteLine("The End"); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { EndpointAddress address = new EndpointAddress("net.tcp://localhost:8010/MovieService"); Binding binding = new NetTcpBinding(); MovieClient proxyClient = new MovieClient(binding, address); IEnumerable<MovieData> data = proxyClient.GetDirectorNames(); if (data != null) { LstDirectors.ItemsSource = data; } proxyClient.Close(); }
public MovieController(MovieClient movieClient) { this.movieClient = movieClient ?? throw new ArgumentNullException(nameof(movieClient)); }
public MovieMeta(MovieClient client) { Client = client; }