Large diffs are not rendered by default.

@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Mattias Westphal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -12,37 +12,63 @@ namespace imageDeCap
{
static class Program
{
public static Form1 mainProgram;
//public static Form1 mainProgram;
//[STAThread]
//static void Main()
//{
//
//
// bool createdNew = true;
// using (Mutex mutex = new Mutex(true, "MyApplicationName", out createdNew))
// {
// if (createdNew)
// {
// Application.EnableVisualStyles();
// Application.SetCompatibleTextRenderingDefault(false);
// Form1 mainProgram = new Form1();
// Application.Run(mainProgram);
// }
// else
// {
// Process current = Process.GetCurrentProcess();
// foreach (Process process in Process.GetProcessesByName(current.ProcessName))
// {
// if (process.Id != current.Id)
// {
// //SetForegroundWindow(process.MainWindowHandle);
// break;
// }
// }
// }
// }
//}
public static bool hotkeysEnabled = true;
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 f1 = new Form1();
f1.FormClosed += QuitLoop;
f1.Show();


bool createdNew = true;
using (Mutex mutex = new Mutex(true, "MyApplicationName", out createdNew))
while (!mQuit)
{
if (createdNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 mainProgram = new Form1();
Application.Run(mainProgram);
}
else
{
Process current = Process.GetCurrentProcess();
foreach (Process process in Process.GetProcessesByName(current.ProcessName))
{
if (process.Id != current.Id)
{
//SetForegroundWindow(process.MainWindowHandle);
break;
}
}
}
}
}

Application.DoEvents();

f1.mainLoop();




System.Threading.Thread.Sleep(10);
}
}
private static bool mQuit;
private static void QuitLoop(object sender, FormClosedEventArgs e)
{
mQuit = true;
}
}
}
@@ -38,14 +38,15 @@ public void recordScreen()
string ClientId = "da05117bbfa9bda";
public void UploadImage(object sender, DoWorkEventArgs e)
{
string image = (string)e.Argument;

string filepath = (string)e.Argument;

WebClient w = new WebClient();
w.Headers.Add("Authorization", "Client-ID " + ClientId);
System.Collections.Specialized.NameValueCollection Keys = new System.Collections.Specialized.NameValueCollection();
try
{
Keys.Add("image", Convert.ToBase64String(File.ReadAllBytes(image)));
Keys.Add("image", Convert.ToBase64String(File.ReadAllBytes(filepath)));
byte[] responseArray = w.UploadValues("https://api.imgur.com/3/image", Keys);
dynamic result = Encoding.ASCII.GetString(responseArray);
Regex reg = new System.Text.RegularExpressions.Regex("link\":\"(.*?)\"");
@@ -63,7 +64,37 @@ public void UploadImage(object sender, DoWorkEventArgs e)
}
}

public void uploadToFTP(object sender, DoWorkEventArgs e)
{
string[] arguments = (string[])e.Argument;
string url = arguments[0];
string username = arguments[1];
string password = arguments[2];
string filepath = arguments[3];
string filename = arguments[4];

// Get the object used to communicate with the server.

FtpWebRequest request = (FtpWebRequest)WebRequest.Create(url + (url.EndsWith("/") ? "" : "/") + filename);
request.Method = WebRequestMethods.Ftp.UploadFile;

// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential(username, password);

// Copy the contents of the file to the request stream.
byte[] fileContents = File.ReadAllBytes(filepath);
request.ContentLength = fileContents.Length;

Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();

FtpWebResponse response = (FtpWebResponse)request.GetResponse();

Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);

response.Close();
}

private string ILoginURL = "http://pastebin.com/api/api_login.php";
private string IPostURL = "http://pastebin.com/api/api_post.php";
@@ -93,14 +124,12 @@ public void Send(object sender, DoWorkEventArgs e)

using (WebClient IClient = new WebClient())
{
bool failed = false;
try
{
IResponse = Encoding.UTF8.GetString(IClient.UploadValues(IPostURL, IQuery));
}
catch(Exception ee)
{
failed = true;
IResponse = "failed, " + ee.Message;
}
}
@@ -152,7 +181,8 @@ public Bitmap Capture(enmScreenCaptureMode screenCaptureMode = enmScreenCaptureM

using (var g = Graphics.FromImage(result))
{
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
g.Clear(Color.Black);
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size, CopyPixelOperation.SourceCopy);
}

