mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
infer course name from folder name
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace LocalModels;
|
||||
|
||||
public record LocalCourse
|
||||
@@ -8,35 +6,6 @@ public record LocalCourse
|
||||
public LocalCourseSettings Settings { get; set; }
|
||||
}
|
||||
|
||||
public record LocalCourseSettings
|
||||
{
|
||||
public IEnumerable<LocalAssignmentGroup> AssignmentGroups { get; init; } =
|
||||
Enumerable.Empty<LocalAssignmentGroup>();
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public IEnumerable<DayOfWeek> DaysOfWeek { get; init; } = Enumerable.Empty<DayOfWeek>();
|
||||
public ulong? CanvasId { get; init; }
|
||||
public DateTime StartDate { get; init; }
|
||||
public DateTime EndDate { get; init; }
|
||||
public SimpleTimeOnly DefaultDueTime { get; init; } = new SimpleTimeOnly();
|
||||
|
||||
public string ToYaml()
|
||||
{
|
||||
var serializer = new SerializerBuilder().DisableAliases().Build();
|
||||
var yaml = serializer.Serialize(this);
|
||||
return yaml;
|
||||
}
|
||||
|
||||
public static LocalCourseSettings ParseYaml(string rawText)
|
||||
{
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.IgnoreUnmatchedProperties()
|
||||
.Build();
|
||||
|
||||
var settings = deserializer.Deserialize<LocalCourseSettings>(rawText);
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
||||
public record SimpleTimeOnly
|
||||
{
|
||||
public int Hour { get; init; } = 1;
|
||||
|
||||
Reference in New Issue
Block a user