Skip to content

Commit be94c3f

Browse files
committed
style(project): 🎨 clean up csproj formatting
1 parent 8d0ff11 commit be94c3f

9 files changed

Lines changed: 128 additions & 118 deletions

File tree

.config/dotnet-tools.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
"isRoot": true,
44
"tools": {
55
"csharpier": {
6-
"version": "0.29.2",
7-
"commands": ["dotnet-csharpier"]
6+
"version": "1.0.2",
7+
"commands": [
8+
"csharpier"
9+
],
10+
"rollForward": false
811
}
912
}
1013
}

AGENTS.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
The CI workflow uses static checks that do not require Resonite assemblies.
44

55
- Formatting is enforced with `csharpier`.
6-
- Run `dotnet tool restore` once per session if `dotnet dotnet-csharpier` is unavailable.
7-
- Before committing, run `dotnet dotnet-csharpier --check .` to verify formatting.
8-
- Use `dotnet dotnet-csharpier .` to apply formatting fixes.
9-
- TODO: Explore additional static checks such as `dotnet format` with stub assemblies.
6+
- Before committing, run `dotnet csharpier check .` to verify formatting.
7+
- Use `dotnet csharpier format .` to apply formatting fixes.

Directory.Build.props

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,53 @@
1313
<PackageReadmeFile>README.md</PackageReadmeFile>
1414
<Version>0.8.0</Version>
1515
</PropertyGroup>
16-
1716
<!-- Common Build Properties -->
1817
<PropertyGroup>
1918
<TargetFramework>net472</TargetFramework>
2019
<LangVersion>latest</LangVersion>
2120
<Nullable>enable</Nullable>
2221
<Deterministic>true</Deterministic>
2322
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
24-
2523
<!-- Debug/Release specific settings -->
2624
<DebugType Condition="'$(Configuration)'=='Debug'">embedded</DebugType>
2725
<DebugType Condition="'$(Configuration)'=='Release'">pdbonly</DebugType>
2826
<Optimize Condition="'$(Configuration)'=='Release'">true</Optimize>
29-
3027
<!-- Assembly Metadata -->
3128
<AssemblyTitle>$(MSBuildProjectName)</AssemblyTitle>
3229
<Product>$(MSBuildProjectName)</Product>
33-
3430
<!-- Code Quality -->
3531
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
3632
<EnableNETAnalyzers>true</EnableNETAnalyzers>
3733
<AnalysisLevel>latest-all</AnalysisLevel>
3834
<WarningLevel>9999</WarningLevel>
3935
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4036
<WarningsAsErrors />
41-
<WarningsNotAsErrors>NU1701</WarningsNotAsErrors> <!-- Allow .NET Framework dependencies -->
42-
37+
<WarningsNotAsErrors>NU1701</WarningsNotAsErrors>
38+
<!-- Allow .NET Framework dependencies -->
4339
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
4440
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
4541
</PropertyGroup>
46-
4742
<!-- Resonite Path Discovery -->
4843
<PropertyGroup Condition="'$(ResonitePath)'==''">
4944
<ResonitePath>$(MSBuildThisFileDirectory)Resonite/</ResonitePath>
50-
<ResonitePath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\Resonite\')">C:\Program Files (x86)\Steam\steamapps\common\Resonite\</ResonitePath>
51-
<ResonitePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')">$(HOME)/.steam/steam/steamapps/common/Resonite/</ResonitePath>
45+
<ResonitePath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\Resonite\')"
46+
>C:\Program Files (x86)\Steam\steamapps\common\Resonite\</ResonitePath
47+
>
48+
<ResonitePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')"
49+
>$(HOME)/.steam/steam/steamapps/common/Resonite/</ResonitePath
50+
>
5251
</PropertyGroup>
53-
5452
<!-- Normalize ResonitePath -->
5553
<PropertyGroup>
5654
<ResonitePath>$([MSBuild]::EnsureTrailingSlash('$(ResonitePath)'))</ResonitePath>
5755
</PropertyGroup>
58-
5956
<!-- Derived Resonite Paths -->
6057
<PropertyGroup>
6158
<ResoniteManagedPath>$(ResonitePath)Resonite_Data\Managed\</ResoniteManagedPath>
6259
<ResoniteModsPath>$(ResonitePath)rml_mods</ResoniteModsPath>
6360
<ResoniteHotReloadPath>$(ResonitePath)rml_mods\HotReloadMods</ResoniteHotReloadPath>
6461
<ResoniteLibsPath>$(ResonitePath)rml_libs\</ResoniteLibsPath>
6562
</PropertyGroup>
66-
6763
<!-- Common Resonite References -->
6864
<ItemGroup>
6965
<!-- Core Resonite Mod Dependencies -->
@@ -73,10 +69,11 @@
7369
</Reference>
7470
<Reference Include="HarmonyLib">
7571
<HintPath>$(ResoniteLibsPath)0Harmony.dll</HintPath>
76-
<HintPath Condition="Exists('$(ResonitePath)0Harmony.dll')">$(ResonitePath)0Harmony.dll</HintPath>
72+
<HintPath Condition="Exists('$(ResonitePath)0Harmony.dll')"
73+
>$(ResonitePath)0Harmony.dll</HintPath
74+
>
7775
<Private>false</Private>
7876
</Reference>
79-
8077
<!-- Core Resonite Engine References (Managed) -->
8178
<Reference Include="FrooxEngine">
8279
<HintPath>$(ResoniteManagedPath)FrooxEngine.dll</HintPath>
@@ -90,7 +87,6 @@
9087
<HintPath>$(ResoniteManagedPath)Elements.Assets.dll</HintPath>
9188
<Private>false</Private>
9289
</Reference>
93-
9490
<Reference Include="System.Text.Json">
9591
<HintPath>$(ResoniteManagedPath)System.Text.Json.dll</HintPath>
9692
<Private>false</Private>
@@ -99,14 +95,12 @@
9995
<HintPath>$(ResoniteManagedPath)System.Memory.dll</HintPath>
10096
<Private>false</Private>
10197
</Reference>
102-
10398
<!-- Debug-only references -->
10499
<Reference Include="ResoniteHotReloadLib" Condition="'$(Configuration)'=='Debug'">
105100
<HintPath>$(ResoniteLibsPath)ResoniteHotReloadLib.dll</HintPath>
106101
<Private>false</Private>
107102
</Reference>
108103
</ItemGroup>
109-
110104
<!-- Common Items -->
111105
<ItemGroup>
112106
<None Include="$(MSBuildThisFileDirectory).github\**\*" LinkBase=".github" />

