1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
7
namespace Hornung.ResourceToolkit.ResourceFileContent
10
/// Creates resource file contents for .resources and .resx files.
12
public class DefaultBclResourceFileContentFactory : IResourceFileContentFactory
15
/// Determines whether this factory can create a resource file content
16
/// for the specified file.
18
/// <param name="fileName">The file name to examine.</param>
19
/// <returns><c>true</c>, if this factory can create a resource file content for the specified file, otherwise <c>false</c>.</returns>
20
public bool CanCreateContentForFile(string fileName)
22
string ext = Path.GetExtension(fileName);
24
if (ext.Equals(".resources", StringComparison.OrdinalIgnoreCase) ||
25
ext.Equals(".resx", StringComparison.OrdinalIgnoreCase)) {
33
/// Creates a resource file content for the specified file.
35
/// <param name="fileName">The name of the file to create the resource file content for.</param>
36
/// <returns>A new instance of a class that implements <see cref="IResourceFileContent"/> and represents the content of the specified file, or <c>null</c>, if this class cannot handle the file format.</returns>
37
public IResourceFileContent CreateContentForFile(string fileName)
39
string ext = Path.GetExtension(fileName);
41
if (ext.Equals(".resources", StringComparison.OrdinalIgnoreCase)) {
42
return new ResourcesResourceFileContent(fileName);
43
} else if (ext.Equals(".resx", StringComparison.OrdinalIgnoreCase)) {
44
return new ResXResourceFileContent(fileName);
50
// ********************************************************************************************************************************
53
/// Initializes a new instance of the <see cref="DefaultBclResourceFileContentFactory"/> class.
55
public DefaultBclResourceFileContentFactory()