Skip to content

Commit

Permalink
Now working a simple implementation
Browse files Browse the repository at this point in the history
:)
  • Loading branch information
iamedu committed Feb 9, 2011
1 parent 5b703cf commit e073efc
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 13 deletions.
Binary file modified DokanDAV/DokanDAV.suo
Binary file not shown.
3 changes: 0 additions & 3 deletions DokanDAV/DokanDAV/DokanDAV.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
4 changes: 3 additions & 1 deletion DokanDAV/RacsaFS/SettingsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 71 additions & 9 deletions DokanDAV/RacsaFS/SettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
using System.Text;
using System.Windows.Forms;

using System.Threading;
using Dokan;

using DokanDAV;

namespace RacsaFS
{
public partial class SettingsForm : Form
{
private Settings settings;
private Func<string, DokanDAV.DAVSize> sizeFunc;
private DAVOperations operations;

public SettingsForm()
{
Expand All @@ -24,7 +30,7 @@ public SettingsForm()
{
DokanDAV.DAVSize size = new DokanDAV.DAVSize();

using (AVService.DAVClient client = new AVService.DAVClient("DAV", settings.Webservice))
using (AVService.DAVClient client = new AVService.DAVClient())
{
size.total = (ulong)client.getTotalSpace(username);
size.used = (ulong)client.getUsedSpace(username);
Expand All @@ -39,36 +45,92 @@ private void SettingsForm_Load(object sender, EventArgs e)
userTxt.Text = settings.Username;
passwordTxt.Text = settings.Password;
driveCombo.Text = settings.Mount;

Connect();

}

private void mountButton_Click(object sender, EventArgs e)
{
settings.Username = userTxt.Text;
settings.Password = passwordTxt.Text;
settings.Mount = driveCombo.Text;

if (Connect())
{
this.Hide();
}
else
{
MessageBox.Show("Ocurrio un error, por favor revise sus datos");
}

}

private void StartDAV()
{
Dokan.DokanOptions options = new DokanOptions();

options.MountPoint = settings.Mount;
options.VolumeLabel = "AV de " + settings.Username;
options.DebugMode = true;

int status = DokanNet.DokanMain(options, operations);

switch (status)
{
case DokanNet.DOKAN_DRIVE_LETTER_ERROR:
MessageBox.Show("Drive incorrecto");
break;
case DokanNet.DOKAN_DRIVER_INSTALL_ERROR:
MessageBox.Show("Error al instalar el drive");
break;
case DokanNet.DOKAN_MOUNT_ERROR:
MessageBox.Show("Error al montar el drive");
break;
case DokanNet.DOKAN_START_ERROR:
MessageBox.Show("Error al iniciar el drive");
break;
case DokanNet.DOKAN_ERROR:
MessageBox.Show("Error desconocido");
break;
case DokanNet.DOKAN_SUCCESS:
MessageBox.Show("Ha desmontado su AV");
break;
default:
MessageBox.Show("Status desconocido " + status);
break;
}

}

private void Connect()
private bool Connect()
{
string basePath;

MessageBox.Show(settings.Webservice);


using (AVService.DAVClient client = new AVService.DAVClient("DAVHttpPort", settings.Webservice))
using (AVService.DAVClient client = new AVService.DAVClient())
{
basePath = settings.Base + client.getBasePath("iamedu", "iamedu");
basePath = client.getBasePath(settings.Username, settings.Password);
if (basePath == null)
{
return false;
}
basePath = settings.Base + basePath;
}

DokanDAV.DAVOperations operations = new DokanDAV.DAVOperations(WebdavClient.DAVProtocol.HTTP,
operations = new DokanDAV.DAVOperations(WebdavClient.DAVProtocol.HTTP,
settings.Hostname,
settings.Port,
basePath,
settings.Username,
settings.Password,
sizeFunc);
Thread t = new Thread(new ThreadStart(StartDAV));


t.Start();


return true;
}

}
Expand Down
Binary file modified DokanDAV/RacsaFS/bin/Debug/DokanDAV.dll
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/DokanDAV.pdb
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/DokanNet.dll
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/DokanNet.pdb
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/RacsaFS.exe
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/RacsaFS.pdb
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/WebdavClient.dll
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/bin/Debug/WebdavClient.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/obj/x86/Debug/GenerateResource.read.1.tlog
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/obj/x86/Debug/RacsaFS.exe
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/obj/x86/Debug/RacsaFS.pdb
Binary file not shown.
Binary file modified DokanDAV/RacsaFS/obj/x86/Debug/ResolveAssemblyReference.cache
Binary file not shown.

0 comments on commit e073efc

Please sign in to comment.