Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        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();
            }
        }