@@ -33,16 +33,14 @@ internal ExportManager(KeyInfo keyInfo)
3333 /// <param name="content">The content that should be stored in the file</param>
3434 private static void Export ( string path , string content )
3535 {
36- using ( StreamWriter sw = new StreamWriter ( path ) )
37- {
38- sw . Write ( content ) ;
39- }
36+ using StreamWriter sw = new StreamWriter ( path ) ;
37+ sw . Write ( content ) ;
4038 }
4139
4240 /// <summary>
4341 /// Export the KeyInfo object to a storage device in plain text format
4442 /// </summary>
45- /// <param name="path">The path where the KeyInfo object can be stored in plain text format</param>
43+ /// <param name="path">The path where the KeyInfo object should be stored in plain text format</param>
4644 internal void ExportToTxt ( string path )
4745 {
4846 string content = "Product name: " + _keyInfo . GetProductName ( ) + Environment . NewLine + "Product key: " +
@@ -53,7 +51,7 @@ internal void ExportToTxt(string path)
5351 /// <summary>
5452 /// Export the KeyInfo object to a storage device in CSV format
5553 /// </summary>
56- /// <param name="path">The path where the KeyInfo object can be stored in CSV format</param>
54+ /// <param name="path">The path where the KeyInfo object should be stored in CSV format</param>
5755 internal void ExportToCsv ( string path )
5856 {
5957 ExportDelimiter ( path , "," ) ;
@@ -62,16 +60,27 @@ internal void ExportToCsv(string path)
6260 /// <summary>
6361 /// Export the KeyInfo object to a storage device in CSV format using the Excel delimiter
6462 /// </summary>
65- /// <param name="path">The path where the KeyInfo object can be stored in CSV format using the Excel delimiter</param>
63+ /// <param name="path">The path where the KeyInfo object should be stored in CSV format using the Excel delimiter</param>
6664 internal void ExportToExcel ( string path )
6765 {
6866 ExportDelimiter ( path , ";" ) ;
6967 }
68+
69+ /// <summary>
70+ /// Export the KeyInfo object to a storage device in JSON format
71+ /// </summary>
72+ /// <param name="path">The path where the KeyInfo object should be stored in JSON format</param>
73+ internal void ExportToJson ( string path )
74+ {
75+ string content = "{\" productName\" :\" " + _keyInfo . GetProductName ( ) + "\" ,\" productKey\" :\" " +
76+ _keyInfo . GetProductKey ( ) + "\" }" ;
77+ Export ( path , content ) ;
78+ }
7079
7180 /// <summary>
7281 /// Export the KeyInfo object to a storage device using a specific delimiter character
7382 /// </summary>
74- /// <param name="path">The path where the KeyInfo object can be stored</param>
83+ /// <param name="path">The path where the KeyInfo object should be stored</param>
7584 /// <param name="delimiter">The delimiter that should be used to split the data</param>
7685 private void ExportDelimiter ( string path , string delimiter )
7786 {
@@ -83,12 +92,11 @@ private void ExportDelimiter(string path, string delimiter)
8392 /// <summary>
8493 /// Export the KeyInfo object to a storage device in HTML format
8594 /// </summary>
86- /// <param name="path">The path where the KeyInfo object can be stored in HTML format</param>
95+ /// <param name="path">The path where the KeyInfo object should be stored in HTML format</param>
8796 internal void ExportToHtml ( string path )
88- {
89- string content =
90- "<html><head><title>PK Finder</title></head><body><table border='1'><tr><th>Product name</th><th>Product key</th></tr><tr><td>" +
91- _keyInfo . GetProductName ( ) + "</td><td>" + _keyInfo . GetProductKey ( ) + "</td></tr></table></body></html>" ;
97+ {
98+ string content = "<html><head><meta charset=\" UTF-8\" ><title>PK Finder</title></head><body><table border='1'><tbody><tr><th>Product name</th><th>Product key</th></tr><tr><td>" +
99+ _keyInfo . GetProductName ( ) + "</td><td>" + _keyInfo . GetProductKey ( ) + "</td></tr></tbody></table></body></html>" ;
92100 Export ( path , content ) ;
93101 }
94102 }
0 commit comments