Sry.Solution.Components/FileHelper.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace ChangeHope.Common
{
    using System;
    using System.IO;
    using System.Text;

    public class FileHelper
    {
        private Encoding defaultEncoding = Encoding.UTF8;
        private int directoryIndex = 0;
        public StringBuilder fileTree = new StringBuilder();
        private int listIndex = 0;
        public string rootUrl = "";

        public bool CopyFile(string FileOldPath, string FileNewPath, bool IsReplaceFile)
        {
            try
            {
                if (File.Exists(FileOldPath))
                {
                    if (!File.Exists(FileNewPath))
                    {
                        if (!File.Exists(FileNewPath.Substring(0, FileNewPath.LastIndexOf(@"\"))))
                        {
                            this.CreateDirectory(FileNewPath.Substring(0, FileNewPath.LastIndexOf(@"\")));
                        }
                        File.Copy(FileOldPath, FileNewPath);
                        return true;
                    }
                    if (IsReplaceFile)
                    {
                        File.Delete(FileNewPath);
                        File.Copy(FileOldPath, FileNewPath);
                        return true;
                    }
                }
                return false;
            }
            catch
            {
                return false;
            }
        }

        public bool CreateDirectory(string filePath)
        {
            try
            {
                if (!Directory.Exists(filePath))
                {
                    DirectoryInfo di = Directory.CreateDirectory(filePath);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }

后面还有 231 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。