public static String GetLongPathName(String shortPath) { StringBuilder longPath = new StringBuilder(1024); if (0 == PathExtensions.GetLongPathName(shortPath, longPath, longPath.Capacity)) { return(shortPath); } return(longPath.ToString()); }
static void Main(string[] args) { #if false StringCollection2IEnumerableString.StringCollection2List(); #endif #if false String path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Internet Explorer\iexplore.exe"); Console.WriteLine("Long path: '{0}'", path); path = PathExtensions.GetShortPathName(path); Console.WriteLine("Short path: '{0}'", path); path = PathExtensions.GetLongPathName(path); Console.WriteLine("Long path: '{0}'", path); #endif #if true Console.WriteLine("{0} keyboard(s) are attached", Keyboard.GetKeyboardCount()); #endif }