本文整理汇总了C#中System.IO.StreamReader.get_EndOfStream方法的典型用法代码示例。如果您正苦于以下问题:C# StreamReader.get_EndOfStream方法的具体用法?C# StreamReader.get_EndOfStream怎么用?C# StreamReader.get_EndOfStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.StreamReader
的用法示例。
在下文中一共展示了StreamReader.get_EndOfStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadReesters
public static void LoadReesters(ExtExternalProcessing processing, string fileName)
{
try
{
System.IO.FileInfo info = new System.IO.FileInfo(fileName);
if (!System.IO.File.Exists(info.get_FullName()))
{
throw new System.Exception(string.Format("Файл [{0}] не существует", fileName));
}
if (info.get_Extension().ToLower() == ".dbf")
{
System.Data.DataTable table = DALOdbc.ExecuteDataTable(DbfFormat.dBaseIV, info.get_DirectoryName(), "select * from " + info.get_Name());
if (table.Rows.get_Count() > 0)
{
System.Data.DataTable insertData = new System.Data.DataTable();
insertData.Columns.Add("processingId", System.Type.GetType("System.Int64"));
insertData.Columns.Add("field", System.Type.GetType("System.String"));
insertData.Columns.Add("statusId", System.Type.GetType("System.Int64"));
int id = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
foreach (System.Data.DataRow row in table.Rows)
{
System.Data.DataRow row2 = insertData.NewRow();
row2.set_Item("processingId", (long) processing.Id);
row2.set_Item("statusId", (int) id);
string str = "";
foreach (System.Data.DataColumn column in table.Columns)
{
string str2 = row.get_Item(column).ToString();
if (processing.Encoding != "")
{
System.Text.Encoding encoding = System.Text.Encoding.GetEncoding(processing.Encoding);
str2 = System.Text.Encoding.GetEncoding(0x4e3).GetString(encoding.GetBytes(str2));
}
str2 = str2.Replace(";", "").Replace("=", "");
str = str + column.get_Caption();
str = str + "=";
str = str + str2;
str = str + ';';
}
row2.set_Item("field", str);
insertData.Rows.Add(row2);
}
DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", insertData);
}
}
if (info.get_Extension().ToLower() == ".txt")
{
System.Data.DataTable table3 = new System.Data.DataTable();
table3.Columns.Add("processingId", System.Type.GetType("System.Int64"));
table3.Columns.Add("field", System.Type.GetType("System.String"));
table3.Columns.Add("statusId", System.Type.GetType("System.Int64"));
System.Text.Encoding encoding3 = System.Text.Encoding.GetEncoding(0x362);
if (processing.Encoding != "")
{
encoding3 = System.Text.Encoding.GetEncoding(processing.Encoding);
}
System.IO.StreamReader reader = new System.IO.StreamReader(fileName, encoding3);
int num2 = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
while (!reader.get_EndOfStream())
{
string str3 = reader.ReadLine();
System.Data.DataRow row3 = table3.NewRow();
row3.set_Item("processingId", (long) processing.Id);
row3.set_Item("statusId", (int) num2);
row3.set_Item("field", str3);
table3.Rows.Add(row3);
}
DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", table3);
}
if (info.get_Extension().ToLower() == ".csv")
{
System.Data.DataTable table4 = new System.Data.DataTable();
table4.Columns.Add("processingId", System.Type.GetType("System.Int64"));
table4.Columns.Add("field", System.Type.GetType("System.String"));
table4.Columns.Add("statusId", System.Type.GetType("System.Int64"));
System.IO.StreamReader reader2 = new System.IO.StreamReader(fileName, System.Text.Encoding.GetEncoding(0x4e3));
int num3 = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
while (!reader2.get_EndOfStream())
{
string str4 = reader2.ReadLine();
System.Data.DataRow row4 = table4.NewRow();
row4.set_Item("processingId", (long) processing.Id);
row4.set_Item("statusId", (int) num3);
row4.set_Item("field", str4);
table4.Rows.Add(row4);
}
DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", table4);
}
if (info.get_Extension() == ".xml")
{
System.Data.DataTable table5 = new System.Data.DataTable();
table5.Columns.Add("processingId", System.Type.GetType("System.Int64"));
table5.Columns.Add("field", System.Type.GetType("System.String"));
table5.Columns.Add("statusId", System.Type.GetType("System.Int64"));
System.IO.StreamReader reader3 = new System.IO.StreamReader(fileName, System.Text.Encoding.GetEncoding(0x4e3));
int num4 = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
string str5 = reader3.ReadToEnd();
System.Data.DataRow row5 = table5.NewRow();
row5.set_Item("processingId", (long) processing.Id);
row5.set_Item("statusId", (int) num4);
//.........这里部分代码省略.........