@@ -333,12 +333,12 @@ public int FindMostRecentProgram()
333
333
if ( newestMayaVersion == - 1 )
334
334
{
335
335
newestMayaVersion = 0 ;
336
- savedMayaVersionNumber = FindMayaVersion ( dccOptionPaths [ i ] ) ;
336
+ savedMayaVersionNumber = FindDCCVersion ( dccOptionNames [ i ] ) ;
337
337
continue ;
338
338
}
339
339
340
340
//Check if the path we are considering is newer than the previously saved one
341
- int versionToCheck = FindMayaVersion ( dccOptionPaths [ i ] ) ;
341
+ int versionToCheck = FindDCCVersion ( dccOptionNames [ i ] ) ;
342
342
if ( versionToCheck > savedMayaVersionNumber )
343
343
{
344
344
newestMayaVersion = i ;
@@ -350,12 +350,12 @@ public int FindMostRecentProgram()
350
350
if ( newestMaxVersion == - 1 )
351
351
{
352
352
newestMaxVersion = 0 ;
353
- savedMaxVersionNumber = FindMaxVersion ( dccOptionPaths [ newestMaxVersion ] ) ;
353
+ savedMaxVersionNumber = FindDCCVersion ( dccOptionNames [ newestMaxVersion ] ) ;
354
354
continue ;
355
355
}
356
356
357
357
//Check if the path we are considering is newer than the previously saved one
358
- int versionToCheck = FindMaxVersion ( dccOptionPaths [ i ] ) ;
358
+ int versionToCheck = FindDCCVersion ( dccOptionNames [ i ] ) ;
359
359
if ( versionToCheck > savedMaxVersionNumber )
360
360
{
361
361
newestMaxVersion = i ;
@@ -384,36 +384,11 @@ public int FindMostRecentProgram()
384
384
/// </summary>
385
385
/// <param name="path"></param>
386
386
/// <returns> the year/version OR -1 if the year could not be parsed </returns>
387
- private static int FindMaxVersion ( string path )
387
+ private static int FindDCCVersion ( string AppName )
388
388
{
389
- var fileName = Path . GetFileName ( Path . GetDirectoryName ( path ) ) . ToLower ( ) ;
390
- fileName = fileName . Replace ( "3ds max" , "" ) . Trim ( ) ;
391
-
392
- int version ;
393
-
394
- if ( int . TryParse ( fileName , out version ) )
395
- {
396
- return version ;
397
- }
398
- else
399
- {
400
- return - 1 ;
401
- }
402
- }
403
-
404
- /// <summary>
405
- /// Finds the Maya version based off of the title of the application
406
- /// </summary>
407
- /// <param name="path"></param>
408
- /// <returns> the year/version OR -1 if the year could not be parsed </returns>
409
- private static int FindMayaVersion ( string path )
410
- {
411
- var fileName = Path . GetFileName ( Path . GetDirectoryName ( path ) ) . ToLower ( ) ;
412
- fileName = fileName . Replace ( "maya" , "" ) . Trim ( ) ;
413
-
414
389
int version ;
415
390
416
- if ( int . TryParse ( fileName , out version ) )
391
+ if ( int . TryParse ( AppName , out version ) )
417
392
{
418
393
return version ;
419
394
}
@@ -623,8 +598,8 @@ public static string GetMaxOptionName(string exePath){
623
598
return GetUniqueName ( Path . GetFileName ( Path . GetDirectoryName ( exePath ) ) ) ;
624
599
}
625
600
626
- public static bool IsEarlierThanMax2017 ( string exePath ) {
627
- int version = FindMaxVersion ( exePath ) ;
601
+ public static bool IsEarlierThanMax2017 ( string AppName ) {
602
+ int version = FindDCCVersion ( AppName ) ;
628
603
return version != - 1 && version < 2017 ;
629
604
}
630
605
0 commit comments