private void OnInstallEnd(String packId, Boolean bSuccess) { if (m_installingPackId != null && m_installingPackId != packId) Debug.LogError("OnInstallSucceeded get wrong packId: " + packId); m_installingPackId = null; if (bSuccess) { lock (m_lock) m_packRecordMap[packId] = new ExpansionPackRecord(ExpansionPackRecordState.Installed); if (SaveRecord()) { CleanDownloadedDir(); } } else { m_installingPackId = null; } }
private Boolean LoadRecord() { lock (m_lock) { m_packRecordMap.Clear(); if (!File.Exists(GetRecordFilePath())) //记录文件尚未创建 return true; try { SecurityElement xmlDoc = SecurityElement.FromString(File.ReadAllText(GetRecordFilePath())); SecurityElement xmlRoot = xmlDoc; if (xmlRoot != null && xmlRoot.Children != null) { foreach (SecurityElement item in xmlRoot.Children) { String id = item.Attributes["id"].ToString(); Int32 state = Convert.ToInt32(item.Attributes["state"].ToString()); m_packRecordMap[id] = new ExpansionPackRecord((ExpansionPackRecordState)state); } } return true; } catch (IOException e) { m_packRecordMap.Clear(); Debug.LogException(e); return false; } catch (XmlSyntaxException e) { m_packRecordMap.Clear(); Debug.LogException(e); return false; } catch (NullReferenceException e) { m_packRecordMap.Clear(); Debug.LogException(e); return false; } } }