1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.IO;
using Microsoft.CodeAnalysis;
using SourceBrowser.Generator.Model;


namespace SourceBrowser.Generator.DocumentWalkers
{
    internal class WalkerSelector
    {
        public static IWalker GetWalker(IProjectItem parent, Document document, ReferencesourceLinkProvider refSourceLinkProvider)
        {
            var fileExtension = Path.GetExtension(document.FilePath);
            if (String.IsNullOrEmpty(fileExtension))
            {
                return null;
            }
            if (fileExtension == ".cs")
            {
                return new DocumentWalker<CSWalkerUtils>(parent, document, refSourceLinkProvider, (w) => new CSWalkerUtils(w));
            }
            else if (fileExtension == ".vb")
            {
                return new DocumentWalker<VBWalkerUtils>(parent, document, refSourceLinkProvider, (w) => new VBWalkerUtils(w));
            }
            return null;
        }
    }
}