mirror of
https://github.com/mii443/VRCExternalTools.git
synced 2025-08-22 15:45:40 +00:00
アバター一覧の追加、アバターダウンロードの追加
This commit is contained in:
@ -8,13 +8,19 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Debug|x64.Build.0 = Debug|x64
|
||||||
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Release|Any CPU.Build.0 = Release|Any CPU
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{12F51A26-2AE2-4798-9087-516F7BC3B788}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -8,12 +8,13 @@ namespace VRCExternalTools
|
|||||||
{
|
{
|
||||||
class Friend
|
class Friend
|
||||||
{
|
{
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
public Friend(String userId)
|
public Friend(string userId)
|
||||||
{
|
{
|
||||||
id = userId;
|
id = userId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:VRCExternalTools"
|
xmlns:local="clr-namespace:VRCExternalTools"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="VRCExternalTool" Height="450" Width="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="Settings">
|
<TabItem Header="Settings">
|
||||||
@ -23,12 +23,13 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Avatars" Height="22" VerticalAlignment="Bottom">
|
<TabItem Header="Avatars" Height="22" VerticalAlignment="Bottom">
|
||||||
<Grid Background="#FFE5E5E5">
|
<Grid Background="#FFE5E5E5">
|
||||||
<ListView x:Name="avatars" Margin="10">
|
<Button x:Name="reloadAvatarsButton" Content="Reload" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="reloadAvatarsButton_Click"/>
|
||||||
|
<ListView x:Name="avatarsListView" Margin="10,35,10,10" PreviewMouseDoubleClick="AvatarsListView_OnPreviewMouseDoubleClick">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="{Binding name}" FontSize="15"/>
|
<TextBlock Text="{Binding name}" FontSize="15"/>
|
||||||
<TextBlock Text="{Binding description}"/>
|
<TextBlock Text="{Binding id}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
|
@ -30,7 +30,7 @@ namespace VRCExternalTools
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
friends.ItemsSource = friendsCollection;
|
friends.ItemsSource = friendsCollection;
|
||||||
avatars.ItemsSource = avatarsCollection;
|
avatarsListView.ItemsSource = avatarsCollection;
|
||||||
BindingOperations.EnableCollectionSynchronization(this.friendsCollection, new object());
|
BindingOperations.EnableCollectionSynchronization(this.friendsCollection, new object());
|
||||||
BindingOperations.EnableCollectionSynchronization(this.avatarsCollection, new object());
|
BindingOperations.EnableCollectionSynchronization(this.avatarsCollection, new object());
|
||||||
}
|
}
|
||||||
@ -51,22 +51,20 @@ namespace VRCExternalTools
|
|||||||
loginButton.IsEnabled = false;
|
loginButton.IsEnabled = false;
|
||||||
var userConfig = api.getUserConfig();
|
var userConfig = api.getUserConfig();
|
||||||
Name.Content = userConfig.username;
|
Name.Content = userConfig.username;
|
||||||
|
|
||||||
var avatars = api.searchAvatars(user: "me", releaseStatus: "all");
|
|
||||||
foreach (var avatar in avatars)
|
|
||||||
{
|
|
||||||
avatarsCollection.Add(avatar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("2FA Failed.");
|
MessageBox.Show("2FA Failed.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (api == null)
|
else if (api == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Invalid Username or Password");
|
MessageBox.Show("Invalid Username or Password");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Logined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reloadFriends_Click(object sender, RoutedEventArgs e)
|
private void reloadFriends_Click(object sender, RoutedEventArgs e)
|
||||||
@ -81,5 +79,21 @@ namespace VRCExternalTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reloadAvatarsButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var avatars = api.searchAvatars(user: "me", releaseStatus: "all");
|
||||||
|
foreach (var avatar in avatars)
|
||||||
|
{
|
||||||
|
avatarsCollection.Add(avatar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AvatarsListView_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var avatar = (VRCAPIBase.AvatarObject) avatarsListView.SelectedItems[0];
|
||||||
|
var window = new avatarWindow(api, avatar);
|
||||||
|
window.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,12 @@ using JsonSerializer = System.Text.Json.JsonSerializer;
|
|||||||
|
|
||||||
namespace VRCExternalTools.VRCAPI
|
namespace VRCExternalTools.VRCAPI
|
||||||
{
|
{
|
||||||
class VRCAPI
|
public class VRCAPI
|
||||||
{
|
{
|
||||||
public String apiKey;
|
public string apiKey;
|
||||||
public String authToken;
|
public string authToken;
|
||||||
private HttpClientHandler handler = new HttpClientHandler();
|
private HttpClientHandler handler = new HttpClientHandler();
|
||||||
public VRCAPI(String key, String token)
|
public VRCAPI(string key, string token)
|
||||||
{
|
{
|
||||||
apiKey = key;
|
apiKey = key;
|
||||||
authToken = token;
|
authToken = token;
|
||||||
@ -35,7 +35,20 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<VRCAPIBase.AvatarObject> searchAvatars(String user = null, bool featured = false, String userId = null, int n = -1, int offset = -1, string order = null, string releaseStatus = null, string sort = null, string maxUnityVersion = null, string minUnityVersion = null, string maxAssetVersion = null, string minAssetVersion = null, string platform = null)
|
public VRCAPIBase.AvatarObject getAvatarById(string id)
|
||||||
|
{
|
||||||
|
StringBuilder urlParams = new StringBuilder("?");
|
||||||
|
urlParams.Append("apiKey=" + apiKey);
|
||||||
|
Uri uri = new Uri(VRCAPIBase.api_base + "/avatars/" + id + urlParams);
|
||||||
|
using (var client = new HttpClient(handler, false))
|
||||||
|
{
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Get, uri);
|
||||||
|
var result = client.SendAsync(request).Result.Content.ReadAsStringAsync().Result;
|
||||||
|
return JsonConvert.DeserializeObject<VRCAPIBase.AvatarObject>(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VRCAPIBase.AvatarObject> searchAvatars(string user = null, bool featured = false, string userId = null, int n = -1, int offset = -1, string order = null, string releaseStatus = null, string sort = null, string maxUnityVersion = null, string minUnityVersion = null, string maxAssetVersion = null, string minAssetVersion = null, string platform = null)
|
||||||
{
|
{
|
||||||
string urlParams = "?";
|
string urlParams = "?";
|
||||||
if (user != null) { urlParams += "user=" + user + "&"; }
|
if (user != null) { urlParams += "user=" + user + "&"; }
|
||||||
@ -71,7 +84,6 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
//request.Content = new StringContent(JsonSerializer.Serialize(new VRCAPIBase.FriendsRequest() { apiKey = apiKey, n = n, offline = offline, offset = offset }), Encoding.UTF8, "application/json");
|
//request.Content = new StringContent(JsonSerializer.Serialize(new VRCAPIBase.FriendsRequest() { apiKey = apiKey, n = n, offline = offline, offset = offset }), Encoding.UTF8, "application/json");
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, uri);
|
var request = new HttpRequestMessage(HttpMethod.Get, uri);
|
||||||
var result = client.SendAsync(request).Result.Content.ReadAsStringAsync().Result;
|
var result = client.SendAsync(request).Result.Content.ReadAsStringAsync().Result;
|
||||||
MessageBox.Show(result);
|
|
||||||
return JsonConvert.DeserializeObject<List<VRCAPIBase.LimitedUserObject>>(result);
|
return JsonConvert.DeserializeObject<List<VRCAPIBase.LimitedUserObject>>(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,110 +7,127 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Security.RightsManagement;
|
using System.Security.RightsManagement;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace VRCExternalTools.VRCAPI
|
namespace VRCExternalTools.VRCAPI
|
||||||
{
|
{
|
||||||
class VRCAPIBase
|
public class VRCAPIBase
|
||||||
{
|
{
|
||||||
public static readonly String api_base = "https://api.vrchat.cloud/api/1";
|
public static readonly string api_base = "https://api.vrchat.cloud/api/1";
|
||||||
|
|
||||||
public class AvatarObject
|
public class AvatarObject
|
||||||
{
|
{
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
public String name { get; set; }
|
public string name { get; set; }
|
||||||
public String description { get; set; }
|
public string description { get; set; }
|
||||||
public String authorId { get; set; }
|
public string authorId { get; set; }
|
||||||
public String authorName { get; set; }
|
public string authorName { get; set; }
|
||||||
|
public string[] tags { get; set; }
|
||||||
|
public int version { get; set; }
|
||||||
|
public bool featured { get; set; }
|
||||||
|
public string created_at { get; set; }
|
||||||
|
public string updated_at { get; set; }
|
||||||
|
public string releaseStatus { get; set; }
|
||||||
|
public string assetUrl { get; set; }
|
||||||
|
public string assetVersion { get; set; }
|
||||||
|
public string platform { get; set; }
|
||||||
|
public string imageUrl { get; set; }
|
||||||
|
public string thumbnailImageUrl { get; set; }
|
||||||
|
public string unityVersion { get; set; }
|
||||||
|
public string unityPackageUrl { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PastDisplayNameObject
|
public class PastDisplayNameObject
|
||||||
{
|
{
|
||||||
public String displayName { get; set; }
|
public string displayName { get; set; }
|
||||||
public String updated_at { get; set; }
|
public string updated_at { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CurrentUserObject
|
public class CurrentUserObject
|
||||||
{
|
{
|
||||||
public String username { get; set; }
|
public string username { get; set; }
|
||||||
public String displayName { get; set; }
|
public string displayName { get; set; }
|
||||||
|
[JsonProperty(Required = Required.AllowNull)]
|
||||||
public PastDisplayNameObject[] pastDisplayNames { get; set; }
|
public PastDisplayNameObject[] pastDisplayNames { get; set; }
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
public String bio { get; set; }
|
public string bio { get; set; }
|
||||||
public String[] bioLinks { get; set; }
|
public string[] bioLinks { get; set; }
|
||||||
public String email { get; set; }
|
public string email { get; set; }
|
||||||
public bool emailVerified { get; set; }
|
public bool emailVerified { get; set; }
|
||||||
public bool hasEmail { get; set; }
|
public bool hasEmail { get; set; }
|
||||||
public bool hasPendingEmail { get; set; }
|
public bool hasPendingEmail { get; set; }
|
||||||
public String obfuscatedEmail { get; set; }
|
public string obfuscatedEmail { get; set; }
|
||||||
public String obfuscatedPendingEmail { get; set; }
|
public string obfuscatedPendingEmail { get; set; }
|
||||||
public String steamId { get; set; }
|
public string steamId { get; set; }
|
||||||
public String[] steamDetails { get; set; }
|
public string[] steamDetails { get; set; }
|
||||||
public String oculusId { get; set; }
|
public string oculusId { get; set; }
|
||||||
public int acceptedTOSVersion { get; set; }
|
public int acceptedTOSVersion { get; set; }
|
||||||
public bool hasBirthday { get; set; }
|
public bool hasBirthday { get; set; }
|
||||||
public String[] friends { get; set; }
|
public string[] friends { get; set; }
|
||||||
public String[] onlineFriends { get; set; }
|
public string[] onlineFriends { get; set; }
|
||||||
public String[] activeFriends { get; set; }
|
public string[] activeFriends { get; set; }
|
||||||
public String[] offlineFriends { get; set; }
|
public string[] offlineFriends { get; set; }
|
||||||
public String[] friendGroupNames { get; set; }
|
public string[] friendGroupNames { get; set; }
|
||||||
public String state { get; set; }
|
public string state { get; set; }
|
||||||
public String status { get; set; }
|
public string status { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WorldUnityPackageObject
|
public class WorldUnityPackageObject
|
||||||
{
|
{
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
public String platform { get; set; }
|
public string platform { get; set; }
|
||||||
public String assetUrl { get; set; }
|
public string assetUrl { get; set; }
|
||||||
public String unityVersion { get; set; }
|
public string unityVersion { get; set; }
|
||||||
public int unitySortNumber { get; set; }
|
public int unitySortNumber { get; set; }
|
||||||
public int assetVersion { get; set; }
|
public int assetVersion { get; set; }
|
||||||
public String created_at { get; set; }
|
public string created_at { get; set; }
|
||||||
public String assetUrlObject { get; set; }
|
public string assetUrlObject { get; set; }
|
||||||
public String pluginUrl { get; set; }
|
public string pluginUrl { get; set; }
|
||||||
public String pluginUrlObject { get; set; }
|
public string pluginUrlObject { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LimitedWorldObject
|
public class LimitedWorldObject
|
||||||
{
|
{
|
||||||
public String name { get; set; }
|
public string name { get; set; }
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
public String authorName { get; set; }
|
public string authorName { get; set; }
|
||||||
public int authorId { get; set; }
|
public int authorId { get; set; }
|
||||||
public String[] tags { get; set; }
|
public string[] tags { get; set; }
|
||||||
public String created_at { get; set; }
|
public string created_at { get; set; }
|
||||||
public String updated_at { get; set; }
|
public string updated_at { get; set; }
|
||||||
public String releaseStatus { get; set; }
|
public string releaseStatus { get; set; }
|
||||||
public int visits { get; set; }
|
public int visits { get; set; }
|
||||||
public int occupants { get; set; }
|
public int occupants { get; set; }
|
||||||
public int capacity { get; set; }
|
public int capacity { get; set; }
|
||||||
public int favorites { get; set; }
|
public int favorites { get; set; }
|
||||||
public int popularity { get; set; }
|
public int popularity { get; set; }
|
||||||
public String imageUrl { get; set; }
|
public string imageUrl { get; set; }
|
||||||
public String thumbnailImageUrl { get; set; }
|
public string thumbnailImageUrl { get; set; }
|
||||||
public String organization { get; set; }
|
public string organization { get; set; }
|
||||||
public int heat { get; set; }
|
public int heat { get; set; }
|
||||||
public String publicationDate { get; set; }
|
public string publicationDate { get; set; }
|
||||||
public String labsPublicationDate { get; set; }
|
public string labsPublicationDate { get; set; }
|
||||||
public WorldUnityPackageObject[] unityPackages { get; set; }
|
public WorldUnityPackageObject[] unityPackages { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LimitedUserObject
|
public class LimitedUserObject
|
||||||
{
|
{
|
||||||
public String username { get; set; }
|
public string username { get; set; }
|
||||||
public String displayName { get; set; }
|
public string displayName { get; set; }
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
public String bio { get; set; }
|
public string bio { get; set; }
|
||||||
public String statys { get; set; }
|
public string statys { get; set; }
|
||||||
public String currentAvatarImageUrl { get; set; }
|
public string currentAvatarImageUrl { get; set; }
|
||||||
public String currentAvatarThumbnailImageUrl { get; set; }
|
public string currentAvatarThumbnailImageUrl { get; set; }
|
||||||
public String last_platform { get; set; }
|
public string last_platform { get; set; }
|
||||||
public String[] tags { get; set; }
|
public string[] tags { get; set; }
|
||||||
public String developerType { get; set; }
|
public string developerType { get; set; }
|
||||||
public bool isFriend { get; set; }
|
public bool isFriend { get; set; }
|
||||||
//public LimitedWorldObject location { get; set; }
|
|
||||||
|
//[JsonProperty(Required = Required.AllowNull)]
|
||||||
|
// public LimitedWorldObject location { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FriendsRequest
|
public class FriendsRequest
|
||||||
@ -118,13 +135,13 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
public int offset { get; set; }
|
public int offset { get; set; }
|
||||||
public int n { get; set; }
|
public int n { get; set; }
|
||||||
public bool offline { get; set; }
|
public bool offline { get; set; }
|
||||||
public String apiKey { get; set; }
|
public string apiKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TwoFactorRequest
|
public class TwoFactorRequest
|
||||||
{
|
{
|
||||||
public String apiKey { get; set; }
|
public string apiKey { get; set; }
|
||||||
public String code { get; set; }
|
public string code { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TwoFactorAuthReturn
|
public class TwoFactorAuthReturn
|
||||||
@ -134,110 +151,110 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
|
|
||||||
public class DisplayNameObject
|
public class DisplayNameObject
|
||||||
{
|
{
|
||||||
public String displayName { get; set; }
|
public string displayName { get; set; }
|
||||||
public String updated_at { get; set; }
|
public string updated_at { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserDataReturn
|
public class UserDataReturn
|
||||||
{
|
{
|
||||||
public String id { get; set; }
|
public string id { get; set; }
|
||||||
public String username { get; set; }
|
public string username { get; set; }
|
||||||
public String displayName { get; set; }
|
public string displayName { get; set; }
|
||||||
public String userIcon { get; set; }
|
public string userIcon { get; set; }
|
||||||
public String bio { get; set; }
|
public string bio { get; set; }
|
||||||
public String[] bioLinks { get; set; }
|
public string[] bioLinks { get; set; }
|
||||||
public DisplayNameObject[] pastDisplayNames { get; set; }
|
public DisplayNameObject[] pastDisplayNames { get; set; }
|
||||||
public bool hasEmail { get; set; }
|
public bool hasEmail { get; set; }
|
||||||
public bool hasPendingEmail { get; set; }
|
public bool hasPendingEmail { get; set; }
|
||||||
public String email { get; set; }
|
public string email { get; set; }
|
||||||
public String obfuscatedEmail { get; set; }
|
public string obfuscatedEmail { get; set; }
|
||||||
public String obfuscatedPendingEmail { get; set; }
|
public string obfuscatedPendingEmail { get; set; }
|
||||||
public bool emailVerified { get; set; }
|
public bool emailVerified { get; set; }
|
||||||
public bool hasBirthday { get; set; }
|
public bool hasBirthday { get; set; }
|
||||||
public bool unsubscribe { get; set; }
|
public bool unsubscribe { get; set; }
|
||||||
public String[] friends { get; set; }
|
public string[] friends { get; set; }
|
||||||
public String[] friendGroupNames { get; set; }
|
public string[] friendGroupNames { get; set; }
|
||||||
public String currentAvatarImageUrl { get; set; }
|
public string currentAvatarImageUrl { get; set; }
|
||||||
public String currentAvatarThumbnailImageUrl { get; set; }
|
public string currentAvatarThumbnailImageUrl { get; set; }
|
||||||
public String fallbackAvatar { get; set; }
|
public string fallbackAvatar { get; set; }
|
||||||
public String currentAvatar { get; set; }
|
public string currentAvatar { get; set; }
|
||||||
public String currentAvatarAssetUrl { get; set; }
|
public string currentAvatarAssetUrl { get; set; }
|
||||||
public String accountDeletionDate { get; set; }
|
public string accountDeletionDate { get; set; }
|
||||||
public int acceptedTOSVersion { get; set; }
|
public int acceptedTOSVersion { get; set; }
|
||||||
public String steamId { get; set; }
|
public string steamId { get; set; }
|
||||||
public String oculusId { get; set; }
|
public string oculusId { get; set; }
|
||||||
public bool hasLoggedInFromClient { get; set; }
|
public bool hasLoggedInFromClient { get; set; }
|
||||||
public String homeLocation { get; set; }
|
public string homeLocation { get; set; }
|
||||||
public bool twoFactorAuthEnabled { get; set; }
|
public bool twoFactorAuthEnabled { get; set; }
|
||||||
public String status { get; set; }
|
public string status { get; set; }
|
||||||
public String statusDescription { get; set; }
|
public string statusDescription { get; set; }
|
||||||
public String state { get; set; }
|
public string state { get; set; }
|
||||||
public String[] tags { get; set; }
|
public string[] tags { get; set; }
|
||||||
public String developerType { get; set; }
|
public string developerType { get; set; }
|
||||||
public String last_login { get; set; }
|
public string last_login { get; set; }
|
||||||
public String last_platform { get; set; }
|
public string last_platform { get; set; }
|
||||||
public bool allowAvatarCopying { get; set; }
|
public bool allowAvatarCopying { get; set; }
|
||||||
public bool isFriend { get; set; }
|
public bool isFriend { get; set; }
|
||||||
public String friendKey { get; set; }
|
public string friendKey { get; set; }
|
||||||
public String[] onlineFriends { get; set; }
|
public string[] onlineFriends { get; set; }
|
||||||
public String[] activeFriends { get; set; }
|
public string[] activeFriends { get; set; }
|
||||||
public String[] offlineFriends { get; set; }
|
public string[] offlineFriends { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ConfigDataReturn
|
public class ConfigDataReturn
|
||||||
{
|
{
|
||||||
public String messageOfTheDay { get; set; }
|
public string messageOfTheDay { get; set; }
|
||||||
public String timeOutWorldId { get; set; }
|
public string timeOutWorldId { get; set; }
|
||||||
public String gearDemoRoomId { get; set; }
|
public string gearDemoRoomId { get; set; }
|
||||||
public String releaseServerVersionStandalone { get; set; }
|
public string releaseServerVersionStandalone { get; set; }
|
||||||
public String downloadLinkWindows { get; set; }
|
public string downloadLinkWindows { get; set; }
|
||||||
public String releaseAppVersionStandalone { get; set; }
|
public string releaseAppVersionStandalone { get; set; }
|
||||||
public String devAppVersionStandalone { get; set; }
|
public string devAppVersionStandalone { get; set; }
|
||||||
public String devServerVersionStandalone { get; set; }
|
public string devServerVersionStandalone { get; set; }
|
||||||
public String devDownloadLinkWindows { get; set; }
|
public string devDownloadLinkWindows { get; set; }
|
||||||
public int currentTOSVersiona { get; set; }
|
public int currentTOSVersiona { get; set; }
|
||||||
public String releaseSdkUrl { get; set; }
|
public string releaseSdkUrl { get; set; }
|
||||||
public String releaseSdkVersion { get; set; }
|
public string releaseSdkVersion { get; set; }
|
||||||
public String devSdkUrl { get; set; }
|
public string devSdkUrl { get; set; }
|
||||||
public String devSdkVersion { get; set; }
|
public string devSdkVersion { get; set; }
|
||||||
public String[] whiteListedAssetUrls { get; set; }
|
public string[] whiteListedAssetUrls { get; set; }
|
||||||
public String clientApiKey { get; set; }
|
public string clientApiKey { get; set; }
|
||||||
public String viveWindowsUrl { get; set; }
|
public string viveWindowsUrl { get; set; }
|
||||||
public String sdkUnityVersion { get; set; }
|
public string sdkUnityVersion { get; set; }
|
||||||
public String hubWorldId { get; set; }
|
public string hubWorldId { get; set; }
|
||||||
public String homeWorldId { get; set; }
|
public string homeWorldId { get; set; }
|
||||||
public String tutorialWorldId { get; set; }
|
public string tutorialWorldId { get; set; }
|
||||||
public bool disableEventStream { get; set; }
|
public bool disableEventStream { get; set; }
|
||||||
public bool disableAvatarGating { get; set; }
|
public bool disableAvatarGating { get; set; }
|
||||||
public bool disableFeedbackGating { get; set; }
|
public bool disableFeedbackGating { get; set; }
|
||||||
public bool disableRegistration { get; set; }
|
public bool disableRegistration { get; set; }
|
||||||
public String plugin { get; set; }
|
public string plugin { get; set; }
|
||||||
public String sdkNotAllowedToPublishMessage { get; set; }
|
public string sdkNotAllowedToPublishMessage { get; set; }
|
||||||
public String sdkDeveloperFaqUrl { get; set; }
|
public string sdkDeveloperFaqUrl { get; set; }
|
||||||
public String sdkDiscordUrl { get; set; }
|
public string sdkDiscordUrl { get; set; }
|
||||||
public String notAllowedToSelectAvatarInPrivateWorldMessage { get; set; }
|
public string notAllowedToSelectAvatarInPrivateWorldMessage { get; set; }
|
||||||
public int userVerificationTimeout { get; set; }
|
public int userVerificationTimeout { get; set; }
|
||||||
public int userUpdatePeriod { get; set; }
|
public int userUpdatePeriod { get; set; }
|
||||||
public int userVerificationDelay { get; set; }
|
public int userVerificationDelay { get; set; }
|
||||||
public int userVerificationRetry { get; set; }
|
public int userVerificationRetry { get; set; }
|
||||||
public int worldUpdatePeriod { get; set; }
|
public int worldUpdatePeriod { get; set; }
|
||||||
public int moderationQueryPeriod { get; set; }
|
public int moderationQueryPeriod { get; set; }
|
||||||
public String defaultAvatar { get; set; }
|
public string defaultAvatar { get; set; }
|
||||||
// public String dynamicWorldRows { get; set; } // Array of DynamicWorldRows WIP
|
// public String dynamicWorldRows { get; set; } // Array of DynamicWorldRows WIP
|
||||||
public String address { get; set; }
|
public string address { get; set; }
|
||||||
public String contactEmail { get; set; }
|
public string contactEmail { get; set; }
|
||||||
public String supportEmail { get; set; }
|
public string supportEmail { get; set; }
|
||||||
public String jobsEmail { get; set; }
|
public string jobsEmail { get; set; }
|
||||||
public String copyrightEmail { get; set; }
|
public string copyrightEmail { get; set; }
|
||||||
public String moderationEmail { get; set; }
|
public string moderationEmail { get; set; }
|
||||||
public bool disableEmail { get; set; }
|
public bool disableEmail { get; set; }
|
||||||
public String appName { get; set; }
|
public string appName { get; set; }
|
||||||
public String serverName { get; set; }
|
public string serverName { get; set; }
|
||||||
public String deploymentGroup { get; set; }
|
public string deploymentGroup { get; set; }
|
||||||
public String buildVersionTag { get; set; }
|
public string buildVersionTag { get; set; }
|
||||||
public String apiKey { get; set; }
|
public string apiKey { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,19 +14,19 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
{
|
{
|
||||||
class VRCAuthenticator
|
class VRCAuthenticator
|
||||||
{
|
{
|
||||||
private String userName;
|
private string userName;
|
||||||
private String password;
|
private string password;
|
||||||
private String apiKey;
|
private string apiKey;
|
||||||
private String authToken;
|
private string authToken;
|
||||||
private bool twoFactor = false;
|
private bool twoFactor = false;
|
||||||
|
|
||||||
public VRCAuthenticator(String name, String pass)
|
public VRCAuthenticator(string name, string pass)
|
||||||
{
|
{
|
||||||
userName = name;
|
userName = name;
|
||||||
password = pass;
|
password = pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<String> getApiKey()
|
public async Task<string> getApiKey()
|
||||||
{
|
{
|
||||||
Uri uri = new Uri(VRCAPIBase.api_base + "/config");
|
Uri uri = new Uri(VRCAPIBase.api_base + "/config");
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
@ -37,7 +37,7 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getAuthToken(String name, String pass)
|
public string getAuthToken(string name, string pass)
|
||||||
{
|
{
|
||||||
var cookieContainer = new CookieContainer();
|
var cookieContainer = new CookieContainer();
|
||||||
|
|
||||||
@ -69,14 +69,14 @@ namespace VRCExternalTools.VRCAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<VRCAPI> loginAsync()
|
public async Task<VRCAPI> loginAsync()
|
||||||
{
|
{
|
||||||
apiKey = await getApiKey();
|
apiKey = await getApiKey();
|
||||||
authToken = getAuthToken(userName, password);
|
authToken = getAuthToken(userName, password);
|
||||||
if (authToken == String.Empty)
|
if (authToken == string.Empty)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,28 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
@ -86,10 +108,17 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="avatarWindow.xaml.cs">
|
||||||
|
<DependentUpon>avatarWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Friend.cs" />
|
<Compile Include="Friend.cs" />
|
||||||
<Compile Include="VRCAPI\VRCAPIBase.cs" />
|
<Compile Include="VRCAPI\VRCAPIBase.cs" />
|
||||||
<Compile Include="VRCAPI\VRCAuthenticator.cs" />
|
<Compile Include="VRCAPI\VRCAuthenticator.cs" />
|
||||||
<Compile Include="VRCAPI\VRCAPI.cs" />
|
<Compile Include="VRCAPI\VRCAPI.cs" />
|
||||||
|
<Page Include="avatarWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
36
VRCExternalTools/avatarWindow.xaml
Normal file
36
VRCExternalTools/avatarWindow.xaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<Window x:Class="VRCExternalTools.avatarWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:VRCExternalTools"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="AVATAR" Height="370" Width="400">
|
||||||
|
<Grid>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="全般">
|
||||||
|
<Grid Background="#FFE5E5E5">
|
||||||
|
<Label Content="id:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="name:" HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="description:" HorizontalAlignment="Left" Margin="10,62,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="version:" HorizontalAlignment="Left" Margin="10,88,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="featured:" HorizontalAlignment="Left" Margin="10,114,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="created__at:" HorizontalAlignment="Left" Margin="10,140,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="updated__at:" HorizontalAlignment="Left" Margin="10,166,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="releaseStatus:" HorizontalAlignment="Left" Margin="10,192,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="platform:" HorizontalAlignment="Left" Margin="9,218,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="idLabel" Content="Label" HorizontalAlignment="Left" Margin="97,10,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="nameLabel" Content="Label" HorizontalAlignment="Left" Margin="97,36,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="descriptionLabel" Content="Label" HorizontalAlignment="Left" Margin="97,62,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="versionLabel" Content="Label" HorizontalAlignment="Left" Margin="97,88,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="featuredLabel" Content="Label" HorizontalAlignment="Left" Margin="97,114,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="created_atLabel" Content="Label" HorizontalAlignment="Left" Margin="97,140,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="updated_atLabel" Content="Label" HorizontalAlignment="Left" Margin="97,166,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="releaseStatusLabel" Content="Label" HorizontalAlignment="Left" Margin="97,192,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="platformLabel" Content="Label" HorizontalAlignment="Left" Margin="97,218,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Button x:Name="downloadPackageButton" Content="download package" HorizontalAlignment="Left" Margin="10,249,0,0" VerticalAlignment="Top" Width="125" Click="downloadPackageButton_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
65
VRCExternalTools/avatarWindow.xaml.cs
Normal file
65
VRCExternalTools/avatarWindow.xaml.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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.Shapes;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using VRCExternalTools.VRCAPI;
|
||||||
|
|
||||||
|
namespace VRCExternalTools
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// avatarWindow.xaml の相互作用ロジック
|
||||||
|
/// </summary>
|
||||||
|
public partial class avatarWindow : Window
|
||||||
|
{
|
||||||
|
private VRCAPI.VRCAPI api;
|
||||||
|
private VRCAPIBase.AvatarObject avatar;
|
||||||
|
|
||||||
|
public avatarWindow(VRCAPI.VRCAPI vrcApi, VRCAPIBase.AvatarObject currentAvatar)
|
||||||
|
{
|
||||||
|
api = vrcApi;
|
||||||
|
avatar = currentAvatar;
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.Title = avatar.name;
|
||||||
|
idLabel.Content = avatar.id;
|
||||||
|
nameLabel.Content = avatar.name;
|
||||||
|
descriptionLabel.Content = avatar.description;
|
||||||
|
versionLabel.Content = avatar.version.ToString();
|
||||||
|
featuredLabel.Content = avatar.featured.ToString();
|
||||||
|
created_atLabel.Content = avatar.created_at;
|
||||||
|
updated_atLabel.Content = avatar.updated_at;
|
||||||
|
releaseStatusLabel.Content = avatar.releaseStatus;
|
||||||
|
platformLabel.Content = avatar.platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void downloadPackageButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var perfectAvatar = api.getAvatarById(avatar.id);
|
||||||
|
|
||||||
|
var dialog = new SaveFileDialog();
|
||||||
|
dialog.Filter = "Unity package file(*.unitypackage)|*.unitypackage";
|
||||||
|
dialog.FileName = perfectAvatar.name + ".unitypackage";
|
||||||
|
|
||||||
|
var result = dialog.ShowDialog() ?? false;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var client = new WebClient();
|
||||||
|
client.DownloadFile(perfectAvatar.unityPackageUrl, dialog.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user