@@ -43,6 +43,7 @@ public class SettingsViewModel : ViewModelBase
4343 private ICommand _cancelSettingsCommand ;
4444
4545 private string _currentLayoutHashId ;
46+ private string _currentGeometry ;
4647 private string _currentLayoutRevisionId ;
4748 private string _layoutTitle ;
4849 private string _keyboardModel ;
@@ -52,7 +53,6 @@ public class SettingsViewModel : ViewModelBase
5253 private string _hexFileUri ;
5354 private string _sourcesZipUri ;
5455 private bool _layoutIsCompiled ;
55- private string _keyboardGeometry ;
5656
5757 private string _altModifierLabel ;
5858 private string _ctrlModifierLabel ;
@@ -227,6 +227,12 @@ public string CurrentLayoutHashId
227227 set => Set ( ref _currentLayoutHashId , value ) ;
228228 }
229229
230+ public string CurrentGeometry
231+ {
232+ get => _currentGeometry ;
233+ set => Set ( ref _currentGeometry , value ) ;
234+ }
235+
230236 public string CurrentLayoutRevisionId
231237 {
232238 get => _currentLayoutRevisionId ;
@@ -349,12 +355,12 @@ private void OpenTagSearchUrl(string tag)
349355 {
350356 Logger . TraceRelayCommand ( ) ;
351357
352- if ( string . IsNullOrWhiteSpace ( tag ) || string . IsNullOrWhiteSpace ( _keyboardGeometry ) )
358+ if ( string . IsNullOrWhiteSpace ( tag ) )
353359 {
354360 return ;
355361 }
356362
357- var tagSearchUri = string . Format ( TagSearchBaseUri , _keyboardGeometry , tag ) ;
363+ var tagSearchUri = string . Format ( TagSearchBaseUri , CurrentGeometry , tag ) ;
358364 _processService . StartWebUrl ( tagSearchUri ) ;
359365 }
360366
@@ -400,11 +406,11 @@ private async void UpdateErgoDoxInfo()
400406 {
401407 Logger . TraceMethod ( ) ;
402408
403- ( CurrentLayoutHashId , CurrentLayoutRevisionId ) = ExtractLayoutUrlIds ( LayoutUrlContent ) ;
409+ ExtractLayoutUrlIds ( LayoutUrlContent ) ;
404410
405411 try
406412 {
407- var layoutInfo = await _layoutService . GetLayoutInfo ( CurrentLayoutHashId , CurrentLayoutRevisionId ) ;
413+ var layoutInfo = await _layoutService . GetLayoutInfo ( CurrentLayoutHashId , CurrentGeometry , CurrentLayoutRevisionId ) ;
408414 Logger . Debug ( "LayoutInfo = {@value0}" , layoutInfo ) ;
409415
410416 ClearLayoutInfo ( ) ;
@@ -445,8 +451,7 @@ private void ClearLayoutInfo()
445451 LayoutTitle = "" ;
446452 KeyboardModel = "" ;
447453 LayoutStatus = "" ;
448-
449- _keyboardGeometry = "" ;
454+
450455 _layoutIsCompiled = false ;
451456 }
452457
@@ -455,7 +460,6 @@ private void UpdateLayoutInfo(ErgodoxLayout layoutInfo)
455460 Logger . TraceMethod ( ) ;
456461
457462 LayoutTitle = layoutInfo . Title ;
458- _keyboardGeometry = layoutInfo . Geometry ;
459463
460464 if ( layoutInfo . Tags ? . Any ( ) != null )
461465 {
@@ -464,7 +468,7 @@ private void UpdateLayoutInfo(ErgodoxLayout layoutInfo)
464468
465469 if ( layoutInfo . Revision != null )
466470 {
467- KeyboardModel = GetKeyBoardDescription ( _keyboardGeometry , layoutInfo . Revision . Model ) ;
471+ KeyboardModel = GetKeyBoardDescription ( layoutInfo . Geometry , layoutInfo . Revision . Model ) ;
468472 UpdateLayoutButtons ( layoutInfo . Revision ) ;
469473 LayoutStatus = ! _layoutIsCompiled ? "Not compiled" : "Compiled" ;
470474
@@ -519,7 +523,7 @@ private async Task UpdateLayout()
519523
520524 try
521525 {
522- var ergodoxLayout = await _layoutService . GetErgodoxLayout ( CurrentLayoutHashId , CurrentLayoutRevisionId ) ;
526+ var ergodoxLayout = await _layoutService . GetErgodoxLayout ( CurrentLayoutHashId , CurrentGeometry , CurrentLayoutRevisionId ) ;
523527 Logger . Debug ( "ergodoxLayout = {@value0}" , ergodoxLayout ) ;
524528
525529 var ezLayout = _layoutService . PrepareEZLayout ( ergodoxLayout ) ;
@@ -539,33 +543,35 @@ private async Task UpdateLayout()
539543 }
540544 }
541545
542- private ( string layoutHashId , string layoutRevisionId ) ExtractLayoutUrlIds ( string layoutUrl )
546+ private void ExtractLayoutUrlIds ( string layoutUrl )
543547 {
544548 Logger . TraceMethod ( ) ;
545549
546550 var layoutHashIdGroupName = "layoutHashId" ;
551+ var geometryGroupName = "geometry" ;
547552 var layoutRevisionIdGroupName = "layoutRevisionId" ;
548553 var pattern =
549- $ "https://configure.(?:ergodox-ez.com|zsa.io)/(?:ergodox-ez|planck-ez|moonlander)/layouts/(?<{ layoutHashIdGroupName } >default|[a-zA-Z0-9]{{4,}})(?:/(?<{ layoutRevisionIdGroupName } >latest|[a-zA-Z0-9]+)(?:/[0-9]{{1,2}})?)?";
550- var layoutHashId = "default" ;
551- var layoutRevisionId = "latest" ;
554+ $ "https://configure.(?:ergodox-ez.com|zsa.io)/(?<{ geometryGroupName } >ergodox-ez|planck-ez|moonlander)/layouts/(?<{ layoutHashIdGroupName } >default|[a-zA-Z0-9]{{4,}})(?:/(?<{ layoutRevisionIdGroupName } >latest|[a-zA-Z0-9]+)(?:/[0-9]{{1,2}})?)?";
555+ CurrentLayoutHashId = "default" ;
556+ CurrentGeometry = "ergodox-ez" ;
557+ CurrentLayoutRevisionId = "latest" ;
552558
553559 var regex = new Regex ( pattern ) ;
554560 var match = regex . Match ( layoutUrl ) ;
555561
556562 if ( match . Success )
557563 {
558- layoutHashId = match . Groups [ layoutHashIdGroupName ] . Value ;
559-
564+ CurrentLayoutHashId = match . Groups [ layoutHashIdGroupName ] . Value ;
565+ CurrentGeometry = match . Groups [ geometryGroupName ] . Value ;
560566 var revisionId = match . Groups [ layoutRevisionIdGroupName ] . Value ;
561- layoutRevisionId = string . IsNullOrWhiteSpace ( revisionId ) ? layoutRevisionId : revisionId ;
567+ CurrentLayoutRevisionId = string . IsNullOrWhiteSpace ( revisionId ) ? CurrentLayoutRevisionId : revisionId ;
562568 }
563569
564- Logger . Debug ( "Layout URL = {0}" , layoutUrl ) ;
565- Logger . Debug ( "Layout Hash ID = {0}" , layoutHashId ) ;
566- Logger . Debug ( "Layout Revision ID = {0}" , layoutRevisionId ) ;
567-
568- return ( layoutHashId , layoutRevisionId ) ;
570+ Logger . Debug ( $ "Layout URL = { layoutUrl } " ) ;
571+ Logger . Debug ( $ "Layout URL has { ( match . Success ? "" : "NOT " ) } been matched" ) ;
572+ Logger . Debug ( $ "Layout Hash ID = { CurrentLayoutHashId } " ) ;
573+ Logger . Debug ( $ "Keyboard geometry = { CurrentGeometry } " ) ;
574+ Logger . Debug ( $ "Layout Revision ID = { CurrentLayoutRevisionId } " ) ;
569575 }
570576
571577 #endregion
0 commit comments