public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value == null || Instance == null) { return(null); } string valueString = Convert.ToString(value); if (string.IsNullOrEmpty(valueString)) { return(Instance.RootEditorLayer); } string[] dirs = valueString.Split(Path.AltDirectorySeparatorChar); EditorLayer layer = Instance.RootEditorLayer; for (int i = 1; i < dirs.Length; i++) { layer = layer.FindChild(dirs[i]); if (layer == null) { return(Instance.RootEditorLayer); } } return(layer); }
public EditorLayer Find(string p) { if (p == null) { return(null); } string[] ps = p.Split('\\'); EditorLayer editorLayer = Instance.RootEditorLayer; for (int i = 1; i < ps.Length && editorLayer != null; i++) { string psi = ps[i]; EditorLayer layer = editorLayer.FindChild(psi); if (layer == null) { editorLayer = null; break; } editorLayer = layer; } return(editorLayer); }