Created
April 7, 2020 06:30
-
-
Save JustZerooo/be048024c46ee8f16e35ce95438acd87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Grab your API Key from : https://fortniteapi.io */ | |
using Newtonsoft.Json.Linq; | |
using System.IO; | |
using System.Net; | |
using System.Windows; | |
using System.Windows.Documents; | |
namespace Anwendung_1 | |
{ | |
/// <summary> | |
/// Interaktionslogik für MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
const string url = "https://fortniteapi.io/lookup"; | |
private void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
string username = txt_username.Text; | |
string apikey = txt_apikey.Text; | |
if (txt_username.Text == "") | |
{ | |
MessageBox.Show("Bitte gib einen Benutzername ein!", "Benutzername Eingeben!"); | |
} else if (txt_apikey.Text == "") | |
{ | |
MessageBox.Show("Bitte gib deinen API Key ein!", "API Key Eingeben!"); | |
} else | |
{ | |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + "?username=" + username); | |
WebHeaderCollection requestHeaders = request.Headers; | |
request.Method = "POST"; | |
request.Timeout = 30000; | |
request.ContentType = "application/json"; | |
request.UserAgent = "Fortnite Private ID Checker"; | |
requestHeaders.Add("Authorization", apikey); | |
requestHeaders.Add("Accept-Language", "en;q=0.8"); | |
var response = (HttpWebResponse)request.GetResponse(); | |
using (var sr = new StreamReader(response.GetResponseStream())) | |
{ | |
var jsonResponse = sr.ReadToEnd(); | |
JObject jobject = JObject.Parse(jsonResponse); | |
string accountID = (string)jobject["account_id"]; | |
txt_rb.Document.Blocks.Clear(); | |
txt_rb.Document.Blocks.Add(new Paragraph(new Run("Accountname : " + username + "\n" + "Account ID : " + accountID))); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment