Пример #1
0
        private void ParseMethodLine(string line)
        {
            int helpStringPos = line.IndexOf("helpstring");

            if (helpStringPos <= 0)
            {
                throw new Exception("Help string could not be found");
            }

            helpStringPos += "helpstring".Length + 2; // 2 for ("

            int    helpStringPosEnd = line.IndexOf(")]", helpStringPos) - 1;
            int    helpStringLen    = helpStringPosEnd - helpStringPos;
            string helpString       = line.Substring(helpStringPos, helpStringLen);

            int hResultPos = line.IndexOf("HRESULT");

            if (hResultPos <= 0)
            {
                throw new Exception("HRESULT could not be found");
            }

            int propertyStartPos = hResultPos + "HRESULT ".Length;
            int propertyEndPos   = line.IndexOf("(", propertyStartPos);
            int propertyLength   = propertyEndPos - propertyStartPos;

            string propertyName = line.Substring(propertyStartPos, propertyLength);

            int    parametersEndPos = line.IndexOf(")", propertyEndPos);
            int    parametersLength = parametersEndPos - propertyEndPos;
            string parameters       = line.Substring(propertyEndPos + 1, parametersLength - 1);

            List <APIParameter> methodParameters;

            ParseGetPropertyParameters(parameters, out methodParameters);

            APIMethod method = new APIMethod();

            _currentInterface.Methods.Add(method);
            method.Name       = propertyName;
            method.Parameters = methodParameters;
            method.HelpString = helpString;
        }
Пример #2
0
        private void ParseMethodLine(string line)
        {
            int helpStringPos = line.IndexOf("helpstring");
            if (helpStringPos <= 0)
                throw new Exception("Help string could not be found");

            helpStringPos += "helpstring".Length + 2; // 2 for ("

            int helpStringPosEnd = line.IndexOf(")]", helpStringPos) - 1;
            int helpStringLen = helpStringPosEnd - helpStringPos;
            string helpString = line.Substring(helpStringPos, helpStringLen);

            int hResultPos = line.IndexOf("HRESULT");
            if (hResultPos <= 0)
                throw new Exception("HRESULT could not be found");

            int propertyStartPos = hResultPos + "HRESULT ".Length;
            int propertyEndPos = line.IndexOf("(", propertyStartPos);
            int propertyLength = propertyEndPos - propertyStartPos;

            string propertyName = line.Substring(propertyStartPos, propertyLength);

            int parametersEndPos = line.IndexOf(")", propertyEndPos);
            int parametersLength = parametersEndPos - propertyEndPos;
            string parameters = line.Substring(propertyEndPos + 1, parametersLength - 1);

            List<APIParameter> methodParameters;
            ParseGetPropertyParameters(parameters, out methodParameters);

            APIMethod method = new APIMethod();
            _currentInterface.Methods.Add(method);
            method.Name = propertyName;
            method.Parameters = methodParameters;
            method.HelpString = helpString;
        }