├── .gitignore
├── Images
├── QQ.jpg
├── 中书君.png
├── 打字效果.png
├── 捐赠.jpg
└── 楔子.png
├── LICENSE
├── README.md
├── WubiMaster.sln
└── WubiMaster
├── App.config
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── Assets
├── Fonts
│ └── 黑体字根.ttf
├── Inno
│ └── InnoSetup.iss
├── Schemas
│ └── WubiMaster.txt
├── Spelling
│ ├── wb06_spelling.txt
│ ├── wb86_spelling.txt
│ └── wb98_spelling.txt
└── Yamls
│ └── color_themes.yaml
├── Common
├── CmdHelper.cs
├── ConfigHelper.cs
├── Converter.cs
├── FontHelper.cs
├── GlobalValues.cs
├── HttpRequestHelper.cs
├── JsonConfigHelper.cs
├── LogHelper.cs
├── NongliHelper.cs
├── ObjectExtend.cs
├── PopExtend.cs
├── RegistryHelper.cs
├── ServiceHelper.cs
├── ShiciHelper.cs
├── SpellingWorker.cs
├── YamlHelper.cs
└── ZipHelper.cs
├── Controls
├── CancelButton.xaml
├── CancelButton.xaml.cs
├── ColorSchemeControl.xaml
├── ColorSchemeControl.xaml.cs
├── ControlsView.xaml
├── ControlsView.xaml.cs
├── EtymonKeyControl.xaml
├── EtymonKeyControl.xaml.cs
├── IconButton.xaml
├── IconButton.xaml.cs
├── LogoControl.xaml
├── LogoControl.xaml.cs
├── MessageBoxControl.xaml
├── MessageBoxControl.xaml.cs
├── NavButton.xaml
├── NavButton.xaml.cs
├── PageTitle.xaml
├── PageTitle.xaml.cs
├── PagingControl.xaml
├── PagingControl.xaml.cs
├── RimeLogo.xaml
├── RimeLogo.xaml.cs
├── RunningControl.xaml
├── RunningControl.xaml.cs
├── SearchTextbox.xaml
├── SearchTextbox.xaml.cs
├── SeparatorControl.xaml
├── SeparatorControl.xaml.cs
├── SettingPanel.xaml
├── SettingPanel.xaml.cs
├── ShichenControl.xaml
├── ShichenControl.xaml.cs
├── ShiciControl.xaml
├── ShiciControl.xaml.cs
├── StateToggleButton.xaml
├── StateToggleButton.xaml.cs
├── ToolButton.xaml
├── ToolButton.xaml.cs
├── WinowStateButton.xaml
├── WinowStateButton.xaml.cs
├── ZigenKey.xaml
├── ZigenKey.xaml.cs
├── ZigenPanel.xaml
├── ZigenPanel.xaml.cs
├── ZiwuControl.xaml
└── ZiwuControl.xaml.cs
├── Fonts
├── iconfont.ttf
├── 方正启体_GBK.ttf
├── 演示佛系体.ttf
└── 黑体字根.ttf
├── Images
├── JinriShici
│ ├── 低头.png
│ ├── 低头的人.png
│ ├── 侧脸.png
│ ├── 侧身微笑.png
│ ├── 坐椅子的女人.png
│ ├── 坐着的女人.png
│ ├── 思考.png
│ ├── 手托头.png
│ ├── 正面.png
│ ├── 翘二郎腿的女人.png
│ ├── 长发女人.png
│ ├── 青花瓷少女.png
│ └── 青花瓷衣服.png
├── donation.jpg
└── wubi_demo.png
├── Models
├── CikuModel.cs
├── ColorSchemeModel.cs
├── ColorsModel.cs
├── LogBackModel.cs
├── ShiciContentModel.cs
├── ShiciIntervalModel.cs
├── SpellingModel.cs
├── ThemeModel.cs
├── WeaselCustomModel.cs
├── WeaselModel.cs
├── WubiDictModel.cs
└── ZigenModel.cs
├── Properties
└── PublishProfiles
│ └── FolderProfile.pubxml
├── Styles
├── ButtonStyle.xaml
├── CheckBoxStyle.xaml
├── CloseButtonStyle.xaml
├── ComboBoxStyle.xaml
├── CommonStyle.xaml
├── ContextMenuStyle.xaml
├── DataGridStyle.xaml
├── HomeViewStyle.xaml
├── ItemsControlStyle.xaml
├── LexiconViewStyle.xaml
├── MainViewStyle.xaml
├── MinButtonStyle.xaml
├── NavButtonStyle.xaml
├── PageStyle.xaml
├── PopViewBaseStyle.xaml
├── RadioButtonStyle.xaml
├── ScrollViewerStyle.xaml
├── TabControlStyle.xaml
├── TextBoxStyle.xaml
├── ThemeButtonStyle.xaml
├── ThemeViewStyle.xaml
├── ToggleButtonStyle.xaml
├── ToolTipStyle.xaml
└── UIElementHoverStyle.xaml
├── Themes
├── BlackWhiteTheme.xaml
├── CeladonLilacTheme.xaml
├── CeruleanTheme.xaml
├── CyberpunkTheme.xaml
├── DarkGreenTheme.xaml
├── DefultBlueTheme.xaml
├── DefultLightTheme.xaml
├── DefultNightTheme.xaml
├── DullBlueTheme.xaml
├── GoldDarkTheme.xaml
├── HackerNewsTheme.xaml
├── InkBueNightTheme.xaml
├── JadeCoralTheme.xaml
├── KellyGreenTheme.xaml
├── LavendarTheme.xaml
├── NeonLightsTheme.xaml
├── OceanSunsetTheme.xaml
├── PurpleDarkTheme.xaml
├── RainyMormingTheme.xaml
├── RedTheme.xaml
├── SmokeBlueTheme.xaml
├── SummerMeadowTheme.xaml
├── ThemeNames.xaml
├── TickTokTheme.xaml
├── TurquoiseRustTheme.xaml
└── VintageJewelryTheme.xaml
├── ViewModels
├── AttributeViewModel.cs
├── CreateWordsViewModel.cs
├── EtymonKeyViewModel.cs
├── EtymonViewModel.cs
├── HomeViewModel.cs
├── LexiconViewModel.cs
├── MainViewModel.cs
├── MyColorsViewModel.cs
├── PopViewModel.cs
├── SettingsViewModel.cs
├── TestViewModel.cs
└── ThemeViewModel.cs
├── Views
├── AboutView.xaml
├── AboutView.xaml.cs
├── AttributeView.xaml
├── AttributeView.xaml.cs
├── EtymonKeyView.xaml
├── EtymonKeyView.xaml.cs
├── EtymonView.xaml
├── EtymonView.xaml.cs
├── HomeView.xaml
├── HomeView.xaml.cs
├── LexiconView.xaml
├── LexiconView.xaml.cs
├── MainView.xaml
├── MainView.xaml.cs
├── MyColorsView.xaml
├── MyColorsView.xaml.cs
├── PopViews
│ ├── CreateWordsView.xaml
│ ├── CreateWordsView.xaml.cs
│ ├── DonationView.xaml
│ ├── DonationView.xaml.cs
│ ├── LodingView.xaml
│ ├── LodingView.xaml.cs
│ ├── MessageView.xaml
│ ├── MessageView.xaml.cs
│ ├── WelcomeView.xaml
│ └── WelcomeView.xaml.cs
├── SettingsView.xaml
├── SettingsView.xaml.cs
├── TestView.xaml
├── TestView.xaml.cs
├── ThemeView.xaml
└── ThemeView.xaml.cs
├── WubiMaster.csproj
├── app.manifest
└── faviocn.ico
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # Uncomment if you have tasks that create the
29 | config.json
--------------------------------------------------------------------------------
/Images/QQ.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/Images/QQ.jpg
--------------------------------------------------------------------------------
/Images/中书君.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/Images/中书君.png
--------------------------------------------------------------------------------
/Images/打字效果.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/Images/打字效果.png
--------------------------------------------------------------------------------
/Images/捐赠.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/Images/捐赠.jpg
--------------------------------------------------------------------------------
/Images/楔子.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/Images/楔子.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | ## 写给热爱打字的你
4 |
5 | > 我们曾是诗的国度,你我的魂早已浸透了仓颉的恩泽。
6 | > 相信你也曾像太白一样诗意盎然,忽复乘舟梦日边。
7 | > 也曾挥毫间,畅想兰亭轶闻,放浪形骸于山水之间。
8 | > 你有你的故事,我有我的酒。
9 | > 用最初的文字,记录每一处痕迹,直到盛满整个星汉。
10 | > 当你用它打字时,你就成了最浪漫的诗人!
11 | > ——空山明月
12 |
13 | ## 预览
14 |
15 | 
16 |
17 | ## 介绍
18 |
19 | **【中书君】** 是一款针对于 Rime 输入法引擎的管理器,最初的愿望是希望它能支持五笔输入方案的属性、词库等方面的管理。最终还希望它能完美地兼容更多输入方案(如简拼、双拼等)的管理,以提升 Rime 的使用体验。
20 |
21 | 目前,本软件还处于研发阶段,相应功能会持续更新,如有特殊需求,可提交 ISSUES.
22 |
23 | 如果对您有帮助,请帮我在右上角点个星,谢啦~~~ ⭐
24 |
25 | ## 软件架构
26 |
27 | | 关键技术 | 描述 |
28 | | ---- | ---- |
29 | | 开发语言 | C# |
30 | | 开发框架 | .NET Core / WPF |
31 | | 框架版本 | .NET 6 |
32 | | 开发工具 | Visual Studio 2022 |
33 | | 设计模式 | Mvvm / CommunityToolkit.Mvvm |
34 | | 第三方库 | Log4.net / CommunityToolkit.Mvvm / Newtonsoft.Json / YamlDotNet / Behaviossr.Wpf |
35 | | 打包环境 | Inno Setup |
36 |
37 | ## 打字效果
38 |
39 | 支持86、98和新世纪码表
40 |
41 | 
42 |
43 | ### 方案地址
44 |
45 | https://gitee.com/hi-coder/rime-86wubi
46 |
47 | ## 捐赠
48 |
49 | > 感谢您选择并使用这款开源软件!您的信任与支持是我持续前进的动力。
50 | > 开源软件的研发与维护离不开开发者的辛勤付出与无私奉献。为了保持软件的持续更新与优化,恳请您在能力范围内考虑对本项目进行捐赠。
51 | > 您的每一份捐赠,都将直接用于软件的开发、测试、维护以及优化,帮助更多用户享受到更好的使用体验。
52 | > 您可以选择通过支付宝、微信等在线支付平台进行捐赠,捐赠金额不限,您的每一份心意我都将倍加珍惜。
53 | > 再次感谢您的支持与厚爱!祝您生活愉快,工作顺利!
54 | > 空山明月 敬上
55 |
56 | 
57 |
58 | ## QQ群
59 |
60 | 欢迎您的加入!
61 |
62 | 
63 |
--------------------------------------------------------------------------------
/WubiMaster.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.6.33712.159
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WubiMaster", "WubiMaster\WubiMaster.csproj", "{91DDE01B-E8B3-4E7E-8B5C-A785123F0D8B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {91DDE01B-E8B3-4E7E-8B5C-A785123F0D8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {91DDE01B-E8B3-4E7E-8B5C-A785123F0D8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {91DDE01B-E8B3-4E7E-8B5C-A785123F0D8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {91DDE01B-E8B3-4E7E-8B5C-A785123F0D8B}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {326EF06E-84A8-4956-AC59-FF3A160E6E31}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/WubiMaster/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/WubiMaster/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/WubiMaster/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Threading;
11 | using WubiMaster.Common;
12 |
13 | namespace WubiMaster
14 | {
15 | public partial class App : Application
16 | {
17 | private Mutex mutex;
18 | public static bool IsMaximized { get; set; }
19 |
20 | private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
21 | {
22 | try
23 | {
24 | e.Handled = true;
25 | LogHelper.Fatal(e.Exception.Message);
26 | }
27 | catch (Exception ex)
28 | {
29 | LogHelper.Fatal("程序发生致命错误,将终止,请联系开发人员!" + ex.Message);
30 | this.ShowMessage("程序发生致命错误,将终止,请联系开发人员!", DialogType.Error);
31 | Environment.Exit(0);
32 | }
33 | }
34 |
35 | private void Application_Exit(object sender, ExitEventArgs e)
36 | {
37 | LogHelper.Info("程序退出");
38 | }
39 |
40 | private void Application_Startup(object sender, StartupEventArgs e)
41 | {
42 | //bool ret;
43 | //mutex = new Mutex(true, "WubiMaster", out ret);
44 | //if (!ret)
45 | //{
46 | // LogHelper.Info("禁止启用多个进程");
47 | // Environment.Exit(0);
48 | // return;
49 | //}
50 |
51 | LogHelper.Info("程序启动");
52 |
53 | this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
54 | TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
55 | AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
56 | }
57 |
58 | private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
59 | {
60 | StringBuilder sbEx = new StringBuilder();
61 | if (e.IsTerminating)
62 | {
63 | sbEx.Append("程序发生致命错误,将终止,请联系开发人员!\n");
64 | }
65 |
66 | if (e.ExceptionObject is Exception)
67 | {
68 | sbEx.Append(((Exception)e.ExceptionObject).Message);
69 | }
70 | else
71 | {
72 | sbEx.Append(e.ExceptionObject);
73 | }
74 | this.ShowMessage(sbEx.ToString(), DialogType.Error);
75 | }
76 |
77 | private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
78 | {
79 | LogHelper.Fatal(e.Exception.Message);
80 | e.SetObserved();
81 | this.ShowMessage(e.Exception.Message, DialogType.Error);
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/WubiMaster/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 | [assembly: log4net.Config.XmlConfigurator(Watch = true)]
12 |
--------------------------------------------------------------------------------
/WubiMaster/Assets/Fonts/黑体字根.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/WubiMaster/Assets/Fonts/黑体字根.ttf
--------------------------------------------------------------------------------
/WubiMaster/Assets/Inno/InnoSetup.iss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshiqiqi/WubiMaster/3548687df1ac1bd922cc33e31ac8cf5a0e43abd8/WubiMaster/Assets/Inno/InnoSetup.iss
--------------------------------------------------------------------------------
/WubiMaster/Assets/Schemas/WubiMaster.txt:
--------------------------------------------------------------------------------
1 | 无
--------------------------------------------------------------------------------
/WubiMaster/Common/CmdHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace WubiMaster.Common
10 | {
11 | public class CmdHelper
12 | {
13 | public static void RunCmd(string path, string cmd, bool readToEnd = true)
14 | {
15 | Task.Run(() => {
16 | string CmdPath = @"C:\Windows\System32\cmd.exe";
17 | cmd = cmd.Trim().TrimEnd('&') + "&exit";//说明:不管命令是否成功均执行exit命令,否则当调用ReadToEnd()方法时,会处于假死状态
18 | using (Process p = new Process())
19 | {
20 | p.StartInfo.FileName = CmdPath;
21 | p.StartInfo.WorkingDirectory = path; // 指定运行目录
22 | p.StartInfo.UseShellExecute = false; //是否使用操作系统shell启动
23 | p.StartInfo.RedirectStandardInput = true; //接受来自调用程序的输入信息
24 | p.StartInfo.RedirectStandardOutput = true; //由调用程序获取输出信息
25 | p.StartInfo.RedirectStandardError = true; //重定向标准错误输出
26 | p.StartInfo.CreateNoWindow = true; //不显示程序窗口
27 | p.Start();//启动程序
28 |
29 | //向cmd窗口写入命令
30 | p.StandardInput.WriteLine(cmd);
31 | p.StandardInput.AutoFlush = true;
32 |
33 | //获取cmd窗口的输出信息
34 | if (readToEnd)
35 | {
36 | bool isReaded = false;
37 | Task.Run(() =>
38 | {
39 | p.StandardOutput.ReadToEnd();
40 | isReaded = true;
41 | });
42 |
43 | int waitTimeCount = 0;
44 | while (!isReaded)
45 | {
46 | Thread.Sleep(100);
47 | waitTimeCount++;
48 |
49 | if (waitTimeCount >= 10 * 3)
50 | break;
51 | }
52 | }
53 |
54 | //string output = p.StandardOutput.ReadToEnd();
55 | p.WaitForExit();//等待程序执行完退出进程
56 | p.Close();
57 |
58 | //return output;
59 | }
60 | });
61 |
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/WubiMaster/Common/ConfigHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WubiMaster.Common
4 | {
5 | public class ConfigHelper
6 | {
7 | public static bool ReadConfigByBool(string key, bool defaultValue = false)
8 | {
9 | string value = JsonConfigHelper.ReadConfig(key);
10 | if (string.IsNullOrEmpty(value))
11 | {
12 | return defaultValue;
13 | }
14 |
15 | return bool.Parse(value);
16 | }
17 |
18 | public static int ReadConfigByInt(string key, int defaultValue = -1)
19 | {
20 | string value = JsonConfigHelper.ReadConfig(key);
21 | if (string.IsNullOrEmpty(value))
22 | {
23 | return defaultValue;
24 | }
25 |
26 | return Convert.ToInt32(value);
27 | }
28 |
29 | public static string ReadConfigByString(string key, string defaultValue = "")
30 | {
31 | string value = JsonConfigHelper.ReadConfig(key);
32 | if (string.IsNullOrEmpty(value))
33 | {
34 | return defaultValue;
35 | }
36 |
37 | return value;
38 | }
39 |
40 | public static void WriteConfigByBool(string key, bool value)
41 | {
42 | JsonConfigHelper.WriteConfig(key, value.ToString());
43 | }
44 |
45 | public static void WriteConfigByInt(string key, int value)
46 | {
47 | JsonConfigHelper.WriteConfig(key, value.ToString());
48 | }
49 | public static void WriteConfigByString(string key, string value)
50 | {
51 | try
52 | {
53 | JsonConfigHelper.WriteConfig(key, value);
54 | }
55 | catch (Exception ex)
56 | {
57 | LogHelper.Error(ex.ToString());
58 | if (ex is UnauthorizedAccessException)
59 | App.Current.MainWindow.ShowMessage("当前用户没有权限读取配置文件");
60 | }
61 |
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/WubiMaster/Common/GlobalValues.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WubiMaster.Common
4 | {
5 | public class GlobalValues
6 | {
7 | public static string AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
8 | public static string GithubZipUrl = "https://github.com/mrshiqiqi/rime-wubi/archive/refs/heads/master.zip";
9 | public static string HeitiFont = AppDomain.CurrentDomain.BaseDirectory + @$"Assets\Fonts\黑体字根.ttf";
10 | public static string SchemaKey = @"\wubi_master.txt";
11 | public static string SchemaZip = AppDomain.CurrentDomain.BaseDirectory + @$"Assets\Schemas\schema.zip";
12 | public static string SpellingText06 = AppDomain.CurrentDomain.BaseDirectory + @$"Assets\Spelling\wb06_spelling.txt";
13 | public static string SpellingText86 = AppDomain.CurrentDomain.BaseDirectory + @$"Assets\Spelling\wb86_spelling.txt";
14 | public static string SpellingText98 = AppDomain.CurrentDomain.BaseDirectory + @$"Assets\Spelling\wb98_spelling.txt";
15 | public static string Table06Zip = AppDomain.CurrentDomain.BaseDirectory + @"Assets\Schemas\table06.zip";
16 | public static string Table86Zip = AppDomain.CurrentDomain.BaseDirectory + @"Assets\Schemas\table86.zip";
17 | public static string Table98Zip = AppDomain.CurrentDomain.BaseDirectory + @"Assets\Schemas\table98.zip";
18 | public static string WubiFileName = "rime-wubi-master";
19 | public static string WubiZipPath = AppDomain.CurrentDomain.BaseDirectory + @$"Assets\Schemas\{WubiFileName}.zip";
20 | private static string processPath;
21 | private static string rimeKey;
22 | private static string serverName;
23 | private static string userPath;
24 |
25 | public static string ProcessPath
26 | {
27 | get { return processPath; }
28 | set { processPath = value; }
29 | }
30 |
31 | public static string RimeKey
32 | {
33 | get { return rimeKey; }
34 | set { rimeKey = value; }
35 | }
36 |
37 | public static string ServerName
38 | {
39 | get { return serverName; }
40 | set { serverName = value; }
41 | }
42 |
43 | public static string UserPath
44 | {
45 | get { return userPath; }
46 | set { userPath = value; }
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/WubiMaster/Common/JsonConfigHelper.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace WubiMaster.Common
10 | {
11 | public class JsonConfigHelper
12 | {
13 |
14 | private static Dictionary configDic = new Dictionary();
15 |
16 | ///
17 | /// 读取配置信息
18 | ///
19 | ///
20 | ///
21 | public static string ReadConfig(string key)
22 | {
23 | if (File.Exists("config.json") == false)//如果不存在就创建file文件夹
24 | {
25 | FileStream f = File.Create("config.json");
26 | f.Close();
27 | }
28 | string s = File.ReadAllText("config.json");
29 | try
30 | {
31 | configDic = JsonConvert.DeserializeObject>(s);
32 | }
33 | catch
34 | {
35 | configDic = new Dictionary();
36 | }
37 |
38 | if (configDic != null && configDic.ContainsKey(key))
39 | {
40 | return configDic[key];
41 | }
42 | else
43 | {
44 | return string.Empty;
45 | }
46 | }
47 |
48 | ///
49 | /// 添加配置信息
50 | ///
51 | ///
52 | ///
53 | public static void WriteConfig(string key, string value)
54 | {
55 | if (configDic == null)
56 | {
57 | configDic = new Dictionary();
58 | }
59 | configDic[key] = value;
60 | string s = JsonConvert.SerializeObject(configDic);
61 | File.WriteAllText("config.json", s);
62 | }
63 |
64 | ///
65 | /// 删除配置信息
66 | ///
67 | ///
68 | public static void DeleteConfig(string key)
69 | {
70 | if (configDic != null && configDic.ContainsKey(key))
71 | {
72 | configDic.Remove(key);
73 | string s = JsonConvert.SerializeObject(configDic);
74 | File.WriteAllText("config.json", s);
75 | }
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/WubiMaster/Common/PopExtend.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.Messaging;
2 | using System;
3 | using System.Windows;
4 | using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
5 |
6 | namespace WubiMaster.Common
7 | {
8 | public static class PopExtend
9 | {
10 | public static void ClosePop(this Window pop)
11 | {
12 | if (pop == null) return;
13 |
14 | try
15 | {
16 | pop.DialogResult = true;
17 | }
18 | catch (Exception ex)
19 | {
20 | LogHelper.Error(ex.Message);
21 | pop.Close();
22 | }
23 | }
24 |
25 | public static bool? ShowPop(this Window pop)
26 | {
27 | if (pop == null) return null;
28 |
29 | Window mainWindow = App.Current.MainWindow;
30 |
31 | WeakReferenceMessenger.Default.Send("true", "ShowMaskLayer");
32 | pop.Owner = mainWindow;
33 | pop.WindowStartupLocation = WindowStartupLocation.CenterOwner;
34 | return pop.ShowDialog();
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/WubiMaster/Common/ShiciHelper.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using WubiMaster.Models;
3 |
4 | namespace WubiMaster.Common
5 | {
6 | public enum ShiciType
7 | {
8 | Chun,
9 | Xia,
10 | Qiu,
11 | Dong,
12 |
13 | Chunjie,
14 | Yuanxiaojie,
15 | Hanshijie,
16 | Qingmingjie,
17 | Duanwujie,
18 | Qixijie,
19 | Zhongqiujie,
20 | Chongyangjie,
21 |
22 | Defualt,
23 | }
24 |
25 | public class ShiciHelper
26 | {
27 | private static string BaseUrl = "https://v1.jinrishici.com";
28 | private static HttpRequestHelper httpRequestHelper = new HttpRequestHelper();
29 | private static string TargetUrl = "";
30 |
31 | public static ShiciContentModel GetShiciAll()
32 | {
33 | TargetUrl = BaseUrl + @"/all";
34 | string jsonString = httpRequestHelper.HttpGet(TargetUrl, "");
35 | ShiciContentModel model = JsonConvert.DeserializeObject(jsonString);
36 |
37 | return model;
38 | }
39 |
40 | public static ShiciContentModel GetShiciByType(ShiciType type = ShiciType.Defualt)
41 | {
42 | TargetUrl = "";
43 | switch (type)
44 | {
45 | case ShiciType.Chun:
46 | TargetUrl = BaseUrl + @"/siji/chuntian";
47 | break;
48 |
49 | case ShiciType.Xia:
50 | TargetUrl = BaseUrl + @"/siji/xiatian";
51 | break;
52 |
53 | case ShiciType.Qiu:
54 | TargetUrl = BaseUrl + @"/siji/qiutian";
55 | break;
56 |
57 | case ShiciType.Dong:
58 | TargetUrl = BaseUrl + @"/siji/dongtian";
59 | break;
60 |
61 | case ShiciType.Chunjie:
62 | TargetUrl = BaseUrl + @"/jieri/chunjie";
63 | break;
64 |
65 | case ShiciType.Yuanxiaojie:
66 | TargetUrl = BaseUrl + @"/jieri/yuanxiaojie";
67 | break;
68 |
69 | case ShiciType.Hanshijie:
70 | TargetUrl = BaseUrl + @"/jieri/hanshijie";
71 | break;
72 |
73 | case ShiciType.Qingmingjie:
74 | TargetUrl = BaseUrl + @"/jieri/qingmingjie";
75 | break;
76 |
77 | case ShiciType.Duanwujie:
78 | TargetUrl = BaseUrl + @"/jieri/duanwujie";
79 | break;
80 |
81 | case ShiciType.Qixijie:
82 | TargetUrl = BaseUrl + @"/jieri/qixijie";
83 | break;
84 |
85 | case ShiciType.Zhongqiujie:
86 | TargetUrl = BaseUrl + @"/jieri/zhongqiujie";
87 | break;
88 |
89 | case ShiciType.Chongyangjie:
90 | TargetUrl = BaseUrl + @"/jieri/chongyangjie";
91 | break;
92 |
93 | default:
94 | TargetUrl = BaseUrl + @"/all";
95 | break;
96 | }
97 |
98 | string jsonString = httpRequestHelper.HttpGet(TargetUrl, "");
99 | ShiciContentModel model = JsonConvert.DeserializeObject(jsonString);
100 |
101 | return model;
102 | }
103 | }
104 | }
--------------------------------------------------------------------------------
/WubiMaster/Common/YamlHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Text.Unicode;
7 | using System.Threading.Tasks;
8 | using System.Windows.Shapes;
9 | using YamlDotNet.Serialization;
10 | using YamlDotNet.Serialization.NamingConventions;
11 |
12 | namespace WubiMaster.Common
13 | {
14 | public static class YamlHelper
15 | {
16 | private static IDeserializer _deserializer;
17 | private static IDeserializer _jsondeserializer;
18 | private static ISerializer _jsonserializer;
19 | private static ISerializer _serializer;
20 |
21 | static YamlHelper()
22 | {
23 | _serializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();
24 | _deserializer = new DeserializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance).Build();
25 | _jsondeserializer = new DeserializerBuilder().Build();
26 | _jsonserializer = new SerializerBuilder().JsonCompatible().Build();
27 | }
28 |
29 | public static T DeserializeFromFile(string filePath)
30 | {
31 | var yaml = File.ReadAllText(filePath, Encoding.UTF8);
32 | return Deserizlize(yaml);
33 | }
34 |
35 | public static T Deserizlize(string yaml)
36 | {
37 | return _deserializer.Deserialize(yaml);
38 | }
39 |
40 | public static string Serialize(object target)
41 | {
42 | return _serializer.Serialize(target);
43 | }
44 |
45 | public static void SerizlizerToFile(object target, string filePath)
46 | {
47 | var content = Serialize(target);
48 | File.WriteAllText(filePath, content, Encoding.UTF8);
49 | }
50 |
51 | public static void WriteYaml(object target, string filePath)
52 | {
53 | StreamWriter yamlWriter = File.CreateText(filePath);
54 |
55 | Serializer yamlSerializer = new Serializer();
56 | yamlSerializer.Serialize(yamlWriter, target);
57 | yamlWriter.Close();
58 |
59 | StringBuilder YamlHeaderStr = new StringBuilder();
60 | YamlHeaderStr.Append("# Rime settings\n");
61 | YamlHeaderStr.Append("# encoding: utf-8\n");
62 | YamlHeaderStr.Append("# author: 空山明月\n");
63 | YamlHeaderStr.Append("# modify: 中书君\n");
64 | YamlHeaderStr.Append("# time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n");
65 |
66 | string[] yamlText = File.ReadAllLines(filePath);
67 | List _list = yamlText.ToList();
68 | _list.Insert(0, YamlHeaderStr.ToString());
69 | File.WriteAllLines(filePath, _list.ToArray(), encoding: Encoding.UTF8);
70 | }
71 |
72 | public static string YamlToJson(string yaml)
73 | {
74 | var yamlObject = _jsondeserializer.Deserialize(yaml);
75 | var json = _jsonserializer.Serialize(yamlObject);
76 |
77 | return json;
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/WubiMaster/Common/ZipHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.IO.Compression;
7 | using System.IO;
8 |
9 | namespace WubiMaster.Common
10 | {
11 | public class ZipHelper
12 | {
13 | ///
14 | /// 将指定目录压缩为Zip文件
15 | ///
16 | /// 文件夹地址 D:/1/
17 | /// zip地址 D:/1.zip
18 | public static void CompressDirectoryZip(string folderPath, string zipPath)
19 | {
20 | DirectoryInfo directoryInfo = new(zipPath);
21 |
22 | if (directoryInfo.Parent != null)
23 | {
24 | directoryInfo = directoryInfo.Parent;
25 | }
26 |
27 | if (!directoryInfo.Exists)
28 | {
29 | directoryInfo.Create();
30 | }
31 |
32 | ZipFile.CreateFromDirectory(folderPath, zipPath, CompressionLevel.Optimal, false);
33 | }
34 |
35 | ///
36 | /// 将指定文件压缩为Zip文件
37 | ///
38 | /// 文件地址 D:/1.txt
39 | /// zip地址 D:/1.zip
40 | public static void CompressFileZip(string filePath, string zipPath)
41 | {
42 |
43 | FileInfo fileInfo = new FileInfo(filePath);
44 | string dirPath = fileInfo.DirectoryName?.Replace("\\", "/") + "/";
45 | string tempPath = dirPath + Guid.NewGuid() + "_temp/";
46 | if (!Directory.Exists(tempPath))
47 | {
48 | Directory.CreateDirectory(tempPath);
49 | }
50 | fileInfo.CopyTo(tempPath + fileInfo.Name);
51 | CompressDirectoryZip(tempPath, zipPath);
52 | DirectoryInfo directory = new(tempPath);
53 | if (directory.Exists)
54 | {
55 | //将文件夹属性设置为普通,如:只读文件夹设置为普通
56 | directory.Attributes = FileAttributes.Normal;
57 |
58 | directory.Delete(true);
59 | }
60 | }
61 |
62 | ///
63 | /// 解压Zip文件到指定目录
64 | ///
65 | /// zip地址 D:/1.zip
66 | /// 文件夹地址 D:/1/
67 | public static void DecompressZip(string zipPath, string folderPath, bool overwrite=true)
68 | {
69 | DirectoryInfo directoryInfo = new(folderPath);
70 |
71 | if (!directoryInfo.Exists)
72 | {
73 | directoryInfo.Create();
74 | }
75 |
76 | ZipFile.ExtractToDirectory(zipPath, folderPath, overwrite);
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/WubiMaster/Controls/CancelButton.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
61 |
62 |
63 |
70 |
71 |
--------------------------------------------------------------------------------
/WubiMaster/Controls/CancelButton.xaml.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.Input;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Media;
5 |
6 | namespace WubiMaster.Controls
7 | {
8 | public partial class CancelButton : UserControl
9 | {
10 | public CancelButton()
11 | {
12 | InitializeComponent();
13 | }
14 |
15 | public Brush CBBorderBrush
16 | {
17 | get { return (Brush)GetValue(CBBorderBrushProperty); }
18 | set { SetValue(CBBorderBrushProperty, value); }
19 | }
20 |
21 | public static readonly DependencyProperty CBBorderBrushProperty =
22 | DependencyProperty.Register("CBBorderBrush", typeof(Brush), typeof(CancelButton));
23 |
24 | public Thickness CBBorderThinckness
25 | {
26 | get { return (Thickness)GetValue(CBBorderThincknessProperty); }
27 | set { SetValue(CBBorderThincknessProperty, value); }
28 | }
29 |
30 | public static readonly DependencyProperty CBBorderThincknessProperty =
31 | DependencyProperty.Register("CBBorderThinckness", typeof(Thickness), typeof(CancelButton));
32 |
33 | public Brush CBBackground
34 | {
35 | get { return (Brush)GetValue(CBBackgroundProperty); }
36 | set { SetValue(CBBackgroundProperty, value); }
37 | }
38 |
39 | public static readonly DependencyProperty CBBackgroundProperty =
40 | DependencyProperty.Register("CBBackground", typeof(Brush), typeof(CancelButton));
41 |
42 | public Brush CBForeground
43 | {
44 | get { return (Brush)GetValue(CBForegroundProperty); }
45 | set { SetValue(CBForegroundProperty, value); }
46 | }
47 |
48 | public static readonly DependencyProperty CBForegroundProperty =
49 | DependencyProperty.Register("CBForeground", typeof(Brush), typeof(CancelButton));
50 |
51 | public RelayCommand