Exemplo n.º 1
0
        private object IndexAndReturnExitCode(IndexOptions opts)
        {
            if (opts.SourcePath.Length == 0 || opts.PdbFile.Length == 0)
            {
                return(1);
            }

            var ini         = opts.IniPath ?? opts.ToolsPath;
            var arr         = opts.BackEnd.Split(':');
            var backEndType = arr[0].ToUpper();
            var customCmd   = arr.Length > 1 ? arr[1] : "git";

            SettingsBean Params = new SettingsBean
            {
                PdbFile       = opts.PdbFile,
                SourcePath    = opts.SourcePath,
                ToolsPath     = opts.ToolsPath,
                SrcSrvIniPath = ini,
                BackEndType   = backEndType,
                CustomCommand = customCmd,
                LogLevel      = opts.LogLevel,
            };

            new SourceIndexer(Params).RunSourceIndexing();
            return(0);
        }
Exemplo n.º 2
0
        private SourceIndexer CreateSourceIndexer()
        {
            SettingsBean Params = new SettingsBean
            {
                PdbFile       = PdbPathTextBox.Text,
                SourcePath    = SourceRootTextBox.Text,
                ToolsPath     = SrcToolsPath.Text,
                SrcSrvIniPath = SrcSrvIniPath.Text,
                BackEndType   = BackendComboBox.SelectedItem.ToString().ToUpper(),
                CustomCommand = customCommandText.Text
            };

            return(new SourceIndexer(Params));
        }
Exemplo n.º 3
0
        private object EvalAndReturnExitCode(EvalOptions opts)
        {
            SettingsBean Params = new SettingsBean
            {
                PdbFile   = opts.PdbFile,
                ToolsPath = opts.ToolsPath,
            };

            var    indexer = new SourceIndexer(Params);
            string result  = indexer.EvaluateSourceIndexing();

            Console.Write(result);
            return(0);
        }
Exemplo n.º 4
0
        static public string ReadStream(SettingsBean Parameters, string streamName)
        {
            ProcessStartInfo info = new ProcessStartInfo
            {
                FileName               = string.Format("\"{0}\\pdbstr.exe\"", Parameters.ToolsPath),
                Arguments              = string.Format("-r -p:\"{0}\" -s:{1}", Parameters.PdbFile, streamName),
                UseShellExecute        = false,
                RedirectStandardOutput = true
            };
            Process process = Process.Start(info);
            string  output  = process.StandardOutput.ReadToEnd();

            process.WaitForExit();
            return(output);
        }
Exemplo n.º 5
0
        static public string RunSrcTool(SettingsBean Parameters, string arguments)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                FileName  = string.Format("\"{0}\\srctool.exe\"", Parameters.ToolsPath),
                Arguments = string.Format("\"{0}\" {1}", Parameters.PdbFile, arguments),
                RedirectStandardOutput = true,
                UseShellExecute        = false
            };

            var process = Process.Start(startInfo);
            var output  = process.StandardOutput.ReadToEnd();

            process.WaitForExit();
            return(output);
        }
Exemplo n.º 6
0
        static public void WriteStream(SettingsBean Parameters, string streamName, string streamContents)
        {
            var outFilePath = "SrcSrvOut.txt";

            File.WriteAllText(outFilePath, streamContents);

            ProcessStartInfo info = new ProcessStartInfo
            {
                FileName        = string.Format("\"{0}\\pdbstr.exe\"", Parameters.ToolsPath),
                Arguments       = string.Format("-w -p:\"{0}\" -s:{1} -i:{2}", Parameters.PdbFile, streamName, outFilePath),
                UseShellExecute = false
            };
            Process process = Process.Start(info);

            process.WaitForExit();
        }
Exemplo n.º 7
0
        static public List <SourceFile> GetFileListing(SettingsBean Parameters)
        {
            var output = RunSrcTool(Parameters, "-r");
            var lines  = output.Split('\n');

            // Copy all of the lines out. The last line is a newline and the one before that is a summary hence the -2.
            var results = new List <SourceFile>();

            for (var i = 0; i < lines.Length - 2; ++i)
            {
                var file = new SourceFile()
                {
                    PdbFilePath = lines[i].Trim()
                };
                results.Add(file);
            }
            return(results);
        }
Exemplo n.º 8
0
        public SourceIndexer(SettingsBean Params)
        {
            Parameters = Params;
            LogWriter  = new ConsoleLogger();
            FrontEnd   = new GitFrontEnd();
            if (Parameters.BackEndType == "GIT")
            {
                BackEnd = new GitBackEnd();
            }
            else if (Parameters.BackEndType == "GITHUB")
            {
                BackEnd = new GitHubBackEnd();
            }
            else
            {
                // Default backend
                BackEnd = new CmdBackEnd();
            }

            BackEnd.Parameters = Params;
        }
Exemplo n.º 9
0
 static public string GetUnindexedList(SettingsBean Parameters)
 {
     return(RunSrcTool(Parameters, "-u"));
 }
Exemplo n.º 10
0
 static public string GetSrcSrvResults(SettingsBean Parameters)
 {
     return(RunSrcTool(Parameters, "-n"));
 }
Exemplo n.º 11
0
 public virtual void SetParameters(SettingsBean Params)
 {
     Parameters = Params;
 }
Exemplo n.º 12
0
 public override void SetParameters(SettingsBean Params)
 {
     base.SetParameters(Params);
     FindRepositories(Params.SourcePath);
 }
Exemplo n.º 13
0
 static public void WriteStream(SettingsBean Parameters, string streamContents)
 {
     WriteStream(Parameters, "srcsrv", streamContents);
 }
Exemplo n.º 14
0
 static public string ReadStream(SettingsBean Parameters)
 {
     return(ReadStream(Parameters, "srcsrv"));
 }