public static string GenerateOutPutPath(this string str, XFileType destinationType, string extraText = null) { var name = Path.GetFileNameWithoutExtension(str); var extension = Path.GetExtension(str); str = str.Replace(extension, destinationType.GetExtensionType()); return(str.Replace(name, $"{name}[{extraText ?? string.Empty}]_out")); }
public static string GenerateGuidPath(this string path, XFileType dst, string extraText = null) { //Guid g = Guid.NewGuid(); //string GuidString = System.Convert.ToBase64String(g.ToByteArray()); //GuidString = GuidString.Replace("=", ""); //GuidString = GuidString.Replace("+", ""); string GuidString = (new Random()).Next(1000000).ToString(); var dir = Path.GetDirectoryName(path); var file = $"{GuidString} [{extraText ?? string.Empty}]{dst.GetExtensionType()}"; return(Path.Combine(dir, file)); }
public static string ReplaceExtension(this string str, XFileType destinatinFileType) { var ext = Path.GetExtension(str); return(str.Replace(Path.GetExtension(str), destinatinFileType.GetExtensionType())); }