} // Render /// <summary> /// Creates a filename for writing the user poster to the HttpResponse (i.e. the filename the user will see /// when prompted to download their poster). /// </summary> /// <param name="outputFilename">Start of the filename, e.g. "my-toepoke-poster"</param> /// <param name="outputFormat">The output format to be used, e.g. "jpeg" or "png"</param> /// <param name="avoidCaching"> /// If true a hash is appended to the filename to reduce the chances of poster being cached /// (so if the user makes another poster they will get a fresh version rather than a cached version) /// If false no hash is appended. /// </param> /// <returns>The build filename</returns> /// <remarks> /// You most probably want <paramref name="avoidCaching"/> to be true, otherwise the user will continually /// download the same poster, no matter how many changes they make. /// </remarks> public string BuildFilename(string outputFilename, ImgFormat.SupportedTypes outputFormat, bool avoidCaching = true) { string filename = outputFilename; string ext = ImgFormat.ToFileExtension(outputFormat); // add the correct file extension (to ensure the correct application opens the file on the Client's browser) filename = System.IO.Path.Combine(outputFilename, ext); return filename; } // BuildFilename
/// <summary> /// Creates a filename for writing the user poster to the HttpResponse (i.e. the filename the user will see /// when prompted to download their poster). /// </summary> /// <param name="outputFilename">Start of the filename, e.g. "my-toepoke-poster"</param> /// <param name="outputFormat">The output format to be used, e.g. "jpeg" or "png"</param> /// <param name="avoidCaching"> /// If true a hash is appended to the filename to reduce the chances of poster being cached /// (so if the user makes another poster they will get a fresh version rather than a cached version) /// If false no hash is appended. /// </param> /// <returns>The build filename</returns> /// <remarks> /// You most probably want <paramref name="avoidCaching"/> to be true, otherwise the user will continually /// download the same poster, no matter how many changes they make. /// </remarks> public string BuildFilename(string outputFilename, ImgFormat.SupportedTypes outputFormat, bool avoidCaching = true) { string filename = outputFilename; string ext = ImgFormat.ToFileExtension(outputFormat); // add the correct file extension (to ensure the correct application opens the file on the Client's browser) filename = System.IO.Path.Combine(outputFilename, ext); return filename; }