Beispiel #1
0
 /// <summary>
 /// Create an immutabe string property
 /// </summary>
 private PropertyDescriptor GetImmutableStringProperty(string name, string value)
 {
     return(new PropertyDescriptor
     {
         Configurable = false,
         Enumerable = true,
         IsOwn = true,
         Writable = false,
         Name = name,
         Value = RemoteObjectCreator.Create(value)
     });
 }
Beispiel #2
0
        private ConsoleAPICalledEvent GetLogEvent(string logMessage, string level)
        {
            var logEvent = new ConsoleAPICalledEvent
            {
                Type               = level,
                Timestamp          = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
                ExecutionContextId = Context,
                Args               = new RemoteObject[]
                {
                    RemoteObjectCreator.Create(logMessage)
                }
            };

            return(logEvent);
        }
Beispiel #3
0
        /// <summary>
        /// Try to create an immutable number property for the object
        /// </summary>
        /// <param name="name">property name</param>
        /// <param name="value">generic value</param>
        /// <returns>null if the value cannot converted to double</returns>
        private PropertyDescriptor TryGetImmutableNumberProperty(string name, object value)
        {
            if (value == null)
            {
                return(null);
            }

            try
            {
                return(new PropertyDescriptor
                {
                    Configurable = false,
                    Enumerable = true,
                    IsOwn = true,
                    Writable = false,
                    Name = name,
                    Value = RemoteObjectCreator.Create(Convert.ToDouble(value))
                });
            }
            catch
            {
                return(null);
            }
        }
Beispiel #4
0
 protected virtual RemoteObject Evaluate(string expr)
 {
     return(RemoteObjectCreator.Create("Not implemented"));
 }