Example #1
0
        /// <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);
        }
Example #2
0
        private static void WriteStrDataToFile(string filePath, string[,] data)
        {
            string strData = FileUtil.BuildStringData(data.GetEnumerator(), data.GetLength(0), data.GetLength(1), StrDelims);

            FileUtil.WriteStrToFile(filePath, strData, Encode);
        }