@@ -173,16 +173,17 @@ public static bool ReadCommandLineArgs(IList<string> args)
173173 img . datetime = DateTime . Now ;
174174 string d = DateTime . Now . ToString ( p ) ;
175175 img . date = d ;
176- img . anonupload = settings . anonUpload ;
176+ img . Anonupload = settings . anonUpload ;
177177 //if (extension != null && ImageExtensions.Contains(extension.ToLowerInvariant()))
178178 if ( extension != null && ImageFileTypes . SupportedTypes . Contains ( extension . ToLowerInvariant ( ) ) )
179179 {
180- img . uploadsite = settings . imageUploadSite ;
180+ img . Uploadsite = settings . imageUploadSite ;
181181 AddToQueue ( img ) ;
182182 }
183183 else if ( settings . fileUploadSite != UploadSite . None )
184184 {
185- img . uploadsite = settings . fileUploadSite ;
185+ img . IsImage = false ;
186+ img . Uploadsite = settings . fileUploadSite ;
186187 AddToQueue ( img ) ;
187188 }
188189 }
@@ -260,8 +261,7 @@ private async void Upload()
260261 while ( ! queue . IsCompleted )
261262 {
262263 CancelEnabled = false ;
263- XImage currentUpload ;
264- if ( queue . TryTake ( out currentUpload , Timeout . Infinite ) )
264+ if ( queue . TryTake ( out XImage currentUpload , Timeout . Infinite ) )
265265 {
266266 try
267267 {
@@ -278,20 +278,20 @@ private async void Upload()
278278 Tuple < string , string > result = null ;
279279 string response ;
280280 dynamic json ;
281- switch ( currentUpload . uploadsite )
281+ switch ( currentUpload . Uploadsite )
282282 {
283283 case UploadSite . Imgur :
284284 default :
285285 // check if filesize exceeds service limitations
286- if ( CheckFileSizeLimit ( filesize , 10 ) )
286+ if ( CheckFileSizeLimit ( filesize , settings . fileSizeImgur ) )
287287 {
288288 currentUpload . image = null ;
289289 SetStatusBarText ( "File too large. Skipping." ) ;
290290 continue ;
291291 }
292292
293293 // refresh imgur token if using account
294- if ( TokenNeedsRefresh ( UploadSite . Imgur ) && currentUpload . anonupload == false )
294+ if ( TokenNeedsRefresh ( UploadSite . Imgur ) && currentUpload . Anonupload == false )
295295 {
296296 SetStatusBarText ( "Refreshing Imgur login.." ) ;
297297 ChangeTrayIcon ( "R" ) ;
@@ -317,7 +317,7 @@ private async void Upload()
317317 continue ;
318318 }
319319
320- if ( CheckFileSizeLimit ( filesize , 40 ) )
320+ if ( CheckFileSizeLimit ( filesize , settings . fileSizeGyazo ) )
321321 {
322322 currentUpload . image = null ;
323323 SetStatusBarText ( "File too large. Skipping." ) ;
@@ -339,7 +339,7 @@ private async void Upload()
339339 continue ;
340340 }
341341
342- if ( CheckFileSizeLimit ( filesize , 20 ) )
342+ if ( CheckFileSizeLimit ( filesize , settings . fileSizePuush ) )
343343 {
344344 currentUpload . image = null ;
345345 SetStatusBarText ( "File too large. Skipping." ) ;
@@ -348,6 +348,10 @@ private async void Upload()
348348 response = await Uploader . HttpPuushUpload ( currentUpload , cancelUpload . Token ) ;
349349
350350 string [ ] split = response . Split ( ',' ) ;
351+ if ( split . Length < 3 )
352+ {
353+ throw new Exception ( $ "Puush error\r \n { response } ") ;
354+ }
351355 string t = $ "http://puush.me/{ split [ 2 ] } ";
352356
353357 result = new Tuple < string , string > ( split [ 1 ] , t ) ;
@@ -359,7 +363,7 @@ private async void Upload()
359363 MessageBoxResult . None , MessageBoxOptions . DefaultDesktopOnly ) ;
360364 continue ;
361365 }
362- if ( CheckFileSizeLimit ( filesize , 150 ) )
366+ if ( CheckFileSizeLimit ( filesize , settings . fileSizeDropbox ) )
363367 {
364368 currentUpload . image = null ;
365369 SetStatusBarText ( "File too large. Skipping." ) ;
@@ -381,7 +385,7 @@ private async void Upload()
381385 continue ;
382386 }
383387
384- if ( CheckFileSizeLimit ( filesize , 300 ) )
388+ if ( CheckFileSizeLimit ( filesize , settings . fileSizeGDrive ) )
385389 {
386390 currentUpload . image = null ;
387391 SetStatusBarText ( "File too large. Skipping." ) ;
@@ -420,7 +424,8 @@ private async void Upload()
420424 }
421425 uiContext . Post ( x => AddXimageToList ( currentUpload , result . Item1 , result . Item2 ) , null ) ;
422426 ChangeTrayIcon ( "F" ) ;
423- BalloonMessage . ShowMessage ( "Upload complete" , Hardcodet . Wpf . TaskbarNotification . BalloonIcon . Info ) ;
427+ //BalloonMessage.ShowMessage("Upload complete", Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Info);
428+ BalloonMessage . ShowMessage ( "Upload complete" ) ;
424429
425430 if ( queue . Count == 0 )
426431 {
@@ -621,8 +626,7 @@ private void HookMouseAction(bool b)
621626 {
622627 if ( b )
623628 {
624- NativeMethods . POINT p ;
625- NativeMethods . GetCursorPos ( out p ) ;
629+ NativeMethods . GetCursorPos ( out NativeMethods . POINT p ) ;
626630 CapWindowFromPoint ( p . X , p . Y ) ;
627631 }
628632 MouseKeyHook . Unhook ( ) ;
@@ -635,18 +639,18 @@ public void D3DCapPrimaryScreen()
635639 MessageBox . Show ( "DirectX capture requires Windows 8 or higher." , "Fail" , MessageBoxButton . OK , MessageBoxImage . Exclamation ) ;
636640 return ;
637641 }
638-
642+ var title = GetActiveWindowTitle ( ) ;
639643 try
640644 {
641645 if ( ! settings . d3dAllScreens )
642646 {
643647 //DesktopDuplication.DuplicatePrimaryScreen();
644648 //GC.Collect();
645- ImageManager ( DesktopDuplication . DuplicatePrimaryScreen ( ) , "D3DScreenshot" ) ;
649+ ImageManager ( DesktopDuplication . DuplicatePrimaryScreen ( ) , title ) ;
646650 }
647651 else
648652 {
649- ImageManager ( DesktopDuplication . DuplicateAllScreens ( ) , "D3DScreenshot" ) ;
653+ ImageManager ( DesktopDuplication . DuplicateAllScreens ( ) , title ) ;
650654 }
651655 }
652656 catch ( Exception e )
@@ -806,10 +810,10 @@ public async void CapGif()
806810 img . datetime = DateTime . Now ;
807811 string date = DateTime . Now . ToString ( p ) ;
808812 img . date = date ;
809- img . uploadsite = settings . imageUploadSite ;
813+ img . Uploadsite = settings . imageUploadSite ;
810814 if ( settings . gifUpload )
811815 {
812- img . anonupload = settings . anonUpload ;
816+ img . Anonupload = settings . anonUpload ;
813817 AddToQueue ( img ) ;
814818 }
815819 else
@@ -858,7 +862,7 @@ private static string GetActiveWindowTitle()
858862 StringBuilder buff = new StringBuilder ( nChars ) ;
859863 var handle = NativeMethods . GetForegroundWindow ( ) ;
860864
861- return NativeMethods . GetWindowText ( handle , buff , nChars ) > 0 ? buff . ToString ( ) : "null " ;
865+ return NativeMethods . GetWindowText ( handle , buff , nChars ) > 0 ? buff . ToString ( ) : "image " ;
862866 }
863867
864868 // convert image into png encoded byte array
@@ -941,7 +945,7 @@ private void ImageManager(byte[] image, string filename)
941945 filename = $ "{ f } .png",
942946 url = "" ,
943947 filepath = "" ,
944- uploadsite = settings . imageUploadSite
948+ Uploadsite = settings . imageUploadSite
945949 } ;
946950 const string p = "dd.MM.yy HH:mm:ss" ;
947951 x . datetime = DateTime . Now ;
@@ -961,7 +965,7 @@ private void ImageManager(byte[] image, string filename)
961965
962966 if ( settings . autoUpload )
963967 {
964- x . anonupload = settings . anonUpload ;
968+ x . Anonupload = settings . anonUpload ;
965969 AddToQueue ( x ) ;
966970 }
967971 else
@@ -1010,7 +1014,7 @@ private void AddXimageToList(XImage x, string url, string thumbnail)
10101014 }
10111015 }
10121016 }
1013- if ( url . Length > 0 )
1017+ if ( url . Length > 0 && x . IsImage )
10141018 {
10151019 if ( settings . openInBrowser )
10161020 {
@@ -1089,8 +1093,7 @@ public void ReadXML()
10891093
10901094 private static NativeMethods . USERNOTIFICATIONSTATE NotificationState ( )
10911095 {
1092- NativeMethods . USERNOTIFICATIONSTATE state ;
1093- var value = NativeMethods . SHQueryUserNotificationState ( out state ) ;
1096+ var value = NativeMethods . SHQueryUserNotificationState ( out NativeMethods . USERNOTIFICATIONSTATE state ) ;
10941097 return state ;
10951098 }
10961099 }
0 commit comments