EnsureDirectorySeperatorAtEnd() 공개 정적인 메소드

public static EnsureDirectorySeperatorAtEnd ( string directory ) : string
directory string
리턴 string
예제 #1
0
        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
    }
예제 #2
0
        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)));
        }
예제 #3
0
        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)));
        }