public static EnsureDirectorySeperatorAtEnd ( string directory ) : string | ||
directory | string | |
리턴 | string |
public static System.Type[] GetCreatableObjectImplementsInterface(Type interfaceType, string path, AppDomain domain) { var al = new ArrayList(); if (System.IO.File.Exists(path)) { al.Add(Assembly.LoadFile(path)); } else { var fullPath = StringHelper.EnsureDirectorySeperatorAtEnd(path); if (!System.IO.Directory.Exists(fullPath)) //Check for path existence { return new System.Type[] { } } ; al = LoadAllAssembliesForPath(fullPath); } var retval = new ArrayList(); try { foreach (System.Reflection.Assembly assembly in al) { try { foreach (var t in assembly.GetTypes()) { if (ImplementsInterface(t, interfaceType) && !t.IsAbstract && !t.IsInterface) { retval.Add(t); } } } catch (System.Reflection.ReflectionTypeLoadException ex) { nHydrateLog.LogError(ex, "Could not load types for assembly: " + assembly.FullName); foreach (var innerEx in ex.LoaderExceptions) { nHydrateLog.LogError(innerEx, "Loader Exception: " + innerEx.Message); } } catch (Exception ex) { nHydrateLog.LogError(ex, "Could not load types for assembly: " + assembly.FullName); } } } catch (Exception ex) { throw; } return((System.Type[])retval.ToArray(typeof(System.Type))); } #endregion }
public static DirectoryInfo DotNetFramework() { const string location = @"SOFTWARE\Microsoft\.NETFramework"; const string item = @"InstallRoot"; var installLocation = RegistryHelper.GetLocalMachineRegistryValue(location, item); return(new DirectoryInfo(StringHelper.EnsureDirectorySeperatorAtEnd(installLocation))); }
public static DirectoryInfo VisualCSharp() { const string location = @"SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VC#"; const string item = @"ProductDir"; var installLocation = RegistryHelper.GetLocalMachineRegistryValue(location, item); return(new DirectoryInfo(StringHelper.EnsureDirectorySeperatorAtEnd(installLocation))); }