Directory.Build.targets

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,37 @@
77
Prerequisites: Project must be built first (dotnet build)
88
Installs to main mods folder, and additionally to HotReload folder for Debug builds
99
-->
10-
<Target Name="Install"
11-
Inputs="$(TargetPath)"
12-
Outputs="$(ResoniteModsPath)\$(TargetFileName);$(ResoniteHotReloadPath)\$(TargetFileName)">
13-
10+
<Target
11+
Name="Install"
12+
Inputs="$(TargetPath)"
13+
Outputs="$(ResoniteModsPath)\$(TargetFileName);$(ResoniteHotReloadPath)\$(TargetFileName)"
14+
>
1415
<!-- Check if build output exists -->
15-
<Error Text="Build output not found at $(TargetPath). Please run 'dotnet build' first."
16-
Condition="!Exists('$(TargetPath)')" />
17-
16+
<Error
17+
Text="Build output not found at $(TargetPath). Please run 'dotnet build' first."
18+
Condition="!Exists('$(TargetPath)')"
19+
/>
1820
<!-- Always install to main mods folder -->
19-
<Message Text="Installing $(TargetFileName) to Resonite mods folder: $(ResoniteModsPath)" Importance="high" />
21+
<Message
22+
Text="Installing $(TargetFileName) to Resonite mods folder: $(ResoniteModsPath)"
23+
Importance="high"
24+
/>
2025
<MakeDir Directories="$(ResoniteModsPath)" Condition="!Exists('$(ResoniteModsPath)')" />
21-
<Copy SourceFiles="$(TargetPath)"
22-
DestinationFolder="$(ResoniteModsPath)" />
23-
26+
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(ResoniteModsPath)" />
2427
<!-- Additionally install to HotReload folder for Debug builds -->
25-
<Message Text="Installing $(TargetFileName) to Resonite hot reload folder: $(ResoniteHotReloadPath)"
26-
Importance="high"
27-
Condition="'$(Configuration)'=='Debug'" />
28-
<MakeDir Directories="$(ResoniteHotReloadPath)"
29-
Condition="'$(Configuration)'=='Debug' AND !Exists('$(ResoniteHotReloadPath)')" />
30-
<Copy SourceFiles="$(TargetPath)"
31-
DestinationFolder="$(ResoniteHotReloadPath)"
32-
Condition="'$(Configuration)'=='Debug'" />
28+
<Message
29+
Text="Installing $(TargetFileName) to Resonite hot reload folder: $(ResoniteHotReloadPath)"
30+
Importance="high"
31+
Condition="'$(Configuration)'=='Debug'"
32+
/>
33+
<MakeDir
34+
Directories="$(ResoniteHotReloadPath)"
35+
Condition="'$(Configuration)'=='Debug' AND !Exists('$(ResoniteHotReloadPath)')"
36+
/>
37+
<Copy
38+
SourceFiles="$(TargetPath)"
39+
DestinationFolder="$(ResoniteHotReloadPath)"
40+
Condition="'$(Configuration)'=='Debug'"
41+
/>
3342
</Target>
3443
</Project>

