Beispiel #1
0
		public static ReplOptions TryCreate(ITextViewOptionsGroup group, IContentTypeRegistryService contentTypeRegistryService, IReplOptionsDefinitionMetadata md) {
			if (group == null)
				throw new ArgumentNullException(nameof(group));
			if (contentTypeRegistryService == null)
				throw new ArgumentNullException(nameof(contentTypeRegistryService));
			if (md == null)
				throw new ArgumentNullException(nameof(md));

			if (md.ContentType == null)
				return null;
			var contentType = contentTypeRegistryService.GetContentType(md.ContentType);
			if (contentType == null)
				return null;

			if (md.Guid == null)
				return null;
			Guid guid;
			if (!Guid.TryParse(md.Guid, out guid))
				return null;

			if (md.LanguageName == null)
				return null;

			return new ReplOptions(group, contentType, guid, md.LanguageName);
		}
Beispiel #2
0
        public static ReplOptions TryCreate(ITextViewOptionsGroup group, IContentTypeRegistryService contentTypeRegistryService, IReplOptionsDefinitionMetadata md)
        {
            if (group == null)
            {
                throw new ArgumentNullException(nameof(group));
            }
            if (contentTypeRegistryService == null)
            {
                throw new ArgumentNullException(nameof(contentTypeRegistryService));
            }
            if (md == null)
            {
                throw new ArgumentNullException(nameof(md));
            }

            if (md.ContentType == null)
            {
                return(null);
            }
            var contentType = contentTypeRegistryService.GetContentType(md.ContentType);

            if (contentType == null)
            {
                return(null);
            }

            if (md.Guid == null)
            {
                return(null);
            }
            if (!Guid.TryParse(md.Guid, out var guid))
            {
                return(null);
            }

            if (md.LanguageName == null)
            {
                return(null);
            }

            return(new ReplOptions(group, contentType, guid, md.LanguageName));
        }