@@ -697,117 +697,6 @@ private static string NormalizePathInput(string currentInput, bool isFtp)
697
697
return currentInput ;
698
698
}
699
699
700
- [ Obsolete ( "Superseded by Omnibar." ) ]
701
- public async Task CheckPathInputAsync ( string currentInput , string currentSelectedPath , IShellPage shellPage )
702
- {
703
- if ( currentInput . StartsWith ( '>' ) )
704
- {
705
- var code = currentInput . Substring ( 1 ) . Trim ( ) ;
706
- var command = Commands [ code ] ;
707
-
708
- if ( command == Commands . None )
709
- await DialogDisplayHelper . ShowDialogAsync ( Strings . InvalidCommand . GetLocalizedResource ( ) ,
710
- string . Format ( Strings . InvalidCommandContent . GetLocalizedResource ( ) , code ) ) ;
711
- else if ( ! command . IsExecutable )
712
- await DialogDisplayHelper . ShowDialogAsync ( Strings . CommandNotExecutable . GetLocalizedResource ( ) ,
713
- string . Format ( Strings . CommandNotExecutableContent . GetLocalizedResource ( ) , command . Code ) ) ;
714
- else
715
- await command . ExecuteAsync ( ) ;
716
-
717
- return ;
718
- }
719
-
720
- var isFtp = FtpHelpers . IsFtpPath ( currentInput ) ;
721
-
722
- var normalizedInput = NormalizePathInput ( currentInput , isFtp ) ;
723
-
724
- if ( currentSelectedPath == normalizedInput || string . IsNullOrWhiteSpace ( normalizedInput ) )
725
- return ;
726
-
727
- if ( normalizedInput != shellPage . ShellViewModel . WorkingDirectory || shellPage . CurrentPageType == typeof ( HomePage ) )
728
- {
729
- if ( normalizedInput . Equals ( "Home" , StringComparison . OrdinalIgnoreCase ) || normalizedInput . Equals ( Strings . Home . GetLocalizedResource ( ) , StringComparison . OrdinalIgnoreCase ) )
730
- {
731
- SavePathToHistory ( "Home" ) ;
732
- shellPage . NavigateHome ( ) ;
733
- }
734
- else if ( normalizedInput . Equals ( "ReleaseNotes" , StringComparison . OrdinalIgnoreCase ) || normalizedInput . Equals ( Strings . ReleaseNotes . GetLocalizedResource ( ) , StringComparison . OrdinalIgnoreCase ) )
735
- {
736
- SavePathToHistory ( "ReleaseNotes" ) ;
737
- shellPage . NavigateToReleaseNotes ( ) ;
738
- }
739
- // TODO add settings page
740
- //else if (normalizedInput.Equals("Settings", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Settings.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
741
- //{
742
- // SavePathToHistory("Settings");
743
- // shellPage.NavigateToReleaseNotes();
744
- //}
745
- else
746
- {
747
- normalizedInput = StorageFileExtensions . GetResolvedPath ( normalizedInput , isFtp ) ;
748
- if ( currentSelectedPath == normalizedInput )
749
- return ;
750
-
751
- var item = await FilesystemTasks . Wrap ( ( ) => DriveHelpers . GetRootFromPathAsync ( normalizedInput ) ) ;
752
-
753
- var resFolder = await FilesystemTasks . Wrap ( ( ) => StorageFileExtensions . DangerousGetFolderWithPathFromPathAsync ( normalizedInput , item ) ) ;
754
- if ( resFolder || FolderHelpers . CheckFolderAccessWithWin32 ( normalizedInput ) )
755
- {
756
- var matchingDrive = drivesViewModel . Drives . Cast < DriveItem > ( ) . FirstOrDefault ( x => PathNormalization . NormalizePath ( normalizedInput ) . StartsWith ( PathNormalization . NormalizePath ( x . Path ) , StringComparison . Ordinal ) ) ;
757
- if ( matchingDrive is not null && matchingDrive . Type == Data . Items . DriveType . CDRom && matchingDrive . MaxSpace == ByteSizeLib . ByteSize . FromBytes ( 0 ) )
758
- {
759
- bool ejectButton = await DialogDisplayHelper . ShowDialogAsync ( Strings . InsertDiscDialog_Title . GetLocalizedResource ( ) , string . Format ( Strings . InsertDiscDialog_Text . GetLocalizedResource ( ) , matchingDrive . Path ) , Strings . InsertDiscDialog_OpenDriveButton . GetLocalizedResource ( ) , Strings . Close . GetLocalizedResource ( ) ) ;
760
- if ( ejectButton )
761
- DriveHelpers . EjectDeviceAsync ( matchingDrive . Path ) ;
762
- return ;
763
- }
764
- var pathToNavigate = resFolder . Result ? . Path ?? normalizedInput ;
765
- SavePathToHistory ( pathToNavigate ) ;
766
- shellPage . NavigateToPath ( pathToNavigate ) ;
767
- }
768
- else if ( isFtp )
769
- {
770
- SavePathToHistory ( normalizedInput ) ;
771
- shellPage . NavigateToPath ( normalizedInput ) ;
772
- }
773
- else // Not a folder or inaccessible
774
- {
775
- var resFile = await FilesystemTasks . Wrap ( ( ) => StorageFileExtensions . DangerousGetFileWithPathFromPathAsync ( normalizedInput , item ) ) ;
776
- if ( resFile )
777
- {
778
- var pathToInvoke = resFile . Result . Path ;
779
- await Win32Helper . InvokeWin32ComponentAsync ( pathToInvoke , shellPage ) ;
780
- }
781
- else // Not a file or not accessible
782
- {
783
- var workingDir =
784
- string . IsNullOrEmpty ( shellPage . ShellViewModel . WorkingDirectory ) ||
785
- shellPage . CurrentPageType == typeof ( HomePage ) ?
786
- Constants . UserEnvironmentPaths . HomePath :
787
- shellPage . ShellViewModel . WorkingDirectory ;
788
-
789
- if ( await LaunchApplicationFromPath ( currentInput , workingDir ) )
790
- return ;
791
-
792
- try
793
- {
794
- if ( ! await Windows . System . Launcher . LaunchUriAsync ( new Uri ( currentInput ) ) )
795
- await DialogDisplayHelper . ShowDialogAsync ( Strings . InvalidItemDialogTitle . GetLocalizedResource ( ) ,
796
- string . Format ( Strings . InvalidItemDialogContent . GetLocalizedResource ( ) , Environment . NewLine , resFolder . ErrorCode . ToString ( ) ) ) ;
797
- }
798
- catch ( Exception ex ) when ( ex is UriFormatException || ex is ArgumentException )
799
- {
800
- await DialogDisplayHelper . ShowDialogAsync ( Strings . InvalidItemDialogTitle . GetLocalizedResource ( ) ,
801
- string . Format ( Strings . InvalidItemDialogContent . GetLocalizedResource ( ) , Environment . NewLine , resFolder . ErrorCode . ToString ( ) ) ) ;
802
- }
803
- }
804
- }
805
- }
806
-
807
- PathControlDisplayText = shellPage . ShellViewModel . WorkingDirectory ;
808
- }
809
- }
810
-
811
700
private void SavePathToHistory ( string path )
812
701
{
813
702
var pathHistoryList = UserSettingsService . GeneralSettingsService . PathHistoryList ? . ToList ( ) ?? [ ] ;
0 commit comments