Skip to content

Commit 9508fec

Browse files
committed
Update to .NET 8 and some fixes
* Update to .NET 8 (use of collection initialization, use of primary constructors, more uses of ReadOnlySpan<char> and make use of the ReadOnlySpan<char>.Split method added with .NET 8) * "Corrects" issue when encountering a /Tc or /Tp flag. While it should be erroneous, I was presented an example of a DSP that had a /Tp flag with no argument, which made me assume it was meant to be /TP instead, so this will handle this, whether correct or not. * Corrects issue when inside of a Custom Build Step and encountering a line which are not ones that contain the outputs of the build step.
1 parent 93e19a4 commit 9508fec

18 files changed

+621
-627
lines changed

ClCompile.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public ClCompile(string include, string condition) : base(include, condition)
1818

1919
// Order is based on how Visual Studio 2022 has them in its properties window
2020
public bool? ExcludedFromBuild { get; set; }
21-
public HashSet<string> AdditionalIncludeDirectories { get; } = new();
21+
public HashSet<string> AdditionalIncludeDirectories { get; } = [];
2222
public string? DebugInformationFormat { get; set; }
2323
public bool? SuppressStartupBanner { get; set; }
2424
public string? WarningLevel { get; set; }
@@ -29,8 +29,8 @@ public ClCompile(string include, string condition) : base(include, condition)
2929
public string? FavorSizeOrSpeed { get; set; }
3030
public bool? OmitFramePointers { get; set; }
3131
public bool? EnableFiberSafeOptimizations { get; set; }
32-
public HashSet<string> PreprocessorDefinitions { get; } = new();
33-
public HashSet<string> UndefinePreprocessorDefinitions { get; } = new();
32+
public HashSet<string> PreprocessorDefinitions { get; } = [];
33+
public HashSet<string> UndefinePreprocessorDefinitions { get; } = [];
3434
public bool? UndefineAllPreprocessorDefinitions { get; set; }
3535
public bool? IgnoreStandardIncludePath { get; set; }
3636
public bool? PreprocessToFile { get; set; }
@@ -55,9 +55,9 @@ public ClCompile(string include, string condition) : base(include, condition)
5555
public string? BrowseInformationFile { get; set; }
5656
public string? CallingConvention { get; set; }
5757
public string? CompileAs { get; set; }
58-
public HashSet<string> ForcedIncludeFiles { get; } = new();
58+
public HashSet<string> ForcedIncludeFiles { get; } = [];
5959
public bool? OmitDefaultLibName { get; set; }
60-
public HashSet<string> AdditionalOptions { get; } = new();
60+
public HashSet<string> AdditionalOptions { get; } = [];
6161

