Ejemplo n.º 1
0
        /// <summary>
        /// 结束整个下载过程
        /// </summary>
        private void EndDownload()
        {
            isDownloadingFile = false;

            //同步服务器的文件信息
            StringBuilder strBuilder = serverResourceInfoData.GetTotalString();
            FileStream    assetFile  = File.Open(AssetBundleFilePath.ServerExtensionDataPath + "ResourceInfoData.csv", FileMode.Create);
            StreamWriter  sw         = new StreamWriter(assetFile, Encoding.UTF8);

            sw.Write(strBuilder);
            sw.Close();
            assetFile.Close();

            UpdateResVerInfo();

            EndHotFixUpdate();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新资源信息文件
        /// </summary>
        /// <param name="fileName">File name.</param>
        private void UpdateResoureceInfoData(string fileName)
        {
            ResourcesInfoData localResourceInfoData = new ResourcesInfoData();

            if (File.Exists(AssetBundleFilePath.ServerExtensionDataPath + "ResourceInfoData.csv"))
            {
                localResourceInfoData.InitFromPath(AssetBundleFilePath.ServerExtensionDataPath + "ResourceInfoData.csv");
            }
            else
            {
                localResourceInfoData.InitFromResource();
            }
            int localId = localResourceInfoData.GetIDByBundleName(fileName);



            int    serverId = serverResourceInfoData.GetIDByBundleName(fileName);
            int    verCode  = serverResourceInfoData.GetVersionCode(serverId);
            string crc      = serverResourceInfoData.GetCRC(serverId);
            string hash     = serverResourceInfoData.GetHashCode(serverId);


            if (localId < 0)
            {
                localResourceInfoData.AddRowWithoutId(fileName, verCode.ToString(), crc, hash);
            }
            else
            {
                localResourceInfoData.SetVersionCode(localId, verCode);
                localResourceInfoData.SetCRC(localId, crc);
                localResourceInfoData.SetHashCode(localId, hash);
            }


            StringBuilder strBuilder = localResourceInfoData.GetTotalString();
            FileStream    assetFile  = File.Open(AssetBundleFilePath.ServerExtensionDataPath + "ResourceInfoData.csv", FileMode.Create);
            StreamWriter  sw         = new StreamWriter(assetFile, Encoding.UTF8);

            sw.Write(strBuilder);
            sw.Close();
            assetFile.Close();
        }