public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode) { Highlighter.Stop(); Highlighter.active = true; if (!Highlighter.SetWindow(windowTitle)) { Debug.LogWarning("Window " + windowTitle + " not found."); return(false); } Highlighter.activeText = text; Highlighter.s_SearchMode = mode; Highlighter.s_LastTime = Time.realtimeSinceStartup; bool flag = Highlighter.Search(); if (flag) { EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(Highlighter.Update)); EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(Highlighter.Update)); } else { Debug.LogWarning(string.Concat(new string[] { "Item ", text, " not found in window ", windowTitle, "." })); Highlighter.Stop(); } InternalEditorUtility.RepaintAllViews(); return(flag); }
public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode) { bool flag = false; if (Highlighter.s_RecursionLock || Highlighter.searching) { Debug.LogWarning("Highlighter recursion detected. You are calling Highlighter.Highlight() with too much abandon. Avoid highlighting during layout and repaint events."); } else if (Event.current != null && Event.current.type == EventType.Layout) { Debug.LogWarning("You are calling Highlighter.Highlight() inorrectly. Avoid highlighting during layout and repaint events."); } else { Highlighter.s_RecursionLock = true; Highlighter.Stop(); if (!Highlighter.SetWindow(windowTitle)) { Debug.LogWarning("Window " + windowTitle + " not found."); } else if (mode != HighlightSearchMode.None) { Highlighter.active = true; Highlighter.activeText = text; Highlighter.s_SearchMode = mode; Highlighter.s_LastTime = Time.realtimeSinceStartup; flag = Highlighter.Search(); if (flag) { Delegate arg_D8_0 = EditorApplication.update; if (Highlighter.< > f__mg$cache0 == null) { Highlighter.< > f__mg$cache0 = new EditorApplication.CallbackFunction(Highlighter.Update); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_D8_0, Highlighter.< > f__mg$cache0); Delegate arg_109_0 = EditorApplication.update; if (Highlighter.< > f__mg$cache1 == null) { Highlighter.< > f__mg$cache1 = new EditorApplication.CallbackFunction(Highlighter.Update); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(arg_109_0, Highlighter.< > f__mg$cache1); } else { Debug.LogWarning(string.Concat(new string[] { "Item ", text, " not found in window ", windowTitle, "." })); Highlighter.Stop(); } InternalEditorUtility.RepaintAllViews(); } Highlighter.s_RecursionLock = false; } return(flag); }
/// <summary> /// <para>Highlights an element in the editor.</para> /// </summary> /// <param name="windowTitle">The title of the window the element is inside.</param> /// <param name="text">The text to identify the element with.</param> /// <param name="mode">Optional mode to specify how to search for the element.</param> /// <returns> /// <para>true if the requested element was found; otherwise false.</para> /// </returns> public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode) { Highlighter.Stop(); Highlighter.active = true; if (!Highlighter.SetWindow(windowTitle)) { Debug.LogWarning((object)("Window " + windowTitle + " not found.")); return(false); } Highlighter.activeText = text; Highlighter.s_SearchMode = mode; Highlighter.s_LastTime = Time.realtimeSinceStartup; bool flag = Highlighter.Search(); if (flag) { EditorApplication.update -= new EditorApplication.CallbackFunction(Highlighter.Update); EditorApplication.update += new EditorApplication.CallbackFunction(Highlighter.Update); } else { Debug.LogWarning((object)("Item " + text + " not found in window " + windowTitle + ".")); Highlighter.Stop(); } InternalEditorUtility.RepaintAllViews(); return(flag); }
public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode) { Highlighter.Stop(); Highlighter.active = true; bool result; if (!Highlighter.SetWindow(windowTitle)) { Debug.LogWarning("Window " + windowTitle + " not found."); result = false; } else { Highlighter.activeText = text; Highlighter.s_SearchMode = mode; Highlighter.s_LastTime = Time.realtimeSinceStartup; bool flag = Highlighter.Search(); if (flag) { Delegate arg_79_0 = EditorApplication.update; if (Highlighter.< > f__mg$cache0 == null) { Highlighter.< > f__mg$cache0 = new EditorApplication.CallbackFunction(Highlighter.Update); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_79_0, Highlighter.< > f__mg$cache0); Delegate arg_AA_0 = EditorApplication.update; if (Highlighter.< > f__mg$cache1 == null) { Highlighter.< > f__mg$cache1 = new EditorApplication.CallbackFunction(Highlighter.Update); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(arg_AA_0, Highlighter.< > f__mg$cache1); } else { Debug.LogWarning(string.Concat(new string[] { "Item ", text, " not found in window ", windowTitle, "." })); Highlighter.Stop(); } InternalEditorUtility.RepaintAllViews(); result = flag; } return(result); }