예제 #1
0
        void OnStderr(object sender, System.Diagnostics.DataReceivedEventArgs e)
        {
            var data = e.Data;

            if (string.IsNullOrEmpty(data) || data.StartsWith("No files were searched"))
            {
                return;
            }
            ReferenceSearchEngine.Log(data);
        }
예제 #2
0
        void OnEnable()
        {
            titleContent.text = "References";

            objectList            = new ScrollableObjectList();
            objectList.OnPostDraw = OnPostDrawResultItem;
            beforeTarget          = null;
            if (engine != null)
            {
                engine.Cancel();
            }
            var root = Path.GetFullPath(Application.dataPath + "/..");

            engine = new ReferenceSearchEngine(root);

            ReferenceSearchEngine.Tracer  = s => Debug.Log(s);
            AssetDependencyDatabase.Trace = s => Debug.Log(s);

            AssetDependencyDatabase.StartFullScanWorker();
        }
예제 #3
0
        internal void StartProcess()
        {
            process = new System.Diagnostics.Process();
            process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            process.StartInfo.StandardErrorEncoding  = Encoding.UTF8;
            process.StartInfo.FileName               = ReferenceSearchEngine.RipGrepPath;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.RedirectStandardInput  = false;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
            var args = Argument;

            if (IgnoreDirectory != null)
            {
                args += string.Format(" -g {0} ", ReferenceSearchEngine.Quote("!" + IgnoreDirectory));
            }
            if (TargetGUIDs.Count == 1)
            {
                args += TargetGUIDs[0];
            }
            else
            {
                args += ReferenceSearchEngine.Quote(string.Join("|", TargetGUIDs.ToArray()));
            }
            args += string.Format(" {0}", ReferenceSearchEngine.Quote(SearchDirectory));
            // ReferenceSearchEngine.Log(args);
            process.StartInfo.Arguments = args;
            // process.EnableRaisingEvents = true;
            // process.OutputDataReceived += OnStdout;
            process.ErrorDataReceived += OnStderr;

            process.Start();
            // process.BeginOutputReadLine();
            process.BeginErrorReadLine();
        }