public static string ComposeSingleTextureURL(string singleTexturePath) { // '\\abc\\foo\\' // 会被转为 // 'abc/foo' string unixStyle = SysUtil.ToUnixPath(SysUtil.TrimHeadTailSeparators(singleTexturePath)); return(ComposeURL(unixStyle, ResProtocol.TileSingleTextureMarker)); }
public static AssetDesc CreateDesc(string assetPath) { string unixStyle = SysUtil.ToUnixPath(SysUtil.TrimHeadTailSeparators(assetPath)); string filename = Path.GetFileNameWithoutExtension(unixStyle); string ext = Path.GetExtension(unixStyle); if (string.IsNullOrEmpty(filename)) { Logging.Instance.Log("CreateDesc() failed (invalid asset path): {0}.", assetPath); return(null); } string fullpath = Path.Combine(GState.AssetRoot, SysUtil.ToWindowsPath(unixStyle)); if (!File.Exists(fullpath)) { Logging.Instance.Log("CreateDesc() failed (file not found): {0}.", assetPath); return(null); } string digest = SysUtil.GetFileMD5AsString(fullpath); if (string.IsNullOrEmpty(digest)) { Logging.Instance.Log("CreateDesc() failed (md5 calculating failed): {0}.", fullpath); return(null); } AssetType type = AssetType.Unknown; if (ext.ToLower() == "png") { type = AssetType.PNG; } AssetDesc desc = new AssetDesc(); desc.LinkTime = DateTime.Now; desc.Name = filename + "_" + desc.LinkTime.ToString("yyyyMMdd_HHmmss"); desc.Type = type; desc.Path = unixStyle; desc.Digest = digest; return(desc); }