cosmetics and amend spelling error in argument
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
SShot/Properties/launchSettings.json
Normal file
8
SShot/Properties/launchSettings.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"SShot": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"commandLineArgs": "-QietErrors"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Visual Studio 2019/Visualizers/attribcache140.bin
Normal file
BIN
Visual Studio 2019/Visualizers/attribcache140.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user