private static bool IsSupported(string fileName)
        {
            string extension = Path.GetExtension(fileName).ToLowerInvariant();
            string[] allowed = new[] { ".js", ".css", ".html", ".htm", ".less", ".scss", ".coffee", ".iced", ".config" };

            return allowed.Contains(extension);
        }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = this.EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);

            $rootSafeItemName$ commandFilter = new $rootSafeItemName$(textView);
            IOleCommandTarget next;
            textViewAdapter.AddCommandFilter(commandFilter, out next);

            commandFilter.Next = next;
        }
        /// <summary>
        /// The initialise.
        /// </summary>
        public void Initialise()
        {
            var routes = RouteTable.Routes;
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{filename}.ashx/{*pathInfo}");
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

            // taxonomy route.
            var taxonomyRouteOptions = new { controller = "tag", action = "tags", tagId = string.Empty};
            const string TaxonomyRouteValues = "tags/{tagId}";

            routes.Add(new LowercaseRoute(TaxonomyRouteValues, new RouteValueDictionary(taxonomyRouteOptions), new MvcRouteHandler()));

            // Search route.
            var searchOptions = new { controller = "rss", action = "feed", url = string.Empty, postUrl = string.Empty };
            const string SearchValues = "rss";

            routes.Add(new LowercaseRoute(SearchValues, new RouteValueDictionary(searchOptions), new MvcRouteHandler()));

            // Rss route.
            var rssOptions = new { controller = "search", action = "index", url = string.Empty, postUrl = string.Empty };
            const string RssValues = "search";

            routes.Add(new LowercaseRoute(RssValues, new RouteValueDictionary(rssOptions), new MvcRouteHandler()));

            // blog post archive.
            var blogPostArchiveOptions = new { controller = "blog", action = "archiveByYear", url = string.Empty, archiveYear = string.Empty };
            const string BlogPostArchiveValues = "archive/{url}/{archiveYear}";

            routes.Add(new LowercaseRoute(BlogPostArchiveValues, new RouteValueDictionary(blogPostArchiveOptions), new MvcRouteHandler()));

            // user blog listing.
            var userBlogListingOptions = new { controller = "blog", action = "ReadUserBlogs", username = string.Empty };
            const string UserBlogListingValues = "{username}/blogs";

            routes.Add(new LowercaseRoute(UserBlogListingValues, new RouteValueDictionary(userBlogListingOptions), new MvcRouteHandler()));

            // blog post archive.
            var blogPostArchiveMonthOptions = new { controller = "blog", action = "archiveByMonth", url = string.Empty, archiveYear = string.Empty, archiveMonth = string.Empty };
            const string BlogPostArchiveMonthValues = "archive/{url}/{archiveMonth}/{archiveYear}";

            routes.Add(new LowercaseRoute(BlogPostArchiveMonthValues, new RouteValueDictionary(blogPostArchiveMonthOptions), new MvcRouteHandler()));

            // blog route.
            var routeOptions = new { controller = "blog", action = "index", url = string.Empty, postUrl = string.Empty };
            const string RouteValues = "{action}/{controller}/{url}/{postUrl}";

            routes.Add(new LowercaseRoute(RouteValues, new RouteValueDictionary(routeOptions), new MvcRouteHandler()));

            // Default route.
            var defaultRouteOptions = new { controller = "blog", action = "index"};
            const string defaultRouteValues = "{action}/{controller}";

            routes.Add(new LowercaseRoute(defaultRouteValues, new RouteValueDictionary(defaultRouteOptions), new MvcRouteHandler()));
        }
示例#4
0
        void IScriptPack.Initialize(IScriptPackSession session)
        {
            //session.AddReference("Superscribe");
            var namespaces = new[]
                {
                    "Superscribe.ScriptCS",
                    "Superscribe"
                }.ToList();

            namespaces.ForEach(session.ImportNamespace);
        }
        private ICommandConverter[] SetupCommandConverter()
        {
            _container = new CompositionContainer();
            var batch = new CompositionBatch();
            _item = new SimpleCommand();
            batch.AddExportedValue<IItem>(_item);

            _container.Compose(batch);

            var converters = new[] {new ICommandConverter(_container)};
            _luceneStorage = new LuceneStorage(converters);
            return converters;
        }
        void IScriptPack.Initialize(IScriptPackSession session)
        {
            session.AddReference("System.Net.Http");
            var namespaces = new[]
                {
                    "System.Web.Http",
                    "System.Web.Http.Routing",
                    "System.Net.Http",
                    "System.Net.Http.Headers",
                    "Owin"
                }.ToList();

            namespaces.ForEach(session.ImportNamespace);
        }
        public void Initialize(IScriptPackSession session)
        {
            var namespaces = new[]
              {
            "System.Net",
            "Microsoft.WindowsAzure.Management.Compute.Models",
            "Microsoft.WindowsAzure.Management.Compute",
            "Microsoft.WindowsAzure.Management.MediaServices",
            "Microsoft.WindowsAzure.Management.MediaServices.Models",
            "Microsoft.WindowsAzure.Management.Models",
            "Microsoft.WindowsAzure.Management.Monitoring",
            "Microsoft.WindowsAzure.Management.Monitoring.Alerts",
            "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models",
            "Microsoft.WindowsAzure.Management.Monitoring.Autoscale",
            "Microsoft.WindowsAzure.Management.Monitoring.Autoscale.Models",
            "Microsoft.WindowsAzure.Management.Monitoring.Metrics",
            "Microsoft.WindowsAzure.Management.Monitoring.Metrics.Models",
            "Microsoft.WindowsAzure.Management.Scheduler",
            "Microsoft.WindowsAzure.Management.Scheduler.Models",
            "Microsoft.WindowsAzure.Management.ServiceBus",
            "Microsoft.WindowsAzure.Management.ServiceBus.Models",
            "Microsoft.WindowsAzure.Management.Sql.Models",
            "Microsoft.WindowsAzure.Management.Sql",
            "Microsoft.WindowsAzure.Management.Storage.Models",
            "Microsoft.WindowsAzure.Management.Storage",
            "Microsoft.WindowsAzure.Management.VirtualNetworks.Models",
            "Microsoft.WindowsAzure.Management.VirtualNetworks",
            "Microsoft.WindowsAzure.Management.WebSites.Models",
            "Microsoft.WindowsAzure.Management.WebSites",
            "Microsoft.WindowsAzure.Management",
            "Microsoft.WindowsAzure",
            "Microsoft.WindowsAzure.Common",
              }.ToList();

              var references = new[]
              {
            "System.Net",
              }.ToList();

              namespaces.ForEach(session.ImportNamespace);
              references.ForEach(session.AddReference);

              _scriptArgs = session.ScriptArgs;
        }