/// <summary> /// Generates unique file name with specified extensions. /// </summary> public static string GetUniqueFileName(this string?initialFileName) { var fileExtension = initialFileName?.Split('.').LastOrDefault(); var fileName = $"{DateTime.UtcNow:yyyyMMddHHmmss}_{XXHasher.GenerateStringHash()}"; if (!String.IsNullOrEmpty(fileExtension)) { fileName = fileName + "." + fileExtension; } return(fileName); }
public static string Generate(string prefix, string text) { return($"{prefix}_{XXHasher.ComputeStringHash(text)}".ToLower()); }