Skip to content

Add support for Multiple Values in multiple lines #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions iCalNET/Model/vEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,31 @@ public class vEvent
private const string ContentLinePattern = "(.+?):(.+?)(?=\\r\\n[A-Z]|$)";
private const RegexOptions ContentLineTRegexOptions = RegexOptions.Singleline;

public Dictionary<string, ContentLine> ContentLines { get; set; }
public Dictionary<string, List<ContentLine>> ContentLines { get; set; }

public vEvent(string source)
{
Match contentMatch = Regex.Match(source, vEventContentPattern, vEventContentRegexOptions);
string content = contentMatch.Groups[1].ToString();
MatchCollection matches = Regex.Matches(content, ContentLinePattern, ContentLineTRegexOptions);
ContentLines = new Dictionary<string, ContentLine>();
ContentLines = new Dictionary<string, List<ContentLine>>();
foreach (Match match in matches)
{
string contentLineString = match.Groups[0].ToString();
string contentLineString = match.Groups[0].ToString();
ContentLine contentLine = new ContentLine(contentLineString);
ContentLines[contentLine.Name] = contentLine;
if (ContentLines.ContainsKey(ContentLine.name))
{
ContentLines[contentLine.Name].Add(contentLine);
d[i.ToString()].Add(i.ToString());
}
else
{
ContentLines.Add(contentLine.name, new List<ContentLine>()
{
contentLine
}
);
}
}

}
Expand Down