public static (ejoHelpEntity source, string[] subPath) findeOverrideTargetObject(WebObjectLibrary lib, string fullPath) { string[] points = fullPath.Split(','); ejoHelpEntity ent = null; int skipQty = 2; switch (points[0]) { case nameof(lib.dclAttributes): ent = lib.dclAttributes[points[1]]; break; case nameof(lib.dclTiles): ent = lib.dclTiles[points[1]]; break; case nameof(lib.events): ent = lib.events[points[1]]; break; case nameof(lib.functions): ent = lib.functions[points[1]]; break; case nameof(lib.objects): ent = lib.objects[points[1]]; break; case nameof(lib.ambiguousFunctions): ent = lib.ambiguousFunctions[points[1]][Convert.ToInt32(points[2].Substring(1, 1))]; skipQty = 3; break; } return(ent, points.Skip(skipQty).ToArray()); }
private string ApplyUserFilterGetObjValue(string propTarget, ejoHelpEntity obj) { propTarget = propTarget.getLetters(true); Type t = obj.GetType(); switch (propTarget) { case "ATTRIBUTES": case "DESCRIPTION": case "PLATFORMS": case "SIGNATURE": PropertyInfo basicProp = t.GetProperties().ToList().Find(p => p.Name.ToUpper() == propTarget); return((basicProp != null) ? basicProp.GetValue(obj).ToString().ToUpper() : ""); case "METHODS": case "PROPERTIES": case "VALIDOBJECTS": PropertyInfo arrayProp = t.GetProperties().ToList().Find(p => p.Name.ToUpper() == propTarget); if (arrayProp != null) { return(string.Join(", ", (string[])arrayProp.GetValue(obj)).ToUpper()); } else { return(""); } case "ENUMS": if (obj is ejoAttribute) { return((obj as ejoAttribute).valueType.getUpperCaseSearchString(null)); } else if (obj is ejoFunction) { return(string.Join(", ", (obj as ejoFunction).arguments.Select(a => a.getUpperCaseSearchString(null))) + " " + (obj as ejoFunction).returnType.getUpperCaseSearchString(null)); } else { return(""); } case "IDROOT": return(obj.id.ToUpper()); default: // "SIGNATURERETURN" string result = t.GetProperty("signature") == null ? "" : t.GetProperty("signature").GetValue(obj).ToString().ToUpper() + " "; result += t.GetProperty(nameof(ejoFunction.returnType)) == null ? "" : t.GetProperty(nameof(ejoFunction.returnType)).GetValue(obj).ToString().ToUpper() + " "; result += t.GetProperty(nameof(ejoAttribute.valueType)) == null ? "" : t.GetProperty(nameof(ejoAttribute.valueType)).GetValue(obj).ToString().ToUpper() + " "; return(result.Trim()); } }
private void lbxOverrideRules_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lbxOverrideRules.SelectedItem != null) { OverrideRule rule = (OverrideRule)lbxOverrideRules.SelectedItem; try // neccessary evil so that rules can exist, but don't have to always be functional. This will handle testing of partial exports or potential legacy situations. { ejoHelpEntity obj = OverrideRule.findeOverrideTargetObject(CurrentLib, rule.fullSelectedPath).source; if (obj != null) { wbApplyOverrides.Navigate(urlHelpers.getHelpURL(obj.guid)); } } catch (Exception) { MessageBox.Show("The selected OverrideRule references a path to an object that doesn't exist\n\n" + rule.fullSelectedPath, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void tvApplyOverrides_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (tvApplyOverrides.SelectedItem != null) { ejoHelpEntity tvEntity = null; if (tvApplyOverrides.SelectedItem.GetType().GetProperty("Key") != null && !(tvApplyOverrides.SelectedItem.GetType().GetProperty("Value").GetValue(tvApplyOverrides.SelectedItem) is List <ejoFunction>)) { tvEntity = (ejoHelpEntity)tvApplyOverrides.SelectedItem.GetType().GetProperty("Value").GetValue(tvApplyOverrides.SelectedItem); } else if (tvApplyOverrides.SelectedItem.GetType().Name.StartsWith("ejo") == true) { tvEntity = (ejoHelpEntity)tvApplyOverrides.SelectedItem; } if (tvEntity != null) { wbApplyOverrides.Navigate(urlHelpers.getHelpURL(tvEntity.guid)); } } }