示例#1
0
        public Categories()
        {
            Dependencies.AddRange(new[]
            {
                nameof(Posts),
            });

            ProcessModules = new ModuleList
            {
                new ReplaceDocuments(nameof(Posts)),
                new GroupDocuments(CustomKeys.Category),
                new FilterDocuments(Config.FromDocument(doc => !string.IsNullOrEmpty(doc.GetString(Keys.GroupKey)))),
                new ForEachDocument(
                    new SetMetadata(CustomKeys.CategoryPosts, Config.FromDocument(doc => doc.GetChildren())),
                    new SetMetadata(CustomKeys.Title, Config.FromDocument(doc => doc.GetString(Keys.GroupKey))),
                    new SetMetadata(CustomKeys.Subtitle, Config.FromDocument(doc => $"Pokémon attrapés avec la méthode <strong>‘{doc.GetString(Keys.GroupKey)}’</strong>")),
                    new SetMetadata(CustomKeys.WritePath, Config.FromDocument(doc => $"categories/{doc.GetString(Keys.GroupKey).Slugify()}/index.html"))
                    ),
                new RenderRazor().WithLayout((NormalizedPath)"/_Category.cshtml"),
                new SetDestination(Config.FromDocument(doc => (NormalizedPath)doc.GetString(CustomKeys.WritePath)))
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#2
0
        public SiteMapPipeline()
        {
            Dependencies.AddRange(nameof(PostsPipeline), nameof(HomePipeline));
            ProcessModules = new ModuleList(
                // pull documents from other pipelines
                new ReplaceDocuments(Dependencies.ToArray()),
                new SetMetadata(Keys.SitemapItem, Config.FromDocument((doc, ctx) =>
            {
                var siteMapItem = new SitemapItem(doc.Destination.FullPath)
                {
                    LastModUtc = doc.Get <DateTime?>(KontentKeys.System.LastModified, null)
                };

                if (!siteMapItem.LastModUtc.HasValue)
                {
                    siteMapItem.LastModUtc      = DateTime.UtcNow;
                    siteMapItem.ChangeFrequency = SitemapChangeFrequency.Weekly;
                }
                else
                {
                    siteMapItem.ChangeFrequency = SitemapChangeFrequency.Monthly;
                }

                return(siteMapItem);
            })),

                new GenerateSitemap()
                );

            OutputModules = new ModuleList {
                new WriteFiles(),
            };
        }
示例#3
0
 protected ApplyLayoutPipeline()
 {
     PostProcessModules = new ModuleList
     {
         new SetMetadata("template", Config.FromContext(async ctx => await ctx.Outputs
                                                        .FromPipeline(nameof(LayoutPipeline))
                                                        .First(x => x.Source.FileName == "layout.hbs")
                                                        .GetContentStringAsync())),
         new RenderHandlebars("template")
         .Configure(async(context, document, handlebars) =>
         {
             foreach (var partial in context.Outputs
                      .FromPipeline(nameof(LayoutPipeline)).WhereContainsKey("partial"))
             {
                 handlebars.RegisterTemplate(
                     partial.GetString("partial"),
                     await partial.GetContentStringAsync());
             }
         }).WithModel(Config.FromDocument(async(doc, ctx) => new
         {
             title = doc.GetString(Keys.Title),
             body  = await doc.GetContentStringAsync(),
             link  = ctx.GetLink(doc),
             year  = ctx.Settings.GetString(FeedKeys.Copyright)
         })),
         new SetContent(Config.FromDocument(x => x.GetString("template")))
     };
 }
示例#4
0
        private void InitModules()
        {
            ModuleList.Clear();
            AddedModuleList.Clear();
            if (SelectedApplication != null)
            {
                List <DynEntity> allModules = ApplicationDesignService.GetAllApplictionModuleCollection();
                List <DynEntity> currentApplicationModules = ApplicationDesignService.GetAplicationModulesByAplicationID(SelectedApplication.ApplicationID);

                foreach (var module in allModules)
                {
                    bool isHave = false;
                    foreach (var addedModule in currentApplicationModules)
                    {
                        if (Convert.Equals(addedModule["ModuleID"], module["ModuleID"]))
                        {
                            AddedModuleList.Add(new ApplicationModule()
                            {
                                ModuleName = module["ModuleName"] as string, ModuleID = (int)module["ModuleID"]
                            });
                            isHave = true;
                            break;
                        }
                    }
                    if (!isHave)
                    {
                        ModuleList.Add(new ApplicationModule()
                        {
                            ModuleName = module["ModuleName"] as string, ModuleID = (int)module["ModuleID"]
                        });
                    }
                }
            }
        }
        public unsafe IntPtr TryGetMarshallerForDelegate(RuntimeTypeHandle delegateTypeHandle)
        {
            int delegateHashcode = delegateTypeHandle.GetHashCode();

            foreach (NativeFormatModuleInfo module in ModuleList.EnumerateModules())
            {
                NativeReader delegateMapReader;
                if (TryGetNativeReaderForBlob(module, ReflectionMapBlob.DelegateMarshallingStubMap, out delegateMapReader))
                {
                    NativeParser    delegateMapParser = new NativeParser(delegateMapReader, 0);
                    NativeHashtable delegateHashtable = new NativeHashtable(delegateMapParser);

                    ExternalReferencesTable externalReferences = default(ExternalReferencesTable);
                    externalReferences.InitializeCommonFixupsTable(module);

                    var          lookup = delegateHashtable.Lookup(delegateHashcode);
                    NativeParser entryParser;
                    while (!(entryParser = lookup.GetNext()).IsNull)
                    {
                        RuntimeTypeHandle foundDelegateType = externalReferences.GetRuntimeTypeHandleFromIndex(entryParser.GetUnsigned());
                        if (foundDelegateType.Equals(delegateTypeHandle))
                        {
                            byte *pByte = (byte *)externalReferences.GetIntPtrFromIndex(entryParser.GetUnsigned());
                            return((IntPtr)pByte);
                        }
                    }
                }
            }

            return(IntPtr.Zero);
        }
示例#6
0
        protected IssuePages(TotalIssueCounts totals)
        {
            Dependencies.Add(nameof(Issues));

            ProcessModules = new ModuleList
            {
                new ExecuteConfig(
                    Config.FromContext(ctx => ctx.Outputs
                                       .FromPipeline(nameof(Issues))
                                       .Where(doc => DocumentPredicate == null || DocumentPredicate(doc))
                                       .SelectMany(doc => doc
                                                   .GetList <Issue>("Issues")
                                                   .Where(i => IssuePredicate == null || IssuePredicate(i))
                                                   .Select(i => new PagedIssue(i, doc)))
                                       .OrderByDescending(x => x.CreatedAt)
                                       .Partition(24, count => SetTotal(count, totals))
                                       .Select(x => ctx.CreateDocument(new MetadataItems
                {
                    { "Page", x.Key },
                    { "Issues", x.ToList() }
                })))),
                new GenerateJson(Config.FromDocument(doc => doc["Issues"]))
                .WithCamelCase(),
                new MinifyJs(),
                new SetDestination(Destination)
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
        public PagesPipeline(IDeliveryClient deliveryClient)
        {
            Dependencies.AddRange(nameof(HomepagePipeline), nameof(SiteMetadataPipeline));
            InputModules = new ModuleList {
                new Kontent <Page>(deliveryClient)
                .WithQuery(new IncludeTotalCountParameter(), new NotEmptyFilter("elements.body")),
                new SetDestination(Config.FromDocument((doc, ctx) => GetPath(doc))),
            };

            ProcessModules = new ModuleList {
                new MergeContent(new ReadFiles(patterns: "Index.cshtml")),
                new RenderRazor()
                .WithModel(Config.FromDocument((document, context) =>
                {
                    var menuItem = document.AsKontent <Page>();
                    var model    = new HomeViewModel(menuItem,
                                                     new SidebarViewModel(
                                                         context.Outputs.FromPipeline(nameof(HomepagePipeline)).Select(x => x.AsKontent <Homepage>()).FirstOrDefault(),
                                                         context.Outputs.FromPipeline(nameof(SiteMetadataPipeline)).Select(x => x.AsKontent <SiteMetadata>()).FirstOrDefault(),
                                                         false, menuItem.Url));
                    return(model);
                }
                                               ))/*,
                                                  * new KontentImageProcessor()*/
            };

            OutputModules = new ModuleList {
                new WriteFiles(),
            };
        }
示例#8
0
        public Redirects()
        {
            Dependencies.Add(nameof(Content));

            ProcessModules = new ModuleList
            {
                new ReplaceDocuments(nameof(Content)),
                new FlattenTree(),
                new ExecuteConfig(Config.FromSettings(settings =>
                {
                    GenerateRedirects generateRedirects = new GenerateRedirects()
                                                          .WithMetaRefreshPages(settings.GetBool(WebKeys.MetaRefreshRedirects, true));
                    if (settings.GetBool(WebKeys.NetlifyRedirects, false))
                    {
                        generateRedirects = generateRedirects.WithAdditionalOutput(
                            "_redirects",
                            redirects => string.Join(Environment.NewLine, redirects.Select(r => $"/{r.Key} {r.Value}")));
                    }
                    return(generateRedirects);
                }))
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#9
0
        public List <ServiceItem> UpdateList(ModuleList moduleList)
        {
            List <ServiceItem> newList = new List <ServiceItem>();

            if (moduleList.ModuleInfoList != null)
            {
                foreach (ModuleInfo moduleInfo in moduleList.ModuleInfoList)
                {
                    string serviceName = moduleInfo.Name + " (" + moduleInfo.Version + ")";

                    ServiceItem ServiceItem = new ServiceItem();
                    ServiceItem.ServiceTitle = serviceName;
                    ServiceItem.Tag          = moduleInfo;

                    if (moduleInfo.Enabled == 0)
                    {
                        ServiceItem.MenuEnableHeader   = "Enable";
                        ServiceItem.ServiceStatusColor = (Brush)(new BrushConverter()).ConvertFromString("#FF0000");
                    }
                    else
                    {
                        ServiceItem.MenuEnableHeader   = "Disable";
                        ServiceItem.ServiceStatusColor = (Brush)(new BrushConverter()).ConvertFromString("#00FF00");
                    }

                    newList.Add(ServiceItem);
                }
            }

            return(newList);
        }
示例#10
0
        private void Refresh(bool rmodule, bool rmenu, bool rmenudtl, bool rrole, bool ruser)
        {
            if (rmodule)
            {
                ModuleList.Clear();
                ModuleList.AddRange(PubMaster.Mod.RoleSql.QueryWcsModuleList());
            }

            if (rmenu)
            {
                MenuList.Clear();
                MenuList.AddRange(PubMaster.Mod.RoleSql.QueryWcsMenuList());
            }

            if (rmenudtl)
            {
                MenuDtlList.Clear();
                MenuDtlList.AddRange(PubMaster.Mod.RoleSql.QueryWcsMenuDtlList());
            }

            if (rrole)
            {
                RoleList.Clear();
                RoleList.AddRange(PubMaster.Mod.RoleSql.QueryWcsRoleList());
            }

            if (ruser)
            {
                UserList.Clear();
                UserList.AddRange(PubMaster.Mod.RoleSql.QueryWcsUserList());
            }
        }
示例#11
0
        public HomePipeline()
        {
            Dependencies.AddRange(nameof(BookPipeline), nameof(RatingPipeline), nameof(AuthorPipeline), nameof(ContactPipeline));
            InputModules = new ModuleList
            {
                new ReadFiles("index.cshtml")
            };

            ProcessModules = new ModuleList {
                new RenderRazor().WithModel(Config.FromDocument((doc, context) =>
                {
                    var allBooks   = XperienceDocumentConverter.ToTreeNodes <Book>(context.Outputs.FromPipeline(nameof(BookPipeline)));
                    var allAuthors = XperienceDocumentConverter.ToTreeNodes <Author>(context.Outputs.FromPipeline(nameof(AuthorPipeline)));
                    var allRatings = XperienceDocumentConverter.ToCustomTableItems <RatingsItem>(context.Outputs.FromPipeline(nameof(RatingPipeline)), RatingsItem.CLASS_NAME);

                    var contactInfo      = XperienceDocumentConverter.ToTreeNodes <ContactUs>(context.Outputs.FromPipeline(nameof(ContactPipeline))).FirstOrDefault();
                    var booksWithReviews = allBooks.Select(b => new BookWithReviews(b, allRatings));
                    var authorsWithBooks = allAuthors.Select(a => new AuthorWithBooks(a, booksWithReviews));

                    return(new HomeViewModel()
                    {
                        Authors = authorsWithBooks,
                        Books = booksWithReviews,
                        ContactInfo = contactInfo
                    });
                })),
                new SetDestination(Config.FromDocument((doc, ctx) => {
                    return(new NormalizedPath("index.html"));
                }))
            };

            OutputModules = new ModuleList {
                new WriteFiles()
            };
        }
示例#12
0
        public void TestModuleList()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\CurrentBCTCmodules.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", currentDate,
                                                                             null, null, null, null, null, null);

            var component = new ModuleList();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Module Name"
            });
            expectedData.AddRange(new List <string> {
                "AAD-Admin"
            });
            expectedData.AddRange(new List <string> {
                "AED-Admin"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator"
            });
            TestUtility.AssertTableContent(table, expectedData, 1, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public SocialImages()
        {
            Dependencies.AddRange(nameof(Inputs));

            ProcessModules = new ModuleList
            {
                new GetPipelineDocuments(ContentType.Content),

                // Filter to non-archive content
                new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))),

                // Process the content
                new CacheDocuments
                {
                    new AddTitle(),
                    new SetDestination(true),
                    new ExecuteIf(Config.FromSetting(WebKeys.OptimizeContentFileNames, true))
                    {
                        new OptimizeFileName()
                    },
                    new GenerateSocialImage(),
                }
            };

            OutputModules = new ModuleList {
                new WriteFiles()
            };
        }
示例#14
0
        public NewsFeed()
        {
            Dependencies.AddRange(
                nameof(Blogs.Posts),
                nameof(Broadcasts.Episodes));

            ProcessModules = new ModuleList
            {
                new ReplaceDocuments(
                    nameof(Blogs.Posts),
                    nameof(Broadcasts.Episodes)),
                new FilterDocuments(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Recent)),
                new OrderDocuments(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Published)).Descending(),
                new GenerateFeeds()
                .WithAtomPath("feeds/news.atom")
                .WithRssPath("feeds/news.rss")
                .WithFeedTitle("Recent News From Discover .NET")
                .WithFeedDescription("A roundup of recent blog posts, podcasts, and more.")
                .WithItemTitle(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Title))
                .WithItemDescription(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Description))
                .WithItemPublished(Config.FromDocument(doc => (DateTime?)doc.Get <FeedItem>("FeedItems").Published.DateTime))
                .WithItemLink(Config.FromDocument(doc => TypeHelper.Convert <Uri>(doc.Get <FeedItem>("FeedItems").Link)))
                .WithItemId(Config.FromDocument(doc => TypeHelper.Convert <Uri>(doc.Get <FeedItem>("FeedItems").Link).ToString()))
                .WithItemAuthor(Config.FromDocument(doc =>
                                                    doc.Get <FeedItem>("FeedItems").Author
                                                    ?? doc.GetString("Author")
                                                    ?? doc.GetString("Title")))
                .WithItemImageLink(null)
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#15
0
        // Retreiving information from the previous created student list
        public StudentDetails(ModuleList store)
        {
            InitializeComponent();

            // Adding Student list items to the datagrid GUI
            datagrid_show_all.ItemsSource = _store.StudentList;
        }
        public Issues()
        {
            InputModules = new ModuleList
            {
                new ReadFiles(Config.FromContext(ctx => ctx.FileSystem.RootPath.Combine("../../data/projects/*.yml").FullPath)),
                new ExecuteIf(Config.FromContext(ctx => ctx.ApplicationState.IsCommand("preview") || ctx.Settings.GetBool("dev")))
                {
                    new OrderDocuments(Config.FromDocument(x => x.Source)),
                    new TakeDocuments(10)
                }
            };

            ProcessModules = new ModuleList
            {
                new LogMessage(Config.FromContext(ctx => $"Getting issue data for {ctx.Inputs.Length} issues...")),
                new ParseYaml(),
                new SetContent(string.Empty),
                new GetIssueGitHubData(),
                new FilterDocuments(Config.FromDocument(doc => doc.ContainsKey("Issues"))),
                new SetMetadata("ProjectKey", Config.FromDocument(x => x.Source.FileNameWithoutExtension.FullPath)),
                new GenerateJson(Config.FromDocument(doc => doc["Issues"]))
                .WithCamelCase(),
                new MinifyJs(),
                new SetDestination(Config.FromDocument(x => (FilePath)$"data/issues/projects/{x.Source.FileName.ChangeExtension(".json")}"))
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#17
0
        public TagIndexPipeline()
        {
            Dependencies.Add(nameof(TagsPipeline));

            InputModules = new ModuleList
            {
                new ReadFiles("_tagIndex.hbs")
            };

            ProcessModules = new ModuleList
            {
                new SetDestination(Config.FromValue(new NormalizedPath("./tags/index.html"))),
                new RenderHandlebars()
                .WithModel(Config.FromContext(context => new
                {
                    tags = context.Outputs.FromPipeline(nameof(TagsPipeline))
                           .OrderByDescending(x => x.GetChildren().Count)
                           .ThenBy(x => x.GetString(Keys.GroupKey))
                           .Select(x => x.AsTag(context)),
                }))
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#18
0
        /// <summary>
        /// Locate the containing module for a method and try to resolve its name based on start address.
        /// </summary>
        public static string GetMethodNameFromStartAddressIfAvailable(IntPtr methodStartAddress)
        {
            IntPtr moduleStartAddress = RuntimeAugments.GetOSModuleFromPointer(methodStartAddress);
            int    rva = (int)((nuint)methodStartAddress - (nuint)moduleStartAddress);

            foreach (TypeManagerHandle handle in ModuleList.Enumerate())
            {
                if (handle.OsModuleBase == moduleStartAddress)
                {
                    string name = _perModuleMethodNameResolverHashtable.GetOrCreateValue(handle.GetIntPtrUNSAFE()).GetMethodNameFromRvaIfAvailable(rva);
                    if (name != null)
                    {
                        return(name);
                    }
                }
            }

            // We haven't found information in the stack trace metadata tables, but maybe reflection will have this
            if (ReflectionExecution.TryGetMethodMetadataFromStartAddress(methodStartAddress,
                                                                         out MetadataReader reader,
                                                                         out TypeDefinitionHandle typeHandle,
                                                                         out MethodHandle methodHandle))
            {
                return(MethodNameFormatter.FormatMethodName(reader, typeHandle, methodHandle));
            }

            return(null);
        }
示例#19
0
        public ShellViewModel(IRegionManager rm, IEventAggregator ea)
        {
            _rm = rm;
            #region 加载列表
            ea.GetEvent <Models.Events.RegisterMenuEvent>().Subscribe(s =>
            {
                ModuleList.Add(new Menu_Module
                {
                    IconName   = s.IconName,
                    ModuleNmae = s.MenuName,
                    PageName   = s.PageName,
                });
            });
            #endregion

            #region 模块选择命令
            ModuleChangedCommand = new DelegateCommand <string>(p =>
            {
                if (p == null)
                {
                    return;
                }
                rm.RequestNavigate("主tab", p);
                NaviIndex = -1;
            });
            #endregion

            #region 关闭tabItem命令
            CloseTabItemCommadn = new DelegateCommand <object>(P =>
            {
                _rm.Regions["主tab"].Remove(P);
            });
            #endregion
        }
        public FeedsPipeline()
        {
            Dependencies.Add(nameof(PostsPipeline));
            ProcessModules = new ModuleList(
                // Pull documents from other pipelines
                new ReplaceDocuments(Dependencies.ToArray()),

                // Set metadata for the feeds module
                new SetMetaDataItems(
                    async(input, context) =>
            {
                var post    = input.AsKontent <Article>();
                var html    = await ParseHtml(input, context);
                var article = html?.GetElementsByTagName("article").FirstOrDefault()?.InnerHtml ?? "";

                return(new MetadataItems
                {
                    { FeedKeys.Title, post.Title },
                    { FeedKeys.Content, post.Description },
                    { FeedKeys.Description, post.Description },
                    { FeedKeys.Image, post.OgImage.FirstOrDefault()?.Url },      // TODO: make that a local image!
                    { FeedKeys.Published, post.PublishDate },
                    { FeedKeys.Content, article }
                });
            }),
                new GenerateFeeds()
                .WithFeedTitle("Lumen Blog")
                .WithFeedCopyright($"{DateTime.Today.Year}")
                );
            OutputModules = new ModuleList(
                new WriteFiles()
                );
        }
示例#21
0
 public SiteResources()
 {
     ProcessModules = new ModuleList
     {
         new CopyFiles("**/*{!.cshtml,!.md,!.less,!.yml,!.scss,}")
     };
 }
        private unsafe bool TryGetStructData(RuntimeTypeHandle structTypeHandle, out ExternalReferencesTable externalReferences, out NativeParser entryParser)
        {
            int structHashcode = structTypeHandle.GetHashCode();

            externalReferences = default(ExternalReferencesTable);
            entryParser        = default(NativeParser);
            foreach (NativeFormatModuleInfo module in ModuleList.EnumerateModules())
            {
                NativeReader structMapReader;
                if (TryGetNativeReaderForBlob(module, ReflectionMapBlob.StructMarshallingStubMap, out structMapReader))
                {
                    NativeParser    structMapParser = new NativeParser(structMapReader, 0);
                    NativeHashtable structHashtable = new NativeHashtable(structMapParser);

                    externalReferences.InitializeCommonFixupsTable(module);

                    var lookup = structHashtable.Lookup(structHashcode);
                    while (!(entryParser = lookup.GetNext()).IsNull)
                    {
                        RuntimeTypeHandle foundStructType = externalReferences.GetRuntimeTypeHandleFromIndex(entryParser.GetUnsigned());
                        if (foundStructType.Equals(structTypeHandle))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
        public Recent()
        {
            Dependencies.Add(nameof(Issues));

            ProcessModules = new ModuleList
            {
                new GenerateJson(
                    Config.FromContext(ctx => ctx.Outputs
                                       .FromPipeline(nameof(Issues))
                                       .SelectMany(doc => doc
                                                   .GetList <Issue>("Issues")
                                                   .Where(i => i.Recent)
                                                   .Select(i => new
                {
                    ProjectKey = doc.GetString("ProjectKey"),
                    CreatedAt  = i.CreatedAt,
                    Link       = i.Link,
                    Title      = i.Title
                }))
                                       .OrderByDescending(x => x.CreatedAt)))
                .WithCamelCase(),
                new MinifyJs(),
                new SetDestination((FilePath)"data/issues/recent/all.json")
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
        public Resources()
        {
            InputModules = new ModuleList
            {
                new ReadFiles(Config.FromContext(ctx => ctx.FileSystem.RootPath.Combine("../../data/resources/*.yml").FullPath)),
                new ExecuteIf(Config.FromContext(ctx => ctx.ApplicationState.IsCommand("preview") || ctx.Settings.GetBool("dev")))
                {
                    new OrderDocuments(Config.FromDocument(x => x.Source)),
                    new TakeDocuments(10)
                }
            };

            ProcessModules = new ModuleList
            {
                new ParseYaml(),
                new SetContent(string.Empty),
                new SetMetadata("Key", Config.FromDocument(x => x.Source.FileNameWithoutExtension.FullPath)),
                new SetMetadata("Link", Config.FromDocument(d => d.GetString("Website"))),
                new SetMetadata("CardType", "Resource"), // TODO: Do we still need this without groups/events?
                new SetMetadata("CardData", Config.FromDocument(x => x.GetMetadata(
                                                                    "Website",
                                                                    "Title",
                                                                    "Image",
                                                                    "Description",
                                                                    "CardType",
                                                                    "Comment",
                                                                    "Tags",
                                                                    "DiscoveryDate")))
            };
        }
示例#25
0
        public HomePipeline(IDeliveryClient deliveryClient)
        {
            Dependencies.AddRange(nameof(PostsPipeline), nameof(HomepagePipeline), nameof(SiteMetadataPipeline));
            ProcessModules = new ModuleList(
                // pull documents from other pipelines
                new ReplaceDocuments(nameof(PostsPipeline)),
                new PaginateDocuments(4),
                new SetDestination(Config.FromDocument((doc, ctx) => Filename(doc))),
                new MergeContent(new ReadFiles("Index.cshtml")),
                new RenderRazor()
                .WithModel(Config.FromDocument((document, context) =>
            {
                var model = new HomeViewModel(document.AsPagedKontent <Article>(),
                                              new SidebarViewModel(
                                                  context.Outputs.FromPipeline(nameof(HomepagePipeline)).Select(x => x.AsKontent <Homepage>()).FirstOrDefault(),
                                                  context.Outputs.FromPipeline(nameof(SiteMetadataPipeline)).Select(x => x.AsKontent <SiteMetadata>()).FirstOrDefault(),
                                                  true, "/"));
                return(model);
            }
                                               )),
                new KontentImageProcessor()
                );

            OutputModules = new ModuleList {
                new WriteFiles(),
            };
        }
示例#26
0
            public Pack()
            {
                ExecutionPolicy = ExecutionPolicy.Manual;

                Dependencies.Add(nameof(Build));

                ProcessModules = new ModuleList
                {
                    new ThrowExceptionIf(Config.ContainsSettings("DAVIDGLICK_CERTPASS").IsFalse(), "DAVIDGLICK_CERTPASS setting missing"),
                    new ReadFiles("src/**/*.csproj"),
                    new StartProcess("dotnet")
                    .WithArgument("pack")
                    .WithArgument("--no-build")
                    .WithArgument("--no-restore")
                    .WithArgument("-o", Config.FromContext(ctx => ctx.FileSystem.GetOutputPath().FullPath), true)
                    .WithArgument(Config.FromDocument(doc => doc.Source.FullPath), true)
                    .WithParallelExecution(false)
                    .LogOutput(),
                    new ReadFiles(Config.FromContext(ctx => ctx.FileSystem.GetOutputPath("*.nupkg").FullPath)),
                    new StartProcess("nuget")
                    .WithArgument("sign")
                    .WithArgument(Config.FromDocument(doc => doc.Source.FullPath), true)
                    .WithArgument("-CertificatePath", Config.FromContext(ctx => ctx.FileSystem.GetRootFile("davidglick.pfx").Path.FullPath), true)
                    .WithArgument("-CertificatePassword", Config.FromSetting("DAVIDGLICK_CERTPASS"), true)
                    .WithArgument("-Timestamper", "http://timestamp.digicert.com", true)
                    .WithArgument("-NonInteractive")
                    .WithParallelExecution(false)
                    .LogOutput()
                };
            }
示例#27
0
        /// <summary>
        /// Returns a list of modules for the stack 'stackIdx'.  It also updates the interning table stackModuleLists, so
        /// that the entry cooresponding to stackIdx remembers the answer.  This can speed up processing alot since many
        /// stacks have the same prefixes to root.
        /// </summary>
        private ModuleList GetModulesForStack(ModuleList[] stackModuleLists, StackSourceCallStackIndex stackIdx)
        {
            var ret = stackModuleLists[(int)stackIdx];

            if (ret == null)
            {
                // ret = the module list for the rest of the frames.
                var callerIdx = GetCallerIndex(stackIdx);
                if (callerIdx != StackSourceCallStackIndex.Invalid)
                {
                    ret = GetModulesForStack(stackModuleLists, callerIdx);
                }

                // Compute the module for the top most frame, and add it to the list (if we find a module)
                TraceModuleFile module   = null;
                var             frameIdx = GetFrameIndex(stackIdx);
                if (frameIdx != StackSourceFrameIndex.Invalid)
                {
                    var codeAddress = GetFrameCodeAddress(frameIdx);
                    if (codeAddress != CodeAddressIndex.Invalid)
                    {
                        var moduleFileIdx = TraceLog.CallStacks.CodeAddresses.ModuleFileIndex(codeAddress);
                        if (moduleFileIdx != ModuleFileIndex.Invalid)
                        {
                            module = TraceLog.ModuleFiles[moduleFileIdx];
                            ret    = ModuleList.SetAdd(module, ret);
                        }
                    }
                }
                stackModuleLists[(int)stackIdx] = ret;
            }
            return(ret);
        }
        public Pages()
        {
            InputModules = new ModuleList
            {
                new ReadFiles("**/{!_,}*.{cshtml,md}")
            };

            ProcessModules = new ModuleList
            {
                new CacheDocuments
                {
                    new ExtractFrontMatter(new ParseYaml()),
                    new ExecuteIf(
                        Config.FromDocument(doc => doc.MediaTypeEquals("text/markdown")),
                        new RenderMarkdown().UseExtensions()),
                    new SetDestination(".html")
                }
            };

            TransformModules = new ModuleList
            {
                new ExecuteIf(
                    Config.FromDocument(doc => doc.MediaTypeEquals("text/markdown")),
                    new RenderRazor().WithLayout((FilePath)"/_markdown.cshtml"))
                .Else(new RenderRazor().WithLayout((FilePath)"/_layout.cshtml")),
                new MirrorResources()
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#29
0
        public ArchivePipeline()
        {
            Dependencies.Add(nameof(BlogPostPipeline));

            InputModules = new ModuleList
            {
                new ReadFiles("_archive.hbs")
            };

            ProcessModules = new ModuleList
            {
                new SetDestination(Config.FromValue(new NormalizedPath("./posts/index.html"))),
                new RenderHandlebars()
                .WithModel(Config.FromContext(context => new
                {
                    groups = context.Outputs.FromPipeline(nameof(BlogPostPipeline))
                             .GroupBy(x => x.GetDateTime(FeedKeys.Published).Year)
                             .OrderByDescending(x => x.Key)
                             .Select(group => new
                    {
                        key   = group.Key,
                        posts = group
                                .OrderByDescending(x => x.GetDateTime(FeedKeys.Published))
                                .Select(x => x.AsPost(context)),
                    })
                }))
            };

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }
示例#30
0
 protected void ModuleList(PacketHeader header, Connection connection, ModuleList moduleList)
 {
     if (ModuleListEvent != null)
     {
         ModuleListEvent.Invoke(moduleList.ModuleInfoList, EventArgs.Empty);
     }
 }
示例#31
0
    public Debugger(AsyncTaskRunner asyncTaskRunner) {
      Dispatch.AsyncTaskRunner = asyncTaskRunner;

      this.BreakpointList = new BreakpointList(this);
      this.Memory = new Memory(this);
      this.ModuleList = new ModuleList(this);
      this.ThreadList = new ThreadList(this);

      this.CurrentContext = new Context(this);
    }
示例#32
0
        public BusinessClassesList GetAdditionalClasses(ModuleList moduleList) {
#pragma warning disable 612,618
            var businessClassesList = new BusinessClassesList(moduleList.SelectMany(@base => @base.AdditionalBusinessClasses));
            businessClassesList.AddRange(
                moduleList.SelectMany(moduleBase => moduleBase.BusinessClassAssemblies.GetBusinessClasses()));
#pragma warning restore 612,618

            businessClassesList.AddRange(moduleList.SelectMany(@base => @base.AdditionalExportedTypes));

            return businessClassesList;
        }
示例#33
0
 private void UpdateModulesList(ModuleList sender)
 {
     modulesListView.BeginUpdate();
       modulesListView.Items.Clear();
       foreach (Module module in debugger.ModuleList) {
     var item = new ListViewItem(new string[]{
     module.Handle.ToString("X4"),
     module.ModuleType == xe.debug.proto.ModuleType.Kernel ? "Kernel"
                                                           : "User",
     module.Name,
     module.Path,
     });
     modulesListView.Items.Add(item);
       }
       modulesListView.EndUpdate();
 }
示例#34
0
 public static Dictionary<string, StringModelStore> GetEmbededModelStores(Func<KeyValuePair<string, ResourceInfo>, bool> func, ModuleList modules) {
     return ResourceInfos(modules).Where(func).ToDictionary(pair => pair.Key, pair => new StringModelStore(pair.Value.AspectInfos.First().Xml));
 }
示例#35
0
 private void UpdateModulesList(ModuleList sender)
 {
     modulesComboBox.BeginUpdate();
       modulesComboBox.Items.Clear();
       foreach (Module module in debugger.ModuleList) {
     modulesComboBox.Items.Add(module);
     module.Changed += Module_Changed;
       }
       modulesComboBox.EndUpdate();
 }
 public DefaultModuleLoader(ILogger logger, ModuleList moduleList)
 {
     this.moduleList = moduleList;
     this.logger = logger;
 }
示例#37
0
 public BusinessClassesList GetAdditionalClasses(ModuleList moduleList) {
     var businessClassesList = new BusinessClassesList(moduleList.SelectMany(@base => @base.AdditionalBusinessClasses));
     businessClassesList.AddRange(
         moduleList.SelectMany(moduleBase => moduleBase.BusinessClassAssemblies.GetBusinessClasses()));
     return businessClassesList;
 }
 public ExecuteBackgroundCommandOnModuleList(ModuleList moduleList)
 {
     this.moduleList = moduleList;
 }
示例#39
0
 public IList<Type> GetAdditionalClasses(ModuleList moduleList) {
     return new List<Type>(moduleList.SelectMany(@base => @base.AdditionalExportedTypes));
 }
 public SetCopiesReportHelper(ModuleList modules)
 {
     ReportsModuleV2 module = ReportsModuleV2.FindReportsModule(modules);
     if (module != null)
         module.ReportsDataSourceHelper.BeforeShowPreview += ReportsDataSourceHelper_BeforeShowPreview;
 }
示例#41
0
                public ModuleManagement(ServicesDaemon tBase)
                {
                    Modules = new ModuleList();
                    DataDriver = "";

                    Base = tBase;
                }
 public NickServService(LocalClient tMyClient, ServicesCore tMyCore, DataBase tNickDB, ModuleList Modules)
 {
     this.MyClient = tMyClient;
     this.MyCore = tMyCore;
     this.NickDB = tNickDB;
     this.Modules = Modules;
     Help = ((Help.Help) this.Modules["Help"]);
 }
 public RunCommandOnModuleList(ModuleList moduleList)
 {
     this.moduleList = moduleList;
 }
示例#44
0
                    public override bool ModLoad()
                    {
                        DataDriver = MyBase.DataDriver;
                        //Load the DB into memory
                        try
                        {
                            if (DataDriver.DBExists("floodserv.db"))
                            {
                                FloodDB = DataDriver.LoadDB("floodserv.db");
                                if (FloodDB == null)
                                {
                                    throw (new Exception("NickServ: Unknown DB Load Error"));
                        //									return false;
                                }
                            }
                            else
                            {
                                MakeDB();
                            }
                            BlackLight.Services.Timers.Timer FSSaveTimer;
                            FSSaveTimer = new BlackLight.Services.Timers.Timer(new TimeSpan(0), new TimeSpan(0, 5, 0), - 1, new Timers.TimedCallBack(TimerSaveDB));
                            MyBase.timerController.addTimer(FSSaveTimer);
                            MyBase.Core.events.OnFinishedNetBurst += new BlackLight.Services.Core.ServicesCore.ServicesEvents.OnFinishedNetBurstEventHandler(this.OnConnect);
                        }
                        catch (Exception ex)
                        {
                            MyBase.Core.SendLogMessage("FloodServ", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace);
                            //show("FloodServ Error " + ex.Message + " " + ex.StackTrace);
                            return false;
                        }

                        mFloodServ = new LocalClient("FloodServ",new MessageCallBack(FloodServCallBack) ,MyBase.Core);
                        ModuleList tModules = new ModuleList();
                        tModules.Add(MyBase.ModuleManage.Modules["Help"]);
                        MyService = new FloodServService(mFloodServ, MyBase.Core, FloodDB, tModules);
                        mFloodServ.host = "services.com";
                        mFloodServ.modes = "S";
                        mFloodServ.realname = "FloodServ";
                        mFloodServ.time = BlackLight.Services.Converters.Time.GetTS(DateTime.Now);
                        mFloodServ.username = "******";
                        MyBase.Core.events.onClientConnect += new BlackLight.Services.Core.ServicesCore.ServicesEvents.onClientConnectEventHandler(MyService.OnClientConnect);

                        mFloodServ.Cmds.Add("HELP", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSHelp));

                        mFloodServ.Cmds.Add("NPWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNPWatch));

                        mFloodServ.Cmds.Add("NSWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNSWatch));

                        mFloodServ.Cmds.Add("REGWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSRegWatch));

                        mFloodServ.Cmds.Add("NPSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNPScan));

                        mFloodServ.Cmds.Add("NSSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNSScan));

                        mFloodServ.Cmds.Add("REGSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSRegScan));

                        MyBase.Core.LocalClients.AddClient(mFloodServ);
                        return true;
                    }
 public FloodServService(LocalClient tMyClient, ServicesCore tMyCore, DataBase tFloodDB, ModuleList Modules)
 {
     this.MyClient = tMyClient;
     this.MyCore = tMyCore;
     this.FloodDB = tFloodDB;
     this.Modules = Modules;
     Help = ((Help.Help) this.Modules["Help"]);
     m_NPWatches = new ArrayList();
     m_NSWatches = new ArrayList();
     m_RegWatches = new ArrayList();
     m_Recent = new ServiceList();
     updateWatchList(0);
     updateWatchList(1);
     updateWatchList(2);
 }
 private void Init(XpandControllersManager xpandControllersManager, string assembliesPath) {
     Tracing.Tracer.LogVerboseText("ApplicationModulesManager.Init");
     _assembliesPath = assembliesPath;
     Modules = new ModuleList(null);
     _xpandControllersManager = xpandControllersManager;
 }
示例#47
0
                    public override bool ModLoad()
                    {
                        DataDriver = MyBase.DataDriver;
                        //Load the DB into memory
                        try
                        {
                            if (DataDriver.DBExists("nickserv.db"))
                            {
                                NickDB = DataDriver.LoadDB("nickserv.db");
                                if (NickDB == null)
                                {
                                    throw (new Exception("NickServ: Unknown DB Load Error"));
                        //									return false;
                                }
                            }
                            else
                            {
                                MakeDB();
                            }
                            BlackLight.Services.Timers.Timer NSSaveTimer;
                            NSSaveTimer = new BlackLight.Services.Timers.Timer(new TimeSpan(0), new TimeSpan(0, 5, 0), - 1, new Timers.TimedCallBack( TimerSaveDB));
                            MyBase.timerController.addTimer(NSSaveTimer);
                            MyBase.Core.events.OnFinishedNetBurst += new BlackLight.Services.Core.ServicesCore.ServicesEvents.OnFinishedNetBurstEventHandler(this.OnConnect);
                        }
                        catch (Exception ex)
                        {
                            MyBase.Core.SendLogMessage("Nick", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace);
                            //show("NickServ Error " + ex.Message + " " + ex.StackTrace);
                            return false;
                        }

                        mNickServ = new LocalClient("NickServ", new MessageCallBack(NickServCallBack), MyBase.Core);
                        ModuleList tModules = new ModuleList();
                        tModules.Add(MyBase.ModuleManage.Modules["Help"]);
                        MyService = new NickServService(mNickServ, MyBase.Core, NickDB, tModules);
                        mNickServ.host = "services.com";
                        mNickServ.modes = "S";
                        mNickServ.realname = "NickyServ";
                        mNickServ.time = BlackLight.Services.Converters.Time.GetTS(DateTime.Now);
                        mNickServ.username = "******";

                        // Client
                        mNickServ.Cmds.Add("REGISTER", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSRegister));
                        // Client
                        mNickServ.Cmds.Add("IDENTIFY", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSIdentify));
                        // Client
                        mNickServ.Cmds.Add("GROUP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGroup));
                        // Client
                        mNickServ.Cmds.Add("GLIST", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGList));
                        // Client/Oper
                        mNickServ.Cmds.Add("DROP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSDrop));
                        // Client
                        mNickServ.Cmds.Add("GHOST", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGhost));

                        mNickServ.Cmds.Add("HELP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSHelp));
                        // Client/Open - (oper gets more)
                        // bNickServ.Cmds.Add("INFO", AddressOf MyService.NullFunction)
                        // Client
                        // bNickServ.Cmds.Add("LOGOUT", AddressOf MyService.NullFunction)
                        // Client
                        // bNickServ.Cmds.Add("RECOVER", AddressOf MyService.NullFunction)
                        // Client
                        // bNickServ.Cmds.Add("RELEASE", AddressOf MyService.NullFunction)
                        // Client
                        //  bNickServ.Cmds.Add("AJOIN", AddressOf MyService.NullFunction)
                        // Client / Oper
                        //  bNickServ.Cmds.Add("ACCESS", AddressOf MyService.NullFunction)
                        // Client / Oper
                        //  bNickServ.Cmds.Add("ALIST", AddressOf MyService.NullFunction)
                        // Client
                        //  bNickServ.Cmds.Add("STATUS", AddressOf MyService.NullFunction)
                        // Client/Oper
                        // bNickServ.Cmds.Add("SET", AddressOf MyService.NullFunction)

                        // Oper
                        //  bNickServ.Cmds.Add("FIND", AddressOf MyService.NullFunction)
                        // Oper
                        // bNickServ.Cmds.Add("FORBID", AddressOf MyService.NullFunction)
                        // Oper
                        // bNickServ.Cmds.Add("UNFORBID", AddressOf MyService.NullFunction)
                        // Oper
                        //  bNickServ.Cmds.Add("SUSPEND", AddressOf MyService.NullFunction)
                        // Oper
                        // bNickServ.Cmds.Add("UNSUSPEND", AddressOf MyService.NullFunction)
                        // Oper - de oper/dc
                        // bNickServ.Cmds.Add("NOOP", AddressOf MyService.NullFunction)
                        // Oper
                        //bNickServ.Cmds.Add("UNIDENTIFY", AddressOf MyService.NullFunction)

                        MyBase.Core.LocalClients.AddClient(mNickServ);
                        return true;
                    }
 public ReloadCommandOnModuleList(IDirectoryController directories, ModuleList moduleList, IModuleLoader moduleLoader)
 {
     this.directories = directories;
     this.moduleList = moduleList;
     this.moduleLoader = moduleLoader;
 }