public CustomRequirement(string requirement) { string[] sa = requirement.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries); if (sa.Length == 0) { m_min = new CustomVersion(); m_max = new CustomVersion(); } else { if (sa.Length == 1) { m_min = new CustomVersion(); m_max = new CustomVersion(sa[0]); } else { if (sa.Length == 2) { m_min = new CustomVersion(sa[0]); m_max = new CustomVersion(sa[1]); } else { m_range = new CustomVersion[sa.Length]; for (int i = 0; i < sa.Length; i++) { m_range[i] = new CustomVersion(sa[i]); } } } } }
public bool IsCompatibleWith(CustomVersion cv) { if (cv == null) { return(false); } if (m_min == null || m_max == null) { for (int i = 0; i < m_range.Length; i++) { if (cv.IsCompatibleWith(m_range[i])) { return(true); } } // we didn't find any compatible version return(false); } else { return(cv.IsCompatibleWith(m_min) && cv.IsCompatibleWith(m_max)); } }
public CustomRequirement(CustomVersion min, CustomVersion max) { m_min = min; m_max = max; }