Esempio n. 1
0
        private void SaveDownloadedFileInfo(IPostToDownload post, DownloadedFile downloadedFile)
        {
            //if (_downloadDirectory == null || downloadedFile.File == null)
            //    return;
            //string file = zPath.Combine(_downloadDirectory, zPath.GetDirectoryName(downloadedFile.File), _infoDirectory, zPath.GetFileName(downloadedFile.File)) + _infoSuffixFile;

            if (_downloadDirectory == null || downloadedFile.DownloadedFiles.Length == 0)
            {
                return;
            }
            // save info file to sub-directory .i, file = .i\filename.i
            string file = downloadedFile.DownloadedFiles[0];

            //file = zPath.Combine(_downloadDirectory, zPath.GetDirectoryName(file), _infoDirectory, zPath.GetFileName(file)) + _infoSuffixFile;
            file = zPath.Combine(_downloadDirectory, InfoFile.GetInfoFile(file));

            zfile.CreateFileDirectory(file);
            BsonDocument postDocument;

            if (post != null)
            {
                postDocument = post.ToBsonDocument();
            }
            else
            {
                postDocument = new BsonDocument();
            }
            new BsonDocument {
                { "Post", postDocument }, { "DownloadedFile", downloadedFile.ToBsonDocument() }
            }.zSave(file);
        }
Esempio n. 2
0
        private void SaveDownloadedFileInfo(IPostToDownload post, DownloadedFile downloadedFile)
        {
            //if (_downloadDirectory == null || downloadedFile.File == null)
            //    return;
            //string file = zPath.Combine(_downloadDirectory, zPath.GetDirectoryName(downloadedFile.File), _infoDirectory, zPath.GetFileName(downloadedFile.File)) + _infoSuffixFile;

            if (_downloadDirectory == null || downloadedFile.DownloadedFiles.Length == 0)
                return;
            // save info file to sub-directory .i, file = .i\filename.i
            string file = downloadedFile.DownloadedFiles[0];
            //file = zPath.Combine(_downloadDirectory, zPath.GetDirectoryName(file), _infoDirectory, zPath.GetFileName(file)) + _infoSuffixFile;
            file = zPath.Combine(_downloadDirectory, InfoFile.GetInfoFile(file));

            zfile.CreateFileDirectory(file);
            BsonDocument postDocument;
            if (post != null)
                postDocument = post.ToBsonDocument();
            else
                postDocument = new BsonDocument();
            new BsonDocument { { "Post", postDocument }, { "DownloadedFile", downloadedFile.ToBsonDocument() } }.zSave(file);
        }