| @@ -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. |
| @@ -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> |
| @@ -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. | ||
| } | ||
| } | ||
| } |