Added Notes Module + Data Structure Added Config Module + Data Structure Added Role Buttons Module + Data Structure
41 lines
No EOL
1.7 KiB
C#
41 lines
No EOL
1.7 KiB
C#
namespace SMSModLogOutputAnalyzer
|
|
{
|
|
internal partial class Flowchart
|
|
{
|
|
public static Flowchart Parse(string file) => Parse(file.Split('\n'));
|
|
public static Flowchart Parse(string[] lines)
|
|
{
|
|
Flowchart flowchart = new();
|
|
|
|
foreach (var line in lines)
|
|
{
|
|
if (line.Contains("-->"))
|
|
{
|
|
var fc = new FlowchartConnection();
|
|
fc.FromName = line.Split("-->")[0].Trim().ToLower();
|
|
if (line.Contains("|"))
|
|
{
|
|
fc.ToName = line.Split('|')[2].Trim().ToLower();
|
|
fc.Text = line.Split('|')[1].Trim().Replace("\\n", "").Replace("]", "");
|
|
} else
|
|
{
|
|
fc.ToName = line.Split("-->")[1].Trim().ToLower();
|
|
fc.Text = "Next";
|
|
}
|
|
flowchart.Connections.Add(fc);
|
|
}
|
|
else
|
|
{
|
|
string name = line.Split('[')[0].Trim().ToLower();
|
|
string text = line.Split('[')[1].Split("<sub>")[0].Replace("\\n", "").Replace("]", "");
|
|
string description = line.Contains("<sub>") ? line.Split("<sub>")[1].Trim().Trim(']').Replace("\\n", "\n") : "";
|
|
flowchart.Nodes.Add(new FlowchartNode { Name = name, Text = text, Description = description });
|
|
}
|
|
}
|
|
|
|
return flowchart;
|
|
}
|
|
public List<FlowchartNode> Nodes { get; set; } = new();
|
|
public List<FlowchartConnection> Connections { get; set; } = new();
|
|
}
|
|
} |