public bool RemoveResource(string szResourceFullPath) { string szlowerResourcePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath).ToLower(); if (m_ResourceList.ContainsKey(szlowerResourcePath) == false) { return(false); } AssetBundleResourceInfo resource = m_ResourceList[szlowerResourcePath]; AssetBundleInfo assetbundleinfo = m_AssetBundleList[resource.m_AssetBundleKey]; if (assetbundleinfo != null) { assetbundleinfo.m_ResourceList.Remove(szlowerResourcePath); if (assetbundleinfo.m_ResourceList.Count == 0) { m_AssetBundleList.Remove(assetbundleinfo.GetBundleMidPath() + assetbundleinfo.m_szAssetRealBundleName); } } else { Debug.LogError("assetbundle info is null"); } resource.Clear(); m_ResourceList.Remove(szlowerResourcePath); return(true); }
public bool UpdateResource(string szResourceFullPath) { if (File.Exists(szResourceFullPath) == false) { return(false); } string szlowerResourcePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath).ToLower(); if (m_ResourceList.ContainsKey(szlowerResourcePath) == false) { return(false); } AssetBundleResourceInfo resource = m_ResourceList[szlowerResourcePath]; AssetBundleInfo bundleInfo = m_AssetBundleList[resource.m_AssetBundleKey]; if (bundleInfo == null) { Debug.LogError("assetbundle info is null : @" + resource.m_AssetBundleKey); } FileInfo fileInfo = new FileInfo(szResourceFullPath); resource.m_dateResource = fileInfo.LastWriteTime; resource.m_lResourceSize = fileInfo.Length; FileInfo metaFileInfo = new FileInfo(szResourceFullPath + @".meta"); resource.m_dateMetaResource = metaFileInfo.LastWriteTime; resource.m_lMetaResourceSize = metaFileInfo.Length; return(true); }
public AssetBundleResourceInfo GetResource(string szResourceFullPath) { string szlowerResourcePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath).ToLower(); if (m_ResourceList.ContainsKey(szlowerResourcePath) == false) { return(null); } return(m_ResourceList[szlowerResourcePath]); }
public static bool IsEqual(AssetBundleResourceInfo resourceInfo) { string szResource = resourceInfo.GetResourceFullPath(); if (File.Exists(szResource) == false) { return(false); } FileInfo fileInfo = new FileInfo(szResource); if (resourceInfo.m_lResourceSize != fileInfo.Length) { return(false); } if (resourceInfo.m_dateResource != fileInfo.LastWriteTime) { return(false); } if (File.Exists(szResource + @".meta") == true) { FileInfo metaFileInfo = new FileInfo(szResource + @".meta"); if (resourceInfo.m_lMetaResourceSize != metaFileInfo.Length) { return(false); } if (resourceInfo.m_dateMetaResource != metaFileInfo.LastWriteTime) { return(false); } } return(true); }
public bool AddResource(string szResourceFullPath, int nProperty = 0) { if (File.Exists(szResourceFullPath) == false) { return(false); } if (AssetBundleInfo.HasIgnoreExtension(szResourceFullPath) == true) { return(false); } string szlowerResourcePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath).ToLower(); if (m_ResourceList.ContainsKey(szlowerResourcePath) == true) { return(false); } AssetBundleResourceInfo resource = new AssetBundleResourceInfo(); resource.m_szResourcePath = szResourceFullPath.Remove(szResourceFullPath.LastIndexOf(@"/")); resource.m_szResourceName = szResourceFullPath.Substring(szResourceFullPath.LastIndexOf(@"/")); if (!CoreApplication.IsMobile) { FileInfo fileInfo = new FileInfo(szResourceFullPath); resource.m_dateResource = fileInfo.LastWriteTime; resource.m_lResourceSize = fileInfo.Length; FileInfo metaFileInfo = new FileInfo(szResourceFullPath + @".meta"); resource.m_dateMetaResource = metaFileInfo.LastWriteTime; resource.m_lMetaResourceSize = metaFileInfo.Length; } string szAssetBundlePath = resource.m_szResourcePath.Remove(resource.m_szResourcePath.LastIndexOf(@"/")); string szAssetBundleName = resource.m_szResourcePath.Substring(resource.m_szResourcePath.LastIndexOf(@"/")); // 개별 빌드시에 오동작 체크 if (nProperty == 1) { szAssetBundlePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath); szAssetBundleName = szAssetBundlePath.Substring(szAssetBundlePath.LastIndexOf(@"/")); } string szAssetBundleFullPath = szAssetBundlePath + szAssetBundleName; resource.m_AssetBundleKey = szAssetBundleFullPath; resource.m_nProperty = nProperty; // 특성을 저장 AssetBundleInfo assetBundleInfo = null; if (m_AssetBundleList.ContainsKey(szAssetBundleFullPath) == true) { assetBundleInfo = m_AssetBundleList[szAssetBundleFullPath]; } else { assetBundleInfo = new AssetBundleInfo(); assetBundleInfo.m_nVersion = @"0"; assetBundleInfo.m_szAssetBundlePath = szAssetBundlePath; assetBundleInfo.m_szAssetRealBundleName = szAssetBundleName; assetBundleInfo.GenerateBundleName(szResourceFullPath, szAssetBundleFullPath, nProperty); m_AssetBundleList.Add(szAssetBundleFullPath, assetBundleInfo); } assetBundleInfo.m_ResourceList.Add(szlowerResourcePath, resource); m_ResourceList.Add(szlowerResourcePath, resource); Debug.Log("Add Resources - @" + szlowerResourcePath); return(true); }