コード例 #1
0
        /// <summary>
        /// 写一个表
        /// </summary>
        /// <param name="storage"></param>
        /// <param name="directory"></param>
        /// <param name="isOverWrite">是否覆盖</param>
        public static void WriteTable(ObjectTableStorage storage, string directory, bool isOverWrite = true)
        {
            var OutputPath = Path.Combine(directory, storage.Name);

            if (!OutputPath.EndsWith(TableExtention, StringComparison.CurrentCultureIgnoreCase))
            {
                OutputPath += TableExtention;
            }

            if (!isOverWrite && File.Exists(OutputPath))
            {
                storage.log.Warn("忽略了已存在文件 " + OutputPath);
                return;
            }

            var writer = new ObjectTableWriter(OutputPath);

            writer.Write(storage);
            writer.CloseStream();
        }