本文整理匯總了C#中System.IO.TempFile.Write方法的典型用法代碼示例。如果您正苦於以下問題:C# TempFile.Write方法的具體用法?C# TempFile.Write怎麽用?C# TempFile.Write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.TempFile
的用法示例。
在下文中一共展示了TempFile.Write方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddComment
private void AddComment(string comment, ref string args, out TempFile tempFile)
{
tempFile = null;
if (!string.IsNullOrEmpty(comment))
{
// need to use a temporary file to specify the comment when not
// using the system default code page or it contains newlines
if (commitEncoding.CodePage != Encoding.Default.CodePage || comment.IndexOf('\n') >= 0)
{
Logger.WriteLine("Generating temp file for comment: {0}", comment);
tempFile = new TempFile();
tempFile.Write(comment, commitEncoding);
// temporary path might contain spaces (e.g. "Documents and Settings")
args += " -F " + Quote(tempFile.Name);
}
else
{
args += " -m " + Quote(comment);
}
}
}
示例2: GetCommentOption
private string GetCommentOption(string comment, out TempFile tempFile)
{
if (comment.StartsWith("-"))
{
tempFile = new TempFile();
tempFile.Write(comment, Encoding.UTF8);
return "-F " + Quote(tempFile.Name);
}
else
{
tempFile = null;
return "-m " + Quote(comment);
}
}