6262
public override XElement GetBlock()
6363
{

ClInclude.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ namespace DSPtoVCXPROJ;
55
/// <summary>
66
/// The <see cref="ClInclude" /> block is typically only used on C/C++ header files.
77
/// </summary>
8-
class ClInclude : None
8+
class ClInclude(string? include = null) : None(include)
99
{
10-
public ClInclude(string? include = null) : base(include)
11-
{
12-
}
13-
1410
public override XElement GetBlock()
1511
{
1612
var block = base.GetBlock();

ConfigurationProperties.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ namespace DSPtoVCXPROJ;
55
/// <summary>
66
/// The configuration properties of a project, the condition is usually a comparison against Configuration and Platform.
77
/// </summary>
8-
class ConfigurationProperties
8+
class ConfigurationProperties(string condition)
99
{
10-
public string Condition { get; }
11-
12-
public ConfigurationProperties(string condition) => this.Condition = condition;
10+
public string Condition { get; } = condition;
1311

1412
public bool? UseDebugLibraries { get; set; }
1513
public string? UseOfMfc { get; set; }

DSPtoVCXPROJ.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

Filter.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ namespace DSPtoVCXPROJ;
77
/// filter in the IDE. This encompasses both the general filters, which contain the extensions, as well as being used on the objects
88
/// themselves to say which filter they are contained within.
99
/// </summary>
10-
class Filter
10+
class Filter(string include)
1111
{
12-
public string Include { get; }
12+
public string Include { get; } = include;
1313
public string? Extensions { get; set; }
1414

15-
public Filter(string include) => this.Include = include;
16-
1715
/// <summary>
1816
/// Gets the block as an <see cref="XElement" />.
1917
/// </summary>

Image.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ namespace DSPtoVCXPROJ;
55
/// <summary>
66
/// The <see cref="Image" /> block is typically only used on Image files, such as .ico or .bmp files.
77
/// </summary>
8-
class Image : None
8+
class Image(string? include = null) : None(include)
99
{
10-
public Image(string? include = null) : base(include)
11-
{
12-
}
13-
1410
public override XElement GetBlock()
1511
{
1612
var block = base.GetBlock();

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 Naram "CyberBotX" Qashat
3+
Copyright (c) 2023-2025 Naram "CyberBotX" Qashat
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Lib.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ class Lib : None
99
{
1010
// Order is based on how Visual Studio 2022 has them in its properties window
1111
public string? OutputFile { get; set; }
12-
public HashSet<string> AdditionalDependencies { get; } = new();
13-
public HashSet<string> AdditionalLibraryDirectories { get; } = new();
12+
public HashSet<string> AdditionalDependencies { get; } = [];
13+
public HashSet<string> AdditionalLibraryDirectories { get; } = [];
1414
public bool? SuppressStartupBanner { get; set; }
1515
public string? ModuleDefinitionFile { get; set; }
1616
public bool? IgnoreAllDefaultLibraries { get; set; }
17-
public HashSet<string> IgnoreSpecificDefaultLibraries { get; } = new();
18-
public HashSet<string> ExportNamedFunctions { get; } = new();
17+
public HashSet<string> IgnoreSpecificDefaultLibraries { get; } = [];
18+
public HashSet<string> ExportNamedFunctions { get; } = [];
1919
public string? ForceSymbolReferences { get; set; }
2020
public string? TargetMachine { get; set; }
2121
public string? SubSystem { get; set; }
22-
public HashSet<string> RemoveObjects { get; } = new();
22+
public HashSet<string> RemoveObjects { get; } = [];
2323
public bool? Verbose { get; set; }
2424
public string? Name { get; set; }
25-
public HashSet<string> AdditionalOptions { get; } = new();
25+
public HashSet<string> AdditionalOptions { get; } = [];
2626

2727
public override XElement GetBlock()
2828
{

Link.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace DSPtoVCXPROJ;
77
/// </summary>
88
class Link : None
99
{
10-
internal static readonly HashSet<string> InheritedAdditionalDependencies = new()
11-
{
10+
internal static readonly HashSet<string> InheritedAdditionalDependencies =
11+
[
1212
"kernel32.lib",
1313
"user32.lib",
1414
"gdi32.lib",
@@ -21,23 +21,23 @@ class Link : None
2121
"uuid.lib",
2222
"odbc32.lib",
2323
"odbccp32.lib"
24-
};
24+
];
2525

2626
// Order is based on how Visual Studio 2022 has them in its properties window
2727
public string? OutputFile { get; set; }
2828
public string? ShowProgress { get; set; }
2929
public string? Version { get; set; }
3030
public bool? LinkIncremental { get; set; }
3131
public bool? SuppressStartupBanner { get; set; }
32-
public HashSet<string> AdditionalLibraryDirectories { get; } = new();
32+
public HashSet<string> AdditionalLibraryDirectories { get; } = [];
3333
public string? ForceFileOutput { get; set; }
3434
public string? SpecifySectionAttributes { get; set; }
35-
public HashSet<string> AdditionalDependencies { get; } = new();
35+
public HashSet<string> AdditionalDependencies { get; } = [];
3636
public bool? IgnoreAllDefaultLibraries { get; set; }
37-
public HashSet<string> IgnoreSpecificDefaultLibraries { get; } = new();
37+
public HashSet<string> IgnoreSpecificDefaultLibraries { get; } = [];
3838
public string? ModuleDefinitionFile { get; set; }
39-
public HashSet<string> ForceSymbolReferences { get; } = new();
40-
public HashSet<string> DelayLoadDLLs { get; } = new();
39+
public HashSet<string> ForceSymbolReferences { get; } = [];
40+
public HashSet<string> DelayLoadDLLs { get; } = [];
4141
public bool? GenerateDebugInformation { get; set; }
4242
public string? ProgramDatabaseFile { get; set; }
4343
public bool? GenerateMapFile { get; set; }
@@ -69,7 +69,7 @@ class Link : None
6969
public string? SectionAlignment { get; set; }
7070
// This is the only option here that has no entry in the property pages but does have one in MSBuild
7171
public string? MSDOSStubFileName { get; set; }
72-
public HashSet<string> AdditionalOptions { get; } = new();
72+
public HashSet<string> AdditionalOptions { get; } = [];
7373

7474
public override XElement GetBlock()
7575
{

MultipleClCompile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace DSPtoVCXPROJ;
55
/// </summary>
66
class MultipleClCompile
77
{
8-
public List<ClCompile> Objects { get; set; } = new();
8+
public List<ClCompile> Objects { get; set; } = [];
99

1010
public bool? ExcludedFromBuild
1111
{

0 commit comments

Comments
 (0)