public string GetCustomLevelTimeString(long onlineID, FractionDifficulty diff) { var dat = GetCustomLevelData(onlineID); if (dat == null) { return(string.Empty); } switch (diff) { case FractionDifficulty.DIFF_0: return(dat.Diff0_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff0_BestTime, true) : string.Empty); case FractionDifficulty.DIFF_1: return(dat.Diff1_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff1_BestTime, true) : string.Empty); case FractionDifficulty.DIFF_2: return(dat.Diff2_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff2_BestTime, true) : string.Empty); case FractionDifficulty.DIFF_3: return(dat.Diff3_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff3_BestTime, true) : string.Empty); case FractionDifficulty.NEUTRAL: case FractionDifficulty.PLAYER: default: SAMLog.Error("PP::EnumSwitch_GCLTS", "diff: " + diff); return("?"); } }
public void TryStopBGM(string path) { if (!this.soundManager.IsMatchPreviousPlayedBGM(path)) { this.soundManager.StopBGM(TimeExtension.GetTimeScaleDivided(base.stateManager.stateProperty.bgmFadeoutSecond), null); } }
void GetInfoUser() { string userId = CookieExtension.GetCookies("UserId"); DataTable dt = new DataTable(); dt = TatThanhJsc.Database.Users.GetUsersByUserId(userId); if (dt.Rows.Count > 0) { ltrTaiKhoan.Text = dt.Rows[0][UsersColumns.UsernameColumn].ToString(); ltrHoTen.Text = dt.Rows[0][UsersColumns.UserfirstnameColumn].ToString() + " " + dt.Rows[0][UsersColumns.UserlastnameColumn].ToString(); ltrEmail.Text = dt.Rows[0][UsersColumns.UseremailColumn].ToString(); ltrDienThoai.Text = dt.Rows[0][UsersColumns.UserphonenumberColumn].ToString(); ltrDiaChi.Text = dt.Rows[0][UsersColumns.UseraddressColumn].ToString(); ltrGhiChu.Text = dt.Rows[0][UsersColumns.UsercommentColumn].ToString(); ltrNgayTao.Text = TimeExtension.FormatTime(dt.Rows[0][UsersColumns.UsercreatedateColumn], 6); ltrLanDangXuatCuoi.Text = TimeExtension.FormatTime(dt.Rows[0][UsersColumns.UserlastlockoutdateColumn], 6); ltrLanDangNhapCuoi.Text = TimeExtension.FormatTime(dt.Rows[0][UsersColumns.UserlastlogindateColumn], 6); tbTen.Text = dt.Rows[0][UsersColumns.UserlastnameColumn].ToString(); tbHo.Text = dt.Rows[0][UsersColumns.UserfirstnameColumn].ToString(); tbDiaChi.Text = dt.Rows[0][UsersColumns.UseraddressColumn].ToString(); tbDienThoai.Text = dt.Rows[0][UsersColumns.UserphonenumberColumn].ToString(); tbSoCMND.Text = dt.Rows[0][UsersColumns.UseridentitycardColumn].ToString(); } }
/* <pre> * 5.2.1. INIT Received in COOKIE-WAIT or COOKIE-ECHOED State (Item B) * * This usually indicates an initialization collision, i.e., each * endpoint is attempting, at about the same time, to establish an * association with the other endpoint. * * Upon receipt of an INIT in the COOKIE-WAIT state, an endpoint MUST * respond with an INIT ACK using the same parameters it sent in its * original INIT chunk (including its Initiate Tag, unchanged). When * responding, the endpoint MUST send the INIT ACK back to the same * address that the original INIT (sent by this endpoint) was sent. * * Upon receipt of an INIT in the COOKIE-ECHOED state, an endpoint MUST * respond with an INIT ACK using the same parameters it sent in its * original INIT chunk (including its Initiate Tag, unchanged), provided * that no NEW address has been added to the forming association. If * the INIT message indicates that a new address has been added to the * association, then the entire INIT MUST be discarded, and NO changes * should be made to the existing association. An ABORT SHOULD be sent * in response that MAY include the error 'Restart of an association * with new addresses'. The error SHOULD list the addresses that were * added to the restarting association. * * When responding in either state (COOKIE-WAIT or COOKIE-ECHOED) with * an INIT ACK, the original parameters are combined with those from the * newly received INIT chunk. The endpoint shall also generate a State * Cookie with the INIT ACK. The endpoint uses the parameters sent in * its INIT to calculate the State Cookie. * * After that, the endpoint MUST NOT change its state, the T1-init timer * shall be left running, and the corresponding TCB MUST NOT be * destroyed. The normal procedures for handling State Cookies when a * TCB exists will resolve the duplicate INITs to a single association. * * For an endpoint that is in the COOKIE-ECHOED state, it MUST populate * its Tie-Tags within both the association TCB and inside the State * Cookie (see Section 5.2.2 for a description of the Tie-Tags). * </pre> */ public virtual Chunk[] inboundInit(InitChunk init) { Chunk[] reply = null; _peerVerTag = init.getInitiateTag(); _winCredit = init.getAdRecWinCredit(); _farTSN = (uint)(init.getInitialTSN() - 1); _maxOutStreams = Math.Min(init.getNumInStreams(), MAXSTREAMS); _maxInStreams = Math.Min(init.getNumOutStreams(), MAXSTREAMS); InitAckChunk iac = new InitAckChunk(); iac.setAdRecWinCredit(MAXBUFF); iac.setNumInStreams(_maxInStreams); iac.setNumOutStreams(_maxOutStreams); iac.setInitialTSN(_nearTSN); iac.setInitiateTag(_myVerTag); CookieHolder cookie = new CookieHolder(); cookie.cookieData = new byte[Association.COOKIESIZE]; cookie.cookieTime = TimeExtension.CurrentTimeMillis(); _random.NextBytes(cookie.cookieData); iac.setCookie(cookie.cookieData); _cookies.Add(cookie); byte[] fse = init.getFarSupportedExtensions(); if (fse != null) { iac.setSupportedExtensions(this.getUnionSupportedExtensions(fse)); } reply = new Chunk[1]; reply[0] = iac; //logger.LogDebug("SCTP received INIT:" + init.ToString()); //logger.LogDebug("Replying with init-ack :" + iac.ToString()); return(reply); }
public async Task <CookieCollection> LoginTzbAsync(VmLogin para) { var cookieJar = new CookieContainer(); using (var handler = new HttpClientHandler { CookieContainer = cookieJar, UseCookies = true, }) { using (var client = CreateHttpClient(AppSetting.Instance.HostTzb, handler)) { var formData = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("logonUsername", para.UserName), new KeyValuePair <string, string>("password", para.Password.Md5Encrypt()), new KeyValuePair <string, string>("rememberType", "10080"), new KeyValuePair <string, string>("loginType", "user"), new KeyValuePair <string, string>("verificationCode", string.Empty), new KeyValuePair <string, string>("timeStamp", TimeExtension.GetTimeStamp().ToString()), }); var Uri = CreateUri("/auth/loginSubmit", AppSetting.Instance.HostTzb, HttpSchema.HTTPS); var response = await client.PostAsync(Uri, formData); if (response.IsSuccessStatusCode) { var responseCookies = cookieJar.GetCookies(Uri); return(responseCookies); } } } return(new CookieCollection()); }
public async Task <string> LoginAsync(vmLogin para) { var cookieJar = new CookieContainer(); var handler = new HttpClientHandler { CookieContainer = cookieJar, UseCookies = true, UseDefaultCredentials = false }; var client = CreateHttpClient(handler); var formData = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("logonUsername", para.UserName), new KeyValuePair <string, string>("password", para.Password.Md5Encrypt()), new KeyValuePair <string, string>("rememberType", "10080"), new KeyValuePair <string, string>("loginType", "user"), new KeyValuePair <string, string>("verificationCode", "请输入验证码"), new KeyValuePair <string, string>("timeStamp", TimeExtension.GetTimeStamp().ToString()), }); var Uri = CreateUri("/auth/loginSubmit"); var response = await client.PostAsync(Uri, formData); response.EnsureSuccessStatusCode(); var responseCookies = cookieJar.GetCookies(Uri); var ret = string.Empty; foreach (Cookie cookie in responseCookies) { ret += $"{cookie.Name}={cookie.Value};"; } return(ret); }
public string FormatHighscoreCell() { if (string.IsNullOrWhiteSpace(HighscoreUsername) || HighscoreTime == null) { return(string.Empty); } return(TimeExtension.FormatMilliseconds(HighscoreTime.Value, true) + " (" + HighscoreUsername + ")"); }
public string GetTimeString(FractionDifficulty d, bool forceMinutes) { var v = Data[d]; if (!v.HasCompleted) { return(string.Empty); } return(TimeExtension.FormatMilliseconds(v.BestTime, forceMinutes)); }
void Awake() { if (seed == 0) { Generators.Seed = Random.value * 1000000.0f + Random.value; seed = Generators.Seed; } else { Generators.Seed = seed; } Debug.Log("Seed = " + Generators.Seed); timeExtension = GetComponent <TimeExtension>(); }
public override void enqueue(DataChunk d) { // todo - this worries me - 2 nested synchronized //logger.LogDebug(" Aspiring to enqueue " + d.ToString()); lock (this) { long now = TimeExtension.CurrentTimeMillis(); d.setTsn(_nearTSN++); d.setGapAck(false); d.setRetryTime(now + getT3() - 1); d.setSentTime(now); SimpleSCTPTimer.setRunnable(run, getT3()); reduceRwnd(d.getDataSize()); //_outbound.put(new Long(d.getTsn()), d); //logger.LogDebug(" DataChunk enqueued " + d.ToString()); // all sorts of things wrong here - being in a synchronized not the least of them Chunk[] toSend = addSackIfNeeded(d); try { send(toSend); //logger.LogDebug("sent, syncing on inFlight... " + d.getTsn()); lock (_inFlight) { _inFlight.Add(d.getTsn(), d); } //logger.LogDebug("added to inFlight... " + d.getTsn()); } catch (SctpPacketFormatException ex) { logger.LogError("badly formatted chunk " + d.ToString()); logger.LogError(ex.ToString()); } catch (EndOfStreamException end) { unexpectedClose(end); logger.LogError(end.ToString()); } catch (IOException ex) { logger.LogError("Can not send chunk " + d.ToString()); logger.LogError(ex.ToString()); } } //logger.LogDebug("leaving enqueue" + d.getTsn()); }
/// <summary> /// Cancel order /// </summary> /// <param name="symbol">currency</param> /// <param name="orderId">id of irder</param> public void CancelOrder(string symbol, long orderId) { string apiRequestUrl = $"{baseUrl}v3/order"; string query = $"symbol={symbol}&orderId={orderId}"; query = $"{query}×tamp={TimeExtension.getTimeStamp()}"; var signature = request.getSignature(SettingsAPI.SecretKey, query); query += "&signature=" + signature; apiRequestUrl += "?" + query; var response = request.webRequest(apiRequestUrl, "DELETE", SettingsAPI.ApiKey); }
void GetTitleItem() { fields = DataExtension.GetListColumns(TatThanhJsc.Columns.ItemsColumns.VititleColumn, TatThanhJsc.Columns.ItemsColumns.DicreatedateColumn); condition = ItemsTSql.GetItemsByIid(iid); DataTable dt = new DataTable(); dt = GroupsItems.GetAllData(top, fields, condition, orderBy); if (dt.Rows.Count > 0) { LtTitlePage.Text = dt.Rows[0]["VITITLE"].ToString(); lt_cate_name.Text = @" <div class='TitleItem'>Tên Vé tàu: " + dt.Rows[0]["VITITLE"].ToString() + @"</div> <div>Ngày đăng: " + TimeExtension.FormatTime(dt.Rows[0][TatThanhJsc.Columns.ItemsColumns.DicreatedateColumn], "dd/MM/yyyy") + @"</div>"; } }
/// <summary> /// Extends time left in the last cruise session /// </summary> /// <returns></returns> public IStatus <Avatar> ExtendCruiseTime(TimeExtension extension) { var response = new Status <Avatar>(); try { LastCruise.ExtendTime(response, this, extension); } catch (Exception ex) { response.AddException(ex); } return(AvatarValidationStatus(response)); }
private void Update() { if (this.isPausing) { return; } float num = (!this._ignoreTimeScale) ? Time.time : Time.unscaledTime; float num2 = (!this._ignoreTimeScale) ? TimeExtension.GetTimeScaleDivided(this._interval) : this._interval; if (num >= this.time) { this.time = num + num2; this.ApplyText((this.currentIndex + 1) % this.textReplacer.PatternLength); } }
private uint howStaleIsMyCookie(CookieHolder cookie) { uint ret = 0; long now = TimeExtension.CurrentTimeMillis(); if ((now - cookie.cookieTime) < VALIDCOOKIELIFE) { ret = 0; } else { ret = (uint)((now - cookie.cookieTime) - VALIDCOOKIELIFE); } return(ret); }
protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds) { if (node == null) { return; } SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, Color.Black * 0.8f * progressDisplay, true, false, false, false, 16); sbatch.DrawLine(Position + new Vector2(0, HEADER_HEIGHT), Position + new Vector2(Width, HEADER_HEIGHT), FlatColors.MidnightBlue * progressDisplay, 2); sbatch.DrawLine(Position + new Vector2(1 * (Width / 3f), 0), Position + new Vector2(1 * (Width / 3f), 32), FlatColors.MidnightBlue * progressDisplay, 2); sbatch.DrawLine(Position + new Vector2(2 * (Width / 3f), 0), Position + new Vector2(2 * (Width / 3f), 32), FlatColors.MidnightBlue * progressDisplay, 2); FontRenderHelper.DrawTextCentered(sbatch, (tab == 0 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header1), (tab == 0 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(1 * (Width / 6f), HEADER_HEIGHT / 2f)); FontRenderHelper.DrawTextCentered(sbatch, (tab == 1 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header2), (tab == 1 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(3 * (Width / 6f), HEADER_HEIGHT / 2f)); FontRenderHelper.DrawTextCentered(sbatch, (tab == 2 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header3), (tab == 2 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(5 * (Width / 6f), HEADER_HEIGHT / 2f)); if (tab == 0) { // Best time local DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, node.LevelData.GetTimeString(FractionDifficulty.DIFF_0, true), true); DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_1, true), true); DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, node.LevelData.GetTimeString(FractionDifficulty.DIFF_2, true), true); DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, node.LevelData.GetTimeString(FractionDifficulty.DIFF_3, true), true); } else if (tab == 1) { // Best time global DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalBestTime, true), true); DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalBestTime, true), true); DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalBestTime, true), true); DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalBestTime, true), true); } else if (tab == 2) { // global count DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalCompletionCount), false); DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalCompletionCount), false); DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalCompletionCount), false); DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalCompletionCount), false); } }
public OpenOrderList[] GetOpenOrderList() { string apiRequestUrl = $"{baseUrl}v3/openOrderList"; string query = $"timestamp={TimeExtension.getTimeStamp()}"; var signature = request.getSignature(SettingsAPI.SecretKey, query); query += "&signature=" + signature; apiRequestUrl += "?" + query; var response = request.webRequest(apiRequestUrl, "GET", SettingsAPI.ApiKey); var parsedResponse = JsonConvert.DeserializeObject <OpenOrderList[]>(response); return(parsedResponse); }
internal Status <Avatar> ExtendTime(Status <Avatar> response, Avatar sender , TimeExtension extension) { try { response = IsCorrectSender(response, sender); if (response.IsSuccess()) { TimeExtensions.Add(extension); } } catch (Exception ex) { response.AddException(ex); } return(response); }
public void UpdateTDMLabels() { if (TimeDisplayMode == 0) // PB { LabelTimeHeader.L10NText = L10NImpl.STR_HSP_TIME_YOU; LabelTimeValue.Text = TimeExtension.FormatMilliseconds(PersonalTimes[(int)SelectedDifficulty] ?? -1, false); } else if (TimeDisplayMode == 1) // WR { LabelTimeHeader.L10NText = L10NImpl.STR_INF_HIGHSCORE; LabelTimeValue.Text = TimeExtension.FormatMilliseconds(LevelMeta.Highscores[(int)SelectedDifficulty].HighscoreTime ?? -1, false); } else if (TimeDisplayMode == 2) // Curr { LabelTimeHeader.L10NText = L10NImpl.STR_HSP_TIME_NOW; LabelTimeValue.Text = TimeExtension.FormatMilliseconds(LevelTime, false); } }
public Candlestick Deserialize(string json) { var jToken = JToken.Parse(json); return(new Candlestick( jToken[KeySymbol]?.Value <string>(), jToken[KeyInterval].Value <string>(), TimeExtension.ToDateTime(jToken[KeyOpenTime].Value <long>()), jToken[KeyOpen].Value <decimal>(), jToken[KeyHigh].Value <decimal>(), jToken[KeyLow].Value <decimal>(), jToken[KeyClose].Value <decimal>(), jToken[KeyVolume].Value <decimal>(), TimeExtension.ToDateTime(jToken[KeyCloseTime].Value <long>()), jToken[KeyQuoteAssetVolume].Value <decimal>(), jToken[KeyNumberOfTrades].Value <long>(), jToken[KeyTakerBuyBaseAssetVolume].Value <decimal>(), jToken[KeyTakerBuyQuoteAssetVolume].Value <decimal>())); }
public IEnumerable <Candlestick> DeserializeMany(string json) { return(JArray.Parse(json).Select(item => new Candlestick ( symbol, interval, TimeExtension.ToDateTime(item[0].Value <long>()), // open time item[1].Value <decimal>(), // open item[2].Value <decimal>(), // high item[3].Value <decimal>(), // low item[4].Value <decimal>(), // close item[5].Value <decimal>(), // volume TimeExtension.ToDateTime(item[6].Value <long>()), // close time item[7].Value <decimal>(), // quote asset volume item[8].Value <long>(), // number of trades item[9].Value <decimal>(), // taker buy base asset volume item[10].Value <decimal>() // taker buy quote asset volume )).ToArray()); }
public IValidator Parse(string data, IValidator nextValidator) { foreach (var rule in _ruleDictionary) { var validationCode = rule.Key; var regex = rule.Value; Match match; string signalSourceId; switch (validationCode) { case Error.SignalLimitExceeded: match = regex.Match(data); if (!match.Success) { continue; } signalSourceId = match.Groups[Signalsourceid].Value; var limit = double.Parse(match.Groups[Limit].Value); return(new SignalLimitValidator(signalSourceId, limit, nextValidator)); case Error.SignalRangeViolation: match = regex.Match(data); if (!match.Success) { continue; } signalSourceId = match.Groups[Signalsourceid].Value; var invalidValue = match.Groups[Limit].Value; return(new SignalRangeValidator(signalSourceId, invalidValue, nextValidator)); case Error.SignalTimeViolation: match = regex.Match(data); if (!match.Success) { continue; } signalSourceId = match.Groups[Signalsourceid].Value; var timeString = match.Groups[InvalidTime].Value; return(new SignalTimeValidator(signalSourceId, TimeExtension.Parse(timeString), nextValidator)); } } throw new RuleParseException("Unable to parse the rule - " + data); }
/// <summary> /// Places an order /// </summary> /// <param name="symbol">currency</param> /// <param name="side">>Order Side, BUY or SELL</param> /// <param name="type">Order Type, see Enum.OrderTypes</param> /// <param name="timeInForce">Time order will be active for</param> /// <param name="quantity">Amount to be traded</param> /// <param name="price">Price to be bought/sold at</param> /// <returns>The order object</returns> public Order PlaceOrder(string symbol, OrderSides side, OrderTypes type, TimesInForce timeInForce, decimal quantity, decimal price) { string apiRequestUrl = $"{baseUrl}v3/order"; string query = $"symbol={symbol}&side={side}&type={type}&timeInForce={timeInForce}&quantity={quantity}&price={price}"; query = $"{query}×tamp={TimeExtension.getTimeStamp()}"; var signature = request.getSignature(SettingsAPI.SecretKey, query); query += "&signature=" + signature; apiRequestUrl += "?" + query; var response = request.webRequest(apiRequestUrl, "POST", SettingsAPI.ApiKey); var parsedResponse = JsonConvert.DeserializeObject <Order>(response); return(parsedResponse); }
private IEnumerator DeadEffectCorutine(HitEffectParams hitEffectParams, float deathEffectGenerationInterval, Action callbackDeathEffect = null) { float timing = Time.time + TimeExtension.GetTimeScaleDivided(deathEffectGenerationInterval); while (Time.time < timing) { yield return(null); } if (hitEffectParams != null) { hitEffectParams.gameObject.SetActive(true); hitEffectParams.PlayAnimationTrigger(this.characterParams); if (callbackDeathEffect != null) { callbackDeathEffect(); } } callbackDeathEffect = null; yield break; }
/// <summary> /// get a open orders of currency in current time /// </summary> /// <param name="symbol">currency</param> /// <returns>A list of Trades</returns> public Order[] GetOpenOrders(string symbol) { string apiRequestUrl = $"{baseUrl}v3/openOrders"; string query = $"symbol={symbol}"; query = $"{query}×tamp={TimeExtension.getTimeStamp()}"; var signature = request.getSignature(SettingsAPI.SecretKey, query); query += "&signature=" + signature; apiRequestUrl += "?" + query; var response = request.webRequest(apiRequestUrl, "GET", SettingsAPI.ApiKey); System.Console.WriteLine("GetOpenOrders"); var parsedResponse = JsonConvert.DeserializeObject <Order[]>(response); return(parsedResponse); }
/// <summary> /// Get AccountInformation including all Asset Balances /// </summary> /// <returns></returns> /// public AccountInformation GetAccountInformation() { string apiRequestUrl = $"{baseUrl}v3/account"; string query = $""; query = $"{query}×tamp={TimeExtension.getTimeStamp()}"; var signature = request.getSignature(SettingsAPI.SecretKey, query); query += "&signature=" + signature; apiRequestUrl += "?" + query; var response = request.webRequest(apiRequestUrl, "GET", SettingsAPI.ApiKey); System.Console.WriteLine("GetAccountInformation"); var parsedResponse = JsonConvert.DeserializeObject <AccountInformation>(response); return(parsedResponse); }
public async Task <SxhResult> GetVerifyCodeAsync(UserAccount account) { if (account != null && account.HasValue) { var cookieJar = new CookieContainer(); using (var handler = new HttpClientHandler { CookieContainer = cookieJar, UseCookies = true, }) { using (var client = CreateHttpClient(handler)) { var Uri = CreateUri($"/sxhig/generateCaptchaCode?t={TimeExtension.GetTimeStamp().ToString()}"); foreach (Cookie token in account.TokenOffical) { cookieJar.Add(Uri, new Cookie(token.Name, token.Value)); } var response = await client.GetAsync(Uri); if (response.IsSuccessStatusCode) { var bytes = await response.Content.ReadAsByteArrayAsync(); return(new SxhResult(true, bytes)); } else { return(new SxhResult(false, response.StatusCode)); } } } } return(new SxhResult(false)); }
public IEnumerator SmoothIncreaseCharactersAction(float time, params CharacterStateControl[] characters) { float current = 0f; float endTime = Mathf.Abs(time); bool isRevere = time < 0f; do { current += Time.deltaTime; float duration = TimeExtension.GetTimeScaleDivided(base.stateProperty.revivalActionSpeed); float smoothLevel = Mathf.Clamp01(Mathf.SmoothStep(0f, 1f, current) / duration); if (isRevere) { smoothLevel = 1f - smoothLevel; } foreach (CharacterStateControl characterStateControl in characters) { characterStateControl.CharacterParams.transform.localScale = Vector3.one * smoothLevel; } yield return(new WaitForEndOfFrame()); }while (current < endTime); yield break; }
public OrderOCO OrderOCO(string symbol, OrderSides side, decimal quantity, decimal price, decimal stopPrice) { string newQuantity = quantity.ToString().Replace(',', '.'); string newPrice = price.ToString().Replace(',', '.'); string newstopPrice = stopPrice.ToString().Replace(',', '.'); string apiRequestUrl = $"{baseUrl}v3/order/oco"; string query = $"symbol={symbol}&side={side}&quantity={newQuantity}&price={newPrice}&stopPrice={newstopPrice}"; query = $"{query}×tamp={TimeExtension.getTimeStamp()}"; var signature = request.getSignature(SettingsAPI.SecretKey, query); query += "&signature=" + signature; apiRequestUrl += "?" + query; var response = request.webRequest(apiRequestUrl, "POST", SettingsAPI.ApiKey); var parsedResponse = JsonConvert.DeserializeObject <OrderOCO>(response); return(parsedResponse); }
public void OnHitDamageBgmChangeFunction() { if (base.hierarchyData.batteWaves.Length <= base.battleStateData.currentWaveNumber || base.battleStateData.currentWaveNumber < 0) { return; } BattleWave battleWave = base.hierarchyData.batteWaves[base.battleStateData.currentWaveNumber]; if (BoolExtension.AllMachValue(false, battleWave.enemiesBossFlag)) { return; } if (battleWave.enemiesBossFlag.Length != base.battleStateData.enemies.Length) { return; } int num = 0; int num2 = 0; for (int i = 0; i < base.battleStateData.enemies.Length; i++) { if (battleWave.enemiesBossFlag[i]) { num2++; if ((float)base.battleStateData.enemies[i].hp / (float)base.battleStateData.enemies[i].extraMaxHp < battleWave.bgmChangeHpPercentage) { num++; } } } if (num2 > num) { return; } base.stateManager.soundPlayer.TryPlayBGM(battleWave.changedBgmId, TimeExtension.GetTimeScaleDivided(base.stateManager.stateProperty.bgmCrossfadeSecond)); }