コード例 #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);
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
ファイル: SrcTool.cs プロジェクト: KocourKuba/SourceIndexer
        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);
        }
コード例 #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();
        }
コード例 #7
0
ファイル: SrcTool.cs プロジェクト: KocourKuba/SourceIndexer
        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);
        }
コード例 #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;
        }
コード例 #9
0
ファイル: SrcTool.cs プロジェクト: KocourKuba/SourceIndexer
 static public string GetUnindexedList(SettingsBean Parameters)
 {
     return(RunSrcTool(Parameters, "-u"));
 }
コード例 #10
0
ファイル: SrcTool.cs プロジェクト: KocourKuba/SourceIndexer
 static public string GetSrcSrvResults(SettingsBean Parameters)
 {
     return(RunSrcTool(Parameters, "-n"));
 }
コード例 #11
0
 public virtual void SetParameters(SettingsBean Params)
 {
     Parameters = Params;
 }
コード例 #12
0
 public override void SetParameters(SettingsBean Params)
 {
     base.SetParameters(Params);
     FindRepositories(Params.SourcePath);
 }
コード例 #13
0
 static public void WriteStream(SettingsBean Parameters, string streamContents)
 {
     WriteStream(Parameters, "srcsrv", streamContents);
 }
コード例 #14
0
 static public string ReadStream(SettingsBean Parameters)
 {
     return(ReadStream(Parameters, "srcsrv"));
 }