void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (DefaultLanguageCode != null) { writer.WritePropertyName("defaultLanguageCode"); writer.WriteStringValue(DefaultLanguageCode.Value.ToString()); } writer.WritePropertyName("@odata.type"); writer.WriteStringValue(ODataType); if (Name != null) { writer.WritePropertyName("name"); writer.WriteStringValue(Name); } if (Description != null) { writer.WritePropertyName("description"); writer.WriteStringValue(Description); } if (Context != null) { writer.WritePropertyName("context"); writer.WriteStringValue(Context); } if (Inputs != null && Inputs.Any()) { writer.WritePropertyName("inputs"); writer.WriteStartArray(); foreach (var item in Inputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } if (Outputs != null && Outputs.Any()) { writer.WritePropertyName("outputs"); writer.WriteStartArray(); foreach (var item in Outputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } writer.WriteEndObject(); }
/// <summary> /// Функция для соединения двух процедур /// </summary> public bool Connect(BaseProcedure another) { if (Outputs.Any(x => x.End == another)) { return(false); } var newConnection = new Connection() { Begin = this, End = another }; Outputs.Add(newConnection); another.Inputs.Add(newConnection); return(true); }
/// <summary> /// Adds the outputs from the SoundBank.<br/> /// This method adds OutputNumbered objects for all outputs to the list of outputs. /// </summary> internal void AddOutputs() { for (int i = 0; i <= SoundBank.Names.Count - 1; i++) { if (!Outputs.Any(x => x.Number == i)) { Outputs.Add(new Output() { Name = "{0}.{1:00}".Build(SoundBank.Names[i], i), Number = i, Value = 0 }); Contactors.Add(new SSFnoid() { Number = i, Value = 0 }); //yes, .11 is Shaker... myNames.Add(SoundBank.Names[i]); Log.Write($"Added: {Outputs.Last().Name} to internal list..."); } } }
public override bool Verify() { if (Version != 0) { throw new FormatException(nameof(Version)); } if (Inputs.Length != 0) { throw new FormatException(nameof(Inputs)); } if (Outputs.Any(p => p.AssetId != TransactionContext.UtilityTokenHash)) { throw new FormatException(nameof(Outputs)); } return(base.Verify()); }
public OutputPlug CreateOutputPlug(OutputPlug plug) { if (!Outputs.Any(p => p.Name == plug.Name)) { plug.Owner = this; Outputs.Add(plug); } else { OutputPlug existing = Outputs.Find(p => p.Name == plug.Name); if (existing.Owner == null) { existing.Owner = this; } return(existing); } return(plug); }
public new TransactionCheckResult Check() { var result = base.Check(); if (result == TransactionCheckResult.OutputTooLarge) { result = Outputs.Any(o => o.Value >= MaxMoney) ? TransactionCheckResult.OutputTooLarge : TransactionCheckResult.OutputTotalTooLarge; } if (result == TransactionCheckResult.OutputTotalTooLarge) { result = Outputs.Sum(o => o.Value) >= MaxMoney ? TransactionCheckResult.OutputTotalTooLarge : TransactionCheckResult.Success; } return(result); }
public void AddOutputNode(PanelOutputNode node) { if (Outputs.Any(x => x.Id == node.Id)) { return; } var output = new Output { Id = node.Id, Name = GenerateOutputName() }; node.Settings["Name"].Value = output.Name; AddOutput(output); UpdateMeInEditor(); UpdateMeInDb(); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("uri"); writer.WriteStringValue(Uri); if (HttpHeaders != null && HttpHeaders.Any()) { writer.WritePropertyName("httpHeaders"); writer.WriteStartObject(); foreach (var item in HttpHeaders) { writer.WritePropertyName(item.Key); writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } if (HttpMethod != null) { writer.WritePropertyName("httpMethod"); writer.WriteStringValue(HttpMethod); } if (Timeout != null) { writer.WritePropertyName("timeout"); writer.WriteStringValue(Timeout.Value, "P"); } if (BatchSize != null) { writer.WritePropertyName("batchSize"); writer.WriteNumberValue(BatchSize.Value); } if (DegreeOfParallelism != null) { writer.WritePropertyName("degreeOfParallelism"); writer.WriteNumberValue(DegreeOfParallelism.Value); } writer.WritePropertyName("@odata.type"); writer.WriteStringValue(ODataType); if (Name != null) { writer.WritePropertyName("name"); writer.WriteStringValue(Name); } if (Description != null) { writer.WritePropertyName("description"); writer.WriteStringValue(Description); } if (Context != null) { writer.WritePropertyName("context"); writer.WriteStringValue(Context); } if (Inputs.Any()) { writer.WritePropertyName("inputs"); writer.WriteStartArray(); foreach (var item in Inputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } else { writer.WriteNull("inputs"); } if (Outputs.Any()) { writer.WritePropertyName("outputs"); writer.WriteStartArray(); foreach (var item in Outputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } else { writer.WriteNull("outputs"); } writer.WriteEndObject(); }
public bool ContainsOutput(CommandOutput commandOutput) { return(Outputs.Any(output => output.Id == commandOutput.Id)); }
protected virtual void OnInitializing() { State = ExecutionState.Initializing; try { try { InitLog(); } catch (Exception e) { throw new Exception("InitLog threw", e); } try { _InitPartial(); } catch (Exception ex) { throw new Exception("_InitPartial threw", ex); } ValidateConfiguration(); #if cAlgo //if (Bot == null) //{ // throw new Exception("TEMP - Bot == null in OnInitializing()"); //} if (Bot != null && Bot.Indicators == null) { throw new Exception("Bot != null && Bot.Indicators == null in OnInitializing()"); } #endif if (EffectiveIndicators == null) { throw new Exception("EffectiveIndicators == null"); } if (!Outputs.Any()) { throw new Exception("!Outputs.Any(). Override Outputs."); } foreach (var child in Children.OfType <IIndicator>()) { #if !cAlgo if (child.Account == null) { // REvIEW - shouldn't be needed here? child.Account = this.Account; } child.Start(); #endif } State = ExecutionState.Ready; } catch (Exception) { State = ExecutionState.Uninitialized; throw; } }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Categories != null && Categories.Any()) { writer.WritePropertyName("categories"); writer.WriteStartArray(); foreach (var item in Categories) { writer.WriteStringValue(item.ToString()); } writer.WriteEndArray(); } if (DefaultLanguageCode != null) { writer.WritePropertyName("defaultLanguageCode"); writer.WriteStringValue(DefaultLanguageCode.Value.ToString()); } if (IncludeTypelessEntities != null) { writer.WritePropertyName("includeTypelessEntities"); writer.WriteBooleanValue(IncludeTypelessEntities.Value); } if (MinimumPrecision != null) { writer.WritePropertyName("minimumPrecision"); writer.WriteNumberValue(MinimumPrecision.Value); } writer.WritePropertyName("@odata.type"); writer.WriteStringValue(ODataType); if (Name != null) { writer.WritePropertyName("name"); writer.WriteStringValue(Name); } if (Description != null) { writer.WritePropertyName("description"); writer.WriteStringValue(Description); } if (Context != null) { writer.WritePropertyName("context"); writer.WriteStringValue(Context); } if (Inputs.Any()) { writer.WritePropertyName("inputs"); writer.WriteStartArray(); foreach (var item in Inputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } else { writer.WriteNull("inputs"); } if (Outputs.Any()) { writer.WritePropertyName("outputs"); writer.WriteStartArray(); foreach (var item in Outputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } else { writer.WriteNull("outputs"); } writer.WriteEndObject(); }