Esempio n. 1
0
 public static void RegisterExtensions(
     IContentTypeRegistryService/*!*/ contentTypeRegistryService,
     IFileExtensionRegistryService/*!*/ fileExtensionRegistryService,
     IContentType/*!*/ contentType,
     IEnumerable<string>/*!*/ fileExtensions
     )
 {
     foreach (var extension in fileExtensions) {
         if (fileExtensionRegistryService.GetContentTypeForExtension(extension) == contentTypeRegistryService.UnknownContentType) {
             fileExtensionRegistryService.AddFileExtension(extension, contentType);
         }
     }
 }
Esempio n. 2
0
 public static void RegisterExtensions(
     IContentTypeRegistryService /*!*/ contentTypeRegistryService,
     IFileExtensionRegistryService /*!*/ fileExtensionRegistryService,
     IContentType /*!*/ contentType,
     IEnumerable <string> /*!*/ fileExtensions
     )
 {
     foreach (var extension in fileExtensions)
     {
         if (fileExtensionRegistryService.GetContentTypeForExtension(extension) == contentTypeRegistryService.UnknownContentType)
         {
             fileExtensionRegistryService.AddFileExtension(extension, contentType);
         }
     }
 }
        public static StyleSheet GetOrCreateStyleSheet(GraphNode node, IFileExtensionRegistryService fileService)
        {
            StyleSheet stylesheet = node.Id.GetNestedValueByName <StyleSheet>(CssGraphSchema.CssStyleSheet);

            if (stylesheet == null)
            {
                Uri          url             = node.Id.GetNestedValueByName <Uri>(CodeGraphNodeIdName.File);
                IContentType contentType     = fileService.GetContentTypeForExtension(Path.GetExtension(url.LocalPath));
                string       contentTypeName = (contentType != null) ? contentType.TypeName : CssContentTypeDefinition.CssContentType;

                ICssParser parser = contentTypeName == LessContentTypeDefinition.LessContentType ? new LessParser() : new CssParser();
                stylesheet = parser.Parse(File.ReadAllText(url.LocalPath), false);
            }

            return(stylesheet);
        }
Esempio n. 4
0
        private bool IsSqlToolsInstalled()
        {
            bool installed = false;

            // Try modern registration first
            var ct = _fers.GetContentTypeForExtension(".sql");

            if (ct != null && ct != _ctrs.UnknownContentType)
            {
                installed = true;
            }
            else
            {
                // Fall back to IVs* type of registration
                ct        = _ctrs.GetContentType("SQL Server Tools");
                installed = ct != null && ct != _ctrs.UnknownContentType;
            }
            return(installed);
        }
Esempio n. 5
0
        private static void RegisterFileExtensions(IFileExtensionRegistryService fileExtensionRegistry, string sExtensions, IContentType contentType, ILogger logger)
        {
            var extensions = sExtensions.Split(new char[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var ext in extensions)
            {
                try
                {
                    //fileExtensionRegistry.RemoveFileExtension(ext);
                    fileExtensionRegistry.AddFileExtension(ext, contentType);
                }
                catch (InvalidOperationException ioe)
                {
                    var          otherContentType = fileExtensionRegistry.GetContentTypeForExtension(ext);
                    const string title            = "GLSL language integration";
                    var          message          = $"{title}:Extension '{ext}' is ignored because it is already registered " +
                                                    $"with the content type '{otherContentType.TypeName}'. " +
                                                    $"Please use a different extension on the {title} options page!" +
                                                    $"Following is the detailed exception message {ioe}";
                    logger.Log(message, true);
                }
            }
        }
 public CssDependencyGraph(string extension, IFileExtensionRegistryService fileExtensionRegistry)
     : base(fileExtensionRegistry.GetContentTypeForExtension(extension.TrimStart('.')), fileExtensionRegistry)
 {
     Extension = extension;
     parserFactory = CssParserLocator.FindComponent(ContentType);
 }
Esempio n. 7
0
 public CssDependencyGraph(string extension, IFileExtensionRegistryService fileExtensionRegistry)
     : base(fileExtensionRegistry.GetContentTypeForExtension(extension.TrimStart('.')), fileExtensionRegistry)
 {
     Extension     = extension;
     parserFactory = CssParserLocator.FindComponent(ContentType);
 }