예제 #1
0
        private string GetSeminarsShortcutId(IAdobeConnectProxy provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            StatusInfo  status;
            ScoShortcut seminarShortcut = provider.GetShortcutByType("seminars", out status);

            if (status.Code != StatusCodes.ok)
            {
                throw new AdobeConnectException(status);
            }

            if (seminarShortcut == null)
            {
                throw new InvalidOperationException("Seminars are not acсessible for the principal");
            }

            return(seminarShortcut.ScoId);
        }
예제 #2
0
        public IEnumerable <ScoContent> GetAllSeminarLicenses(IAdobeConnectProxy provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            StatusInfo  status;
            ScoShortcut seminarShortcut = provider.GetShortcutByType("seminars", out status);

            if (status.Code != StatusCodes.ok)
            {
                throw new AdobeConnectException(status);
            }
            if (seminarShortcut == null)
            {
                throw new InvalidOperationException("Seminars are not acessible for the principal");
            }

            var result = provider.GetContentsByScoId(seminarShortcut.ScoId);

            return(result.Values);
        }
예제 #3
0
        public ChatTranscript GetMeetingChatTranscript(string accountId, string meetingScoId, DateTime sessionDateCreated, DateTime sessionDateEnd)
        {
            ScoShortcut chatsFolder = GetChatTranscriptsFolder(accountId);

            IEnumerable <ScoContent> chatScoList = _contentService.GetFolderContent(chatsFolder.ScoId, meetingScoId);
            var sessionChatFiles = chatScoList.Where(x => x.BeginDate >= sessionDateCreated && x.EndDate <= sessionDateEnd);

            if (sessionChatFiles.Count() == 0)
            {
                //TODO: what to do
                return(null);
            }

            if (sessionChatFiles.Count() > 1)
            {
                string message = $"Several files found: { string.Join(", ", sessionChatFiles.Select(x => x.ScoId)) }. MeetingScoId:'{meetingScoId}'. sessionDateCreated:{sessionDateCreated}. sessionDateEnd:{sessionDateEnd}.";
                throw new InvalidOperationException(message);
            }

            var    chatFileScoId = sessionChatFiles.Single().ScoId;
            string err;

            byte[] zipContent = _proxy.GetContent(chatFileScoId, out err);

            using (var chatXmlFileStream = new MemoryStream())
            {
                using (var compressedFileStream = new MemoryStream(zipContent))
                {
                    using (var zipArchive = new ZipArchive(compressedFileStream, ZipArchiveMode.Read, true))
                    {
                        ZipArchiveEntry zipEntry;
                        try
                        {
                            zipEntry = zipArchive.Entries.Single();
                        }
                        catch (Exception ex)
                        {
                            throw new InvalidOperationException($"Error parsing chat transcription. No transcript file found. MeetingScoId:'{meetingScoId}'. ChatFile sco-id:{chatFileScoId}.", ex);
                        }

                        using (var zipEntryStream = zipEntry.Open())
                        {
                            zipEntryStream.CopyTo(chatXmlFileStream);
                        }
                    }
                }

                chatXmlFileStream.Position = 0;

                try
                {
                    using (var sr = new StreamReader(chatXmlFileStream, Encoding.UTF8))
                    {
                        var chat = (ChatTranscript)Serializer.Deserialize(sr);

                        if (chat.Messages.Any(x => x.To == null))
                        {
                            _logger.Error($"Message with To==null. MeetingScoId:'{meetingScoId}'. ChatFile sco-id:{chatFileScoId}.");
                        }

                        return(chat);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Error($"Error parsing chat transcription. MeetingScoId:'{meetingScoId}'. ChatFile sco-id:{chatFileScoId}. {_proxy.AdobeConnectRoot}.", ex);
                    throw new InvalidOperationException("Error parsing chat transcription.", ex);
                }
            }
        }