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);
        }
 void ConfigManager_FetchCompleted(ConfigResponse configResponse)
 {
     ConfigManager.FetchCompleted -= ConfigManager_FetchCompleted;
     Assert.That(configResponse.requestOrigin == ConfigOrigin.Remote, "Request orgin was {0}, should have been {1}", configResponse.requestOrigin, ConfigOrigin.Remote);
     Assert.That(configResponse.status == ConfigRequestStatus.Success, "Request status was {0}, should have been {1}", configResponse.status, ConfigRequestStatus.Success);
     testFinished = true;
 }
Example #3
0
    private void ApplyRemoteSettings(ConfigResponse configResponse)
    {
        // Conditionally update settings, depending on the response's origin:
        switch (configResponse.requestOrigin)
        {
        case ConfigOrigin.Default:
            Debug.Log("No settings loaded this session; using default values.");
            break;

        case ConfigOrigin.Cached:
            Debug.Log("No settings loaded this session; using cached values from a previous session.");
            break;

        case ConfigOrigin.Remote:
            Debug.Log("New settings loaded this session; update values accordingly.");
            SetVars();

            if (!initRemoteApply)
            {
                Start2();
            }
            initRemoteApply = true;
            break;
        }
    }
        void OnConfigsFetched(ConfigResponse configResponse)
        {
            Debug.Log($"UnityConfigsLoader {nameof(OnConfigsFetched)} configResponse {configResponse.requestOrigin}");

            ConfigManager.FetchCompleted -= OnConfigsFetched;
            ReturnConfigs();
        }
Example #5
0
 private void SetActivePrefabNew(ConfigResponse response)
 {
     if (_newObject != null)
     {
         _newObject.SetActive(ConfigManager.appConfig.GetBool("NewPrefab"));
     }
 }
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Getting list of sandboxes.");
            ConfigResponse <IEnumerable <string> > response = ConfigurationManager.GetSandboxesAsync(this.AccountId).Result;

            this.WriteObject(response.Result);
        }
Example #7
0
        static async Task Main(string[] args)
        {
            VRChatApi.VRChatApi api = new VRChatApi.VRChatApi("avail", "");

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

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

            //UserResponse userNew = await api.UserApi.Register("someName", "somePassword", "*****@*****.**");
            //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
            WorldResponse world = await api.WorldApi.Get("wrld_b2d24c29-1ded-4990-a90d-dd6dcc440300");

            //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("wrld_b2d24c29-1ded-4990-a90d-dd6dcc440300");

            /*if (world.instances.Count > 0)
             * {
             *  WorldInstanceResponse worldInst = await api.WorldApi.GetInstance(world.id, world.instances[0].id);
             * }*/
        }
        private static async Task <int> CommitDocumentsAsync(CommitDocumentsOptions options)
        {
            if (options.DocumentType == DocumentType.Sandbox && string.IsNullOrEmpty(options.Sandbox))
            {
                throw new ArgumentException("Sandbox must be specified when committing sandbox documents.");
            }

            if (options.DocumentType == DocumentType.Account)
            {
                options.Sandbox = null;
            }

            IEnumerable <string> files = Glob(options.Files);
            int fileCount = files.Count();

            if (fileCount == 0)
            {
                Console.Error.WriteLine("There are no files selected to commit.");
                return(-1);
            }

            Console.WriteLine($"Committing {fileCount} file(s) to Xbox Live.");

            string eTag = options.ETag ?? GetETag(files, options.Sandbox);

            if (options.Force)
            {
                eTag = null;
            }

            Task <ConfigResponse <ValidationResponse> > documentsTask;

            if (options.DocumentType == DocumentType.Sandbox)
            {
                Console.WriteLine("Committing sandbox documents.");
                documentsTask = ConfigurationManager.CommitSandboxDocumentsAsync(files, options.Scid, options.Sandbox, eTag, options.ValidateOnly, options.Message);
            }
            else
            {
                Console.WriteLine("Committing account documents.");
                if (options.AccountId == Guid.Empty)
                {
                    DevAccount user = ToolAuthentication.LoadLastSignedInUser();
                    options.AccountId = new Guid(user.AccountId);
                }

                documentsTask = ConfigurationManager.CommitAccountDocumentsAsync(files, options.AccountId, eTag, options.ValidateOnly, options.Message);
            }

            ConfigResponse <ValidationResponse> result = await documentsTask;

            SaveETag(result.Result.ETag, Path.GetDirectoryName(files.First()), options.Sandbox);

            Console.WriteLine($"Can Commit: {result.Result.CanCommit}");
            Console.WriteLine($"Committed:  {result.Result.Committed}");

            PrintValidationInfo(result.Result.ValidationInfo);

            return(0);
        }
