/// <summary> /// 解析版本列表文件到对像 /// </summary> /// <param name="v"></param> /// <param name="mapping"></param> /// <param name="sizeMapping"></param> public static void ParserVersion(string v, Dictionary <string, HashSizeFile> mapping) { if (string.IsNullOrEmpty(v)) { return; } StringReader reader = new StringReader(v); string key = reader.ReadLine(); string[] keyHash; while (key != null) { keyHash = key.Split(':'); HashSizeFile hashSizeFile = new HashSizeFile(keyHash[0]); hashSizeFile.hash = keyHash[1]; int size = 0; int.TryParse(keyHash[2], out size); hashSizeFile.size = size; mapping[hashSizeFile.uri] = hashSizeFile; key = reader.ReadLine(); } }
/// <summary> /// 本地Hash文件列表 /// </summary> /// <param name="v"></param> public void initLocal() { IDictionary dic = null; string fullPath = VdatPath; if (File.Exists(fullPath)) { dic = FileHelper.GetAMF(fullPath) as IDictionary; } localMapping.Clear(); if (dic == null) { return; } foreach (DictionaryEntry entry in dic) { HashSizeFile hashSizeFile = new HashSizeFile((string)entry.Key); hashSizeFile.hash = (string)entry.Value; localMapping[hashSizeFile.uri] = hashSizeFile; } }