示例#1
0
 private void AddItemToPostingDb(FileSystemInfo toPost)
 {
     UploadEntry newUploadentry = new UploadEntry();
     newUploadentry.CreatedAt = DateTime.UtcNow;
     newUploadentry.Name = toPost.Name;
     newUploadentry.RemoveAfterVerify = configuration.RemoveAfterVerify;
     newUploadentry.Cancelled = false;
     newUploadentry.Size = toPost.Size();
     if (newUploadentry.Size == 0)
         log.ErrorFormat("File added with a size of 0 bytes, This cannot be uploaded! File name: [{0}]",
             toPost.FullName);
     DBHandler.Instance.AddNewUploadEntry(newUploadentry);
 }
示例#2
0
        private void MakeRarAndParFiles(FileSystemInfo toPost, String nameWithoutExtension,
            DirectoryInfo processedFolder, String password)
        {
            Int64 size = toPost.Size();
            var rarSizeRecommendation = configuration.RarNParSettings
                .Where(rr => rr.FromSize < size)
                .OrderByDescending(rr => rr.FromSize)
                .First();
            var rarWrapper = new RarWrapper(configuration.InactiveProcessTimeout, configuration.RarLocation);
            rarWrapper.Compress(
                toPost,
                processedFolder,
                nameWithoutExtension,
                Settings.DetermineOptimalRarSize(rarSizeRecommendation.RarSize,
                    configuration.YEncLineSize, configuration.YEncLinesPerMessage),
                password);

            var parWrapper = new ParWrapper(configuration.InactiveProcessTimeout, configuration.ParLocation);
            parWrapper.CreateParFilesInDirectory(
                processedFolder, nameWithoutExtension, configuration.YEncPartSize, rarSizeRecommendation.Par2Percentage);
        }
示例#3
0
        private void MakeRarAndParFiles(FileSystemInfo toPost, String nameWithoutExtension,
            DirectoryInfo processedFolder)
        {
            Int64 size = toPost.Size();
            var rarSizeRecommendation = configuration.RecommendationMap
                .Where(rr => rr.FromFileSize < size)
                .OrderByDescending(rr => rr.FromFileSize)
                .First();
            var rarWrapper = new RarWrapper(configuration.InactiveProcessTimeout, configuration.RarLocation);
            rarWrapper.Compress(
                toPost, processedFolder, nameWithoutExtension, rarSizeRecommendation.ReccomendedRarSize);

            var parWrapper = new ParWrapper(configuration.InactiveProcessTimeout, configuration.ParLocation);
            parWrapper.CreateParFilesInDirectory(
                processedFolder, nameWithoutExtension, configuration.YEncPartSize, rarSizeRecommendation.ReccomendedRecoveryPercentage);
        }