<commit_before>﻿using System;
using System.IO;

namespace makecal
{
  public class CalendarWriterFactory
  {
    public OutputType OutputType { get; set; }
    private string ServiceAccountKey { get; set; }
    private string OutputDirectory { get; set; }

    public CalendarWriterFactory(OutputType outputType, string serviceAccountKey)
    {
      OutputType = outputType;

      switch (OutputType)
      {
        case OutputType.Csv:
          OutputDirectory = CreateOutputDirectory("csv");
          break;
        case OutputType.Ical:
          OutputDirectory = CreateOutputDirectory("ical");
          break;
        case OutputType.GoogleCalendar:
        case OutputType.GoogleCalendarPrimary:
        case OutputType.GoogleCalendarRemoveSecondary:
          ServiceAccountKey = serviceAccountKey;
          break;
      }
    }

    public ICalendarWriter GetCalendarWriter(string email)
    {
      if (OutputType == OutputType.GoogleCalendar || OutputType == OutputType.GoogleCalendarRemoveSecondary)
      {
        return new GoogleCalendarWriter(email, ServiceAccountKey, removeCalendars: OutputType == OutputType.GoogleCalendarRemoveSecondary);
      }
      if (OutputType == OutputType.GoogleCalendarPrimary)
      {
        return new GooglePrimaryCalendarWriter(email, ServiceAccountKey);
      }

      var userName = email.Split('@')[0];
      var outputFileName = Path.Combine(OutputDirectory, userName);

      return OutputType switch
      {
        OutputType.Csv => new CsvCalendarWriter(outputFileName + ".csv"),
        OutputType.Ical => new IcalCalendarWriter(outputFileName + ".ics"),
        _ => throw new NotImplementedException(),
      };
    }

    private static string CreateOutputDirectory(string subfolder)
    {
      var directory = Path.Combine(AppContext.BaseDirectory, "calendars", subfolder);
      Directory.CreateDirectory(directory);
      return directory;
    }
  }
}<commit_msg>Code style<commit_after>﻿using System;
using System.IO;

namespace makecal
{
  public class CalendarWriterFactory
  {
    public OutputType OutputType { get; set; }
    private string ServiceAccountKey { get; set; }
    private string OutputDirectory { get; set; }

    public CalendarWriterFactory(OutputType outputType, string serviceAccountKey)
    {
      OutputType = outputType;

      switch (OutputType)
      {
        case OutputType.Csv:
          OutputDirectory = CreateOutputDirectory("csv");
          break;
        case OutputType.Ical:
          OutputDirectory = CreateOutputDirectory("ical");
          break;
        case OutputType.GoogleCalendar:
        case OutputType.GoogleCalendarPrimary:
        case OutputType.GoogleCalendarRemoveSecondary:
          ServiceAccountKey = serviceAccountKey;
          break;
      }
    }

    public ICalendarWriter GetCalendarWriter(string email)
    {
      if (OutputType == OutputType.GoogleCalendar || OutputType == OutputType.GoogleCalendarRemoveSecondary)
      {
        return new GoogleCalendarWriter(email, ServiceAccountKey, removeCalendars: OutputType == OutputType.GoogleCalendarRemoveSecondary);
      }
      if (OutputType == OutputType.GoogleCalendarPrimary)
      {
        return new GooglePrimaryCalendarWriter(email, ServiceAccountKey);
      }

      var userName = email.Split('@')[0];
      var outputFileName = Path.Combine(OutputDirectory, userName);

      return OutputType switch
      {
        OutputType.Csv => new CsvCalendarWriter(outputFileName + ".csv"),
        OutputType.Ical => new IcalCalendarWriter(outputFileName + ".ics"),
        _ => throw new NotImplementedException()
      };
    }

    private static string CreateOutputDirectory(string subfolder)
    {
      var directory = Path.Combine(AppContext.BaseDirectory, "calendars", subfolder);
      Directory.CreateDirectory(directory);
      return directory;
    }
  }
}
{'fraction_non_alphanumeric': 0.08238636363636363, 'fraction_numerical': 0.0005165289256198347, 'mean_word_length': 3.0427974947807934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1853771', 'n_tokens_mistral': 986, 'n_tokens_neox': 960, 'n_words': 219}