Skip to content

Commit 17a78a2

Browse files
committedMar 29, 2023
fix linting issues
1 parent 9935652 commit 17a78a2

31 files changed

+375
-279
lines changed
 

‎Sekta.Admx.Schema/BooleanElement.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Xml.Serialization;
3+
#pragma warning disable CA1823
34

45
namespace Sekta.Admx.Schema;
56

‎Sekta.Admx.Schema/DecimalElement.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Xml.Serialization;
3+
#pragma warning disable CA1823
34

45
namespace Sekta.Admx.Schema;
56

‎Sekta.Admx.Schema/EnumerationElement.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Xml.Serialization;
3+
#pragma warning disable CA1823
34

45
namespace Sekta.Admx.Schema;
56

‎Sekta.Admx.Schema/ListElement.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Xml.Serialization;
3+
#pragma warning disable CA1823
34

45
namespace Sekta.Admx.Schema;
56

‎Sekta.Admx.Schema/PolicyDefinitionResources.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ Stream s
125125
var reader = XmlReader.Create(s, readerSettings);
126126

127127
await Task.Run(
128-
() => resources = (PolicyDefinitionResources)Serializer.Deserialize(reader)
129-
);
128+
() => resources = (PolicyDefinitionResources)Serializer.Deserialize(reader)
129+
)
130+
.ConfigureAwait(false);
130131
}
131132
catch (Exception e)
132133
{

‎Sekta.Admx.Schema/PolicyDefinitions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ public static PolicyDefinitions Deserialize(Stream s)
135135

136136
var reader = XmlReader.Create(s, readerSettings);
137137

138-
await Task.Run(() => defs = (PolicyDefinitions)Serializer.Deserialize(reader));
138+
await Task.Run(() => defs = (PolicyDefinitions)Serializer.Deserialize(reader))
139+
.ConfigureAwait(false);
139140
}
140141
catch (Exception e)
141142
{
+35-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net6.0</TargetFrameworks>
4+
<Platforms>x64;x86;arm64</Platforms>
5+
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
6+
<LangVersion>latest</LangVersion>
7+
<Nullable>disable</Nullable>
8+
</PropertyGroup>
9+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|x64'">
10+
<NoWarn>1701;1702;CS0169</NoWarn>
11+
</PropertyGroup>
12+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|x64'">
13+
<NoWarn>1701;1702;CS0169</NoWarn>
14+
</PropertyGroup>
15+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|x86'">
16+
<NoWarn>1701;1702;CS0169</NoWarn>
17+
</PropertyGroup>
18+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|x86'">
19+
<NoWarn>1701;1702;CS0169</NoWarn>
20+
</PropertyGroup>
21+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|arm64'">
22+
<NoWarn>1701;1702;CS0169</NoWarn>
23+
</PropertyGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|arm64'">
25+
<NoWarn>1701;1702;CS0169</NoWarn>
26+
</PropertyGroup>
227

3-
<PropertyGroup>
4-
<TargetFrameworks>net6.0</TargetFrameworks>
5-
<Platforms>x64;x86;arm64</Platforms>
6-
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
</PropertyGroup>
28+
<ItemGroup>
29+
<None Remove="PolicyDefinitionFiles.xsd" />
30+
</ItemGroup>
1031

11-
<ItemGroup>
12-
<None Remove="PolicyDefinitionFiles.xsd" />
13-
</ItemGroup>
32+
<ItemGroup>
33+
<EmbeddedResource Include="PolicyDefinitionFiles.xsd" />
34+
</ItemGroup>
1435

15-
<ItemGroup>
16-
<EmbeddedResource Include="PolicyDefinitionFiles.xsd" />
17-
</ItemGroup>
18-
19-
<ItemGroup>
20-
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
21-
</ItemGroup>
22-
23-
</Project>
36+
<ItemGroup>
37+
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
38+
</ItemGroup>
39+
</Project>

‎Sekta.Core/IO/DialogFileFilter.cs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Sekta.Core.IO;
2+
3+
public readonly struct DialogFileFilter
4+
{
5+
public readonly string[] Extensions;
6+
public readonly string FileDescription;
7+
8+
public DialogFileFilter(string fileDescription, params string[] extensions)
9+
{
10+
Extensions = extensions;
11+
FileDescription = fileDescription ?? string.Empty;
12+
}
13+
}

‎Sekta.Core/IO/IOService.cs

+9-21
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,15 @@
44

55
namespace Sekta.Core.IO;
66

7-
public readonly struct DialogFileFilter
8-
{
9-
public readonly string[] Extensions;
10-
public readonly string FileDescription;
11-
12-
public DialogFileFilter(string fileDescription, params string[] extensions)
13-
{
14-
Extensions = extensions;
15-
FileDescription = fileDescription ?? string.Empty;
16-
}
17-
}
18-
197
public interface IOService
208
{
21-
Task<string> SelectSingleOutputFile(params DialogFileFilter[] filters);
22-
Task<string> SelectSingleInputFile(params DialogFileFilter[] filters);
23-
Task<string[]> SelectMultipleInputFiles(params DialogFileFilter[] filters);
24-
Task<bool> FileExists(params string[] files);
25-
Task<bool> FileExists(IEnumerable<string> files);
26-
Task<Stream> OpenFileRead(string filePath);
27-
Task<Stream> CreateOrOpenFileWrite(string filePath);
28-
Task<string[]> FindFiles(string directoryPath, string filter = null);
29-
Task<Stream> CreateOrOverwriteFileWrite(string filePath);
9+
Task<string> SelectSingleOutputFileAsync(params DialogFileFilter[] filters);
10+
Task<string> SelectSingleInputFileAsync(params DialogFileFilter[] filters);
11+
Task<string[]> SelectMultipleInputFilesAsync(params DialogFileFilter[] filters);
12+
Task<bool> FileExistsAsync(params string[] files);
13+
Task<bool> FileExistsAsync(IEnumerable<string> files);
14+
Task<Stream> OpenFileReadAsync(string filePath);
15+
Task<Stream> CreateOrOpenFileWriteAsync(string filePath);
16+
Task<string[]> FindFilesAsync(string directoryPath, string filter = null);
17+
Task<Stream> CreateOrOverwriteFileWriteAsync(string filePath);
3018
}

‎Sekta.Core/ModelViews/AdmxAdmlContextViewModel.cs

+15-16
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public AdmxAdmlContextViewModel()
6060
.Bind(out _admlFilePaths)
6161
.Subscribe();
6262

63-
SelectAdmxFileCommand = ReactiveCommand.CreateFromTask(SelectAdmxFile);
63+
SelectAdmxFileCommand = ReactiveCommand.CreateFromTask(SelectAdmxFileAsync);
6464

65-
SelectMoreAdmlFilesCommand = ReactiveCommand.CreateFromTask(AddAdmlFile);
65+
SelectMoreAdmlFilesCommand = ReactiveCommand.CreateFromTask(AddAdmlFileAsync);
6666

6767
RemoveSelectedAdmlFileCommand = ReactiveCommand.CreateFromTask(
68-
RemoveSelectedAdmlFile,
68+
RemoveSelectedAdmlFileAsync,
6969
this.WhenAny((vm) => vm.AdmxFilePath, (path) => !string.IsNullOrEmpty(path.Value))
7070
);
7171

@@ -76,13 +76,13 @@ public AdmxAdmlContextViewModel()
7676
AutoAddAdmlFiles = true;
7777
}
7878

