private void SetPersistentVersion(string version) { JsonObject persistentVersionInfoJo = new JsonObject(); persistentVersionInfoJo.Add(ConstValue.VERSION_KEY, version); byte[] persistentVersionInfoBytes = ConvertExt.StringToBytes(persistentVersionInfoJo.ToString()); FileManager.Write(ConstValue.PERSISTENT_DIR_PATH + "/" + m_ModuleName + "/" + ConstValue.VERSION_NAME, persistentVersionInfoBytes); }
public WWWLoader(string url) { m_Url = url; m_WWW = new WWW(ConvertExt.UriEncode(url)); m_Wait = new WaitUntil(() => IsDone); m_WaitIe = DoWait(); CoroutineManager.Start(m_WaitIe); }
private byte[] CustomLoad(ref string filename) { string extension = ".lua"; filename = filename.EndsWith(extension) ? filename.Substring(0, filename.Length - extension.Length) : filename; string relativePath = filename.Replace(".", "/") + extension; TextAsset textAsset = LoadLua(relativePath); if (textAsset) { return(ConvertExt.StringToBytes(textAsset.text)); } return(null); }
private void SetPersistentFileList() { byte[] persistentFileListBytes = ConvertExt.StringToBytes(m_PersistentFileList.ToString()); FileManager.Write(ConstValue.PERSISTENT_DIR_PATH + "/" + m_ModuleName + "/" + ConstValue.FILE_LIST_NAME, persistentFileListBytes); }
private string GetPersistentVersion(string defaultVersion) { if (IsPersistentHasVersion()) { byte[] persistentVersionInfoBytes = FileManager.Read(ConstValue.PERSISTENT_DIR_PATH + "/" + m_ModuleName + "/" + ConstValue.VERSION_NAME); string persistentVersionInfoStr = persistentVersionInfoBytes == null ? null : ConvertExt.BytesToString(persistentVersionInfoBytes); JsonObject persistentVersionInfoJo = StringParser.StringToJo(persistentVersionInfoStr, false); return(JsonParser.JoItemToString(persistentVersionInfoJo, ConstValue.VERSION_KEY, defaultVersion)); } return(defaultVersion); }
void Awake() { #if DOWNLOAD m_UpdateStepType = UpdateStepType.VersionCompare; NativeVersionCompare(); if (IsPersistentHasVersion()) { // 如果有Version字段,则有Persistent数据,加载Persistent的FileList byte[] persistentFileListBytes = FileManager.Read(ConstValue.PERSISTENT_DIR_PATH + "/" + m_ModuleName + "/" + ConstValue.FILE_LIST_NAME); string persistentFileListStr = persistentFileListBytes == null ? null : ConvertExt.BytesToString(persistentFileListBytes); m_PersistentFileList = StringParser.StringToJo(persistentFileListStr, false); } else { // 否则,Persistent的FileList为空 m_PersistentFileList = new JsonObject(); } #else m_UpdateStepType = UpdateStepType.UpdateCancel; m_Version = ConstValue.VERSION; #endif if (FileManager.IsFileExist(ConstValue.STREAMING_DIR_PATH + "/" + m_ModuleName + "/" + ConstValue.FILE_LIST_NAME)) { byte[] streamingFileListBytes = FileManager.Read(ConstValue.STREAMING_DIR_PATH + "/" + m_ModuleName + "/" + ConstValue.FILE_LIST_NAME); string streamingFileListStr = streamingFileListBytes == null ? null : ConvertExt.BytesToString(streamingFileListBytes); m_StreamingFileList = StringParser.StringToJo(streamingFileListStr, false); } else { m_StreamingFileList = new JsonObject(); } }