/// <summary>
 /// Reads the CSS file.
 /// </summary>
 /// <param name="Path">The path.</param>
 public static void ReadCSSFile(this ICssParser parser, string filePath)
 {
     using (var stream = new FileStream(filePath, FileMode.Open))
     {
         parser.ReadCSSFile(stream);
     }
 }
 public EmbeddedWebFont(string fontFileName, string alias, string cssFileName, Assembly assembly)
     : base(fontFileName, alias)
 {
     _glyphs    = new Dictionary <string, string>();
     _cssParser = new CssParser();
     _cssParser.ReadCSSFile(GetResourceStream(cssFileName, assembly));
 }
 /// <summary>
 /// Reads the CSS file.
 /// </summary>
 /// <param name="stream">The file stream.</param>
 public static void ReadCSSFile(this ICssParser parser, Stream stream)
 {
     using (var reader = new StreamReader(stream))
     {
         parser.ReadCSSFile(reader);
     }
 }
        /// <summary>
        /// Reads a css file from a given assembly
        /// </summary>
        /// <param name="parser">The <see cref="ICssParser"/> instance</param>
        /// <param name="resourceName">The CSS file name 'sample.css' or 'sample.min.css'</param>
        /// <param name="assembly">The <see cref="Assembly"/> the file is embedded in</param>
        public static void ReadCSSFile(this ICssParser parser, string resourceName, Assembly assembly)
        {
            var resourceId = assembly.GetManifestResourceNames()
                             .FirstOrDefault(x => x.Equals(resourceName, StringComparison.InvariantCultureIgnoreCase) ||
                                             x.EndsWith(resourceName, StringComparison.InvariantCultureIgnoreCase));

            if (string.IsNullOrEmpty(resourceId))
            {
                throw new FileNotFoundException($"The css file {resourceName} could not be found in the assembly {assembly.FullName}");
            }

            using var stream = assembly.GetManifestResourceStream(resourceId);
            parser.ReadCSSFile(stream);
        }
 public static void ReadCSSFile(this ICssParser parser, string resourceName, Type resolvingType) =>
 parser.ReadCSSFile(resourceName, resolvingType.Assembly);