Example #1
0
        /// <summary>
        ///     Gets the discovery path.
        /// </summary>
        /// <param name = "downloadedDiscoveryDirectory">The downloaded discovery directory.</param>
        /// <param name = "absoluteUri">The absolute URI.</param>
        /// <returns></returns>
        public override string GetDiscoveryPath(string downloadedDiscoveryDirectory, string absoluteUri, string fullTextIndexType)
        {
            string directory = UserDefinedFunctions.ExtractDirectory(downloadedDiscoveryDirectory, absoluteUri).Value;

            DirectoryInfo directoryInfo = null;

            if (!Directory.Exists(directory))
            {
                //ANODET: View the history of this... :)
                //http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#file_and_directory_names
                //CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
                directory += "\\";
                directory  = Regex.Replace(directory.ToLower(), "\\\\com\\d\\\\", "\\com_\\");
                directory  = Regex.Replace(directory.ToLower(), "\\\\lpt\\d\\\\", "\\lpt_\\");
                directory  = directory.ToLower().Replace("\\aux\\", "\\aux_\\").Replace("\\con\\", "\\con_\\").Replace("\\nul\\", "\\nul_\\").Replace("\\prn\\", "\\prn_\\");
                directory  = directory.Substring(0, directory.Length - 1);

                directoryInfo = Directory.CreateDirectory(directory);
            }
            else
            {
                directoryInfo = new DirectoryInfo(directory);
            }

            return(Path.Combine(directoryInfo.FullName, "_" + new Hash(absoluteUri) + fullTextIndexType));
        }
Example #2
0
        public override string GetDiscoveryPath(string downloadedDiscoveryVirtualDirectory, string absoluteUri)
        {
            string[] uriSplit = absoluteUri.Split("/".ToCharArray());

            return(Path.Combine(UserDefinedFunctions.ExtractDirectory(downloadedDiscoveryVirtualDirectory, absoluteUri).Value, uriSplit[uriSplit.Length - 1]).Replace("\\", "/").Replace("//", "/"));
        }