return result;

Large diffs are not rendered by default.

@@ -27,7 +27,9 @@ public SettingsWindow(Form1 parentForm)
bool saveImagesAtAll = Properties.Settings.Default.saveImageAtAll;
checkBox1.Checked = saveImagesAtAll;
button2.Enabled = Properties.Settings.Default.saveImageAtAll;

alsoSaveTextFilesBox.Enabled = Properties.Settings.Default.saveImageAtAll;
alsoSaveTextFilesBox.Checked = Properties.Settings.Default.AlsoSaveTextFiles;

textBox1.Text = Properties.Settings.Default.SaveImagesHere;
textBox1.Enabled = checkBox1.Checked;

@@ -36,9 +38,35 @@ public SettingsWindow(Form1 parentForm)
checkBox4.Checked = Properties.Settings.Default.DisableSoundEffects;

checkBox2.Checked = Properties.Settings.Default.UseHTTPS;

checkBox2.Enabled = !Properties.Settings.Default.NeverUpload;
checkBox3.Enabled = !Properties.Settings.Default.NeverUpload;
checkBox5.Enabled = !Properties.Settings.Default.NeverUpload;
textBox2.Enabled = !Properties.Settings.Default.NeverUpload;

neverUpload.Checked = Properties.Settings.Default.NeverUpload;

checkBox5.Checked = Properties.Settings.Default.DisableNotifications;

textBox2.Text = Properties.Settings.Default.PastebinSubjectLine;

checkBox6.Checked = Properties.Settings.Default.FreezeScreenOnRegionShot;

checkBoxUploadToFTP.Checked = Properties.Settings.Default.uploadToFTP;
AlsoFTPTectFilesBox.Enabled = Properties.Settings.Default.uploadToFTP;
AlsoFTPTectFilesBox.Checked = Properties.Settings.Default.AlsoFTPTextFiles;
FTPURL.Enabled = Properties.Settings.Default.uploadToFTP;
FTPUsername.Enabled = Properties.Settings.Default.uploadToFTP;
FTPpassword.Enabled = Properties.Settings.Default.uploadToFTP;


HotkeyTextBox1.Text = Properties.Settings.Default.Hotkey1;
HotkeyTextBox2.Text = Properties.Settings.Default.Hotkey2;
HotkeyTextBox3.Text = Properties.Settings.Default.Hotkey3;
HotkeyTextBox4.Text = Properties.Settings.Default.Hotkey4;

FTPpassword.Text = Properties.Settings.Default.FTPpassword;
FTPURL.Text = Properties.Settings.Default.FTPurl;
FTPUsername.Text = Properties.Settings.Default.FTPusername;

//CHECK IF INSTALLED
isInstalled();
@@ -62,21 +90,21 @@ public bool isInstalled()
if(System.IO.File.Exists(startMenuShortcutPath))
{
installedLabel.Text = "Installed!";
installButton.Enabled = false;
uninstallButton.Enabled = true;
//installButton.Enabled = false;
//uninstallButton.Enabled = true;
installed = true;
button3.Enabled = false;
//button3.Enabled = false;
}
}
}

if (!System.IO.File.Exists(appdataDirectory + @"\imageDeCap.exe") || !System.IO.File.Exists(startupDirectory + @"\imageDeCap.lnk") || !System.IO.File.Exists(startMenuShortcutPath))
{
installedLabel.Text = "Not Installed.";
installButton.Enabled = true;
uninstallButton.Enabled = false;
//installButton.Enabled = true;
//uninstallButton.Enabled = false;
installed = false;
button3.Enabled = true;
//button3.Enabled = true;
}
return installed;
}
@@ -111,7 +139,14 @@ public void Install()
System.IO.File.Copy(System.Reflection.Assembly.GetEntryAssembly().Location, programPath);
CreateShortcut(programPath, shortcutPath);
CreateShortcut(programPath, startMenuShortcutPath);
isInstalled();
if(isInstalled())
{
installButton.Text = "Install and add to startup";
}
else
{
installButton.Text = "Uninstall";
}
}
public void UnInstall()
{
@@ -125,12 +160,30 @@ public void UnInstall()
}
private void installButton_Click(object sender, EventArgs e)
{
Install();
if(isInstalled())
{
UnInstall();
installButton.Text = "Install and add to startup";
Properties.Settings.Default.IsInstalled = false;
Properties.Settings.Default.Save();
}
else
{
Install();
installButton.Text = "Uninstall";
Properties.Settings.Default.IsInstalled = true;
Properties.Settings.Default.Save();
}

//Properties.Settings.Default.IsInstalled = true;
//Properties.Settings.Default.Save();
}

