Fixed the bugs of NullReference

Signed-off-by: Miyu Kawaii <trigger114514xx@gmail.com>
CHL
Miyu Kawaii 1 year ago
parent 6960a0e9a9
commit 73a1a183f5

Binary file not shown.

@ -22,6 +22,7 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Speech" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

@ -11,6 +11,7 @@
"CommunityToolkit.Mvvm": "8.2.1",
"Newtonsoft.Json": "13.0.3",
"System.Drawing.Common": "7.0.0",
"System.Speech": "7.0.0",
"runtimepack.Microsoft.Windows.SDK.NET.Ref": "10.0.19041.29"
},
"runtime": {
@ -79,6 +80,22 @@
"fileVersion": "7.0.22.51805"
}
}
},
"System.Speech/7.0.0": {
"runtime": {
"lib/net6.0/System.Speech.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "7.0.22.51805"
}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/System.Speech.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
}
}
},
@ -120,6 +137,13 @@
"sha512": "sha512-KIX+oBU38pxkKPxvLcLfIkOV5Ien8ReN78wro7OF5/erwcmortzeFx+iBswlh2Vz6gVne0khocQudGwaO1Ey6A==",
"path": "system.drawing.common/7.0.0",
"hashPath": "system.drawing.common.7.0.0.nupkg.sha512"
},
"System.Speech/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7E0uB92Cx2sXR67HW9rMKJqDACdLuz9t3I3OwZUFDzAgwKXWuY6CYeRT/NiypHcyZO2be9+0H0w0M6fn7HQtgQ==",
"path": "system.speech/7.0.0",
"hashPath": "system.speech.7.0.0.nupkg.sha512"
}
}
}

