本文整理汇总了C#中ITaskItem.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# ITaskItem.GetLength方法的具体用法?C# ITaskItem.GetLength怎么用?C# ITaskItem.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITaskItem
的用法示例。
在下文中一共展示了ITaskItem.GetLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertFileReferencesToComReferenceInfo
private void ConvertFileReferencesToComReferenceInfo(List<ComReferenceInfo> projectRefs, ITaskItem[] tlbFiles)
{
int num = (tlbFiles == null) ? 0 : tlbFiles.GetLength(0);
for (int i = 0; i < num; i++)
{
string itemSpec = tlbFiles[i].ItemSpec;
if (!Path.IsPathRooted(itemSpec))
{
itemSpec = Path.Combine(Directory.GetCurrentDirectory(), itemSpec);
}
ComReferenceInfo item = new ComReferenceInfo();
try
{
if (item.InitializeWithPath(base.Log, itemSpec, tlbFiles[i], this.TargetProcessorArchitecture))
{
projectRefs.Add(item);
}
else
{
item.ReleaseTypeLibPtr();
}
}
catch (COMException exception)
{
base.Log.LogWarningWithCodeFromResources("ResolveComReference.CannotLoadTypeLibItemSpec", new object[] { tlbFiles[i].ItemSpec, exception.Message });
item.ReleaseTypeLibPtr();
}
}
}
示例2: ConvertFileReferencesToComReferenceInfo
/*
* Method: ConvertFileReferencesToComReferenceInfo
*
* Helper method. Converts TypeLibFiles references to ComReferenceInfo objects
* This method cannot fail, since we want to proceed with the task even if some references won't load.
*/
private void ConvertFileReferencesToComReferenceInfo(List<ComReferenceInfo> projectRefs, ITaskItem[] tlbFiles)
{
int tlbFilesLength = (tlbFiles == null) ? 0 : tlbFiles.GetLength(0);
for (int i = 0; i < tlbFilesLength; i++)
{
string refPath = tlbFiles[i].ItemSpec;
if (!Path.IsPathRooted(refPath))
refPath = Path.Combine(Directory.GetCurrentDirectory(), refPath);
ComReferenceInfo projectRefInfo = new ComReferenceInfo();
try
{
if (projectRefInfo.InitializeWithPath(Log, Silent, refPath, tlbFiles[i], this.TargetProcessorArchitecture))
{
projectRefs.Add(projectRefInfo);
}
else
{
projectRefInfo.ReleaseTypeLibPtr();
}
}
catch (COMException ex)
{
if (!Silent)
{
Log.LogWarningWithCodeFromResources("ResolveComReference.CannotLoadTypeLibItemSpec", tlbFiles[i].ItemSpec, ex.Message);
}
projectRefInfo.ReleaseTypeLibPtr();
// we don't want to fail the task if one of the references is not registered, so just continue
}
}
}
示例3: ConvertAttrReferencesToComReferenceInfo
private void ConvertAttrReferencesToComReferenceInfo(List<ComReferenceInfo> projectRefs, ITaskItem[] typeLibAttrs)
{
int num = (typeLibAttrs == null) ? 0 : typeLibAttrs.GetLength(0);
for (int i = 0; i < num; i++)
{
ComReferenceInfo item = new ComReferenceInfo();
try
{
if (item.InitializeWithTypeLibAttrs(base.Log, TaskItemToTypeLibAttr(typeLibAttrs[i]), typeLibAttrs[i], this.TargetProcessorArchitecture))
{
projectRefs.Add(item);
}
else
{
item.ReleaseTypeLibPtr();
}
}
catch (COMException exception)
{
base.Log.LogWarningWithCodeFromResources("ResolveComReference.CannotLoadTypeLibItemSpec", new object[] { typeLibAttrs[i].ItemSpec, exception.Message });
item.ReleaseTypeLibPtr();
}
}
}
示例4: ConvertAttrReferencesToComReferenceInfo
/*
* Method: ConvertAttrReferencesToComReferenceInfo
*
* Helper method. Converts TypeLibAttr references to ComReferenceInfo objects.
* This method cannot fail, since we want to proceed with the task even if some references won't load.
*/
private void ConvertAttrReferencesToComReferenceInfo(List<ComReferenceInfo> projectRefs, ITaskItem[] typeLibAttrs)
{
int typeLibAttrsLength = (typeLibAttrs == null) ? 0 : typeLibAttrs.GetLength(0);
for (int i = 0; i < typeLibAttrsLength; i++)
{
ComReferenceInfo projectRefInfo = new ComReferenceInfo();
try
{
if (projectRefInfo.InitializeWithTypeLibAttrs(Log, Silent, TaskItemToTypeLibAttr(typeLibAttrs[i]), typeLibAttrs[i], this.TargetProcessorArchitecture))
{
projectRefs.Add(projectRefInfo);
}
else
{
projectRefInfo.ReleaseTypeLibPtr();
}
}
catch (COMException ex)
{
if (!Silent)
{
Log.LogWarningWithCodeFromResources("ResolveComReference.CannotLoadTypeLibItemSpec", typeLibAttrs[i].ItemSpec, ex.Message);
}
projectRefInfo.ReleaseTypeLibPtr();
// we don't want to fail the task if one of the references is not registered, so just continue
}
}
}