示例#1
0
        public static UANameSpace Convert(UANodesetResult info)
        {
            UANameSpace nameSpace = new UANameSpace();

            nameSpace.Title            = info.Title;
            nameSpace.Nodeset.Version  = info.Version;
            nameSpace.Contributor.Name = info.Contributor;

            switch (info.License)
            {
            case "MIT":
            {
                nameSpace.License = License.MIT;
                break;
            }

            case "ApacheLicense20":
            {
                nameSpace.License = License.ApacheLicense20;
                break;
            }

            case "Custom":
            {
                nameSpace.License = License.Custom;
                break;
            }

            default:
            {
                nameSpace.License = License.Custom;
                break;
            }
            }
            nameSpace.Nodeset.PublicationDate = (info.CreationTime != null) ? info.CreationTime.Value : DateTime.MinValue;
            nameSpace.Nodeset.NamespaceUri    = string.IsNullOrEmpty(info.NameSpaceUri) ? null : new Uri(info.NameSpaceUri);
            nameSpace.Nodeset.Identifier      = info.Id;

            return(nameSpace);
        }
示例#2
0
        /// <summary>
        /// Switch case with all the names for the members
        /// </summary>
        private static void ConvertCases(UANameSpace nameSpace, MetadataResult metadata)
        {
            switch (metadata.Name)
            {
                #region NameSpace Cases
            case "addressspacedescription":
            {
                nameSpace.Description = metadata.Value;
                break;
            }

            case "copyright":
            {
                nameSpace.CopyrightText = metadata.Value;
                break;
            }

            case "documentationurl":
            {
                nameSpace.DocumentationUrl = new Uri(metadata.Value);
                break;
            }

            case "licenseurl":
            {
                nameSpace.LicenseUrl = new Uri(metadata.Value);
                break;
            }

            case "purchasinginfo":
            {
                nameSpace.PurchasingInformationUrl = new Uri(metadata.Value);
                break;
            }

            case "keywords":
            {
                nameSpace.Keywords = metadata.Value.Split(new char[] { ',' });
                break;
            }

            case "locales":
            {
                nameSpace.SupportedLocales = metadata.Value.Split(new char[] { ',' });
                break;
            }

            case "numdownloads":
            {
                nameSpace.NumberOfDownloads = System.Convert.ToUInt32(metadata.Value, CultureInfo.InvariantCulture);
                break;
            }

            case "validationstatus":
            {
                nameSpace.ValidationStatus = metadata.Value;
                break;
            }

            case "addressspacename":
            {
                nameSpace.Title = metadata.Value;
                break;
            }

            case "license":
            {
                switch (metadata.Value)
                {
                case "MIT":
                {
                    nameSpace.License = License.MIT;
                    break;
                }

                case "ApacheLicense20":
                {
                    nameSpace.License = License.ApacheLicense20;
                    break;
                }

                case "Custom":
                {
                    nameSpace.License = License.Custom;
                    break;
                }

                default:
                {
                    nameSpace.License = License.Custom;
                    break;
                }
                }
                break;
            }

            case "version":
            {
                nameSpace.Nodeset.Version = metadata.Value;
                break;
            }

            case "releasenotes":
            {
                nameSpace.ReleaseNotesUrl = new Uri(metadata.Value);
                break;
            }

            case "testspecification":
            {
                nameSpace.TestSpecificationUrl = new Uri(metadata.Value);
                break;
            }
                #endregion

                #region Organistion Cases
            case "orgname":
            {
                nameSpace.Contributor.Name = metadata.Value;
                break;
            }

            case "orgdesciption":
            {
                nameSpace.Contributor.Description = metadata.Value;
                break;
            }

            case "orgcontact":
            {
                nameSpace.Contributor.ContactEmail = metadata.Value;
                break;
            }

            case "orgwebsite":
            {
                nameSpace.Contributor.Website = new Uri(metadata.Value);
                break;
            }

            case "orglogo":
            {
                nameSpace.Contributor.LogoUrl = new Uri(metadata.Value);
                break;
            }

                #endregion
            case "adressspacecreationtime":
            {
                nameSpace.Nodeset.PublicationDate = DateTime.ParseExact(metadata.Value, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                break;
            }

            default:
            {
                break;
            }
            }
        }