Esempio n. 1
0
        /// <summary>
        /// Converts regular path to unc path
        /// </summary>
        /// <exception cref="InvalidOperationException">If path is invalid or cannot be identified</exception>
        public static string ToPathUnc(string path)
        {
            Contract.Requires(!String.IsNullOrEmpty(path));

            // give origin if already unc
            if (IsShareUnc(path) || IsLocalUnc(path))
            {
                // already unc
                return(path);
            }

            // convert to share
            if (IsShareRegular(path))
            {
                return(QuickIOPath.ToSharePathUnc(path));
            }
            // convert to local
            if (IsLocalRegular(path))
            {
                return(QuickIOPath.ToLocalPathUnc(path));
            }

            // it is already a regular path
            // or invalid. but will not be checked here
            return(path);
        }