Example #1
0
        static MethodBag ExtractMethods(string src)
        {
            var    methods            = new MethodBag();
            var    lastLineWithMethod = 0;
            string lastComment        = null;

            var lines = File.ReadAllLines(src);

            for (var i = 0; i < lines.Length; i++)
            {
                var line = lines[i];
                if (line.StartsWith("FMOD_RESULT F_API") || line.StartsWith("FMOD_BOOL "))
                {
                    // was our last line a method as well? If not, we can find a comment above us
                    if (lastLineWithMethod != i - 1)
                    {
                        lastComment = ExtractLastComment(lines, i - 1);
                    }

                    lastLineWithMethod = i;
                    line = line.Replace("F_API", "");
                    methods.AddMethod(lastComment, ParseMethod(line));
                }
            }

            return(methods);
        }