Example #9
0
    void test_DownloadResource(ConfigResponse res)
    {
        configLoading.SetDescribe(Core.Data.stringManager.getString(9027));
        configLoading.ShowLoading(0);

        HttpDownloadTask task = new HttpDownloadTask(ThreadType.MainThread, TaskResponse.Igonre_Response);

        string url  = res.url;
        string fn   = "Config.zip";
        string path = DeviceInfo.PersistRootPath;

        Debug.Log("path=" + path);
        long size = res.size;

        task.AppendDownloadParam(url, fn, path, res.md5, size);

        task.DownloadStart += (string durl) => { ConsoleEx.DebugLog("Download starts and url = " + durl); };

        task.taskCompeleted += () => { ConsoleEx.DebugLog("Download success."); };
        task.afterCompleted += testDownloadResp;
        task.ErrorOccured   += (s, t) => { step = LoginStep.Download_ERROR; ConsoleEx.DebugLog("Download failure."); };

        task.Report += (cur, total) => {
            ConsoleEx.DebugLog("current Bytes = " + cur + ", total Bytes = " + total);
            configLoading.ShowLoading((float)cur / (float)total);
        };

        task.DispatchToRealHandler();
    }
Example #10
0
    void HandleFetch(ConfigResponse response)
    {
        switch (response.requestOrigin)
        {
        case ConfigOrigin.Default:

            break;

        case ConfigOrigin.Cached:

            break;

        case ConfigOrigin.Remote:
            this.useAds = ConfigManager.appConfig.GetBool("Use Ads");

            //ad test mode
            //and Admob and IS rate

            break;

        default:

            break;
        }
    }
Example #11
0
        private void HandleInput(byte[] data, int offset)
        {
            byte messageType = data[offset + 2];

            if (messageType == Message.MessageTypeConfigResponse)
            {
                ConfigResponse response = new ConfigResponse();
                response.Read(data, offset);
                //response.Dump();
                if (_deviceState == DeviceState.Ready || response.RequestId == 0xffff)
                {
                    HandleConfigResponse(response);
                }
            }
            else if (messageType == Message.MessageTypePortEvent)
            {
                PortEvent evt = new PortEvent();
                //evt.Dump();
                evt.Read(data, offset);
                if (_deviceState == DeviceState.Ready)
                {
                    HandlePortEvent(evt);
                }
            }
            else
            {
                throw new WirekiteException(String.Format("Invalid message type ({0}) received", messageType));
            }
        }
        void onUpdateSetting(ConfigResponse config)
        {
            if (config.status == ConfigRequestStatus.Success)
            {
                minVersion    = ConfigManager.appConfig.GetInt(minVersionRemoteName, 0);
                letestVersion = ConfigManager.appConfig.GetInt(letestVersionRemoteName, currentVersion);

                letestAndroidURL = ConfigManager.appConfig.GetString(letestAndroidURLName, letestAndroidURL);
                letestIosURL     = ConfigManager.appConfig.GetString(letestIosURLName, letestIosURL);

                UpdateAvalibleMsg = ConfigManager.appConfig.GetString(UpdateAvalibleMsgName, UpdateAvalibleMsg);
                UpdateNeedMsg     = ConfigManager.appConfig.GetString(UpdateNeedMsgName, UpdateNeedMsg);

                ShowNews            = ConfigManager.appConfig.GetBool(ShowNewsName, ShowNews);
                NewsImageURL        = ConfigManager.appConfig.GetString(NewsImageURLName, NewsImageURL);
                NewsClickAndroidURL = ConfigManager.appConfig.GetString(NewsClickAndroidURLName, NewsClickAndroidURL);
                NewsClickIosURL     = ConfigManager.appConfig.GetString(NewsClickIosURLName, NewsClickIosURL);

                if (currentVersion < minVersion)
                {
                    ShowUpdateNeedPopup();
                }
                else if (currentVersion < letestVersion)
                {
                    ShowUpdateAvaliblePopup();
                }
                else if (ShowNews)
                {
                    StartCoroutine(setupNewsImage());
                }
            }
        }
