EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SolFS basic example to create and mount filesystem

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#32126
Posted: 02/06/2015 08:17:48
by Alen Lovric (Standard support level)
Joined: 02/06/2015
Posts: 3

Do you have a basic sample in a few lines of code to create and mount a SolFS filesystem?

Ideally I would like both options to mount it like \\.\SolFS type name or as a drive letter too...

Also can you show how to open it at a later stage?

Many thanks,
Alen
#32129
Posted: 02/06/2015 09:06:10
by Volodymyr Zinin (EldoS Corp.)

Hello Alen,

Look at the attachment. I have found one sample C++ code for console app.
It's necessary to install the SolFS drivers first with some other application like the SimpleMounter sample.


[ Download ]
#32133
Posted: 02/06/2015 14:51:30
by Alen Lovric (Standard support level)
Joined: 02/06/2015
Posts: 3

Hi Volodymyr

Would you have an example in C# please?

I tried to implement the above in C# and successfully mounted it, however the files are still encrypted and I cannot access them.

I basically loaded the SimpleMounter sample and modified the following function:

Code
        private void btnAddPoint_Click(object sender, EventArgs e)
        {
            frmAddPoint frm = new frmAddPoint();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                m_Storage.CheckPassword("password");
                m_Storage.AddMountingPoint(frm.GetText());
                updateList();
            }
        }


Thank you,
Alen
#32134
Posted: 02/06/2015 15:13:50
by Eugene Mayevski (EldoS Corp.)

CheckPassword doesn't *set* the password. Use StoragePassword property to specify the password.

On a side note please use CODE button to mark the beginning and the end of the code block in your messages.


Sincerely yours
Eugene Mayevski
#32177
Posted: 02/12/2015 03:33:15
by Alen Lovric (Standard support level)
Joined: 02/06/2015
Posts: 3

Hello again,

I am now able to create a storage, open an existing storage, encrypt and password protect and create mounting points. However whenever I try to create a SolFSStream I get exceptions.

Code
try
{
    _storage.CreateDirectory("test");
    string fileLoc = _path + _pathSeparator + "test" + _pathSeparator + "test.txt";

    _stream = new SolFSStream(_storage, fileLoc);

    MessageBox.Show("Success");
}

catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}


The "Success" is never shown as the exception I get is "The filename, directory name, or volume label syntax is incorrect."

The exception is thrown regardless of whether I set '_path' to be 'x:' (mountpoint path) or to the storage file. Also, if I create a UNC mountpoint and set '_path' to '\\.\example' I get a blue screen of death.

Thank you,
Alen
#32178
Posted: 02/12/2015 03:35:45
by Alexander Plas (EldoS Corp.)

Moved to HelpDesk
#32180
Posted: 02/12/2015 10:00:38
by Eugene Mayevski (EldoS Corp.)

Once you have created a virtual disk, you have two options:

1) use regular FileStream class and pass your fileLoc value to it
2) use SolFSStream and pass SolFS-specific path to the constructor.

Example:

you have a file "/path/to/filename.ext" and you've mounted the disk to drive X: (for simplicity).

In the first case you call

Code
new FileStream("X:\path\to\filename.ext",...);


In the second case you call

Code
new SolFSStream("/path/to/filename.ext", ...);


Sincerely yours
Eugene Mayevski
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 4028 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!