Exemplo n.º 1
0
        /// <summary>
        /// 获取支持的翻译语种列表
        /// </summary>
        private void Deal0x0506()
        {
            List <Language> languageList = TranslateFun.GetTranslate().GetTransLanguages();

            if (languageList != null && languageList.Count > 0)
            {
                byte[] data = _analyzer.Combine0x0602(languageList, 0x0606);
                Send(data, " 0x0606 (支持翻译的语种列表)");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 翻译
        /// </summary>
        /// <param name="data"></param>
        private void Deal0x0505(byte[] data)
        {
            LanguageType from;
            LanguageType to;
            string       text;

            bool ret = _analyzer.Analyze0x0505(data, out text, out from, out to);

            if (ret == false)
            {
                Utils.ShowInfo(this, "[Service] 解析 0x0505 数据失败。");
                return;
            }

            string transResult;

            ret = TranslateFun.GetTranslate().Trans(text, from, out transResult, to);

            byte[] sendData = _analyzer.Combine0x0605(ret, transResult);
            Send(sendData, " 0x0605 (翻译结果)");
        }