예제 #1
0
        protected virtual void AddFormImageDataFields(WWWForm form, EncounterImageContent imageData)
        {
            var imagesDoc        = new XmlDocument();
            var imagesSerializer = new XmlSerializer(imagesDoc);

            ImageDataSerializer.Serialize(imagesSerializer, imageData);
            byte[] fileBytesImg = GetFileAsByteArray(imagesDoc.OuterXml);
            Debug.Log("Image file size (in bytes): " + fileBytesImg.Length);
            // Eventually an approach to get around the size limit may be needed
            if (fileBytesImg.Length <= MaxAllowedPacketSize)
            {
                form.AddBinaryData(ImageContentVariable, fileBytesImg, ImageContentFilename, XmlMimeType);
            }
            else
            {
                Debug.LogError("Error: Images exceed upload size limit");
            }
        }
예제 #2
0
        public WaitableTask Save(User user, Encounter encounter)
        {
            MetadataWriter.Save(user, encounter.Metadata);

            var contentDoc        = new XmlDocument();
            var contentSerializer = new XmlSerializer(contentDoc);

            EncounterContentSerializer.Serialize(contentSerializer, encounter.Content.NonImageContent);
            FileManager.SetFileText(user, FileType.Data, encounter.Metadata, contentDoc.OuterXml);

            var imagesDoc        = new XmlDocument();
            var imagesSerializer = new XmlSerializer(imagesDoc);

            ImageDataSerializer.Serialize(imagesSerializer, encounter.Content.ImageContent);
            FileManager.SetFileText(user, FileType.Image, encounter.Metadata, imagesDoc.OuterXml);

            return(WaitableTask.CompletedTask);
        }