mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-09-27 23:01:47 +12:00
commit
75216d8bfa
6 changed files with 56 additions and 4 deletions
|
@ -27,6 +27,7 @@ namespace ModAssistant
|
||||||
public const string BeatModsAPIUrl = "https://beatmods.com/api/v1/";
|
public const string BeatModsAPIUrl = "https://beatmods.com/api/v1/";
|
||||||
public const string TeknikAPIUrl = "https://api.teknik.io/v1/";
|
public const string TeknikAPIUrl = "https://api.teknik.io/v1/";
|
||||||
public const string BeatModsURL = "https://beatmods.com";
|
public const string BeatModsURL = "https://beatmods.com";
|
||||||
|
public const string WeebCDNAPIURL = "https://pat.assistant.moe/api/v1.0/";
|
||||||
public const string BeatModsModsOptions = "mod?status=approved";
|
public const string BeatModsModsOptions = "mod?status=approved";
|
||||||
public const string MD5Spacer = " ";
|
public const string MD5Spacer = " ";
|
||||||
public static readonly char[] IllegalCharacters = new char[]
|
public static readonly char[] IllegalCharacters = new char[]
|
||||||
|
@ -53,6 +54,13 @@ namespace ModAssistant
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class WeebCDNRandomResponse
|
||||||
|
{
|
||||||
|
public int index;
|
||||||
|
public string url;
|
||||||
|
public string ext;
|
||||||
|
}
|
||||||
|
|
||||||
public static void SendNotify(string message, string title = "Mod Assistant")
|
public static void SendNotify(string message, string title = "Mod Assistant")
|
||||||
{
|
{
|
||||||
var notification = new System.Windows.Forms.NotifyIcon()
|
var notification = new System.Windows.Forms.NotifyIcon()
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
xmlns:local="clr-namespace:ModAssistant"
|
xmlns:local="clr-namespace:ModAssistant"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Icon="Resources/icon.ico"
|
Icon="Resources/icon.ico"
|
||||||
Title="Mod Assistant" Width="1280" Height="720">
|
Title="Mod Assistant" Width="1280" Height="720"
|
||||||
|
UIElement.PreviewMouseDown="Window_PreviewMouseDown">
|
||||||
<Grid Margin="10">
|
<Grid Margin="10">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
|
|
|
@ -225,5 +225,11 @@ namespace ModAssistant
|
||||||
Mods.Instance.LoadMods();
|
Mods.Instance.LoadMods();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Window_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
About.Instance.PatUp.IsOpen = false;
|
||||||
|
About.Instance.PatButton.IsEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="WindowsFormsIntegration" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Include="App.xaml">
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<Page x:Class="ModAssistant.Pages.About"
|
<Page x:Class="ModAssistant.Pages.About"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
|
||||||
|
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:ModAssistant"
|
xmlns:local="clr-namespace:ModAssistant"
|
||||||
|
@ -20,7 +22,7 @@
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
@ -97,6 +99,13 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<Button x:Name="PatButton" x:FieldModifier="public" Grid.Row="9" Margin="5" Height="30" Width="80" Content="Headpats" Click="HeadpatsButton_Click"/>
|
||||||
</Grid>
|
<Popup Placement="Center" x:Name="PatUp" Width="auto" Height="auto">
|
||||||
|
<Border BorderBrush="Gray" BorderThickness="3">
|
||||||
|
<wfi:WindowsFormsHost>
|
||||||
|
<winForms:PictureBox x:Name="PatImage"></winForms:PictureBox>
|
||||||
|
</wfi:WindowsFormsHost>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web.Script.Serialization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
@ -33,5 +36,29 @@ namespace ModAssistant.Pages
|
||||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void HeadpatsButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
PatButton.IsEnabled = false;
|
||||||
|
await Task.Run(() => HeadPat());
|
||||||
|
PatUp.IsOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HeadPat()
|
||||||
|
{
|
||||||
|
Utils.WeebCDNRandomResponse Pat;
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Utils.Constants.WeebCDNAPIURL + "pats/random");
|
||||||
|
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();
|
||||||
|
Pat = serializer.Deserialize<Utils.WeebCDNRandomResponse>(reader.ReadToEnd());
|
||||||
|
}
|
||||||
|
PatImage.Load(Pat.url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue