/// <summary> /// Determines if the name trimmer is relevant for the given type. /// </summary> /// <param name="trimmable">The type to check.</param> /// <returns>true if the name trimmer is relevant; otherwise, false.</returns> public bool IsRelevant([NotNull] INamedExtensionScopedEntity trimmable) { if (trimmable.Extension is null) { return(false); } return(trimmable.Name.EndsWith(trimmable.Extension)); }
private static (FunctionSignature, StringBuilder) Cast( FunctionSignature function, INamedExtensionScopedEntity oldFunction) { var sb = new StringBuilder(); sb.Append("return (IntPtr) " + oldFunction.Name + "("); sb.Append(string.Join(", ", function.Parameters.Select(x => ConvertName(x.Name)))); sb.AppendLine(");"); return(function, sb); }
public string Trim([NotNull] INamedExtensionScopedEntity trimmable) { if (trimmable.Extension is null) { throw new ArgumentException("Cannot trim a null extension.", nameof(trimmable.Extension)); } var extensionNameIndex = trimmable.Name.LastIndexOf(trimmable.Extension, StringComparison.Ordinal); return(trimmable.Name.Remove(extensionNameIndex)); }
/// <summary> /// Determines if the name trimmer is relevant for the given type. /// </summary> /// <param name="trimmable">The type to check.</param> /// <returns>true if the name trimmer is relevant; otherwise, false.</returns> public static bool IsRelevant([NotNull] INamedExtensionScopedEntity trimmable) { return(!(trimmable.Extension is null) && trimmable.Name.EndsWith(trimmable.Extension)); }