home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / FileSystem206395542007.psc / Files.cls < prev    next >
Text File  |  2007-04-26  |  4KB  |  109 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "Files"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = True
  14. ' =======================================================
  15. '
  16. ' Hex Editor VB
  17. ' Coded by violent_ken (Alain Descotes)
  18. '
  19. ' =======================================================
  20. '
  21. ' A complete hexadecimal editor for Windows ⌐
  22. ' (Editeur hexadΘcimal complet pour Windows ⌐)
  23. '
  24. ' Copyright ⌐ 2006-2007 by Alain Descotes.
  25. '
  26. ' This file is part of Hex Editor VB.
  27. '
  28. ' Hex Editor VB is free software; you can redistribute it and/or modify
  29. ' it under the terms of the GNU General Public License as published by
  30. ' the Free Software Foundation; either version 2 of the License, or
  31. ' (at your option) any later version.
  32. '
  33. ' Hex Editor VB is distributed in the hope that it will be useful,
  34. ' but WITHOUT ANY WARRANTY; without even the implied warranty of
  35. ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  36. ' GNU General Public License for more details.
  37. '
  38. ' You should have received a copy of the GNU General Public License
  39. ' along with Hex Editor VB; if not, write to the Free Software
  40. ' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  41. '
  42. ' =======================================================
  43.  
  44.  
  45. Option Explicit
  46.  
  47. Private colFiles As Collection
  48.  
  49. 'http://www.vbfrance.com/tutorial.aspx?ID=188
  50.  
  51. '=======================================================
  52. 'Permet d'utiliser For Each
  53. '=======================================================
  54. Public Function NewEnum() As IEnumVARIANT
  55. Attribute NewEnum.VB_UserMemId = -4
  56. Attribute NewEnum.VB_MemberFlags = "40"
  57.  
  58.     'on renvoie l'objet d'ΘnumΘration
  59.  
  60.     Set NewEnum = colFiles.[_NewEnum]
  61.  
  62. End Function
  63.  
  64. 'Renvoie l'ΘlΘment d'index iCurrent dans la variable var
  65. 'elle doit renvoyer 0 si tout vabien
  66. '1 s'il n'y a plus d'ΘlΘments dans la collection
  67. Public Function ForEach(ByVal iCurrent As Long, var As Variant) As Long
  68. Attribute ForEach.VB_MemberFlags = "40"
  69. '
  70.  
  71. End Function
  72.  
  73.  
  74.  
  75. '=======================================================
  76. 'ProperiΘtΘs de la classe
  77. '=======================================================
  78. Public Property Get Count() As Long: Count = colFiles.Count: End Property
  79. Public Property Get Item(Index As Long) As File: On Error Resume Next: Set Item = colFiles(Index): End Property
  80. Attribute Item.VB_UserMemId = 0
  81.  
  82.  
  83. '=======================================================
  84. 'Subs d'initialisations
  85. '=======================================================
  86. Private Sub Class_Initialize(): Set colFiles = New Collection: End Sub
  87. Private Sub Class_Terminate(): Set colFiles = Nothing: End Sub
  88.  
  89.  
  90. '=======================================================
  91. 'Ajout d'un objet dans la collection
  92. '=======================================================
  93. Public Sub AddItem(Path As String, Optional ByVal RefreshInfos As Boolean = True)
  94. Dim tFile As File
  95.     
  96.     Set tFile = New File
  97.     Call tFile.SetPath(Path, RefreshInfos)  'refresh les infos du nouvel objet
  98.     Call colFiles.Add(Item:=tFile)
  99. End Sub
  100.  
  101. '=======================================================
  102. 'Suppression d'un objet de la collection
  103. '=======================================================
  104. Public Sub RemoveItem(Index As Long)
  105.     Call colFiles.Remove(Index)
  106. End Sub
  107.  
  108.  
  109.