EldoS | Feel safer!

Software components for data protection, secure storage and transfer

creating subfolders after double clicking a parent folder

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 12/12/2013 06:44:33
by pnina (Standard support level)
Joined: 11/20/2013
Posts: 36

I took as a basis the VDisk sample for c#.
I was able to create a virtual files and directories using the VirtualFile class.

Now I am trying to do the following:
To create a virtual directory named "a".
Then, after "a" is clicked, to create "b" inside it (path: a\b), then when "b" is clicked, to create "c" inside it (path: a\b\c) and so on.

I tried to implement it in this way:
Under btnAddPoint_Click to create "a" (after adding the mounting point)
Then, under CbFsOpenFile to create b,c,d,etc based on the previous folder (according to FileName).

But then I get everything triple.
I had 1 "a" folder that was created inside btnAddPoint_Click,
but when double clicking "a", inside "a" I had 3 "b" folders, because it was calling CbFsOpenFile event multiple times.

Where should I write the code for the folders that are created after a double click to make sure they are created only once?
Posted: 12/12/2013 06:50:37
by Eugene Mayevski (Team)

You should not perform any operations on the virtual disk you manage. If you want to change anything under the hood, you make changes in the backend data, then use NotifyDirectoryChange to inform the OS about the changes made in the filesystem structure.

Sincerely yours
Eugene Mayevski
Posted: 12/12/2013 07:11:21
by pnina (Standard support level)
Joined: 11/20/2013
Posts: 36

So I should create all the virtual structure right in the beginning, in the same time and place where I'm creating "a"?
Posted: 12/12/2013 07:15:11
by Eugene Mayevski (Team)

No, not necessarily.

Frankly speaking I don't know what to tell you about what you are doing - you are conducting experiments and the behavior you observe is logical - OnOpenFile is called and if you don't check existing state (i.e. contents of the directory being opened), you will end up with subdirectories created multiple times. But these are your experiments, you learn from them :).

Sincerely yours
Eugene Mayevski
Posted: 12/12/2013 07:23:13
by pnina (Standard support level)
Joined: 11/20/2013
Posts: 36

Thanks :)
As long as it is generally makes sense, I'll figure it out :)
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.



Topic viewed 1075 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!