Example #13
0
        private async Task <string> GetConfigInner(string tenant, string dataId, string group, long timeoutMs)
        {
            group = ParamUtils.Null2DefaultGroup(group);
            ParamUtils.CheckKeyParam(dataId, group);
            ConfigResponse cr = new ConfigResponse();

            cr.SetDataId(dataId);
            cr.SetTenant(tenant);
            cr.SetGroup(group);

            // 优先使用本地配置
            string content = await FileLocalConfigInfoProcessor.GetFailoverAsync(_worker.GetAgentName(), dataId, group, tenant);

            if (content != null)
            {
                _logger?.LogWarning(
                    "[{0}] [get-config] get failover ok, dataId={1}, group={2}, tenant={3}, config={4}",
                    _worker.GetAgentName(), dataId, group, tenant, ContentUtils.TruncateContent(content));

                cr.SetContent(content);
                _configFilterChainManager.DoFilter(null, cr);
                content = cr.GetContent();
                return(content);
            }

            try
            {
                List <string> ct = await _worker.GetServerConfig(dataId, group, tenant, timeoutMs, false);

                cr.SetContent(ct[0]);

                _configFilterChainManager.DoFilter(null, cr);
                content = cr.GetContent();

                return(content);
            }
            catch (NacosException ioe)
            {
                if (NacosException.NO_RIGHT == ioe.ErrorCode)
                {
                    throw;
                }

                _logger?.LogWarning(
                    "[{0}] [get-config] get from server error, dataId={1}, group={2}, tenant={3}, msg={4}",
                    _worker.GetAgentName(), dataId, group, tenant, ioe.ErrorMsg);
            }

            _logger?.LogWarning(
                "[{0}] [get-config] get snapshot ok, dataId={1}, group={2}, tenant={3}, config={4}",
                _worker.GetAgentName(), dataId, group, tenant, ContentUtils.TruncateContent(content));

            content = await FileLocalConfigInfoProcessor.GetSnapshotAync(_worker.GetAgentName(), dataId, group, tenant);

            cr.SetContent(content);
            _configFilterChainManager.DoFilter(null, cr);
            content = cr.GetContent();
            return(content);
        }
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Obtaining web services.");

            ConfigResponse <IEnumerable <WebService> > response = ConfigurationManager.GetWebServicesAsync(this.AccountId).Result;

            this.WriteObject(response.Result);
        }
Example #15
0
 void setLog(ConfigResponse response)
 {
     if (ConfigManager.appConfig.GetString("LogTitle").Length > 1 && ConfigManager.appConfig.GetString("LogText").Length > 1)
     {
         title.text = ConfigManager.appConfig.GetString("LogTitle");
         log.text   = ConfigManager.appConfig.GetString("LogText").Replace("/n", "<br><br>");
     }
 }
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Getting achievement images.");

            ConfigResponse <IEnumerable <AchievementImage> > response = ConfigurationManager.GetAchievementImagesAsync(this.Scid).Result;

            this.WriteObject(response.Result, true);
        }
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Obtaining product.");

            ConfigResponse <Product> response = ConfigurationManager.GetProductAsync(this.ProductId).Result;

            this.WriteObject(response.Result, true);
        }
Example #18
0
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Obtaining relying parties.");

            ConfigResponse <IEnumerable <RelyingParty> > response = ConfigurationManager.GetRelyingPartiesAsync(this.AccountId).Result;

            this.WriteObject(response.Result);
        }
Example #19
0
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Getting achievement image.");

            ConfigResponse <AchievementImage> response = ConfigurationManager.GetAchievementImageAsync(this.Scid, this.AssetId).Result;

            this.WriteObject(response.Result);
        }
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Updating web service.");

            ConfigResponse <WebService> response = ConfigurationManager.UpdateWebServiceAsync(this.ServiceId, this.AccountId, this.Name, this.TelemetryAccess, this.AppChannelsAccess).Result;

            this.WriteVerbose($"Web service with ID {response.Result.ServiceId} successfully updated.");
            this.WriteObject(response.Result);
        }
        public async Task <IActionResult> GetConfig()
        {
            var obj = new ConfigResponse
            {
                PublishableKey = Options.Value.PublishableKey,
            };

            return(Ok(obj));
        }
Example #22
0
 private void GetData(ConfigResponse response)
 {
     NewGameVersion = ConfigManager.appConfig.GetInt("gameVersion");
     if (CurrentGameVersion != NewGameVersion)
     {
         UpdateMessage = ConfigManager.appConfig.GetString("updateMessage");
         ShowMessage();
     }
 }
Example #23
0
        public async Task GetSchemaTypesFailure()
        {
            Uri uri = new Uri(new Uri(ClientSettings.Singleton.XConEndpoint), "/schema");

            this.mockHandler.Expect(uri.ToString())
            .Respond(HttpStatusCode.ServiceUnavailable);

            ConfigResponse <IEnumerable <string> > schemaTypes = await ConfigurationManager.GetSchemaTypesAsync();
        }
        /// <inheritdoc/>
        protected override void Process()
        {
            if (!Enum.TryParse <DocumentType>(this.DocumentType, out DocumentType documentType))
            {
                throw new ArgumentException("Invalid DocumentType. Must be either 'Sandbox' or 'Account'.", nameof(this.DocumentType));
            }

            if (documentType == Microsoft.Xbox.Services.DevTools.XblConfig.DocumentType.Sandbox && string.IsNullOrEmpty(this.Sandbox))
            {
                throw new ArgumentException("Sandbox must be specified when committing sandbox documents.");
            }

            if (documentType == Microsoft.Xbox.Services.DevTools.XblConfig.DocumentType.Account)
            {
                this.Sandbox = null;
            }

            IEnumerable <string> files = this.Glob(this.Files);
            int fileCount = files.Count();

            if (fileCount == 0)
            {
                throw new ArgumentException("There are no files selected to commit.", nameof(this.Files));
            }

            this.WriteVerbose($"Committing {fileCount} file(s) to Xbox Live.");

            string eTag = this.ETag ?? this.GetETag(files, this.Sandbox);

            if (this.Force)
            {
                eTag = null;
            }

            Task <ConfigResponse <ValidationResponse> > documentsTask;

            if (documentType == Microsoft.Xbox.Services.DevTools.XblConfig.DocumentType.Sandbox)
            {
                this.WriteVerbose("Committing sandbox documents.");
                documentsTask = ConfigurationManager.CommitSandboxDocumentsAsync(files, this.Scid, this.Sandbox, eTag, this.ValidateOnly, this.Message);
            }
            else
            {
                this.WriteVerbose("Committing account documents.");
                documentsTask = ConfigurationManager.CommitAccountDocumentsAsync(files, this.AccountId, eTag, this.ValidateOnly, this.Message);
            }

            ConfigResponse <ValidationResponse> result = documentsTask.Result;

            this.SaveETag(result.Result.ETag, Path.GetDirectoryName(files.First()), this.Sandbox);

            this.WriteVerbose($"Can Commit: {result.Result.CanCommit}");
            this.WriteVerbose($"Committed:  {result.Result.Committed}");

            this.PrintValidationInfo(result.Result.ValidationInfo);
        }
        private static async Task <int> GetSandboxesAsync(GetSandboxOptions options)
        {
            Console.WriteLine("Getting list of sandboxes.");
            Console.WriteLine();

            ConfigResponse <IEnumerable <string> > response = await ConfigurationManager.GetSandboxesAsync(options.AccountId);

            Console.WriteLine(ObjectPrinter.Print(response.Result));
            return(0);
        }
        /// <inheritdoc />
        protected override void Process()
        {
            this.WriteVerbose("Uploading achievement image.");

            using (FileStream stream = File.OpenRead(this.Filename))
            {
                ConfigResponse <AchievementImage> response = ConfigurationManager.UploadAchievementImageAsync(this.Scid, Path.GetFileName(stream.Name), stream).Result;
                this.WriteObject(response.Result);
            }
        }
        private static async Task <int> GetAchievementImagesAsync(GetAchievevmentImagesOptions options)
        {
            Console.WriteLine("Getting achievement images.");
            Console.WriteLine();

            ConfigResponse <IEnumerable <AchievementImage> > response = await ConfigurationManager.GetAchievementImagesAsync(options.Scid);

            Console.WriteLine(ObjectPrinter.Print(response.Result));
            return(0);
        }
        private static async Task <int> UpdateWebServiceAsync(UpdateWebServiceOptions options)
        {
            Console.WriteLine("Updating web service.");
            Console.WriteLine();

            ConfigResponse <WebService> response = await ConfigurationManager.UpdateWebServiceAsync(options.ServiceId, options.AccountId, options.Name, options.TelemetryAccess, options.AppChannelsAccess);

            Console.WriteLine($"Web service with ID {response.Result.ServiceId} successfully updated.");
            return(0);
        }
        private static async Task <int> GetWebServicesAsync(GetWebServicesOptions options)
        {
            Console.WriteLine("Obtaining web services.");
            Console.WriteLine();

            ConfigResponse <IEnumerable <WebService> > response = await ConfigurationManager.GetWebServicesAsync(options.AccountId);

            Console.WriteLine(ObjectPrinter.Print(response.Result));
            return(0);
        }
 private void ApplyConfigurationFromServer(ConfigResponse configResponse)
 {
     _userRepository.Tos          = configResponse.Tos;
     _userRepository.FcmTokenSent = configResponse.AuthTokenEnabled;
     _userRepository.IsPhoneVerificationEnabled = configResponse.PhoneVerificationEnabled;
     _userRepository.IsP2PEnabled = configResponse.P2PEnabled;
     _userRepository.P2PMaxKin    = configResponse.P2PMaxKin;
     _userRepository.P2PMinKin    = configResponse.P2PMinKin;
     _userRepository.P2PMinTasks  = configResponse.P2PMinTasks;
 }