private void uninstallButton_Click(object sender, EventArgs e)
{
UnInstall();
//UnInstall();
//Properties.Settings.Default.IsInstalled = false;
//Properties.Settings.Default.Save();
}

private void button5_Click(object sender, EventArgs e)//Apply
@@ -192,6 +245,7 @@ private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
textBox1.Enabled = checkBox1.Checked;
button2.Enabled = checkBox1.Checked;
alsoSaveTextFilesBox.Enabled = checkBox1.Checked;
Properties.Settings.Default.saveImageAtAll = checkBox1.Checked;
Properties.Settings.Default.Save();
}
@@ -258,9 +312,181 @@ private void textBox2_TextChanged_1(object sender, EventArgs e)
Properties.Settings.Default.Save();
}

private void neverUpload_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.NeverUpload = neverUpload.Checked;
Properties.Settings.Default.Save();
checkBox2.Enabled = !Properties.Settings.Default.NeverUpload;
checkBox3.Enabled = !Properties.Settings.Default.NeverUpload;
checkBox5.Enabled = !Properties.Settings.Default.NeverUpload;
textBox2.Enabled = !Properties.Settings.Default.NeverUpload;
}

private void button3_Click(object sender, EventArgs e)
{
parentForm.actuallyCloseTheProgram();
}

private void checkBox5_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.DisableNotifications = checkBox5.Checked;
Properties.Settings.Default.Save();

}

private void checkBox6_CheckedChanged(object sender, EventArgs e)
{

Properties.Settings.Default.FreezeScreenOnRegionShot = checkBox6.Checked;
Properties.Settings.Default.Save();
}

private void checkBoxUploadToFTP_CheckedChanged(object sender, EventArgs e)
{
AlsoFTPTectFilesBox.Enabled = checkBoxUploadToFTP.Checked;
Properties.Settings.Default.uploadToFTP = checkBoxUploadToFTP.Checked;
Properties.Settings.Default.Save();

AlsoFTPTectFilesBox.Enabled = Properties.Settings.Default.uploadToFTP;
FTPURL.Enabled = Properties.Settings.Default.uploadToFTP;
FTPUsername.Enabled = Properties.Settings.Default.uploadToFTP;
FTPpassword.Enabled = Properties.Settings.Default.uploadToFTP;
}

private void FTPURL_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.FTPurl = FTPURL.Text;
Properties.Settings.Default.Save();
}

private void FTPUsername_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.FTPusername = FTPUsername.Text;
Properties.Settings.Default.Save();
}

private void FTPpassword_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.FTPpassword = FTPpassword.Text;
Properties.Settings.Default.Save();
}

private void alsoSaveTextFilesBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.AlsoSaveTextFiles = alsoSaveTextFilesBox.Checked;
Properties.Settings.Default.Save();
}

private void AlsoFTPTectFilesBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.AlsoFTPTextFiles = AlsoFTPTectFilesBox.Checked;
Properties.Settings.Default.Save();
}

public static string getCurrentHotkey()
{

string textToPutInBox = "";
int length = Enum.GetValues(typeof(System.Windows.Input.Key)).Length;

for (int i = length; i-- > 0;)
{
if(Enum.IsDefined(typeof(System.Windows.Input.Key), i) && i != 0)
{
bool isDown = System.Windows.Input.Keyboard.IsKeyDown((System.Windows.Input.Key)i);
if (isDown)
{
textToPutInBox += ((System.Windows.Input.Key)i).ToString() + "+";
}
}
}
if(textToPutInBox == "")
{
return "";
}
else
{
return textToPutInBox.Remove(textToPutInBox.Length - 1);
}
}

