66using System . Linq ;
77using System . Windows ;
88using System . Windows . Documents ;
9- using Flow . Launcher . Helper ;
109using Flow . Launcher . Infrastructure ;
1110using Flow . Launcher . Infrastructure . Logger ;
1211using Flow . Launcher . Plugin . SharedCommands ;
12+ using Flow . Launcher . Infrastructure . Exception ;
1313
1414namespace Flow . Launcher
1515{
@@ -43,32 +43,36 @@ private void SetException(Exception exception)
4343 var log = directory . GetFiles ( ) . OrderByDescending ( f => f . LastWriteTime ) . First ( ) ;
4444
4545 var websiteUrl = exception switch
46- {
47- FlowPluginException pluginException => GetIssuesUrl ( pluginException . Metadata . Website ) ,
48- _ => Constant . IssuesUrl
49- } ;
50-
46+ {
47+ FlowPluginException pluginException => GetIssuesUrl ( pluginException . Metadata . Website ) ,
48+ _ => Constant . IssuesUrl
49+ } ;
5150
52- var paragraph = Hyperlink ( "Please open new issue in: " , websiteUrl ) ;
53- paragraph . Inlines . Add ( $ "1. upload log file: { log . FullName } \n ") ;
54- paragraph . Inlines . Add ( $ "2. copy below exception message") ;
51+ var paragraph = Hyperlink ( App . API . GetTranslation ( "reportWindow_please_open_issue" ) , websiteUrl ) ;
52+ paragraph . Inlines . Add ( string . Format ( App . API . GetTranslation ( "reportWindow_upload_log" ) , log . FullName ) ) ;
53+ paragraph . Inlines . Add ( "\n " ) ;
54+ paragraph . Inlines . Add ( App . API . GetTranslation ( "reportWindow_copy_below" ) ) ;
5555 ErrorTextbox . Document . Blocks . Add ( paragraph ) ;
5656
5757 StringBuilder content = new StringBuilder ( ) ;
58- content . AppendLine ( ErrorReporting . RuntimeInfo ( ) ) ;
59- content . AppendLine ( ErrorReporting . DependenciesInfo ( ) ) ;
60- content . AppendLine ( $ "Date: { DateTime . Now . ToString ( CultureInfo . InvariantCulture ) } ") ;
61- content . AppendLine ( "Exception:" ) ;
58+ content . AppendLine ( RuntimeInfo ( ) ) ;
59+ content . AppendLine ( ) ;
60+ content . AppendLine ( DependenciesInfo ( ) ) ;
61+ content . AppendLine ( ) ;
62+ content . AppendLine ( string . Format ( App . API . GetTranslation ( "reportWindow_date" ) , DateTime . Now . ToString ( CultureInfo . InvariantCulture ) ) ) ;
63+ content . AppendLine ( App . API . GetTranslation ( "reportWindow_exception" ) ) ;
6264 content . AppendLine ( exception . ToString ( ) ) ;
6365 paragraph = new Paragraph ( ) ;
6466 paragraph . Inlines . Add ( content . ToString ( ) ) ;
6567 ErrorTextbox . Document . Blocks . Add ( paragraph ) ;
6668 }
6769
68- private Paragraph Hyperlink ( string textBeforeUrl , string url )
70+ private static Paragraph Hyperlink ( string textBeforeUrl , string url )
6971 {
70- var paragraph = new Paragraph ( ) ;
71- paragraph . Margin = new Thickness ( 0 ) ;
72+ var paragraph = new Paragraph
73+ {
74+ Margin = new Thickness ( 0 )
75+ } ;
7276
7377 var link = new Hyperlink
7478 {
@@ -79,10 +83,38 @@ private Paragraph Hyperlink(string textBeforeUrl, string url)
7983 link . Click += ( s , e ) => SearchWeb . OpenInBrowserTab ( url ) ;
8084
8185 paragraph . Inlines . Add ( textBeforeUrl ) ;
86+ paragraph . Inlines . Add ( " " ) ;
8287 paragraph . Inlines . Add ( link ) ;
8388 paragraph . Inlines . Add ( "\n " ) ;
8489
8590 return paragraph ;
8691 }
92+
93+ private void BtnCancel_OnClick ( object sender , RoutedEventArgs e )
94+ {
95+ Close ( ) ;
96+ }
97+
98+ private static string RuntimeInfo ( )
99+ {
100+ var info =
101+ $ """
102+ Flow Launcher { App . API . GetTranslation ( "reportWindow_version" ) } : { Constant . Version }
103+ OS { App . API . GetTranslation ( "reportWindow_version" ) } : { ExceptionFormatter . GetWindowsFullVersionFromRegistry ( ) }
104+ IntPtr { App . API . GetTranslation ( "reportWindow_length" ) } : { IntPtr . Size }
105+ x64: { Environment . Is64BitOperatingSystem }
106+ """ ;
107+ return info ;
108+ }
109+
110+ private static string DependenciesInfo ( )
111+ {
112+ var info =
113+ $ """
114+ { App . API . GetTranslation ( "pythonFilePath" ) } : { Constant . PythonPath }
115+ { App . API . GetTranslation ( "nodeFilePath" ) } : { Constant . NodePath }
116+ """ ;
117+ return info ;
118+ }
87119 }
88120}
0 commit comments