private void show_network_root(mFilePanel target_panel) { var nl = new WnetResourceList (0, false, netCommander.WNet.WinApiWNETwrapper.RootNetresource); nl.MainWindow = this; target_panel.Source = nl; nl.Refill(); }
public override void GetChildCollection(int index, ref FileCollectionBase new_collection, ref bool use_new, ref string preferred_focused_text) { if (index == 0) { //return container from wnet try { NETRESOURCE container = WinApiWNETwrapper.GetParentResource(server_ref); WnetResourceList wnet_list = new WnetResourceList(SortCriteria, SortReverse, container); preferred_focused_text = server_ref.lpRemoteName; wnet_list.Refill(); use_new = true; new_collection = wnet_list; } catch (Exception ex) { Messages.ShowException(ex); } return; } //else return DirectoryList try { string target_dir = string.Format ("{0}\\{1}", server_ref.lpRemoteName, internal_list.Keys[index - 1].shi1_netname); DirectoryList dir_list = new DirectoryList(SortCriteria, SortReverse, target_dir); dir_list.Refill(); use_new = true; new_collection = dir_list; } catch (Exception ex) { Messages.ShowException(ex); } return; }
public override void GetChildCollection (int index, ref FileCollectionBase new_collection, ref bool use_new, ref string preferred_focus) { if (!GetItemIsContainer(index)) { use_new = false; return; } //directory to go to.. string target_dir = Path.Combine(directory_path, internal_list.Keys[index].cFileName); target_dir = Path.GetFullPath(target_dir); //case for smb network paths if ((target_dir == directory_path) && (target_dir.StartsWith(@"\\"))) { //go to share list try { netCommander.WNet.NETRESOURCE target_res = netCommander.WNet.WinApiWNETwrapper.GetParentResource (netCommander.WNet.WinApiWNETwrapper.GetResourceInfo(directory_path)); WnetResourceList netsh_list = new WnetResourceList(0, false, target_res); netsh_list.MainWindow = MainWindow; netsh_list.Refill(); new_collection = netsh_list; use_new = true; preferred_focus = directory_path; } catch (Exception ex) { Messages.ShowException(ex); } return; } //preferred focus text if (internal_list.Keys[index].cFileName == "..") { //go up string old_dir = Path.GetFileName(directory_path); preferred_focus = old_dir; } else { //go down - focus on 0 preferred_focus = string.Empty; } //use current DirectoryList use_new = false; //save current directory path //needed if exception occur while filling string dir_old = directory_path; directory_path = target_dir; try { Refill(); } catch (Exception ex) { //directory path not change directory_path = dir_old; Messages.ShowException(ex); } }