private void HotkeyTextBox1_KeyDown(object sender, KeyEventArgs e)
{
HotkeyTextBox1.Text = getCurrentHotkey();
Properties.Settings.Default.Hotkey1 = HotkeyTextBox1.Text;
Properties.Settings.Default.Save();
}
private void HotkeyTextBox1_GotFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = false;
}
private void HotkeyTextBox1_LostFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = true;
}

private void HotkeyTextBox2_KeyDown(object sender, KeyEventArgs e)
{
HotkeyTextBox2.Text = getCurrentHotkey();
Properties.Settings.Default.Hotkey2 = HotkeyTextBox2.Text;
Properties.Settings.Default.Save();
}
private void HotkeyTextBox2_GotFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = false;
}
private void HotkeyTextBox2_LostFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = true;
}
private void HotkeyTextBox3_KeyDown(object sender, KeyEventArgs e)
{
HotkeyTextBox3.Text = getCurrentHotkey();
Properties.Settings.Default.Hotkey3 = HotkeyTextBox3.Text;
Properties.Settings.Default.Save();
}
private void HotkeyTextBox3_GotFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = false;
}
private void HotkeyTextBox3_LostFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = true;
}

private void HotkeyTextBox4_KeyDown(object sender, KeyEventArgs e)
{
HotkeyTextBox4.Text = getCurrentHotkey();
Properties.Settings.Default.Hotkey4 = HotkeyTextBox4.Text;
Properties.Settings.Default.Save();
}
private void HotkeyTextBox4_GotFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = false;
}
private void HotkeyTextBox4_LostFocus(object sender, EventArgs e)
{
Program.hotkeysEnabled = true;
}

private void HotkeyTextBox1_TextChanged(object sender, EventArgs e)
{

}

private void label4_Click(object sender, EventArgs e)
{

}

private void label3_Click(object sender, EventArgs e)
{

}

private void label7_Click(object sender, EventArgs e)
{

}
}
}
@@ -490,7 +490,4 @@
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -26,5 +26,10 @@ private void label5_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("http://www.mattwestphal.com");
}

private void label1_Click_1(object sender, EventArgs e)
{

}
}
}

Large diffs are not rendered by default.

@@ -18,19 +18,28 @@ public completeCover(Form1 mainProgram)
InitializeComponent();
this.mainProgram = mainProgram;

//ScreenCapturer cap = new ScreenCapturer();
//Bitmap fullSnapshot = cap.Capture(enmScreenCaptureMode.Screen);
//SetBounds(SystemInformation.VirtualScreen.X, SystemInformation.VirtualScreen.Y, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);

if (Properties.Settings.Default.FreezeScreenOnRegionShot)
{
ScreenCapturer cap = new ScreenCapturer();
Bitmap fullSnapshot = cap.Capture(enmScreenCaptureMode.Screen);
pictureBox1.Image = fullSnapshot;
pictureBox1.SetBounds(0, 0, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);
}
else
{
this.Opacity = 0.05;
}

//SetBounds(SystemInformation.VirtualScreen.X, SystemInformation.VirtualScreen.Y, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);

//this.Left = 0;
//this.Top = 0;


//this.Location = new Point(SystemInformation.VirtualScreen.X, SystemInformation.VirtualScreen.Y);
//this.Size = new System.Drawing.Size(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);


//System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
//System.Drawing.Graphics formGraphics;
//formGraphics = this.CreateGraphics();
@@ -67,6 +76,13 @@ private void completeCover_MouseMove(object sender, MouseEventArgs e)
keyPressed = false;
escPressed = false;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{

mainProgram.updateSelectedArea(this, keyPressed, escPressed);
keyPressed = false;
escPressed = false;
}

