public void Execute(int index) { var rng = rngs[threadId]; float x_value = Corner_bottom_left.x + rng.NextFloat(0, Width); float y_value = 1.2f + rng.NextFloat(0f, 1f); float z_value = Corner_bottom_left.z + rng.NextFloat(0, Height); rngs[threadId] = rng; // Preparing V4 format of the nativearray int order; if (index < MPC1_quantity) { order = 1; } // MPC1 else if (index >= MPC1_quantity && index < MPC1_quantity + MPC2_quantity) { order = 2; } // MPC2 else if (index >= MPC1_quantity + MPC2_quantity && index < MPC1_quantity + MPC2_quantity + MPC3_quantity) { order = 3; } // MPC3 else { order = 4; } // DMC Array[index] = new V5(new Vector3(x_value, y_value, z_value), order, 0); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append('{'); WriteName(sb, "V0"); sb.Append(V0.ToString() + ","); WriteName(sb, "V1"); sb.Append(V1.ToString() + ","); WriteName(sb, "V2"); sb.Append(V2.ToString() + ","); WriteName(sb, "V3"); sb.Append(V3.ToString() + ","); WriteName(sb, "V4"); sb.Append(V4.ToString() + ","); WriteName(sb, "V5"); sb.Append(V5.ToString() + ","); WriteName(sb, "V6"); sb.Append(V6.ToString() + ","); WriteName(sb, "V7"); sb.Append(V7.ToString() + ","); WriteName(sb, "V8"); sb.Append(V8.ToString() + ","); WriteName(sb, "V9"); sb.Append(V9.ToString() + ","); sb.Length--; sb.Append('}'); return(sb.ToString()); }
private async Task CheckStreamStatus(V5 twitchClient, int intervallTime) { List <TwitchLib.Api.V5.Models.Streams.Stream> onlineStreams = new List <TwitchLib.Api.V5.Models.Streams.Stream>(); while (true) { try { await Task.Delay(intervallTime * 1000); using var db = Database.Open(); var twitchChannels = db.TwitchChannels.ToList(); if (!twitchChannels.Any()) { continue; } foreach (var twitchChannel in twitchChannels) { var userId = twitchClient.Users.GetUserByNameAsync(twitchChannel.ChannelName).Result.Matches?.FirstOrDefault()?.Id; if (userId == null) { continue; } var stream = twitchClient.Streams?.GetStreamByUserAsync(userId).Result?.Stream; if (stream != null && stream.StreamType != "playlist") { if (!onlineStreams.Contains(stream)) { onlineStreams.Add(stream); OnStreamOnline?.Invoke(this, new StreamEventArgs { Stream = stream, GuildId = twitchChannel.GuildId }); } } else { if (onlineStreams.Contains(stream)) { onlineStreams.Remove(stream); } } await Task.Delay(1000); } } catch (Exception e) { _logger.Error(e, $"Error while checking Twitch streams"); } } }
// Use this for initialization void Start() { if (BuyCarScript.V01A == 0) { BuyCarScript.V01A = 2; } if (BuyCarScript.V01A == 2) { V1.SetActive(true); } if (BuyCarScript.V02A == 2) { V2.SetActive(true); } if (BuyCarScript.V03A == 2) { V3.SetActive(true); } if (BuyCarScript.V04A == 2) { V4.SetActive(true); } if (BuyCarScript.V05A == 2) { V5.SetActive(true); } if (BuyCarScript.V06A == 2) { V6.SetActive(true); } if (BuyCarScript.V07A == 2) { V7.SetActive(true); } if (BuyCarScript.V08A == 2) { V8.SetActive(true); } if (BuyCarScript.V09A == 2) { V9.SetActive(true); } if (BuyCarScript.V10A == 2) { V10.SetActive(true); } car = true; }
private void ConfigureLiveMonitorAsync() { try { var twitchClient = new V5(); twitchClient.Settings.ClientId = Config.Bot.TwitchToken; twitchClient.Settings.AccessToken = Config.Bot.TwitchAccessToken; this.OnStreamOnline += Twitch_OnStreamOnline; new Task(async() => await CheckStreamStatus(twitchClient, 300), TaskCreationOptions.LongRunning).Start(); _logger.Information($"{nameof(TwitchService)}: Loaded successfully"); } catch (Exception e) { _logger.Error(e, $"Error while loading {nameof(TwitchService)}"); } }
public void Execute(int index) { if (MPC_array[index].Coordinates.x >= Xleft && MPC_array[index].Coordinates.x <= Xright && MPC_array[index].Coordinates.z >= Zdown && MPC_array[index].Coordinates.z <= Zup) { if (MPC_array[index].Inclusion == 0) { if (p1 == p2) // the polygon is a triangle { Vector3 side1 = s1 - p1; Vector3 side2 = s2 - p2; float S_triangle = Mathf.Abs(-side1.x * side2.z + side1.z * side2.x); // double area // We check if MPC_array[index] is in the triangle side1 side2 Vector3 v1 = s1 - MPC_array[index].Coordinates; Vector3 v2 = p1 - MPC_array[index].Coordinates; Vector3 v3 = s2 - MPC_array[index].Coordinates; float S1 = Mathf.Abs(-v1.x * v2.z + v1.z * v2.x); // double area float S2 = Mathf.Abs(-v2.x * v3.z + v2.z * v3.x); // double area float S3 = Mathf.Abs(-v3.x * v1.z + v3.z * v1.x); // double area if (Mathf.Abs(S_triangle - S1 - S2 - S3) < 0.001) { // if the sum of areas is almost equal to the whole area, then the MPC is included into the active set of MPCs MPC_V6[index] = new V6(MPC_array[index].Coordinates, (n1 + n2).normalized); MPC_array[index] = new V5(MPC_array[index].Coordinates, MPC_array[index].MPC_order, 1); } } else // the polygon is not a triangle { float dot_prod_normals = Vector3.Dot(n1, n2); if (dot_prod_normals <= 0) // then the polygon is not convex (or triangle where p1 != p2) { // in this case, we consider two triangles separately Vector3 v11 = p1 - s1; Vector3 v12 = p2 - s1; float S1 = Mathf.Abs(-v11.x * v12.z + v11.z * v12.x); //(v11, v12, out float S1); Vector3 v21 = p1 - s2; Vector3 v22 = p2 - s2; float S2 = Mathf.Abs(-v21.x * v22.z + v21.z * v22.x); //Area2D(v21, v22, out float S2); // we consider such strange triangles in order to cover the biggest area defined at leas with one correct triangle // and at the same time to avoid considering a non-convex quadrangle Vector3 vp1 = p1 - MPC_array[index].Coordinates; Vector3 vp2 = p2 - MPC_array[index].Coordinates; Vector3 vs1 = s1 - MPC_array[index].Coordinates; Vector3 vs2 = s2 - MPC_array[index].Coordinates; // common area that is related to both S1 and S2 float Spp = Mathf.Abs(-vp1.x * vp2.z + vp1.z * vp2.x); //Area2D(vp1, vp2, out float Spp); // areas related to S1 float Sp1s1 = Mathf.Abs(-vp1.x * vs1.z + vp1.z * vs1.x); //Area2D(vp1, vs1, out float Sp1s1); float Sp2s1 = Mathf.Abs(-vp2.x * vs1.z + vp2.z * vs1.x); //Area2D(vp2, vs1, out float Sp2s1); // areas related to S2 float Sp1s2 = Mathf.Abs(-vp1.x * vs2.z + vp1.z * vs2.x); //Area2D(vp1, vs2, out float Sp1s2); float Sp2s2 = Mathf.Abs(-vp2.x * vs2.z + vp2.z * vs2.x); //Area2D(vp2, vs2, out float Sp2s2); // check if the point [i] belongs to S1 or S2 if (Mathf.Abs(S1 - Spp - Sp1s1 - Sp2s1) < 0.001) { MPC_V6[index] = new V6(MPC_array[index].Coordinates, n1); MPC_array[index] = new V5(MPC_array[index].Coordinates, MPC_array[index].MPC_order, 1); } else if (Mathf.Abs(S2 - Spp - Sp1s2 - Sp2s2) < 0.001) { MPC_V6[index] = new V6(MPC_array[index].Coordinates, n2); MPC_array[index] = new V5(MPC_array[index].Coordinates, MPC_array[index].MPC_order, 1); } } else // the polygon is convex { // the first triangle of the quadrangle Vector3 v11 = p1 - s1; Vector3 v12 = s2 - s1; float S1 = Mathf.Abs(-v11.x * v12.z + v11.z * v12.x);//Area2D(v11, v12, out float S1); // the second triangle of the quadrangle Vector3 v21 = p1 - p2; Vector3 v22 = s2 - p2; float S2 = Mathf.Abs(-v21.x * v22.z + v21.z * v22.x);//Area2D(v21, v22, out float S2); Vector3 v1 = p1 - MPC_array[index].Coordinates; Vector3 v2 = s1 - MPC_array[index].Coordinates; Vector3 v3 = s2 - MPC_array[index].Coordinates; Vector3 v4 = p2 - MPC_array[index].Coordinates; float A1 = Mathf.Abs(-v1.x * v2.z + v1.z * v2.x); //Area2D(v1, v2, out float A1); float A2 = Mathf.Abs(-v2.x * v3.z + v2.z * v3.x); //Area2D(v2, v3, out float A2); float A3 = Mathf.Abs(-v3.x * v4.z + v3.z * v4.x); //Area2D(v3, v4, out float A3); float A4 = Mathf.Abs(-v4.x * v1.z + v4.z * v1.x); //Area2D(v4, v1, out float A4); float area_diff = Mathf.Abs(S1 + S2 - A1 - A2 - A3 - A4); if (area_diff < 1) { MPC_V6[index] = new V6(MPC_array[index].Coordinates, (n1 + n2).normalized); MPC_array[index] = new V5(MPC_array[index].Coordinates, MPC_array[index].MPC_order, 1); } } } } } }
public Bits(TwitchAPI api) { v5 = new V5(api); }
public Auth(TwitchAPI api) { v5 = new V5(api); }
public Clips(TwitchAPI api) { v5 = new V5(api); helix = new Helix(api); }
public ChannelFeeds(TwitchAPI api) { v5 = new V5(api); }
public Communities(TwitchAPI api) { v5 = new V5(api); }
public Ingests(TwitchAPI api) { v3 = new V3(api); v5 = new V5(api); }
public Root(TwitchAPI api) { v5 = new V5(api); }
public string IsError() { if (string.IsNullOrWhiteSpace(GrsName)) { return("Укажите наименование ГРС"); } if (string.IsNullOrWhiteSpace(SubGrsName)) { return("Укажите наименование замерной нитки"); } if (Psantimeter > 0) { if (V1 + V2 + V3 + V9 + V10 + V11 > 0) { CalculateSmallK(); } else { K = SmallKConstants.KAll; } } else { if (V1 != 0 && !V1.CheckIntervalParams(90m, 97.9m)) { return("V1 параметр \"Объёмная концентрация метана\" несоответсвует"); } if (V2 != 0 && !V2.CheckIntervalParams(0.75m, 4.75m)) { return("V2 параметр \"Объёмная концентрация этана\" несоответсвует"); } if (V3 != 0 && !V3.CheckIntervalParams(0.30m, 3.5m)) { return("V3 параметр \"Объёмная концентрация пропана\" несоответсвует"); } if (V4 != 0 && !V4.CheckIntervalParams(0.01m, 0.5m)) { return("V4 параметр \"Объёмная концентрация i-бутана\" несоответсвует"); } if (!V5.CheckIntervalParams(0m, 0.4m)) { return("V5 параметр \"Объёмная концентрация n-бутана\" несоответсвует"); } if (!V6.CheckIntervalParams(0m, 0.2m)) { return("V6 параметр \"Объёмная концентрация i-пентана\" несоответсвует"); } if (!V7.CheckIntervalParams(0m, 0.15m)) { return("V7 параметр \"Объёмная концентрация n-пентана\" несоответсвует"); } if (!V8.CheckIntervalParams(0m, 0.3m)) { return("V8 параметр \"Объёмная концентрация гексана\" несоответсвует"); } if (V9 != 0 && !V9.CheckIntervalParams(0.1m, 2.5m)) { return("V9 параметр \"Объёмная концентрация углекислого газа\" несоответсвует"); } if (V10 != 0 && !V10.CheckIntervalParams(0.2m, 1.3m)) { return("V10 параметр \"Объёмная концентрация азота\" несоответсвует"); } if (!V11.CheckIntervalParams(0m, 0.3m)) { return("V11 параметр \"Объёмная концентрация кислорода\" несоответсвует"); } if (K == 0) { CalculateSmallK(); } else if (!K.CheckIntervalParams(1.24m, 2.1m)) { return("k параметр \"Объёмный показатель адиабаты\" несоответсвует"); } else { this.IsCalculateK = false; } } if (Z == 0) { this.Z = 0.882m; } else if (!Z.CheckIntervalParams(0.6m, 0.9999m)) { return("z параметр \"Коэффициент сжимаемости\" несоответсвует"); } if (!Pvxod.CheckIntervalParams(0.01m, 6m)) { return("Pвх параметр \"Давление газа на входе в ДГА\" несоответсвует"); } if (!Pvixod.CheckIntervalParams(0.01m, 4m)) { return("Pвых параметр \"Давление газа на выходе из ДГА\" несоответсвует"); } if (!Q.CheckIntervalParams(100m, 100000000m)) { return("Q параметр \"Расход газа по нитке\" несоответсвует"); } if (!Temperature.CheckIntervalParams(10m, 90m)) { return("t параметр \"Температура\" несоответсвует"); } if ((Nnominal > 0 && EffectProcent == 0) || (Nnominal == 0 && EffectProcent > 0)) { return("Укажите Nnominal и Procent, чтобы узнать эффективность расчета"); } CalculateParams(); return(string.Empty); }
public Videos(TwitchAPI api) { v5 = new V5(api); helix = new Helix(api); }
public Bits(TwitchAPI api) { v5 = new V5(api); helix = new Helix(api); }
public Teams(TwitchAPI api) { v5 = new V5(api); }
public Users(TwitchAPI api) { v5 = new V5(api); helix = new Helix(api); }
public Root(TwitchAPI api) { v3 = new V3(api); v5 = new V5(api); }
public void Left() { if (V2.activeInHierarchy == true) { V1.SetActive(true); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V3.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(true); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V4.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(true); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V5.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(true); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V6.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(true); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V7.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(true); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V8.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(true); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V9.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(true); V9.SetActive(false); V10.SetActive(false); } else if (V10.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(true); V10.SetActive(false); } }
public Streams(TwitchAPI api) { v3 = new V3(api); v5 = new V5(api); helix = new Helix(api); }
public Channels(TwitchAPI api) { v3 = new V3(api); v5 = new V5(api); }
public Games(TwitchAPI api) { v5 = new V5(api); helix = new Helix(api); }
public Search(TwitchAPI api) { v3 = new V3(api); v5 = new V5(api); }
public Badges(TwitchAPI api) { v5 = new V5(api); }
public Collections(TwitchAPI api) { v5 = new V5(api); }
public Chat(TwitchAPI api) { v5 = new V5(api); }