Skip to content

Commit

Permalink
Convert TransparencyType from enum to class #318
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian Stockbower committed Nov 9, 2017
1 parent 88e8ea9 commit 099fbb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 5 additions & 5 deletions net-core/Ical.Net/Ical.Net/Components/CalendarEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ public string Status
/// or if the time cannot be scheduled for anything
/// else (opaque).
/// </summary>
public TransparencyType Transparency
public string Transparency
{
get => Properties.Get<TransparencyType>("TRANSP");
set => Properties.Set("TRANSP", value);
get => Properties.Get<string>(TransparencyType.Key);
set => Properties.Set(TransparencyType.Key, value);
}

private EventEvaluator _mEvaluator;
Expand Down Expand Up @@ -293,7 +293,7 @@ protected bool Equals(CalendarEvent other)
&& resourcesSet.SetEquals(other.Resources)
&& string.Equals(Status, other.Status, StringComparison.Ordinal)
&& IsActive == other.IsActive
&& Transparency.Equals(other.Transparency)
&& string.Equals(Transparency, other.Transparency, TransparencyType.Comparison)
&& EvaluationIncludesReferenceDate == other.EvaluationIncludesReferenceDate
&& Attachments.SequenceEqual(other.Attachments)
&& CollectionHelpers.Equals(ExceptionRules, other.ExceptionRules)
Expand Down Expand Up @@ -352,7 +352,7 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ (Location?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ Status?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ IsActive.GetHashCode();
hashCode = (hashCode * 397) ^ Transparency.GetHashCode();
hashCode = (hashCode * 397) ^ Transparency?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Attachments);
hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Resources);
hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCodeForNestedCollection(ExceptionDates);
Expand Down
10 changes: 7 additions & 3 deletions net-core/Ical.Net/Ical.Net/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,14 @@ public enum RecurrenceEvaluationModeType
ThrowException
}

public enum TransparencyType
public static class TransparencyType
{
Opaque,
Transparent
public const string Name = "TRANSP";
public const string Key = "TRANSP";
public static readonly StringComparison Comparison = StringComparison.Ordinal;

public const string Opaque = "OPAQUE";
public const string Transparent = "TRANSPARENT";
}

public class CalendarProductIDs
Expand Down

0 comments on commit 099fbb0

Please sign in to comment.