Exemple #1
0
        internal static unsafe NXNode ParseNode(NodeData *ptr, NXNode parent, NXFile file)
        {
            NXNode ret;

            switch (ptr->Type)
            {
            case 0:
                ret = new NXNode(ptr, file);
                break;

            case 1:
                ret = new NXInt64Node(ptr, file);
                break;

            case 2:
                ret = new NXDoubleNode(ptr, file);
                break;

            case 3:
                ret = new NXStringNode(ptr, file);
                break;

            case 4:
                ret = new NXPointNode(ptr, file);
                break;

            case 5:
                ret = new NXBitmapNode(ptr, file);
                break;

            case 6:
                ret = new NXAudioNode(ptr, file);
                break;

            default:
                return(Util.Die <NXNode>(string.Format("NX node has invalid type {0}; dying", ptr->Type)));
            }

            if ((file._flags & NXReadSelection.EagerParseFile) == NXReadSelection.EagerParseFile)
            {
                ret.CheckChild();
            }

            return(ret);
        }
Exemple #2
0
        internal static unsafe NXNode ParseNode(NodeData *ptr, NXFile file)
        {
            NXNode ret;

            switch (ptr->Type)
            {
            case NXNodeType.Nothing:
                ret = new NXNode(ptr, file);
                break;

            case NXNodeType.Int64:
                ret = new NXInt64Node(ptr, file);
                break;

            case NXNodeType.Double:
                ret = new NXDoubleNode(ptr, file);
                break;

            case NXNodeType.String:
                ret = new NXStringNode(ptr, file);
                break;

            case NXNodeType.Point:
                ret = new NXPointNode(ptr, file);
                break;

            case NXNodeType.Bitmap:
                ret = new NXBitmapNode(ptr, file);
                break;

            case NXNodeType.Audio:
                ret = new NXAudioNode(ptr, file);
                break;

            default:
                return(Util.Die <NXNode>($"NX node has invalid type {ptr->Type}"));
            }

            if (file.HasFlag(NXReadSelection.EagerParseFile))
            {
                ret.InitialiseMap();
            }

            return(ret);
        }