private void completeCover_KeyDown(object sender, KeyEventArgs e)
{
@@ -78,7 +94,9 @@ private void completeCover_KeyDown(object sender, KeyEventArgs e)
{
//MessageBox.Show("wa! ");
escPressed = true;
//this.Close();
}
}

}
}
@@ -92,6 +92,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
@@ -111,6 +112,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="Zlib.Portable">
<HintPath>..\packages\Zlib.Portable.1.10.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath>
</Reference>
@@ -244,6 +246,7 @@
<ItemGroup>
<Content Include="canvas.png" />
<Content Include="Untitled-2.ico" />
<Content Include="Untitled-2_256x256.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
@@ -0,0 +1,56 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "imageDeCap", "imageDeCap\imageDeCap.csproj", "{ADD5179A-F93E-4947-BB09-0841EC81ADAD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CD_ROM|Any CPU = CD_ROM|Any CPU
CD_ROM|Mixed Platforms = CD_ROM|Mixed Platforms
CD_ROM|x86 = CD_ROM|x86
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
DVD-5|Any CPU = DVD-5|Any CPU
DVD-5|Mixed Platforms = DVD-5|Mixed Platforms
DVD-5|x86 = DVD-5|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
SingleImage|Any CPU = SingleImage|Any CPU
SingleImage|Mixed Platforms = SingleImage|Mixed Platforms
SingleImage|x86 = SingleImage|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.CD_ROM|Mixed Platforms.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.CD_ROM|Mixed Platforms.Build.0 = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.CD_ROM|x86.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Debug|x86.ActiveCfg = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.DVD-5|Mixed Platforms.ActiveCfg = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.DVD-5|Mixed Platforms.Build.0 = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.DVD-5|x86.ActiveCfg = Debug|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Release|Any CPU.Build.0 = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.Release|x86.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.SingleImage|Any CPU.Build.0 = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.SingleImage|Mixed Platforms.ActiveCfg = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.SingleImage|Mixed Platforms.Build.0 = Release|Any CPU
{ADD5179A-F93E-4947-BB09-0841EC81ADAD}.SingleImage|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="imageDeCap.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<imageDeCap.Properties.Settings>
<setting name="SaveImagesHere" serializeAs="String">
<value />
</setting>
<setting name="saveImageAtAll" serializeAs="String">
<value>False</value>
</setting>
<setting name="CopyLinksToClipboard" serializeAs="String">
<value>True</value>
</setting>
<setting name="DisableSoundEffects" serializeAs="String">
<value>False</value>
</setting>
<setting name="EditScreenshotAfterCapture" serializeAs="String">
<value>True</value>
</setting>
<setting name="UseHTTPS" serializeAs="String">
<value>False</value>
</setting>
<setting name="PastebinSubjectLine" serializeAs="String">
<value>"Image DeCap Upload!"</value>
</setting>
</imageDeCap.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.28.0" newVersion="4.2.28.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,96 @@
#region License_Do_Not_Remove
/*
* Made by TheDarkJoker94.
* Check http://thedarkjoker94.cer33.com/ for more C# Tutorials
* and also SUBSCRIBE to my Youtube Channel http://www.youtube.com/user/TheDarkJoker094
* GlobalKeyboardHook is licensed under a Creative Commons Attribution 3.0 Unported License.(http://creativecommons.org/licenses/by/3.0/)
* This means you can use this Code for whatever you want as long as you credit me! That means...
* DO NOT REMOVE THE LINES ABOVE !!!
*/
#endregion
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;

public class GlobalKeyboardHook
{
[DllImport("user32.dll")]
static extern int CallNextHookEx(IntPtr hhk, int code, int wParam, ref keyBoardHookStruct lParam);
[DllImport("user32.dll")]
static extern IntPtr SetWindowsHookEx(int idHook, LLKeyboardHook callback, IntPtr hInstance, uint theardID);
[DllImport("user32.dll")]
static extern bool UnhookWindowsHookEx(IntPtr hInstance);
[DllImport("kernel32.dll")]
static extern IntPtr LoadLibrary(string lpFileName);

public delegate int LLKeyboardHook(int Code, int wParam, ref keyBoardHookStruct lParam);

public struct keyBoardHookStruct
{
public int vkCode;
public int scanCode;
public int flags;
public int time;
public int dwExtraInfo;
}

const int WH_KEYBOARD_LL = 13;
const int WM_KEYDOWN = 0x0100;
const int WM_KEYUP = 0x0101;
const int WM_SYSKEYDOWN = 0x0104;
const int WM_SYSKEYUP = 0x0105;

LLKeyboardHook llkh;
public List<Keys> HookedKeys = new List<Keys>();

IntPtr Hook = IntPtr.Zero;

public event KeyEventHandler KeyDown;
public event KeyEventHandler KeyUp;

// This is the Constructor. This is the code that runs every time you create a new GlobalKeyboardHook object
public GlobalKeyboardHook()
{
llkh = new LLKeyboardHook(HookProc);
// This starts the hook. You can leave this as comment and you have to start it manually (the thing I do in the tutorial, with the button)
// Or delete the comment mark and your hook will start automatically when your program starts (because a new GlobalKeyboardHook object is created)
// That's why there are duplicates, because you start it twice! I'm sorry, I haven't noticed this...
hook();
}
~GlobalKeyboardHook()
{ unhook(); }

public void hook()
{
IntPtr hInstance = LoadLibrary("User32");
Hook = SetWindowsHookEx(WH_KEYBOARD_LL, llkh, hInstance, 0);
}

public void unhook()
{
UnhookWindowsHookEx(Hook);
}

public int HookProc(int Code, int wParam, ref keyBoardHookStruct lParam)
{
if (Code >= 0)
{
Keys key = (Keys)lParam.vkCode;
if (HookedKeys.Contains(key))
{
KeyEventArgs kArg = new KeyEventArgs(key);
if ((wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) && (KeyDown != null))
KeyDown(this, kArg);
else if ((wParam == WM_KEYUP || wParam == WM_SYSKEYUP) && (KeyUp != null))
KeyUp(this, kArg);
if (kArg.Handled)
return 1;
}
}
return CallNextHookEx(Hook, Code, wParam, ref lParam);
}

}

