示例#1
0
        private MapProcessingResult HandleMaps(ConfigProcessingResult configProcessingResult)
        {
            var xmlFiles = DocumentHelper.GetXmlFiles(_projectItems);
            var configs  = GotoAsyncPackage.Storage.SqlMapConfigProvider.GetAll();

            if (_options.MapsOptions.IndexAllMaps)
            {
                return(HandleCorrectMapFiles(xmlFiles, configs));
            }

            if (_options.MapsOptions.IndexOnlyMapsInConfig)
            {
                var fileNames        = configs.SelectMany(e => e.Maps).Select(e => e.Value);
                var filteredXmlFiles = GetExistingInMaps(xmlFiles, fileNames);

                if (fileNames.Any(e => e.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0))
                {
                    //Fallback scenario, when path/filename is invaild than just index all maps in solution,
                    //maps that are are not referenced in config, will be assigned to default config.
                    OutputWindowLogger.WriteLn("Found invaild character for file. Parsing all maps found in solution.");
                    return(HandleAllMapFiles(xmlFiles, configs));
                }

                return(HandleCorrectMapFiles(filteredXmlFiles, configs));
            }

            return(new MapProcessingResult());
        }
示例#2
0
        public static ConfigProcessingResult FromProcessingResults(IEnumerable <SqlMapConfig> configs)
        {
            var result = new ConfigProcessingResult();

            if (configs.Count() == 1)
            {
                result.HasAtLeastOneProperConfig = true;
            }

            if (configs.Count() > 1)
            {
                result.HasMultipleProperConfigs = true;
            }

            return(result);
        }