private static unsafe IntPtr VirtualMachine__RunFunctionHook(VirtualMachine *virtualMachine, string functionName, int a3, int a4, int a5, int a6) { IntPtr num = IntPtr.Zero; try { string str = functionName; if (str == "config") { PreConfig?.Invoke(); num = VirtualMachine__RunFunction(virtualMachine, functionName, a3, a4, a5, a6); PostConfig?.Invoke(); } else { if (str == "main") { PreMain?.Invoke(); num = VirtualMachine__RunFunction(virtualMachine, functionName, a3, a4, a5, a6); PostMain?.Invoke(); } else { num = VirtualMachine__RunFunction(virtualMachine, functionName, a3, a4, a5, a6); } } } catch (Exception ex) { Trace.WriteLine($"Unhandled Exception in {nameof(Script)}.{nameof(VirtualMachine__RunFunctionHook)}!"); Trace.WriteLine(ex.ToString()); } return(num); }
public FacebookPostServiceTest() { var config = new PostConfig() { DurationInSeconds = 10, DisplayPeriodInDaysForAdmins = 10 }; var postOptions = new Mock <IOptionsSnapshot <PostConfig> >(); postOptions.Setup(m => m.Value).Returns(config); _unitOfWork = new Mock <IUnitOfWork>(); _postRepositoryMock = new Mock <IPostRepository>(); _providerFactoryMock = new Mock <IExternalPostProviderFactory>(); _postService = new Mock <IPostService>(); _facebookClient = new Mock <IFacebookClient>(); _fileService = new Mock <IFileService>(); _unitOfWork.SetupGet(x => x.Posts).Returns(_postRepositoryMock.Object); _logger = new Mock <ILogger <ExternalPostService> >(); _externalPostService = new ExternalPostService(_providerFactoryMock.Object, _unitOfWork.Object, _logger.Object, postOptions.Object); _fbPostCreator = new FacebookPostCreator(_facebookClient.Object, _fileService.Object); }
protected void BindDate() { M_PostConfig = Post.GetConfig(PhyFilePath); this.txtEmail.Text = M_PostConfig.Email; //this.txtPassword.Text = M_PostConfig.Password; this.txtPassword.Attributes.Add("value", DesSecurity.DesDecrypt(M_PostConfig.Password, "emailpwd")); this.txtSmtpServer.Text = M_PostConfig.SmtpServer; this.txtPort.Text = M_PostConfig.Port; }
public async Task WritePostAsync(string sourcePostUrl, PostConfig config) { var post = await _reader.ReadAsync(sourcePostUrl); if (post != null) { await _writer.WriteAsync(post, config); } }
protected void PostConfigSetter(PostConfig ep, bool select) { if (select) { PostConfig = PostConfig | ep; } else { PostConfig = PostConfig & ~ep; } }
protected void BindDate() { M_PostConfig = Post.GetConfig(PhyFilePath); this.txtEmail.Text = M_PostConfig.Email; //this.txtPassword.Text = M_PostConfig.Password; this.txtPassword.Attributes.Add("value", DesSecurity.DesDecrypt(M_PostConfig.Password, "emailpwd")); this.txtSmtpServer.Text = M_PostConfig.SmtpServer; this.txtPort.Text = M_PostConfig.Port; string memberValue = Utils.XmlRead(hrFilePath, "HRConfig/IsMember", ""); string mailValue = Utils.XmlRead(hrFilePath, "HRConfig/IsSendToEmail", ""); txtResumeDetailFilePath.Value = Utils.XmlRead(hrFilePath, "HRConfig/ResumeDetailFilePath", ""); txtEMailTitle.Text = Utils.XmlRead(hrFilePath, "HRConfig/EMailTitle", "").Replace("{SiteName}", siteName); txtEMailContent.Content = Utils.XmlRead(hrFilePath, "HRConfig/EMailContent", "").Replace("{SiteName}", siteName); if (memberValue == "1") { chkIsMember.Checked = true; } if (mailValue == "1") { chkIsEmail.Checked = true; } }
/// <summary> /// Gets the entries that meet the <see cref="PostType"/> and /// <see cref="PostConfig"/> flags. /// </summary> /// <param name="itemCount">Item count.</param> /// <param name="postType">The type of entry to return.</param> /// <param name="postConfig">Post Configuration options.</param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public abstract ICollection<Entry> GetEntries(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories);
/// <summary> /// Gets the entries that meet the <see cref="PostType"/> and /// <see cref="PostConfig"/> flags. /// </summary> /// <param name="itemCount">Item count.</param> /// <param name="postType">The type of entry to return.</param> /// <param name="postConfig">Post Configuration options.</param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public abstract ICollection <Entry> GetEntries(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories);
/// <summary> /// Gets the entries that meet the specific <see cref="PostType"/> /// and the <see cref="PostConfig"/> flags. /// </summary> /// <remarks> /// This is called to get the main syndicated entries and supports MetaWeblog API. /// </remarks> /// <param name="itemCount">Item count.</param> /// <param name="postType">The type of post to retrieve.</param> /// <param name="postConfig">Post configuration options.</param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public override ICollection<Entry> GetEntries(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories) { using (IDataReader reader = _procedures.GetConditionalEntries(itemCount, (int)postType, (int)postConfig, BlogId, includeCategories, CurrentDateTimeUtc)) { return reader.ReadEntryCollection(); } }
public static IEnumerable <EntryDay> GetBlogPostsForHomePage(this ObjectRepository repository, int itemCount, PostConfig postConfig) { return(repository.GetEntries(itemCount, PostType.BlogPost, postConfig, false /*includeCategories*/).GroupByDayUsingDateSyndicated()); }
/// <summary> /// Gets the entry from the data store by entry name. Only returns an entry if it is /// within the current blog (Config.CurrentBlog). /// </summary> /// <param name="EntryName">Name of the entry.</param> /// <param name="postConfig">The entry option used to constrain the search.</param> /// <param name="includeCategories">Whether the returned entry should have its categories collection populated.</param> /// <returns></returns> public static Entry GetEntry(string EntryName, PostConfig postConfig, bool includeCategories) { bool isActive = ((postConfig & PostConfig.IsActive) == PostConfig.IsActive); return ObjectProvider.Instance().GetEntry(EntryName, isActive, includeCategories); }
/// <summary> /// Gets the entries that meet the specific <see cref="PostType"/> /// and the <see cref="PostConfig"/> flags. /// </summary> /// <remarks> /// This is called to get the main syndicated entries. /// </remarks> /// <param name="itemCount">Item count.</param> /// <param name="postType">The type of post to retrieve.</param> /// <param name="postConfig">Post configuration options.</param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public override IList<Entry> GetConditionalEntries(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories) { using(IDataReader reader = DbProvider.Instance().GetConditionalEntries(itemCount, postType, postConfig, includeCategories)) { return DataHelper.LoadEntryCollectionFromDataReader(reader); } }
public static Entry GetEntry(int entryId, PostConfig postConfig, bool includeCategories) { bool isActive = ((postConfig & PostConfig.IsActive) == PostConfig.IsActive); return(new DatabaseObjectProvider().GetEntry(entryId, isActive, includeCategories)); }
protected bool EntryPropertyCheck(PostConfig ep) { return((PostConfig & ep) == ep); }
public async Task Write_Post_Value() { var jekyllRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "jekyll"); var web = Substitute.For <IResourceClient>(); var screenshot1 = new ImageResource(new byte[] { 1, 1, 1 }, ".png"); web.DownloadImageAsync("http://test/screenshot1.png").Returns(screenshot1); var screenshot2 = new ImageResource(new byte[] { 2, 2, 2 }, ".png"); web.DownloadImageAsync("http://test/screenshot2.png").Returns(screenshot2); var screenshot3 = new ImageResource(new byte[] { 2, 2 }, ".png"); web.DownloadImageAsync("http://test/screenshot3.png").Returns(screenshot3); var logo = new ImageResource(new byte[] { 3, 3, 3 }, ".png"); web.DownloadImageAsync("http://test/screenshot3.png").Returns(logo); var fs = Substitute.For <IFileSystem>(); var target = new PostWriter(jekyllRootFolder, web, fs); var post = new Post { Title = "Test título", Date = new DateTime(2018, 11, 28), Companies = new string[] { "Test company" }, Category = PostCategory.Game, Tags = new string[] { "test-company", "test-tag" }, Content = "test content1\ntest content2", Logo = "http://test/screenshot3.png", Screenshots = new string [] { "http://test/screenshot1.png", "http://test/screenshot2.png", "http://test/screenshot3.png" } }; var config = new PostConfig { Author = "Test author", IgnoreImagesLowerThanBytes = 3 }; await target.WriteAsync(post, config); var expectedPostFolder = Path.Combine(jekyllRootFolder, "_posts", "2018"); fs.Received().CreateDirectory(expectedPostFolder); var expectedPostFilename = Path.Combine(expectedPostFolder, "2018-11-28-test-titulo.md"); var expectedPostFileContent = @"--- published: true layout: post title: 'Test título' author: 'Test author' companies: 'Test company' categories: Game tags: test-company test-tag --- test content1 test content2"; fs.Received().WriteFile(expectedPostFilename, expectedPostFileContent); var expectedImagesFolder = Path.Combine(jekyllRootFolder, "assets", "2018", "11", "28", "test-titulo"); fs.Received().CreateDirectory(expectedImagesFolder); fs.Received().WriteFile(Path.Combine(expectedImagesFolder, "screenshot1.png"), screenshot1.Data); fs.Received().WriteFile(Path.Combine(expectedImagesFolder, "screenshot2.png"), screenshot2.Data); fs.Received().WriteFile(Path.Combine(expectedImagesFolder, "logo.png"), logo.Data); }
/// <summary> /// Returns the itemCount most recent posts. /// This is used to support MetaBlogAPI... /// </summary> /// <param name="itemCount"></param> /// <param name="postType"></param> /// <param name="postConfig"></param> /// <param name="includeCategories"></param> /// <returns></returns> public static IList<Entry> GetRecentPosts(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories) { return ObjectProvider.Instance().GetConditionalEntries(itemCount, postType, postConfig, includeCategories); }
public static IEnumerable<EntryDay> GetBlogPostsForHomePage(this ObjectRepository repository, int itemCount, PostConfig postConfig) { return repository.GetEntries(itemCount, PostType.BlogPost, postConfig, false /*includeCategories*/).GroupByDayUsingDateSyndicated(); }
/// <summary> /// Returns blog posts that meet the criteria specified in the <see cref="PostConfig"/> flags. /// </summary> /// <param name="itemCount">Item count.</param> /// <param name="pc">Pc.</param> /// <returns></returns> public override IList<EntryDay> GetBlogPosts(int itemCount, PostConfig pc) { IDataReader reader = DbProvider.Instance().GetConditionalEntries(itemCount, PostType.BlogPost, pc, false); try { IList<EntryDay> edc = DataHelper.LoadEntryDayCollection(reader); return edc; } finally { reader.Close(); } }
protected bool EntryPropertyCheck(PostConfig ep) { return (PostConfig & ep) == ep; }
/// <summary> /// Gets entries within the system that meet the /// <see cref="PostConfig"/> flags. /// </summary> /// <param name="itemCount">Item count.</param> /// <param name="pc">Pc.</param> /// <returns></returns> public abstract IList<EntryDay> GetBlogPosts(int itemCount, PostConfig pc);
/// <summary> /// Gets the entries that meet the specific <see cref="PostType"/> /// and the <see cref="PostConfig"/> flags. /// </summary> /// <remarks> /// This is called to get the main syndicated entries and supports MetaWeblog API. /// </remarks> /// <param name="itemCount">Item count.</param> /// <param name="postType">The type of post to retrieve.</param> /// <param name="postConfig">Post configuration options.</param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public override ICollection <Entry> GetEntries(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories) { using (IDataReader reader = _procedures.GetConditionalEntries(itemCount, (int)postType, (int)postConfig, BlogId, includeCategories, CurrentDateTime)) { return(reader.ReadEntryCollection()); } }
/// <summary> /// Gets the entries that meet the <see cref="PostType"/> and /// <see cref="PostConfig"/> flags. /// </summary> /// <param name="itemCount">Item count.</param> /// <param name="postType">The type of entry to return.</param> /// <param name="postConfig">Post Configuration options.</param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public abstract IList<Entry> GetConditionalEntries(int itemCount, PostType postType, PostConfig postConfig, bool includeCategories);
/// <summary> /// Returns the specified number of blog entries /// </summary> /// <param name="itemCount"></param> /// <param name="postType"></param> /// <param name="postConfiguration"></param> /// <param name="includeCategories">Whether or not to include categories</param> /// <returns></returns> public abstract IDataReader GetConditionalEntries(int itemCount, PostType postType, PostConfig postConfiguration, bool includeCategories);
/// <summary> /// Gets the specified number of entries using the <see cref="PostConfig"/> flags /// specified. /// </summary> /// <remarks> /// This is used to get the posts displayed on the home page. /// </remarks> /// <param name="itemCount">Item count.</param> /// <param name="pc">Pc.</param> /// <returns></returns> public static IList<EntryDay> GetBlogPosts(int itemCount, PostConfig pc) { return ObjectProvider.Instance().GetBlogPosts(itemCount, pc); }