本文整理汇总了C#中System.IO.StreamWriter.WriteDsvField方法的典型用法代码示例。如果您正苦于以下问题:C# StreamWriter.WriteDsvField方法的具体用法?C# StreamWriter.WriteDsvField怎么用?C# StreamWriter.WriteDsvField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.StreamWriter
的用法示例。
在下文中一共展示了StreamWriter.WriteDsvField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranscribeAndModifyFile
private static List<string> TranscribeAndModifyFile(StreamWriter writer, TextReader reader, List<string> fields, bool first, int currentFileCount)
{
var fileReader = new DsvFileReader(reader, SEPARATOR);
if (first)
{
fields = fileReader.FieldNames;
for (int i = 0; i < fields.Count; ++i)
{
if (i > 0)
writer.Write(SEPARATOR);
writer.WriteDsvField(fileReader.FieldNames[i], SEPARATOR);
}
writer.WriteLine();
}
Debug.Assert(Equals(fileReader.NumberOfFields, fields.Count));
for (int i = 0; i < fields.Count; ++i)
{
Debug.Assert(Equals(fileReader.FieldNames[i], fields[i]));
}
while (fileReader.ReadLine() != null)
{
for (int i = 0; i < fields.Count; ++i)
{
string modifiedField = fileReader.GetFieldByIndex(i);
switch (fileReader.FieldNames[i])
{
case FILE_NAME:
modifiedField = Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(modifiedField)) + MS_FILE_TYPE;
break;
case TRANSITION_GROUP:
modifiedField = modifiedField + currentFileCount;
break;
case RUN_ID:
modifiedField = currentFileCount.ToString(CultureInfo.CurrentCulture);
break;
}
if (i > 0)
writer.Write(SEPARATOR);
writer.WriteDsvField(modifiedField, SEPARATOR);
}
writer.WriteLine();
}
return fields;
}