@@ -253,19 +253,21 @@ public void AddButton_Click(object sender, RoutedEventArgs e)
253253 {
254254 if ( SavedAppsPage . CmdBox . Text != "Command Line" )
255255 {
256- App AppToAdd = new App ( ) ;
257- AppToAdd . Cmd = SavedAppsPage . CmdBox . Text ;
258- AppToAdd . Xpos = SavedAppsPage . XBox . Text ;
259- AppToAdd . Ypos = SavedAppsPage . YBox . Text ;
260- AppToAdd . Width = SavedAppsPage . WidthBox . Text ;
261- AppToAdd . Height = SavedAppsPage . HeightBox . Text ;
262- AppToAdd . Flags = SavedAppsPage . FlagBox . Text ;
263- AppToAdd . Name = SavedAppsPage . NameBox . Text ;
264- AppToAdd . Time = SavedAppsPage . TimeBox . Text ;
265- AppToAdd . Lock = SavedAppsPage . LockedCheckBox . IsChecked ?? false ;
266- AppToAdd . Startup = SavedAppsPage . AutostartCheckBox . IsChecked ?? false ;
267- AppToAdd . Fix = SavedAppsPage . FixCheckBox . IsChecked ?? false ;
268- AppToAdd . Pin = SavedAppsPage . PinnedCheckBox . IsChecked ?? false ;
256+ App AppToAdd = new App
257+ {
258+ Cmd = SavedAppsPage . CmdBox . Text ,
259+ Xpos = SavedAppsPage . XBox . Text ,
260+ Ypos = SavedAppsPage . YBox . Text ,
261+ Width = SavedAppsPage . WidthBox . Text ,
262+ Height = SavedAppsPage . HeightBox . Text ,
263+ Flags = SavedAppsPage . FlagBox . Text ,
264+ Name = SavedAppsPage . NameBox . Text ,
265+ Time = SavedAppsPage . TimeBox . Text ,
266+ Lock = SavedAppsPage . LockedCheckBox . IsChecked ?? false ,
267+ Startup = SavedAppsPage . AutostartCheckBox . IsChecked ?? false ,
268+ Fix = SavedAppsPage . FixCheckBox . IsChecked ?? false ,
269+ Pin = SavedAppsPage . PinnedCheckBox . IsChecked ?? false
270+ } ;
269271 JSONArrayList . Add ( AppToAdd ) ;
270272
271273
@@ -363,15 +365,13 @@ public void SaveButton_Click(object sender, RoutedEventArgs e)
363365 {
364366 if ( CurrentAppsPage . HandleListBox . SelectedIndex != - 1 )
365367 {
366- RECT PosTarget ;
367- uint PID ;
368368 string SyllyIsAwesome ;
369369 IntPtr hwnd = IntPtr . Zero ;
370370 hwnd = new IntPtr ( Convert . ToInt32 ( DesktopWindowPropertyList [ Convert . ToInt32 ( CurrentAppsPage . HandleListBox . SelectedItem . ToString ( ) . Substring ( CurrentAppsPage . HandleListBox . SelectedItem . ToString ( ) . Length - 3 ) ) ] [ 2 ] ) ) ;
371371 StringBuilder WindowTitle = new StringBuilder ( 1000 ) ;
372372 StringBuilder FileName = new StringBuilder ( 1000 ) ;
373373 uint size = ( uint ) FileName . Capacity ;
374- GetWindowThreadProcessId ( hwnd , out PID ) ;
374+ GetWindowThreadProcessId ( hwnd , out uint PID ) ;
375375 IntPtr handle = OpenProcess ( 0x1000 , false , PID ) ;
376376 if ( QueryFullProcessImageNameW ( handle , 0 , FileName , ref size ) != 0 )
377377 {
@@ -383,7 +383,7 @@ public void SaveButton_Click(object sender, RoutedEventArgs e)
383383 }
384384 CloseHandle ( handle ) ;
385385
386- GetWindowRect ( hwnd , out PosTarget ) ;
386+ GetWindowRect ( hwnd , out RECT PosTarget ) ;
387387 GetWindowText ( hwnd , WindowTitle , 1000 ) ;
388388 SavedAppsPage . CmdBox . Text = SyllyIsAwesome ;
389389 SavedAppsPage . XBox . Text = PosTarget . Left . ToString ( ) ;
@@ -580,8 +580,7 @@ private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvoke
580580 }
581581 else
582582 {
583- TextBlock ItemContent = args . InvokedItem as TextBlock ;
584- if ( ItemContent != null )
583+ if ( args . InvokedItem is TextBlock ItemContent )
585584 {
586585 switch ( ItemContent . Tag )
587586 {
@@ -758,15 +757,17 @@ public DisplayInfoCollection GetDisplays()
758757 bool success = GetMonitorInfo ( hMonitor , ref mi ) ;
759758 if ( success )
760759 {
761- DisplayInfo di = new DisplayInfo ( ) ;
762- di . ScreenWidth = ( mi . rcMonitor . Right - mi . rcMonitor . Left ) . ToString ( ) ;
763- di . ScreenHeight = ( mi . rcMonitor . Bottom - mi . rcMonitor . Top ) . ToString ( ) ;
764- di . MonitorArea = mi . rcMonitor ;
765- di . WorkArea = mi . rcWork ;
766- di . Availability = mi . dwFlags . ToString ( ) ;
767- di . Handle = hMonitor ;
768- di . Top = mi . rcMonitor . Top ;
769- di . Left = mi . rcMonitor . Left ;
760+ DisplayInfo di = new DisplayInfo
761+ {
762+ ScreenWidth = ( mi . rcMonitor . Right - mi . rcMonitor . Left ) . ToString ( ) ,
763+ ScreenHeight = ( mi . rcMonitor . Bottom - mi . rcMonitor . Top ) . ToString ( ) ,
764+ MonitorArea = mi . rcMonitor ,
765+ WorkArea = mi . rcWork ,
766+ Availability = mi . dwFlags . ToString ( ) ,
767+ Handle = hMonitor ,
768+ Top = mi . rcMonitor . Top ,
769+ Left = mi . rcMonitor . Left
770+ } ;
770771 col . Add ( di ) ;
771772 }
772773 return true ;
@@ -777,10 +778,9 @@ public DisplayInfoCollection GetDisplays()
777778 // Deals with getting a window's size
778779 public static Size GetWindowSize ( IntPtr hWnd )
779780 {
780- RECT pRect ;
781781 Size cSize = new Size ( ) ;
782782 // get coordinates relative to window
783- GetWindowRect ( hWnd , out pRect ) ;
783+ GetWindowRect ( hWnd , out RECT pRect ) ;
784784
785785 cSize . Width = pRect . Right - pRect . Left ;
786786 cSize . Height = pRect . Bottom - pRect . Top ;
@@ -790,8 +790,7 @@ public static Size GetWindowSize(IntPtr hWnd)
790790 // Have a guess what this does you fkn idiot
791791 public static Point GetCursorPosition ( )
792792 {
793- POINT lpPoint ;
794- GetCursorPos ( out lpPoint ) ;
793+ GetCursorPos ( out POINT lpPoint ) ;
795794 return lpPoint ;
796795 }
797796
@@ -820,8 +819,7 @@ public static List<IntPtr> GetChildWindows(IntPtr parent)
820819 private static bool EnumWindow ( IntPtr handle , IntPtr pointer )
821820 {
822821 GCHandle gch = GCHandle . FromIntPtr ( pointer ) ;
823- List < IntPtr > list = gch . Target as List < IntPtr > ;
824- if ( list == null )
822+ if ( ! ( gch . Target is List < IntPtr > list ) )
825823 {
826824 throw new InvalidCastException ( "GCHandle Target could not be cast as List<IntPtr>" ) ;
827825 }
@@ -970,8 +968,7 @@ public void SetWindowSizeAndLock(App i, IntPtr hwnd)
970968 try
971969 {
972970 SetParent ( hwnd , DesktopHandle ) ;
973- RECT PosTarget ;
974- GetWindowRect ( hwnd , out PosTarget ) ;
971+ GetWindowRect ( hwnd , out RECT PosTarget ) ;
975972 if ( i . Xpos == "X" )
976973 {
977974 i . Xpos = PosTarget . Top . ToString ( ) ;
0 commit comments