public void CSV_file_is_read_correct() { var result = ContentLibrary.ImportFromCsvFile("content\\Tweets.csv"); result.Should().Contain(c => c.Message == "äöü" && c.Link == "http://das.ist.toll"); result.Should().Contain(c => c.Message == "Hello World" && c.Link == "https://link.de"); }
public Lok.Unik.ModelCommon.Client.ContentLibrary ToCommonModel(ContentLibrary contentLibrary, ApplicationUser user, List <string> appIds) { //if (contentLibrary.ContentItems.Any()) //{ // for (var i = 0; i < appIds.Count; i++) // { // contentLibrary.ContentItems.ElementAt(i).AssociateApp = new Guid(appIds[i]); // } //} //var content = new Lok.Unik.ModelCommon.Client.ContentLibrary //{ // Id = contentLibrary.Id, // Title = contentLibrary.Title, // Description = contentLibrary.Description, // CreationDate = DateTime.UtcNow, // CreatorPrincipalId = user.PrincipalId, // CreatorUserName = user.UserName, // Files = ToCommonItems(contentLibrary.ContentItems, contentLibrary.Id, user), // State = State.Enabled, // BasePath = contentLibrary.BasePath //}; //content.Tags.Add(new TagManager().AddDefault<Lok.Unik.ModelCommon.Client.ContentLibrary>(content.Title, content.Id.ToString())); //return content; return(new ContentLibrary()); }
public void InitPanel(ContentLibrary library) { contentLibrary = library; currTileDB = Globals.campaign.GetTileData(); gameObject.SetActive(true); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); //Create an empty texture and setup the Texture2D ContentLibrary empty_texture = new Texture2D(GraphicsDevice, 1, 1); empty_texture.SetData(new Color[] { new Color(255, 255, 255, 255) }); textures = new ContentLibrary <Texture2D>(empty_texture, Content.Load <Texture2D>("missing_texture")); //Setup the AsepriteDocument ContentLibrary aseDocs = new ContentLibrary <AsepriteDocument>(Content.Load <AsepriteDocument>("empty_aseDoc"), Content.Load <AsepriteDocument>("missing_aseDoc")); //Setup the AsepriteDocument ContentLibrary fonts = new ContentLibrary <SpriteFont>(Content.Load <SpriteFont>("empty_font"), Content.Load <SpriteFont>("missing_font")); //TO-DO, Load Settings Settings.UIScale = 1.0f; Settings.Resolution = new Point(1000, 600); ApplySettings(); //start the game after the content is loaded. ChangeGameState("menu"); #if DEBUG Console.WriteLine("Debug mode: on"); #else Console.WriteLine("Debug mode: off"); #endif }
public Animation(string sheetName, int numFrames, TimeSpan frameTime) { //spriteSheet = new SpriteSheet(sheetName); spriteSheet = ContentLibrary.GetSpriteSheet(sheetName); this.numFrames = numFrames; currentFrame = 0; this.frameTime = frameTime; frameRunningTime = TimeSpan.Zero; }
public void Tweet() { var token = Token.ReadFromFile(CredentialsFilename); var contents = ContentLibrary.ReadFromJsonFile(ContentLibraryFilename); var contentFinder = new ContentFinder(contents); var contentToPublish = contentFinder.GetNextContent(); var response = Tweet(contentToPublish, token); ContentLibrary.SaveAsJsonFile(contents, ContentLibraryFilename); Console.WriteLine($"Id of tweet is: {response.IdStr}"); }
public void CreateLibrary(ContentLibrary contentLibrary, ApplicationUser user, List <System.Web.HttpPostedFileBase> fileBases, List <string> appIds) { //var cf = Catalog.Factory.Resolve<IConfig>(); //var containerFileShare = cf[ComServerConfiguration.DistributedFileShare]; //var contentContainerPath = cf[ContentFileStorage.ContentFilesContainer]; //var containerLibPath = cf[ContentFileStorage.ContentLibrariesContainer]; //var containerHost = Path.Combine(containerFileShare, contentContainerPath); //var directory = Path.Combine(containerHost, containerLibPath); //contentLibrary.Id = Guid.NewGuid(); //contentLibrary.BasePath = directory; //foreach (var file in fileBases.Where(file => file.ContentLength != 0)) //{ // if (contentLibrary.ContentItems == null) // contentLibrary.ContentItems = new Collection<ContentItem>(); // contentLibrary.ContentItems.Add(new ContentItem // { // Id = Guid.NewGuid(), // CreatorPrincipalId = user.PrincipalId, // Title = file.FileName, // Path = directory, // }); //} //using (var cntx = ContextRegistry.NamedContextsFor(this.GetType())) //{ // using (var session = DocumentStoreLocator.ContextualResolve()) // { // session.Store(ToCommonModel(contentLibrary, user, appIds)); // session.SaveChanges(); // _log.InfoFormat("{0} Library has been Created", contentLibrary.Title); // } //} //for (var i = 0; i < contentLibrary.ContentItems.Count; i++) //{ // var flh = new FileStorageHelper(); // byte[] fileData; // var objId = string.Format("{0}.zip", contentLibrary.ContentItems.ElementAt(i).Id); // using (var binaryReader = new BinaryReader(fileBases[i].InputStream)) // fileData = binaryReader.ReadBytes(fileBases[i].ContentLength); // flh.SaveData(containerLibPath, objId, fileData); // _log.InfoFormat("{0} library has been stored at '{1}'", objId, directory); //} }
public void GetListTest1() { ContentLibrary target = new ContentLibrary(); // TODO: Initialize to an appropriate value long siteId = 7512913955264234783; // TODO: Initialize to an appropriate value string @where = string.Empty; // TODO: Initialize to an appropriate value string sortField = string.Empty; // TODO: Initialize to an appropriate value IList <awContent> expected = null; // TODO: Initialize to an appropriate value IList <awContent> actual; actual = target.GetList(siteId, @where, sortField); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> /// Creates a GameScreen which handles gameplay /// </summary> public GameScreen(ScreenHandler screenHandler) : base(screenHandler) { // ---------- Create ContentLibrary ---------- _contentLibrary = new ContentLibrary(Content); // ---------- Create GameLevel ---------- _gameLevel = new GameLevel(this, "poopies"); //_gameLevel = new GameLevel(this, 40, 40, 1); // ---------- Create GameInterface ---------- _gameInterface = new GameInterface(this); }
public void CreateLibrary(ContentLibrary contentLibrary, ApplicationUser user, List <string> appIds) { using (var cntx = ContextRegistry.NamedContextsFor(this.GetType())) { using (var session = DocumentStoreLocator.ContextualResolve()) { contentLibrary.Id = Guid.NewGuid(); session.Store(ToCommonModel(contentLibrary, user, appIds)); session.SaveChanges(); _log.InfoFormat("{0} Library has been Stored sucessfully", contentLibrary.Title); } } }
private ContentLibraryViewModel ContentToViewModel(ContentLibrary content, bool gridView) { var result = new ContentLibraryViewModel { ContentType = content.ContentType.ToString(), Status = content.Status, Id = content.Id, Created = content.Created?.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") ?? "", Featured = content.Featured, Precis = content.Precis, ImageUrl = MakeImageUrl(content.ImageUrl, gridView), Title = content.Title, Url = content.Url, ContentTypeText = content.ContentType.ToString(), StatusText = content.Status.ToString() }; return(result); }
public DeferredColoredChunkRenderer(EngineConfiguration config, ContentLibrary contentLibrary, GraphicsDevice device, CameraManager cameraManager, IChunkManager chunkManager) { _device = device; _sb = new SpriteBatch(_device); _halfPixel = new Vector2(0.5f / _device.PresentationParameters.BackBufferWidth, 0.5f / _device.PresentationParameters.BackBufferHeight); _quadRenderer = new QuadRenderer(_device); _clearEffect = new ClearEffect(contentLibrary.ClearEffect); _renderGBufferEffect = new RenderGBufferColorEffect(contentLibrary.RenderGBufferColorEffect); _renderCombineEffect = new RenderCombineEffect(contentLibrary.RenderCombineEffect); _directionalLightEffect = new DirectionalLightEffect(contentLibrary.DirectionalLightEffect); _pointLightEffect = new PointLightEffect(contentLibrary.PointLightEffect); _ssaoEffect = new SSAOEffect(contentLibrary.SSAOEffect); _camManager = cameraManager; _chunks = chunkManager; _debugOptions = ChunkRendererDebugOptions.NONE; basicEffect = contentLibrary.BasicEffect; _uiFontTiny = contentLibrary.UIFontTiny; _albedoTarget = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); _lightTarget = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None); _normalTarget = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None); _depthTarget = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8); _randomMap = new Texture2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight); CreateRandomNormalTexture(_randomMap); _debugRasterizerState = new RasterizerState() { CullMode = Microsoft.Xna.Framework.Graphics.CullMode.None, FillMode = Microsoft.Xna.Framework.Graphics.FillMode.WireFrame }; _rasterizerState = new RasterizerState() { CullMode = Microsoft.Xna.Framework.Graphics.CullMode.CullCounterClockwiseFace }; }
// Use this for initialization void Start() { Globals.currState = GameState.Base; SaveStateBase stat = (SaveStateBase)(SaveLoadManager.LoadFile(FilePath.CurrentSaveFilePath)); campaign = stat.campaign; contentContainer = campaign.contentLibrary; baseUI.campaign = campaign; baseMap = Globals.campaign.GetMapDataContainer().mapDB.GetCopy(stat.baseID); atlas = Resources.Load <SpriteAtlas>(FilePath.TileSetAtlas); PrintBoard(); inputFSM = new InputFSM(new BlockUserInputState()); }
public void EditLibrary(ContentLibrary contentLibrary) { using (var cntx = ContextRegistry.NamedContextsFor(this.GetType())) { using (var session = DocumentStoreLocator.ContextualResolve()) { var libs = from q in session.Query <Lok.Unik.ModelCommon.Client.ContentLibrary>() select q; var lib = libs.ToArray().FirstOrDefault(x => x.Id == contentLibrary.Id); if (lib != null) { lib.Title = contentLibrary.Title; lib.Description = contentLibrary.Description; // lib.State = (State)Enum.Parse(typeof(State), contentLibrary.State); //.. _log.InfoFormat("{0} Library has been updated", lib.Title); session.SaveChanges(); } } } }
public DualContourDeferredColoredChunkSystem(GraphicsDevice device, ContentLibrary contentLibrary, IChunkManager chunkManager, CameraManager cameraManager, World world, ITerrainGradientFunction densityGradientFunction, float minimumSolidDensity) { _builder = new DualContourChunkBuilder(device, world, densityGradientFunction, minimumSolidDensity); _renderer = new DeferredColoredChunkRenderer(world.EngineConfiguration, contentLibrary, device, cameraManager, chunkManager); }
public void AddItemPackage(ContentLibrary library, List <System.Web.HttpPostedFileBase> tempFiles, List <string> associateAppWithFile, ApplicationUser user) { //var cf = Catalog.Factory.Resolve<IConfig>(); //var containerFileShare = cf[ComServerConfiguration.DistributedFileShare]; //var contentContainerPath = cf[ContentFileStorage.ContentFilesContainer]; //var containerLibPath = cf[ContentFileStorage.ContentLibrariesContainer]; //var containerHost = Path.Combine(containerFileShare, contentContainerPath); //var directory = Path.Combine(containerHost, containerLibPath); //library.BasePath = directory; //foreach (var file in tempFiles.Where(file => file.ContentLength != 0)) //{ // if (library.ContentItems == null) // library.ContentItems = new Collection<ContentItem>(); // library.ContentItems.Add(new ContentItem // { // Id = Guid.NewGuid(), // Title = file.FileName, // Path = directory, // CreatorPrincipalId = library.CreatorPrincipalId, // LibraryId = library.Id.ToString() // }); //} //for (var i = 0; i < associateAppWithFile.Count; i++) // library.ContentItems.ElementAt(i).AssociateApp = new Guid(associateAppWithFile[i]); //using (var cntx = ContextRegistry.NamedContextsFor(this.GetType())) //{ // using (var session = DocumentStoreLocator.ContextualResolve()) // { // var query = // (from libs in session.Query<Lok.Unik.ModelCommon.Client.ContentLibrary>() select libs) // .ToArray() // .FirstOrDefault(x => x.Id == library.Id); // if (query != null) // { // query.BasePath = library.BasePath; // var commomItems = ToCommonItems(library.ContentItems, query.Id, user); // foreach (var contentItem in commomItems) // { // query.Files.Add(contentItem); // _log.InfoFormat("Adding {0} Item into '{1}' Library", contentItem.Title, query.Title); // } // } // session.SaveChanges(); // } //} //for (var i = 0; i < library.ContentItems.Count; i++) //{ // var flh = new FileStorageHelper(); // byte[] fileData; // var objId = string.Format("{0}.zip", library.ContentItems.ElementAt(i).Id); // using (var binaryReader = new BinaryReader(tempFiles[i].InputStream)) // fileData = binaryReader.ReadBytes(tempFiles[i].ContentLength); // flh.SaveData(containerLibPath, objId, fileData); // _log.InfoFormat("Storing {0} into '{1}'", objId, directory); //} //_log.InfoFormat("Storing Success"); }
public void ImportContent() { var contents = ContentLibrary.ImportFromCsvFile(CsvFilename); ContentLibrary.SaveAsJsonFile(contents, ContentLibraryFilename); }
public void Importing_from_CSV_file_sets_the_ids_on_each_content() { var result = ContentLibrary.ImportFromCsvFile("content\\Tweets.csv"); result.Should().NotContain(c => string.IsNullOrEmpty(c.Id)); }
public void Ids_are_unique() { var result = ContentLibrary.ImportFromCsvFile("content\\Tweets.csv"); result.Select(c => c.Id).Should().OnlyHaveUniqueItems(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); contentLibrary = new ContentLibrary(); contentLibrary.Load(GraphicsDevice, Content); basicEffect = new BasicEffect(GraphicsDevice); _space = new Space(); _space.ForceUpdater.Gravity = MathConverter.Convert(new Vector3(0, -9.81f, 0)); font = Content.Load <SpriteFont>("Arial"); _fpsCounter = new FPSCounter(this, font); _fpsCounter.LoadContent(); camManager = new CameraManager(); camManager.AddCamera("player", cam); camManager.MainCameraName = "player"; simplexDensityFunction = new SimplexDensityFunction(0.01f, 0.1f); EngineConfiguration config = new EngineConfiguration(); config.ChunkWidth = 16; config.ChunkHeight = 16; config.ChunkLength = 16; config.CPULightingEnabled = true; config.RenderDistance = 5; int worldChunkHeight = 8; SphereDensityFunction sdf = new SphereDensityFunction(new Vector3(8, 8, 8), 7.5f); SineWaveDensityFunction swdf = new SineWaveDensityFunction(5, 10, 0.25f); DualContourIslandChunkGenerator icg = new DualContourIslandChunkGenerator(worldChunkHeight * config.ChunkHeight, new SimplexNoiseGenerator(Environment.TickCount)); DualContourFlatLandGenerator flg = new DualContourFlatLandGenerator(); DensityChunkGenerator dcg = new DensityChunkGenerator(swdf); DebuggerGenerator dg = new DebuggerGenerator(); IChunkGenerator generator; ITerrainGradientFunction grad; generator = icg; grad = icg; _world = new World(config, camManager); _chunkManager = new StaticThreadedChunkManager(config, _world, 5, worldChunkHeight, 5); _chunkManager.ChunkSystem = new DualContourColoredChunkSystem(GraphicsDevice, contentLibrary, _chunkManager, camManager, _world, grad, 0.0f); _chunkManager.ChunkSystem.Builder.MeshBuilt += new MeshBuildEventHandler(BuildPhysicsMesh); _chunkManager.ChunkGenerator = generator; _chunkManager.LightManager = new FloodfillLightManager(_chunkManager, config, worldChunkHeight); _world.ChunkManager = _chunkManager; _chunkManager.GenerateChunks(); _chunkManager.BuildAllChunks(); }
private void OnDestroy() { Destroy(ms_instance); ms_instance = null; }
public void Should_all_be_unpublished() { var result = ContentLibrary.ImportFromCsvFile("content\\Tweets.csv"); result.Should().NotContain(c => c.IsPublished); }
public ActionResult Create(ContentLibraryAddModel model) { ProcessImageUpload imageData = new ProcessImageUpload { PostedFile = model.UploadedFile, }; if (!imageData.CheckImageOk()) { ModelState.AddModelError("UploadedFile", imageData.Error); return(View(model)); } if (imageData.Empty && !ModelState.IsValid) { return(View(model)); } //NOTE: model.sendDateTime will be in local time. We need it in the timezone the user has selected var correctDateTime = model.AvailableFromDate; if (correctDateTime.HasValue) { var timezone = System.TimeZoneInfo.FindSystemTimeZoneById(model.TimeZone); var newDate = System.TimeZoneInfo.ConvertTimeToUtc(model.AvailableFromDate.Value, timezone); correctDateTime = newDate; } var record = new ContentLibrary { Featured = model.Featured, Title = model.Title, Precis = model.Precis, Url = model.Url, Status = ContentStatus.AwaitingDate, ContentType = model.ContentType, Created = DateTime.UtcNow, AvailableFromDate = model.AvailableFromDate != null? correctDateTime : DateTime.UtcNow, TimeZone = model.TimeZone }; try { Db.ContentLibraries.Add(record); Db.SaveChanges(); if (!imageData.Empty && imageData.PostedFileSaveAndResize(Server.MapPath(AppSettings.ContentLibraryImagePath), "item" + record.Id)) { record.ImageUrl = imageData.SavedName; Db.SaveChanges(); } } catch (Exception) { return(View(model)); } if (!ModelState.IsValid || !imageData.Empty) { return(RedirectToAction("Edit", new { id = record.Id })); } return(RedirectToAction("Index")); }
public void Should_not_have_published_ids() { var result = ContentLibrary.ImportFromCsvFile("content\\Tweets.csv"); result.Should().NotContain(c => !string.IsNullOrEmpty(c.PublishedId)); }
private ContentLibraryViewModel ContentToGridViewModel(ContentLibrary content) { return(ContentToViewModel(content, true)); }
public void Should_not_have_published_timestamps() { var result = ContentLibrary.ImportFromCsvFile("content\\Tweets.csv"); result.Should().NotContain(c => c.PublishedAt != new DateTime()); }