Mirea.Tools.Schedule.Parser (1.2.5)
Installation
dotnet nuget add source --name Winsomnia --username your_username --password your_token
dotnet add package --source Winsomnia --version 1.2.5 Mirea.Tools.Schedule.Parser
About this package
A small module that parses a specific excel format of Mirea tables.
Mirea Schedule Parser
Overview
The Mirea Schedule Parser is a .NET library that facilitates the extraction of schedules from Excel files for MIREA (Moscow Technological University). It is designed to parse the schedule and provide structured information about various classes, including details such as discipline, type of occupation, professor's name, lecture hall, and optional meeting links.
Features
- Flexible Configuration: The parser allows you to configure various offsets and settings to adapt to different Excel file formats.
- Day-wise Parsing: The library organizes the schedule information day-wise, making it easy to navigate and retrieve data for specific days.
- Group Information: Provides details about different groups, including group names, university names, and schedules for each group.
Installation
You can install the library via NuGet Package Manager Console:
Install-Package Mirea.Tools.Schedule.Parser
Don't forget to add the source for the package:
dotnet nuget add source --name Winsomnia --username your_username --password your_token https://git.winsomnia.net/api/packages/Winsomnia/nuget/index.json
Usage
Parsing Excel Files
using Mirea.Tools.Schedule.Parser;
using System;
using System.Collections.Generic;
// Instantiate the parser
var parser = new Parser();
// Parse an Excel file
Uri filePath = new Uri("path/to/schedule.xlsx");
List<GroupInfo> schedule = parser.Parse(filePath);
GroupInfo Class
The GroupInfo
class represents information about a specific group, including group name, university name, and a list of DayInfo
objects.
using Mirea.Tools.Schedule.Parser.Domain;
foreach (var group in schedule)
{
Console.WriteLine($"Group: {group.GroupName}");
// Access schedule for each day
foreach (var dayInfo in group.Days)
{
Console.WriteLine($"Day: {dayInfo.DayOfWeek}");
// Access lessons for each pair number
foreach (var (pairNumber, lessons) in dayInfo.Lessons)
{
Console.WriteLine($"Pair {pairNumber}:");
// Access details for each lesson
foreach (var lesson in lessons)
{
Console.WriteLine($"- Discipline: {lesson.Discipline}");
Console.WriteLine($"- Type of Occupation: {lesson.TypeOfOccupation ?? "N/A"}");
Console.WriteLine($"- Professor: {lesson.FullNameOfProfessor ?? "N/A"}");
Console.WriteLine($"- Lecture Hall: {lesson.LectureHall ?? "N/A"}");
Console.WriteLine($"- Meeting Link: {lesson.LinkToMeet ?? "N/A"}");
Console.WriteLine($"- Is Even: {lesson.IsEven}");
}
}
}
}
Attention
The schedule may contain several values that are not processed in any way, but they are mostly separated using the \n
separator. If the data is separated, it will need to be processed
Configuration
The Parser
class provides various properties for configuring offsets and settings according to the structure of your Excel file. You can customize these properties to match the specific format of the schedule.
var parser = new Parser
{
// Set various offsets and settings here
MaxPairByDay = 7,
PairNumberOffset = 1,
// ... (other properties)
};
// Use the parser to parse the schedule as shown in the previous examples
Feel free to adjust these configuration properties based on your specific Excel file structure.
Dependencies
License
This library is licensed under the MIT License. Feel free to modify and distribute it according to your project's requirements. If you find any issues or have suggestions for improvement, please open an issue.
Release v1.2.5
- Add parsing all worksheets
Dependencies
ID | Version | Target Framework |
---|---|---|
EPPlus | 7.3.0 | net8.0 |