using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
using UnityEditor;
|
using UnityEngine;
|
|
public class TableTool : EditorWindow
|
{
|
|
public static string configOutPutPath;
|
|
|
|
public static void CopyConfigsToOutPutPath(string _outPath)
|
{
|
configOutPutPath = _outPath;
|
var root1 = UnityEngine.Application.dataPath + "/ResourcesOut/Config";
|
var configFiles = new List<FileInfo>();
|
configFiles.AddRange(FileExtersion.GetFileInfos(root1, new string[] { "*.txt", "*.TXT" }));
|
var root2 = UnityEngine.Application.dataPath + "/Resources/Config";
|
if (Directory.Exists(root2))
|
{
|
var fileInfos = FileExtersion.GetFileInfos(root2, new string[] { "*.txt", "*.TXT" });
|
if (fileInfos != null)
|
{
|
configFiles.AddRange(fileInfos);
|
}
|
}
|
|
foreach (var file in configFiles)
|
{
|
var fileInfo = new FileInfo(file.FullName);
|
|
CopyTxt(fileInfo);
|
}
|
}
|
|
|
private static void CopyTxt(FileInfo fileInfo)
|
{
|
string fileName = fileInfo.Name.Split('.')[0];
|
|
if (!Directory.Exists(configOutPutPath))
|
{
|
Directory.CreateDirectory(configOutPutPath);
|
}
|
|
string filePath = configOutPutPath + "/" + fileName + ".txt";
|
if (File.Exists(filePath))
|
{
|
File.Delete(filePath);
|
}
|
|
File.Copy(fileInfo.FullName, filePath);
|
}
|
|
|
|
|
}
|
|