Ejemplo n.º 1
0
        private Proto.ReminderState StateToProto(Reminder.State state)
        {
            var proto = new Proto.ReminderState();

            foreach (var schedule in state.Entries.Values)
            {
                proto.Entries.Add(EntryToProto(schedule));
            }
            return(proto);
        }
Ejemplo n.º 2
0
        private Reminder.State StateFromProto(Proto.ReminderState proto)
        {
            var builder = ImmutableDictionary <string, Reminder.Schedule> .Empty.ToBuilder();

            foreach (var protoEntry in proto.Entries)
            {
                var taskId = protoEntry.TaskId;
                builder[taskId] = EntryFromProto(protoEntry);
            }

            return(new Reminder.State(builder.ToImmutable()));
        }