home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Musical Instruments / Musical-Instruments.iso / msstp / misc.inc < prev    next >
Text File  |  1993-08-26  |  2KB  |  101 lines

  1. '*************************************************************************
  2. '**
  3. '** IsVersionLater
  4. '** --------
  5. '** Purpose:
  6. '**     Compares two file versions
  7. '** Arguments:
  8. '**     VerOld$ - Old file version string (in format N.N.N.N)
  9. '**     VerNew$ - New file version string (in format N.N.N.N)
  10. '** Returns:
  11. '**     1 if new version is later, 0 if new version is older or the same
  12. '*************************************************************************
  13. FUNCTION IsVersionLater (VerOld$, VerNew$) STATIC AS INTEGER
  14.  
  15.     FOR I=1 TO 4 
  16.  
  17.         VOld = GetVersionNthField (VerOld$, I)
  18.         VNew = GetVersionNthField (VerNew$, I)
  19.  
  20.         
  21.  
  22.         If VNew > VOld THEN 
  23.             IsVersionLater = 1
  24.  
  25.             GOTO XFUNC1    
  26.         ElseIf VNew < VOld Then
  27.             IsVersionLater = 0
  28.  
  29.             GOTO XFUNC1
  30.         End If
  31.  
  32.  
  33.     NEXT I
  34.     IsVersionLater = 0        
  35.  
  36. XFUNC1:
  37.     
  38. END FUNCTION
  39.  
  40.  
  41. '*************************************************************************
  42. '**
  43. '** IsDateLater
  44. '** --------
  45. '** Purpose:
  46. '**     Compares two file dates
  47. '** Arguments:
  48. '**     DateOld$ in YYYY-MM-DD-HH-MM-SS format
  49. '**     DateNew$ in YYYY-MM-DD-HH-MM-SS format
  50. '** Returns:
  51. '**     1 if new date is later, 0 if new date is older or the same
  52. '*************************************************************************
  53. FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
  54.     
  55.  
  56.     'First compare year
  57.  
  58.     OldYear% = GetYearFromDate (DateOld$)
  59.     NewYear% = GetYearFromDate (DateNew$)
  60.  
  61.     If NewYear% < OldYear% Then
  62.         IsDateLater = 0
  63.  
  64.     ElseIf NewYear% = OldYear% Then
  65.  
  66.         'If year is the same, compare month
  67.         
  68.         OldMonth% = GetMonthFromDate (DateOld$)
  69.         NewMonth% = GetMonthFromDate (DateNew$)
  70.  
  71.         If NewMonth% < OldMonth% Then
  72.             IsDateLater = 0
  73.  
  74.         ElseIf NewMonth% = OldMonth% Then
  75.  
  76.             'If month is the same, compare day
  77.  
  78.             OldDay% = GetDayFromDate (DateOld$)
  79.             NewDay% = GetDayFromDate (DateNew$)
  80.  
  81.             If NewDay% <= OldDay% Then
  82.                 IsDateLater = 0
  83.             Else
  84.                 IsDateLater = 1
  85.             End If
  86.          
  87.         Else
  88.             IsDateLater = 1
  89.         End If
  90.  
  91.     Else
  92.         IsDateLater = 1
  93.     ENDIF
  94.     
  95. END FUNCTION
  96.  
  97.  
  98.  
  99.  
  100.  
  101.