Skip to content

Commit 4f8b15e

Browse files
committed
clean up all build warnings
1 parent c1f4c14 commit 4f8b15e

4 files changed

Lines changed: 55 additions & 17 deletions

File tree

.vscode/tasks.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/SharpFM.sln",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/SharpFM.sln",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/SharpFM.sln"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}

SharpFM.App/DocumentTextBindingBehavior.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected override void OnDetaching()
4141
}
4242
}
4343

44-
private void TextChanged(object sender, EventArgs eventArgs)
44+
private void TextChanged(object? sender, EventArgs eventArgs)
4545
{
4646
if (_textEditor != null && _textEditor.Document != null)
4747
{

SharpFM.Core/FileMakerClip.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public class FileMakerClip
2828
/// <param name="data">Data containing the clip.</param>
2929
public FileMakerClip(string name, string format, byte[] data)
3030
{
31-
// pull in the name
32-
Name = name;
3331
// load the format
3432
ClipboardFormat = format;
3533
// skip the first four bytes, as this is a length check
@@ -40,11 +38,10 @@ public FileMakerClip(string name, string format, byte[] data)
4038

4139
// try to show better "name" if possible
4240
var xdoc = XDocument.Load(new StringReader(XmlData));
43-
var containerName = xdoc.Element("fmxmlsnippet")?.Descendants().First()?.Attribute("name")?.Value;
44-
if (!string.IsNullOrEmpty(containerName))
45-
{
46-
Name = containerName;
47-
}
41+
var containerName = xdoc.Element("fmxmlsnippet")?.Descendants().First()?.Attribute("name")?.Value ?? "";
42+
43+
// set the name from the xml data if possible and fall back to constructor parameter
44+
Name = containerName ?? name ?? "new-clip";
4845
}
4946

5047
/// <summary>
@@ -55,7 +52,7 @@ public FileMakerClip(string name, string format, byte[] data)
5552
/// <summary>
5653
/// Name of Clip
5754
/// </summary>
58-
public string Name { get; set; }
55+
public string Name { get; set; } = string.Empty;
5956

6057
/// <summary>
6158
/// Raw data that can be put back onto the Clipboard in FileMaker structure.
@@ -94,19 +91,19 @@ public IEnumerable<FileMakerField> Fields
9491
.Elements("Field")
9592
.Select(x => new FileMakerField
9693
{
97-
FileMakerFieldId = int.Parse(x.Attribute("id").Value),
98-
Name = x.Attribute("name").Value,
99-
DataType = x.Attribute("dataType").Value,
100-
FieldType = x.Attribute("fieldType").Value,
101-
NotEmpty = bool.Parse(x.Element("Validation")?.Element("NotEmpty")?.Attribute("value").Value ?? "false"),
102-
Unique = bool.Parse(x.Element("Validation")?.Element("Unique")?.Attribute("value").Value ?? "false"),
94+
FileMakerFieldId = int.Parse(x.Attribute("id")?.Value ?? ""),
95+
Name = x.Attribute("name")?.Value ?? "",
96+
DataType = x.Attribute("dataType")?.Value ?? "",
97+
FieldType = x.Attribute("fieldType")?.Value ?? "",
98+
NotEmpty = bool.Parse(x.Element("Validation")?.Element("NotEmpty")?.Attribute("value")?.Value ?? "false"),
99+
Unique = bool.Parse(x.Element("Validation")?.Element("Unique")?.Attribute("value")?.Value ?? "false"),
103100
Comment = x.Element("Comment")?.Value,
104101
});
105102

106103
case "Layout": // on a layout we only have the field name (TABLE::FIELD) to go on, so we do that.
107104
return xdoc
108105
.Descendants("Object")
109-
.Where(x => x.Attribute("type").Value == "Field")
106+
.Where(x => x.Attribute("type")?.Value == "Field")
110107
.Descendants("FieldObj")
111108
.Elements("Name")
112109
.Select(x => new FileMakerField { Name = Regex.Split(x.Value, "::")[1] });

SharpFM.Core/SharpFM.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

0 commit comments

Comments
 (0)