MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectService.GetExtensionForItem C# (CSharp) Method

GetExtensionForItem() static private method

static private GetExtensionForItem ( SolutionEntityItem item ) : string
item SolutionEntityItem
return string
		internal static string GetExtensionForItem (SolutionEntityItem item)
		{
			foreach (DotNetProjectSubtypeNode node in GetItemSubtypeNodes ()) {
				if (!string.IsNullOrEmpty (node.Extension) && node.CanHandleItem (item))
					return node.Extension;
			}
			foreach (ItemTypeNode node in GetItemTypeNodes ()) {
				if (node.CanHandleItem (item)) {
					return node.Extension;
				}
			}
			// The generic handler should always be found
			throw new InvalidOperationException ();
		}
		

Usage Example

Exemplo n.º 1
0
 public FilePath GetValidFormatName(object obj, FilePath fileName)
 {
     if (slnFileFormat.CanWriteFile(obj, this))
     {
         return(slnFileFormat.GetValidFormatName(obj, fileName, this));
     }
     else
     {
         string ext = MSBuildProjectService.GetExtensionForItem((SolutionEntityItem)obj);
         if (!string.IsNullOrEmpty(ext))
         {
             return(fileName.ChangeExtension("." + ext));
         }
         else
         {
             return(fileName);
         }
     }
 }