示例#1
0
        /// <summary>
        /// Stores the state of all signals into a string that can be saved to a file.
        /// </summary>
        /// <param name="rta">Runtime application to store the state of</param>
        /// <returns>blob</returns>
        private static string signalStateToBlob(NodeRuntimeApplication rta)
        {
            if (rta == null)
            {
                throw new ArgumentNullException("rta");
            }
            var encodedSignals = from signal in rta.Signals select EncodedSignalValue.EncodeSignalValue(signal);

            return(string.Join(string.Empty, encodedSignals));
        }
示例#2
0
        private NodeTelegram readSignals(NodeTelegram request)
        {
            // incoming request should just be a bunch of Guids that represent signalIds
            var inPayload  = request.Payload.Decode();
            var outPayload = new StringBuilder();

            if (runtimeApplication != null)
            {
                for (int index = 0; index < inPayload.Length; index += m_guidLength)
                {
                    string oneGuidString = inPayload.Substring(index, m_guidLength);
                    if (FieldGuid.CheckSyntax(oneGuidString))
                    {
                        var signalId = new FieldGuid(oneGuidString);
                        var signal   = runtimeApplication.FindSignal(signalId);
                        if (signal != null)
                        {
                            outPayload.Append(EncodedSignalValue.EncodeSignalValue(signal));
                        }
                    }
                }
            }
            return(request.SetPayload(FieldBase64.Encode(outPayload.ToString())));
        }