cosmetics and amend spelling error in argument

This commit is contained in:
Jorg Tretter
2020-12-11 11:30:46 -06:00
parent 4b5d73494a
commit ca8ffb08f4
3 changed files with 15 additions and 13 deletions

View File

@@ -6,36 +6,30 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SShot
{
static class Program
{
namespace SShot {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
static void Main(string[] args) {
string fileName = DateTime.Now.ToString("u").Replace("Z", ".png").Replace(":", "-");
string dirName = DateTime.Now.ToString("u").Substring(0, 10);
System.IO.Directory.CreateDirectory(dirName);
captureScreen(dirName + "\\" + fileName, args);
}
private static void captureScreen(String filename, string[] args)
{
try
{
private static void captureScreen(String filename, string[] args) {
try {
Rectangle captureRectangle = SystemInformation.VirtualScreen;
Bitmap captureBitmap = new Bitmap(captureRectangle.Width, captureRectangle.Height, PixelFormat.Format32bppArgb);
Graphics captureGraphics = Graphics.FromImage(captureBitmap);
captureGraphics.CopyFromScreen(captureRectangle.Left, captureRectangle.Top, 0, 0, captureRectangle.Size);
captureBitmap.Save(filename, ImageFormat.Png);
}
catch (Exception ex)
{
catch (Exception ex) {
if (args.Length > 0) {
if (args[0] != "-QietErrors") {
if (args[0] != "-QuietErrors") {
MessageBox.Show(ex.Message);
}
}

View File

@@ -0,0 +1,8 @@
{
"profiles": {
"SShot": {
"commandName": "Project",
"commandLineArgs": "-QietErrors"
}
}
}

Binary file not shown.