Example #1
0
        /// <summary>
        ///   Writes a resource expressed in the <paramref name="resource" /> onto the <paramref name="targetPath" />.
        /// </summary>
        /// <param name="resource">The embedded resource to be extracted.</param>
        /// <param name="targetPath">The directory path to where the resource will be written.</param>
        /// <returns>The resource name (without any path) written.</returns>
        public static string ToFile(this EmbeddedUri resource, TemplateString targetPath)
        {
            new FileResourceWriter(targetPath).Write(
                new ResourceReader(new[]
            {
                new ResourceInfo
                {
                    Assembly              = GetAssembly(resource.Assembly),
                    Namespace             = resource.Namespace,
                    RelativeRootNamespace = string.Empty,
                    Resource              = resource.Resource
                }
            }));

            return(resource.Resource);
        }
Example #2
0
        /// <summary>
        ///   Writes a resource expressed in the <paramref name="resource" /> onto the <paramref name="targetPath" />.
        /// </summary>
        /// <param name="resource">The embedded resource to be extracted.</param>
        /// <param name="targetPath">The directory path to where the resource will be written.</param>
        /// <returns>The resource name (without any path) written.</returns>
        public static string ToFile(this EmbeddedUri resource, TemplateString targetPath)
        {
            new FileResourceWriter(targetPath).Write(
                new ResourceReader(new[]
            {
                new ResourceInfo
                {
                    Assembly              = AppDomain.CurrentDomain.GetAssemblies().First(x => x.GetName().Name == resource.Assembly),
                    Namespace             = resource.Namespace,
                    RelativeRootNamespace = string.Empty,
                    Resource              = resource.Resource
                }
            }));

            return(resource.Resource);
        }