£
£$%^
Hello group,
I want to create an array of FileSystemWatchers. The indices of the
arrays will be x(PATH) and NotifyFilters, i.e. for every PATH I will be
able to run one watcher for every NotifyFilters attribute. The first
question that I have is that NotifyFilters range from 1 to 383 with
gaps, which means that alot of objects in the array will by empty,
which will be wasteful. To solve this problem I created a
"companion" enumeration like so
(if it was perl, maybe an associative array could have been helpful)
Enum enum_notify
filename = 0
dirname = 1
attributes = 2
size = 3
write = 4
access = 5
create = 6
sec = 8
End Enum
Would this be a reasonable design?
My second question is regarding the above enumeration,
suppose I want to turn raising events on for all attributes,
I would need to write something like so
For i As enum_notify = enum_notify.filename To enum_notify.sec
If enum_notifyfilter_a And 2 ^ i Then arWatcher(menu.Index,
i).EnableRaisingEvents = True
Next
The only problem here is that the for loop takes the values
0,1,2,3,4,5,6,7,8, i.e. it will include 7 in the loop whereas
enum_notify doesn't use 7, and the 2 ^ i "trick" is
not very elegant. Can I do it in a better way?
I want to create an array of FileSystemWatchers. The indices of the
arrays will be x(PATH) and NotifyFilters, i.e. for every PATH I will be
able to run one watcher for every NotifyFilters attribute. The first
question that I have is that NotifyFilters range from 1 to 383 with
gaps, which means that alot of objects in the array will by empty,
which will be wasteful. To solve this problem I created a
"companion" enumeration like so
(if it was perl, maybe an associative array could have been helpful)
Enum enum_notify
filename = 0
dirname = 1
attributes = 2
size = 3
write = 4
access = 5
create = 6
sec = 8
End Enum
Would this be a reasonable design?
My second question is regarding the above enumeration,
suppose I want to turn raising events on for all attributes,
I would need to write something like so
For i As enum_notify = enum_notify.filename To enum_notify.sec
If enum_notifyfilter_a And 2 ^ i Then arWatcher(menu.Index,
i).EnableRaisingEvents = True
Next
The only problem here is that the for loop takes the values
0,1,2,3,4,5,6,7,8, i.e. it will include 7 in the loop whereas
enum_notify doesn't use 7, and the 2 ^ i "trick" is
not very elegant. Can I do it in a better way?