From 31a511a09ca1f0441f587d59ef53511ff74ec121 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Thu, 10 Dec 2020 10:22:36 -0600 Subject: [PATCH] Initial Checkin --- .gitignore | 4 ++++ SShot.sln | 25 +++++++++++++++++++++++++ SShot/Program.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ SShot/SShot.csproj | 9 +++++++++ SShot/triggerSS.cmd | 5 +++++ 5 files changed, 85 insertions(+) create mode 100644 .gitignore create mode 100644 SShot.sln create mode 100644 SShot/Program.cs create mode 100644 SShot/SShot.csproj create mode 100644 SShot/triggerSS.cmd diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cebcbc0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.user +/SShot/bin +/SShot/obj +/.vs diff --git a/SShot.sln b/SShot.sln new file mode 100644 index 0000000..7673d47 --- /dev/null +++ b/SShot.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30503.244 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SShot", "SShot\SShot.csproj", "{6D8C0C2D-6BD5-4FA0-9FEB-A23D62DEF5C9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6D8C0C2D-6BD5-4FA0-9FEB-A23D62DEF5C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D8C0C2D-6BD5-4FA0-9FEB-A23D62DEF5C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D8C0C2D-6BD5-4FA0-9FEB-A23D62DEF5C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D8C0C2D-6BD5-4FA0-9FEB-A23D62DEF5C9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3B34ACF9-C926-431A-B5AF-16FCDA92C2AB} + EndGlobalSection +EndGlobal diff --git a/SShot/Program.cs b/SShot/Program.cs new file mode 100644 index 0000000..1d27274 --- /dev/null +++ b/SShot/Program.cs @@ -0,0 +1,42 @@ +using System.Drawing; +using System.Drawing.Imaging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SShot +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + 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); + } + + private static void captureScreen(String filename) + { + 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) + { + MessageBox.Show(ex.Message); + } + } + + } +} diff --git a/SShot/SShot.csproj b/SShot/SShot.csproj new file mode 100644 index 0000000..7b05c62 --- /dev/null +++ b/SShot/SShot.csproj @@ -0,0 +1,9 @@ + + + + WinExe + netcoreapp3.1 + true + + + \ No newline at end of file diff --git a/SShot/triggerSS.cmd b/SShot/triggerSS.cmd new file mode 100644 index 0000000..ac563a5 --- /dev/null +++ b/SShot/triggerSS.cmd @@ -0,0 +1,5 @@ +SET ProgDir="%~dp0" +set YearMonth="%date:~-4%-%date:~4,2%-%date:~7,2%" +md .\%YearMonth% +cd .\%YearMonth% +%ProgDir%\sshot.exe