Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="content">the file to embed</param>
        public EmbeddingContent(FileInfo content)
        {
            // short circuit
            if ((content == null) || (content.Exists == false))
            {
                throw new SteganographyException("Incorrect parameters for EmbeddingContent");
            }

            this.Header           = new EmbeddingHeader(ContentType.File, Convert.ToInt32(content.Length), content.Name);
            this.HeaderAndContent = EmbeddingContent.MergeHeaderAndContent(this.Header, File.ReadAllBytes(content.FullName));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="typeOfContent">the type of content</param>
        /// <param name="filename">the filename (if the content is file)</param>
        /// <param name="content">byte array of content</param>
        public EmbeddingContent(ContentType typeOfContent, String filename, byte[] content)
        {
            // short circuit
            if ((content == null) || (content.Length < 1))
            {
                throw new SteganographyException("Incorrect parameters for EmbeddingContent");
            }

            this.Header           = new EmbeddingHeader(typeOfContent, content.Length, filename);
            this.HeaderAndContent = EmbeddingContent.MergeHeaderAndContent(this.Header, content);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="content">the text content</param>
        public EmbeddingContent(String content)
        {
            // short circuit
            content = content.Trim();
            if (content.Length < 1)
            {
                throw new SteganographyException("Incorrect parameters for EmbeddingContent");
            }

            this.Header           = new EmbeddingHeader(ContentType.Text, content.Length, String.Empty);
            this.HeaderAndContent = EmbeddingContent.MergeHeaderAndContent(this.Header, Encoding.ASCII.GetBytes(content));
        }