@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace imageDeCap
{
[Flags]
public enum Modifier : int
{
None = 0x0000,
Alt = 0x0001,
Ctrl = 0x0002,
NoRepeat = 0x4000,
Shift = 0x0004,
Win = 0x0008
}

public class HotkeyEventArgs : EventArgs
{
private Modifier _modifier;
private Keys _key;

internal HotkeyEventArgs(Modifier modifier, Keys key)
{
_modifier = modifier;
_key = key;
}

public Modifier Modifier
{
get { return _modifier; }
}

public Keys Key
{
get { return _key; }
}
}

public delegate void HotkeyPressedCb(HotkeyEventArgs args);

class HotkeyCombo
{
public int modifier = 0;
public int key = 0;

public HotkeyCombo()
{
}

public HotkeyCombo(int mmodifier, int kkey)
{
modifier = mmodifier;
key = kkey;
}

public bool Equals(HotkeyCombo rhs)
{
return (modifier == rhs.modifier) && (key == rhs.key);
}

public override bool Equals(object obj)
{
return Equals(obj as HotkeyCombo);
}

public override int GetHashCode()
{
return modifier * 31 + key;
}
}

class Window : NativeWindow, IDisposable
{
private static int WM_HOTKEY = 0x0312;
public Dictionary<HotkeyCombo, HotkeyPressedCb> callbacks = new Dictionary<HotkeyCombo, HotkeyPressedCb>();

public Window()
{
this.CreateHandle(new CreateParams());
}

protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_HOTKEY)
{
// Unpack the key and modifier from the lparam.
Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);
Modifier modifier = (Modifier)((int)m.LParam & 0xFFFF);

// Find and call the delegate hooked to the modifier/key combo.
HotkeyCombo combo = new HotkeyCombo((int)modifier, (int)key);
callbacks[combo](new HotkeyEventArgs(modifier, key));
}
}

public void Dispose()
{
this.DestroyHandle();
}
}

public class Hotkey
{
/* http://msdn.microsoft.com/en-gb/library/windows/desktop/ms646309%28v=vs.85%29.aspx */
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);

/* http://msdn.microsoft.com/en-us/library/windows/desktop/ms646327%28v=vs.85%29.aspx */
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool UnregisterHotKey(IntPtr hWnd, int id);

Window _window = new Window();
int _currentId = 0;
Label lab;
public Hotkey(Label lab)
{
this.lab = lab;
}

public void registerHotkey(Modifier modifier, Keys key, HotkeyPressedCb func)
{
if (func == null)
{
throw new ArgumentNullException("func", "Function pointer is null.");
}

_currentId += 1;
if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key))
{
MessageBox.Show("Couldn't register hotkey " + modifier.ToString() + ", " + key.ToString()+"\nIs it already in use by another program?");
}

_window.callbacks.Add(new HotkeyCombo((int)modifier, (int)key), func);
}

