Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
3.9 KiB

  1. Option Explicit
  2. const SERVER_MDB = "c:\temp\Server.mdb"
  3. const DESKTOP_MDB = "c:\temp\Desktop.mdb"
  4. const WINME_MDB = "c:\temp\WinMe.mdb"
  5. Dim clsAuthDatabase
  6. Set clsAuthDatabase = CreateObject("AuthDatabase.Main")
  7. TestImportHHT
  8. Sub TestImportHHT
  9. Dim clsHHT
  10. clsAuthDatabase.SetDatabase DESKTOP_MDB
  11. Set clsHHT = clsAuthDatabase.HHT
  12. clsHHT.ImportHHT "c:\temp\foo.xml", 1234
  13. End Sub
  14. Sub UpdateChqAndHhk
  15. Dim clsChqsAndHhks
  16. clsAuthDatabase.SetDatabase SERVER_MDB
  17. Set clsChqsAndHhks = clsAuthDatabase.ChqsAndHhks
  18. clsChqsAndHhks.UpdateTable 4, "\\pietrino\HSCExpChms\Srv\winnt", _
  19. "\\pietrino\HlpImages\Srv\winnt"
  20. End Sub
  21. Sub TestChqAndHhk
  22. Dim clsChqsAndHhks
  23. Dim dictFilesAdded
  24. Dim dictFilesRemoved
  25. Dim dtmT0
  26. Dim dtmT1
  27. Dim vnt
  28. clsAuthDatabase.SetDatabase SERVER_MDB
  29. Set clsChqsAndHhks = clsAuthDatabase.ChqsAndHhks
  30. clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\1"
  31. Sleep 2000
  32. clsChqsAndHhks.UpdateTable 8, "c:\temp\CHQ\1"
  33. dtmT0 = Now
  34. Sleep 5000
  35. clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\2"
  36. Sleep 2000
  37. clsChqsAndHhks.UpdateTable 8, "c:\temp\CHQ\2"
  38. Sleep 5000
  39. clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\3"
  40. dtmT1 = Now
  41. Set dictFilesAdded = CreateObject("Scripting.Dictionary")
  42. Set dictFilesRemoved = CreateObject("Scripting.Dictionary")
  43. clsChqsAndHhks.GetFileListDelta 4, dtmT0, dtmT1, dictFilesAdded, dictFilesRemoved
  44. WScript.Echo "Files added for SRV:"
  45. For Each vnt in dictFilesAdded.Keys
  46. WScript.Echo vnt
  47. Next
  48. WScript.Echo "Files removed for SRV:"
  49. For Each vnt in dictFilesRemoved.Keys
  50. WScript.Echo vnt
  51. Next
  52. dictFilesAdded.RemoveAll
  53. dictFilesRemoved.RemoveAll
  54. clsChqsAndHhks.GetFileListDelta 8, dtmT0, dtmT1, dictFilesAdded, dictFilesRemoved
  55. WScript.Echo "Files added for ADV:"
  56. For Each vnt in dictFilesAdded.Keys
  57. WScript.Echo vnt
  58. Next
  59. WScript.Echo "Files removed for ADV:"
  60. For Each vnt in dictFilesRemoved.Keys
  61. WScript.Echo vnt
  62. Next
  63. End Sub
  64. Sub TestDatabaseBackup
  65. clsAuthDatabase.CopyAndCompactDatabase SERVER_MDB, "c:\temp\ServerBack.mdb"
  66. clsAuthDatabase.CopyAndCompactDatabase DESKTOP_MDB, "c:\temp\DesktopBack.mdb"
  67. End Sub
  68. Sub TestServerCAB
  69. Dim clsHHT
  70. clsAuthDatabase.SetDatabase SERVER_MDB
  71. Set clsHHT = clsAuthDatabase.HHT
  72. clsHHT.GenerateCAB "c:\temp\SRV.cab", 4, "Whistler RTM", True
  73. clsHHT.GenerateCAB "c:\temp\ADV.cab", 8, "Whistler RTM", True
  74. clsHHT.GenerateCAB "c:\temp\DAT.cab", 16, "Whistler RTM", True
  75. clsHHT.GenerateCAB "c:\temp\ADV64.cab", 64, "Whistler RTM", True
  76. clsHHT.GenerateCAB "c:\temp\DAT64.cab", 128, "Whistler RTM", True
  77. End Sub
  78. Sub TestDesktopCAB
  79. Dim clsHHT
  80. clsAuthDatabase.SetDatabase DESKTOP_MDB
  81. Set clsHHT = clsAuthDatabase.HHT
  82. clsHHT.GenerateCAB "c:\temp\STD.cab", 1, "Whistler RTM", True
  83. clsHHT.GenerateCAB "c:\temp\PRO.cab", 2, "Whistler RTM", True
  84. clsHHT.GenerateCAB "c:\temp\PRO64.cab", 32, "Whistler RTM", True
  85. End Sub
  86. Sub TestWinMeCAB
  87. Dim clsHHT
  88. clsAuthDatabase.SetDatabase WINME_MDB
  89. Set clsHHT = clsAuthDatabase.HHT
  90. clsHHT.GenerateHHT "c:\temp\WINME.cab", 256, "Windows Me Update", False
  91. End Sub
  92. Sub TestSynonymSets()
  93. Dim clsSynonymSets
  94. Dim arrKeywords(3)
  95. Dim v
  96. clsAuthDatabase.SetDatabase WINME_MDB
  97. Set clsSynonymSets = clsAuthDatabase.SynonymSets
  98. arrKeywords(0) = 0
  99. arrKeywords(1) = 1
  100. arrKeywords(2) = 2
  101. arrKeywords(3) = 3
  102. v = arrKeywords
  103. clsSynonymSets.Create ".aaaaaaaaaahhhhhhh", v, 0, 0, "Test"
  104. End Sub
  105. Sub TestParameters()
  106. Dim clsParameters
  107. clsAuthDatabase.SetDatabase WINME_MDB
  108. Set clsParameters = clsAuthDatabase.Parameters
  109. clsParameters.Value("Foo") = 134
  110. Wscript.Echo clsParameters.Value("Foo") * 2
  111. End Sub
  112. Sub Sleep(intMilliSeconds)
  113. Dim WshShell
  114. Set WshShell = WScript.CreateObject("WScript.Shell")
  115. WScript.Sleep intMilliSeconds
  116. End Sub