/// <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, uint[] data, WriteMode writeMode = WriteMode.OverLap) { FileUtil.CheckFilePath(filePath, FileExtName); FileUtil.CheckDataSize(data); StreamWriteData(filePath, data, data.Length * sizeof(uint), writeMode); }
/// <summary> /// 在bin文件中写入double类型二维数据 /// 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, short[,] data, WriteMode writeMode = WriteMode.OverLap) { FileUtil.CheckFilePath(filePath, FileExtName); FileUtil.CheckDataSize(data); StreamWriteData(filePath, data, data.Length * sizeof(short), writeMode); // byte[] dataBuf = FileUtil.BuildByteData(data); // WriteBinFile(filePath, dataBuf); }
/// <summary> /// 在bin文件中写入string类型一维数据,通过弹窗选择文件路径 /// 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, string[] data, WriteMode writeMode = WriteMode.OverLap) { FileUtil.CheckFilePath(filePath, FileExtName); FileUtil.CheckDataSize(data); //一维数组需要被转换为1列n行的形式 string strData = FileUtil.BuildStringData(data.GetEnumerator(), data.Length, 1, StrDelims); FileUtil.WriteStrToFile(filePath, strData, Encode); }
/// <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); }