11using System ;
2+ using System . Diagnostics ;
23using System . IO ;
34using System . Runtime . InteropServices ;
4- using Flow . Launcher . Infrastructure . Hotkey ;
55using Flow . Launcher . Infrastructure . Logger ;
66using Interop . UIAutomationClient ;
77using NHotkey ;
@@ -61,7 +61,10 @@ public static void OnToggleHotkey(object sender, HotkeyEventArgs args)
6161
6262 private static void NavigateDialogPath ( IUIAutomationElement window )
6363 {
64- if ( window is not { CurrentClassName : "#32770" } dialog ) return ;
64+ if ( window is not { CurrentClassName : "#32770" } dialog )
65+ {
66+ return ;
67+ }
6568
6669 object document ;
6770 try
@@ -73,20 +76,35 @@ private static void NavigateDialogPath(IUIAutomationElement window)
7376 return ;
7477 }
7578
76- if ( document is not IShellFolderViewDual2 folder ) return ;
79+ if ( document is not IShellFolderViewDual2 folder )
80+ {
81+ return ;
82+ }
7783
78- var path = folder . Folder . Items ( ) . Item ( ) . Path ;
79- if ( ! Path . IsPathRooted ( path ) ) return ;
84+ string path ;
85+ try
86+ {
87+ path = folder . Folder . Items ( ) . Item ( ) . Path ;
88+ if ( ! Path . IsPathRooted ( path ) )
89+ {
90+ return ;
91+ }
92+ }
93+ catch
94+ {
95+ return ;
96+ }
8097
81- _inputSimulator . Keyboard . ModifiedKeyStroke ( VirtualKeyCode . MENU , VirtualKeyCode . VK_D ) ;
98+ // _inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.VK_D);
8299
83100 var address = dialog . FindFirst ( TreeScope . TreeScope_Subtree , _automation . CreateAndCondition (
84101 _automation . CreatePropertyCondition ( UIA_PropertyIds . UIA_ControlTypePropertyId , UIA_ControlTypeIds . UIA_EditControlTypeId ) ,
85102 _automation . CreatePropertyCondition ( UIA_PropertyIds . UIA_AccessKeyPropertyId , "d" ) ) ) ;
86103
87104 if ( address == null )
88105 {
89- Log . Error ( "Cannot Get specific Control" ) ;
106+ // I found issue here
107+ Debug . WriteLine ( "Failed to find address edit control" ) ;
90108 return ;
91109 }
92110
@@ -145,11 +163,11 @@ uint dwmsEventTime
145163 }
146164
147165 // Release previous reference if exists
148- if ( lastExplorerView != null )
166+ /* if (lastExplorerView != null)
149167 {
150168 Marshal.ReleaseComObject(lastExplorerView);
151169 lastExplorerView = null;
152- }
170+ }*/
153171
154172 lastExplorerView = explorer ;
155173 }
@@ -160,7 +178,7 @@ uint dwmsEventTime
160178 }
161179 finally
162180 {
163- if ( window != null )
181+ /* if (window != null)
164182 {
165183 Marshal.ReleaseComObject(window);
166184 window = null;
@@ -169,7 +187,7 @@ uint dwmsEventTime
169187 {
170188 Marshal.ReleaseComObject(shellWindows);
171189 shellWindows = null;
172- }
190+ }*/
173191 }
174192 }
175193
0 commit comments