static void SaveTable(string filename, string[] timetable) { var table = timetable.Select(v => new List <string> () { v }).ToList(); CSVFormat.WriteCSVTable(filename, table); }
static void Tests() { //var credential = Auth(); //var service = CreateCalendarService(credential); //RequestSample(service); //CreateSampleEvent(service); //var calendar = CreateSampleCalendar(service, "Test"); // EventCSVFormat.CreateCSVFile("test_calendar", new List<Event>() { event_}); //SheetsManager.Foo(); //Console.WriteLine(new DateTime().ToString("t", new System.Globalization.CultureInfo("en-US"))); var service = RemoteSheets.Auth(); var table = RemoteSheets.Read(service, "1zcN4wBLvq_tnYrY7BfGjW2zBhcX_rET0DO6iBgEFZPw", "Лист2", "B2"); CSVFormat.WriteCSVTable("table.csv", table); }
static List <Event> CreateEventsForRemoteCalendar(string[] timetable, DateTime endDateEvents, int CountPairs) { var aboveLine = new string[timetable.Length / 2]; var belowLine = new string[timetable.Length / 2]; for (var i = 0; i < timetable.Length / 2; i++) { aboveLine[i] = timetable[2 * i]; belowLine[i] = timetable[2 * i + 1]; } var timespans_even = CSVFormat.ReadFile <MySpan>("time_for_even_numbers"); var above_events = TimetableToEventProcess(aboveLine, timespans_even, CountPairs, DateTime.Now.AddDays(7), endDateEvents); var below_events = TimetableToEventProcess(belowLine, timespans_even, CountPairs, DateTime.Now, endDateEvents); var events = new List <Event>(); events.AddRange(above_events); events.AddRange(below_events); return(events); }