public void Dispose()
{
for (int i = _currentId; i > 0; --i)
{
UnregisterHotKey(_window.Handle, i);
}
_window.Dispose();
}
}
}
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//me
using System.Runtime.InteropServices;
using System.Drawing;
using System.Windows.Forms;

using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

using System.Collections.Specialized;

namespace imageDeCap
{
public class KeyMessageFilter : IMessageFilter
{
private Dictionary<Keys, bool> m_keyTable = new Dictionary<Keys, bool>();

public Dictionary<Keys, bool> KeyTable
{
get { return m_keyTable; }
private set { m_keyTable = value; }
}

public bool IsKeyPressed()
{
return m_keyPressed;
}

public bool IsKeyPressed(Keys k)
{
bool pressed = false;

if (KeyTable.TryGetValue(k, out pressed))
{
return pressed;
}

return false;
}

private const int WM_KEYDOWN = 0x0100;

private const int WM_KEYUP = 0x0101;

private bool m_keyPressed = false;


public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_KEYDOWN)
{
KeyTable[(Keys)m.WParam] = true;

m_keyPressed = true;
}

if (m.Msg == WM_KEYUP)
{
KeyTable[(Keys)m.WParam] = false;

m_keyPressed = false;
}

return false;
}
}
}
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

//Me
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Windows.Input;
using System.Media;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Media;
using System.Diagnostics;
using System.Threading;

