protected enmLanguage DetectLanguage(string html)
        {
            var ind1     = html.IndexOf("id=src-translit");
            var divStr   = "<div class=\"goog-inline-block goog-toolbar-button-inner-box\">";
            var indBegin = html.IndexOf(divStr, ind1) + divStr.Length;

            indBegin = html.IndexOf(divStr, indBegin) + divStr.Length;
            var indEnd  = html.IndexOf("</div>", indBegin) - 1;
            var langStr = html.Substring(indBegin, indEnd - indBegin + 1);

            return(TextTranslator.GetLanguageFromName(langStr));
        }
예제 #2
0
        public virtual void Load(string fileName)
        {
            TextTranslator dictionary = null;

            using (var reader = new StreamReader(fileName))
            {
                BinaryFormatter bf = new BinaryFormatter();
                dictionary = (TextTranslator)bf.Deserialize(reader.BaseStream);
            }
            LanguageFrom = dictionary.LanguageFrom;
            LanguageTo   = dictionary.LanguageTo;
            Format       = dictionary.Format;
            FullName     = dictionary.FullName;
            Description  = dictionary.Description;
        }