|
4 | 4 | using CommandLine; |
5 | 5 | using WindowsNotepadParser; |
6 | 6 | using System.IO.Compression; |
| 7 | +using System.ComponentModel.DataAnnotations; |
| 8 | +using CsvHelper.Configuration; |
| 9 | +using System.Diagnostics; |
7 | 10 |
|
8 | 11 | Parser.Default.ParseArguments<Options>(args) |
9 | 12 | .WithParsed(options => |
10 | 13 | { |
11 | 14 | string tabStateLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\TabState"); |
12 | 15 | string windowStateLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\WindowState"); |
13 | 16 | string outputLocation = Directory.GetCurrentDirectory(); |
| 17 | + bool generateGif = options.generateGif; |
14 | 18 |
|
15 | 19 | if (!string.IsNullOrWhiteSpace(options.tabStateLocation)) |
16 | 20 | { |
|
26 | 30 | } |
27 | 31 |
|
28 | 32 | Console.WriteLine("********** Starting **********"); |
| 33 | + |
| 34 | + //TODO: Detect version of Notepad |
| 35 | + |
| 36 | + //string exeLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\WindowsApps\Microsoft.WindowsNotepad_8wekyb3d8bbwe\notepad.exe"); |
| 37 | + //FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(exeLocation); |
| 38 | + //string fileVersion = versionInfo.FileVersion; |
| 39 | + //Console.WriteLine("Version: {0}", fileVersion); |
| 40 | + |
29 | 41 | Console.WriteLine("TabState Folder Location - {0}", tabStateLocation); |
30 | 42 | if (!Directory.Exists(tabStateLocation)) |
31 | 43 | { |
|
98 | 110 | } |
99 | 111 | } |
100 | 112 |
|
101 | | - ContentToImage ci = new ContentToImage(np.Content, np.UnsavedBufferChunks,string.Format("{0}.gif", Path.GetFileNameWithoutExtension(path))); |
| 113 | + if (generateGif) |
| 114 | + { |
| 115 | + Console.WriteLine("Generating Unsaved Buffer Chunks GIF for TabState - {0}", Path.GetFileName(path)); |
| 116 | + ContentToImage ci = new ContentToImage(np.Content, np.UnsavedBufferChunks, string.Format("{0}.gif", Path.GetFileNameWithoutExtension(path))); |
| 117 | + } |
102 | 118 | } |
| 119 | + |
| 120 | + Console.WriteLine("CRC32 Check Pass: {0}", np.CRC32Calculated.SequenceEqual(np.CRC32Stored)); |
103 | 121 | } |
104 | 122 | } |
105 | 123 | } |
|
153 | 171 | Console.WriteLine("Processing WindowState - {0}", Path.GetFileName(path)); |
154 | 172 | NPWindowState np = new NPWindowState(data, Path.GetFileName(path)); |
155 | 173 | windowStateTabs.Add(np); |
| 174 | + |
| 175 | + Console.WriteLine("CRC32 Check Pass: {0}", np.CRC32Calculated.SequenceEqual(np.CRC32Stored)); |
156 | 176 | } |
157 | 177 | } |
158 | 178 | } |
@@ -215,4 +235,7 @@ public class Options |
215 | 235 |
|
216 | 236 | [Option('o', "outputlocation", Required = false, HelpText = "Output Folder Location for CSV files. Default location is same folder as program.")] |
217 | 237 | public string outputLocation { get; set; } |
| 238 | + |
| 239 | + [Option('g', "generategif" , Default = false, Required = false, HelpText = "Generate GIF images of Unsaved Buffer Chunks. Default is false.")] |
| 240 | + public bool generateGif { get; set; } |
218 | 241 | } |
0 commit comments