APIDocumentationCreator.Parser.ParsePropLine C# (CSharp) Метод

ParsePropLine() приватный Метод

private ParsePropLine ( string line, bool setProperty ) : void
line string
setProperty bool
Результат void
        private void ParsePropLine(string line, bool setProperty)
        {
            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> propertyParameters;
            ParseGetPropertyParameters(parameters, out propertyParameters);

            APIProperty property = new APIProperty();
            property.Name = propertyName;
            _currentInterface.Properties.Add(property);

            if (setProperty)
                property.HasSet = true;
            else
                property.HasGet = true;

            property.Parameters = propertyParameters;
            property.HelpString = helpString;
        }