Bloom.Api.EnhancedImageServer.LocalHostPathToFilePath C# (CSharp) Method

LocalHostPathToFilePath() public static method

Adjust the 'localPath' obtained from a request in a platform-dependent way to a path that can actually be used to retrieve a file (or test for its existence).
public static LocalHostPathToFilePath ( string localPath ) : string
localPath string
return string
        public static string LocalHostPathToFilePath(string localPath)
        {
            #if __MonoCS__
            // The JSON format may use a string like this to reference a local path.
            // Try it without the leading marker.
            return localPath.Substring(10);
            #else
            // URL was something like /bloom///localhost/C$/, but info.LocalPathWithoutQuery uses Uri.LocalPath
            // which for some reason drops the leading slashes for a network mapped drive.
            // network mapped drives don't work if the computer isn't on a network.
            // So we'll change the localhost\C$ to C: (same for other letters)
            var pathArray = localPath.Substring(10).ToCharArray();
            var drive = char.ToUpper(pathArray[0]);
            if (pathArray[1] == '$' && pathArray[2] == '/' && drive >= 'A' && drive <= 'Z')
                pathArray[1] = ':';
            return new String(pathArray);
            #endif
        }