Esempio n. 1
0
 /// <summary>
 /// An NUnit test case calls this to obtain the computed value for a node
 /// whose ID is denoted by 'nodeId'.
 /// </summary>
 /// <param name="nodeId">The ID of a node whose value is to be retrieved.
 /// </param>
 /// <returns>Returns the StackValue for the 'nodeId'.</returns>
 internal ProtoCore.DSASM.StackValue GetNodeValue(uint nodeId)
 {
     lock (syncRoot)
     {
         ProtoCore.Mirror.MirrorData data = results[nodeId];
         return(data.GetStackValue());
     }
 }
Esempio n. 2
0
        protected static string GetStringRepOfCollection(ProtoCore.Mirror.MirrorData value)
        {
            var items = string.Join(",",
                                    value.GetElements().Select(x =>
            {
                if (x.IsCollection)
                {
                    return(GetStringRepOfCollection(x));
                }
                return(x.IsDictionary ? GetStringRepOfDictionary(x.Data) : x.StringData);
            }));

            return("{" + items + "}");
        }
Esempio n. 3
0
        /// <summary>
        /// Whenever the LiveRunner.NodeValueReady event is raised, its handler calls
        /// this method to store the resulting value (of the node) in the result list.
        /// </summary>
        /// <param name="nodeId">The node ID whose value is in 'data' parameter.</param>
        /// <param name="data">The value of the node indicated by 'nodeId'.</param>
        internal void AppendPreviewValue(uint nodeId, ProtoCore.Mirror.MirrorData data)
        {
            lock (syncRoot)
            {
                if (!requestedNodes.Contains(nodeId))
                {
                    return; // The node value wasn't requested.
                }
                requestedNodes.Remove(nodeId);
                results[nodeId] = data;

                // Here the consumer thread (presumably the LiveRunner)
                // signals to unblock "WaitForCompletion", which is running in
                // another thread (as part of "System.Threading.Tasks.Task").
                autoEvent.Set();
            }
        }
Esempio n. 4
0
        private static object GetDataOfValue(ProtoCore.Mirror.MirrorData value)
        {
            if (value.IsCollection)
            {
                return(value.GetElements().Select(x => GetDataOfValue(x)).ToList <object>());
            }

            if (!value.IsPointer)
            {
                var data = value.Data;

                if (data != null)
                {
                    return(data);
                }
            }

            return(value.StringData);
        }
Esempio n. 5
0
        private static string GetStringRepOfCollection(ProtoCore.Mirror.MirrorData collection)
        {
            var items = string.Join(",", collection.GetElements().Select(x => x.IsCollection ? GetStringRepOfCollection(x) : x.StringData));

            return("{" + items + "}");
        }