public List<PackageInfo> GetPackages() { try { List<PackageInfo> packagelist = new List<PackageInfo>(); string path = HostingEnvironment.MapPath("~/Repository Server"); DirectoryInfo di = new DirectoryInfo(path); FileInfo[] files = di.GetFiles(); string fname = ""; VersionManager.Version v = new VersionManager.Version(); foreach (FileInfo file in files) { if (!file.Name.Contains(".xml-")) { //XDocument xdoc = new XDocument(file.Name + ".xml"); PackageInfo p = new PackageInfo(); string[] s = file.Name.Split('-'); for (int i = 0; i < s.Length - 1; i++) { fname += s[i]; } p.fileName = file.Name; p.VersionValue = Convert.ToInt32(s[s.Length - 1]); p.CreationDate = file.CreationTime.ToString(); p.Status = Status(path, fname + ".xml-" + p.VersionValue); packagelist.Add(p); fname = ""; } } return packagelist; } catch { return null; } }
public int CheckInPackages(FileInfo filename) { try { VersionManager.Version v = new VersionManager.Version(); string path = HostingEnvironment.MapPath("~/Repository Server"); int ver = v.GetPackageVersion(path, filename); return ver; } catch { return 1; } }