コード例 #1
0
 private void LoadLocalAssetInfos()
 {
     for (int i = 0; i < m_changedInfos.Count; i++)
     {
         var    fileStream = ResourcesManager.LoadStream(m_changedInfos[i] + "/info");
         byte[] bytes      = new byte[fileStream.Length];
         fileStream.Read(bytes, 0, bytes.Length);
         AssetInfos localAssetInfos = ProtobufUtility.Deserialize <AssetInfos>(bytes);
         m_localChangedAssetInfos.Add(localAssetInfos.category, localAssetInfos);
         fileStream.Read(bytes, 0, bytes.Length);
         fileStream.Close();
         fileStream.Dispose();
         fileStream = null;
     }
 }
コード例 #2
0
        private void LoadLocalRootInfo(string path)
        {
            var fileStream = ResourcesManager.LoadStream(path);

            using (StreamReader sr = new StreamReader(fileStream))
            {
                string        s;
                StringBuilder str = new StringBuilder();
                while ((s = sr.ReadLine()) != null)
                {
                    str.Clear();
                    string categoryName = "";
                    int    index        = 0;
                    for (int i = 0, j = 0; i < s.Length; i++)
                    {
                        char c = s[i];
                        if (c == ',' || i == s.Length - 1)
                        {
                            if (j == 0)
                            {
                                categoryName = str.ToString();
                            }
                            else if (j == 1)
                            {
                                str.Append(c);
                                index = Convert.ToInt32(str.ToString());
                            }
                            str.Clear();
                            j++;
                        }
                        else
                        {
                            str.Append(c);
                        }
                    }
                    m_localRootInfos.Add(categoryName, index);
                }
            }
            fileStream.Close();
            fileStream.Dispose();
        }