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); }
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; }
public IBodyPart GetBodyStoratge(IStorageType storageType) => BodyParts.FirstOrDefault(s => s.Type == storageType);