Created
May 6, 2014 00:48
-
-
Save stevenkuhn/036d071c87e912cd3482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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