Skip to content

Commit

Permalink
ref - Adjusted code for .NET 8.0
Browse files Browse the repository at this point in the history
---

Type: ref
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Nov 25, 2023
1 parent 84ebba3 commit 2c8fd4c
Show file tree
Hide file tree
Showing 12 changed files with 404 additions and 404 deletions.
746 changes: 373 additions & 373 deletions VisualCard.Tests/ContactData.cs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions VisualCard.Tests/ContactDataBogus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,30 @@ public static class ContactDataBogus
/// <see cref="CardTools.GetCardParsers(System.IO.StreamReader)"/> function.
/// </summary>
public static readonly string[] invalidContacts =
{
[
vcardZeroByte,
vcardNonexistentVersion,
};
];

/// <summary>
/// All of the contacts in this field with invalid syntax or omitted requirements may be accepted by the
/// <see cref="CardTools.GetCardParsers(System.IO.StreamReader)"/> function.
/// </summary>
public static readonly string[] seemsValidContacts =
{
[
vcardTwoNoFullName,
};
];

/// <summary>
/// All of the contacts in this field should fail immediately upon calling <see cref="BaseVcardParser.Parse()"/>.
/// These usually resemble contacts with invalid syntax.
/// </summary>
public static readonly string[] invalidContactsParser =
{
[
vcardThreeNoFullName,
vcardTwoBarren,
vcardThreeBarren,
vcardFourBarren,
};
];
}
}
4 changes: 2 additions & 2 deletions VisualCard/Parsers/VcardParserTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ internal static string[] GetValues(string[] args, string @default, string argSpe
internal static string[] SplitToKeyAndValueFromString(string line)
{
if (line.IndexOf(':') < 0)
return new[] { line, "" };
return [line, ""];
string key = line.Substring(0, line.IndexOf(':'));
string value = line.Substring(line.IndexOf(':'));
return new[] { key, value };
return [key, value];
}

internal static IEnumerable<int> GetDigits(int num)
Expand Down
6 changes: 3 additions & 3 deletions VisualCard/Parts/AddressInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ internal static AddressInfo FromStringVcardTwo(string value)
throw new InvalidDataException("Address information must specify exactly seven values (P.O. Box, extended address, street address, locality, region, postal code, and country)");

// Populate the fields
string[] _addressTypes = new string[] { "HOME" };
string[] _addressTypes = ["HOME"];
string _addressPOBox = Regex.Unescape(splitAddressValues[0]);
string _addressExtended = Regex.Unescape(splitAddressValues[1]);
string _addressStreet = Regex.Unescape(splitAddressValues[2]);
Expand Down Expand Up @@ -242,7 +242,7 @@ internal static AddressInfo FromStringVcardThree(string value)
throw new InvalidDataException("Address information must specify exactly seven values (P.O. Box, extended address, street address, locality, region, postal code, and country)");

// Populate the fields
string[] _addressTypes = new string[] { "HOME" };
string[] _addressTypes = ["HOME"];
string _addressPOBox = Regex.Unescape(splitAddressValues[0]);
string _addressExtended = Regex.Unescape(splitAddressValues[1]);
string _addressStreet = Regex.Unescape(splitAddressValues[2]);
Expand Down Expand Up @@ -292,7 +292,7 @@ internal static AddressInfo FromStringVcardFour(string value, int altId)
throw new InvalidDataException("Address information must specify exactly seven values (P.O. Box, extended address, street address, locality, region, postal code, and country)");

// Populate the fields
string[] _addressTypes = new string[] { "HOME" };
string[] _addressTypes = ["HOME"];
string _addressPOBox = Regex.Unescape(splitAddressValues[0]);
string _addressExtended = Regex.Unescape(splitAddressValues[1]);
string _addressStreet = Regex.Unescape(splitAddressValues[2]);
Expand Down
6 changes: 3 additions & 3 deletions VisualCard/Parts/EmailInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ internal static EmailInfo FromStringVcardTwo(string value)
}

// Populate the fields
string[] _emailTypes = new string[] { "HOME" };
string[] _emailTypes = ["HOME"];
string _emailAddress = mail.Address;
EmailInfo _email = new(0, [], _emailTypes, _emailAddress);
return _email;
Expand Down Expand Up @@ -193,7 +193,7 @@ internal static EmailInfo FromStringVcardThree(string value)
}

// Populate the fields
string[] _emailTypes = new string[] { "HOME" };
string[] _emailTypes = ["HOME"];
string _emailAddress = mail.Address;
EmailInfo _email = new(0, [], _emailTypes, _emailAddress);
return _email;
Expand Down Expand Up @@ -243,7 +243,7 @@ internal static EmailInfo FromStringVcardFour(string value, int altId)
}

