Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small fixes #33

Merged
merged 3 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ComplexProperties/TimeZones/TimeZoneTransitionGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ internal virtual void InitializeFromAdjustmentRule(AdjustmentRule adjustmentRule
adjustmentRule.DateStart.Year);
standardPeriodToSet.Name = standardPeriod.Name;
standardPeriodToSet.Bias = standardPeriod.Bias;
this.timeZoneDefinition.Periods.Add(standardPeriodToSet.Id, standardPeriodToSet);
this.timeZoneDefinition.Periods.AddOrUpdate(standardPeriodToSet.Id, standardPeriodToSet);

this.transitionToStandard = new TimeZoneTransition(this.timeZoneDefinition, standardPeriodToSet);
this.transitions.Add(this.transitionToStandard);
Expand All @@ -147,7 +147,7 @@ internal virtual void InitializeFromAdjustmentRule(AdjustmentRule adjustmentRule
daylightPeriod.Name = TimeZonePeriod.DaylightPeriodName;
daylightPeriod.Bias = standardPeriod.Bias - adjustmentRule.DaylightDelta;

this.timeZoneDefinition.Periods.Add(daylightPeriod.Id, daylightPeriod);
this.timeZoneDefinition.Periods.AddOrUpdate(daylightPeriod.Id, daylightPeriod);

this.transitionToDaylight = TimeZoneTransition.CreateTimeZoneTransition(
this.timeZoneDefinition,
Expand All @@ -161,7 +161,7 @@ internal virtual void InitializeFromAdjustmentRule(AdjustmentRule adjustmentRule
adjustmentRule.DateStart.Year);
standardPeriodToSet.Name = standardPeriod.Name;
standardPeriodToSet.Bias = standardPeriod.Bias;
this.timeZoneDefinition.Periods.Add(standardPeriodToSet.Id, standardPeriodToSet);
this.timeZoneDefinition.Periods.AddOrUpdate(standardPeriodToSet.Id, standardPeriodToSet);

this.transitionToStandard = TimeZoneTransition.CreateTimeZoneTransition(
this.timeZoneDefinition,
Expand Down
10 changes: 6 additions & 4 deletions Core/EwsHttpWebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ public async Task<IEwsHttpWebResponse> GetResponse(CancellationToken token)
{
var message = new HttpRequestMessage(new HttpMethod(Method), RequestUri);
message.Content = new StringContent(Content);
message.Content.Headers.Clear();
message.Content.Headers.Add("Content-Type", "text/xml; charset=utf-8");
//if (!string.IsNullOrEmpty(ContentType))
// message.Content.Headers.ContentType = new MediaTypeHeaderValue(ContentType);

if (!string.IsNullOrEmpty(ContentType)) {
message.Content.Headers.ContentType = null;
message.Content.Headers.TryAddWithoutValidation("Content-Type", ContentType);
}

Comment on lines -93 to +98
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick check. Is this the same effective fix as PR #52 ? (the change it replaces). That's where the merge conflict was I think as #32 was already fixed in 2.0.0-beta2.


if (!string.IsNullOrEmpty(UserAgent))
{
Expand Down
13 changes: 13 additions & 0 deletions Extensions/DictionaryExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections.Generic;

namespace Microsoft.Exchange.WebServices {
public static class DictionaryExtensions {
public static void AddOrUpdate<T1,T2>(this Dictionary<T1,T2> dic,T1 key,T2 value){
if(dic.ContainsKey(key))
dic[key] = value;
else
dic.Add(key, value);
}
}

}