Radium Zheng

Results 129 comments of Radium Zheng
trafficstars

補充一個可能的使用場景,是我最近在實驗的一個東西: 嘗試用 [Emscripten](https://github.com/kripken/emscripten) 將 Rime 編譯成 WebAssembly / asmjs。動機是可以用網頁版(免安裝)的方式讓用戶體驗不同輸入方案,以及可以將輸入法做成瀏覽器插件。 目前是可以粗糙地運行起來([Demo](https://media.giphy.com/media/1fnvVHaCVX2LcaLcFC/giphy.gif) | [Code](https://github.com/ztl8702/librime/tree/809e6b68ff0872827898cfa6d82a83780d3ae013/wasm-demo)), 不過在瀏覽器裏部署,一來很慢(超過1分鐘),二來占內存(>128MB),這樣可用性就比較低。因此最好還是要外部先生成 table.bin,然後再提供給 WebAssembly 上的 rime 使用。 目前這個Demo部署的文件是在瀏覽器的內存裏面 (Emscripten 的 Virtual File System) ,我看看有沒有辦法把它生成的 .bin 文件取出來和 x64 / x86...

应该可以确定是在UWP应用内,输入法的DLL(C#)没被加载。具体原因猜测和.NET loader有关,还在研究。 用 WinDbg,看到打开非UWP进程,激活输入法的时候,先载入了`mscoree.dll`, `mscoreei.dll`等等.NET框架的东西,然后载入了.NET DLL (`YngPing.TSF.dll`是我修改过的`Yime.Core.dll`,以及`TSF.TypeLib.dll`)。 ![image](https://user-images.githubusercontent.com/2714446/40874692-e102915c-66b5-11e8-8adc-0633175e8fae.png) 而在 UWP App 下切换输入法的时候,`mscoree.dll`, `mscoreei.dll`载入之后就结束了。(后面.NET DLL没被载入) ![image](https://user-images.githubusercontent.com/2714446/40874728-60c395ee-66b6-11e8-9df9-dffc8ecb05a9.png) 我一度觉得是不是因为.NET Framework运行在UWP的Container里面,没有dll所在目录的读写权限。但是把.NET DLL 放到 `System32` 和 `SysWOW64` 下面之后,问题依旧。

小 Update 一下: 我一度想試試看把 `ITfTextInputProcessorEx` 實現爲 out-of-process COM Server,這樣就可以繞開和UWP運行在同一進程帶來的問題。但是發現 TSF 在創建 COM Object 的時候傳遞給 CoCreateInstance 的參數 dwClsContext = 1 (即 `CLSCTX_INPROC_SERVER`),那麼意味着只能用 in-process 的方式實現,LocalServer不會被TSF使用。 ![image](https://user-images.githubusercontent.com/2714446/41191470-60f9b246-6c33-11e8-964a-d0962e7cd501.png) (圖爲我在`combase.dll!CoCreateInstance`設的斷點)

> 按照之前微軟的吹法, 不應該能out-of-process 嗯,大概不然就破壞了AppContainer的安全機制。 > 懷疑不應該用COM方式去實現 所以用 WinRT 的 API 麼? https://docs.microsoft.com/en-us/uwp/api/windows.ui.text.core 但這個似乎只有取用Text Service,不能提供Text Service。

@lantianning [yngping-new-ui-e99249552c8159f6199b5d3c1226e50223afa97d.zip](https://github.com/copyliu/YIME/files/2135860/yngping-new-ui-e99249552c8159f6199b5d3c1226e50223afa97d.zip) 主要代码在`YngPing.TSF`下。

我有在 [StackOverflow](https://stackoverflow.com/questions/50660726/clr-cannot-create-net-based-com-objects-in-uwp/51033934) 上面问了一下,但没有满意的解答(都是说不可以,但是没有说具体的技术细节)。

@luckydonald The purpose of automating the process is just to make deployment on remote servers easier (by using a single command). I later used the following shell code as a...

Sorry for being away for a few days. Thank you for your kind help. In short the need is to have a single entrypoint for both the initial run and...

Some advice by @nachuan99 [福州话熟语大全App 的UI建议.pdf](https://github.com/MindongLab/foochow-idioms/files/1530267/App.UI.pdf)

@Heyhillary Friendly ping. Can we proceed with this request please?