// Populate the fields
string[] _emailTypes = new string[] { "HOME" };
string[] _emailTypes = ["HOME"];
string _emailAddress = mail.Address;
EmailInfo _email = new(altId, [], _emailTypes, _emailAddress);
return _email;
Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/GeoInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ internal static GeoInfo FromStringVcardThree(string value)
string geoValue = value.Substring(VcardConstants._geoSpecifier.Length + 1);

// Populate the fields
string[] _geoTypes = new string[] { "uri" };
string[] _geoTypes = ["uri"];
string _geoNumber = Regex.Unescape(geoValue);
GeoInfo _geo = new(0, [], _geoTypes, _geoNumber);
return _geo;
Expand Down Expand Up @@ -183,7 +183,7 @@ internal static GeoInfo FromStringVcardFour(string value, int altId)
string geoValue = value.Substring(VcardConstants._geoSpecifier.Length + 1);

// Populate the fields
string[] _geoTypes = new string[] { "uri" };
string[] _geoTypes = ["uri"];
string _geoNumber = Regex.Unescape(geoValue);
GeoInfo _geo = new(altId, [], _geoTypes, _geoNumber);
return _geo;
Expand Down
6 changes: 3 additions & 3 deletions VisualCard/Parts/ImppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal string ToStringVcardFour()
internal static ImppInfo FromStringVcardTwo(string value)
{
string imppValue = value.Substring(VcardConstants._imppSpecifier.Length + 1);
string[] _imppTypes = new string[] { "HOME" };
string[] _imppTypes = ["HOME"];
string _impp = Regex.Unescape(imppValue);
ImppInfo _imppInstance = new(0, [], _impp, _imppTypes);
return _imppInstance;
Expand All @@ -158,7 +158,7 @@ internal static ImppInfo FromStringVcardThree(string value)
string imppValue = value.Substring(VcardConstants._imppSpecifier.Length + 1);

// Populate the fields
string[] _imppTypes = new string[] { "HOME" };
string[] _imppTypes = ["HOME"];
string _impp = Regex.Unescape(imppValue);
ImppInfo _imppInstance = new(0, [], _impp, _imppTypes);
return _imppInstance;
Expand All @@ -185,7 +185,7 @@ internal static ImppInfo FromStringVcardFour(string value, int altId)
string imppValue = value.Substring(VcardConstants._imppSpecifier.Length + 1);

// Populate the fields
string[] _imppTypes = new string[] { "HOME" };
string[] _imppTypes = ["HOME"];
string _impp = Regex.Unescape(imppValue);
ImppInfo _imppInstance = new(altId, [], _impp, _imppTypes);
return _imppInstance;
Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/LabelAddressInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ internal static LabelAddressInfo FromStringVcardTwo(string value)
throw new InvalidDataException("Label address information must specify exactly one value (address label)");

// Populate the fields
string[] _addressTypes = new string[] { "HOME" };
string[] _addressTypes = ["HOME"];
string _addressLabel = Regex.Unescape(splitAddressValues[0]);
LabelAddressInfo _address = new(0, [], _addressTypes, _addressLabel);
return _address;
Expand Down Expand Up @@ -166,7 +166,7 @@ internal static LabelAddressInfo FromStringVcardThree(string value)
throw new InvalidDataException("Label address information must specify exactly one value (address label)");

// Populate the fields
string[] _addressTypes = new string[] { "HOME" };
string[] _addressTypes = ["HOME"];
string _addressLabel = Regex.Unescape(splitAddressValues[0]);
LabelAddressInfo _address = new(0, [], _addressTypes, _addressLabel);
return _address;
Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/NicknameInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ internal static NicknameInfo FromStringVcardThree(string value)
string nickValue = value.Substring(VcardConstants._nicknameSpecifier.Length + 1);

// Populate the fields
string[] _nicknameTypes = new string[] { "HOME" };
string[] _nicknameTypes = ["HOME"];
string _nick = Regex.Unescape(nickValue);
NicknameInfo _nickInstance = new(0, [], _nick, _nicknameTypes);
return _nickInstance;
Expand All @@ -157,7 +157,7 @@ internal static NicknameInfo FromStringVcardFour(string value, int altId)
string nickValue = value.Substring(VcardConstants._nicknameSpecifier.Length + 1);

// Populate the fields
string[] _nicknameTypes = new string[] { "HOME" };
string[] _nicknameTypes = ["HOME"];
string _nick = Regex.Unescape(nickValue);
NicknameInfo _nickInstance = new(altId, [], _nick, _nicknameTypes);
return _nickInstance;
Expand Down
6 changes: 3 additions & 3 deletions VisualCard/Parts/OrganizationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ internal static OrganizationInfo FromStringVcardTwo(string value)
string[] splitOrg = orgValue.Split(VcardConstants._fieldDelimiter);

// Populate the fields
string[] splitTypes = new string[] { "WORK" };
string[] splitTypes = ["WORK"];
string _orgName = Regex.Unescape(splitOrg[0]);
string _orgUnit = Regex.Unescape(splitOrg.Length >= 2 ? splitOrg[1] : "");
string _orgUnitRole = Regex.Unescape(splitOrg.Length >= 3 ? splitOrg[2] : "");
Expand Down Expand Up @@ -191,7 +191,7 @@ internal static OrganizationInfo FromStringVcardThree(string value)
string[] splitOrg = orgValue.Split(VcardConstants._fieldDelimiter);

// Populate the fields
string[] splitTypes = new string[] { "WORK" };
string[] splitTypes = ["WORK"];
string _orgName = Regex.Unescape(splitOrg[0]);
string _orgUnit = Regex.Unescape(splitOrg.Length >= 2 ? splitOrg[1] : "");
string _orgUnitRole = Regex.Unescape(splitOrg.Length >= 3 ? splitOrg[2] : "");
Expand Down Expand Up @@ -228,7 +228,7 @@ internal static OrganizationInfo FromStringVcardFour(string value, int altId)
string[] splitOrg = orgValue.Split(VcardConstants._fieldDelimiter);

// Populate the fields
string[] splitTypes = new string[] { "WORK" };
string[] splitTypes = ["WORK"];
string _orgName = Regex.Unescape(splitOrg[0]);
string _orgUnit = Regex.Unescape(splitOrg.Length >= 2 ? splitOrg[1] : "");
string _orgUnitRole = Regex.Unescape(splitOrg.Length >= 3 ? splitOrg[2] : "");
Expand Down
6 changes: 3 additions & 3 deletions VisualCard/Parts/TelephoneInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal static TelephoneInfo FromStringVcardTwo(string value)
string telValue = value.Substring(VcardConstants._telephoneSpecifier.Length + 1);

// Populate the fields
string[] _telephoneTypes = new string[] { "CELL" };
string[] _telephoneTypes = ["CELL"];
string _telephoneNumber = Regex.Unescape(telValue);
TelephoneInfo _telephone = new(0, [], _telephoneTypes, _telephoneNumber);
return _telephone;
Expand All @@ -159,7 +159,7 @@ internal static TelephoneInfo FromStringVcardThree(string value)
string telValue = value.Substring(VcardConstants._telephoneSpecifier.Length + 1);

// Populate the fields
string[] _telephoneTypes = new string[] { "CELL" };
string[] _telephoneTypes = ["CELL"];
string _telephoneNumber = Regex.Unescape(telValue);
TelephoneInfo _telephone = new(0, [], _telephoneTypes, _telephoneNumber);
return _telephone;
Expand All @@ -186,7 +186,7 @@ internal static TelephoneInfo FromStringVcardFour(string value, int altId)
string telValue = value.Substring(VcardConstants._telephoneSpecifier.Length + 1);

// Populate the fields
string[] _telephoneTypes = new string[] { "CELL" };
string[] _telephoneTypes = ["CELL"];
string _telephoneNumber = Regex.Unescape(telValue);
TelephoneInfo _telephone = new(altId, [], _telephoneTypes, _telephoneNumber);
return _telephone;
Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/TimeZoneInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ internal static TimeZoneInfo FromStringVcardThree(string value)
string tzValue = value.Substring(VcardConstants._timeZoneSpecifier.Length + 1);

// Populate the fields
string[] _timeZoneTypes = new string[] { "uri-offset" };
string[] _timeZoneTypes = ["uri-offset"];
string _timeZoneNumber = Regex.Unescape(tzValue);
TimeZoneInfo _timeZone = new(0, [], _timeZoneTypes, _timeZoneNumber);
return _timeZone;
Expand Down Expand Up @@ -183,7 +183,7 @@ internal static TimeZoneInfo FromStringVcardFour(string value, int altId)
string tzValue = value.Substring(VcardConstants._timeZoneSpecifier.Length + 1);

// Populate the fields
string[] _timeZoneTypes = new string[] { "uri-offset" };
string[] _timeZoneTypes = ["uri-offset"];
string _timeZoneNumber = Regex.Unescape(tzValue);
TimeZoneInfo _timeZone = new(altId, [], _timeZoneTypes, _timeZoneNumber);
return _timeZone;
Expand Down

0 comments on commit 2c8fd4c

Please sign in to comment.