2019-04-22 18:41:43 +12:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
2019-12-21 00:06:21 +13:00
|
|
|
|
using System.IO;
|
2019-04-22 18:41:43 +12:00
|
|
|
|
using System.Linq;
|
2019-12-21 00:06:21 +13:00
|
|
|
|
using System.Net;
|
2019-04-22 18:41:43 +12:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-12-21 00:06:21 +13:00
|
|
|
|
using System.Web.Script.Serialization;
|
2019-04-22 18:41:43 +12:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
|
|
|
|
namespace ModAssistant.Pages
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for Page1.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class About : Page
|
|
|
|
|
{
|
|
|
|
|
public static About Instance = new About();
|
|
|
|
|
|
|
|
|
|
public About()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
|
|
|
|
e.Handled = true;
|
|
|
|
|
}
|
2019-12-21 00:06:21 +13:00
|
|
|
|
|
|
|
|
|
private async void HeadpatsButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
PatButton.IsEnabled = false;
|
|
|
|
|
await Task.Run(() => HeadPat());
|
|
|
|
|
PatUp.IsOpen = true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-27 20:50:15 +13:00
|
|
|
|
private async void HugsButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
HugButton.IsEnabled = false;
|
|
|
|
|
await Task.Run(() => Hug());
|
|
|
|
|
HugUp.IsOpen = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string WeebCDN(string type)
|
2019-12-21 00:06:21 +13:00
|
|
|
|
{
|
2020-01-27 20:50:15 +13:00
|
|
|
|
Utils.WeebCDNRandomResponse Response;
|
|
|
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Utils.Constants.WeebCDNAPIURL + type + "/random");
|
2019-12-21 00:06:21 +13:00
|
|
|
|
request.AutomaticDecompression = DecompressionMethods.GZip;
|
|
|
|
|
request.UserAgent = "ModAssistant/" + App.Version;
|
|
|
|
|
|
|
|
|
|
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
|
|
|
|
using (Stream stream = response.GetResponseStream())
|
|
|
|
|
using (StreamReader reader = new StreamReader(stream))
|
|
|
|
|
{
|
|
|
|
|
var serializer = new JavaScriptSerializer();
|
2020-01-27 20:50:15 +13:00
|
|
|
|
Response = serializer.Deserialize<Utils.WeebCDNRandomResponse>(reader.ReadToEnd());
|
2019-12-21 00:06:21 +13:00
|
|
|
|
}
|
2020-01-27 20:50:15 +13:00
|
|
|
|
return Response.url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HeadPat()
|
|
|
|
|
{
|
|
|
|
|
PatImage.Load(WeebCDN("pats"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Hug()
|
|
|
|
|
{
|
|
|
|
|
HugImage.Load(WeebCDN("hugs"));
|
2019-12-21 00:06:21 +13:00
|
|
|
|
}
|
2019-04-22 18:41:43 +12:00
|
|
|
|
}
|
|
|
|
|
}
|