Skip to content
This repository was archived by the owner on Jul 18, 2020. It is now read-only.

Commit 8baf42e

Browse files
committed
R: Huge improvements in performance and file size, and new GIF Recorder!
1 parent 3a3a63f commit 8baf42e

File tree

11 files changed

+54
-213
lines changed

11 files changed

+54
-213
lines changed

Downloads/ImgurSniper.zip

-5.49 MB
Binary file not shown.

Downloads/ImgurSniperSetup.zip

-977 KB
Binary file not shown.

ImgurSniper.UI/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
5454

55-
[assembly: AssemblyVersion("1.0.7.3")]
56-
[assembly: AssemblyFileVersion("1.0.7.3")]
55+
[assembly: AssemblyVersion("1.0.7.6")]
56+
[assembly: AssemblyFileVersion("1.0.7.6")]

ImgurSniper/EntryWindow.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ namespace ImgurSniper {
66
/// <summary>
77
/// Interaction logic for EntryWindow.xaml
88
/// </summary>
9-
public partial class EntryWindow : Window {
9+
public partial class EntryWindow {
1010
public EntryWindow() {
11+
Hide();
12+
1113
StartWithArguments();
1214
}
1315

ImgurSniper/ImgurSniper.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
<Compile Include="Libraries\Native\NativeMethods.cs" />
150150
<Compile Include="Libraries\Native\NativeStructs.cs" />
151151
<Compile Include="Libraries\ScreenCapture\ScreencastOptions.cs" />
152-
<Compile Include="Libraries\ScreenCapture\Screenshot.cs" />
153152
<Compile Include="Libraries\Start\StartUpload.cs" />
154153
<Compile Include="NotificationWindow.xaml.cs">
155154
<DependentUpon>NotificationWindow.xaml</DependentUpon>

ImgurSniper/Libraries/Helper/Animations.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,5 @@ internal static DoubleAnimation FadeIn {
2626
return anim;
2727
}
2828
}
29-
30-
public static DoubleAnimation GetBrightenAnimation(double opacity) {
31-
return new DoubleAnimation {
32-
To = 1,
33-
From = opacity,
34-
Duration = TimeSpan.FromMilliseconds(300)
35-
};
36-
}
37-
38-
public static DoubleAnimation GetDarkenAnimation(double opacity) {
39-
return new DoubleAnimation {
40-
To = 0.5,
41-
From = opacity,
42-
Duration = TimeSpan.FromMilliseconds(200)
43-
};
44-
}
4529
}
4630
}

ImgurSniper/Libraries/Native/NativeMethods.cs

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Drawing;
44
using System.Runtime.InteropServices;
55
using System.Text;
6-
using System.Windows.Forms;
76
using static ImgurSniper.Libraries.Helper.CaptureHelpers;
87
using static ImgurSniper.Libraries.Native.NativeStructs;
98

@@ -52,8 +51,6 @@ public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out
5251
[DllImport("user32.dll")]
5352
public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
5453
[DllImport("user32.dll")]
55-
public static extern IntPtr GetForegroundWindow();
56-
[DllImport("user32.dll")]
5754
public static extern IntPtr FindWindowEx(IntPtr parentHwnd, IntPtr childAfterHwnd, IntPtr className, string windowText);
5855
[DllImport("user32.dll")]
5956
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
@@ -151,8 +148,6 @@ private static int IntPtrToInt32(IntPtr intPtr) {
151148
return unchecked((int)intPtr.ToInt64());
152149
}
153150

