public void AddSupplementaryFileToStore(string sourcePath, string targetDir, string targetFn, bool embedAsThumb,
                                                AdminShellPackageSupplementaryFile.SourceGetByteChunk sourceGetBytesDel = null, string useMimeType = null)
        {
            // beautify parameters
            if ((sourcePath == null && sourceGetBytesDel == null) || targetDir == null || targetFn == null)
            {
                return;
            }

            // build target path
            targetDir = targetDir.Trim();
            if (!targetDir.EndsWith("/"))
            {
                targetDir += "/";
            }
            targetDir = targetDir.Replace(@"\", "/");
            targetFn  = targetFn.Trim();
            if (sourcePath == "" || targetDir == "" || targetFn == "")
            {
                throw (new Exception("Trying add supplementary file with empty name or path!"));
            }

            var targetPath = "" + targetDir.Trim() + targetFn.Trim();

            // base funciton
            AddSupplementaryFileToStore(sourcePath, targetPath, embedAsThumb, sourceGetBytesDel, useMimeType);
        }
Пример #2
0
        public void AddSupplementaryFileToStore(string sourcePath, string targetPath, bool embedAsThumb,
                                                AdminShellPackageSupplementaryFile.SourceGetByteChunk sourceGetBytesDel = null, string useMimeType = null)
        {
            // beautify parameters
            if ((sourcePath == null && sourceGetBytesDel == null) || targetPath == null)
            {
                return;
            }

            sourcePath = sourcePath?.Trim();
            targetPath = targetPath.Trim();

            // add record
            pendingFilesToAdd.Add(
                new AdminShellPackageSupplementaryFile(
                    new Uri(targetPath, UriKind.RelativeOrAbsolute),
                    sourcePath,
                    location: AdminShellPackageSupplementaryFile.LocationType.AddPending,
                    specialHandling: (embedAsThumb
                        ? AdminShellPackageSupplementaryFile.SpecialHandlingType.EmbedAsThumbnail
                        : AdminShellPackageSupplementaryFile.SpecialHandlingType.None),
                    sourceGetBytesDel: sourceGetBytesDel,
                    useMimeType: useMimeType)
                );
        }