public void Save()
        {
            if (NewMaterial == null || materialName == "")
            {
                return;
            }
            if (materialName == selectedImage)             //ncrunch: no coverage start
            {
                if (GetDialogResultToRenameMaterial())
                {
                    MaterialName += "Material";
                }
                else
                {
                    return;
                }
            }
            if (MaterialList.Contains(MaterialName))
            {
                if (!GetDialogResultToSaveMaterial())
                {
                    return;
                }
            }
            var             metaDataCreator = new ContentMetaDataCreator();
            ContentMetaData contentMetaData = metaDataCreator.CreateMetaDataFromMaterial(materialName,
                                                                                         NewMaterial);

            service.UploadContent(contentMetaData);
        }
예제 #2
0
        //ncrunch: no coverage start
        protected virtual ContentMetaData CreateContentMetaData(string contentFilePath)
        {
            var             metaDataCreator = new ContentMetaDataCreator();
            ContentMetaData contentMetaData = metaDataCreator.CreateMetaDataFromFile(contentFilePath);

            return(contentMetaData);
        }         //ncrunch: no coverage end
예제 #3
0
 private void CreateInstances()
 {
     EffectsInProject   = new ObservableCollection <string>();
     SpawnerTypeList    = new ObservableCollection <ParticleEmitterPositionType>();
     MaterialList       = new ObservableCollection <string>();
     AvailableTemplates = new ObservableCollection <string>();
     metaDataCreator    = new ContentMetaDataCreator();
     EmittersInProject  = new List <string>();
     BillboardModeList  = new List <string>();
 }
예제 #4
0
        public void SaveToServer()
        {
            var bytes       = new XmlFile(BuildXmlData()).ToMemoryStream().ToArray();
            var dataAndName = new Dictionary <string, byte[]> {
                { ContentName + ".xml", bytes }
            };
            var metaDataCreator = new ContentMetaDataCreator();
            var contentMetaData = metaDataCreator.CreateMetaDataFromLevelData(ContentName, bytes);

            service.UploadContent(contentMetaData, dataAndName);
        }
		public void CreateContentMetaDataFromXmlFileToBeUploadedToTheOnlineService()
		{
			var creator = new ContentMetaDataCreator();
			var filePath = Path.Combine("Content", "Verdana12.xml");
			var metaData = creator.CreateMetaDataFromFile(filePath);
			Assert.AreEqual("Verdana12", metaData.Name);
			Assert.AreEqual(ContentType.Xml, metaData.Type);
			Assert.LessOrEqual((DateTime.Now - metaData.LastTimeUpdated).Seconds, 1);
			Assert.AreEqual("en", metaData.Language);
			Assert.AreEqual("Verdana12.xml", metaData.LocalFilePath);
			Assert.AreEqual(0, metaData.PlatformFileId);
			Assert.AreEqual(11354, metaData.FileSize);
			Assert.AreEqual(0, metaData.Values.Count);
		}
        public void CreateContentMetaDataFromXmlFileToBeUploadedToTheOnlineService()
        {
            var creator  = new ContentMetaDataCreator();
            var filePath = Path.Combine("Content", "Verdana12.xml");
            var metaData = creator.CreateMetaDataFromFile(filePath);

            Assert.AreEqual("Verdana12", metaData.Name);
            Assert.AreEqual(ContentType.Xml, metaData.Type);
            Assert.LessOrEqual((DateTime.Now - metaData.LastTimeUpdated).Seconds, 1);
            Assert.AreEqual("en", metaData.Language);
            Assert.AreEqual("Verdana12.xml", metaData.LocalFilePath);
            Assert.AreEqual(0, metaData.PlatformFileId);
            Assert.AreEqual(11354, metaData.FileSize);
            Assert.AreEqual(0, metaData.Values.Count);
        }
		public void CreateContentMetaDataFromImageFileToBeUploadedToTheOnlineService()
		{
			var creator = new ContentMetaDataCreator();
			var filePath = Path.Combine("Content", "DeltaEngineLogo.png");
			var metaData = creator.CreateMetaDataFromFile(filePath);
			Assert.AreEqual("DeltaEngineLogo", metaData.Name);
			Assert.AreEqual(ContentType.Image, metaData.Type);
			Assert.LessOrEqual((DateTime.Now - metaData.LastTimeUpdated).Seconds, 1);
			Assert.AreEqual("en", metaData.Language);
			Assert.AreEqual("DeltaEngineLogo.png", metaData.LocalFilePath);
			Assert.AreEqual(0, metaData.PlatformFileId);
			Assert.AreEqual(8153, metaData.FileSize);
			Assert.AreEqual(2, metaData.Values.Count);
			Assert.AreEqual("(128,128)", metaData.Values["PixelSize"]);
			Assert.AreEqual("Normal", metaData.Values["BlendMode"]);
		}
        public void CreateContentMetaDataFromImageFileToBeUploadedToTheOnlineService()
        {
            var creator  = new ContentMetaDataCreator();
            var filePath = Path.Combine("Content", "DeltaEngineLogo.png");
            var metaData = creator.CreateMetaDataFromFile(filePath);

            Assert.AreEqual("DeltaEngineLogo", metaData.Name);
            Assert.AreEqual(ContentType.Image, metaData.Type);
            Assert.LessOrEqual((DateTime.Now - metaData.LastTimeUpdated).Seconds, 1);
            Assert.AreEqual("en", metaData.Language);
            Assert.AreEqual("DeltaEngineLogo.png", metaData.LocalFilePath);
            Assert.AreEqual(0, metaData.PlatformFileId);
            Assert.AreEqual(8153, metaData.FileSize);
            Assert.AreEqual(2, metaData.Values.Count);
            Assert.AreEqual("(128,128)", metaData.Values["PixelSize"]);
            Assert.AreEqual("Normal", metaData.Values["BlendMode"]);
        }
        //ncrunch: no coverage start
        public void SaveInput(CommandList commandList, Service service)
        {
            var root = CreateMainRoot("InputCommands");

            foreach (var command in commandList.GetCommands())
            {
                SetCommand(root, command, commandList.GetAllTriggers(command));
            }
            var bytes            = new XmlFile(root).ToMemoryStream().ToArray();
            var fileNameAndBytes = new Dictionary <string, byte[]>();

            fileNameAndBytes.Add("InputCommands.xml", bytes);
            var metaDataCreator = new ContentMetaDataCreator();
            var contentMetaData = metaDataCreator.CreateMetaDataFromInputData(bytes);

            service.UploadContent(contentMetaData, fileNameAndBytes);
        }
