コード例 #1
0
        void SaveResourceList()
        {
            int num = 0;

            lock (_saveThreadLock)
            {
                num = _finishDatas.Count;
            }
            for (int i = 0; i < num; ++i)
            {
                _currentResourclist.Resources[_finishDatas[0].Key] = _finishDatas[0].Value;
                lock (_saveThreadLock)
                {
                    _finishDatas.RemoveAt(0);
                }
            }
            FileStream fs = new FileStream(ResourceManager.DataPath + "ResourceList.ab.ab", FileMode.Create);

            _currentResourclist.WriteTo(fs);
            fs.Flush();
            fs.Close();
            try
            {
                lock (_threadLock)
                {
                    File.Copy(ResourceManager.DataPath + "ResourceList.ab.ab", ResourceManager.DataPath + "ResourceList.ab", true);
                }
                File.Delete(ResourceManager.DataPath + "ResourceList.ab.ab");
            }
            catch (Exception ex)
            {
                Debugger.LogException(ex);
            }
        }
コード例 #2
0
        static void SaveResourceDatas(string path, ResourceDatas datas)
        {
            FileStream fs = new FileStream(path, FileMode.Create);

            datas.WriteTo(fs);
            fs.Flush();
            fs.Close();
        }