}             //ncrunch: no coverage

            public void LoadValidData()
            {
                var d = new GeometryData {
                    Format = VertexFormat.Position3DColor, Indices = new short[6]
                };

                LoadData(new MemoryStream(BinaryDataExtensions.ToByteArrayWithTypeInformation(d)));
            }
        private static byte[] CreateByteDataWithCompressionIfPossible(object message,
                                                                      bool allowToCompressMessage)
        {
            var messageData = BinaryDataExtensions.ToByteArrayWithTypeInformation(message);

            if (allowToCompressMessage && messageData.Length > MinimumByteDataLengthToZip)
            {
                byte[] compressedData = ZlibStream.CompressBuffer(messageData);
                if (compressedData.Length < messageData.Length)
                {
                    return(ToByteArrayWithLengthHeader(compressedData, true));
                }
            }
            return(ToByteArrayWithLengthHeader(messageData, false));
        }
Exemple #3
0
        private bool TrySavingEmitterData(ParticleEmitterData emitterData, string name,
                                          bool overwrite)
        {
            if (!MaySaveRegardingExistingAndOverwrite(name, ContentType.ParticleEmitter, overwrite))
            {
                //ncrunch: no coverage start
                WarnExistantContentNoOverwrite(name, ContentType.ParticleEmitter);
                return(false);
            }             //ncrunch: no coverage end
            var bytes            = BinaryDataExtensions.ToByteArrayWithTypeInformation(emitterData);
            var fileNameAndBytes = new Dictionary <string, byte[]>();

            fileNameAndBytes.Add(name + ".deltaparticle", bytes);
            ContentMetaData metaData = metaDataCreator.CreateMetaDataFromParticle(name, bytes);

            service.UploadContent(metaData, fileNameAndBytes);
            return(true);
        }
Exemple #4
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();
            }
        }
 private void SaveDataToStream()
 {
     dataBytes  = BinaryDataExtensions.ToByteArrayWithTypeInformation(emitterData);
     dataStream = new MemoryStream(dataBytes);
 }
Exemple #6
0
 public void ReloadCreationData(ShaderWithFormatCreationData creationData)
 {
     byte[] rawData = creationData.VertexCode == "NoData"
                             ? new byte[0] : BinaryDataExtensions.ToByteArrayWithTypeInformation(creationData);
     LoadData(new MemoryStream(rawData));
 }