public static void ClearDirectory(string path)
 {
     if (Directory.Exists(path))
     {
         EditFileOpeUtils.RemoveDirectory(new DirectoryInfo(path));
     }
     Directory.CreateDirectory(path);
 }
Beispiel #2
0
    public static void PushServerFile()
    {
        BuildServerFile();
        DirectoryInfo dirInfo        = new DirectoryInfo(Application.dataPath);
        string        sourceFilePath = Path.Combine(dirInfo.Parent.Parent.FullName, "ResServer");
        string        targetFilePath = string.Empty;

                #if UNITY_STANDALONE_WIN
        DirectoryInfo directoryInfo = new DirectoryInfo(Application.dataPath);
        targetFilePath = Path.Combine(directoryInfo.Parent.Parent.Parent.FullName, "Tools");
        targetFilePath = Path.Combine(targetFilePath, "LegionBattle");
                #elif UNITY_STANDALONE_OSX
        targetFilePath = "/Library/WebServer/Documents/LegionBattle";
                #endif
        EditFileOpeUtils.ClearDirectory(targetFilePath);
        EditFileOpeUtils.CopyDirectory(new DirectoryInfo(sourceFilePath), targetFilePath, new HashSet <string>()
        {
            ".DS_Store"
        });
    }
Beispiel #3
0
    private static void ExportFileSystem(bool isServerBuild, string targetFileRootPath, string sourceFileRootPath)
    {
        Dictionary <string, NewFileSystem.FileDetailInfo> fileListDic = new Dictionary <string, NewFileSystem.FileDetailInfo> ();
        string targetFileDataFolder = Path.Combine(targetFileRootPath, NewFileSystem.FileDownloadData.DataFolder);

        if (isServerBuild && Directory.Exists(targetFileDataFolder))
        {
            DirectoryInfo targetDirInfo = new DirectoryInfo(targetFileDataFolder);
            EditFileOpeUtils.RemoveDirectory(targetDirInfo);
        }
        DirectoryInfo directoryInfo = Directory.CreateDirectory(sourceFileRootPath);

        SeachDirectoryFIles(fileListDic, directoryInfo, string.Empty, targetFileDataFolder, isServerBuild);

        string fileListContent = NewFileSystem.FileListUtils.FileListToString(fileListDic);

        File.WriteAllText(Path.Combine(targetFileRootPath, NewFileSystem.FileDownloadData.FileListFileName), fileListContent);

        if (isServerBuild)
        {
            string fileListMd5 = Utils.MD5(fileListContent);
            File.WriteAllText(Path.Combine(targetFileRootPath, NewFileSystem.FileDownloadData.VersionFileName), fileListMd5);
        }
    }