/// <summary>
    /// Returns parameters according to the upload mode.
    /// </summary>
    private string GetModeParameters()
    {
        string[] args;

        if (MediaLibraryID > 0)
        {
            // MediaLibrary mode
            args = new[]
            {
                "MediaLibraryID", MediaLibraryID.ToString(),
                "MediaFolderPath", MediaFolderPath,
                "MediaFileID", MediaFileID.ToString(),
                "IsMediaThumbnail", IsMediaThumbnail.ToString(),
                "MediaFileName", MediaFileName
            };
            return("MediaLibraryArgs=" + GetArgumentsString(args, UploaderHelper.MEDIA_LIBRARY_ARGS_HASHING_PURPOSE));
        }

        if (ObjectID > 0)
        {
            // MetaFile mode
            args = new[]
            {
                "MetaFileID", MetaFileID.ToString(),
                "ObjectID", ObjectID.ToString(),
                "SiteID", SiteID.ToString(),
                "ObjectType", ObjectType,
                "Category", Category
            };
            return("MetaFileArgs=" + GetArgumentsString(args, UploaderHelper.META_FILE_ARGS_HASHING_PURPOSE));
        }

        if ((DocumentID > 0) || (FormGUID != Guid.Empty))
        {
            // Attachment mode
            args = new[]
            {
                "DocumentID", DocumentID.ToString(),
                "DocumentParentNodeID", DocumentParentNodeID.ToString(),
                "NodeClassName", NodeClassName,
                "AttachmentGUIDColumnName", AttachmentGUIDColumnName,
                "AttachmentGUID", AttachmentGUID.ToString(),
                "AttachmentGroupGUID", AttachmentGroupGUID.ToString(),
                "FormGUID", FormGUID.ToString(),
                "IsFieldAttachment", mIsFiledAttachment.ToString(),
                "FullRefresh", FullRefresh.ToString()
            };
            return("AttachmentArgs=" + GetArgumentsString(args, UploaderHelper.ATTACHEMENT_ARGS_HASHING_PURPOSE));
        }
        return(String.Empty);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Returns parameters according to the upload mode.
    /// </summary>
    private string GetModeParameters()
    {
        string[] args = null;

        if (MediaLibraryID > 0)
        {
            // MediaLibrary mode
            args = new string[] {
                "MediaLibraryID", MediaLibraryID.ToString(),
                "MediaFolderPath", HttpUtility.UrlEncode(MediaFolderPath),
                "MediaFileID", MediaFileID.ToString(),
                "IsMediaThumbnail", IsMediaThumbnail.ToString(),
                "MediaFileName", HttpUtility.UrlEncode(MediaFileName)
            };

            return("MediaLibraryArgs=" + GetArgumentsString(args));
        }
        else
        {
            if ((NodeID > 0) && (SourceType == MediaSourceEnum.Content))
            {
                // CMS.File mode
                args = new string[] {
                    "NodeID", NodeID.ToString(),
                    "DocumentCulture", DocumentCulture,
                    "IncludeExtension", IncludeExtension.ToString(),
                    "NodeGroupID", NodeGroupID.ToString()
                };

                return("FileArgs=" + GetArgumentsString(args));
            }
            else
            {
                if (ObjectID > 0)
                {
                    // MetaFile mode
                    args = new string[] {
                        "MetaFileID", MetaFileID.ToString(),
                        "ObjectID", ObjectID.ToString(),
                        "SiteID", SiteID.ToString(),
                        "ObjectType", ObjectType,
                        "Category", Category
                    };

                    return("MetaFileArgs=" + GetArgumentsString(args));
                }
                else
                {
                    if (PostForumID > 0)
                    {
                        // Forum attachment
                        args = new string[] {
                            "PostForumID", PostForumID.ToString(),
                            "PostID", PostID.ToString()
                        };

                        return("ForumArgs=" + GetArgumentsString(args));
                    }
                    else
                    {
                        if ((DocumentID > 0) || (FormGUID != Guid.Empty))
                        {
                            // Attachment mode
                            args = new string[] {
                                "DocumentID", DocumentID.ToString(),
                                "DocumentParentNodeID", DocumentParentNodeID.ToString(),
                                "NodeClassName", NodeClassName,
                                "AttachmentGUIDColumnName", AttachmentGUIDColumnName,
                                "AttachmentGUID", AttachmentGUID.ToString(),
                                "AttachmentGroupGUID", AttachmentGroupGUID.ToString(),
                                "FormGUID", FormGUID.ToString(),
                                "IsFieldAttachment", mIsFiledAttachment.ToString()
                            };

                            return("AttachmentArgs=" + GetArgumentsString(args));
                        }
                    }
                }
            }
        }
        return(String.Empty);
    }