IfInvalidFileName() public static method

public static IfInvalidFileName ( string fileName ) : void
fileName string
return void
Esempio n. 1
0
        ///<summary>
        /// Returns the format information of the specified format based on the extension of the
        /// file. If that fails the format will be determined by 'pinging' the file.
        ///</summary>
        ///<param name="fileName">The name of the file to get the format for.</param>
        public static MagickFormatInfo GetFormatInformation(string fileName)
        {
            string filePath = FileHelper.CheckForBaseDirectory(fileName);

            Throw.IfInvalidFileName(filePath);

            return(GetFormatInformation(new FileInfo(filePath)));
        }
Esempio n. 2
0
        /// <summary>
        /// Performs lossless compression on the specified file. If the new file size is not smaller
        /// the file won't be overwritten.
        /// </summary>
        /// <param name="fileName">The file name of the image to compress</param>
        public void LosslessCompress(string fileName)
        {
            string filePath = FileHelper.CheckForBaseDirectory(fileName);

            Throw.IfInvalidFileName(filePath);

            DoLosslessCompress(new FileInfo(filePath));
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MagickScript"/> class.
        /// </summary>
        /// <param name="fileName">The fully qualified name of the script file, or the relative script file name.</param>
        public MagickScript(string fileName)
        {
            string filePath = FileHelper.CheckForBaseDirectory(fileName);

            Throw.IfInvalidFileName(filePath);

            using (FileStream stream = File.OpenRead(filePath))
            {
                Initialize(stream);
            }
        }
        private void AddImages(string fileName, MagickReadSettings readSettings, bool ping)
        {
            string filePath = FileHelper.CheckForBaseDirectory(fileName);

            Throw.IfInvalidFileName(filePath);

            MagickSettings settings = CreateSettings(readSettings);

            settings.FileName = filePath;
            settings.Ping     = ping;

            IntPtr result = _NativeInstance.ReadFile(settings);

            AddImages(result, settings);
        }