java: public String getHumanishName() throws IllegalArgumentException {String s = getPath();if ("/".equals(s) || "".equals(s)) s = getHost();if (s == null) throw new IllegalArgumentException();String[] elements;if ("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) elements = s.split("[\\" + File.separatorChar + "/]"); elseelements = s.split("/+"); if (elements.length == 0)throw new IllegalArgumentException();String result = elements[elements.length - 1];if (Constants.DOT_GIT.equals(result))result = elements[elements.length - 2];else if (result.endsWith(Constants.DOT_GIT_EXT))result = result.substring(0, result.length()- Constants.DOT_GIT_EXT.length());return result;}
C#: public virtual string GetHumanishName(){if (string.Empty.Equals(GetPath()) || GetPath() == null){throw new ArgumentException();}string s = GetPath();string[] elements;if ("file".Equals(scheme) || LOCAL_FILE.Matcher(s).Matches()){elements = s.Split("[\\" + FilePath.separatorChar + "/]");}else{elements = s.Split("/");}if (elements.Length == 0){throw new ArgumentException();}string result = elements[elements.Length - 1];if (Constants.DOT_GIT.Equals(result)){result = elements[elements.Length - 2];}else{if (result.EndsWith(Constants.DOT_GIT_EXT)){result = Sharpen.Runtime.Substring(result, 0, result.Length - Constants.DOT_GIT_EXT.Length);}}return result;}