コード例 #1
0
        public SettingsForm()
        {
            InitializeComponent();
            settings = new Settings();
            mounted  = false;

            sizeFunc = delegate(string username)
            {
                DokanDAV.DAVSize size = new DokanDAV.DAVSize();

                try
                {
                    using (AVService.DAVClient client = new AVService.DAVClient())
                    {
                        size.total = (ulong)client.getTotalSpace(username);
                        size.used  = (ulong)client.getUsedSpace(username);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

                return(size);
            };
        }
コード例 #2
0
        private bool Connect()
        {
            string basePath;



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

            operations = new DokanDAV.DAVOperations(WebdavClient.DAVProtocol.HTTP,
                                                    settings.Hostname,
                                                    settings.Port,
                                                    basePath + "/" + settings.Username,
                                                    settings.Username,
                                                    settings.Password,
                                                    sizeFunc);


            disableControls();

            Thread t = new Thread(new ThreadStart(StartDAV));


            t.Start();



            return(true);
        }