Ejemplo n.º 1
0
        protected static Dictionary <string, List <string> > ResolveProjectFiles(IEnumerable <string> itemsFullPath, bool workWithProjitemsFile = false)
        {
            Dictionary <string, List <string> > filesByProject = new Dictionary <string, List <string> >();

            foreach (var item in itemsFullPath)
            {
                var itemDirectory = Directory.GetParent(item).FullName;
                var projFile      = Fs.FindFileAtOrAbove(itemDirectory, "*.*proj");
                if (string.IsNullOrEmpty(projFile))
                {
                    AppHealth.Current.Error.TrackAsync(string.Format(StringRes.ExceptionProjectNotFound, item)).FireAndForget();
                }
                else
                {
                    if (workWithProjitemsFile && Path.GetExtension(projFile) == ".shproj")
                    {
                        projFile = projFile.Replace(".shproj", ".projitems");
                    }

                    if (!filesByProject.ContainsKey(projFile))
                    {
                        filesByProject.Add(projFile, new List <string>()
                        {
                            item
                        });
                    }
                    else
                    {
                        filesByProject[projFile].Add(item);
                    }
                }
            }

            return(filesByProject);
        }