Example #1
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);
            }
        }
Example #2
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();
            }
        }