Esempio n. 1
0
        internal static void readBinary(byte[] bytes, ref int curCodeIndex, List<string> identifiers, ref int curIdIndex, FunctionData data)
        {
            byte code = readByte(bytes, curCodeIndex++);
            if (code == (byte)DslBinaryCode.BeginFunction) {
                code = readByte(bytes, curCodeIndex);
                if (code == (byte)DslBinaryCode.BeginCall) {
                    CallData callData = new CallData();
                    readBinary(bytes, ref curCodeIndex, identifiers, ref curIdIndex, callData);
                    data.Call = callData;
                }
                code = readByte(bytes, curCodeIndex);
                if (code == (byte)DslBinaryCode.BeginExternScript) {
                    ++curCodeIndex;
                    data.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_EXTERN_SCRIPT);
                    data.SetExternScript(readIdentifier(identifiers, curIdIndex++));

                    code = readByte(bytes, curCodeIndex);
                    if (code == (byte)DslBinaryCode.EndExternScript) {
                        ++curCodeIndex;
                    }
                } else {
                    data.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_STATEMENT);
                    for (; ; ) {
                        code = readByte(bytes, curCodeIndex);
                        if (code == (byte)DslBinaryCode.EndFunction) {
                            ++curCodeIndex;
                            break;
                        } else {
                            ISyntaxComponent syntaxData = readBinary(bytes, ref curCodeIndex, identifiers, ref curIdIndex);
                            if (null != syntaxData) {
                                data.Statements.Add(syntaxData);
                            } else {
                                break;
                            }
                        }
                    }
                }
            }
        }