예제 #1
0
        private async void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            _lanz = new Lanzou();
            if (!restoreCookieContainer())
            {
                bool b = _lanz.login(username, password);
                if (b)
                {
                    storeCookieContainer();
                }
            }

            if (!await vfs_db_download())
            {
                MessageBox.Show("vfs db 下载失败");
                return;
            }

            var its = new ObservableCollection <VirtualFileSystem.Directory2>()
            {
                dirTreeViewRoot
            };

            dirTreeView.ItemsSource = its;
            treeViewDict.Clear();
            treeViewDict.Add(-1, dirTreeViewRoot);
            UpdateCurrentDir(-1, null);
        }
예제 #2
0
        private void ProcessFaceFile(VFile file)
        {
            var DirectAccessSet = new HashSet <string>()
            {
                "jpg", "txt", "mp3", "mp4"
            };

            string ext = Path.GetExtension(file.Name).Substring(1).ToLower();

            if (DirectAccessSet.Contains(ext))
            {
                if (file.Size < 10 * 1024 * 1024)
                {
                    var sid = _lanz.get_shareId(file.id);
                    var stm = Lanzou.get_fileStream(sid);
                    OpenStreamByProperApplication(stm, file.Name, ext);
                }
                else
                {
                    downloadFaceFile(file);
                }
            }
            else
            {
                downloadFaceFile(file);
            }
        }
예제 #3
0
 private void DownloadBtn_Click(object sender, RoutedEventArgs e)
 {
     //Lanzou.download_file("i5znnij", "a:/abc.mp3");
     Lanzou.download_file("i62p51e", "a:/mmc.txt");
     //var pua = "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Mobile Safari/537.36";
     //var req = getReq("https://www.lanzous.com/tp/i5znnij");
     //req.UserAgent = pua;
     //var ret = reqOut(req);
     //Clipboard.SetDataObject(ret);
 }
예제 #4
0
        public async Task <bool> vfs_db_download()
        {
            try
            {
                string vvv = await _lanz.get_dirDescription(sys_dir_id);

                Newtonsoft.Json.Linq.JObject json_data = Newtonsoft.Json.Linq.JObject.Parse(vvv);
                var sysFileId = json_data["sys"].ToObject <int>();
                var shareId   = _lanz.get_shareId(sysFileId);
                Lanzou.download_file(shareId, db_tempPath + "__vfs.sqlite.db");
                _sqlcon = new System.Data.SQLite.SQLiteConnection("data source=" + db_tempPath + "__vfs.sqlite.db");
                _sqlcon.Open();
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
예제 #5
0
        public void downloadFaceFile(VFile file)
        {
            if (file.partFile == null)
            {
                var shareId = _lanz.get_shareId(file.id);
                Lanzou.download_file(shareId, fileDownloadPath + file.Name);
            }
            else
            {
                var fs = File.Create(fileDownloadPath + file.Name);

                foreach (var x in file.partFile)
                {
                    var sid = _lanz.get_shareId(x.Value);
                    var stm = Lanzou.get_fileStream(sid);
                    stm.CopyTo(fs);
                }
                fs.Close();
            }
        }