79-
private async Task SelectAdmxFile()
79+
private async Task SelectAdmxFileAsync()
8080
{
8181
IOService service = Locator.Current.GetService<IOService>();
8282

83-
var filePath = await service.SelectSingleInputFile(
84-
new DialogFileFilter("Schema Definition File", "*.admx")
85-
);
83+
var filePath = await service
84+
.SelectSingleInputFileAsync(new DialogFileFilter("Schema Definition File", "*.admx"))
85+
.ConfigureAwait(false);
8686
if (filePath != null)
8787
{
8888
AdmxFilePath = filePath;
@@ -93,10 +93,9 @@ private async Task SelectAdmxFile()
9393
var expectedFileName = Path.GetFileNameWithoutExtension(filePath) + ".adml";
9494

9595
foreach (
96-
string file in await service.FindFiles(
97-
Path.GetDirectoryName(AdmxFilePath),
98-
expectedFileName
99-
)
96+
string file in await service
97+
.FindFilesAsync(Path.GetDirectoryName(AdmxFilePath), expectedFileName)
98+
.ConfigureAwait(false)
10099
)
101100
{
102101
_admlFilePathList.Add(file);
@@ -105,17 +104,17 @@ string file in await service.FindFiles(
105104
}
106105
}
107106

108-
private async Task AddAdmlFile()
107+
private async Task AddAdmlFileAsync()
109108
{
110109
IOService service = Locator.Current.GetService<IOService>();
111110

112-
var files = await service.SelectMultipleInputFiles(
113-
new DialogFileFilter("Schema Resource File", "*.adml")
114-
);
111+
var files = await service
112+
.SelectMultipleInputFilesAsync(new DialogFileFilter("Schema Resource File", "*.adml"))
113+
.ConfigureAwait(false);
115114
_admlFilePathList.AddRange(files.Except(_admlFilePathList.Items).Distinct());
116115
}
117116

118-
private async Task RemoveSelectedAdmlFile()
117+
private async Task RemoveSelectedAdmlFileAsync()
119118
{
120119
if (SelectedAdmlFilePath != null)
121120
{
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace Sekta.Core.ModelView;
5+
6+
public readonly struct AdmxAndAdmlFiles
7+
{
8+
public readonly string AdmxFilePath;
9+
public readonly string[] AdmlFilePaths;
10+
11+
public AdmxAndAdmlFiles(string admxFilePath, IEnumerable<string> admlFilePaths)
12+
{
13+
AdmxFilePath = admxFilePath;
14+
AdmlFilePaths = admlFilePaths.ToArray();
15+
}
16+
}

0 commit comments

Comments
 (0)
Please sign in to comment.