forked from Squirrel/Squirrel.Windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Squirrel#1578 from nickhodge/remove_splat_dependency
Remove Splat External Dependency
- Loading branch information
Showing
39 changed files
with
1,415 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace Squirrel.SimpleSplat | ||
{ | ||
static class AssemblyFinder | ||
{ | ||
public static T AttemptToLoadType<T>(string fullTypeName) | ||
{ | ||
var thisType = typeof(AssemblyFinder); | ||
|
||
var toSearch = new[] { | ||
thisType.AssemblyQualifiedName.Replace(thisType.FullName + ", ", ""), | ||
thisType.AssemblyQualifiedName.Replace(thisType.FullName + ", ", "").Replace(".Portable", ""), | ||
}.Select(x => new AssemblyName(x)).ToArray(); | ||
|
||
foreach (var assembly in toSearch) { | ||
var fullName = fullTypeName + ", " + assembly.FullName; | ||
var type = Type.GetType(fullName, false); | ||
if (type == null) continue; | ||
|
||
return (T)Activator.CreateInstance(type); | ||
} | ||
|
||
return default(T); | ||
} | ||
} | ||
} |
Oops, something went wrong.