Skip to content

Commit d3ad7d0

Browse files
committed
refactor 3
1 parent b05c24c commit d3ad7d0

File tree

1 file changed

+53
-55
lines changed

1 file changed

+53
-55
lines changed

Src/Generate/Program.cs

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public static class ReferenceInfos
332332
{
333333
""");
334334

335-
var allPropNames = ProcessDlls(
335+
ProcessDlls(
336336
name,
337337
realPackagePaths,
338338
realPackagePrefix,
@@ -342,58 +342,6 @@ public static class ReferenceInfos
342342
refContent,
343343
refInfoContent);
344344

345-
refInfoContent.AppendLine("""
346-
private static ImmutableArray<ReferenceInfo> _all;
347-
public static ImmutableArray<ReferenceInfo> All
348-
{
349-
get
350-
{
351-
if (_all.IsDefault)
352-
{
353-
_all =
354-
[
355-
""");
356-
357-
refContent.AppendLine("""
358-
private static ImmutableArray<PortableExecutableReference> _all;
359-
public static ImmutableArray<PortableExecutableReference> All
360-
{
361-
get
362-
{
363-
if (_all.IsDefault)
364-
{
365-
_all =
366-
[
367-
""");
368-
369-
foreach (var propName in allPropNames)
370-
{
371-
refInfoContent.AppendLine($" {propName},");
372-
refContent.AppendLine($" {propName},");
373-
}
374-
375-
refContent.AppendLine("""
376-
];
377-
}
378-
return _all;
379-
}
380-
}
381-
}
382-
}
383-
""");
384-
385-
refInfoContent.AppendLine("""
386-
];
387-
}
388-
return _all;
389-
}
390-
}
391-
392-
public static IEnumerable<(string FileName, byte[] ImageBytes, PortableExecutableReference Reference, Guid Mvid)> AllValues => All.Select(x => x.AsTuple());
393-
}
394-
}
395-
""");
396-
397345
resourcesContent.AppendLine("""
398346
399347
}
@@ -425,7 +373,7 @@ namespace Basic.Reference.Assemblies;
425373

426374
return (codeContent.ToString(), targetsContent.ToString());
427375

428-
static List<string> ProcessDlls(
376+
void ProcessDlls(
429377
string name,
430378
string[] packagePaths,
431379
string packagePrefix,
@@ -492,7 +440,57 @@ public static PortableExecutableReference {{propName}}
492440
""");
493441
}
494442

495-
return allPropNames;
443+
refInfoContent.AppendLine("""
444+
private static ImmutableArray<ReferenceInfo> _all;
445+
public static ImmutableArray<ReferenceInfo> All
446+
{
447+
get
448+
{
449+
if (_all.IsDefault)
450+
{
451+
_all =
452+
[
453+
""");
454+
455+
refContent.AppendLine("""
456+
private static ImmutableArray<PortableExecutableReference> _all;
457+
public static ImmutableArray<PortableExecutableReference> All
458+
{
459+
get
460+
{
461+
if (_all.IsDefault)
462+
{
463+
_all =
464+
[
465+
""");
466+
467+
foreach (var propName in allPropNames)
468+
{
469+
refInfoContent.AppendLine($" {propName},");
470+
refContent.AppendLine($" {propName},");
471+
}
472+
473+
refContent.AppendLine("""
474+
];
475+
}
476+
return _all;
477+
}
478+
}
479+
}
480+
}
481+
""");
482+
483+
refInfoContent.AppendLine("""
484+
];
485+
}
486+
return _all;
487+
}
488+
}
489+
490+
public static IEnumerable<(string FileName, byte[] ImageBytes, PortableExecutableReference Reference, Guid Mvid)> AllValues => All.Select(x => x.AsTuple());
491+
}
492+
}
493+
""");
496494
}
497495

498496
static IEnumerable<(string FilePath, string RelativeFilePath, Guid Mvid)> FindDlls(string[] packagePaths, string packagePrefix)

0 commit comments

Comments
 (0)