Пример #1
0
        /// <summary> Adds pronunciation audio of a word to be written out to lift </summary>
        private void AddAudio(LexEntry entry, Word wordEntry, string path)
        {
            foreach (var audioFile in wordEntry.Audio)
            {
                var lexPhonetic = new LexPhonetic();

                var util = new Utilities();

                var projectPath = Path.Combine(util.GenerateFilePath(
                                                   Utilities.FileType.Dir, true, "", ""), _projectId);
                projectPath = Path.Combine(projectPath, "Import", "ExtractedLocation");
                var extractedDir = Directory.GetDirectories(projectPath);
                projectPath = Path.Combine(projectPath, extractedDir.Single());
                var src = Path.Combine(util.GenerateFilePath(
                                           Utilities.FileType.Audio, true), Path.Combine(projectPath, "audio", audioFile));
                var dest = Path.Combine(path, audioFile);

                if (File.Exists(src))
                {
                    File.Copy(src, dest, true);

                    var proMultiText = new LiftMultiText {
                        { "href", dest }
                    };
                    lexPhonetic.MergeIn(MultiText.Create(proMultiText));
                    entry.Pronunciations.Add(lexPhonetic);
                }
            }
        }
Пример #2
0
        /// <summary> Adds pronunciation audio of a word to be written out to lift </summary>
        private static void AddAudio(LexEntry entry, Word wordEntry, string path, string projectId)
        {
            foreach (var audioFile in wordEntry.Audio)
            {
                var lexPhonetic = new LexPhonetic();
                var src         = FileStorage.GenerateAudioFilePath(projectId, audioFile);
                var dest        = Path.Combine(path, audioFile);

                if (File.Exists(src))
                {
                    File.Copy(src, dest, true);

                    var proMultiText = new LiftMultiText {
                        { "href", dest }
                    };
                    lexPhonetic.MergeIn(MultiText.Create(proMultiText));
                    entry.Pronunciations.Add(lexPhonetic);
                }
            }
        }