Beispiel #1
0
        public void AddMesh(string bodyPartName, int groupid, Mesh mesh)
        {
            var g = BodyParts.FirstOrDefault(x => x.Name == bodyPartName);

            if (g == null)
            {
                g = new BodyPart(bodyPartName);
                BodyParts.Add(g);
            }
            g.AddMesh(groupid, mesh);
        }
Beispiel #2
0
        private void TryProcessBodyStructure(string data)
        {
            Match bstructMatch = Expressions.BodyStructRex.Match(data);

            if (!bstructMatch.Success)
            {
                return;
            }

            using (var parser = new BodyStructureParser(bstructMatch.Groups[1].Value, _client, this))
                BodyParts = parser.Parse();

            Body = new MessageBody(_client,
                                   BodyParts.FirstOrDefault(
                                       _ =>
                                       _.ContentDisposition == null && _.ContentType != null &&
                                       _.ContentType.MediaType.Equals("text/plain", StringComparison.OrdinalIgnoreCase)),
                                   BodyParts.FirstOrDefault(
                                       _ =>
                                       _.ContentDisposition == null && _.ContentType != null &&
                                       _.ContentType.MediaType.Equals("text/html", StringComparison.OrdinalIgnoreCase)));

            Attachments = (from part in BodyParts
                           where
                           part.ContentDisposition != null &&
                           part.ContentDisposition.DispositionType == DispositionTypeNames.Attachment
                           select new Attachment(part)).ToArray();

            EmbeddedResources = (from part in BodyParts
                                 where
                                 part.ContentDisposition != null &&
                                 (part.ContentDisposition.DispositionType == DispositionTypeNames.Inline || !string.IsNullOrEmpty(part.ContentId))
                                 select new Attachment(part)).ToArray();

            _downloadProgress = _downloadProgress | MessageFetchMode.BodyStructure;
        }
Beispiel #3
0
 public IBodyPart GetBodyStoratge(IStorageType storageType) => BodyParts.FirstOrDefault(s => s.Type == storageType);