EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Adding file Programmatically

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#7786
Posted: 10/02/2008 13:05:56
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

Hey Guys,

thanks for all of you.

Mr. Schipper gave me a good hint.

I add a code to create a new Virtual file inside CbFsEnumerateDirectory event
Code
            .
            else
            {
                pInfo = (ENUM_INFO)GCHandle.FromIntPtr(EnumerationContext).Target;
                vdir = pInfo.vfile;
            }

            if (!vdir.Enumerated && vdir.Name != "\\")
            {
                fileDetailsList = GetChildFiles(DirectoryInfo.FileName);
                vdir.Enumerated = true; // next time will not retrieve from database

                for (int i = 0; i < fileDetailsList.Count; i++)
                {
                    VirtualFile vNewfile = new VirtualFile(fileDetailsList[i].FileName);
                    // Set all vNewfile Attributes and Properties from database.
                  
                    vdir.AddFile(vNewfile, false);//Don't reset AddFile Enumeration
                }
            }

            if (FileFound = vdir.Context.GetNextFile(ref vfile))
            {
               .


Now, it is running smoothly, but still need more testing.

So Guys, Do you think this is a proper place to handle addition for subfoders/files ?

Any suggestions are appreciated.

thanks again

Khayralla
#7789
Posted: 10/02/2008 14:50:15
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

Hi again

I noticed that if there are more than 25 subfolders/files (say 60) in a Directory1

the following statment
Code
if (FileFound = vdir.Context.GetNextFile(ref vfile))


will enumerate only the first 25 subfolders/files and a new CbFsEnumerateDirectory event for another Directory2 is start, which will again enumerate the 25 first subfolders\files.

When I click F5 (refresh) in Windows Explorer, the 60 subfolders/files are listed

any help from anyone would be greatly appreciated.

Khayralla
#7790
Posted: 10/02/2008 14:52:31
by Volodymyr Zinin (EldoS Corp.)

Quote
Khayralla AL-Athari wrote:
So Guys, Do you think this is a proper place to handle addition for subfoders/files ?

Any suggestions are appreciated.

Any action from any callback function directed to the same virtual disk, for which the callback is being called, can cause a deadlock. For example if the directory "h:\dir1" is being enumerated and from the EnumerateDirectory callback for this enumeration perform a call for creation of the file "h:\file1.txt" then there is a possibility that a deadlock will occur.

It's possible to workaround it, for example by performing such actions asynchronously(!!!) from some different thread.
#7791
Posted: 10/02/2008 15:05:47
by Volodymyr Zinin (EldoS Corp.)

Quote
Khayralla AL-Athari wrote:
I noticed that if there are more than 25 subfolders/files (say 60) in a Directory1

the following statment ...

I've just checked enumeration on a virtual disk created by the CallbackFS Mounter sample and it works correctly. How can we reproduce the problem?
#7792
Posted: 10/02/2008 15:12:31
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

Sory Vladimir

this behavior is happen after adding my code above to CbFsEnumerateDirectory event.

Khayralla



#7796
Posted: 10/03/2008 05:52:57
by Eugene Mayevski (EldoS Corp.)

Please post the test case (the source code of the application in ZIP archive), which reproduces the issue, to the HelpDesk


Sincerely yours
Eugene Mayevski
#7799
Posted: 10/03/2008 07:58:31
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

but there is a database and data access layer and more...
#7801
Posted: 10/03/2008 11:28:43
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

Actually after removing Debug stuff like

mCbFs.ResetTimeout(0); //It's good idea to set timeout to 0 when you do debugging of your callback functions.

Trace.Writln,...

It is become more stable.

still I am testing it.

thanks Eugene
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 8729 times

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




|

Back to top

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

Got it!