ResoniteMetricsCounter/Metrics/MetricStage.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,33 @@ public enum MetricStage
3434

3535
public static class MetricStageUtils
3636
{
37-
public static readonly HashSet<MetricStage> Collectables =
38-
new()
39-
{
40-
MetricStage.PhysicsMoved,
41-
MetricStage.Updates,
42-
MetricStage.ProtoFluxRebuild,
43-
MetricStage.ProtoFluxEvents,
44-
MetricStage.ProtoFluxUpdates,
45-
MetricStage.ProtoFluxContinuousChanges,
46-
MetricStage.ProtoFluxDiscreteChangesPre,
47-
MetricStage.Changes,
48-
MetricStage.ProtoFluxDiscreteChangesPost,
49-
MetricStage.ParticleSystems,
50-
MetricStage.Connectors,
51-
MetricStage.DynamicBoneChainPrepare,
52-
MetricStage.DynamicBoneChainOverlaps,
53-
MetricStage.DynamicBoneChainSimulation,
54-
MetricStage.DynamicBoneChainFinish,
55-
};
37+
public static readonly HashSet<MetricStage> Collectables = new()
38+
{
39+
MetricStage.PhysicsMoved,
40+
MetricStage.Updates,
41+
MetricStage.ProtoFluxRebuild,
42+
MetricStage.ProtoFluxEvents,
43+
MetricStage.ProtoFluxUpdates,
44+
MetricStage.ProtoFluxContinuousChanges,
45+
MetricStage.ProtoFluxDiscreteChangesPre,
46+
MetricStage.Changes,
47+
MetricStage.ProtoFluxDiscreteChangesPost,
48+
MetricStage.ParticleSystems,
49+
MetricStage.Connectors,
50+
MetricStage.DynamicBoneChainPrepare,
51+
MetricStage.DynamicBoneChainOverlaps,
52+
MetricStage.DynamicBoneChainSimulation,
53+
MetricStage.DynamicBoneChainFinish,
54+
};
5655

57-
public static readonly HashSet<MetricStage> Defaults =
58-
new()
59-
{
60-
MetricStage.PhysicsMoved,
61-
MetricStage.Updates,
62-
MetricStage.ProtoFluxUpdates,
63-
MetricStage.ProtoFluxContinuousChanges,
64-
MetricStage.Changes,
65-
MetricStage.DynamicBoneChainSimulation,
66-
MetricStage.DynamicBoneChainFinish,
67-
};
56+
public static readonly HashSet<MetricStage> Defaults = new()
57+
{
58+
MetricStage.PhysicsMoved,
59+
MetricStage.Updates,
60+
MetricStage.ProtoFluxUpdates,
61+
MetricStage.ProtoFluxContinuousChanges,
62+
MetricStage.Changes,
63+
MetricStage.DynamicBoneChainSimulation,
64+
MetricStage.DynamicBoneChainFinish,
65+
};
6866
}

ResoniteMetricsCounter/Metrics/MetricsCounter.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,17 @@ internal void Add(IWorldElement element, long ticks, MetricStage stage)
149149
}
150150
}
151151

152-
private static readonly JsonSerializerOptions jsonSerializerOptions =
153-
new()
152+
private static readonly JsonSerializerOptions jsonSerializerOptions = new()
153+
{
154+
WriteIndented = true,
155+
IgnoreReadOnlyFields = false,
156+
IgnoreReadOnlyProperties = false,
157+
Converters =
154158
{
155-
WriteIndented = true,
156-
IgnoreReadOnlyFields = false,
157-
IgnoreReadOnlyProperties = false,
158-
Converters =
159-
{
160-
new IWorldElementConverter(),
161-
new JsonStringEnumConverter<World.RefreshStage>(),
162-
},
163-
};
159+
new IWorldElementConverter(),
160+
new JsonStringEnumConverter<World.RefreshStage>(),
161+
},
162+
};
164163