namespace imageDeCap
{

public partial class Magnificator : Form
{
List<PictureBox> Boxes = new List<PictureBox>();

public Magnificator()
{
InitializeComponent();
//SetStyle(ControlStyles.SupportsTransparentBackColor, true);

PictureBox wa = new PictureBox();
wa.SetBounds(58, 58, 4, 4);
wa.BackColor = Color.Red;
Boxes.Add(wa);
this.Controls.Add(wa);


wa = new PictureBox();
wa.SetBounds(50, 58, 4, 4);
wa.BackColor = Color.Black;
Boxes.Add(wa);
this.Controls.Add(wa);
wa = new PictureBox();
wa.SetBounds(58, 50, 4, 4);
wa.BackColor = Color.Black;
Boxes.Add(wa);
this.Controls.Add(wa);
wa = new PictureBox();
wa.SetBounds(66, 58, 4, 4);
wa.BackColor = Color.Black;
Boxes.Add(wa);
this.Controls.Add(wa);
wa = new PictureBox();
wa.SetBounds(58, 66, 4, 4);
wa.BackColor = Color.Black;
Boxes.Add(wa);
this.Controls.Add(wa);
this.ShowInTaskbar = false;
}
Graphics g;
Bitmap bmp;
private void timer1_Tick(object sender, EventArgs e)
{
bmp = new Bitmap(32, 32);
g = this.CreateGraphics();
g = Graphics.FromImage(bmp);
g.CopyFromScreen(MousePosition.X - 16, MousePosition.Y - 16, 0, 0, new Size(32, 32));
pictureBoxWithInterpolationMode1.Image = bmp;
foreach(PictureBox FUCK in Boxes)
{
FUCK.BringToFront();
}
}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{

}

private void pictureBoxWithInterpolationMode1_Click(object sender, EventArgs e)
{

}

private void Magnificator_Load(object sender, EventArgs e)
{

this.Activate();
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace imageDeCap
{
public class PictureBoxWithInterpolationMode : PictureBox
{
public InterpolationMode InterpolationMode { get; set; }

protected override void OnPaint(PaintEventArgs paintEventArgs)
{
paintEventArgs.Graphics.InterpolationMode = InterpolationMode;
base.OnPaint(paintEventArgs);
}
}
}
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;

namespace imageDeCap
{
static class Program
{
public static Form1 mainProgram;
[STAThread]
static void Main()
{


bool createdNew = true;
using (Mutex mutex = new Mutex(true, "MyApplicationName", out createdNew))
{
if (createdNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 mainProgram = new Form1();
Application.Run(mainProgram);
}
else
{
Process current = Process.GetCurrentProcess();
foreach (Process process in Process.GetProcessesByName(current.ProcessName))
{
if (process.Id != current.Id)
{
//SetForegroundWindow(process.MainWindowHandle);
break;
}
}
}
}
}


}
}
@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//me
using System.Runtime.InteropServices;
using System.Drawing;
using System.Windows.Forms;

using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

using System.Collections.Specialized;
using System.ComponentModel;

namespace imageDeCap
{
public enum enmScreenCaptureMode
{
Screen,
Window,
Bounds
}

class ScreenCapturer
{
public void recordScreen()
{

// Get instance of the ScreenCapture object
//var screenCapture = Windows.Media.Capture.ScreenCapture.GetForCurrentView();
}

string ClientId = "da05117bbfa9bda";
public void UploadImage(object sender, DoWorkEventArgs e)
{
string image = (string)e.Argument;

WebClient w = new WebClient();
w.Headers.Add("Authorization", "Client-ID " + ClientId);
System.Collections.Specialized.NameValueCollection Keys = new System.Collections.Specialized.NameValueCollection();
try
{
Keys.Add("image", Convert.ToBase64String(File.ReadAllBytes(image)));
byte[] responseArray = w.UploadValues("https://api.imgur.com/3/image", Keys);
dynamic result = Encoding.ASCII.GetString(responseArray);
Regex reg = new System.Text.RegularExpressions.Regex("link\":\"(.*?)\"");
Match match = reg.Match(result);

string url = match.ToString().Replace("link\":\"", "").Replace("\"", "").Replace("\\/", "/");
e.Result = url;
//return url;
}
catch (Exception s)
{
//MessageBox.Show("Something went wrong. " + s.Message);
//return null;
e.Result = "failed, " + s.Message;
}
}



private string ILoginURL = "http://pastebin.com/api/api_login.php";
private string IPostURL = "http://pastebin.com/api/api_post.php";
private string IDevKey = "4d1c2c0bb6fa2e5c1403cedccc50bfd5";
private string IUserKey = null;

public void Send(object sender, DoWorkEventArgs e)
{
string IBody = (string)e.Argument;
string ISubj = Properties.Settings.Default.PastebinSubjectLine;

if (string.IsNullOrEmpty(IBody.Trim())) { e.Result = "failed"; }
if (string.IsNullOrEmpty(ISubj.Trim())) { e.Result = "failed"; }

NameValueCollection IQuery = new NameValueCollection();

IQuery.Add("api_dev_key", IDevKey);
IQuery.Add("api_option", "paste");
IQuery.Add("api_paste_code", IBody);
IQuery.Add("api_paste_private", "0");
IQuery.Add("api_paste_name", ISubj);
IQuery.Add("api_paste_expire_date", "N");
IQuery.Add("api_paste_format", "text");
IQuery.Add("api_user_key", IUserKey);

string IResponse = "";

using (WebClient IClient = new WebClient())
{
bool failed = false;
try
{
IResponse = Encoding.UTF8.GetString(IClient.UploadValues(IPostURL, IQuery));
}
catch(Exception ee)
{
failed = true;
IResponse = "failed, " + ee.Message;
}
}
e.Result = IResponse;
}




[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();

[DllImport("user32.dll")]
private static extern IntPtr GetWindowRect(IntPtr hWnd, ref Rect rect);

[StructLayout(LayoutKind.Sequential)]
private struct Rect
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}

public Bitmap Capture(enmScreenCaptureMode screenCaptureMode = enmScreenCaptureMode.Window, int X = 0, int Y = 0, int Width = 0, int Height = 0)
{
Rectangle bounds;

if (screenCaptureMode == enmScreenCaptureMode.Screen)
{
//bounds = new Rectangle(0, 0, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);
bounds = SystemInformation.VirtualScreen;
CursorPosition = Cursor.Position;
}
else if (screenCaptureMode == enmScreenCaptureMode.Window)
{
var foregroundWindowsHandle = GetForegroundWindow();
var rect = new Rect();
GetWindowRect(foregroundWindowsHandle, ref rect);
bounds = new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
CursorPosition = new Point(Cursor.Position.X - rect.Left, Cursor.Position.Y - rect.Top);
}
else
{
bounds = new Rectangle(X, Y, Width, Height);
}

var result = new Bitmap(bounds.Width, bounds.Height);

using (var g = Graphics.FromImage(result))
{
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
}

return result;
}

public Point CursorPosition
{
get;
protected set;
}
}
}
@@ -0,0 +1,28 @@
namespace imageDeCap.Properties {


// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {

public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}

private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}

private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}