本文整理汇总了C#中ITaskItem.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ITaskItem.ToString方法的具体用法?C# ITaskItem.ToString怎么用?C# ITaskItem.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITaskItem
的用法示例。
在下文中一共展示了ITaskItem.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendFileNameIfNotNull
public void AppendFileNameIfNotNull (ITaskItem fileItem)
{
if (fileItem == null)
return;
string filename = fileItem.ToString ();
VerifyThrowNoEmbeddedDoubleQuotes (null, filename);
AppendSpaceIfNotEmpty ();
AppendFileNameWithQuoting (filename);
}
示例2: GetSpecial
string GetSpecial(string name, object value, ITaskItem input)
{
// ToLower is affected by localization. Need to be careful here.
name = name.ToLower(new CultureInfo("en-US", false));
if (value == null)
{
if (name == "inputfilename")
{
return Path.GetFileName(input.ItemSpec);
}
else if (name == "inputabsdir")
{
return Path.GetDirectoryName(Path.GetFullPath(input.ToString()));
}
else if (name == "dependencyfile")
{
return GetSpecial("objectfilename", ObjectFileName, input) + ".d";
}
else if (name == "dependencysource")
{
return GetSpecial("objectfilename", ObjectFileName, input);
}
}
if (name == "objectfilename")
{
if (value.ToString().Last() == '\\' || value.ToString().Last() == '/')
{
return value + DecorateFile(input.ItemSpec, ".obj");
}
}
else if (name == "input")
{
return GetFullPath(input.ToString());
}
return value == null ? null : value.ToString();
}
示例3: GetSpecial
string GetSpecial(string name, object value, ITaskItem input)
{
if (value == null)
{
if (name == "inputfilename")
{
return Path.GetFileName(input.ItemSpec);
}
else if (name == "inputabsdir")
{
return Path.GetDirectoryName(Path.GetFullPath(input.ToString()));
}
else if (name == "dependencyfile")
{
return GetSpecial("objectfilename", ObjectFileName, input) + ".d";
}
else if (name == "dependencysource")
{
return GetSpecial("objectfilename", ObjectFileName, input);
}
}
if (name == "objectfilename")
{
if (value.ToString().Last() == '\\' || value.ToString().Last() == '/')
{
return value + DecorateFile(input.ItemSpec, ".obj");
}
}
else if (name == "input")
{
return GetFullPath(input.ToString());
}
return value == null ? null : value.ToString();
}
示例4: AppendSwitchIfNotNull
public void AppendSwitchIfNotNull (string switchName,
ITaskItem parameter)
{
if (switchName == null)
throw new ArgumentNullException (null, "Parameter \"switchName\" cannot be null.");
if (parameter == null)
return;
string value = parameter.ToString ();
VerifyThrowNoEmbeddedDoubleQuotes (switchName, value);
AppendSpaceIfNotEmpty ();
commandLine.Append (switchName);
AppendTextWithQuoting (value);
}
示例5: GenerateCommandLineForSource
protected string GenerateCommandLineForSource(ITaskItem sourceFile,
bool fullOutputName=false)
{
StringBuilder commandLine = new StringBuilder(GCCUtilities.s_CommandLineLength);
//build command line from components and add required switches
string props = xamlParser.Parse(sourceFile, fullOutputName, null);
commandLine.Append(props);
commandLine.Append(" -c");
// Remove rtti items as they are not relevant in C compilation and will
// produce warnings
if (SourceIsC(sourceFile.ToString()))
{
commandLine.Replace("-fno-rtti", "");
commandLine.Replace("-frtti", "");
}
if (ConfigurationType == "DynamicLibrary")
{
commandLine.Append(" -fPIC");
}
return commandLine.ToString();
}