Beispiel #1
0
 private void FillAvatar(AvatarResponse avatar)
 {
     txt_avatar_id.Text          = avatar.id;
     txt_avatar_id.Tag           = avatar;
     txt_avatar_name.Text        = avatar.name;
     txt_avatar_version.Text     = avatar.version.ToString();
     txt_avatar_author.Text      = $"{avatar.authorName} ({avatar.authorId})";
     txt_avatar_asseturl.Text    = avatar.assetUrl;
     txt_avatar_description.Text = avatar.description;
 }
 public UserDetailsResponse(UsersDetails userDetails)
 {
     UserId           = userDetails.Id;
     Height           = userDetails.Height;
     Weight           = userDetails.Weight;
     Age              = userDetails.Age;
     BMI              = userDetails.BMI;
     BMR              = userDetails.BMR;
     BrandingSettings = userDetails.BrandingSettings;
     if (userDetails.Avatar != null)
     {
         Avatar = new AvatarResponse(userDetails.Avatar);
     }
 }
Beispiel #3
0
        static async Task Main(string[] args)
        {
            VRChatApi.VRChatApi api = new VRChatApi.VRChatApi("username", "password");
            VRChatApi.Logging.LogProvider.SetCurrentLogProvider(new ColoredConsoleLogProvider());

            // remote config
            ConfigResponse config = await api.RemoteConfig.Get();

            // user api
            //UserResponse userNew = await api.UserApi.Register("someName", "somePassword", "*****@*****.**");
            UserResponse user = await api.UserApi.Login();

            //UserResponse userUpdated = await api.UserApi.UpdateInfo(user.id, null, null, null, new List<string>() { "admin_moderator", "admin_scripting_access", "system_avatar_access", "system_world_access" });

            // friends
            //List<UserBriefResponse> friends = await api.FriendsApi.Get(0, 20, true);
            //NotificationResponse friendRequestResponse = await api.FriendsApi.SendRequest("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685", api.UserApi.Username);
            //string friendDeletionResponse = await api.FriendsApi.DeleteFriend("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685");
            //await api.FriendsApi.AcceptFriend("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685");

            // world api
            var           worldId = "wrld_b2d24c29-1ded-4990-a90d-dd6dcc440300"; // The great Pug
            WorldResponse world   = await api.WorldApi.Get(worldId);

            //List<WorldBriefResponse> starWorlds = await api.WorldApi.Search(WorldGroups.Favorite, count: 4);
            List <WorldBriefResponse> scaryWorlds = await api.WorldApi.Search(keyword : "Scary", sort : SortOptions.Popularity);

            List <WorldBriefResponse> featuredWorlds = await api.WorldApi.Search(featured : true);

            WorldMetadataResponse metadata = await api.WorldApi.GetMetadata(worldId);

            var instances = new List <WorldInstanceResponse>();

            if (world.instances.Count > 0)
            {
                foreach (WorldInstance instance in world.instances)
                {
                    WorldInstanceResponse worldInst = await api.WorldApi.GetInstance(world.id, instance.id);

                    instances.Add(worldInst);
                }
            }

            // avatar api
            AvatarResponse avatar = await api.AvatarApi.GetById("avtr_17036f54-f706-46bf-8a43-0c60564123ff");
        }
Beispiel #4
0
        public async Task <AvatarResponse> GetById(string id)
        {
            Console.WriteLine($"Getting avatar details using ID: {id}");
            HttpResponseMessage response = await Global.HttpClient.GetAsync($"avatars/{id}?apiKey={Global.ApiKey}");

            AvatarResponse res = null;

            if (response.IsSuccessStatusCode)
            {
                var json = await response.Content.ReadAsStringAsync();

                Console.WriteLine($"JSON received: {json}");

                res = JsonConvert.DeserializeObject <AvatarResponse>(json);
            }

            return(res);
        }
Beispiel #5
0
        public TreeNodeTag(NodeType type, string id = null, params object[] responses)
        {
            Type = type; Id = id;
            foreach (var response in responses)
            {
                switch (response)
                {
                case UserResponse ur:
                    userResponse      = ur;
                    userBriefResponse = ur; break;

                case UserBriefResponse ubr:
                    userBriefResponse = ubr; break;

                case WorldResponse wr:
                    worldResponse      = wr;
                    worldBriefResponse = wr; break;

                case WorldBriefResponse wbr:
                    worldBriefResponse = wbr; break;

                case WorldInstanceResponse wir:
                    worldInstanceResponse = wir; break;

                case WorldInstance wir:
                    worldInstance = wir; break;

                case WorldInstanceUserResponse wiur:
                    worldInstanceUserResponse = wiur; break;

                case PlayerModeratedResponse pmr:
                    playerModeratedResponse = pmr; break;

                case NotificationResponse nr:
                    notificationResponse = nr; break;

                case AvatarResponse ar:
                    avatarResponse = ar; break;

                default:
                    Object = response; break;
                }
            }
        }
