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

View File

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

Binary file not shown.