154-
public static Rectangle GetScreenBounds() => SystemInformation.VirtualScreen;
155-
156151
public static Point ScreenToClient(Point p) {
157152
int screenX = GetSystemMetrics(SystemMetric.SmXvirtualscreen);
158153
int screenY = GetSystemMetrics(SystemMetric.SmYvirtualscreen);
@@ -177,8 +172,7 @@ public static Rectangle GetWindowRect(IntPtr handle) {
177172
}
178173

179174
public static bool GetExtendedFrameBounds(IntPtr handle, out Rectangle rectangle) {
180-
int result = DwmGetWindowAttribute(handle, (int)DwmWindowAttribute.ExtendedFrameBounds, out RECT rect,
181-
Marshal.SizeOf(typeof(RECT)));
175+
int result = DwmGetWindowAttribute(handle, (int)DwmWindowAttribute.ExtendedFrameBounds, out RECT rect, Marshal.SizeOf(typeof(RECT)));
182176
rectangle = rect;
183177
return result == 0;
184178
}
@@ -222,84 +216,7 @@ public static bool GetBorderSize(IntPtr handle, out Size size) {
222216
return result;
223217
}
224218

225-
public static Rectangle GetClientRect(IntPtr handle) {
226-
GetClientRect(handle, out RECT rect);
227-
Point position = rect.Location;
228-
ClientToScreen(handle, ref position);
229-
return new Rectangle(position, rect.Size);
230-
}
231-
232-
public static bool SetTaskbarVisibilityIfIntersect(bool visible, Rectangle rect) {
233-
bool result = false;
234-
235-
IntPtr taskbarHandle = FindWindow("Shell_TrayWnd", null);
236-
237-
if (taskbarHandle != IntPtr.Zero) {
238-
Rectangle taskbarRect = GetWindowRect(taskbarHandle);
239-
240-
if (rect.IntersectsWith(taskbarRect)) {
241-
ShowWindow(taskbarHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide);
242-
result = true;
243-
}
244-
245-
if (IsWindowsVista() || IsWindows7()) {
246-
IntPtr startHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null);
247-
248-
if (startHandle != IntPtr.Zero) {
249-
Rectangle startRect = GetWindowRect(startHandle);
250-
251-
if (rect.IntersectsWith(startRect)) {
252-
ShowWindow(startHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide);
253-
result = true;
254-
}
255-
}
256-
}
257-
}
258-
259-
return result;
260-
}
261-
262-
public static bool SetTaskbarVisibility(bool visible) {
263-
IntPtr taskbarHandle = FindWindow("Shell_TrayWnd", null);
264-
265-
if (taskbarHandle != IntPtr.Zero) {
266-
ShowWindow(taskbarHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide);
267-
268-
if (IsWindowsVista() || IsWindows7()) {
269-
IntPtr startHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null);
270-
271-
if (startHandle != IntPtr.Zero) {
272-
ShowWindow(startHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide);
273-
}
274-
}
275-
276-
return true;
277-
}
278-
279-
return false;
280-
}
281-
282-
public static Rectangle GetActiveScreenBounds() {
283-
return Screen.FromPoint(GetCursorPosition()).Bounds;
284-
}
285-
286219
#region Custom Definitions
287-
public enum WindowShowStyle : uint {
288-
Hide = 0,
289-
ShowNormal = 1,
290-
ShowMinimized = 2,
291-
ShowMaximized = 3,
292-
Maximize = 3,
293-
ShowNormalNoActivate = 4,
294-
Show = 5,
295-
Minimize = 6,
296-
ShowMinNoActivate = 7,
297-
ShowNoActivate = 8,
298-
Restore = 9,
299-
ShowDefault = 10,
300-
ForceMinimized = 11
301-
}
302-
303220
[StructLayout(LayoutKind.Sequential)]
304221
public struct WindowInfo {
305222
public uint cbSize;

ImgurSniper/Libraries/ScreenCapture/Screenshot.cs

Lines changed: 0 additions & 69 deletions
This file was deleted.

ImgurSniper/Libraries/Start/StartTray.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,25 @@ public static async Task Initialize() {
114114
}
115115

116116
private static void OpenFromShortcutGif(HotKey obj = null) {
117-
new GifWindow().ShowDialog();
117+
if (obj != null)
118+
obj.HotKeyPressed -= OpenFromShortcutGif;
119+
120+
using (GifWindow window = new GifWindow()) {
121+
window.ShowDialog();
122+
}
123+
124+
if (obj != null)
125+
obj.HotKeyPressed += OpenFromShortcutGif;
118126
}
119127

120128
private static void OpenFromShortcutImg(HotKey obj = null) {
129+
if (obj != null)
130+
obj.HotKeyPressed += OpenFromShortcutImg;
131+
121132
new ScreenshotWindow().ShowDialog();
133+
134+
if (obj != null)
135+
obj.HotKeyPressed += OpenFromShortcutImg;
122136
}
123137
}
124138
}

ImgurSniper/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
5454

55-
[assembly: AssemblyVersion("1.0.7.3")]
56-
[assembly: AssemblyFileVersion("1.0.7.3")]
55+
[assembly: AssemblyVersion("1.0.7.6")]
56+
[assembly: AssemblyFileVersion("1.0.7.6")]

0 commit comments

Comments
 (0)