コード例 #1
0
        /// <summary>
        /// This function adds a searchpath to the dictionary given an input string describing the searchpath
        /// </summary>
        /// <param name="key"></param>
        /// <param name="pathLine"></param>
        private static void AddSearchpath(string key, string pathLine)
        {
            string[] roughParts = pathLine.Split('?');
            if (roughParts.Length < 2)
            {
                return;
            }

            if (!s_searchpaths.ContainsKey(key))
            {
                s_searchpaths.Add(key, new HashSet <SearchPathInfo>());
            }
            var spi = new SearchPathInfo();

            string[] fineParts = roughParts[1].Split(':');
            spi.Root = fineParts[0].ToLower() == "data" ? SearchPathRoot.Data : SearchPathRoot.Attrib;

            spi.Path = fineParts[1];

            if (roughParts.Length > 2)
            {
                spi.RemoveFromFront = roughParts[2] == string.Empty ? null : roughParts[2];
            }
            else
            {
                spi.RemoveFromFront = null;
            }

            if (roughParts.Length > 3 && roughParts[3] != string.Empty)
            {
                string[] exts = roughParts[3].Split(':');
                spi.ExtensionsToInclude = exts;
            }
            else
            {
                spi.ExtensionsToInclude = null;
            }

            if (roughParts.Length > 4 && roughParts[4] != string.Empty)
            {
                string[] exclude = roughParts[4].Split(':');
                spi.EndingsToExclude = exclude;
            }
            else
            {
                spi.EndingsToExclude = null;
            }

            s_searchpaths[key].Add(spi);
        }
コード例 #2
0
        /// <summary>
        /// This function adds a searchpath to the dictionary given an input string describing the searchpath
        /// </summary>
        /// <param name="key"></param>
        /// <param name="pathLine"></param>
        private static void AddSearchpath(string key, string pathLine)
        {
            string[] roughParts = pathLine.Split('?');
            if (roughParts.Length < 2)
                return;

            if (!s_searchpaths.ContainsKey(key))
                s_searchpaths.Add(key, new HashSet<SearchPathInfo>());
            var spi = new SearchPathInfo();
            string[] fineParts = roughParts[1].Split(':');
            spi.Root = fineParts[0].ToLower() == "data" ? SearchPathRoot.Data : SearchPathRoot.Attrib;

            spi.Path = fineParts[1];

            if (roughParts.Length > 2)
                spi.RemoveFromFront = roughParts[2] == string.Empty ? null : roughParts[2];
            else
                spi.RemoveFromFront = null;

            if (roughParts.Length > 3 && roughParts[3] != string.Empty)
            {
                string[] exts = roughParts[3].Split(':');
                spi.ExtensionsToInclude = exts;
            }
            else
                spi.ExtensionsToInclude = null;

            if (roughParts.Length > 4 && roughParts[4] != string.Empty)
            {
                string[] exclude = roughParts[4].Split(':');
                spi.EndingsToExclude = exclude;
            }
            else
                spi.EndingsToExclude = null;

            s_searchpaths[key].Add(spi);
        }