165164
public void WriteToFile()
166165
{
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk"></Project>

ResoniteMetricsCounter/ResoniteMetricsCounterMod.cs

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,45 +39,52 @@ public class ResoniteMetricsCounterMod : ResoniteMod
3939
private static ModConfiguration? config;
4040

4141
[AutoRegisterConfigKey]
42-
private static readonly ModConfigurationKey<string> blackListKey =
43-
new(
44-
"BlackList",
45-
"Ignore those components. Commas separated.",
46-
computeDefault: () =>
47-
string.Join(
48-
",",
49-
new[]
50-
{
51-
nameof(InteractionHandler),
52-
nameof(InteractionLaser),
53-
nameof(HandPoser),
54-
nameof(LocomotionController),
55-
nameof(UserPoseController),
56-
nameof(PhotoCaptureManager),
57-
nameof(TipTouchSource),
58-
}
59-
)
60-
);
42+
private static readonly ModConfigurationKey<string> blackListKey = new(
43+
"BlackList",
44+
"Ignore those components. Commas separated.",
45+
computeDefault: () =>
46+
string.Join(
47+
",",
48+
new[]
49+
{
50+
nameof(InteractionHandler),
51+
nameof(InteractionLaser),
52+
nameof(HandPoser),
53+
nameof(LocomotionController),
54+
nameof(UserPoseController),
55+
nameof(PhotoCaptureManager),
56+
nameof(TipTouchSource),
57+
}
58+
)
59+
);
6160

6261
[AutoRegisterConfigKey]
63-
private static readonly ModConfigurationKey<float2> panelSizeKey =
64-
new("PanelSize", "Size of the panel.", computeDefault: () => new float2(1200, 1200));
62+
private static readonly ModConfigurationKey<float2> panelSizeKey = new(
63+
"PanelSize",
64+
"Size of the panel.",
65+
computeDefault: () => new float2(1200, 1200)
66+
);
6567

6668
[AutoRegisterConfigKey]
67-
private static readonly ModConfigurationKey<int> maxItemsKey =
68-
new("MaxItems", "Max items to show in the panel.", computeDefault: () => 256);
69+
private static readonly ModConfigurationKey<int> maxItemsKey = new(
70+
"MaxItems",
71+
"Max items to show in the panel.",
72+
computeDefault: () => 256
73+
);
6974

7075
[AutoRegisterConfigKey]
71-
private static readonly ModConfigurationKey<bool> writeToFileKey =
72-
new("WriteToFile", "Write metrics to file.", computeDefault: () => false);
76+
private static readonly ModConfigurationKey<bool> writeToFileKey = new(
77+
"WriteToFile",
78+
"Write metrics to file.",
79+
computeDefault: () => false
80+
);
7381

7482
[AutoRegisterConfigKey]
75-
private static readonly ModConfigurationKey<float> uiUpdateIntervalKey =
76-
new(
77-
"UIUpdateInterval",
78-
"Interval in seconds to update the UI.",
79-
computeDefault: () => 0.1f
80-
);
83+
private static readonly ModConfigurationKey<float> uiUpdateIntervalKey = new(
84+
"UIUpdateInterval",
85+
"Interval in seconds to update the UI.",
86+
computeDefault: () => 0.1f
87+
);
8188

8289
private static readonly Harmony harmony = new($"com.nekometer.esnya.{ModAssembly.GetName()}");
8390
internal static MetricsPanel? Panel { get; private set; }

ResoniteMetricsCounter/UIX/MetricsPanel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ namespace ResoniteMetricsCounter.UIX;
1111

1212
internal sealed class MetricsPanel
1313
{
14-
private readonly List<KeyValuePair<string, MetricsPageBase>> pages =
15-
new() { new("Detailed", new DetailedPage()), new("Hierarchy", new HierarchyPage()) };
14+
private readonly List<KeyValuePair<string, MetricsPageBase>> pages = new()
15+
{
16+
new("Detailed", new DetailedPage()),
17+
new("Hierarchy", new HierarchyPage()),
18+
};
1619

1720
public const float DEFAULTITEMSIZE = 32;
1821
public const float PADDING = 4;

0 commit comments

Comments
 (0)