Esempio n. 1
0
 private void OnParsed(string fileName, RuntimeObject obj)
 {
     Application.Invoke(delegate
     {
         TreeIter parent = store.AppendValues(fileName, null);
         Add(parent, "", obj);
         view.SetCursor(store.GetPath(parent), column, false);
     });
 }
Esempio n. 2
0
 public static extern void encodeWithCoder_(RuntimeObject ___object, Selector ___selector, out RuntimeObject ___occuredException, int ___stackSize, NSCoder coder);
Esempio n. 3
0
 public EcmaArrayEnumerator(RuntimeObject target)
 {
     this.target = target;
 }
Esempio n. 4
0
        /// <summary>
        ///		Saves this entity into a given binary writer.
        /// </summary>
        /// <param name="writer">Binary writer to save this entity into.</param>
        public override void Save(BinaryWriter writer)
        {
            // Save all the basic entity details.
            base.Save(writer);

            // Save all the scripted entity specific details.
            writer.Write((_process.Process != null && _process.Process.Url != null));
            if ((_process.Process != null && _process.Process.Url != null))
            {
                writer.Write(_process.Process.Url);

                int propertyCount = 0;
                foreach (Symbol symbol in _process.Process.GlobalScope.Symbols)
                {
                    if (symbol is VariableSymbol == false || ((VariableSymbol)symbol).IsProperty == false)
                    {
                        continue;
                    }
                    propertyCount++;
                }
                writer.Write((short)propertyCount);

                // Write in the value of all the properties stored in the process.
                foreach (Symbol symbol in _process.Process.GlobalScope.Symbols)
                {
                    if (symbol is VariableSymbol == false || ((VariableSymbol)symbol).IsProperty == false)
                    {
                        continue;
                    }
                    VariableSymbol variableSymbol = symbol as VariableSymbol;

                    // Quickly find out the meta data of this symbol.
                    string editMethod = "";
                    foreach (Symbol subSymbol in symbol.Symbols)
                    {
                        if (subSymbol is MetaDataSymbol)
                        {
                            if (((MetaDataSymbol)subSymbol).Identifier.ToLower() == "editmethod")
                            {
                                editMethod = ((MetaDataSymbol)subSymbol).Value;
                                break;
                            }
                        }
                    }

                    writer.Write(variableSymbol.Identifier);
                    writer.Write((byte)variableSymbol.DataType.DataType);
                    writer.Write(variableSymbol.IsArray);
                    if (variableSymbol.IsArray == true)
                    {
                        int arrayIndex = _process.Process[0].GetArrayGlobal(variableSymbol.Identifier);
                        writer.Write(arrayIndex != 0);
                        if (arrayIndex != 0)
                        {
                            int arrayLength = _process.Process[0].GetArrayLength(arrayIndex);
                            writer.Write(arrayLength);
                            for (int i = 0; i < arrayLength; i++)
                            {
                                switch (variableSymbol.DataType.DataType)
                                {
                                case DataType.Bool: writer.Write(_process.Process[0].GetBooleanArrayElement(arrayIndex, i)); break;

                                case DataType.Byte: writer.Write(_process.Process[0].GetByteArrayElement(arrayIndex, i)); break;

                                case DataType.Double: writer.Write(_process.Process[0].GetDoubleArrayElement(arrayIndex, i)); break;

                                case DataType.Float: writer.Write(_process.Process[0].GetFloatArrayElement(arrayIndex, i)); break;

                                case DataType.Int: writer.Write(_process.Process[0].GetIntArrayElement(arrayIndex, i)); break;

                                case DataType.Long: writer.Write(_process.Process[0].GetLongArrayElement(arrayIndex, i)); break;

                                case DataType.Short: writer.Write(_process.Process[0].GetShortArrayElement(arrayIndex, i)); break;

                                case DataType.String: writer.Write(_process.Process[0].GetStringArrayElement(arrayIndex, i)); break;

                                case DataType.Object:
                                    RuntimeObject obj = _process.Process[0].GetObjectArrayElement(arrayIndex, i);
                                    if (obj != null)
                                    {
                                        if (editMethod.ToLower() == "image")
                                        {
                                            if (obj is NativeObject && ((Graphics.Image)((NativeObject)obj).Object) != null)
                                            {
                                                Graphics.Image img = ((Graphics.Image)((NativeObject)obj).Object);
                                                writer.Write(true);
                                                writer.Write((byte)0);
                                                writer.Write(img.URL);
                                                writer.Write(img.Width);
                                                writer.Write(img.Height);
                                                writer.Write((short)img.VerticalSpacing);
                                                writer.Write((short)img.HorizontalSpacing);
                                            }
                                            else
                                            {
                                                writer.Write(false);
                                            }
                                        }
                                        else if (editMethod.ToLower() == "sound")
                                        {
                                            if (obj is NativeObject && ((Audio.Sound)((NativeObject)obj).Object) != null)
                                            {
                                                Audio.Sound sound = ((Audio.Sound)((NativeObject)obj).Object);
                                                writer.Write(true);
                                                writer.Write((byte)1);
                                                writer.Write(sound.URL);
                                                writer.Write(sound.Frequency);
                                                writer.Write(sound.InnerRadius);
                                                writer.Write(sound.Looping);
                                                writer.Write(sound.OuterRadius);
                                                writer.Write(sound.Pan);
                                                writer.Write(sound.Volume);
                                                writer.Write(sound.Streaming);
                                                writer.Write(sound.Positional);
                                            }
                                            else
                                            {
                                                writer.Write(false);
                                            }
                                        }
                                        else
                                        {
                                            writer.Write(false);
                                        }
                                    }
                                    else
                                    {
                                        writer.Write(false);
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        switch (variableSymbol.DataType.DataType)
                        {
                        case DataType.Bool: writer.Write(_process.Process[0].GetBooleanGlobal(variableSymbol.Identifier)); break;

                        case DataType.Byte: writer.Write(_process.Process[0].GetByteGlobal(variableSymbol.Identifier)); break;

                        case DataType.Double: writer.Write(_process.Process[0].GetDoubleGlobal(variableSymbol.Identifier)); break;

                        case DataType.Float: writer.Write(_process.Process[0].GetFloatGlobal(variableSymbol.Identifier)); break;

                        case DataType.Int: writer.Write(_process.Process[0].GetIntegerGlobal(variableSymbol.Identifier)); break;

                        case DataType.Long: writer.Write(_process.Process[0].GetLongGlobal(variableSymbol.Identifier)); break;

                        case DataType.Short: writer.Write(_process.Process[0].GetShortGlobal(variableSymbol.Identifier)); break;

                        case DataType.String:
                            string value = _process.Process[0].GetStringGlobal(variableSymbol.Identifier);
                            writer.Write(value == null || value == "" ? "" : value);
                            break;

                        case DataType.Object:
                            RuntimeObject obj = _process.Process[0].GetObjectGlobal(variableSymbol.Identifier);
                            if (obj != null)
                            {
                                if (editMethod.ToLower() == "image")
                                {
                                    if (obj is NativeObject && ((Graphics.Image)((NativeObject)obj).Object) != null)
                                    {
                                        Graphics.Image img = ((Graphics.Image)((NativeObject)obj).Object);
                                        writer.Write(true);
                                        writer.Write((byte)0);
                                        writer.Write(img.URL);
                                        writer.Write(img.Width);
                                        writer.Write(img.Height);
                                        writer.Write((short)img.VerticalSpacing);
                                        writer.Write((short)img.HorizontalSpacing);
                                    }
                                    else
                                    {
                                        writer.Write(false);
                                    }
                                }
                                else if (editMethod.ToLower() == "sound")
                                {
                                    if (obj is NativeObject && ((Audio.Sound)((NativeObject)obj).Object) != null)
                                    {
                                        Audio.Sound sound = ((Audio.Sound)((NativeObject)obj).Object);
                                        writer.Write(true);
                                        writer.Write((byte)1);
                                        writer.Write(sound.URL);
                                        writer.Write(sound.Frequency);
                                        writer.Write(sound.InnerRadius);
                                        writer.Write(sound.Looping);
                                        writer.Write(sound.OuterRadius);
                                        writer.Write(sound.Pan);
                                        writer.Write(sound.Volume);
                                        writer.Write(sound.Streaming);
                                        writer.Write(sound.Positional);
                                    }
                                    else
                                    {
                                        writer.Write(false);
                                    }
                                }
                                else
                                {
                                    writer.Write(false);
                                }
                            }
                            else
                            {
                                writer.Write(false);
                            }
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 5
0
 internal AsyncFromSyncIterator(EcmaValue value)
     : base(WellKnownObject.AsyncFromSyncIteratorPrototype)
 {
     this.target   = value.ToObject();
     this.iterator = new EcmaIteratorEnumerator(value);
 }
Esempio n. 6
0
 private EcmaRegExp(RuntimeObject constructor)
     : base(WellKnownObject.RegExpPrototype, constructor)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Replaces occurences of substrings that matches the pattern by the value returned from the invocation of pipe function argument.
 /// </summary>
 /// <param name="input">Input string.</param>
 /// <param name="replacement">A pipe function argument.</param>
 /// <returns></returns>
 public string Replace(string input, RuntimeObject replacement)
 {
     return(ReplaceInternal(input, m => RegExpPrototype.InvokeReplacementCallback(replacement, new MatchResult(this, input, m, null, 0))));
 }
Esempio n. 8
0
 public static void IsConstructorWLength(EcmaValue fn, string name, int functionLength, RuntimeObject prototype, RuntimeObject fnProto = null)
 {
     That(fn, Is.TypeOf("function"));
     That(fn, Has.OwnProperty("name", name, EcmaPropertyAttributes.Configurable));
     That(fn, Has.OwnProperty("length", functionLength, EcmaPropertyAttributes.Configurable));
     if (prototype != null)
     {
         That(fn, Has.OwnProperty("prototype", prototype, EcmaPropertyAttributes.None));
     }
     else
     {
         That(Global.Object.Invoke("getOwnPropertyDescriptor", fn, "prototype"), Is.Undefined);
     }
     That(Global.Object.Invoke("getPrototypeOf", fn), Is.EqualTo(fnProto ?? Global.Function.Prototype));
 }
        public static void RevertPrefabPropertyOverride(object userData)
        {
            SerializedProperty parentProperty = userData as SerializedProperty;

#if UNITY_2018_2_OR_NEWER
            Object prefab = PrefabUtility.GetCorrespondingObjectFromSource(parentProperty.serializedObject.targetObject);
#else
            Object prefab = PrefabUtility.GetPrefabParent(parentProperty.serializedObject.targetObject);
#endif
            SerializedObject   serializedObject = new SerializedObject(prefab);
            SerializedProperty prop             = serializedObject.FindProperty(parentProperty.propertyPath);

            parentProperty.arraySize = prop.arraySize;
            for (int i = 0; i < parentProperty.arraySize; i++)
            {
                var obj1 = RuntimeSerializedObjectCache.GetRuntimeSerializedObject(parentProperty.GetArrayElementAtIndex(i));
                var obj2 = RuntimeSerializedObjectCache.GetRuntimeSerializedObject(prop.GetArrayElementAtIndex(i), RuntimeObject.FromJson(prop.GetArrayElementAtIndex(i).stringValue));
                obj1.Target = obj2.Target;
                obj1.ForceReloadProperties();
            }

            EditorUtilityHelper.ForceReloadInspectors();
        }
Esempio n. 10
0
 public void Connect(string strName, out RuntimeObject item)
 {
     ExAddProperty(this.m_pSelf, strName, 4, 0x3e8);
     item = null;
 }
Esempio n. 11
0
 public void Add(EcmaPropertyKey key, RuntimeObject value)
 {
     Add(new InspectorMetaObjectEntry(key, value));
 }
Esempio n. 12
0
        public void ObjectHosting()
        {
            It("should return different instances on different execution thread", () => {
                TestObject obj   = new TestObject();
                RuntimeObject v0 = RuntimeRealm.Current.ResolveRuntimeObject(obj);

                RuntimeExecution.CreateWorkerThread(parentRealm => {
                    Assume.That(parentRealm, Is.Not.EqualTo(RuntimeRealm.Current), "realm should be different");

                    RuntimeObject v1 = RuntimeRealm.Current.ResolveRuntimeObject(obj);
                    That(v0 != v1, "returned object should be different");
                    That(v0.Realm, Is.EqualTo(parentRealm));
                    That(v1.Realm, Is.EqualTo(RuntimeRealm.Current));

                    That(v0.GetPrototypeOf() != v1.GetPrototypeOf(), "the prototype of returned object should be different");
                    That(v0.GetPrototypeOf().Realm, Is.EqualTo(parentRealm));
                    That(v1.GetPrototypeOf().Realm, Is.EqualTo(RuntimeRealm.Current));

                    That(v0.GetPrototypeOf().GetPrototypeOf() != v1.GetPrototypeOf().GetPrototypeOf(), "all prototype ancestors of returned object should be different");

                    That(v0["MyMethod"], Is.TypeOf("function"));
                    That(v0["MyMethod"], Is.Not.EqualTo(v1["MyMethod"]), "property value of object type should be different");
                }, true).Thread.Join();
            });

            It("should return different instances on different realm of the same execution thread", () => {
                TestObject obj           = new TestObject();
                RuntimeObject v0         = RuntimeRealm.Current.ResolveRuntimeObject(obj);
                RuntimeRealm parentRealm = RuntimeRealm.Current;
                RuntimeRealm other       = new RuntimeRealm();

                other.Enqueue(() => {
                    Assume.That(RuntimeRealm.Current, Is.Not.EqualTo(parentRealm), "realm should be different");
                    Assume.That(RuntimeRealm.Current, Is.EqualTo(other));

                    RuntimeObject v1 = RuntimeRealm.Current.ResolveRuntimeObject(obj);
                    That(v0 != v1, "returned object should be different");
                    That(v0.Realm, Is.EqualTo(parentRealm));
                    That(v1.Realm, Is.EqualTo(RuntimeRealm.Current));

                    That(v0.GetPrototypeOf() != v1.GetPrototypeOf(), "the prototype of returned object should be different");
                    That(v0.GetPrototypeOf().Realm, Is.EqualTo(parentRealm));
                    That(v1.GetPrototypeOf().Realm, Is.EqualTo(RuntimeRealm.Current));

                    That(v0.GetPrototypeOf().GetPrototypeOf() != v1.GetPrototypeOf().GetPrototypeOf(), "all prototype ancestors of returned object should be different");

                    That(v0["MyMethod"], Is.TypeOf("function"));
                    That(v0["MyMethod"], Is.Not.EqualTo(v1["MyMethod"]), "property value of object type should be different");
                });
                RuntimeExecution.ContinueUntilEnd();
            });

            It("should expose native properties as getters and setters on protoype", () => {
                TestObject obj  = new TestObject();
                EcmaValue value = new EcmaValue(obj);
                value["Value"]  = 1;

                That(value["Value"], Is.EqualTo(1));
                That(obj.Value, Is.EqualTo(1), "Value should be reflected on native object");
                That(() => value["ReadOnlyValue"] = 2, Throws.Nothing, "Setting a readonly property does not throw exception");
                That(value["ReadOnlyValue"], Is.EqualTo(1), "Value should not be changed");

                RuntimeObject testObjectPrototype = value.ToObject().GetPrototypeOf();
                That(testObjectPrototype.GetOwnProperty("Value"), Is.Not.EqualTo(EcmaValue.Undefined), "Property should be defined on the reflected prototype object");
                That(testObjectPrototype.GetOwnProperty("Value").Get, Is.Not.EqualTo(EcmaValue.Undefined), "Property should be defined as getter/setter");
                That(testObjectPrototype.GetOwnProperty("ReadOnlyValue").Set, Is.Undefined, "Readonly property should have no setter");
            });

            It("should expose IList as an Array exotic object", () => {
                EcmaValue list = new EcmaValue(new List <object> {
                    1, 2, 3, new EcmaObject()
                });
                That(list["length"], Is.EqualTo(4));
                That(list.ToString(), Is.EqualTo("1,2,3,[object Object]"));
                That(Global.Json.Invoke("stringify", list), Is.EqualTo("[1,2,3,{}]"));
            });

            It("should expose IDictionary as an ordinary object for valid EcmaPropertyKey", () => {
                Hashtable ht  = new Hashtable();
                EcmaValue obj = new EcmaValue(ht);
                obj["prop"]   = 1;
                That(obj["prop"], Is.EqualTo(1));
                That(Global.Json.Invoke("stringify", obj), Is.EqualTo("{\"prop\":1}"));
            });
        }
Esempio n. 13
0
        /// <summary>
        /// Initializes new instance of RuntimeException class with specified Objective-C exception.
        /// </summary>
        /// <param name="object">Original Objective-C exception.</param>
        public RuntimeException(RuntimeObject @object)
        {
            Object = @object;

            Runtime.RetainNativeObject(Object);
        }
Esempio n. 14
0
 public abstract void Sort(RuntimeObject callback);
Esempio n. 15
0
        public static TypedArray SpeciesCreate(TypedArray source, params EcmaValue[] args)
        {
            RuntimeObject constructor = RuntimeObject.GetSpeciesConstructor(source, TypedArrayInfo.GetDefaultConstructor(source.ArrayKind));

            return(constructor.Construct(args).GetUnderlyingObject <TypedArray>());
        }
Esempio n. 16
0
 public static void Stop()
 {
     RuntimeObject.ClearHash();
 }
Esempio n. 17
0
        private void SerializeJsonObject(TextWriter writer, Stack <RuntimeObject> stack, RuntimeObject value)
        {
            bool   hasEntries    = false;
            string prependString = String.Join("", stack.Select(v => indentString).ToArray());

            if (stack.Contains(value))
            {
                throw new EcmaTypeErrorException(InternalString.Error.CircularJsonObject);
            }
            stack.Push(value);
            writer.Write("{");

            List <EcmaPropertyEntry> entries = new List <EcmaPropertyEntry>();

            if (propertyList != null)
            {
                entries.AddRange(propertyList.Select(v => new EcmaPropertyEntry(v, value.Get(v))));
            }
            else
            {
                entries.AddRange(value.GetEnumerableOwnProperties(false));
            }
            foreach (EcmaPropertyEntry e in entries)
            {
                EcmaValue v = TransformValue(value, e.Key, e.Value);
                if (v.Type != EcmaValueType.Undefined)
                {
                    if (hasEntries)
                    {
                        writer.Write(",");
                    }
                    hasEntries = true;
                    if (indentString != String.Empty)
                    {
                        writer.Write(Environment.NewLine);
                        writer.Write(prependString);
                        writer.Write(indentString);
                    }
                    WriteString(writer, e.Key.ToString());
                    writer.Write(":");
                    if (indentString != String.Empty)
                    {
                        writer.Write(" ");
                    }
                    WritePropertyValue(writer, stack, v);
                }
            }
            if (hasEntries && indentString != String.Empty)
            {
                writer.Write(Environment.NewLine);
                writer.Write(prependString);
            }
            writer.Write("}");
            stack.Pop();
        }
Esempio n. 18
0
 public bool Has(RuntimeObject item)
 {
     return(collection.TryGet <object>(item) != null);
 }
Esempio n. 19
0
 public static EcmaValue Compile([This] EcmaValue thisValue, EcmaValue pattern, EcmaValue flags)
 {
     Guard.ArgumentIsObject(thisValue);
     return(RegExpConstructor.RegExp(RuntimeObject.GetSpeciesConstructor(thisValue.ToObject(), WellKnownObject.RegExpConstructor), thisValue, pattern, flags));
 }
Esempio n. 20
0
 public bool Delete(RuntimeObject item)
 {
     return(collection.TryRemove(item));
 }
Esempio n. 21
0
 protected override void OnCloned(RuntimeObject sourceObj, bool isTransfer, CloneContext context)
 {
     base.OnCloned(sourceObj, isTransfer, context);
     this.LastIndex  = 0;
     this.LastResult = null;
 }
Esempio n. 22
0
 public ArrayBuffer(RuntimeObject constructor)
     : base(WellKnownObject.ArrayBufferPrototype, constructor)
 {
 }
Esempio n. 23
0
 public MatchEvaluatorClass(EcmaRegExp re, string input, RuntimeObject replacement)
 {
     this.re          = re;
     this.input       = input;
     this.replacement = replacement;
 }
Esempio n. 24
0
 protected ArrayBuffer(WellKnownObject proto, RuntimeObject constructor)
     : base(proto, constructor)
 {
 }
Esempio n. 25
0
 internal AsyncFromSyncIterator(EcmaIteratorEnumerator iterator)
     : base(WellKnownObject.AsyncFromSyncIteratorPrototype)
 {
     this.target   = iterator.IteratedObject.ToObject();
     this.iterator = iterator;
 }
Esempio n. 26
0
        /// <summary>
        /// Releases internal NSAutoreleasePool object.
        /// </summary>
        public void Dispose()
        {
            Runtime.SendMessage(_handle, Selectors.release);

            _handle = RuntimeObject.Null;
        }
Esempio n. 27
0
        public static void RevertPrefabPropertyOverride(object userData)
        {
            RuntimeSerializedProperty runtimeSerializedProperty = userData as RuntimeSerializedProperty;
            SerializedProperty        serializedProperty        = runtimeSerializedProperty.RuntimeSerializedObject.ParentProperty as SerializedProperty;

            if (serializedProperty == null)
            {
                Debug.LogError("Revert Value to Prefab is not supported on Nested Runtime Serialized Property!");
                return;
            }
            int index;
            var parentProperty = serializedProperty.GetBelongArrayAndIndex(out index);

            if (index >= 0)
            {
#if UNITY_2018_2_OR_NEWER
                Object prefab = PrefabUtility.GetCorrespondingObjectFromSource(parentProperty.serializedObject.targetObject);
#else
                Object prefab = PrefabUtility.GetPrefabParent(parentProperty.serializedObject.targetObject);
#endif
                SerializedObject   serializedObject = new SerializedObject(prefab);
                SerializedProperty prop             = serializedObject.FindProperty(parentProperty.propertyPath);

                parentProperty.arraySize = prop.arraySize;
                for (int i = 0; i < parentProperty.arraySize; i++)
                {
                    var obj1 = RuntimeSerializedObjectCache.GetRuntimeSerializedObject(parentProperty.GetArrayElementAtIndex(i));
                    var obj2 = RuntimeSerializedObjectCache.GetRuntimeSerializedObject(prop.GetArrayElementAtIndex(i), RuntimeObject.FromJson(prop.GetArrayElementAtIndex(i).stringValue));
                    obj1.Target = obj2.Target;
                    obj1.ForceReloadProperties();
                }

                EditorUtilityHelper.ForceReloadInspectors();
            }
        }
Esempio n. 28
0
        private void SerializeJsonArray(TextWriter writer, Stack <RuntimeObject> stack, RuntimeObject value)
        {
            if (stack.Contains(value))
            {
                throw new EcmaTypeErrorException(InternalString.Error.CircularJsonObject);
            }
            string prependString = String.Join("", stack.Select(v => indentString).ToArray());

            stack.Push(value);
            writer.Write("[");

            long length = value.Get(WellKnownProperty.Length).ToLength();

            for (long i = 0; i < length; i++)
            {
                if (i > 0)
                {
                    writer.Write(",");
                }
                if (indentString != String.Empty)
                {
                    writer.Write(Environment.NewLine);
                    writer.Write(prependString);
                    writer.Write(indentString);
                }
                EcmaValue item = value.Get(i);
                if (item.Type == EcmaValueType.Undefined)
                {
                    writer.Write("null");
                }
                else
                {
                    SerializeJsonProperty(writer, stack, value, i);
                }
            }
            if (length > 0 && indentString != String.Empty)
            {
                writer.Write(Environment.NewLine);
                writer.Write(prependString);
            }
            writer.Write("]");
            stack.Pop();
        }
Esempio n. 29
0
 public static extern void release(RuntimeObject ___object, Selector ___selector, out RuntimeObject ___occuredException, int ___stackSize);
Esempio n. 30
0
        private void SerializeJsonProperty(TextWriter writer, Stack <RuntimeObject> stack, RuntimeObject holder, EcmaPropertyKey property)
        {
            EcmaValue value = TransformValue(holder, property, holder.Get(property));

            if (value.Type != EcmaValueType.Undefined)
            {
                WritePropertyValue(writer, stack, value);
            }
        }
Esempio n. 31
0
 public static extern IntPtr initWithCoder_(RuntimeObject ___object, Selector ___selector, out RuntimeObject ___occuredException, int ___stackSize, NObjective.RuntimeObject coder);
Esempio n. 32
0
 private TreeIter Add(TreeIter parent, string prefix, RuntimeObject node)
 {
     Type type = node.GetType();
     parent = store.AppendValues(parent, prefix + TypeNames.GetName(type), node);
     
     // FIXME
     try
     {
     foreach (string field in Pattern.PatternForType(type).Fields)
         Add(parent, field + ": ", type.GetField(field).GetValue(node));
     }
     catch (Exception)
     {
     }
     
     return parent;
 }