예제 #10
0
        public void SaveUI(string obj)
        {
            if (Scene.Controls.Count == 0 || string.IsNullOrEmpty(UIName))
            {
                return;                 //ncrunch: no coverage
            }
            var fileNameAndBytes = new Dictionary <string, byte[]>();
            var bytes            = BinaryDataExtensions.ToByteArrayWithTypeInformation(Scene);

            fileNameAndBytes.Add(UIName + ".deltascene", bytes);
            var             metaDataCreator = new ContentMetaDataCreator();
            ContentMetaData contentMetaData = metaDataCreator.CreateMetaDataFromUI(UIName, bytes);

            editorService.UploadContent(contentMetaData, fileNameAndBytes);
            if (CanGenerateSourceCode)
            {
                new SceneCodeGenerator(editorService, Scene, UIName).GenerateSourceCodeClass();
            }
        }
예제 #11
0
        public AnimationEditorViewModel(Service service)
        {
            this.service    = service;
            metaDataCreator = new ContentMetaDataCreator();
            LoadedImageList = new ObservableCollection <string>();
            ImageList       = new ObservableCollection <string>();
            AnimationList   = new ObservableCollection <string>();
            Duration        = 1;
            LoadImagesFromProject();
            LoadAnimationsFromProject();
            SetMessengers();
            var material = CreateDefaultMaterial2D();

            renderExample = new Sprite(material, new Rectangle(0.25f, 0.25f, 0.5f, 0.5f));
            AnimationName = "MyAnimation";
            UpdateIfCanSave();
            CanSaveAnimation = false;
            SetButtonEnableStates();
            Messenger.Default.Register <ContentIconAndName>(this, "SelectContentInContentManager",
                                                            SelectContentInContentManager);
        }