Skip to content

Commit

Permalink
Merge pull request #58 from r-koubou/refactor/utc
Browse files Browse the repository at this point in the history
Refactor/utc
  • Loading branch information
r-koubou authored Nov 6, 2023
2 parents 89b5599 + 3235e53 commit 4e3cf94
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ namespace KeySwitchManager.Commons.Data.Extensions
{
public static class UtcDateTimeExtension
{
public static DateTime As(this UtcDateTime utcDateTime)
public static DateTime As( this UtcDateTime utcDateTime )
{
return new DateTime(
kind: DateTimeKind.Utc,
year: utcDateTime.Year,
month: utcDateTime.Month,
day:utcDateTime.Day,
day: utcDateTime.Day,
hour: utcDateTime.Hour,
minute: utcDateTime.Minute,
second: utcDateTime.Second,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ public static KeySwitch CreateTemplate(
IMidiNoteOnFactory midiNoteOnFactory,
IMidiControlChangeFactory midiControlChangeFactory,
IMidiProgramChangeFactory midiProgramChangeFactory )
=> factory.Create(
{
var now = UtcDateTime.NowAsDateTime;
return factory.Create(
Guid.NewGuid(),
"Author",
"Description",
UtcDateTime.NowAsDateTime,
UtcDateTime.NowAsDateTime,
now,
now,
"Developer Name",
"Product name",
"Instrument name",
Expand Down Expand Up @@ -65,5 +67,6 @@ public static KeySwitch CreateTemplate(
{ "extra2 key", "extra2 value" },
}
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ public KeySwitch Create(
IEnumerable<Articulation> articulations,
IReadOnlyDictionary<string, string> extraData )
{
created = DateTimeHelper.ToUtc( created );
lastUpdated = DateTimeHelper.ToUtc( lastUpdated );

return new KeySwitch(
new KeySwitchId( id ),
new Author( author ),
Expand All @@ -57,4 +54,4 @@ public KeySwitch Create(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;

using KeySwitchManager.Commons.Data;
using KeySwitchManager.Commons.Data.Extensions;
using KeySwitchManager.Domain.KeySwitches.Models;
using KeySwitchManager.Domain.KeySwitches.Models.Aggregations;
using KeySwitchManager.Domain.KeySwitches.Models.Factory;
Expand Down Expand Up @@ -33,7 +34,7 @@ public IReadOnlyCollection<KeySwitch> Translate( Workbook source )

private KeySwitch TranslateWorkSheet( Worksheet sheet, ICollection<Guid> parsedGuidList )
{
var now = DateTimeHelper.NowUtc();
var now = UtcDateTime.NowAsDateTime;
var articulations = new List<Articulation>();
var extraData = new Dictionary<string, string>();

Expand Down Expand Up @@ -143,4 +144,4 @@ private IReadOnlyCollection<MidiProgramChange> TranslateMidiProgramChangeMapping
}

}
}
}

0 comments on commit 4e3cf94

Please sign in to comment.