Exemplo n.º 1
0
        /// <summary>
        ///     Read file in current assembly by specific file name
        /// </summary>
        /// <param name="fileName"> </param>
        /// <param name="stream"> </param>
        /// <returns> </returns>
        /// <exception cref="ApplicationException">
        ///     <c>ApplicationException</c>
        ///     .
        /// </exception>
        public bool TryReadFileFromResToStream(string fileName, out Stream stream)
        {
            var nameResFile = AssemblyName + ResourceFilePath + fileName;

            stream = Assembly.GetManifestResourceStream(nameResFile);
            if (ReferenceEquals(stream, null))
            {
                #region Get from base extractor
                if (!ReferenceEquals(_baseExtractor, null))
                {
                    stream = _baseExtractor.ReadFileFromResToStream(fileName);
                }
                #endregion
            }
            return(!ReferenceEquals(stream, null));
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Read file in current assembly by specific path
 /// </summary>
 /// <param name="specificPath"> Specific path </param>
 /// <param name="fileName"> Read file name </param>
 /// <returns> </returns>
 public Stream ReadSpecificFileFromResToStream(string specificPath, string fileName)
 {
     var ext = new ResourceFileExtractor(specificPath, Assembly);
     return ext.ReadFileFromResToStream(fileName);
 }
Exemplo n.º 3
0
        /// <summary>
        ///     Read file in current assembly by specific path
        /// </summary>
        /// <param name="specificPath"> Specific path </param>
        /// <param name="fileName"> Read file name </param>
        /// <returns> </returns>
        public Stream ReadSpecificFileFromResToStream(string specificPath, string fileName)
        {
            var ext = new ResourceFileExtractor(specificPath, Assembly);

            return(ext.ReadFileFromResToStream(fileName));
        }