public static ushort[,] ReadUShortData(string filePath, uint startRow, uint[] columns, uint rowCount = 0, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <ushort>(filePath, startRow, columns, rowCount, encoding)); }
public static uint[,] ReadUIntData(string filePath, uint startRow = 0, uint startColumn = 0, uint rowCount = 0, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <uint>(filePath, startRow, startColumn, rowCount, encoding)); }
/// <summary> /// 在csv文件中设置起始索引值,读取二维数组,需配置文件路径。 /// </summary> /// <param name="startRow">要读取的起始行索引</param> /// <param name="filePath">csv文件路径和名称</param> /// <param name="startColumn">要读取的起始列索引</param> /// <param name="rowSize">要读取的行数,若为-1则读取全部行</param> /// <param name="columnSize">要读取的列数,若为-1则读取全部列</param> /// <param name="encoding">编码方式</param> /// <returns></returns> public static T[,] Read <T>(string filePath, long startRow = 0, long startColumn = 0, long rowSize = -1, long columnSize = -1, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <T>(filePath, startRow, startColumn, rowSize, columnSize, encoding)); }
/// <summary> /// 在csv文件中设置要读取的行列索引值数组,读取二维数组,需配置文件路径。 /// </summary> /// <param name="filePath">csv文件路径和名称</param> /// <param name="rowCollection">要读取的行的索引集合</param> /// <param name="columnCollection">要读取的列的索引集合</param> /// <param name="encoding">编码方式</param> /// <returns></returns> public static T[,] Read <T>(string filePath, long[] rowCollection, long[] columnCollection, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <T>(filePath, rowCollection, columnCollection, encoding)); }
/// <summary> /// 在csv文件中设置要读取的行列索引值,读取一维数组,需配置文件路径。 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="filePath">csv文件路径和名称</param> /// <param name="majorOrder">读取数值的方向</param> /// <param name="index">读取的行/列索引值</param> /// <param name="startPosition">要读取的行/列的起始索引位置</param> /// <param name="size">读取的数组长度,若为-1则读取全部</param> /// <param name="encoding">编码方式</param> /// <returns></returns> public static T[] Read <T>(string filePath, MajorOrder majorOrder, long index, long startPosition = 0, long size = -1, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <T>(filePath, index, startPosition, size, MajorOrder.Column == majorOrder, encoding)); }
/// <summary> /// 在bin文件中读取数据为二维string数组。 /// Read data from binary file as two dimensional string array. /// <param name="filePath"> /// <para>The full path of the file to read.</para> /// <para>Chinese Simplified:待读取文件的完整路径。</para> /// </param> /// <param name="colNum"> /// <para>The column count of read data.</para> /// <para>Chinese Simplified:读出数组的列数。</para> /// </param> /// <returns > /// <para>The read two dimensional double array</para> /// <para>Chinese Simplified:读取后的二维double数组</para> /// </returns> /// </summary> public static double[,] ReadDoubleData(string filePath, int colNum) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <double>(filePath, colNum)); }
/// <summary> /// 在bin文件中写入double类型一维数据,通过弹窗选择文件路径 /// Write one dimensional data to binary file. /// <param name="filePath"> /// <para>The full path of the file to write.</para> /// <para>Chinese Simplified:待写入文件的完整路径。</para> /// </param> /// <param name="data"> /// <para>One dimension datas to be write.</para> /// <para>Chinese Simplified:待写入文件的一维数组</para> /// </param> /// <param name="writeMode"> /// <para>Write Mode when file exist.</para> /// <para>Chinese Simplified:文件已存在时的写入模式</para> /// </param> /// </summary> public static void WriteData(string filePath, short[] data, WriteMode writeMode = WriteMode.OverLap) { FileUtil.CheckFilePath(filePath, FileExtName); FileUtil.CheckDataSize(data); StreamWriteData(filePath, data, data.Length * sizeof(short), writeMode); }
/// <summary> /// 在bin文件中读取数据为二维string数组。 /// Read data from binary file as two dimensional string array. /// <param name="filePath"> /// <para>The full path of the file to read.</para> /// <para>Chinese Simplified:待读取文件的完整路径。</para> /// </param> /// <returns > /// <para>The read two dimensional double array</para> /// <para>Chinese Simplified:读取后的二维double数组</para> /// </returns> /// </summary> public static ushort[] ReadUShortData(string filePath) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <ushort>(filePath)); }
/// <summary> /// 在bin文件中写入string类型二维数据 /// Write two dimensional data to binary file. /// <param name="filePath"> /// <para>The full path of the file to write.</para> /// <para>Chinese Simplified:待写入文件的完整路径。</para> /// </param> /// <param name="data"> /// <para>One dimension datas to be write.</para> /// <para>Chinese Simplified:待写入文件的一维数组</para> /// </param> /// <param name="writeMode"> /// <para>Write Mode when file exist.</para> /// <para>Chinese Simplified:文件已存在时的写入模式</para> /// </param> /// </summary> public static void WriteData(string filePath, string[,] data, WriteMode writeMode = WriteMode.OverLap) { FileUtil.CheckFilePath(filePath, FileExtName); FileUtil.CheckDataSize(data); WriteStrDataToFile(filePath, data); }
/// <summary> /// 在bin文件中读取数据为二维string数组。 /// Read data from binary file as two dimensional string array. /// <param name="filePath"> /// <para>The full path of the file to read.</para> /// <para>Chinese Simplified:待读取文件的完整路径。</para> /// </param> /// <returns > /// <para>The read two dimensional double array</para> /// <para>Chinese Simplified:读取后的二维double数组</para> /// </returns> /// </summary> public static int[] ReadIntData(string filePath) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <int>(filePath)); }
/// <summary> /// 在bin文件中读取数据为二维double数组。 /// Read data from binary file as two dimensional double array. /// <param name="filePath"> /// <para>The full path of the file to read.</para> /// <para>Chinese Simplified:待读取文件的完整路径。</para> /// </param> /// <returns > /// <para>The read two dimensional string array</para> /// <para>Chinese Simplified:读取后的二维string数组</para> /// </returns> /// </summary> public static string[] ReadData(string filePath) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadStr(filePath)); }
/// <summary> /// 在bin文件中读取数据为二维string数组。 /// Read data from binary file as two dimensional string array. /// <param name="filePath"> /// <para>The full path of the file to read.</para> /// <para>Chinese Simplified:待读取文件的完整路径。</para> /// </param> /// <param name="colNum"> /// <para>The column count of read data.</para> /// <para>Chinese Simplified:读出数组的列数。</para> /// </param> /// <returns > /// <para>The read two dimensional double array</para> /// <para>Chinese Simplified:读取后的二维double数组</para> /// </returns> /// </summary> public static short[,] ReadShortData(string filePath, int colNum) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <short>(filePath, colNum)); }
/// <summary> /// 在csv文件中写入数据,通过弹窗选择文件路径,需配置文件路径 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="filePath">待写入文件的完整路径和名称</param> /// <param name="data">待写入文件的二维数组</param> /// <param name="writeMode">文件已存在时的写入模式</param> /// <param name="encoding">文件的编码格式。encoding为null时使用系统默认的编码格式</param> public static void WriteData <T>(string filePath, T[,] data, WriteMode writeMode = WriteMode.OverLap, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); StreamWriteData(filePath, data.GetEnumerator(), data.GetLength(0), data.GetLength(1), writeMode, encoding); }
/// <summary> /// 在csv文件中设置要读取的行列索引值,读取一维数组,需配置文件路径。 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="filePath">csv文件路径和名称</param> /// <param name="majorOrder">读取数值的方向</param> /// <param name="index">读取的行/列索引值</param> /// <param name="startIndex">要读取的行/列的起始索引位置</param> /// <param name="readCount">读取的数组长度,若小于等于0则读取全部</param> /// <param name="encoding">编码方式</param> /// <returns></returns> public static T[] Read <T>(string filePath, MajorOrder majorOrder, long index, long startIndex = 0, long readCount = 0, Encoding encoding = null) { FileUtil.CheckFilePath(filePath, FileExtName); return(StreamReadData <T>(filePath, index, startIndex, readCount, MajorOrder.Column == majorOrder, encoding)); }