Skip to content

Commit 6b2af5a

Browse files
committed
generating summary
1 parent add6825 commit 6b2af5a

9 files changed

Lines changed: 1095 additions & 928 deletions

File tree

src/NetPackageAnalyzer/NetPackageAnalyzerConsole/NetPackageAnalyzerConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ProjectReference Include="..\NPA.GitInfo\NPA.GitInfo.csproj" />
3131
</ItemGroup>
3232
<PropertyGroup>
33-
<Version>10.2025.1227.908</Version>
33+
<Version>10.2025.1227.2008</Version>
3434
<PackAsTool>true</PackAsTool>
3535
<ToolCommandName>PackageAnalyzer</ToolCommandName>
3636
<Authors>Andrei Ignat</Authors>

src/NetPackageAnalyzer/NetPackageAnalyzerConsole/Program.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
if (args.Length == 0)
66
{
77
args = new[] { "-h" };
8-
//args = new[] { "generateFiles",
9-
// "--folder", @"D:\eu\GitHub\SkinnyControllersGenerator\src\SkinnyControllers",
10-
// "-wg","HtmlSummary",
11-
// "--where", @"D:\eu\GitHub\PackageAnalyzer\src\documentation1\",
12-
// "--verbose","true"
13-
//};
14-
158
args = new[] { "generateFiles",
16-
"--folder", @"D:\eu\GitHub\eShop",
9+
"--folder", @"D:\eu\GitHub\SkinnyControllersGenerator\src\SkinnyControllers",
1710
"-wg","HtmlSummary",
1811
"--where", @"D:\eu\GitHub\PackageAnalyzer\src\documentation1\",
1912
"--verbose","true"
2013
};
2114

15+
//args = new[] { "generateFiles",
16+
// "--folder", @"D:\eu\GitHub\eShop",
17+
// "-wg","HtmlSummary",
18+
// "--where", @"D:\eu\GitHub\PackageAnalyzer\src\documentation1\",
19+
// "--verbose","true"
20+
//};
21+
2222
//args = new[] { "generateFiles",
2323
// "--folder", @"D:\eu\GitHub\XpertContract-\src\XpertContract",
2424
// "-wg","HtmlSummary",

src/NetPackageAnalyzer/NetPackageAnalyzerConsole/RealMain.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22

3+
using static System.Runtime.InteropServices.JavaScript.JSType;
4+
35
namespace NetPackageAnalyzerConsole;
46
internal class RealMainExecuting
57
{
@@ -278,6 +280,8 @@ private static async Task RealGenerateHandler(string folder, string where, WhatT
278280
break;
279281
case WhatToGenerate.HtmlSummary:
280282
WriteLine($"start {data}");
283+
284+
await ReplaceHtmlSummary(data);
281285
LaunchBrowser(data);
282286
break;
283287
default:
@@ -286,4 +290,43 @@ private static async Task RealGenerateHandler(string folder, string where, WhatT
286290

287291

288292
}
293+
private static async Task<bool> ReplaceHtmlSummary(string filePath)
294+
{
295+
string nameSol = GlobalsForGenerating.NameSolution;
296+
if(!File.Exists(filePath)) return false;
297+
File.Copy(filePath, filePath + ".bak",true);
298+
var content = await File.ReadAllTextAsync(filePath);
299+
content = content.Replace("driverObj.drive();", "driverObj.drive();var tabs = new Tabby('[data-tabs]');");
300+
var lines = content.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
301+
string?[] outputLine = new string[lines.Length];
302+
for(int i=0; i<lines.Length; i++)
303+
{
304+
var line = lines[i];
305+
#region replace all extracted images
306+
var titleToReplace = """title="image """;
307+
if (line.Contains(titleToReplace) && !line.Contains(" stay "))
308+
{
309+
//find title
310+
var index = line.IndexOf(titleToReplace);
311+
var next = line.IndexOf('"', index + titleToReplace.Length + 1);
312+
var title = line.Substring(index + titleToReplace.Length, next - titleToReplace.Length - index);
313+
var nameFile = title.Replace(" ", "-");
314+
nameFile += ".png";
315+
outputLine[i] = $"<img title='{title}' src='images_{nameSol}_summary/{nameFile}' />";
316+
while (!line.Contains("</div>")){
317+
i++ ;
318+
line = lines[i];
319+
outputLine[i] = null;
320+
}
321+
continue;
322+
}
323+
#endregion
324+
outputLine[i] = line;
325+
}
326+
327+
content = string.Join(Environment.NewLine, outputLine.Where(it => !string.IsNullOrWhiteSpace(it)));
328+
await File.WriteAllTextAsync(filePath, content);
329+
330+
return true;
331+
}
289332
}

0 commit comments

Comments
 (0)