-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed more static classes / moved extension methods to appropriate …
…wrapper types
- Loading branch information
1 parent
8d50e17
commit 3ec6220
Showing
16 changed files
with
263 additions
and
353 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
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
39 changes: 39 additions & 0 deletions
39
Rubberduck.VBEEditor/Extensions/ComponentTypeExtensions.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,39 @@ | ||
using Rubberduck.VBEditor.DisposableWrappers.VBA; | ||
|
||
namespace Rubberduck.VBEditor.Extensions | ||
{ | ||
public static class ComponentTypeExtensions | ||
{ | ||
internal const string ClassExtension = ".cls"; | ||
internal const string FormExtension = ".frm"; | ||
internal const string StandardExtension = ".bas"; | ||
internal const string FormBinaryExtension = ".frx"; | ||
internal const string DocClassExtension = ".doccls"; | ||
|
||
/// <summary> | ||
/// Returns the proper file extension for the Component Type. | ||
/// </summary> | ||
/// <remarks>Document classes should properly have a ".cls" file extension. | ||
/// However, because they cannot be removed and imported like other component types, we need to make a distinction.</remarks> | ||
/// <param name="componentType"></param> | ||
/// <returns>File extension that includes a preceeding "dot" (.) </returns> | ||
public static string FileExtension(this ComponentType componentType) | ||
{ | ||
switch (componentType) | ||
{ | ||
case ComponentType.ClassModule: | ||
return ClassExtension; | ||
case ComponentType.UserForm: | ||
return FormExtension; | ||
case ComponentType.StandardModule: | ||
return StandardExtension; | ||
case ComponentType.Document: | ||
// documents should technically be a ".cls", but we need to be able to tell them apart. | ||
return DocClassExtension; | ||
case ComponentType.ActiveXDesigner: | ||
default: | ||
return string.Empty; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.