internal static void LoginWithCredentials(string username, string password, bool rememberMe, AssetStoreClient.DoneLoginCallback callback) { if (AssetStoreClient.sLoginState == AssetStoreClient.LoginState.IN_PROGRESS) { DebugUtils.LogWarning("Tried to login with credentials while already in progress of logging in"); return; } AssetStoreClient.sLoginState = AssetStoreClient.LoginState.IN_PROGRESS; AssetStoreClient.RememberSession = rememberMe; AssetStoreClient.sLoginErrorMessage = null; Uri address = new Uri(string.Format("{0}/login", AssetStoreClient.AssetStoreUrl)); AssetStoreWebClient assetStoreWebClient = new AssetStoreWebClient(); NameValueCollection nameValueCollection = new NameValueCollection(); nameValueCollection.Add("user", username); nameValueCollection.Add("pass", password); nameValueCollection.Add("unityversion", Application.unityVersion); nameValueCollection.Add("toolversion", "V4.1.0"); nameValueCollection.Add("license_hash", AssetStoreClient.GetLicenseHash()); nameValueCollection.Add("hardware_hash", AssetStoreClient.GetHardwareHash()); AssetStoreClient.Pending pending = new AssetStoreClient.Pending(); pending.conn = assetStoreWebClient; pending.id = "login"; pending.callback = AssetStoreClient.WrapLoginCallback(callback); AssetStoreClient.pending.Add(pending); assetStoreWebClient.Headers.Add("Accept", "application/json"); assetStoreWebClient.UploadValuesCompleted += AssetStoreClient.UploadValuesCallback; try { assetStoreWebClient.UploadValuesAsync(address, "POST", nameValueCollection, pending); } catch (WebException ex) { pending.ex = ex; AssetStoreClient.sLoginState = AssetStoreClient.LoginState.LOGIN_ERROR; } }