diff --git a/src/AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction.cs b/src/AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction.cs index 924f136..4149d67 100644 --- a/src/AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction.cs +++ b/src/AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction.cs @@ -18,7 +18,6 @@ namespace WpfApp2 TranslationApiInt trint = new translationPublic(); TranslationScnToJson scnjson = new TranslationScnToJson(); Messiah jsonnet = new jsonNet(); - TempResource temp = new TempResource(); public void InputPrivateBaidu(string name, string id, string key) @@ -31,6 +30,16 @@ namespace WpfApp2 trin.InPutPrivate(name, list); } + public bool OutExistsD() + { + return trstr.GetExistsD(); + } + + public bool OutExistsF(string name) + { + return trstr.GetExistsF(name); + } + public List OutputNameList() { List list = trstr.OutputTranslationNameList(); @@ -114,6 +123,11 @@ namespace WpfApp2 temp.TempDstSet(dst); } + public void SetChoic(string choic) + { + temp.TempChoicSet(choic); + } + public string GetId() { return temp.TempIdGet(); @@ -139,97 +153,15 @@ namespace WpfApp2 return temp.TempDstGet(); } - - //再转为语音,在多几个接口 - - } -} -/* -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace OCRConsoleApp -{ - class Program - { - static void Main(string[] args) - { - using IHost host = CreateHostBuilder(args).Build(); - - var ocrService = host.Services.GetRequiredService(); - - // 截图并保存到本地文件 - var bitmap = ocrService.CaptureScreen(); - bitmap.Save("screenshot.png", ImageFormat.Png); - - // 识别图片中的文字 - var text = ocrService.RecognizeText(bitmap); - - Console.WriteLine(text); - } - - private static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureLogging(logging => - { - logging.ClearProviders(); - logging.AddConsole(); - }) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - services.AddSingleton(new OcrService()); - }); - } - - public interface IOcrService - { - Bitmap CaptureScreen(); - string RecognizeText(Bitmap bitmap); - } - - public class OcrService : IOcrService - { - public Bitmap CaptureScreen() + public string GetChoic() { - var screenBounds = ScreenHelper.GetScreenBounds(); - var bitmap = new Bitmap(screenBounds.Width, screenBounds.Height); - - using (var graphics = Graphics.FromImage(bitmap)) - graphics.CopyFromScreen(screenBounds.X, screenBounds.Y, 0, 0, screenBounds.Size); - - return bitmap; + return temp.TempChoicGet(); } - public string RecognizeText(Bitmap bitmap) - { - var ocrEngine = new IronOcr.AutoOcr(); - - var result = ocrEngine.Read(bitmap); - - return result.Text; - } - } - public static class ScreenHelper - { - [System.Runtime.InteropServices.DllImport("user32.dll")] - private static extern bool GetCursorPos(out Point lpPoint); + - public static Rectangle GetScreenBounds() - { - GetCursorPos(out Point point); - - var screenBounds = Screen.FromPoint(point).Bounds; - - return screenBounds; - } } } - */ + diff --git a/src/Network/GrapeToJsonTrans.cs b/src/Network/GrapeToJsonTrans.cs index fad3531..ae55b99 100644 --- a/src/Network/GrapeToJsonTrans.cs +++ b/src/Network/GrapeToJsonTrans.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace WpfApp1.transToNet +namespace WpfApp2.transToNet { /* internal class GrapeToJsonTrans : GrapeToJson diff --git a/src/Network/TransNetworkApi.cs b/src/Network/TransNetworkApi.cs index 62455f5..a5fbf33 100644 --- a/src/Network/TransNetworkApi.cs +++ b/src/Network/TransNetworkApi.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace WpfApp1.transToNet +namespace WpfApp2.transToNet { interface Messiah { @@ -14,10 +14,10 @@ namespace WpfApp1.transToNet public abstract string RequestJsonBaiDu(string input); - - //以下接口暂时废弃 public abstract string RequestJsonXunFei(string input); + public abstract string RequestJsonPrivateXunFei(string input, string srcl, string dstl, string xid, string xsecret, string xkey); + public abstract string RequestJsonLanguageChangeXunFei(string input, string srcl, string dstl); } diff --git a/src/Network/jsonNet.cs b/src/Network/jsonNet.cs index 6750d25..c34f381 100644 --- a/src/Network/jsonNet.cs +++ b/src/Network/jsonNet.cs @@ -1,8 +1,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Stripe.Terminal; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -14,7 +14,7 @@ using System.Text; using System.Threading.Tasks; using System.Web; -namespace WpfApp1.transToNet +namespace WpfApp2.transToNet { internal class jsonNet : Messiah { diff --git a/src/ScnToJson/TranslationScnToJson.cs b/src/ScnToJson/TranslationScnToJson.cs index a997f27..d16e562 100644 --- a/src/ScnToJson/TranslationScnToJson.cs +++ b/src/ScnToJson/TranslationScnToJson.cs @@ -1,6 +1,7 @@ using System.Diagnostics; +using System.IO; -namespace WpfApp1.ScnToJson +namespace WpfApp2.ScnToJson { internal class TranslationScnToJson { @@ -33,7 +34,7 @@ namespace WpfApp1.ScnToJson public void DirExsis(string id) { - if(Directory.Exists(Directory.GetCurrentDirectory() + "\\" + id)) + if(!Directory.Exists(Directory.GetCurrentDirectory() + "\\" + id)) { Directory.CreateDirectory(Directory.GetCurrentDirectory() + "\\" + id); } diff --git a/src/WindowsSEL/ErrorIn.xaml b/src/WindowsSEL/ErrorIn.xaml new file mode 100644 index 0000000..720b3a1 --- /dev/null +++ b/src/WindowsSEL/ErrorIn.xaml @@ -0,0 +1,14 @@ + + +