public static void MainOperation(string rootPath, JToken configJToken) { string root = rootPath;//工程目录 root += "\\"; //记录修改的文件的txt if (configJToken["versionTextPath"] == null) { Program.ConsoleLog("缺少版本文件地址"); return; } string versionText = root + configJToken["versionTextPath"].Value <string>(); if (!File.Exists(versionText)) { Program.ConsoleLog("不存在文件 " + versionText); return; } //删除之前生成的gangsterRes000文件夹 string gangsterRes000 = Program.VersionFolder; var resourcePath = root + gangsterRes000; if (Directory.Exists(resourcePath)) { Directory.Delete(resourcePath, true); } //读取之前所有文件信息 FileCollector.GenerateResourceInfo(versionText); var useInitTxt = configJToken["useInitTxt"].Value <bool>(); if (useInitTxt) { AssetOperation.GetChangeFiles(); } else { //将更改的资源复制到新文件夹 AssetOperation.FindChangeFiles(configJToken); } //生成资源组,添加到gangster.res.json中 AssetOperation.GenerateChangeGroup(configJToken); }
public static void MainProgram(string rootPath, JToken configJToken) { string root = rootPath;//工程目录 if (configJToken["versionTextPath"] == null) { Console.WriteLine("缺少版本文件地址"); Console.ReadKey(); return; } MainUploading.FTPRootPath = configJToken["ftpRootPath"].Value <string>(); root += "\\"; string versionText = root + configJToken["versionTextPath"].Value <string>(); if (!File.Exists(versionText)) { Console.WriteLine("不存在文件 " + versionText); Console.ReadKey(); return; } //查找txt文件 var allLocalRes = ResContainer.ListResLocalAll; var list = FileCollector.GenerateResourceInfo(versionText); MainUploading.ListChangeGroup = new List <Group>(); //改变的文件列表 foreach (var item in list) { var url = item.filePath; var existRes = allLocalRes.Find(temp => temp.Url == url); if (existRes != null) { existRes.Url = existRes.Url + "?v=" + item.version; var group = existRes.group; var groupName = group.Name; var existGroup = MainUploading.ListChangeGroup.Find(g => g.Name == groupName); if (existGroup == null) { var newGroup = new Group(); newGroup.Name = groupName; newGroup.listRes.Add(existRes); MainUploading.ListChangeGroup.Add(newGroup); } else { existGroup.listRes.Add(existRes); } } else { Console.WriteLine("default.res.json 之前不存在 " + url); } } for (int i = 0; i < MainUploading.ListChangeGroup.Count; i++) { var g = MainUploading.ListChangeGroup[i]; g.Keys = g.GenerateKey(); } }