diff --git a/STranslate/App.config b/STranslate/App.config
index ca88a2c..04fcaeb 100644
--- a/STranslate/App.config
+++ b/STranslate/App.config
@@ -1,6 +1,6 @@
-
+
-
+
-
\ No newline at end of file
+
diff --git a/STranslate/App.xaml b/STranslate/App.xaml
index 91f1640..3c9c4b5 100644
--- a/STranslate/App.xaml
+++ b/STranslate/App.xaml
@@ -3,11 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/STranslate/MainWindow.xaml b/STranslate/MainWindow.xaml
index fb9de5d..4aae442 100644
--- a/STranslate/MainWindow.xaml
+++ b/STranslate/MainWindow.xaml
@@ -5,7 +5,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:STranslate.ViewModel"
xmlns:model="clr-namespace:STranslate.Model"
- xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="Transparent"
WindowStartupLocation="CenterScreen"
@@ -91,11 +90,6 @@
BorderThickness="0"
Command="{Binding CopyInputCmd}">
-
-
-
-
-
@@ -134,7 +127,6 @@
BorderThickness="0" />
@@ -152,20 +144,19 @@
Margin="5"
Height="{Binding ElementName=Output, Path=Height}">
-
+
@@ -180,11 +171,6 @@
Visibility="{Binding OutputTxt,Converter={StaticResource String2VisibilityConverter}}"
Command="{Binding CopyResultCmd}">
-
-
-
-
-
diff --git a/STranslate/MainWindow.xaml.cs b/STranslate/MainWindow.xaml.cs
index ee3c49a..d9573a7 100644
--- a/STranslate/MainWindow.xaml.cs
+++ b/STranslate/MainWindow.xaml.cs
@@ -15,8 +15,6 @@ namespace STranslate
public partial class MainWindow : Window
{
private MainVM vm;
-
- private Process process = new Process();
public MainWindow()
{
InitializeComponent();
@@ -27,8 +25,6 @@ namespace STranslate
InitialTray();
- DeepLStart();
-
//if (HotKeys.InputTranslate.Conflict || HotKeys.CrosswordTranslate.Conflict || HotKeys.ScreenShotTranslate.Conflict)
//{
// MessageBox.Show("全局快捷键有冲突,请您到设置中重新设置");
@@ -37,8 +33,6 @@ namespace STranslate
private void InitialTray()
{
- //notifyIcon.BalloonTipText = "STranslate已运行";
- //notifyIcon.ShowBalloonTip(1000);
notifyIcon.Text = "STranslate";
notifyIcon.Icon = new System.Drawing.Icon(System.Windows.Application.GetResourceStream(new Uri("Images/translate.ico", UriKind.Relative)).Stream);
notifyIcon.Visible = true;
@@ -240,7 +234,7 @@ namespace STranslate
///
private void ScreenshotTranslateMenuItem_Click(object sender, EventArgs e)
{
- HandyControl.Controls.MessageBox.Show("开发中");
+ MessageBox.Show("开发中");
}
///
@@ -261,7 +255,6 @@ namespace STranslate
{
notifyIcon.Dispose();
- DeepLStop();
Environment.Exit(0);
}
private void InitView()
@@ -274,30 +267,5 @@ namespace STranslate
private BitmapImage LockImgPath = new BitmapImage(new Uri("pack://application:,,,/Images/lock3.png"));
private BitmapImage UnLockImgPath = new BitmapImage(new Uri("pack://application:,,,/Images/unlock3.png"));
private System.Windows.Forms.NotifyIcon notifyIcon = new System.Windows.Forms.NotifyIcon();
- ///
- /// 新进程开启DeepL
- ///
- private void DeepLStart()
- {
- if (!string.IsNullOrEmpty(vm.config.deepl?.url) && vm.config.deepl?.url != vm.defaultApi) return;
- string strPathExe = AppDomain.CurrentDomain.BaseDirectory + "\\Static\\deepl-x86_64-pc-windows-gnu.exe";
- process.StartInfo.FileName = strPathExe;
- process.StartInfo.Arguments = null;//-s -t 可以用来关机、开机或重启
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.RedirectStandardInput = false; //true
- process.StartInfo.RedirectStandardOutput = false; //true
- process.StartInfo.RedirectStandardError = false;
- process.StartInfo.CreateNoWindow = true;
- process.Start();//启动
- }
-
- ///
- /// 关闭DeepL进程
- ///
- private void DeepLStop()
- {
- if (!string.IsNullOrEmpty(vm.config.deepl?.url) && vm.config.deepl?.url != vm.defaultApi) return;
- process.Kill();//等待退出。
- }
}
}
\ No newline at end of file
diff --git a/STranslate/Properties/Resources.Designer.cs b/STranslate/Properties/Resources.Designer.cs
index c691968..9ab0253 100644
--- a/STranslate/Properties/Resources.Designer.cs
+++ b/STranslate/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace STranslate.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/STranslate/Properties/Settings.Designer.cs b/STranslate/Properties/Settings.Designer.cs
index 98cf851..39fccf4 100644
--- a/STranslate/Properties/Settings.Designer.cs
+++ b/STranslate/Properties/Settings.Designer.cs
@@ -1,27 +1,24 @@
//------------------------------------------------------------------------------
//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
//
//------------------------------------------------------------------------------
-
-namespace STranslate.Properties
-{
+namespace STranslate.Properties {
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
diff --git a/STranslate/STranslate.csproj b/STranslate/STranslate.csproj
index 12596cd..eff20bd 100644
--- a/STranslate/STranslate.csproj
+++ b/STranslate/STranslate.csproj
@@ -29,9 +29,10 @@
false
false
true
+
- x64
+ AnyCPU
true
full
false
@@ -42,21 +43,19 @@
false
- x64
+ AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
+ false
Images\translate.ico
-
- ..\packages\HandyControl.3.4.0\lib\net48\HandyControl.dll
-
..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll
@@ -77,9 +76,6 @@
-
- ..\packages\YamlDotNet.12.2.1\lib\net47\YamlDotNet.dll
-
@@ -92,7 +88,6 @@
True
Resources.resx
-
@@ -168,12 +163,6 @@
PreserveNewest
-
- PreserveNewest
-
-
- PreserveNewest
-
diff --git a/STranslate/STranslate.yml b/STranslate/STranslate.yml
deleted file mode 100644
index e6474ad..0000000
--- a/STranslate/STranslate.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-service: deepl
-baidu:
- appid:
- secretKey:
-deepl:
- url: https://zggsong.cn/tt
diff --git a/STranslate/Static/deepl-x86_64-pc-windows-gnu.exe b/STranslate/Static/deepl-x86_64-pc-windows-gnu.exe
deleted file mode 100644
index a7bb677..0000000
Binary files a/STranslate/Static/deepl-x86_64-pc-windows-gnu.exe and /dev/null differ
diff --git a/STranslate/Utils/ConfigUtil.cs b/STranslate/Utils/ConfigUtil.cs
deleted file mode 100644
index 720a019..0000000
--- a/STranslate/Utils/ConfigUtil.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using STranslate.Model;
-using System;
-using System.IO;
-using YamlDotNet.Serialization;
-
-namespace STranslate.Utils
-{
- public class ConfigUtil
- {
- public static ConfigModel ReadConfig(string path)
- {
- using (TextReader reader = File.OpenText(path))
- {
- try
- {
- var config = new ConfigModel();
- var deserializer = new Deserializer();
- config = deserializer.Deserialize(reader);
- return config;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- }
-
- public static void WriteConfig(string path, ConfigModel configs)
- {
- var serializer = new Serializer();
- StringWriter strWriter = new StringWriter();
-
- serializer.Serialize(strWriter, configs);
- serializer.Serialize(Console.Out, configs);
-
- using (TextWriter writer = File.CreateText(path))
- {
- writer.Write(strWriter.ToString());
- }
- }
- }
-}
\ No newline at end of file
diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs
index bbc4d1c..2a456b4 100644
--- a/STranslate/ViewModel/MainVM.cs
+++ b/STranslate/ViewModel/MainVM.cs
@@ -18,24 +18,17 @@ namespace STranslate.ViewModel
//[System.Runtime.InteropServices.DllImport("deepl.dll", EntryPoint = "run")]
//extern static void run();
- public string defaultApi = "http://127.0.0.1:8000/translate"; //https://deepl.deno.dev/translate
- private string ConfigPath => $"{AppDomain.CurrentDomain.BaseDirectory}STranslate.yml";
- public ConfigModel config = new ConfigModel();
+ public string defaultApi = "https://zggsong.cn/tt"; //https://deepl.deno.dev/translate、https://zggsong.cn/tt、http://127.0.0.1:8000/translate
private static Dictionary LanguageEnumDict { get => TranslateUtil.GetEnumList(); }
public MainVM()
{
- //启动deepl
- //Task.Run(() => RunCmdUtil.RunCmd(AppDomain.CurrentDomain.BaseDirectory + "\\deepl-x86_64-pc-windows-gnu.exe"));
-
//初始化界面参数
InputCombo = LanguageEnumDict.Keys.ToList();
InputComboSelected = LanguageEnum.AUTO.GetDescription();
OutputCombo = LanguageEnumDict.Keys.ToList();
OutputComboSelected = LanguageEnum.AUTO.GetDescription();
- config = ConfigUtil.ReadConfig(ConfigPath);
-
//复制输入
CopyInputCmd = new RelayCommand((_) => true, (_) =>
{
@@ -109,11 +102,11 @@ namespace STranslate.ViewModel
{
var autoRet = AutomaticLanguageRecognition(InputTxt);
IdentifyLanguage = autoRet.Item1;
- translateResp = await TranslateUtil.TranslateDeepLAsync(config.deepl?.url ?? defaultApi, InputTxt, LanguageEnumDict[autoRet.Item2], LanguageEnumDict[InputComboSelected]);
+ translateResp = await TranslateUtil.TranslateDeepLAsync(defaultApi, InputTxt, LanguageEnumDict[autoRet.Item2], LanguageEnumDict[InputComboSelected]);
}
else
{
- translateResp = await TranslateUtil.TranslateDeepLAsync(config.deepl?.url ?? defaultApi, InputTxt, LanguageEnumDict[OutputComboSelected], LanguageEnumDict[InputComboSelected]);
+ translateResp = await TranslateUtil.TranslateDeepLAsync(defaultApi, InputTxt, LanguageEnumDict[OutputComboSelected], LanguageEnumDict[InputComboSelected]);
}
//百度 Api
diff --git a/STranslate/packages.config b/STranslate/packages.config
index 78498af..4de699c 100644
--- a/STranslate/packages.config
+++ b/STranslate/packages.config
@@ -1,6 +1,4 @@
-
-
-
+
\ No newline at end of file