Пример #1
0
        public virtual void InitializeHandler(SolutionEntityItem item)
        {
            MSBuildProjectHandler h = (MSBuildProjectHandler)ProjectExtensionUtil.GetItemHandler(item);

            UpdateImports(item, h.TargetImports);
            h.SubtypeGuids.Add(guid);
        }
Пример #2
0
        protected virtual MSBuildHandler OnCreateHandler(string fileName, string itemGuid)
        {
            MSBuildHandler h;

            if (!string.IsNullOrEmpty(handlerType))
            {
                h = Addin.CreateInstance(handlerType, true) as MSBuildHandler;
                if (h == null)
                {
                    throw new InvalidOperationException("Type '" + handlerType + "' must be a subclass of 'MonoDevelop.Projects.Formats.MSBuild.MSBuildHandler'");
                }
                if (h is MSBuildProjectHandler)
                {
                    ((MSBuildProjectHandler)h).Initialize(Guid, Import, itemGuid);
                }
                else
                {
                    h.Initialize(Guid, itemGuid);
                }
            }
            else
            {
                h = new MSBuildProjectHandler(Guid, Import, itemGuid);
            }
            return(h);
        }
        public override SolutionEntityItem LoadSolutionItem(IProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string itemGuid)
        {
            MSBuildProjectHandler handler = CreateHandler <MSBuildProjectHandler> (fileName, itemGuid);

            handler.SetCustomResourceHandler(GetResourceHandler());
            return(handler.Load(monitor, fileName, expectedFormat, language, null));
        }
        public virtual void InitializeHandler(SolutionEntityItem item)
        {
            MSBuildProjectHandler h = (MSBuildProjectHandler)ProjectExtensionUtil.GetItemHandler(item);

            UpdateImports(item, h.TargetImports);
            h.SubtypeGuids.Add(guid);
            h.UseMSBuildEngineByDefault |= UseXBuild;
            h.RequireMSBuildEngine      |= RequireXBuild;
        }
        public virtual void InitializeHandler(SolutionEntityItem item)
        {
            MSBuildProjectHandler h = (MSBuildProjectHandler)ProjectExtensionUtil.GetItemHandler(item);

            if (!string.IsNullOrEmpty(import))
            {
                h.TargetImports.AddRange(import.Split(':'));
            }
            if (!string.IsNullOrEmpty(exclude))
            {
                foreach (string e in exclude.Split(':'))
                {
                    h.TargetImports.Remove(e);
                }
            }
            h.SubtypeGuids.Add(guid);
        }
Пример #6
0
 public void WriteFile(FilePath file, object obj, IProgressMonitor monitor)
 {
     if (slnFileFormat.CanWriteFile(obj, this))
     {
         slnFileFormat.WriteFile(file, obj, this, true, monitor);
     }
     else
     {
         SolutionEntityItem item = (SolutionEntityItem)obj;
         if (!(item.ItemHandler is MSBuildProjectHandler))
         {
             MSBuildProjectService.InitializeItemHandler(item);
         }
         MSBuildProjectHandler handler = (MSBuildProjectHandler)item.ItemHandler;
         handler.SetSolutionFormat(this, false);
         handler.Save(monitor);
     }
 }
Пример #7
0
        public static SolutionEntityItem LoadItem(IProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
        {
            foreach (ItemTypeNode node in GetItemTypeNodes())
            {
                if (node.CanHandleFile(fileName, typeGuid))
                {
                    return(node.LoadSolutionItem(monitor, fileName, expectedFormat, itemGuid));
                }
            }

            if (string.IsNullOrEmpty(typeGuid) && IsProjectSubtypeFile(fileName))
            {
                typeGuid = LoadProjectTypeGuids(fileName);
                foreach (ItemTypeNode node in GetItemTypeNodes())
                {
                    if (node.CanHandleFile(fileName, typeGuid))
                    {
                        return(node.LoadSolutionItem(monitor, fileName, expectedFormat, itemGuid));
                    }
                }
            }

            // If it is a known unsupported project, load it as UnknownProject
            var projectInfo = MSBuildProjectService.GetUnknownProjectTypeInfo(typeGuid != null ? new [] { typeGuid } : new string[0], fileName);

            if (projectInfo != null && projectInfo.LoadFiles)
            {
                if (typeGuid == null)
                {
                    typeGuid = projectInfo.Guid;
                }
                var h = new MSBuildProjectHandler(typeGuid, "", itemGuid);
                h.SetUnsupportedType(projectInfo);
                return(h.Load(monitor, fileName, expectedFormat, "", null));
            }

            return(null);
        }
Пример #8
0
        public override SolutionEntityItem LoadSolutionItem(IProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string itemGuid)
        {
            MSBuildProjectHandler handler = new MSBuildProjectHandler(Guid, Import, itemGuid);

            return(handler.Load(monitor, fileName, expectedFormat, null, null));
        }
Пример #9
0
        public override SolutionEntityItem LoadSolutionItem(IProgressMonitor monitor, string fileName, string itemGuid)
        {
            MSBuildProjectHandler handler = CreateHandler <MSBuildProjectHandler> (fileName, itemGuid);

            return(handler.Load(monitor, fileName, null, ItemType));
        }
Пример #10
0
		public override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string itemGuid)
		{
			MSBuildProjectHandler handler = new MSBuildProjectHandler (Guid, Import, itemGuid);
			return handler.Load (monitor, fileName, expectedFormat, null, null);
		}
Пример #11
0
		public static SolutionEntityItem LoadItem (IProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
		{
			foreach (ItemTypeNode node in GetItemTypeNodes ()) {
				if (node.CanHandleFile (fileName, typeGuid))
					return node.LoadSolutionItem (monitor, fileName, expectedFormat, itemGuid);
			}
			
			if (string.IsNullOrEmpty (typeGuid) && IsProjectSubtypeFile (fileName)) {
				typeGuid = LoadProjectTypeGuids (fileName);
				foreach (ItemTypeNode node in GetItemTypeNodes ()) {
					if (node.CanHandleFile (fileName, typeGuid))
						return node.LoadSolutionItem (monitor, fileName, expectedFormat, itemGuid);
				}
			}

			// If it is a known unsupported project, load it as UnknownProject
			var projectInfo = MSBuildProjectService.GetUnknownProjectTypeInfo (typeGuid != null ? new [] { typeGuid } : new string[0], fileName);
			if (projectInfo != null && projectInfo.LoadFiles) {
				if (typeGuid == null)
					typeGuid = projectInfo.Guid;
				var h = new MSBuildProjectHandler (typeGuid, "", itemGuid);
				h.SetUnsupportedType (projectInfo);
				return h.Load (monitor, fileName, expectedFormat, "", null);
			}

			return null;
		}