Exemple #1
0
        /// <summary>
        /// 获取写日志的路径
        /// </summary>
        /// <returns></returns>
        public override string GetLogPath()
        {
            var dir = PathMg.CheckPath(Log.LogDirectory, "System");

            DirectoryHelper.CreateDirectory(dir);//创建目录
            return(PathMg.CheckPath(dir, LogFileName + Log.LogFileExt));
        }
Exemple #2
0
        /// <summary>
        /// 对文件夹进行拷贝
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void CopyDirectory(string source, string target, params string[] withoutdirs)
        {
            source = source.Trim('\\').Trim();
            if (!System.IO.Directory.Exists(source))
            {
                return;
            }

            string[] files = System.IO.Directory.GetFiles(source, "*.*");
            foreach (string file in files)
            {
                if (!System.IO.File.Exists(file))
                {
                    continue;
                }
                string newfile = System.IO.Path.Combine(target, file.Substring(source.Length).Trim('\\'));
                FileHelper.CopyFile(file, newfile);
            }

            string[] dirs = System.IO.Directory.GetDirectories(source, "*.*");
            foreach (string dir in dirs)
            {
                String dirName = System.IO.Path.GetFileName(dir);
                if (withoutdirs != null && StrInArray(withoutdirs, dirName, true))
                {
                    continue;
                }
                String TargetDir = PathMg.CheckPath(target, dirName);
                CreateDirectory(TargetDir);

                CopyDirectory(dir, TargetDir, withoutdirs);//递归拷贝
            }
        }
Exemple #3
0
 /// <summary>
 /// 获取写日志的路径
 /// </summary>
 /// <returns></returns>
 public override string GetLogPath()
 {
     DirectoryHelper.CreateDirectory(Log.LogDirectory);//创建目录
     return(PathMg.CheckPath(Log.LogDirectory, LogFileName + Log.LogFileExt));
 }