Esempio n. 1
0
 internal static void ThrowInternalError(string message, Exception innerException, params object[] args)
 {
     if (throwExceptions)
     {
         throw new InternalErrorException(ResourceUtilities.FormatString(message, args), innerException);
     }
 }
Esempio n. 2
0
        private static string GetFullPath(string path)
        {
#if FEATURE_LEGACY_GETFULLPATH
            if (NativeMethodsShared.IsWindows)
            {
                string uncheckedFullPath = NativeMethodsShared.GetFullPath(path);

                if (IsPathTooLong(uncheckedFullPath))
                {
                    string message = ResourceUtilities.FormatString(AssemblyResources.GetString("Shared.PathTooLong"), path, NativeMethodsShared.OSMaxPathLimit);
                    throw new PathTooLongException(message);
                }

                // We really don't care about extensions here, but Path.HasExtension provides a great way to
                // invoke the CLR's invalid path checks (these are independent of path length)
                Path.HasExtension(uncheckedFullPath);

                // If we detect we are a UNC path then we need to use the regular get full path in order to do the correct checks for UNC formatting
                // and security checks for strings like \\?\GlobalRoot
                return(IsUNCPath(uncheckedFullPath) ? Path.GetFullPath(uncheckedFullPath) : uncheckedFullPath);
            }
#endif
            return(Path.GetFullPath(path));
        }
Esempio n. 3
0
 internal static string FormatString(string unformatted, params object[] args)
 {
     ErrorUtilities.VerifyThrowArgumentNull(unformatted, "unformatted");
     return(ResourceUtilities.FormatString(unformatted, args));
 }
Esempio n. 4
0
 internal static string FormatResourceString(out string code, out string helpKeyword, string resourceName, params object[] args)
 {
     helpKeyword = ResourceUtilities.GetHelpKeyword(resourceName);
     return(ResourceUtilities.ExtractMessageCode(true, ResourceUtilities.FormatString(ResourceUtilities.GetResourceString(resourceName), args), out code));
 }