private void ReplicateFunctionFrom(uint entityId, SerializationModel.Function data) { foreach (string param in data.Parameters) { Controller.SetFunctionParameter(entityId, param); } foreach (string ret in data.Returns) { Controller.SetFunctionReturn(entityId, ret); } }
private void ReplicateInstructionsFrom(uint entityId, SerializationModel.Function data) { var instructionIDs = new Dictionary <uint, uint>(); uint i = 0; //replicate instructions foreach (SerializationModel.Instruction instr in data.Instructions) { uint instrId = Controller.AddInstruction(entityId, instr.InstructionType, GetControllerIdsList(instr.Construction)); //replicate input values foreach (var inputValue in instr.InputValues) { Controller.SetInstructionInputJSONValue( entityId, instrId, inputValue.Key, inputValue.Value ); } instructionIDs[i++] = instrId; } //replicate datalinks foreach (SerializationModel.DataLink dataLink in data.DataLinks) { Controller.LinkInstructionData( entityId, instructionIDs[dataLink.OutputInstructionID], dataLink.Output, instructionIDs[dataLink.InputInstructionID], dataLink.Input ); } //replicate flowlinks foreach (SerializationModel.FlowLink flowLink in data.FlowLinks) { Controller.LinkInstructionExecution( entityId, instructionIDs[flowLink.OutflowInstructionID], flowLink.OutflowPin, instructionIDs[flowLink.InflowInstructionID] ); } if (data.EntryPointIndex != -1) { Controller.SetFunctionEntryPoint(entityId, instructionIDs[(uint)data.EntryPointIndex]); } }