ScrGen.Icon.IcoContainer.ToFile C# (CSharp) Method

ToFile() public method

public ToFile ( string filename, bool overwrite = false, bool arrange = true ) : void
filename string
overwrite bool
arrange bool
return void
        public void ToFile(string filename, bool overwrite = false, bool arrange = true)
        {
            if (string.IsNullOrWhiteSpace(filename))
                throw new ArgumentNullException("filename");

            if (!overwrite && File.Exists(filename))
                throw new ArgumentException("File already exists", "filename");

            var icoBytes = ToBytes(arrange);
            try
            {
                File.WriteAllBytes(filename, icoBytes);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Unable to write file", "filename", ex);
            }
        }