Exemplo n.º 1
0
        /// <summary>
        /// Saves an <see cref="Identicon"/> icon as a Scalable Vector Graphics (SVG) file.
        /// </summary>
        /// <param name="icon">The identicon to save.</param>
        /// <param name="path">The path to the SVG file to create. If the file already exists it will be overwritten.</param>
        /// <param name="fragment">
        /// If <c>true</c> the generated SVG will not be encapsulated in the root svg element making
        /// it suitable to be embedded in another SVG.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="path"/> was <c>null</c>.</exception>
        public static void SaveAsSvg(this Identicon icon, string path, bool fragment)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write))
            {
                icon.SaveAsSvg(stream, fragment);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Saves an <see cref="Identicon"/> icon as a Scalable Vector Graphics (SVG) file.
 /// </summary>
 /// <param name="icon">The identicon to save.</param>
 /// <param name="writer">The <see cref="TextWriter"/> to which the SVG data will be written.</param>
 /// <exception cref="ArgumentNullException"><paramref name="writer"/> was <c>null</c>.</exception>
 public static void SaveAsSvg(this Identicon icon, TextWriter writer)
 {
     icon.SaveAsSvg(writer, false);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Saves an <see cref="Identicon"/> icon as a Scalable Vector Graphics (SVG) file.
 /// </summary>
 /// <param name="icon">The identicon to save.</param>
 /// <param name="path">The path to the SVG file to create. If the file already exists it will be overwritten.</param>
 /// <exception cref="ArgumentNullException"><paramref name="path"/> was <c>null</c>.</exception>
 public static void SaveAsSvg(this Identicon icon, string path)
 {
     icon.SaveAsSvg(path, false);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Saves an <see cref="Identicon"/> icon as a Scalable Vector Graphics (SVG) file.
 /// </summary>
 /// <param name="icon">The identicon to save.</param>
 /// <param name="stream">The stream to which the SVG data will be written.</param>
 /// <exception cref="ArgumentNullException"><paramref name="stream"/> was <c>null</c>.</exception>
 public static void SaveAsSvg(this Identicon icon, Stream stream)
 {
     icon.SaveAsSvg(stream, false);
 }