Example #1
0
        public async void SetupVRCApiAsync()
        {
            var confirmResult = MessageBox.Show("You are not logged in to VRChat.\n\nIn order to use this tab you need to log in through your VRChat account.\n\nDo you want to log in?", "Not logged in!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (confirmResult != DialogResult.Yes)
            {
                tabs_main.SelectTab(0); return;
            }
            var loginModal = new Setup.VRCAPI.LoginModal();

            loginModal.ShowDialog();
            var username = loginModal.txt_username.Text; var password = loginModal.txt_password.Text;
            // VRChatApi.Logging.LogProvider.SetCurrentLogProvider(new ColoredConsoleLogProvider());
            // ConfigResponse config = await vrcapi.RemoteConfig.Get();
            var logged_in = await VRCAPILogin(username, password);

            if (!logged_in)
            {
                return;
            }
            remoteConfig = await vrcapi.RemoteConfig.Get();

            Logger.Trace(remoteConfig.ToJson());
            config["VRCAPI"]["u"] = Utils.Utils.Base64Encode(username);
            config["VRCAPI"]["p"] = Utils.Utils.Base64Encode(password);
            Config.Save(config);
        }