Esempio n. 1
0
        public void LoadFromXdxf(string xdxfFileName)
        {
            var document    = XDocument.Load(xdxfFileName);
            var xdxfElement = document.Element("xdxf");

            LanguageFrom = TextTranslator.GetLanguageFromId(xdxfElement.Attribute("lang_from").Value);
            LanguageTo   = TextTranslator.GetLanguageFromId(xdxfElement.Attribute("lang_to").Value);
            Format       = xdxfElement.Attribute("format").Value;
            var fullNameElem = document.Element("full_name");

            //FullName = document.Element("full_name").Value;
            //Description = document.Element("description").Value;

            SortedList = new SerializableSortedList <string, TranscriptionTranslation>();
            var documentElements = xdxfElement.Elements("ar");

            foreach (var element in documentElements)
            {
                var transcriptionTranslate = new TranscriptionTranslation
                {
                    Transcription = element.Element("tr") == null ? string.Empty : element.Element("tr").Value,
                    Translation   = element.Value
                };

                SortedList.Add(element.Element("k").Value, transcriptionTranslate);
            }
        }
Esempio n. 2
0
        public static SerializableSortedList <string, TranscriptionTranslation> XdxfToSortedList(Stream stream)
        {
            var sortedList       = new SerializableSortedList <string, TranscriptionTranslation>();
            var document         = XDocument.Load(stream);
            var documentElements = document.Element("xdxf").Elements("ar");

            foreach (var element in documentElements)
            {
                var transcriptionTranslate = new TranscriptionTranslation
                {
                    Transcription = element.Element("tr") == null ? string.Empty : element.Element("tr").Value,
                    Translation   = element.Value
                };

                sortedList.Add(element.Element("k").Value, transcriptionTranslate);
            }

            return(sortedList);
        }
Esempio n. 3
0
 public TranscriptionTranslation(string word, TranscriptionTranslation transcriptionTranslation)
 {
     Word          = word;
     Transcription = transcriptionTranslation.Transcription;
     Translation   = transcriptionTranslation.Translation;
 }