コード例 #1
0
        static void TestExist()
        {
            WebDavManager manager = new WebDavManager("admin", "admin", "192.168.10.242", "/owncloud/remote.php/webdav/");

            manager.SucceededHandler = (sender, e) => { Console.WriteLine("Exist Success"); };
            manager.FailedHandler    = (sender, e) => { Console.WriteLine("Exist Handler"); };
            manager.Exist("/KV/lsj/System/", true);
        }
コード例 #2
0
        private int UserWebDavInitialProcess()
        {
            iStatus = StatusCode.BUSY;
            bool          bFinish        = false;
            int           errStep        = 0;
            List <string> noExistFolders = new List <string>();

            //检查连接
            m_wManager.SucceededHandler = (sender, e) => { bFinish = true; };
            m_wManager.FailedHandler    = (sender, e) => { bFinish = true; errStep = 1; };
            m_wManager.CheckLink();
            while (!bFinish)
            {
                ;
            }
            if (errStep != 0)
            {
                return(errStep);
            }

            //检查文件夹
            for (int i = 0; i < m_sFolders.Length; i++)
            {
                bFinish = false;
                m_wManager.SucceededHandler = (sender, e) => { bFinish = true; };
                m_wManager.FailedHandler    = (sender, e) =>
                {
                    noExistFolders.Add(e.Information);
                    bFinish = true;
                };
                m_wManager.Exist(m_sFolders[i], true);
                while (!bFinish)
                {
                    ;
                }
            }

            //创建文件夹
            for (int i = 0; i < noExistFolders.Count; i++)
            {
                bFinish = false;
                m_wManager.SucceededHandler = (sender, e) => { bFinish = true; };
                m_wManager.FailedHandler    = (sender, e) => { bFinish = true; errStep = 2; };
                m_wManager.MkdirRec(noExistFolders[i]);
                while (!bFinish)
                {
                    ;
                }
                if (errStep != 0)
                {
                    return(errStep);
                }
            }

            return(errStep);
        }