コード例 #1
0
        public CatalogueElementName(CatalogueName catalogueName, System.Enum element, string name)
        {
            const string method = ".ctor";

            // Check catalogue name.

            if (catalogueName == null)
            {
                throw new NullParameterException(typeof(CatalogueElementName), method, "catalogueName");
            }

            // Check element.

            if (!NameRegex.IsMatch(element.ToString()))
            {
                throw new InvalidParameterFormatException(typeof(CatalogueElementName), method, "element", element.ToString(), Constants.Validation.CompleteNamePattern);
            }

            // Check name.

            if (name == null)
            {
                throw new NullParameterException(typeof(CatalogueElementName), method, "name");
            }
            if (!NameRegex.IsMatch(name))
            {
                throw new InvalidParameterFormatException(typeof(CatalogueElementName), method, "name", name, Constants.Validation.CompleteNamePattern);
            }

            // Assign.

            m_catalogueName = catalogueName.Clone();
            m_element       = element.ToString();
            m_name          = name;
        }
コード例 #2
0
        public CatalogueElementName(string reference)
        {
            const string method = ".ctor";

            // Use a capturing regex to extract the name, namespace and version.

            Match match = CapturingElementReferenceRegex.Match(reference);

            if (!match.Success)
            {
                throw new InvalidParameterFormatException(typeof(CatalogueElementName), method, "reference", reference, Constants.Validation.CompleteElementReferencePattern);
            }

            m_catalogueName = CatalogueName.CreateUnchecked(match.Groups["CatalogueName"].Value);
            m_element       = match.Groups["Element"].Value;
            m_name          = match.Groups["Name"].Value;
        }
コード例 #3
0
ファイル: CatalogueName.cs プロジェクト: formist/LinkMe
        public static string ToXsiType(CatalogueName catalogueName)
        {
            const string method = "ToXsiType";

            if (catalogueName == null)
            {
                throw new NullParameterException(typeof(CatalogueName), method, "catalogueName");
            }

            string xsiType = catalogueName.FullName;

            if (catalogueName.Version != null)
            {
                xsiType += "-" + catalogueName.Version;
            }
            return(xsiType);
        }
コード例 #4
0
ファイル: CatalogueName.cs プロジェクト: formist/LinkMe
        public int CompareTo(CatalogueName other)
        {
            int result = _namespace.CompareTo(other._namespace);

            if (result != 0)
            {
                return(result);
            }
            result = _name.CompareTo(other._name);
            if (result != 0)
            {
                return(result);
            }
            if (_version == null)
            {
                return(other._version == null ? 0 : -1);
            }
            return(other._version == null ? 1 : _version.CompareTo(other._version));
        }
コード例 #5
0
 /// <summary>
 /// Private constructor for cloning - performs no checks.
 /// </summary>
 private CatalogueElementName(string name, string element, CatalogueName catalogueName)
 {
     m_name          = name;
     m_element       = element;
     m_catalogueName = catalogueName.Clone();
 }
コード例 #6
0
 private static string GetReferenceUnchecked(CatalogueName catalogueName, string element, string name)
 {
     return(element + "=" + name + ", " + catalogueName.FullyQualifiedReference);
 }