Пример #1
0
        public Task <SolutionFolderItem> ReadSolutionItem(ProgressMonitor monitor, SolutionItemReference reference, params WorkspaceItem[] workspaces)
        {
            return(Runtime.RunInMainThread(async delegate {
                if (reference.Id == null)
                {
                    FilePath file = reference.Path.FullPath;
                    foreach (WorkspaceItem workspace in workspaces)
                    {
                        foreach (SolutionItem eitem in workspace.GetAllItems <Solution>().SelectMany(s => s.GetAllSolutionItems()))
                        {
                            if (file == eitem.FileName)
                            {
                                return eitem;
                            }
                        }
                    }
                    return await ReadSolutionItem(monitor, reference.Path);
                }
                else
                {
                    Solution sol = null;
                    if (workspaces.Length > 0)
                    {
                        FilePath file = reference.Path.FullPath;
                        foreach (WorkspaceItem workspace in workspaces)
                        {
                            foreach (Solution item in workspace.GetAllItems <Solution>())
                            {
                                if (item.FileName.FullPath == file)
                                {
                                    sol = item;
                                    break;
                                }
                            }
                            if (sol != null)
                            {
                                break;
                            }
                        }
                    }
                    if (sol == null)
                    {
                        sol = await ReadWorkspaceItem(monitor, reference.Path) as Solution;
                    }

                    if (reference.Id == ":root:")
                    {
                        return sol.RootFolder;
                    }
                    else
                    {
                        return sol.GetSolutionItem(reference.Id);
                    }
                }
            }));
        }
Пример #2
0
        public override bool Equals(object o)
        {
            SolutionItemReference sr = o as SolutionItemReference;

            if (sr == null)
            {
                return(false);
            }
            return((path == sr.path) && (id == sr.id));
        }
Пример #3
0
        public SolutionItem ReadSolutionItem(IProgressMonitor monitor, SolutionItemReference reference, params WorkspaceItem[] workspaces)
        {
            if (reference.Id == null)
            {
                FilePath file = reference.Path.FullPath;
                foreach (WorkspaceItem workspace in workspaces)
                {
                    foreach (SolutionEntityItem eitem in workspace.GetAllSolutionItems <SolutionEntityItem> ())
                    {
                        if (file == eitem.FileName)
                        {
                            return(eitem);
                        }
                    }
                }
                return(ReadSolutionItem(monitor, reference.Path));
            }
            else
            {
                Solution sol = null;
                if (workspaces.Length > 0)
                {
                    FilePath file = reference.Path.FullPath;
                    foreach (WorkspaceItem workspace in workspaces)
                    {
                        foreach (Solution item in workspace.GetAllSolutions())
                        {
                            if (item.FileName.FullPath == file)
                            {
                                sol = item;
                                break;
                            }
                        }
                        if (sol != null)
                        {
                            break;
                        }
                    }
                }
                if (sol == null)
                {
                    sol = ReadWorkspaceItem(monitor, reference.Path) as Solution;
                }

                if (reference.Id == ":root:")
                {
                    return(sol.RootFolder);
                }
                else
                {
                    return(sol.GetSolutionItem(reference.Id));
                }
            }
        }
