public int CompareTo(object obj) { int result = 0; try { VersionModel model = obj as VersionModel; if (this.ToVersion.CompareTo(model.ToVersion) < 0) { result = -1; } else { result = 1; } } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); } return(result); }
//解析节点 private void parse(SecurityElement dom, string domPath, List <VersionModel> versionList) { var nodes = parseNodes(dom, domPath); if (nodes == null) { return; } foreach (SecurityElement item in nodes) { if (item == null) { continue; } VersionModel model = new VersionModel(); var fromNode = item.SearchForChildByTag("FromVersion"); if (fromNode != null) { model.FromVersion = fromNode.Text; } var ToVersion = item.SearchForChildByTag("ToVersion"); if (ToVersion != null) { model.ToVersion = ToVersion.Text; } var PatchFile = item.SearchForChildByTag("PatchFile"); if (PatchFile != null) { model.ResourceUrl = PatchFile.Text; } var PatchFileMD5 = item.SearchForChildByTag("PatchFileMD5"); if (PatchFileMD5 != null) { model.Md5 = PatchFileMD5.Text; } var FileSize = item.SearchForChildByTag("FileSize"); if (FileSize != null) { model.FileSize = FileSize.Text; } model.Stage = model.ToVersion; var mapFile = item.SearchForChildByTag("mapFile"); if (mapFile != null) { model.Map_url = mapFile.Text; } var mapFileMD5 = item.SearchForChildByTag("mapFileMD5"); if (mapFileMD5 != null) { model.Map_md5 = mapFileMD5.Text; } var mapFileSize = item.SearchForChildByTag("mapFileSize"); if (mapFileSize != null) { model.Map_size = mapFileSize.Text; } versionList.Add(model); } }