private int AllocString(string value) { int stringIndex = -1; StringData stringData = default(StringData); if (m_FreeStringDatas.Count > 0) { KeyValuePair <int, StringData> freeStringData = m_FreeStringDatas.Dequeue(); stringIndex = freeStringData.Key; stringData = freeStringData.Value; } else { int index = 0; foreach (KeyValuePair <int, StringData> i in m_StringDatas) { if (i.Key == index) { index++; continue; } break; } if (index < m_HeaderData.MaxFileCount) { stringIndex = index; stringData = ReadStringData(stringIndex); } } if (stringIndex < 0) { throw new GameFrameworkException("Alloc string internal error."); } stringData = stringData.SetString(value, m_HeaderData.GetEncryptBytes()); m_StringDatas.Add(stringIndex, stringData); WriteStringData(stringIndex, stringData); return(stringIndex); }