-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update plugin to facilitate support for more types of files to update
- Loading branch information
1 parent
24013ab
commit 612f07c
Showing
10 changed files
with
106 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
NamespaceAdjuster/NamespaceUpdater/FileNamespaceUpdaterProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
namespace NamespaceUpdater | ||
{ | ||
internal class FileNamespaceUpdaterProvider | ||
{ | ||
private List<LogicFileNamespaceUpdaterService> updaterServices = new List<LogicFileNamespaceUpdaterService>(); | ||
|
||
public FileNamespaceUpdaterProvider() | ||
{ | ||
updaterServices.Add(new CsNamespaceUpdaterService()); | ||
} | ||
|
||
public IFileNamespaceUpdater GetUpdater(string filePath) | ||
{ | ||
string fileExtension = Path.GetExtension(filePath); | ||
|
||
foreach (var updaterService in updaterServices) | ||
{ | ||
if (updaterService.SupportsFileExtension(fileExtension)) | ||
{ | ||
return updaterService; | ||
} | ||
} | ||
|
||
throw new Exception($"Error updating file {filePath}:\nFile extension {fileExtension} not supported."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters