示例#1
0
        public static List <List <Attr> > LinesFromSubtitle <T>(ISubtitleObject <T> subtitle)
        {
            List <Attr> attrs = FromSubtitle(subtitle);

            List <List <Attr> > lines = new List <List <Attr> >();
            List <Attr>         line  = new List <Attr>();
            int index = 0;

            lines.Add(line);
            foreach (Attr attr in attrs)
            {
                if ((index = attr.text.IndexOf('\n')) >= 0)
                {
                    line.Add(new Attr(attr)
                    {
                        text = attr.text.Substring(0, index)
                    });
                    lines.Add(line = new List <Attr>());
                    line.Add(new Attr(attr)
                    {
                        text = attr.text.Substring(index)
                    });
                }
                else
                {
                    line.Add(attr);
                }
            }
            return(lines);
        }
示例#2
0
 public static void ToSubtitle <T>(List <Attr> attrs, ISubtitleObject <T> subtitle)
 {
     subtitle.FromAttr(attrs);
 }
示例#3
0
 public static List <Attr> FromSubtitle <T>(ISubtitleObject <T> subtitle)
 {
     return(subtitle.ToAttr());
 }