using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace Txgy.RBS.Framework
{
    public class CommonData
    {
        public static string RedisDefaultPath { get; set; } = "program\\server";

        public static string ApmsDefaultPath { get; set; } = "program\\apms\\gw.apms.json";
        public static string RecvDefaultPath { get; set; } = "program\\recvmqtt\\gw.recvmqtt.json";

        public static string RedisPublish { get; set; } = "server_status";


        /// <summary>//From:www.13le.com
        /// 复制文件夹下所有文件
        /// </summary>
        /// <param name="sourceFolder">原文件路径</param>
        /// <param name="destFolder">目标文件路径</param>

        public static void CopyFolder(string sourceFolder, string destFolder)
        {

            //如果目标路径不存在,则创建目标路径
            if (!System.IO.Directory.Exists(destFolder))
            {
                System.IO.Directory.CreateDirectory(destFolder);
            }
            //得到原文件根目录下的所有文件
            string[] files = System.IO.Directory.GetFiles(sourceFolder);
            foreach (string file in files)
            {
                string name = System.IO.Path.GetFileName(file);
                string dest = System.IO.Path.Combine(destFolder, name);
                if (file.Contains("program\\server")) continue;  //server目录文件不复制
                System.IO.File.Copy(file, dest);//复制文件
            }
            //得到原文件根目录下的所有文件夹
            string[] folders = System.IO.Directory.GetDirectories(sourceFolder);
            foreach (string folder in folders)
            {
                string name = System.IO.Path.GetFileName(folder);
                string dest = System.IO.Path.Combine(destFolder, name);
                CopyFolder(folder, dest);//构建目标路径,递归复制文件
            }
        }
          
    }
}
