/// <summary> /// 初始化. /// </summary> /// <param name="iPath">路径.</param> /// <param name="iGameName">游戏名.</param> public bool Init(string iPath, string iGameName) { try { this.Load(iPath); // 创建strings.xml对象 this._stringsXml = this.CreateStringsXml(); // if(null == this._stringsXml) { // return false; // } // 初始化Appliction this.InitApplicationInfo(); // 初始化SDK版本信息. if (null == this.InitSDKVersions()) { return(false); } // 应用用户自定义数据 this.ApplyUserData(iGameName); } catch (Exception e) { UtilsLog.Exception("Init", "Failed!!! Exeption:{0}", e.Message); return(false); } return(true); }
/// <summary> /// 添加已经创建目录. /// </summary> /// <param name="iServerId">服务器ID.</param> /// <param name="iDir">I dir.</param> public void AddCreatedDir(TServerID iServerId, string iDir) { // 线程安全锁 lock (_serversDirsLock) { ServerDirInfo targetServer = null; ServerDirInfo[] servers = this.ServersDirs .Where(o => (iServerId == o.ID)) .OrderBy(o => o.ID) .ToArray(); if ((servers == null) || (servers.Length <= 0)) { targetServer = new ServerDirInfo(); targetServer.ID = iServerId; this.ServersDirs.Add(targetServer); } else { if (servers.Length > 1) { UtilsLog.Error("AddCreatedDir", "There are multiple id exist!!![ID:{0}]", iServerId); } targetServer = servers [0]; } string[] dirs = targetServer.Dirs.Where(o => (o.Equals(iDir) == true)).ToArray(); if ((dirs == null) || (dirs.Length <= 0)) { targetServer.Dirs.Add(iDir); } } }
/// <summary> /// 下载完成. /// </summary> /// <param name="iTargetID">目标ID.</param> /// <param name="iFileType">文件类型.</param> public void DownloadCompleted(string iTargetID, TUploadFileType iFileType) { lock (_targetUpdateLock) { DownloadTargetInfo downloadInfo = null; if (this.isTargetExist(iTargetID, iFileType, out downloadInfo) == true) { if (downloadInfo == null) { return; } downloadInfo.Downloaded = true; if (this._progressCounter != null) { this._progressCounter.UpdateCompletedCount(); long dataSize = (string.IsNullOrEmpty(downloadInfo.DataSize) == true) ? 0 : Convert.ToInt64(downloadInfo.DataSize); this._progressCounter.UpdateCompletedDataSize(dataSize); UtilsLog.Info("DownloadCompleted", "Count({0}/{1}) DataSize({2}/{3})", this._progressCounter.DidCount, this._progressCounter.TotalCount, this._progressCounter.DidDatasize, this._progressCounter.TotalDatasize); } } } }
/// <summary> /// 取得文件的Md5码. /// </summary> /// <returns>文件的Md5码.</returns> /// <param name="iFilePath">文件路径.</param> public static string GetFileMD5(string iFilePath) { if (_md5 == null) { _md5 = new MD5CryptoServiceProvider(); } if (false == File.Exists(iFilePath)) { UtilsLog.Error("UploadList", "GetFileMD5()::The file is not exist!!!(File:{0})", iFilePath); return(null); } FileStream fs = new FileStream(iFilePath, FileMode.Open, FileAccess.Read, FileShare.Read); byte[] hash = _md5.ComputeHash(fs); string strMD5 = System.BitConverter.ToString(hash); if (null != fs) { fs.Close(); fs.Dispose(); } strMD5 = strMD5.ToLower(); strMD5 = strMD5.Replace("-", ""); return(strMD5); }
/// <summary> /// 下载失败回调函数. /// </summary> /// <param name="iDownloadInfo">下载信息.</param> /// <param name="iIsManifest">Manifest文件标志位.</param> /// <param name="iErrors">错误信息.</param> public void OnDownloadFail(DownloaderBase iDownloader, DownloadTargetInfo iDownloadInfo, bool iIsManifest, List <ErrorDetail> iErrors) { // 线程安全:添加错误信息至列表 lock (_downloaderErrorLock) { string errsStr = null; foreach (ErrorDetail error in iErrors) { if (string.IsNullOrEmpty(errsStr) == true) { errsStr = string.Format("Type:{0} State:{1} Detail:{2} Retries:{3}", error.Type.ToString(), error.State.ToString(), error.Detail, error.Retries.ToString()); } else { errsStr = string.Format("{0} \n Type:{1} State:{2} Detail:{3} Retries:{4}", errsStr, error.Type.ToString(), error.State.ToString(), error.Detail, error.Retries.ToString()); } } UtilsLog.Error("OnDownloadFail", "Download Failed!!! {0} \n Detail:{1}", iDownloadInfo.toString(), errsStr); this._errors.AddRange(iErrors); this._State = TRunState.Error; if (iDownloader != null) { iDownloader.Dispose(); GC.Collect(); } } }
/// <summary> /// 根据检测模式检测已下载的文件. /// </summary> /// <returns><c>true</c>, OK, <c>false</c> NG.</returns> /// <param name="iTarget">目标信息.</param> /// <param name="iDownloadFileFullPath">已经下载到本地的路径.</param> private bool CheckFileByCheckMode(DownloadTargetInfo iTarget, string iDownloadFileFullPath) { if (File.Exists(iDownloadFileFullPath) == false) { return(false); } bool isCheckOK = true; switch (UploadList.GetInstance().CheckMode) { case TCheckMode.Unity3d_Hash128: { UtilsLog.Info("CheckFileByCheckMode", "The Unity3d_Hash128 of check mode has not been supported yet!!!"); isCheckOK = false; } break; case TCheckMode.Custom_Md5: { string md5 = UploadList.GetFileMD5(iDownloadFileFullPath); if ((true == string.IsNullOrEmpty(md5)) || (false == md5.Equals(iTarget.CheckCode))) { isCheckOK = false; } } break; default: break; } return(isCheckOK); }
/// <summary> /// 构造函数. /// </summary> // public DefinesWindow() { // if (false == this.Init (_jsonFileDir)) { // UtilsLog.Error (this.ClassName, "DefinesWindow Failed!!!"); // } // } /// <summary> /// 窗口类不要写构造函数,初始化写在Awake里 /// </summary> void Awake() { if (false == this.Init(_jsonFileDir)) { UtilsLog.Error(this.ClassName, "Awake()::DefinesWindow Failed!!!"); } }
/// <summary> /// 设定宏. /// </summary> /// <param name="iDefines">宏.</param> /// <param name="iTargetGroup">目标组.</param> public static void SetDefines(DefineInfo[] iDefines, BuildTargetGroup iTargetGroup) { if ((null == iDefines) || (0 >= iDefines.Length)) { return; } string _defines = null; foreach (DefineInfo define in iDefines) { if (true == string.IsNullOrEmpty(define.Name)) { continue; } if (true == string.IsNullOrEmpty(_defines)) { _defines = define.Name; } else { _defines = string.Format("{0};{1}", _defines, define.Name); } } if (false == string.IsNullOrEmpty(_defines)) { PlayerSettings.SetScriptingDefineSymbolsForGroup(iTargetGroup, _defines); UtilsLog.Info("DefinesSetting", "SetDefines -> Target:{0} Defines:{1}", iTargetGroup, _defines); BuildLogger.LogMessage("DefinesSetting()::Defines({0}):{1}", iTargetGroup.ToString(), _defines); } }
/// <summary> /// 追加宏. /// </summary> /// <param name="iAddNewDefine">新追加的宏.</param> private void AddDefine(string iName, bool iAndroid, bool iIOS) { if ((true == string.IsNullOrEmpty(iName)) || (null == this.Defines)) { return; } bool isExist = false; foreach (DefineInfo define in this.Data.Defines) { if (true == string.IsNullOrEmpty(define.Name)) { continue; } if (true == iName.Equals(define.Name)) { define.Android = iAndroid; define.iOS = iIOS; isExist = true; break; } } if (false == isExist) { DefineInfo _define = new DefineInfo(iName, iAndroid, iIOS); this.Defines.Add(_define); } // 按名字排序 this.Defines.Sort((x, y) => (x.Name.CompareTo(y.Name))); UtilsLog.Info("DefinesWindow", "AddDefine -> Name:{0} Andorid:{1} iOS:{2}", iName, iAndroid, iIOS); }
public static string ProcessBaseURL(string baseURL, UrlMode currentMode) { string result = ""; switch (currentMode) { case UrlMode.Local: { result = baseURL.Replace("<BundleVersion>", BundleVersion).Replace("<ServerRoot>", LocalServerRoot).Replace("<Platform>", Platform).Replace("<ConfigType>", ConfigType).Replace("<BuildTag>", BuildTag).Replace("<MarketVersion>", MarketVersion); } break; case UrlMode.Default: { result = baseURL.Replace("<BundleVersion>", BundleVersion).Replace("<ServerRoot>", PublicServerRoot).Replace("<Platform>", Platform).Replace("<ConfigType>", ConfigType).Replace("<BuildTag>", BuildTag).Replace("<MarketVersion>", MarketVersion); } break; default: { result = baseURL.Replace("<BundleVersion>", BundleVersion).Replace("<ServerRoot>", PublicServerRoot).Replace("<Platform>", Platform).Replace("<ConfigType>", ConfigType).Replace("<BuildTag>", BuildTag).Replace("<MarketVersion>", MarketVersion); } break; } UtilsLog.Info("AssetBundleConst", "ProcessBaseURL()::result:{0}", result); return(result); }
/// <summary> /// 判断目标存不存在. /// </summary> /// <returns><c>true</c>, 存在, <c>false</c> 不存在.</returns> /// <param name="iBundleId">BundleID.</param> /// <param name="iFileType">文件类型.</param> /// <param name="iTarget">下载目标信息.</param> public bool isTargetExist(string iBundleId, TUploadFileType iFileType, out DownloadTargetInfo iTarget) { iTarget = null; if (string.IsNullOrEmpty(iBundleId) == true) { return(false); } DownloadTargetInfo[] targets = this.Targets .Where(o => ( (iBundleId.Equals(o.ID) == true) && (iFileType == o.FileType))) .OrderByDescending(o => o.No) .ToArray(); if ((targets == null) || (targets.Length <= 0)) { return(false); } if (1 != targets.Length) { UtilsLog.Warning("isTargetExist", "There is duplicate id exist in download list!!!(Bundle ID:{0} FileType:{1})", iBundleId, iFileType); } iTarget = targets [0]; return(true); }
/// <summary> /// 添加对象. /// </summary> /// <param name="iTarget">上传目标.</param> public void AddTarget(UploadItem iTarget) { DownloadTargetInfo target = null; if (false == isTargetExist(iTarget.ID, iTarget.FileType, out target)) { target = new DownloadTargetInfo(); this.Targets.Add(target); target.No = iTarget.No; target.ID = iTarget.ID; target.BundleType = iTarget.BundleType; target.FileType = iTarget.FileType; target.DataSize = iTarget.DataSize; target.CheckCode = iTarget.CheckCode; target.Downloaded = false; UtilsLog.Info("AddTarget", "New:{0}", iTarget.toString()); } else { // 变更的场合 if (false == iTarget.CheckCode.Equals(target.CheckCode)) { target.DataSize = iTarget.DataSize; target.CheckCode = iTarget.CheckCode; target.Downloaded = false; UtilsLog.Info("AddTarget", "Changed:{0}", iTarget.toString()); } } }
public static void RestoreFinished() { UtilsLog.Info("IAPMsgSwitch", "[RestoreFinished]"); if ((null != IAPInstance) && (null != IAPInstance.OnRestoreFinished)) { IAPInstance.OnRestoreFinished(); } }
public static void IAPFailed(IAPErrorCode iErrorCode, Int32 iErrorDetailCode, string iErrorDetailInfo) { UtilsLog.Info("IAPMsgSwitch", "[IAPFailed] ErrorCode::{0} ErrorDetailCode::{1} ErrorDetail::{2}", iErrorCode, iErrorDetailCode, iErrorDetailInfo); if ((null != IAPInstance) && (null != IAPInstance.OnFailed)) { IAPInstance.OnFailed(iErrorCode, iErrorDetailCode, iErrorDetailInfo); } }
public static void TransactionUpdated(string productID, TransactionState state, string transactionID, string receipt, Int32 quantity) { UtilsLog.Info("IAPMsgSwitch", "[TransactionUpdated] ProductID:{0}({1}) State:{2} TransactionID:{3} Receipt:{4}", ((true == string.IsNullOrEmpty(productID)) ? "null" : productID), quantity, state.ToString(), ((true == string.IsNullOrEmpty(transactionID)) ? "null" : transactionID), ((true == string.IsNullOrEmpty(receipt)) ? "null" : receipt)); switch (state) { case TransactionState.Purchasing: if ((null != IAPInstance) && (null != IAPInstance.OnTransactionPurchasing)) { IAPInstance.OnTransactionPurchasing(productID, quantity); } break; case TransactionState.Purchased: { if ((null != IAPInstance) && (null != IAPInstance.OnTransactionPurchased)) { IAPInstance.OnTransactionPurchased(productID, quantity, transactionID, receipt); } } break; case TransactionState.Canceled: { if ((null != IAPInstance) && (null != IAPInstance.OnTransactionCanceled)) { IAPInstance.OnTransactionCanceled(productID, quantity); } } break; case TransactionState.Restored: if (IAPVerifyTransaction(transactionID)) { if ((null != IAPInstance) && (null != IAPInstance.OnTransactionRestored)) { IAPInstance.OnTransactionRestored(productID, quantity, transactionID, receipt); } } break; case TransactionState.Deferred: { if ((null != IAPInstance) && (null != IAPInstance.OnTransactionDeferred)) { IAPInstance.OnTransactionDeferred(productID); } } break; } }
/// <summary> /// 加载数据(旧版本). /// </summary> /// <returns>加载队形.</returns> /// <param name="path">路径.</param> public static Object LoadData(string path) { Object objRet = Load <Object>(path); if (null == objRet) { UtilsLog.Warning("DataLoadController", "LoadData():Load Failed!!(path:{0})", path); } return(objRet); }
/// <summary> /// 初始化. /// </summary> /// <param name="iTotalCount">I total count.</param> /// <param name="iTotalDatasize">I total datasize.</param> public void Init(int iTotalCount, long iTotalDatasize) { this.TotalCount = iTotalCount; this.DidCount = 0; this.TotalDatasize = iTotalDatasize; this.DidDatasize = 0; UtilsLog.Info("Init", "{0}/{1} {2}/{3}", this.DidCount, this.TotalCount, this.DidDatasize, this.TotalDatasize); }
public static Object LoadFromResource(string path) { Object objRet = ResourcesLoad.Load(path) as Object; if (null == objRet) { UtilsLog.Warning("DataLoadController", "LoadFromResource():Load Failed!!(path:{0})", path); } return(objRet); }
/// <summary> /// 添加对象. /// </summary> /// <param name="iTarget">对象.</param> /// <param name="iFileType">上传文件类型.</param> /// <param name="iHashCode">HashCode(Unity3d打包生成).</param> public void AddTarget( BundleMap iTarget, TUploadFileType iFileType, string iHashCode = null) { if (iTarget == null) { return; } UploadItem _item = null; string filePath = GetLocalBundleFilePath( iTarget.ID, iFileType, (TBundleType.Scene == iTarget.Type)); string checkCode = null; string dataSize = null; if ((false == string.IsNullOrEmpty(filePath)) && (true == File.Exists(filePath))) { if (TCheckMode.Unity3d_Hash128 == this.CheckMode) { checkCode = iHashCode; } else { checkCode = GetFileMD5(filePath); } FileInfo fileInfo = new FileInfo(filePath); dataSize = fileInfo.Length.ToString(); } else { UtilsLog.Warning("AddTarget", "Target File is not exist!!!(target:{0})", filePath); } bool _exist = this.isTargetExist(iTarget.ID, iFileType, out _item); if (false == _exist) { _item = this.CreateUploadItem(iTarget.ID, iTarget.Type, iFileType); _item.CheckCode = checkCode; _item.DataSize = dataSize; } else { if ((false == string.IsNullOrEmpty(checkCode)) && (false == checkCode.Equals(_item.CheckCode))) { _item.CheckCode = checkCode; _item.DataSize = dataSize; _item.Uploaded = false; } } UtilsAsset.SetAssetDirty(this); }
/// <summary> /// 加载场景. /// </summary> /// <param name="iSceneName">I scene name.</param> public static void LoadScene(string iSceneName) { if (false == AssetBundlesManager.Instance.LoadScene(iSceneName)) { UtilsLog.Warning("DataLoadController", "LoadScene():There is no scene({0}) in asset bundles manager!!", iSceneName); // 加载场景 SceneManager.LoadScene(iSceneName); } }
static void ShowDefinesWindow() { //创建窗口 DefinesWindow window = UtilsWindow.CreateWindow <DefinesWindow, DefinesConfInfo>(DefinesWindow.ConfInfo); if (null == window) { UtilsLog.Error("DefinesWindow", "ShowDefinesWindow -> Create Window Failed!!"); return; } window.Show(); }
/// <summary> /// 取得拷贝目的文件目录. /// </summary> /// <returns>取得拷贝目的文件目录.</returns> public string GetAndroidCopyToDir() { string dir = string.Format("{0}/Plugins/Android", Application.dataPath); if (false == Directory.Exists(dir)) { UtilsLog.Warning("GetAndroidCopyToDir", "The directory is not exist!!(Dir:{0})", dir); Directory.CreateDirectory(dir); } return(dir); }
/// <summary> /// 取得Bundle全路径名. /// </summary> /// <returns>Bundle全路径名.</returns> /// <param name="iBundleId">BundleId.</param> /// <param name="iFileType">文件类型.</param> public string GetBundleFullPath( string iBundleId, TUploadFileType iFileType = TUploadFileType.Bundle) { DownloadTargetInfo targetInfo = null; if (isTargetExist(iBundleId, iFileType, out targetInfo) == false) { UtilsLog.Error("GetBundleFullPath", "This bundles is not exist!!!({BundleId:{0} FileType:{1})", iBundleId, iFileType); return(null); } if (targetInfo == null) { return(null); } string fileName = UploadList.GetLocalBundleFileName(iBundleId, targetInfo.FileType); if (string.IsNullOrEmpty(fileName) == true) { return(null); } string fileFullPath = null; switch (targetInfo.BundleType) { case TBundleType.Normal: { fileFullPath = string.Format("{0}/{1}", ServersConf.BundlesDirOfNormal, fileName); } break; case TBundleType.Scene: { fileFullPath = string.Format("{0}/{1}", ServersConf.BundlesDirOfScenes, fileName); } break; default: { fileFullPath = string.Format("{0}/{1}", ServersConf.BundlesDir, fileName); } break; } return(fileFullPath); }
/// <summary> /// 登出. /// </summary> public void Logout() { if (TPlatformType.None == BuildInfo.GetInstance().PlatformType) { UtilsLog.Error("AndroidLibs", "Logout():The platformType is none in buildinfo.asset file!!!"); return; } AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); jo.Call("UToA_Logout"); }
/// <summary> /// 初始化Asset. /// </summary> public override bool InitAsset() { DownloadRootDir = Application.temporaryCachePath; UtilsLog.Info("InitAsset", "DownloadRootDir:{0}", DownloadRootDir); // 下载目录 DownloadDir = string.Format("{0}/Downloads", DownloadRootDir); UtilsLog.Info("InitAsset", "DownloadDir:{0}", DownloadDir); // 下载目录(Normal) DownloadDirOfNormal = string.Format("{0}/{1}", DownloadDir, UploadList.AssetBundleDirNameOfNormal); UtilsLog.Info("InitAsset", "DownloadDirOfNormal:{0}", DownloadDirOfNormal); // 下载目录(Scenes) DownloadDirOfScenes = string.Format("{0}/{1}", DownloadDir, UploadList.AssetBundleDirNameOfScenes); UtilsLog.Info("InitAsset", "DownloadDirOfScenes:{0}", DownloadDirOfScenes); // Bundles目录 BundlesDir = string.Format("{0}/Bundles", Application.persistentDataPath); UtilsLog.Info("InitAsset", "BundlesDir:{0}", BundlesDir); // Bundles目录(Normal) BundlesDirOfNormal = string.Format("{0}/{1}", BundlesDir, UploadList.AssetBundleDirNameOfNormal); UtilsLog.Info("InitAsset", "BundlesDirOfNormal:{0}", BundlesDirOfNormal); // Scene BundlesDirOfScenes = string.Format("{0}/{1}", BundlesDir, UploadList.AssetBundleDirNameOfScenes); UtilsLog.Info("InitAsset", "BundlesDirOfScenes:{0}", BundlesDirOfScenes); // 解压缩 DecompressedDir = string.Format("{0}/Decompressed", DownloadRootDir); UtilsLog.Info("InitAsset", "DecompressedDir:{0}", DecompressedDir); // 解压缩(Normal) DecompressedDirOfNormal = string.Format("{0}/{1}", DecompressedDir, UploadList.AssetBundleDirNameOfNormal); UtilsLog.Info("InitAsset", "DecompressedDirOfNormal:{0}", DecompressedDirOfNormal); // 解压缩(Scenes) DecompressedDirOfScenes = string.Format("{0}/{1}", DecompressedDir, UploadList.AssetBundleDirNameOfScenes); UtilsLog.Info("InitAsset", "DecompressedDirOfScenes:{0}", DecompressedDirOfScenes); UtilsAsset.SetAssetDirty(this); return(base.InitAsset()); }
/// <summary> /// 初始化上传队列. /// </summary> private IEnumerator InitUploadQueue() { this._isCompleted = false; // 初始化上传信息队列 List <UploadItem> targets = UploadList.GetInstance().Targets; if (this.UploadQueue != null) { UploadItem[] uploadTargets = targets. Where(o => ( (false == o.Uploaded) && (false == o.Scraped))) .OrderBy(o => o.No) .ToArray(); if ((uploadTargets == null) || (uploadTargets.Length <= 0)) { this._State = TRunState.NoUploadTarget; UtilsLog.Warning("InitUploadQueue", "There is no target to upload!!!"); } yield return(new WaitForEndOfFrame()); if (TRunState.OK == this._State) { this.UploaderCount = 0; int targetsCount = uploadTargets.Length; int maxCount = ServersConf.GetInstance().ThreadMaxCount; this.UploaderMaxCount = (targetsCount > maxCount) ? maxCount : targetsCount; foreach (UploadItem loop in uploadTargets) { if (loop == null) { continue; } Uploader uploader = Uploader.Create(loop, this.OnUploadStart, this.OnUploadFailed, this.OnUploadSuccessed); if (uploader != null) { this.UploadQueue.Enqueue(uploader); } } yield return(new WaitForEndOfFrame()); } } yield return(null); }
/// <summary> /// 上传失败委托. /// </summary> /// <param name="iUploader">上传器.</param> /// <param name="iTargetInfo">上传目标信息.</param> /// <param name="iRetries">剩余重试次数.</param> /// <param name="iError">错误信息.</param> public void OnUploadFailed(Uploader iUploader, UploadItem iTargetInfo, int iRetries, List <ErrorDetail> iErrors) { lock (_errorLock) { UtilsLog.Error("OnUploadFailed", "{0} State:{1} Retries:{2} Detail:{3}", iTargetInfo.toString(), this._State, iRetries, iErrors.ToString()); this._errors.AddRange(iErrors); this._State = TRunState.Error; if (iUploader != null) { iUploader.Dispose(); GC.Collect(); } } }
/// <summary> /// 初始化. /// </summary> /// <param name="iPath">I path.</param> protected virtual bool Init(string iPath) { try { // 保存路径 this.SavePath = iPath; // 加载 this.Load(iPath); } catch (Exception e) { UtilsLog.Exception("StringsXMLBase", "Init():Failed!!! Exeption:{0}", e.Message); return(false); } return(true); }
/// <summary> /// 检测下载用的目录. /// </summary> /// <param name="iDir">检测目录.</param> private void CheckDownloadDirs(string iDir) { if (string.IsNullOrEmpty(iDir) == true) { return; } if (false == Directory.Exists(iDir)) { Directory.CreateDirectory(iDir); UtilsLog.Info("CheckDownloadDirs", " Create Dir:{0}", iDir); if (false == Directory.Exists(iDir)) { UtilsLog.Error("CheckDownloadDirs", " Create Dir Failed!! Dir:{0}", iDir); } } }
/// <summary> /// 下载完毕拷贝文件. /// </summary> public void CopyTargetWhenDownloadCompleted() { string copyFrom = null; string copyTo = null; switch (this.BundleType) { case TBundleType.Scene: { copyFrom = ServersConf.DownloadDirOfScenes; copyTo = ServersConf.BundlesDirOfScenes; } break; case TBundleType.Normal: { copyFrom = ServersConf.DownloadDirOfNormal; copyTo = ServersConf.BundlesDirOfNormal; } break; default: { copyFrom = ServersConf.DownloadDir; copyTo = ServersConf.BundlesDir; } break; } string fileName = UploadList.GetLocalBundleFileName(this.ID, this.FileType); copyFrom = string.Format("{0}/{1}", copyFrom, fileName); copyTo = string.Format("{0}/{1}", copyTo, fileName); if (true == File.Exists(copyFrom)) { File.Copy(copyFrom, copyTo, true); UtilsLog.Info("CopyTargetWhenDownloadCompleted", "Copy File:{0} -> {1}", copyFrom, copyTo); } if (false == File.Exists(copyTo)) { UtilsLog.Error("CopyTargetWhenDownloadCompleted", "Failed!! FileName:{0} -> {1}", copyFrom, copyTo); } File.Delete(copyFrom); UtilsLog.Info("CopyTargetWhenDownloadCompleted", "Delete File -> {0}", copyFrom); }