public async Task <IActionResult> Index()
        {
            MovieClient           client          = new MovieClient(_configuration);
            List <MovieViewModel> movieViewModels = await client.GetMovies();

            return(View(movieViewModels));
        }
Example #2
0
 public MainWindow()
 {
     InitializeComponent();
     proxyClient = new MovieClient("1stEP");
    // proxyClient.ClientCredentials.UserName.UserName = "******";
     proxyClient.Open();
     synchronizationContext = SynchronizationContext.Current;
 }
Example #3
0
 public MainWindow()
 {
     InitializeComponent();
     proxyClient = new MovieClient("1stEP");
     // proxyClient.ClientCredentials.UserName.UserName = "******";
     proxyClient.Open();
     synchronizationContext = SynchronizationContext.Current;
 }
Example #4
0
 public ActionResult MovieList()
 {
     using (((WindowsIdentity)User.Identity).Impersonate())
     {
         proxyClient = new MovieClient("1stEP");
         proxyClient.Open();
         IEnumerable <MovieData> data = proxyClient.GetDirectorNames();
         proxyClient.Close();
     }
     return(View());
 }
Example #5
0
        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();
        }
Example #6
0
        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;
            }
        }
Example #9
0
        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");
        }
Example #10
0
        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();
        }
Example #11
0
        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();
        }
Example #12
0
 public MovieController(MovieClient movieClient)
 {
     this.movieClient = movieClient ?? throw new ArgumentNullException(nameof(movieClient));
 }
Example #13
0
 public MovieMeta(MovieClient client)
 {
     Client = client;
 }