Beispiel #6
0
        async Task CheckAvatarIDIfStolen()
        {
            string n  = Environment.NewLine;
            string id = avatarIDTextField.Text;

            logTextField.Text += "Checking " + id + " to see if it is a stolen avatar";

            try
            {
                AvatarResponse avatar = await api.AvatarApi.GetById(id);

                UserBriefResponse avatarOwner = await api.UserApi.GetById(avatar.authorId);

                CheckIfStolen(avatar.assetUrl, avatar.id, avatarOwner.username, avatarOwner.displayName, avatarOwner.id);
            }
            catch (Exception e)
            {
                string response = await api.AvatarApi.GetUrl(id);

                string[] parse    = response.Split('"');
                string   assetURL = "";
                string   avatarID = "";
                for (int i = 0; i < parse.Length; i++)
                {
                    if (parse[i].Contains("assetUrl"))
                    {
                        assetURL = parse[i + 2];
                        break;
                    }
                }
                foreach (String sss in parse)
                {
                    if (sss.Contains("avtr_"))
                    {
                        avatarID = sss;
                        break;
                    }
                }
                CheckIfStolen(assetURL, avatarID, "", "", "");
                //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "              " + "Manual Asset URL: " + assetURL + n);
            }
        }
Beispiel #7
0
        async void OnButtonClicked()
        {
            try
            {
                List <FavouriteResponse> scaryWorlds = await api.FavouriteApi.GetFavourites("avatar", 100);



                foreach (var Worlds in scaryWorlds)
                {
                    AvatarResponse Avataron = await api.AvatarApi.GetById(Worlds.favoriteId);

                    userlist.Add(new serwor
                    {
                        id = Avataron.id,

                        name = Avataron.name,

                        authorName = Avataron.authorName,

                        thumbnailImageUrl = Avataron.thumbnailImageUrl,

                        description = Avataron.description
                    });
                }



                BindingContext = this;

                listpro.ItemsSource = userlist;

                RefreshData();
                listpro.IsRefreshing = false;
            }
            catch { }
        }
Beispiel #8
0
        async Task StartApi()
        {
            if (IsLoggedIn)
            {
                return;
            }

            string n      = Environment.NewLine;
            string userID = "";

            try
            {
                Global.ApiKey = apiKeyTextField.Text;
                try { System.IO.File.WriteAllLines("APIKey.cfg", new string[] { Global.ApiKey }); } catch (Exception e) { /*unhandled*/ }
                logTextField.Text += "Logging in to API as " + userTextField.Text + n;
                //logTextField.Text += "Creating API Instance" + n;
                api = new VRChatApi.VRChatApi(userTextField.Text, passwordTextField.Text);
                //logTextField.Text += "Getting config response" + n;
                ConfigResponse config = await api.RemoteConfig.Get();

                UserResponse user = await api.UserApi.Login();

                if (user == null)
                {
                    logTextField.Text += "Login Failed (Incorrect Username/Password OR APIKey)" + n;
                    IsLoggedIn         = false;
                    return;
                }

                loginButton.Enabled = false;

                //logTextField.Text += user.DeepDumpAsString() + n;
                IsLoggedIn = true;

                userID = user.id;
                if (!user.friends.Contains(userID))
                {
                    await api.UserApi.SendFriendRequest(userID);

                    await api.FriendsApi.AcceptFriend(userID);
                }
            } catch (Exception e)
            {
                logTextField.Text += e.ToString() + Environment.NewLine;
            }

            new Thread(async() =>
            {
                while (true)
                {
                    if (!IsLoggedIn)
                    {
                        break;
                    }

                    if (!loggingOnButton.Checked)
                    {
                        Thread.Sleep(1000);
                        continue;
                    }

                    //usr_80a984c9-2b8e-4396-b893-2f31d8fd2ba3
                    UserBriefResponse userPing = await api.UserApi.GetById(userID);
                    //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "User Ping" + n + n + userPing.DeepDumpAsString() + n);

                    ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "Running check for stolen avatars" + n);

                    IList <String> ids = await api.WorldApi.GetUsersInInstance(userPing.worldId + "/" + userPing.instanceId);
                    foreach (String s in ids)
                    {
                        //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + s + n);

                        UserBriefResponse userInRoom = await api.UserApi.GetById(s);
                        if (userInRoom == null)
                        {
                            continue;
                        }
                        IList <string> userPublicAvatars = await api.AvatarApi.GetAvatarList(userInRoom.id);

                        foreach (String ss in userPublicAvatars)
                        {
                            //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "              " + ss + n);
                            try {
                                AvatarResponse avatar = await api.AvatarApi.GetById(ss);
                                CheckIfStolen(avatar.assetUrl, avatar.id, userInRoom.username, userInRoom.displayName, userInRoom.id);
                            } catch (Exception e) {
                                string response = await api.AvatarApi.GetUrl(ss);
                                string[] parse  = response.Split('"');
                                string assetURL = "";
                                string avatarID = "";
                                for (int i = 0; i < parse.Length; i++)
                                {
                                    if (parse[i].Contains("assetUrl"))
                                    {
                                        assetURL = parse[i + 2];
                                        break;
                                    }
                                }
                                foreach (String sss in parse)
                                {
                                    if (sss.Contains("avtr_"))
                                    {
                                        avatarID = sss;
                                        break;
                                    }
                                }
                                CheckIfStolen(assetURL, avatarID, userInRoom.username, userInRoom.displayName, userInRoom.id);
                                //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "              " + "Manual Asset URL: " + assetURL + n);
                            }
                        }
                    }

                    ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "Check finished. Waiting 60 seconds..." + n);
                    Thread.Sleep(60000);
                }
            }).Start();
        }