public void updateElement(BoundOutputModel model) { Output element = source.Outputs.FirstOrDefault(rec => rec.OutputName == model.OutputName && rec.ID != model.ID); if (element != null) { throw new Exception("Уже есть изделие с таким названием"); } element = source.Outputs.FirstOrDefault(rec => rec.ID == model.ID); if (element == null) { throw new Exception("Элемент не найден"); } element.OutputName = model.OutputName; element.Price = model.Price; int maxPCId = source.OutputElements.Count > 0 ? source.OutputElements.Max(rec => rec.ID) : 0; var compIds = model.OutputElements.Select(rec => rec.ElementID).Distinct(); var updateComponents = source.OutputElements .Where(rec => rec.OutputID == model.ID && compIds.Contains(rec.ElementID)); foreach (var updateComponent in updateComponents) { updateComponent.Count = model.OutputElements .FirstOrDefault(rec => rec.ID == updateComponent.ID).Count; } source.OutputElements.RemoveAll(rec => rec.OutputID == model.ID && !compIds.Contains(rec.ElementID)); var groupComponents = model.OutputElements .Where(rec => rec.ID == 0) .GroupBy(rec => rec.ElementID) .Select(rec => new { ComponentId = rec.Key, Count = rec.Sum(r => r.Count) }); foreach (var groupComponent in groupComponents) { OutputElement elementPC = source.OutputElements .FirstOrDefault(rec => rec.OutputID == model.ID && rec.ElementID == groupComponent.ComponentId); if (elementPC != null) { elementPC.Count += groupComponent.Count; } else { source.OutputElements.Add(new OutputElement { ID = ++maxPCId, OutputID = model.ID, ElementID = groupComponent.ComponentId, Count = groupComponent.Count }); } } }
protected override void OnPrefabInit() { base.OnPrefabInit(); Attributes attributes = base.gameObject.GetAttributes(); machinerySpeedAttribute = attributes.Add(Db.Get().Attributes.MachinerySpeed); if (ElementConverterInput == null) { ElementConverterInput = new StatusItem("ElementConverterInput", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, true, OverlayModes.None.ID, true, 129022).SetResolveStringCallback(delegate(string str, object data) { ConsumedElement consumedElement = (ConsumedElement)data; str = str.Replace("{ElementTypes}", consumedElement.Name); str = str.Replace("{FlowRate}", GameUtil.GetFormattedByTag(consumedElement.tag, consumedElement.Rate, GameUtil.TimeSlice.PerSecond)); return(str); }); } if (ElementConverterOutput == null) { ElementConverterOutput = new StatusItem("ElementConverterOutput", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, true, OverlayModes.None.ID, true, 129022).SetResolveStringCallback(delegate(string str, object data) { OutputElement outputElement = (OutputElement)data; str = str.Replace("{ElementTypes}", outputElement.Name); str = str.Replace("{FlowRate}", GameUtil.GetFormattedMass(outputElement.Rate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")); return(str); }); } }
public static string TemplateKeyForOutputType(OutputElement output) { if (string.IsNullOrEmpty(output?.ColumnType)) { return("Numeric"); } return(TemplateKeyForOutputType(output?.ColumnType)); }
public List <Descriptor> GetDescriptors(BuildingDef def) { List <Descriptor> list = new List <Descriptor>(); if (!showDescriptors) { return(list); } if (consumedElements != null) { ConsumedElement[] array = consumedElements; for (int i = 0; i < array.Length; i++) { ConsumedElement consumedElement = array[i]; Descriptor item = default(Descriptor); item.SetupDescriptor(string.Format(UI.BUILDINGEFFECTS.ELEMENTCONSUMED, consumedElement.Name, GameUtil.GetFormattedMass(consumedElement.massConsumptionRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.##}")), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.ELEMENTCONSUMED, consumedElement.Name, GameUtil.GetFormattedMass(consumedElement.massConsumptionRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.##}")), Descriptor.DescriptorType.Requirement); list.Add(item); } } if (outputElements != null) { OutputElement[] array2 = outputElements; for (int j = 0; j < array2.Length; j++) { OutputElement outputElement = array2[j]; Descriptor item2 = default(Descriptor); LocString loc_string; LocString loc_string2; if (outputElement.useEntityTemperature) { loc_string = UI.BUILDINGEFFECTS.ELEMENTEMITTED_ENTITYTEMP; loc_string2 = UI.BUILDINGEFFECTS.TOOLTIPS.ELEMENTEMITTED_ENTITYTEMP; } else if (outputElement.minOutputTemperature > 0f) { loc_string = UI.BUILDINGEFFECTS.ELEMENTEMITTED_MINTEMP; loc_string2 = UI.BUILDINGEFFECTS.TOOLTIPS.ELEMENTEMITTED_MINTEMP; } else { loc_string = UI.BUILDINGEFFECTS.ELEMENTEMITTED_INPUTTEMP; loc_string2 = UI.BUILDINGEFFECTS.TOOLTIPS.ELEMENTEMITTED_INPUTTEMP; } item2.SetupDescriptor(string.Format(loc_string, outputElement.Name, GameUtil.GetFormattedMass(outputElement.massGenerationRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.##}"), GameUtil.GetFormattedTemperature(outputElement.minOutputTemperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)), string.Format(loc_string2, outputElement.Name, GameUtil.GetFormattedMass(outputElement.massGenerationRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.##}"), GameUtil.GetFormattedTemperature(outputElement.minOutputTemperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)), Descriptor.DescriptorType.Effect); list.Add(item2); } } return(list); }
protected internal override void Configure(OutputElement config) { //**************************************** var MyConfig = (TextFileOutputElement)config; //**************************************** base.Configure(config); //**************************************** IndentTabs = MyConfig.IndentTabs; IndentSize = MyConfig.IndentSize; Encoding = Encoding.GetEncoding(MyConfig.Encoding); }
public static string TemplateValueForOutputAttValue(OutputElement output) { if (output == null) { return("'0'"); } if (output.ColumnType == "Numeric") { return($"&{output.Attribute.Name}"); } else { return($"&{output.Attribute.Name}.ToString().Trim()"); } }
public void updateElement(BoundOutputModel model) { using (var transaction = context.Database.BeginTransaction()) { try { Output element = context.Outputs.FirstOrDefault(rec => rec.OutputName == model.OutputName && rec.ID != model.ID); if (element != null) { throw new Exception("Уже есть изделие с таким названием"); } element = context.Outputs.FirstOrDefault(rec => rec.ID == model.ID); if (element == null) { throw new Exception("Элемент не найден"); } element.OutputName = model.OutputName; element.Price = model.Price; context.SaveChanges(); var compIds = model.OutputElements.Select(rec => rec.ElementID).Distinct(); var updateComponents = context.OutputElements .Where(rec => rec.OutputID == model.ID && compIds.Contains(rec.ElementID)); foreach (var updateComponent in updateComponents) { updateComponent.Count = model.OutputElements .FirstOrDefault(rec => rec.ID == updateComponent.ID).Count; } context.SaveChanges(); context.OutputElements.RemoveRange( context.OutputElements.Where(rec => rec.OutputID == model.ID && !compIds.Contains(rec.ElementID))); context.SaveChanges(); var groupComponents = model.OutputElements .Where(rec => rec.ID == 0) .GroupBy(rec => rec.ElementID) .Select(rec => new { ComponentId = rec.Key, Count = rec.Sum(r => r.Count) }); foreach (var groupComponent in groupComponents) { OutputElement elementPC = context.OutputElements .FirstOrDefault(rec => rec.OutputID == model.ID && rec.ElementID == groupComponent.ComponentId); if (elementPC != null) { elementPC.Count += groupComponent.Count; context.SaveChanges(); } else { context.OutputElements.Add(new OutputElement { OutputID = model.ID, ElementID = groupComponent.ComponentId, Count = groupComponent.Count }); context.SaveChanges(); } } transaction.Commit(); } catch (Exception) { transaction.Rollback(); throw; } } }
/// <summary> /// Sets input and output PinTarget for this connection</summary> public void SetPinTarget() { if (InputPin != null) { bool isInputElementRef = InputElement.DomNode.Is <IReference <DomNode> >(); if (InputPin.Is <GroupPin>()) { if (isInputElementRef) { var pinTarget = InputPin.Cast <GroupPin>().PinTarget; InputPinTarget = new PinTarget(pinTarget.LeafDomNode, pinTarget.LeafPinIndex, InputElement.DomNode); } else { InputPinTarget = InputPin.Cast <GroupPin>().PinTarget; } } else { if (isInputElementRef) { var reference = InputElement.As <IReference <DomNode> >(); InputPinTarget = new PinTarget(reference.Target, InputPin.Index, InputElement.DomNode); } else { InputPinTarget = new PinTarget(InputElement.DomNode, InputPin.Index, null); } } Debug.Assert(InputPinTarget != null, "sanity check"); } if (OutputPin != null) { bool isOutputElementRef = OutputElement.DomNode.Is <IReference <DomNode> >(); if (OutputPin.Is <GroupPin>()) { if (isOutputElementRef) { var pinTarget = OutputPin.Cast <GroupPin>().PinTarget; OutputPinTarget = new PinTarget(pinTarget.LeafDomNode, pinTarget.LeafPinIndex, OutputElement.DomNode); } else { OutputPinTarget = OutputPin.Cast <GroupPin>().PinTarget; } } else { if (isOutputElementRef) { var reference = OutputElement.Cast <IReference <DomNode> >(); OutputPinTarget = new PinTarget(reference.Target, OutputPin.Index, OutputElement.DomNode); } else { OutputPinTarget = new PinTarget(OutputElement.DomNode, OutputPin.Index, null); } } Debug.Assert(OutputPinTarget != null, "sanity check"); } }
//**************************************** /// <summary> /// Applies the configuration for this log output /// </summary> /// <param name="config">The configuration to use</param> protected internal virtual void Configure(OutputElement config) { }
//**************************************** /// <inheritdoc /> protected internal override void Configure(OutputElement config) { var MyConfig = (TraceOutputElement)config; _DebuggerOnly = MyConfig.DebuggerOnly; }
public static IEnumerable <KeyValuePair <string, string> > EnumerateOutputProperties(OutputElement output) { string columnType = output.ColumnType; yield return(new KeyValuePair <string, string>("column_type", columnType)); yield return(new KeyValuePair <string, string>("inspect_output", output.InspectOutput.ToString())); if (columnType == "Numeric") { string missingValueStrategy = output.MissingValueStrategyNumeric; yield return(new KeyValuePair <string, string>("missing_value_strategy", missingValueStrategy)); if (missingValueStrategy == "Fill with constant") { yield return(new KeyValuePair <string, string>("fill_value", output.FillValueNumeric.ToString())); } yield return(new KeyValuePair <string, string>("normalization_numeric", output.NormalizationNumeric)); yield return(new KeyValuePair <string, string>("loss", output.LossNumeric)); } if (columnType == "Category") { string elementType = output.ElementType; yield return(new KeyValuePair <string, string>("element_type", elementType)); string missingValueStrategy = ""; if (elementType == "Numerics") { missingValueStrategy = output.MissingValueStrategyCategoryNumerics; } else { missingValueStrategy = output.MissingValueStrategyCategoryCharacters; } yield return(new KeyValuePair <string, string>("missing_value_strategy", missingValueStrategy)); if (missingValueStrategy == "Fill with constant") { if (elementType == "Numerics") { yield return(new KeyValuePair <string, string>("fill_value", output.FillValueCategoryNumerics.ToString())); } else { yield return(new KeyValuePair <string, string>("fill_value", output.FillValueCategoryCharacters)); } } yield return(new KeyValuePair <string, string>("most_common_category", output.MostCommonCategory.ToString())); if (elementType == "Numerics") { yield return(new KeyValuePair <string, string>("bucketize_numerics", output.BucketizeCategoryNumerics.ToString())); } yield return(new KeyValuePair <string, string>("loss", output.LossCategory)); } if (columnType == "Region") { yield return(new KeyValuePair <string, string>("format", output.FormatRegion)); yield return(new KeyValuePair <string, string>("separator", output.SeparatorRegion)); yield return(new KeyValuePair <string, string>("loss", output.LossRegion)); } if (columnType == "Text") { yield return(new KeyValuePair <string, string>("remove_diacritics", output.RemoveDiacriticsText.ToString())); yield return(new KeyValuePair <string, string>("stopwords_file", output.StopwordsFileText.ToString())); yield return(new KeyValuePair <string, string>("max_characters", output.MaxCharactersText.ToString())); yield return(new KeyValuePair <string, string>("char_padding_direction", output.CharacterPaddingDirectionText)); yield return(new KeyValuePair <string, string>("char_padding_symbol", output.CharacterPaddingSymbolText)); yield return(new KeyValuePair <string, string>("max_words", output.MaxWordsText.ToString())); yield return(new KeyValuePair <string, string>("word_padding_direction", output.WordPaddingDirectionText)); yield return(new KeyValuePair <string, string>("word_padding_symbol", output.WordPaddingSymbolText)); yield return(new KeyValuePair <string, string>("most_common_text", output.MostCommonText.ToString())); yield return(new KeyValuePair <string, string>("unknown_symbol", output.UnknownSymbolText)); yield return(new KeyValuePair <string, string>("tokenizer", output.TokenizerText)); yield return(new KeyValuePair <string, string>("loss", output.LossText)); yield return(new KeyValuePair <string, string>("level_text", output.LevelText)); } yield return(new KeyValuePair <string, string>("lowercase_characters", output.LowercaseCharacters.ToString())); }
private void ConvertMass() { float speedMultiplier = GetSpeedMultiplier(); float num = 1f * speedMultiplier; float num2 = 1f; for (int i = 0; i < consumedElements.Length; i++) { ConsumedElement consumedElement = consumedElements[i]; float num3 = consumedElement.massConsumptionRate * num * num2; if (num3 <= 0f) { num2 = 0f; break; } float num4 = 0f; for (int j = 0; j < storage.items.Count; j++) { GameObject gameObject = storage.items[j]; if (!((UnityEngine.Object)gameObject == (UnityEngine.Object)null) && gameObject.HasTag(consumedElement.tag)) { PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); float num5 = Mathf.Min(num3, component.Mass); num4 += num5 / num3; } } num2 = Mathf.Min(num2, num4); } if (!(num2 <= 0f)) { SimUtil.DiseaseInfo diseaseInfo = SimUtil.DiseaseInfo.Invalid; diseaseInfo.idx = byte.MaxValue; diseaseInfo.count = 0; float num6 = 0f; float num7 = 0f; float num8 = 0f; for (int k = 0; k < consumedElements.Length; k++) { ConsumedElement consumedElement2 = consumedElements[k]; float num9 = consumedElement2.massConsumptionRate * num * num2; Game.Instance.accumulators.Accumulate(consumedElement2.accumulator, num9); for (int l = 0; l < storage.items.Count; l++) { GameObject gameObject2 = storage.items[l]; if (!((UnityEngine.Object)gameObject2 == (UnityEngine.Object)null)) { if (gameObject2.HasTag(consumedElement2.tag)) { PrimaryElement component2 = gameObject2.GetComponent <PrimaryElement>(); component2.KeepZeroMassObject = true; float num10 = Mathf.Min(num9, component2.Mass); float num11 = num10 / component2.Mass; int num12 = (int)(num11 * (float)component2.DiseaseCount); float num13 = num10 * component2.Element.specificHeatCapacity; num8 += num13; num7 += num13 * component2.Temperature; component2.Mass -= num10; component2.ModifyDiseaseCount(-num12, "ElementConverter.ConvertMass"); num6 += num10; diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(diseaseInfo.idx, diseaseInfo.count, component2.DiseaseIdx, num12); num9 -= num10; if (num9 <= 0f) { break; } } if (num9 <= 0f) { Debug.Assert(num9 <= 0f); } } } } float num14 = (!(num8 > 0f)) ? 0f : (num7 / num8); if (onConvertMass != null && num6 > 0f) { onConvertMass(num6); } if (outputElements != null && outputElements.Length > 0) { for (int m = 0; m < outputElements.Length; m++) { OutputElement outputElement = outputElements[m]; SimUtil.DiseaseInfo a = diseaseInfo; if (totalDiseaseWeight <= 0f) { a.idx = byte.MaxValue; a.count = 0; } else { float num15 = outputElement.diseaseWeight / totalDiseaseWeight; a.count = (int)((float)a.count * num15); } if (outputElement.addedDiseaseIdx != 255) { a = SimUtil.CalculateFinalDiseaseInfo(a, new SimUtil.DiseaseInfo { idx = outputElement.addedDiseaseIdx, count = outputElement.addedDiseaseCount }); } float num16 = outputElement.massGenerationRate * OutputMultiplier * num * num2; Game.Instance.accumulators.Accumulate(outputElement.accumulator, num16); float num17 = 0f; num17 = ((!outputElement.useEntityTemperature && (num14 != 0f || outputElement.minOutputTemperature != 0f)) ? Mathf.Max(outputElement.minOutputTemperature, num14) : GetComponent <PrimaryElement>().Temperature); Element element = ElementLoader.FindElementByHash(outputElement.elementHash); if (outputElement.storeOutput) { PrimaryElement primaryElement = storage.AddToPrimaryElement(outputElement.elementHash, num16, num17); if ((UnityEngine.Object)primaryElement == (UnityEngine.Object)null) { if (element.IsGas) { storage.AddGasChunk(outputElement.elementHash, num16, num17, a.idx, a.count, true, true); } else if (element.IsLiquid) { storage.AddLiquid(outputElement.elementHash, num16, num17, a.idx, a.count, true, true); } else { GameObject go = element.substance.SpawnResource(base.transform.GetPosition(), num16, num17, a.idx, a.count, true, false, false); storage.Store(go, true, false, true, false); } } else { primaryElement.AddDisease(a.idx, a.count, "ElementConverter.ConvertMass"); } } else { Vector3 position = base.transform.GetPosition(); float x = position.x + outputElement.outputElementOffset.x; Vector3 position2 = base.transform.GetPosition(); Vector3 vector = new Vector3(x, position2.y + outputElement.outputElementOffset.y, 0f); int num18 = Grid.PosToCell(vector); if (element.IsLiquid) { int idx = element.idx; FallingWater.instance.AddParticle(num18, (byte)idx, num16, num17, a.idx, a.count, true, false, false, false); } else if (element.IsSolid) { element.substance.SpawnResource(vector, num16, num17, a.idx, a.count, false, false, false); } else { SimMessages.AddRemoveSubstance(num18, outputElement.elementHash, CellEventLogger.Instance.OxygenModifierSimUpdate, num16, num17, a.idx, a.count, true, -1); } } if (outputElement.elementHash == SimHashes.Oxygen) { ReportManager.Instance.ReportValue(ReportManager.ReportType.OxygenCreated, num16, base.gameObject.GetProperName(), null); } } } storage.Trigger(-1697596308, base.gameObject); } }
private void SetPayload(FrameworkElement element, bool isFlippedHorizontally) { object simulinkNodeElement; Guid? guid = GlobalVariableManager.LastSelectedElementIdentifer; switch (element.Name) { case "Constant": { Constant constant = (element as Constant); simulinkNodeElement = new InputElement(SimulinkInputType.Constant, guid); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(constant.Value), constant.Value); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "Step": { Step step = (element as Step); simulinkNodeElement = new InputElement(SimulinkInputType.Step, guid); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(step.StepTime), step.StepTime); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(step.InitialValue), step.InitialValue); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(step.FinalValue), step.FinalValue); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(step.SampleTime), step.SampleTime); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "Ramp": { Ramp ramp = (element as Ramp); simulinkNodeElement = new InputElement(SimulinkInputType.Ramp, guid); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(ramp.Slope), ramp.Slope); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(ramp.StartTime), ramp.StartTime); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add(nameof(ramp.InitialOutput), ramp.InitialOutput); ((ISimulinkNodeElement <SimulinkInputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "Scope": simulinkNodeElement = new OutputElement(SimulinkOutputType.Scope, guid); break; case "Display": simulinkNodeElement = new OutputElement(SimulinkOutputType.Display, guid); break; case "TransferFunction": { TransferFunction transferFunction = (element as TransferFunction); simulinkNodeElement = new InputOutputElement(SimulinkInputOutputType.TransferFunction, guid); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(transferFunction.NumeratorCoefficients), transferFunction.NumeratorCoefficients); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(transferFunction.DenominatorCoefficients), transferFunction.DenominatorCoefficients); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "PidController": { PidController pidController = (element as PidController); simulinkNodeElement = new InputOutputElement(SimulinkInputOutputType.PidController, guid); // Selected Controller ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.SelectedPidController), pidController.SelectedPidController); // Controller Parameters ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.Proportional), pidController.Proportional); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.Integral), pidController.Integral); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.Derivative), pidController.Derivative); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.FilterCoefficient), pidController.FilterCoefficient); // Controller Initial Conditions ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.Integrator), pidController.Integrator); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(pidController.Filter), pidController.Filter); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "Integrator": { Integrator integrator = (element as Integrator); simulinkNodeElement = new InputOutputElement(SimulinkInputOutputType.Integrator, guid); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(integrator.InitialCondition), integrator.InitialCondition); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "Sum": { Sum sum = (element as Sum); simulinkNodeElement = new InputOutputElement(SimulinkInputOutputType.Sum, guid); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).NumberOfInputs = sum.Signs.CountNonEmpty(); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(sum.Signs), sum.Signs); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; case "Gain": { Gain gain = (element as Gain); simulinkNodeElement = new InputOutputElement(SimulinkInputOutputType.Gain, guid); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add(nameof(gain.Value), gain.Value); ((ISimulinkNodeElement <SimulinkInputOutputType>)simulinkNodeElement).Properties.Add("FlipHorizontally", isFlippedHorizontally); } break; default: throw new InvalidOperationException(); } SimulinkNodeElement = simulinkNodeElement; }