Example #31
0
    private void DiscoveryListener()
    {
      IPEndPoint l_receiveAddress = new IPEndPoint(IPAddress.Any, 0);
      while (this.m_serviceListening) {
        byte[] dataPacket = this.m_discoveryService.Receive(ref l_receiveAddress);
        if (l_receiveAddress.Address == IPAddress.Any) {
          Debug.Warn("Invalid response address '{0}'.", l_receiveAddress);
          continue;
        }

        NetworkPacket l_receivedPacket = NetworkPacket.Parser.ParseFrom(dataPacket);
        if (l_receivedPacket == null || l_receivedPacket.Type != MessageType.ServiceConfigurationRequest) {
          Debug.Error("Invalid network packet.");
          continue;
        }

        try {
          ConfigRequest l_clientRequest = ConfigRequest.Parser.ParseFrom(l_receivedPacket.Message);
          Debug.Log("Client request ServiceId={0} Port={1}.", l_clientRequest.ServiceId, l_clientRequest.Port);

          ConfigResponse l_responseMessage = new ConfigResponse();
          l_responseMessage.ServiceId = l_clientRequest.ServiceId;
          l_responseMessage.IPAddress = this.m_serverAddress.Address.ToString();
          l_responseMessage.Port = this.m_serverAddress.Port;

          NetworkPacket l_responsePacket = new NetworkPacket();
          l_responsePacket.Type = MessageType.ServiceConfigurationResponse;
          // l_responsePacket.Message = Any.Pack(l_responseMessage, String.Empty);
          l_responsePacket.Message = l_responseMessage.ToByteString();

          l_receiveAddress.Port = l_clientRequest.Port;
          byte[] responseData = l_responsePacket.ToByteArray();
          int sendBytes = this.m_discoveryService.Send(responseData, responseData.Length, l_receiveAddress);

          Debug.Log("Response send to {0}, Bytes={1}.", l_receiveAddress, sendBytes);
        }
        catch (Exception ex) {
          Debug.Exception(ex);
          continue;
        }
      }
    }