private Portal GetOtherPortal() { foreach (Portal portal in FindObjectsOfType <Portal>()) { DestinationIdentifier otherPortal = portal.destination; if (portal == this || portal.destination != this.destination) { continue; } return(portal); } // if no portal found print("Could not find Portal."); return(null); }
private void SetValue(EventInfo eventInfo, string replacementText) { Variables variables = null; switch (TargetSource) { case VariableSource.Channel: variables = eventInfo.Variables; break; case VariableSource.Global: variables = Self.Variables; break; } if (variables != null) { IVariable <string> variable = variables.GetOrDefault <string>(VariableName.GetText(eventInfo.Variables)) ?? variables.Add <string>(VariableName.GetText(eventInfo.Variables)); if (DestinationIdentifier != null && DestinationMessageValueType != MessageValueType.Text && variable?.Value != null) { switch (DestinationMessageValueType) { case MessageValueType.Json: variable.Value = variable.Value.SetJsonValue(DestinationIdentifier.GetText(eventInfo.Variables), replacementText); break; case MessageValueType.Xml: variable.Value = variable.Value.SetXmlValue(DestinationIdentifier.GetText(eventInfo.Variables), replacementText); break; } } else { variable.Value = replacementText; } } }