11using FileSystemCommon ;
2+ using FileSystemCommon . Models . Configuration ;
23using FileSystemCommon . Models . FileSystem ;
34using FileSystemCommon . Models . FileSystem . Content ;
45using FileSystemCommon . Models . FileSystem . Folders ;
@@ -63,19 +64,23 @@ public SyncEditPage()
6364 protected override void OnNavigatedTo ( NavigationEventArgs e )
6465 {
6566 edit = ( SyncPairEdit ) e . Parameter ;
67+ char directorySeparatorChar = edit . Api . Config . DirectorySeparatorChar ;
6668
6769 PathPart [ ] serverPath = edit . Sync . ServerPath ;
6870 if ( serverPath != null )
6971 {
7072 for ( int i = 0 ; i < serverPath . Length ; i ++ )
7173 {
72- folderPaths [ serverPath . Take ( i + 1 ) . GetNamePath ( ) . TrimEnd ( '\\ ' ) ] = serverPath [ i ] . Path ;
74+ string path = serverPath
75+ . Take ( i + 1 )
76+ . GetNamePath ( directorySeparatorChar ) ;
77+ folderPaths [ path ] = serverPath [ i ] . Path ;
7378 }
7479 }
7580
7681 tblTitlePrefix . Text = edit . IsAdd ? "Add" : "Edit" ;
7782 DataContext = edit . Sync ;
78- asbServerPath . Text = edit . Sync . ServerPath . GetNamePath ( ) ;
83+ asbServerPath . Text = edit . Sync . ServerPath . GetNamePath ( directorySeparatorChar ) ;
7984
8085 base . OnNavigatedTo ( e ) ;
8186 }
@@ -103,6 +108,7 @@ private object LinesConverter_ConvertBackEvent(object value, Type targetType, ob
103108
104109 private async void AsbServerPath_TextChanged ( AutoSuggestBox sender , AutoSuggestBoxTextChangedEventArgs args )
105110 {
111+ Config config = edit . Api . Config ;
106112 sinServerPathValid . Symbol = Symbol . Help ;
107113
108114 if ( args . Reason == AutoSuggestionBoxTextChangeReason . UserInput ||
@@ -113,15 +119,18 @@ private async void AsbServerPath_TextChanged(AutoSuggestBox sender, AutoSuggestB
113119 string . Empty : Path . GetFileName ( sender . Text ) ;
114120 string searchKey = folderName . ToLower ( ) ;
115121 string parentPath = string . IsNullOrWhiteSpace ( sender . Text ) ?
116- string . Empty : Utils . GetParentPath ( sender . Text ) . TrimEnd ( Path . DirectorySeparatorChar ) ;
122+ string . Empty : config . GetParentPath ( sender . Text ) . TrimEnd ( config . DirectorySeparatorChar ) ;
117123 FolderContent content = folderPaths . TryGetValue ( parentPath , out actualParentPath ) ?
118124 await edit . Api . FolderContent ( folderPaths [ parentPath ] ) : null ;
119125
120126 if ( content ? . Folders != null )
121127 {
122128 foreach ( FolderSortItem folder in content . Folders )
123129 {
124- folderPaths [ content . Path . GetChildPathParts ( folder ) . GetNamePath ( ) . TrimEnd ( Path . DirectorySeparatorChar ) ] = folder . Path ;
130+ string path = content . Path
131+ . GetChildPathParts ( folder )
132+ . GetNamePath ( config . DirectorySeparatorChar ) ;
133+ folderPaths [ path ] = folder . Path ;
125134 }
126135
127136 FolderSortItem currentFolder ;
@@ -143,17 +152,18 @@ private async void AsbServerPath_TextChanged(AutoSuggestBox sender, AutoSuggestB
143152 }
144153
145154 string actualPath ;
146- string namePath = sender . Text . TrimEnd ( Path . DirectorySeparatorChar ) ;
155+ string namePath = sender . Text . TrimEnd ( config . DirectorySeparatorChar ) ;
147156 bool exists = folderPaths . TryGetValue ( namePath , out actualPath ) && await edit . Api . FolderExists ( actualPath ) ;
148157 sinServerPathValid . Symbol = exists ? Symbol . Accept : Symbol . Dislike ;
149158 }
150159
151160 private void AsbServerPath_QuerySubmitted ( AutoSuggestBox sender , AutoSuggestBoxQuerySubmittedEventArgs args )
152161 {
162+ Config config = edit . Api . Config ;
153163 FolderItem suggestion = args . ChosenSuggestion is FolderItem ? ( FolderItem ) args . ChosenSuggestion : ( FolderItem ) sender . Items [ 0 ] ;
154- string parentPath = Utils . GetParentPath ( sender . Text ) ;
164+ string parentPath = config . GetParentPath ( sender . Text ) ;
155165
156- sender . Text = Utils . JoinPaths ( parentPath , suggestion . Name ) + ' \\ ' ;
166+ sender . Text = config . JoinPaths ( parentPath , suggestion . Name ) + config . DirectorySeparatorChar ;
157167 sender . Focus ( FocusState . Keyboard ) ;
158168 }
159169
0 commit comments