/* * 自动生成热更内容,即UpdateTest.txt文件 * */ public static void GenerateVersionContent() { var version = "3.1.3"; var content = ""; var fileContent = ""; var fileSize = 0; UpdateModuleMessage module = null; GenerateAssetBundleVersionContent(out module); fileContent += module.Content; fileSize += module.Size; module = null; LuaScriptEditor.GenerateScriptVersionContent(out module); fileContent += module.Content; fileSize += module.Size; module = null; ConfigEditor.GenerateConfigVersionContent(out module); fileContent += module.Content; fileSize += module.Size; content += "return {\n"; content += "\tVersion = \"" + version + "\",\n"; content += "\tUpdateURL = " + "\"" + UpdateManager.UpdateTest + "\",\n"; content += "\tUpdateSize = " + fileSize + ",\n"; content += fileContent; content += "}\n"; FileManager.CreateFileWithString(UpdateManager.UpdateTest + "/" + "UpdateTest.txt", content); }
void MoveFile(DownloadFileRequest req, string info, byte[] bytes, int length) { if (req.fileType == DownloadFileType.TypeText) { FileManager.CreateFileWithString(req.filePath, info); } else if (req.fileType == DownloadFileType.TypeAssetBundle) { FileManager.CreateFileWithBytes(req.filePath, bytes, length); } }
static public int CreateFileWithString_s(IntPtr l) { try { System.String a1; checkType(l, 1, out a1); System.String a2; checkType(l, 2, out a2); FileManager.CreateFileWithString(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public static void CopyScript() { FileManager.DeleteDirectory(UpdateManager.UpdateTest + SCRIPT_PATH); List <string> fileList = new List <string>(); GetAllScriptFile(Application.dataPath + "/Resources" + SCRIPT_PATH, fileList); for (int i = 0; i < fileList.Count; ++i) { //TODO:加密每一个script文件,并拷贝到PersistentDataPath var file = fileList[i]; var targetFile = file.Replace(Application.dataPath + "/Resources", UpdateManager.UpdateTest); var content = FileManager.LoadFileWithString(file); FileManager.CreateFileWithString(targetFile, EncryptScript(content)); } }