示例#1
0
        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]);
                        }
                    }
                }
            }
        }
示例#2
0
        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));
            }
        }
示例#3
0
 public CustomRequirement(CustomVersion min, CustomVersion max)
 {
     m_min = min;
     m_max = max;
 }