public static String fileNameFromGeneration(String base, String ext, long gen) {if (gen == -1) {return null;} else if (gen == 0) {return segmentFileName(base, "", ext);} else {assert gen > 0;StringBuilder res = new StringBuilder(base.length() + 6 + ext.length()).append(base).append('_').append(Long.toString(gen, Character.MAX_RADIX));if (ext.length() > 0) {res.append('.').append(ext);}return res.toString();}}
public static string FileNameFromGeneration(string @base, string ext, long gen){if (gen == -1){return null;}else if (gen == 0){return SegmentFileName(@base, "", ext);}else{Debug.Assert(gen > 0);StringBuilder res = (new StringBuilder(@base.Length + 6 + ext.Length)).Append(@base).Append('_').Append(gen.ToString(Character.MaxRadix));if (ext.Length > 0){res.Append('.').Append(ext);}return res.ToString();}}