public static IHtmlContent GetContentAsString(this IHtmlHelper htmlHelper, string repositoryName, string contentName, object filters) { ContentEngine engine = new ContentEngine(repositoryName); ContentItem item = engine.GetContents <ContentItem>(contentName, filters).FirstOrDefault(); return(new HtmlString(item == null ? "" : item.GetValue().ToString())); }
static void Main(string[] args) { var config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); IEngine engine = new ContentEngine(); engine.Container.AddComponentInstance(typeof(IServiceContainer).FullName, typeof(IServiceContainer), engine.Container); engine.Container.StartComponents(); //var cache = engine.Container.Resolve<N2.Engine.StructureBoundCache<N2.Engine.Globalization.LanguageInfo>>(); var cache = engine.Container.Resolve<N2.Tests.Engine.Services.DependingGenericSelfService<string>>(); //var c = new N2.Castle.WindsorServiceContainer(); //c.AddComponentInstance("0", typeof(IServiceContainer), c); //c.AddComponentInstance("1", typeof(ITypeFinder), new FakeTypeFinder(typeof(N2.Context).Assembly, typeof(N2.Context).Assembly.GetTypes())); //var finder = Rhino.Mocks.MockRepository.GenerateStub<N2.Persistence.Finder.IItemFinder>(); //c.AddComponentInstance("2", typeof(N2.Persistence.IPersister), new N2.Persistence.NH.ContentPersister(new FakeRepository<ContentItem>(), new FakeRepository<N2.Details.LinkDetail>(), finder)); //c.AddComponent("3", typeof(N2.Engine.ServiceRegistrator), typeof(N2.Engine.ServiceRegistrator)); //c.Resolve<N2.Engine.ServiceRegistrator>().Start(); //var cache = c.Resolve<N2.Engine.StructureBoundDictionaryCache<int, N2.Engine.Globalization.LanguageInfo>>(); //Persistence.PersistFixture pf = new N2.Tests.Persistence.PersistFixture(); //pf.SetUp(); //pf.InsertRootNode(); //pf.TearDown(); //Xml.N2XmlWriterFixture f = new N2.Tests.Xml.N2XmlWriterFixture(); //f.SetUp(); //Console.Clear(); //f.WriteAndReadOneNodeWithDetails(); //f.WriteRootNode(); //Console.ReadLine(); //f.TearDown(); }
public void Initialize(ContentEngine engine) { engine.Resolve<ITypeFinder>().Find(typeof(IContextMenuPlugin)) .Where(t => !t.IsInterface && !t.IsAbstract) .ToList() .ForEach(t => engine.AddComponent(null, typeof(IContextMenuPlugin), t)); }
public override void SetUp() { engine = new ContentEngine(new MediumTrustServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); //engine.Resolve<EngineSection>().Assemblies.Add(new System.Web.Configuration.AssemblyInfo("N2")); //engine.Resolve<EngineSection>().Assemblies.Add(new System.Web.Configuration.AssemblyInfo("N2.Tests")); base.SetUp(); }
public void SetUp() { var cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); engine = new ContentEngine(cfg, "n2multiplesites", new MediumTrustServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); host = engine.Resolve <IHost>(); }
public void Throwing_IsIntercepted_InMediumTrust() { IEngine engine = new ContentEngine(new MediumTrustServiceContainer(), new EventBroker(), new ContainerConfigurer()); engine.Initialize(); var schemaCreator = new SchemaExport(engine.Resolve <IConfigurationBuilder>().BuildConfiguration()); var conn = engine.Resolve <ISessionProvider>().OpenSession.Session.Connection; schemaCreator.Execute(false, true, false, conn, null); engine.SecurityManager.Enabled = false; ContentItem root = new ThrowableItem(); root.Name = "root_mediumtrust"; ContentItem item = new ThrowableItem(); item.Name = "bin's destiny"; item.AddTo(root); engine.Persister.Save(root); engine.Resolve <IHost>().DefaultSite.RootItemID = root.ID; engine.Resolve <IHost>().DefaultSite.StartPageID = root.ID; engine.Persister.Delete(item); Assert.That(root.Children.Count, Is.EqualTo(1)); Assert.That(root.Children[0], Is.TypeOf(typeof(TrashContainerItem))); Assert.That(root.Children[0].Children[0], Is.EqualTo(item)); }
public static Parallax Parse(string _PluginName, string _Name, Rectangle _DistinationRectangle) { var culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.NumberFormat.NumberDecimalSeparator = "."; System.IO.StreamReader sr = new System.IO.StreamReader("Data\\" + _PluginName + "\\Textures2D\\Parallax\\" + _Name + ".rise"); string f = sr.ReadToEnd(); sr.Close(); f = f.Replace(System.Environment.NewLine, ""); string[] Ls = f.Split(';'); List <ParallaxLayer> Pl = new List <ParallaxLayer>(); for (int i = 0; i < Ls.Length; i++) { string[] sub = Ls[i].Split(':'); if (sub.Length == 2) { Pl.Add(new ParallaxLayer(ContentEngine.Texture2D(_PluginName, "Parallax\\" + _Name + "\\" + sub[0]), float.Parse(sub[1], culture))); } } Parallax p = new Parallax(Pl.ToArray(), _DistinationRectangle); return(p); }
public override void Draw(SpriteBatch spriteBatch, GameTime gameTime) { switch (Type) { case CursorType.Cursor: sCursor.Draw(spriteBatch, new Rectangle(MouseLocation, new Point(32)), Color.White, gameTime); break; case CursorType.Ibeam: sIBeam.Draw(spriteBatch, new Rectangle(MouseLocation, new Point(32)), Color.White, gameTime); break; default: sCursor.Draw(spriteBatch, new Rectangle(MouseLocation, new Point(32)), Color.White, gameTime); break; } if (!(Item.ID == -1)) { GameObjectsManager.Items[Item.ID].Variant[Item.Variant].Draw(spriteBatch, new Rectangle(MouseLocation + new Point(8, 22), new Point(32)), Color.White, gameTime); spriteBatch.DrawString(ContentEngine.SpriteFont("Engine", "segoeUI_16pt"), Item.Count.ToString(), new Rectangle(MouseLocation + new Point(16, 30), new Point(32)), helper.Alignment.Left, helper.Style.DropShadow, Color.White); } base.Draw(spriteBatch, gameTime); }
public void DefaultContenExistTwoFoundTest() { IContentStore contentStore = manager.GetContentStore(repositoryId); contentStore.Items.Add(new StringContentItem() { Id = Guid.NewGuid(), DefinitionId = definitionId, Data = "First" }); contentStore.Items.Add(new StringContentItem() { Id = Guid.NewGuid(), DefinitionId = definitionId, Data = "Second" }); contentStore.Save(); // check GetContentString ContentEngine engine = new ContentEngine(repositoryName); Assert.AreEqual("First", engine.GetContentString(contentName)); // check GetContentStrings var list = engine.GetContentStrings(contentName).ToList(); Assert.AreEqual(2, list.Count); Assert.AreEqual("First", list[0]); Assert.AreEqual("Second", list[1]); }
public override void Draw(SpriteBatch spriteBatch, GameTime gameTime, int x, int y) { if (Visible) { if (this.MouseDown) { ButMD.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + 64 + x, SizeBox.Location.Y + y), new Point(SizeBox.Width - 128, 64)), ControlColor, gameTime); ButLD.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x, SizeBox.Location.Y + y), new Point(64)), ControlColor, gameTime); ButRD.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x + SizeBox.Width - 64, SizeBox.Location.Y + y), new Point(64)), ControlColor, gameTime); helper.DrawString(spriteBatch, ContentEngine.SpriteFont("Engine", "segoeUI_16pt"), Text, new Rectangle(SizeBox.Location.X + x, SizeBox.Location.Y + y + 4, SizeBox.Width, SizeBox.Height), helper.Alignment.Center, helper.Style.Regular, Color.White); } else if (this.MouseOver) { ButM.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + 64 + x, SizeBox.Location.Y + y), new Point(SizeBox.Width - 128, 64)), ControleHoverColor, gameTime); ButL.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x, SizeBox.Location.Y + y), new Point(64)), ControleHoverColor, gameTime); ButR.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x + SizeBox.Width - 64, SizeBox.Location.Y + y), new Point(64)), ControleHoverColor, gameTime); helper.DrawString(spriteBatch, ContentEngine.SpriteFont("Engine", "segoeUI_16pt"), Text, new Rectangle(SizeBox.Location.X + x, SizeBox.Location.Y + y - 4, SizeBox.Width, SizeBox.Height), helper.Alignment.Center, helper.Style.Regular, Color.White); } else { ButM.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + 64 + x, SizeBox.Location.Y + y), new Point(SizeBox.Width - 128, 64)), ControlColor, gameTime); ButL.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x, SizeBox.Location.Y + y), new Point(64)), ControlColor, gameTime); ButR.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x + SizeBox.Width - 64, SizeBox.Location.Y + y), new Point(64)), ControlColor, gameTime); helper.DrawString(spriteBatch, ContentEngine.SpriteFont("Engine", "segoeUI_16pt"), Text, new Rectangle(SizeBox.Location.X + x, SizeBox.Location.Y + y - 4, SizeBox.Width, SizeBox.Height), helper.Alignment.Center, helper.Style.Regular, Color.White); } } base.Draw(spriteBatch, gameTime, x, y); }
protected override IEngine CreateEngine() { NinjectServiceContainer.SetKernel(null); // force new kernel var engine = new ContentEngine(new NinjectServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); return(engine); }
protected override IEngine CreateEngine() { NinjectServiceContainer.SetKernel(null); // force new kernel var engine = new ContentEngine(new NinjectServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); return engine; }
/// <summary> /// Creates an instance of the correct engine for the current environment (regular or medium trust) & registers additional components for the MVC functionality /// </summary> /// <returns></returns> public static IEngine Create(IServiceContainer container) { IEngine engine = new ContentEngine(container, EventBroker.Instance, new ContainerConfigurer()); N2.Context.Replace(engine); return(MvcInitialize(engine)); }
/// <summary>Invokes the initialize method on the supplied plugins.</summary> public void InitializePlugins(ContentEngine engine, IEnumerable<IPluginDefinition> plugins) { List<Exception> exceptions = new List<Exception>(); foreach (IPluginDefinition plugin in plugins) { try { plugin.Initialize(engine); } catch (Exception ex) { exceptions.Add(ex); } } if (exceptions.Count > 0) { string message = "While initializing {0} plugin(s) threw an exception. Please review the stack trace to find out what went wrong."; message = string.Format(message, exceptions.Count); foreach (Exception ex in exceptions) message += Environment.NewLine + Environment.NewLine + "- " + ex.Message; throw new PluginInitializationException(message, exceptions.ToArray()); } }
public void Initialize(ContentEngine engine) { if (engine.Resolve<AdminSection>().RecycleBin.Enabled) { engine.AddComponent("zeus.recycleBin", typeof(IRecycleBinHandler), typeof(RecycleBinHandler)); engine.AddComponent("zeus.deleteInterceptor", typeof(DeleteInterceptor)); } }
public static IHtmlContent GetCmsString(this IHtmlHelper htmlHelper, string repositoryName, string contentName) { ContentEngine engine = new ContentEngine(repositoryName); return(new HtmlString( engine.GetContentString(contentName) )); }
public void TargetedValueNotFoundTest() { CreateTextContentValue(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { }).ToList(); Assert.AreEqual(0, items.Count()); }
public ContentRoute(ContentEngine engine, IRouteHandler routeHandler, IControllerMapper controllerMapper) : base("{controller}/{action}/{*remainingUrl}", new RouteValueDictionary(new { Action = "Index" }), routeHandler) { this.engine = engine; this.routeHandler = routeHandler; this.controllerMapper = controllerMapper ?? engine.Resolve<IControllerMapper>(); _adminSection = (AdminSection)ConfigurationManager.GetSection("zeus/admin"); }
public void TargetedValueStringFilterTest() { CreateTextContentValue(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { Email = "*****@*****.**", IsLoggedIn = true }).ToList(); Assert.AreEqual(1, items.Count()); }
public override void Draw(SpriteBatch spriteBatch, GameTime gameTime) { if (Visible == true) { //Drawing Corner BoxUL.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X, ContainerRect.Location.Y, 64, 64), BackColor, gameTime); BoxDL.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X, ContainerRect.Location.Y + ContainerRect.Height - 64, 64, 64), BackColor, gameTime); BoxUR.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + ContainerRect.Width - 64, ContainerRect.Location.Y, 64, 64), BackColor, gameTime); BoxDR.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + ContainerRect.Width - 64, ContainerRect.Location.Y + ContainerRect.Height - 64, 64, 64), BackColor, gameTime); if (ContainerRect.Width > 128) { BoxMU.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + 64, ContainerRect.Location.Y, ContainerRect.Width - 128, 64), BackColor, gameTime); BoxMD.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + 64, ContainerRect.Location.Y + ContainerRect.Height - 64, ContainerRect.Width - 128, 64), BackColor, gameTime); } if (ContainerRect.Height > 128) { BoxML.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X, ContainerRect.Location.Y + 64, 64, ContainerRect.Height - 128), BackColor, gameTime); BoxMR.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + ContainerRect.Width - 64, ContainerRect.Location.Y + 64, 64, ContainerRect.Height - 128), BackColor, gameTime); } if (ContainerRect.Height > 128) { if (ContainerRect.Width > 128) { BoxC.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + 64, ContainerRect.Location.Y + 64, ContainerRect.Width - 128, ContainerRect.Height - 128), BackColor, gameTime); } } } if (ShowTitle) { BoxTUL.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X, ContainerRect.Location.Y, 64, 64), BackColor, gameTime); BoxTUR.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + ContainerRect.Width - 64, ContainerRect.Location.Y, 64, 64), BackColor, gameTime); BoxTUC.Draw(spriteBatch, new Rectangle(ContainerRect.Location.X + 64, ContainerRect.Location.Y, ContainerRect.Width - 128, 64), BackColor, gameTime); spriteBatch.DrawString(ContentEngine.SpriteFont("Engine", "segoeUI_16pt"), Title, new Rectangle(ContainerRect.Location.X, ContainerRect.Location.Y, ContainerRect.Width, 64), helper.Alignment.Center, helper.Style.DropShadow, Color.White); } foreach (Control i in this.Controls) { i.Draw(spriteBatch, gameTime, this.ContainerRect.X, this.ContainerRect.Y); if (Config.Debug.GuiFrame) { spriteBatch.DrawRectangle(i.ClickRect, Color.Black); } } base.Draw(spriteBatch, gameTime); if (Config.Debug.GuiFrame) { spriteBatch.DrawRectangle(ContainerRect, Color.Black); } }
public virtual void TestFixtureSetUp() { Context.Replace(Engine = new ContentEngine()); var configurationBuilder = Engine.Resolve<IConfigurationBuilder>(); SessionProvider = (FakeSessionProvider)Engine.Resolve<ISessionProvider>(); SchemaCreator = new SchemaExport(configurationBuilder.BuildConfiguration()); CreateDatabaseSchema(); Engine.Initialize(); }
public virtual void TestFixtureSetUp() { Context.Replace(Engine = new ContentEngine()); var configurationBuilder = Engine.Resolve <IConfigurationBuilder>(); SessionProvider = (FakeSessionProvider)Engine.Resolve <ISessionProvider>(); SchemaCreator = new SchemaExport(configurationBuilder.BuildConfiguration()); CreateDatabaseSchema(); Engine.Initialize(); }
public virtual void TestFixtureSetUp() { engine = new ContentEngine(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None), "n2nodb", new WindsorServiceContainer(), new EventBroker(), new ContainerConfigurer()); N2.Context.Replace(engine); engine.Initialize(); engine.Host.CurrentSite.RootItemID = 1; engine.Host.CurrentSite.StartPageID = 1; }
private static void RegisterRoutes(RouteCollection routes, ContentEngine engine) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{*extaxd}", new { extaxd = @"(.*/)?ext.axd(/.*)?" }); string adminPath = Zeus.Context.Current.Resolve<AdminSection>().Path; routes.IgnoreRoute(adminPath + "/{*pathInfo}"); routes.IgnoreRoute("assets" + "/{*pathInfo}"); // This route detects content item paths and executes their controller routes.Add(new ContentRoute(engine)); }
public RenderState(RenderState copy, TreePathStreamedBlob item = null) { this.engine = copy.engine; this.item = item ?? copy.item; this.readFrom = copy.readFrom; this.writeTo = copy.writeTo; this.earlyExit = copy.earlyExit; this.processElements = copy.processElements; this.previous = copy; }
public TextBox(string text, int maxChar, int X, int Y) { CharSize = ContentEngine.SpriteFont("Engine", "Consolas_16pt").MeasureString("0"); this.SizeBox = new Rectangle(X, Y, (int)ContentEngine.SpriteFont("Engine", "Consolas_16pt").MeasureString("0").X *maxChar + 32, 64); Text = text; MaxChar = maxChar; TxtM = CommonSheets.GUI.GetSprite("TxtM"); TxtL = CommonSheets.GUI.GetSprite("TxtL"); TxtR = CommonSheets.GUI.GetSprite("TxtR"); Common.Window.TextInput += Window_TextInput; }
public void TargetedValueStringFilterTest() { CreateTextContentValue(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { Card = "NotFoundCard" }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { Card = "MyCoolCard" }).ToList(); Assert.AreEqual(1, items.Count()); }
public void TargetedValueBooleanFilterTest() { CreateBooleanContentValue(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { IsLoggedIn = false }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { IsLoggedIn = true }).ToList(); Assert.AreEqual(1, items.Count()); }
public override void Draw(SpriteBatch spriteBatch, GameTime gameTime, int x, int y) { TxtM.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + 64 + x, SizeBox.Location.Y + y), new Point(SizeBox.Width - 128, 64)), Color.White, gameTime); TxtL.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x, SizeBox.Location.Y + y), new Point(64)), Color.White, gameTime); TxtR.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x + SizeBox.Width - 64, SizeBox.Location.Y + y), new Point(64)), Color.White, gameTime); spriteBatch.DrawString(ContentEngine.SpriteFont("Engine", "Consolas_16pt"), Text, new Rectangle(x + SizeBox.X + 16, y + SizeBox.Y + 4, SizeBox.Width - 32, SizeBox.Height), helper.Alignment.Left, helper.Style.Regular, Color.Black); if (this.MouseOver) { spriteBatch.FillRectangle(new Rectangle((int)ContentEngine.SpriteFont("Engine", "Consolas_16pt").MeasureString(" ").X *CharIndex + x + SizeBox.X + 16, y + SizeBox.Y + 20, 1, (int)CharSize.Y), Color.Black); } base.Draw(spriteBatch, gameTime, x, y); }
public MainMenuState(FiniteStateMachine <GameState> stateMachine, MainGame game) : base(stateMachine, game) { _sb = Game.SpriteBatch; _content = new ContentEngine { Game = Game }; _content.RequestTexture("logo", "Sprites/hog_128"); _content.RequestTexture("map", "Sprites/map_background"); _content.RequestTexture("clouds", "Sprites/map_clouds"); _content.RequestFont("title", "Fonts/title"); _content.RequestFont("menu", "Fonts/menu"); _ui = new UiComponent(Game); }
public override void Draw(SpriteBatch spriteBatch, GameTime gameTime, int x, int y) { if (IsChecked) { CheckV.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x - 2, SizeBox.Location.Y + y), new Point(64)), Color.White, gameTime); } else { CheckB.Draw(spriteBatch, new Rectangle(new Point(SizeBox.Location.X + x - 2, SizeBox.Location.Y + y), new Point(64)), Color.White, gameTime); } helper.DrawString(spriteBatch, ContentEngine.SpriteFont("Engine", "segoeUI_16pt"), Text, new Rectangle(SizeBox.Location.X + x + 64, SizeBox.Location.Y + y, SizeBox.Width - 64, SizeBox.Height), helper.Alignment.Left, helper.Style.Regular, Color.White); base.Draw(spriteBatch, gameTime, x, y); }
public void TargetedValueExcludeStringFilterTest() { CreateTextContentValue(); contentStore.Items[0].Filters[0].FilterType = IContentFilter.ContentFilterType.Exclude; contentStore.Save(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { Email = "*****@*****.**" }).ToList(); Assert.AreEqual(1, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { Email = "*****@*****.**" }).ToList(); Assert.AreEqual(0, items.Count()); }
public void TargetedValueDateTimeFilterTest() { CreateTextContentValue(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { Active = DateTime.Now.AddDays(-11) }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { Active = DateTime.Now.AddDays(11) }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { Active = DateTime.Now }).ToList(); Assert.AreEqual(1, items.Count()); }
public void DefaultContentExistTwoFoundTest() { IContentStore contentStore = manager.GetContentStore(repositoryId); var contentItem = new StringContentItem() { Id = Guid.NewGuid(), DefinitionId = definitionId, Data = "UniqueValue" }; contentStore.Items.Add(contentItem); contentStore.Save(); ContentEngine engine = new ContentEngine(repositoryName); Assert.AreEqual("UniqueValue", engine.GetContentString(contentName)); Assert.AreEqual(1, engine.GetContentStrings(contentName).Count()); }
public void TargetedValueNotFoundTest() { CreateTextContentValue(); ContentEngine engine = new ContentEngine(repositoryName); List <ContentItem> items = engine.GetContents <ContentItem>(contentName, new { }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { Email = "*****@*****.**" }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { Email = "*****@*****.**", IsLoggedIn = false }).ToList(); Assert.AreEqual(0, items.Count()); items = engine.GetContents <ContentItem>(contentName, new { IsLoggedIn = false }).ToList(); Assert.AreEqual(0, items.Count()); }
public static SoundEffectColection Parse(string _PluginName, string _Name) { System.IO.StreamReader sr = new System.IO.StreamReader("Data\\" + _PluginName + "\\SoundsEffects\\" + _Name + ".rise"); string f = sr.ReadToEnd(); sr.Close(); f = f.Replace(System.Environment.NewLine, ""); string[] Ls = f.Split(','); SoundEffectColection SE = new SoundEffectColection(); for (int i = 0; i < Ls.Length; i++) { SE.SE.Add(ContentEngine.SoundEffect(_PluginName, Ls[i])); } return(SE); }
public void TestFixtureSetUp() { engine = new ContentEngine(); var schemaCreator = new SchemaExport(engine.Resolve<IConfigurationBuilder>().BuildConfiguration()); schemaCreator.Execute(false, true, false, engine.Resolve<ISessionProvider>().OpenSession.Session.Connection, null); engine.Initialize(); engine.SecurityManager.Enabled = false; root = new ThrowableItem(); root.Name = "root"; engine.Persister.Save(root); engine.Resolve<IHost>().DefaultSite.RootItemID = root.ID; engine.Resolve<IHost>().DefaultSite.StartPageID = root.ID; currentTimeBackup = Utility.CurrentTime; trash = ((TrashHandler)engine.Resolve<ITrashHandler>()).GetTrashContainer(true); }
public MainGameState(FiniteStateMachine <GameState> stateMachine, MainGame game) : base(stateMachine, game) { SpriteBatch = MainGame.Instance.SpriteBatch; _content = new ContentEngine { Game = game }; _iso = new IsometricRendering(W, H, new Vector2(180, 103), SpriteBatch) { ScreenOffset = new Vector2(-(Game.Graphics.PreferredBackBufferWidth / 2f), (Game.Graphics.PreferredBackBufferHeight / 2f)) }; _content.RequestTexture("a", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneUneven_S"); _content.RequestTexture("b", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneTile_S"); _content.RequestTexture("c", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneSteps_S"); _content.RequestTexture("d", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneSideUneven_S"); _content.RequestTexture("e", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneSide_S"); _content.RequestTexture("f", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneRight_S"); _content.RequestTexture("g", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneMissingTiles_S"); _content.RequestTexture("h", "Sprites/Tiles/Dungeon/Isometric/Foundation/stoneLeft_S"); _content.RequestTexture("i", "Sprites/Tiles/Dungeon/Isometric/Foundation/stone_S"); _content.RequestTexture("j", "Sprites/Tiles/Dungeon/Isometric/Foundation/dirtTiles_S"); _content.RequestTexture("k", "Sprites/Tiles/Dungeon/Isometric/Foundation/dirt_S"); _content.RequestTexture("l", "Sprites/Tiles/Dungeon/Isometric/Floor/planksHole_S"); _content.RequestTexture("m", "Sprites/Tiles/Dungeon/Isometric/Floor/planksBroken_S"); _content.RequestTexture("n", "Sprites/Tiles/Dungeon/Isometric/Floor/bridgeBroken_S"); _content.RequestTexture("o", "Sprites/Tiles/Dungeon/Isometric/Floor/bridge_S"); _content.RequestTexture("0", "Sprites/Tiles/Dungeon/Isometric/Props/woodenPile_S"); _content.RequestTexture("1", "Sprites/Tiles/Dungeon/Isometric/Props/woodenCrates_S"); _content.RequestTexture("2", "Sprites/Tiles/Dungeon/Isometric/Props/woodenCrate_S"); _content.RequestTexture("3", "Sprites/Tiles/Dungeon/Isometric/Props/tableShortChairs_S"); _content.RequestTexture("4", "Sprites/Tiles/Dungeon/Isometric/Props/tableShort_S"); _content.RequestTexture("5", "Sprites/Tiles/Dungeon/Isometric/Props/tableRoundChairs_S"); _content.RequestTexture("6", "Sprites/Tiles/Dungeon/Isometric/Props/tableRound_S"); _content.RequestTexture("7", "Sprites/Tiles/Dungeon/Isometric/Props/tableChairsBroken_S"); _content.RequestTexture("8", "Sprites/Tiles/Dungeon/Isometric/Props/chestOpen_S"); _content.RequestTexture("9", "Sprites/Tiles/Dungeon/Isometric/Props/chestClosed_S"); _content.RequestTexture("10", "Sprites/Tiles/Dungeon/Isometric/Props/chair_S"); _content.RequestTexture("11", "Sprites/Tiles/Dungeon/Isometric/Props/barrelsStacked_S"); _content.RequestTexture("12", "Sprites/Tiles/Dungeon/Isometric/Props/barrels_S"); _content.RequestTexture("13", "Sprites/Tiles/Dungeon/Isometric/Props/barrel_S"); }
public void TestFixtureSetUp() { engine = new ContentEngine(); var schemaCreator = new SchemaExport(engine.Resolve <IConfigurationBuilder>().BuildConfiguration()); schemaCreator.Execute(false, true, false, engine.Resolve <ISessionProvider>().OpenSession.Session.Connection, null); engine.Initialize(); engine.SecurityManager.Enabled = false; root = new ThrowableItem(); root.Name = "root"; engine.Persister.Save(root); engine.Resolve <IHost>().DefaultSite.RootItemID = root.ID; engine.Resolve <IHost>().DefaultSite.StartPageID = root.ID; currentTimeBackup = Utility.CurrentTime; trash = ((TrashHandler)engine.Resolve <ITrashHandler>()).GetTrashContainer(true); }
static void Main(string[] args) { String appDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); WriteLine(ConsoleColor.Yellow, "App running in: {0}", appDirectory); String contentDirectory = Path.GetFullPath(Path.Combine(appDirectory, "..", "..", "..", "Content")); WriteLine(ConsoleColor.Yellow, "Content in: {0}", contentDirectory); WriteLine(); WriteLine(); WriteLine(ConsoleColor.Yellow, "Constructing ContentEngine."); ContentEngine engine = new ContentEngine(new String[0], new TypeMapping[0]); WriteLine(); foreach (String file in Files) { WriteLine(ConsoleColor.White, "Adding file: {0}", file); engine.Add(Path.Combine(contentDirectory, file)); } WriteLine(); for (Int32 i = 0; i < 3; ++i) { WriteLine(ConsoleColor.Cyan, "Engine pass #{0} (will hang window for a while)...", i); engine.Build(); } WriteLine(ConsoleColor.Cyan, "Done!"); WriteLine(ConsoleColor.Green, "All done! Press Enter to continue (will open the compiled output directory)."); Console.ReadLine(); Process.Start(engine.OutputDirectory); }
static void Main(string[] args) { String appDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); WriteLine(ConsoleColor.Yellow, "App running in: {0}", appDirectory); String contentDirectory = Path.GetFullPath(Path.Combine(appDirectory, "..", "..", "..", "Content")); WriteLine(ConsoleColor.Yellow, "Content in: {0}", contentDirectory); WriteLine(); WriteLine(); WriteLine(ConsoleColor.Yellow, "Constructing ContentEngine."); ContentEngine engine = new ContentEngine(new String[0], new TypeMapping[0]); WriteLine(); foreach(String file in Files) { WriteLine(ConsoleColor.White, "Adding file: {0}", file); engine.Add(Path.Combine(contentDirectory, file)); } WriteLine(); for (Int32 i = 0; i < 3; ++i) { WriteLine(ConsoleColor.Cyan, "Engine pass #{0} (will hang window for a while)...", i); engine.Build(); } WriteLine(ConsoleColor.Cyan, "Done!"); WriteLine(ConsoleColor.Green, "All done! Press Enter to continue (will open the compiled output directory)."); Console.ReadLine(); Process.Start(engine.OutputDirectory); }
public virtual void Initialize(ContentEngine engine) { if (InitializerType == null) throw new ArgumentNullException("InitializerType"); CreateInitializer().Initialize(engine); }
public override void SetUp() { engine = new ContentEngine(new MediumTrustServiceContainer(), new EventBroker(), new ContainerConfigurer()); base.SetUp(); }
protected override IEngine CreateEngine() { var engine = new ContentEngine(new N2.Engine.TinyIoC.TinyIoCServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); return engine; }
public FallbackXmlReader(ContentEngine engine) { UseDiscriminator = true; this.engine = engine; }
public override void SetUp() { engine = new ContentEngine(); base.SetUp(); }
public void Initialize(ContentEngine engine) { engine.AddComponent("zeus.admin.navigationFlag.navigationCachingService", typeof(NavigationCachingService)); }
/// <summary> /// Creates an instance of the correct engine for the current environment (regular or medium trust) & registers additional components for the MVC functionality /// </summary> /// <returns></returns> public static IEngine Create(IServiceContainer container) { IEngine engine = new ContentEngine(container, EventBroker.Instance, new ContainerConfigurer()); N2.Context.Replace(engine); return MvcInitialize(engine); }
public void CanCreateWithEventBroker() { engine = new ContentEngine(); }
public void SetUp() { engine = new ContentEngine(new MediumTrustServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); }
public void SetUp() { var cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); engine = new ContentEngine(cfg, "n2multiplesites", new MediumTrustServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); host = engine.Resolve<IHost>(); }
protected override IEngine CreateEngine() { var engine = new ContentEngine(new MediumTrustServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); return engine; }
public void Initialize(ContentEngine engine) { engine.AddComponent("zeus.fileSystem.images.imageCachingService", typeof(ImageCachingService)); }
public ContentRoute(ContentEngine engine) : this(engine, new MvcRouteHandler()) { }
public ContentRoute(ContentEngine engine, IRouteHandler routeHandler) : this(engine, routeHandler, null) { }
internal GlobalFunctions(ContentEngine engine) { _engine = engine; }
public void SetUp() { engine = new ContentEngine(new WindsorServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); }
public void Throwing_IsIntercepted_InMediumTrust() { IEngine engine = new ContentEngine(new MediumTrustServiceContainer(), new EventBroker(), new ContainerConfigurer()); engine.Initialize(); engine.Persister.Dispose(); var schemaCreator = new SchemaExport(engine.Resolve<IConfigurationBuilder>().BuildConfiguration()); var conn = engine.Resolve<ISessionProvider>().OpenSession.Session.Connection; schemaCreator.Execute(false, true, false, conn, null); engine.SecurityManager.Enabled = false; ContentItem root = new ThrowableItem(); root.Name = "root_mediumtrust"; ContentItem item = new ThrowableItem(); item.Name = "bin's destiny"; item.AddTo(root); engine.Persister.Save(root); engine.Resolve<IHost>().DefaultSite.RootItemID = root.ID; engine.Resolve<IHost>().DefaultSite.StartPageID = root.ID; engine.Persister.Delete(item); Assert.That(root.Children.Count, Is.EqualTo(1)); Assert.That(root.Children[0], Is.TypeOf(typeof(TrashContainerItem))); Assert.That(root.Children[0].Children[0], Is.EqualTo(item)); }
public RenderState(ContentEngine engine, TreePathStreamedBlob item, XmlTextReader readFrom = null, StringBuilder writeTo = null, Func<RenderState, bool> earlyExit = null, Func<RenderState, Task<Errorable<bool>>> processElements = null, RenderState previous = null) { this.engine = engine; this.item = item; this.readFrom = readFrom; this.writeTo = writeTo; this.earlyExit = earlyExit ?? DefaultEarlyExit; this.processElements = processElements ?? DefaultProcessElements; this.previous = previous; }