@ -12,7 +12,7 @@ public class TreeViewLoaded
var fileItemList = new ObservableCollection<FileItem>();
var files = Directory.GetFiles(path);
var getPath = Directory.GetParent(path)!.FullName;
FileItem parentItem = new FileItem()
var parentItem = new FileItem()
{
Name = "...",
path = getPath,
@ -22,7 +22,7 @@ public class TreeViewLoaded
fileItemList.Add(parentItem);
foreach (var item in directories)
{
FileItem fileItem = new FileItem()
var fileItem = new FileItem()
{
Name = Path.GetFileName(item),
path = item,
@ -35,7 +35,7 @@ public class TreeViewLoaded
{
if (Path.GetExtension(item) == ".json")
{
FileItem fileItem = new FileItem()
var fileItem = new FileItem()
{
Name = Path.GetFileNameWithoutExtension(item) +Path.GetExtension(item),
path = item,

@ -14,4 +14,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = TstTranslator
build_property.ProjectDir = E:\Works\software636\src\TstTranslator\TstTranslator\
build_property.ProjectDir = E:\NonsBot\WpfApp2\TstTranslator\

@ -1 +1 @@
794a248daaff8260c78947f550b941a5917d124b
3a5d2c0512c5c3e9a436558feaf7c5f8c9b84679

@ -92,3 +92,52 @@ E:\Works\software636\src\TstTranslator\TstTranslator\obj\Debug\net6.0-windows10.
E:\Works\software636\src\TstTranslator\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.pdb
E:\Works\software636\src\TstTranslator\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.genruntimeconfig.cache
E:\Works\software636\src\TstTranslator\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\ref\TstTranslator.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\TstTranslator.exe
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\TstTranslator.deps.json
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\TstTranslator.runtimeconfig.json
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\TstTranslator.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\TstTranslator.pdb
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\CommunityToolkit.Mvvm.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\Microsoft.Win32.SystemEvents.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\Newtonsoft.Json.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\System.Drawing.Common.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\System.Speech.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\runtimes\win\lib\net6.0\Microsoft.Win32.SystemEvents.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\runtimes\win\lib\net6.0\System.Drawing.Common.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\runtimes\win\lib\net6.0\System.Speech.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\Microsoft.Windows.SDK.NET.dll
E:\NonsBot\WpfApp2\TstTranslator\bin\Debug\net6.0-windows10.0.19041.0\WinRT.Runtime.dll
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.csproj.AssemblyReference.cache
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.csproj.ResolveComReference.cache
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\ErrorIn.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\MainWindow.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\ProgressSelect.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\ScreenshotWindow.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\SelectPriTrueWindow.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TranslationSourceSelect.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TranslationText.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TransSourceInWindow.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TransSourceSelectPri.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\App.g.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator_MarkupCompile.cache
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator_MarkupCompile.lref
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\ErrorIn.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\MainWindow.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\ProgressSelect.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\ScreenshotWindow.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\SelectPriTrueWindow.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TranslationSourceSelect.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TranslationText.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TransSourceInWindow.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\view\TransSourceSelectPri.baml
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.g.resources
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.GeneratedMSBuildEditorConfig.editorconfig
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.AssemblyInfoInputs.cache
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.AssemblyInfo.cs
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.csproj.CoreCompileInputs.cache
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.csproj.CopyComplete
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.dll
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\refint\TstTranslator.dll
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.pdb
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\TstTranslator.genruntimeconfig.cache
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\ref\TstTranslator.dll

@ -1 +1 @@
2cad0e29336813b308519dfc31f90d95d45f4df7
32a01f4a030c77885b344f24bb8abe8a641ea419

@ -4,16 +4,16 @@
winexe
C#
.cs
E:\Works\software636\src\TstTranslator\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\
E:\NonsBot\WpfApp2\TstTranslator\obj\Debug\net6.0-windows10.0.19041.0\
TstTranslator
none
false
TRACE;DEBUG;NET;NET6_0;NETCOREAPP
E:\Works\software636\src\TstTranslator\TstTranslator\App.xaml
E:\NonsBot\WpfApp2\TstTranslator\App.xaml
91120374147
31936355299
207-1824966944
32-705057768
208-1025002063
view\ErrorIn.xaml;view\MainWindow.xaml;view\ProgressSelect.xaml;view\ScreenshotWindow.xaml;view\SelectPriTrueWindow.xaml;view\TranslationSourceSelect.xaml;view\TranslationText.xaml;view\TransSourceInWindow.xaml;view\TransSourceSelectPri.xaml;
False

@ -1,12 +1,12 @@

FE:\Works\software636\src\TstTranslator\TstTranslator\view\ErrorIn.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\MainWindow.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\ProgressSelect.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\ScreenshotWindow.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\SelectPriTrueWindow.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\TranslationSourceSelect.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\TranslationText.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\TransSourceInWindow.xaml;;
FE:\Works\software636\src\TstTranslator\TstTranslator\view\TransSourceSelectPri.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\ErrorIn.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\MainWindow.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\ProgressSelect.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\ScreenshotWindow.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\SelectPriTrueWindow.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\TranslationSourceSelect.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\TranslationText.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\TransSourceInWindow.xaml;;
FE:\NonsBot\WpfApp2\TstTranslator\view\TransSourceSelectPri.xaml;;

@ -54,7 +54,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/errorin.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/errorin.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\ErrorIn.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -174,7 +174,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/mainwindow.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/mainwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\MainWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -70,7 +70,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/progressselect.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/progressselect.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\ProgressSelect.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -54,7 +54,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/screenshotwindow.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/screenshotwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\ScreenshotWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -54,7 +54,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/selectpritruewindow.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/selectpritruewindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\SelectPriTrueWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -78,7 +78,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/transsourceinwindow.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/transsourceinwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\TransSourceInWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -62,7 +62,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/transsourceselectpri.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/transsourceselectpri.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\TransSourceSelectPri.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -54,7 +54,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/translationsourceselect.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/translationsourceselect.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\TranslationSourceSelect.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\view\TranslationText.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "A43AB1B24E0882C2EF02EDF42C5171A3CE08C539"
#pragma checksum "..\..\..\..\view\TranslationText.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "050D36EB7AD9DF4F7509BB209863B4DE50A79141"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -108,6 +108,14 @@ namespace TstTranslator.view {
#line 13 "..\..\..\..\view\TranslationText.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Screenshot_trans);
#line default
#line hidden
return;
case 4:
#line 14 "..\..\..\..\view\TranslationText.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Baba_OnClick);
#line default
#line hidden
return;

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\view\TranslationText.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "A43AB1B24E0882C2EF02EDF42C5171A3CE08C539"
#pragma checksum "..\..\..\..\view\TranslationText.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "050D36EB7AD9DF4F7509BB209863B4DE50A79141"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -62,7 +62,7 @@ namespace TstTranslator.view {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/TstTranslator;V1.0.0.0;component/view/translationtext.xaml", System.UriKind.Relative);
System.Uri resourceLocater = new System.Uri("/TstTranslator;component/view/translationtext.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\view\TranslationText.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
@ -108,6 +108,14 @@ namespace TstTranslator.view {
#line 13 "..\..\..\..\view\TranslationText.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Screenshot_trans);
#line default
#line hidden
return;
case 4:
#line 14 "..\..\..\..\view\TranslationText.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Baba_OnClick);
#line default
#line hidden
return;

@ -1,17 +1,17 @@
{
"format": 1,
"restore": {
"E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj": {}
"E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj": {}
},
"projects": {
"E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj": {
"E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj",
"projectUniqueName": "E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj",
"projectName": "TstTranslator",
"projectPath": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj",
"projectPath": "E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj",
"packagesPath": "C:\\Users\\82590\\.nuget\\packages\\",
"outputPath": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\obj\\",
"outputPath": "E:\\NonsBot\\WpfApp2\\TstTranslator\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
@ -55,6 +55,10 @@
"System.Drawing.Common": {
"target": "Package",
"version": "[7.0.0, )"
},
"System.Speech": {
"target": "Package",
"version": "[7.0.0, )"
}
},
"imports": [

@ -77,6 +77,28 @@
"rid": "win"
}
}
},
"System.Speech/7.0.0": {
"type": "package",
"compile": {
"lib/net6.0/System.Speech.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/System.Speech.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/System.Speech.dll": {
"assetType": "runtime",
"rid": "win"
}
}
}
}
},
@ -209,13 +231,42 @@
"system.drawing.common.nuspec",
"useSharedDesignerContext.txt"
]
},
"System.Speech/7.0.0": {
"sha512": "7E0uB92Cx2sXR67HW9rMKJqDACdLuz9t3I3OwZUFDzAgwKXWuY6CYeRT/NiypHcyZO2be9+0H0w0M6fn7HQtgQ==",
"type": "package",
"path": "system.speech/7.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/System.Speech.targets",
"lib/net462/_._",
"lib/net6.0/System.Speech.dll",
"lib/net6.0/System.Speech.xml",
"lib/net7.0/System.Speech.dll",
"lib/net7.0/System.Speech.xml",
"lib/netstandard2.0/System.Speech.dll",
"lib/netstandard2.0/System.Speech.xml",
"runtimes/win/lib/net6.0/System.Speech.dll",
"runtimes/win/lib/net6.0/System.Speech.xml",
"runtimes/win/lib/net7.0/System.Speech.dll",
"runtimes/win/lib/net7.0/System.Speech.xml",
"system.speech.7.0.0.nupkg.sha512",
"system.speech.nuspec",
"useSharedDesignerContext.txt"
]
}
},
"projectFileDependencyGroups": {
"net6.0-windows10.0.19041": [
"CommunityToolkit.Mvvm >= 8.2.1",
"Newtonsoft.Json >= 13.0.3",
"System.Drawing.Common >= 7.0.0"
"System.Drawing.Common >= 7.0.0",
"System.Speech >= 7.0.0"
]
},
"packageFolders": {
@ -225,11 +276,11 @@
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj",
"projectUniqueName": "E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj",
"projectName": "TstTranslator",
"projectPath": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj",
"projectPath": "E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj",
"packagesPath": "C:\\Users\\82590\\.nuget\\packages\\",
"outputPath": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\obj\\",
"outputPath": "E:\\NonsBot\\WpfApp2\\TstTranslator\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
@ -273,6 +324,10 @@
"System.Drawing.Common": {
"target": "Package",
"version": "[7.0.0, )"
},
"System.Speech": {
"target": "Package",
"version": "[7.0.0, )"
}
},
"imports": [

@ -1,13 +1,14 @@
{
"version": 2,
"dgSpecHash": "C8WNnLuvEMlWIs+2xESrH2f1qqNOxkEauAUTnie1WhHMHgB9qIq+inhmfel9KsMvs30Scgjxcs/0nkv9PhNPhw==",
"dgSpecHash": "ezQW9aOnVyOhmu6eKjYSg/61ydw38yeuW0Jhsn/joDlcEvY2B3wB4qWaeHTncT7FzmANzeVJpWr8E3/H5AjSxw==",
"success": true,
"projectFilePath": "E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj",
"projectFilePath": "E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj",
"expectedPackageFiles": [
"C:\\Users\\82590\\.nuget\\packages\\communitytoolkit.mvvm\\8.2.1\\communitytoolkit.mvvm.8.2.1.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\microsoft.win32.systemevents\\7.0.0\\microsoft.win32.systemevents.7.0.0.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\newtonsoft.json\\13.0.3\\newtonsoft.json.13.0.3.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\system.drawing.common\\7.0.0\\system.drawing.common.7.0.0.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\system.speech\\7.0.0\\system.speech.7.0.0.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\microsoft.netcore.app.ref\\6.0.24\\microsoft.netcore.app.ref.6.0.24.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\microsoft.windowsdesktop.app.ref\\6.0.24\\microsoft.windowsdesktop.app.ref.6.0.24.nupkg.sha512",
"C:\\Users\\82590\\.nuget\\packages\\microsoft.aspnetcore.app.ref\\6.0.24\\microsoft.aspnetcore.app.ref.6.0.24.nupkg.sha512",

@ -1 +1 @@
"restore":{"projectUniqueName":"E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj","projectName":"TstTranslator","projectPath":"E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\TstTranslator.csproj","outputPath":"E:\\Works\\software636\\src\\TstTranslator\\TstTranslator\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net6.0-windows10.0.19041.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net6.0-windows10.0.19041":{"targetAlias":"net6.0-windows10.0.19041.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net6.0-windows10.0.19041":{"targetAlias":"net6.0-windows10.0.19041.0","dependencies":{"CommunityToolkit.Mvvm":{"target":"Package","version":"[8.2.1, )"},"Newtonsoft.Json":{"target":"Package","version":"[13.0.3, )"},"System.Drawing.Common":{"target":"Package","version":"[7.0.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"downloadDependencies":[{"name":"Microsoft.AspNetCore.App.Ref","version":"[6.0.24, 6.0.24]"},{"name":"Microsoft.NETCore.App.Host.win-x64","version":"[6.0.24, 6.0.24]"},{"name":"Microsoft.NETCore.App.Ref","version":"[6.0.24, 6.0.24]"},{"name":"Microsoft.Windows.SDK.NET.Ref","version":"[10.0.19041.29, 10.0.19041.29]"},{"name":"Microsoft.WindowsDesktop.App.Ref","version":"[6.0.24, 6.0.24]"}],"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"},"Microsoft.Windows.SDK.NET.Ref":{"privateAssets":"all"},"Microsoft.WindowsDesktop.App":{"privateAssets":"none"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\7.0.403\\RuntimeIdentifierGraph.json"}}
"restore":{"projectUniqueName":"E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj","projectName":"TstTranslator","projectPath":"E:\\NonsBot\\WpfApp2\\TstTranslator\\TstTranslator.csproj","outputPath":"E:\\NonsBot\\WpfApp2\\TstTranslator\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net6.0-windows10.0.19041.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net6.0-windows10.0.19041":{"targetAlias":"net6.0-windows10.0.19041.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net6.0-windows10.0.19041":{"targetAlias":"net6.0-windows10.0.19041.0","dependencies":{"CommunityToolkit.Mvvm":{"target":"Package","version":"[8.2.1, )"},"Newtonsoft.Json":{"target":"Package","version":"[13.0.3, )"},"System.Drawing.Common":{"target":"Package","version":"[7.0.0, )"},"System.Speech":{"target":"Package","version":"[7.0.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"downloadDependencies":[{"name":"Microsoft.AspNetCore.App.Ref","version":"[6.0.24, 6.0.24]"},{"name":"Microsoft.NETCore.App.Host.win-x64","version":"[6.0.24, 6.0.24]"},{"name":"Microsoft.NETCore.App.Ref","version":"[6.0.24, 6.0.24]"},{"name":"Microsoft.Windows.SDK.NET.Ref","version":"[10.0.19041.29, 10.0.19041.29]"},{"name":"Microsoft.WindowsDesktop.App.Ref","version":"[6.0.24, 6.0.24]"}],"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"},"Microsoft.Windows.SDK.NET.Ref":{"privateAssets":"all"},"Microsoft.WindowsDesktop.App":{"privateAssets":"none"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\7.0.403\\RuntimeIdentifierGraph.json"}}

@ -1 +1 @@
16992725125051395
16993564959856662

@ -15,7 +15,7 @@ namespace TstTranslator.tools
{
public class ConstantValues
{
public enum Language { Japanese};
public enum Language {Japanese};
}
public class OcrProgram
{

@ -12,6 +12,7 @@ using Newtonsoft.Json;
using TstTranslator.model;
using TstTranslator.tools;
using TstTranslator.viewModel;
using MessageBox = System.Windows.Forms.MessageBox;
namespace TstTranslator.view
{
@ -34,23 +35,28 @@ namespace TstTranslator.view
public MainWindow()
{
InitializeComponent();
}
//鼠标双击事件
private void TreeViewItem_DoubleClick(Object sender, MouseButtonEventArgs e)
{
var item = e.Source as System.Windows.Controls.TreeView;
var sourceObject = item!.SelectedItem as FileItem;
if (sourceObject!.IsDirectory != true)
try
{
_jsonString = File.ReadAllText(sourceObject.path);
var chara = JsonConvert.DeserializeObject<List<Charactor>>(_jsonString);
InputList.ItemsSource = chara;
var item = e.Source as System.Windows.Controls.TreeView;
var sourceObject = item!.SelectedItem as FileItem;
if (sourceObject!.IsDirectory != true)
{
_jsonString = File.ReadAllText(sourceObject.path);
var chara = JsonConvert.DeserializeObject<List<Charactor>>(_jsonString);
InputList.ItemsSource = chara;
}
else
{
ExplorerTreeView.ItemsSource = _loaded.CreateFileList(sourceObject.path);
}
}
else
catch (NullReferenceException)
{
ExplorerTreeView.ItemsSource = _loaded.CreateFileList(sourceObject.path);
var error = System.Windows.MessageBox.Show(this, "出错啦OmO","没有上层目录啦!", MessageBoxButton.OK);
}
}
private void TreeView_Loaded(object sender, RoutedEventArgs e)
@ -107,18 +113,26 @@ namespace TstTranslator.view
}
private void Translate_Click(object sender, RoutedEventArgs e)
{
_chara = JsonConvert.DeserializeObject<List<Charactor>>(_jsonString)!;
List<string> temp = new();
foreach (Charactor cha in _chara)
try
{
temp.Add(cha.message);
_chara = JsonConvert.DeserializeObject<List<Charactor>>(_jsonString)!;
List<string> temp = new();
foreach (Charactor cha in _chara)
{
temp.Add(cha.message);
}
var c = String.Join("\r", temp);
var result = _a.NetBaiDu(c, _chara);
_outPutList = JsonConvert.DeserializeObject<List<Charactor>>(result)!;
Outpulist.ItemsSource = _outPut;
_editorViewModel.Charactor = _outPutList;
_editorViewModel.SaveJsonToFile(_savePath, _editorViewModel.Charactor);
}
catch (NullReferenceException)
{
var error = System.Windows.MessageBox.Show(this, "出错啦OmO","请加载文件后再翻译", MessageBoxButton.OK);
}
var c = String.Join("\r", temp);
var result = _a.NetBaiDu(c, _chara);
_outPutList = JsonConvert.DeserializeObject<List<Charactor>>(result)!;
Outpulist.ItemsSource = _outPut;
_editorViewModel.Charactor = _outPutList;
_editorViewModel.SaveJsonToFile(_savePath, _editorViewModel.Charactor);
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)

@ -11,6 +11,7 @@
<Grid>
<CheckBox Content="自动翻译" x:Name="AutoTranslate" HorizontalAlignment="Left" Margin="88,10,0,0" VerticalAlignment="Top" IsChecked="False" Unchecked="AutoTranslate_Unchecked" Checked="CheckBox_Checked"/>
<Button Content="翻译" HorizontalAlignment="Left" Margin="20,8,0,0" VerticalAlignment="Top" Click="Screenshot_trans" Width="53"/>
<Button Content="👆👇" HorizontalAlignment="Left" Margin="200,8,0,0" VerticalAlignment="Top" Click="Baba_OnClick" Width="53"/>
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding TransResult}" VerticalAlignment="Top" Height="198" Width="560" Margin="0,55,0,0"/>
</Grid>
</Window>

@ -2,6 +2,7 @@
using System.Drawing;
using System.Windows;
using System.Windows.Threading;
using TstTranslator.model;
using TstTranslator.tools;
using TstTranslator.viewModel;
@ -17,6 +18,7 @@ namespace TstTranslator.view
private readonly OcrProgram program = new(0);
private readonly TranslationViewModel viewModel;
private readonly ScreenshotWindow w = new();
private readonly Speech s = new();
private DispatcherTimer timer = new DispatcherTimer();
private Bitmap LastOcrBitmap { get; set; } = new Bitmap(100, 100);
private string transResult = "";
@ -48,22 +50,36 @@ namespace TstTranslator.view
private async void Screenshot_trans(object sender, RoutedEventArgs e)
{
var bitmap = w.TakeScreenshot();
var ocrResult = await program.TextRecognizeAsync(bitmap);
transResult = a.NetBaiDu(ocrResult);
viewModel.TransResult = transResult;
try
{
var ocrResult = await program.TextRecognizeAsync(bitmap);
transResult = a.NetBaiDu(ocrResult);
viewModel.TransResult = transResult;
}
catch (NullReferenceException)
{
var error = MessageBox.Show(this, "出错啦OmO","请选择有文字的区域", MessageBoxButton.OK);
}
}
private async void Timer_tick(object sender, EventArgs e)
{
var image = w.TakeScreenshot();
if (!image.Equals(LastOcrBitmap))
try
{
var ocrResult = await program.TextRecognizeAsync(image);
transResult = a.NetBaiDu(ocrResult);
viewModel.TransResult = transResult;
if (!image.Equals(LastOcrBitmap))
{
var ocrResult = await program.TextRecognizeAsync(image);
transResult = a.NetBaiDu(ocrResult);
viewModel.TransResult = transResult;
}
LastOcrBitmap = image;
}
catch (NullReferenceException)
{
AutoTranslate.IsChecked = false;
var error = MessageBox.Show(this, "出错啦OmO","请选择有文字的区域", MessageBoxButton.OK);
}
LastOcrBitmap = image;
}
private void AutoTranslate_Unchecked(object sender, RoutedEventArgs e)
{
if (AutoTranslate.IsChecked == false)
@ -71,5 +87,10 @@ namespace TstTranslator.view
timer.Stop();
}
}
private void Baba_OnClick(object sender, RoutedEventArgs e)
{
s.Talking();
}
}
}

Loading…
Cancel
Save