Skip to content

Instantly share code, notes, and snippets.

@stevenkuhn
Created May 6, 2014 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenkuhn/036d071c87e912cd3482 to your computer and use it in GitHub Desktop.
Save stevenkuhn/036d071c87e912cd3482 to your computer and use it in GitHub Desktop.
public class LocalFileStoreProvider : IFileStoreProvider
{
public bool SaveScreenshot(FluentSettings settings, byte[] contents, string fileName)
{
try
{
if (!string.IsNullOrEmpty(settings.ScreenshotPrefix))
{
fileName = Path.Combine(
Path.GetDirectoryName(fileName),
settings.ScreenshotPrefix + Path.GetFileName(fileName));
}
if (fileName.Substring(0, fileName.Length - 4) != ".png")
fileName += ".png";
File.WriteAllBytes(Path.Combine(settings.ScreenshotPath, fileName), contents);
return true;
}
catch (Exception)
{
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment