Пример #1
0
        }         // func TryLocalToUnc

        /// <summary>Translate a remote path to an unc path.</summary>
        /// <param name="uncPath"></param>
        /// <param name="localPath"></param>
        /// <returns></returns>
        public static bool TryUncToLocal(string uncPath, out string localPath)
        {
            lock (shares)
            {
                if (Procs.TrySplitUncPath(uncPath, out var serverName, out var shareName, out var sharePath) &&
                    String.Compare(serverName, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0 &&
                    shares.Value.TryGetValue(shareName, out var share))
                {
                    localPath = share.Path + sharePath;
                    return(true);
                }