Пример #4
0
		public SolutionItem ReadSolutionItem (IProgressMonitor monitor, SolutionItemReference reference, params WorkspaceItem[] workspaces)
		{
			if (reference.Id == null) {
				FilePath file = reference.Path.FullPath;
				foreach (WorkspaceItem workspace in workspaces) {
					foreach (SolutionEntityItem eitem in workspace.GetAllSolutionItems<SolutionEntityItem> ())
						if (file == eitem.FileName)
							return eitem;
				}
				return ReadSolutionItem (monitor, reference.Path);
			}
			else {
				Solution sol = null;
				if (workspaces.Length > 0) {
					FilePath file = reference.Path.FullPath;
					foreach (WorkspaceItem workspace in workspaces) {
						foreach (Solution item in workspace.GetAllSolutions ()) {
							if (item.FileName.FullPath == file) {
								sol = item;
								break;
							}
						}
						if (sol != null)
							break;
					}
				}
				if (sol == null)
					sol = ReadWorkspaceItem (monitor, reference.Path) as Solution;
				
				if (reference.Id == ":root:")
					return sol.RootFolder;
				else
					return sol.GetSolutionItem (reference.Id);
			}
		}
		SolutionItem GetEntry (SolutionItemReference reference)
		{
			if (IdeApp.IsInitialized)
				return Services.ProjectService.ReadSolutionItem (new NullProgressMonitor (), reference, IdeApp.Workspace.Items.ToArray ());
			else
				return Services.ProjectService.ReadSolutionItem (new NullProgressMonitor (), reference);
		}
		public void AddEntry (SolutionItem entry)
		{
			SolutionItemReference fp = new SolutionItemReference (entry);
			foreach (SolutionItemReference s in childEntries)
				if (s.Equals (fp))
					return;
			
			if (rootEntry == fp)
				return;
			
			List<SolutionItem> list = new List<SolutionItem> ();
			if (RootSolutionItem != null)
				list.Add (RootSolutionItem);
			list.AddRange (GetChildEntries());
			list.Add (entry);
			
			rootSolutionItem = GetCommonSolutionItem (list);
			list.Remove (rootSolutionItem);
			
			foreach (SolutionItem e in list.ToArray ()) {
				SolutionItem ce = e.ParentFolder;
				while (ce != rootSolutionItem) {
					if (!list.Contains (ce))
						list.Add (ce);
					ce = ce.ParentFolder;
				}
			}
			childCombineEntries = list;
			UpdateEntryNames ();
		}
		void UpdateEntryNames ()
		{
			this.rootEntry = new SolutionItemReference (rootSolutionItem);
			this.childEntries.Clear ();
			foreach (SolutionItem e in childCombineEntries)
				childEntries.Add (new SolutionItemReference (e));
		}
		internal void SetSolutionItem (SolutionItemReference siRoot, SolutionItemReference[] children)
		{
			rootEntry = siRoot;
			childEntries.Clear ();
			foreach (SolutionItemReference e in children)
				childEntries.Add (e);
		}
		public virtual void CopyFrom (PackageBuilder other)
		{
			childEntries = new List<SolutionItemReference> (other.childEntries);
			rootEntry = other.rootEntry;
			md1ChildEntries = other.md1ChildEntries;
			md1RootEntry = other.md1RootEntry;
			
			if (other.childCombineEntries != null)
				childCombineEntries = new List<SolutionItem> (other.childCombineEntries);
			else
				childCombineEntries = null;
			if (other.excludedFiles != null)
				excludedFiles = new List<string> (other.excludedFiles);
			else
				excludedFiles = null;
			rootSolutionItem = other.rootSolutionItem;
		}
Пример #10
0
		public Task<SolutionFolderItem> ReadSolutionItem (ProgressMonitor monitor, SolutionItemReference reference, params WorkspaceItem[] workspaces)
		{
			return Runtime.RunInMainThread (async delegate {
				if (reference.Id == null) {
					FilePath file = reference.Path.FullPath;
					foreach (WorkspaceItem workspace in workspaces) {
						foreach (SolutionItem eitem in workspace.GetAllItems<Solution>().SelectMany (s => s.GetAllSolutionItems ()))
							if (file == eitem.FileName)
								return eitem;
					}
					return await ReadSolutionItem (monitor, reference.Path);
				} else {
					Solution sol = null;
					if (workspaces.Length > 0) {
						FilePath file = reference.Path.FullPath;
						foreach (WorkspaceItem workspace in workspaces) {
							foreach (Solution item in workspace.GetAllItems<Solution>()) {
								if (item.FileName.FullPath == file) {
									sol = item;
									break;
								}
							}
							if (sol != null)
								break;
						}
					}
					if (sol == null)
						sol = await ReadWorkspaceItem (monitor, reference.Path) as Solution;
					
					if (reference.Id == ":root:")
						return sol.RootFolder;
					else
						return sol.GetSolutionItem (reference.Id);
				}
			});
		}