示例#1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ADConfigurationObject config = null;
            string parameterSetName;

            if ((parameterSetName = base.ParameterSetName) != null)
            {
                if (parameterSetName == "UploadDialPlanPrompts" || parameterSetName == "UploadDialPlanPromptsStream")
                {
                    config = this.DataObject;
                    goto IL_7D;
                }
                if (parameterSetName == "UploadAutoAttendantPrompts" || parameterSetName == "UploadAutoAttendantPromptsStream")
                {
                    config = base.AutoAttendant;
                    goto IL_7D;
                }
            }
            ExAssert.RetailAssert(false, "Invalid parameter set {0}", new object[]
            {
                base.ParameterSetName
            });
            try
            {
IL_7D:
                ITempFile tempFile = null;
                string extension = Path.GetExtension(this.PromptFileName);
                if (string.Equals(extension, ".wav", StringComparison.OrdinalIgnoreCase))
                {
                    tempFile = TempFileFactory.CreateTempWavFile();
                }
                else
                {
                    if (!string.Equals(extension, ".wma", StringComparison.OrdinalIgnoreCase))
                    {
                        throw new InvalidFileNameException(128);
                    }
                    tempFile = TempFileFactory.CreateTempWmaFile();
                }
                using (tempFile)
                {
                    using (FileStream fileStream = new FileStream(tempFile.FilePath, FileMode.Create, FileAccess.Write))
                    {
                        if (this.PromptFileData != null)
                        {
                            fileStream.Write(this.PromptFileData, 0, this.PromptFileData.Length);
                        }
                        else
                        {
                            CommonUtil.CopyStream(this.PromptFileStream, fileStream);
                        }
                    }
                    using (IPublishingSession publishingSession = PublishingPoint.GetPublishingSession(Environment.UserName, config))
                    {
                        publishingSession.Upload(tempFile.FilePath, this.PromptFileName);
                    }
                }
            }
            catch (UnsupportedCustomGreetingSizeFormatException)
            {
                this.HandleOversizeAudioData();
            }
            catch (LocalizedException exception)
            {
                base.WriteError(exception, (ErrorCategory)1000, null);
            }
            catch (SystemException ex)
            {
                if (!this.HandleException(ex))
                {
                    throw;
                }
                base.WriteError(ex, (ErrorCategory)1000, null);
            }
            TaskLogger.LogExit();
        }