private string BlockMerge() { Caption ct = new Caption(); ct.AutoWrap = false; int max = cap1.Count > cap2.Count?cap1.Count:cap2.Count; for (int i = 0; i < max; i++) { Section st = new Section(); if (i < cap1.Count) { st = cap1[i].Copy(); if (this.isRepeatHead || i >= cap2.Count) { ct.Add(st); } } if (i < cap2.Count) { addText(ref st, cap2[i]); ct.Add(st); } } return(ct.ToString()); }
private string TimeMerge() { Caption ct = new Caption(); ct.AutoWrap = false; int index1, index2; int lockType; //0 no, 1 cap1, 2 cap2 lockType = index1 = index2 = 0; DateTime capTime1 = new DateTime(), capTime2 = new DateTime(); while (index1 < cap1.Count || index2 < cap2.Count) { Section st = new Section(); if (lockType != 1 && index1 < cap1.Count) { capTime1 = cap1[index1].GetBeginTime(); } if (lockType != 2 && index2 < cap2.Count) { capTime2 = cap2[index2].GetBeginTime(); } lockType = 0; if (capTime1 > capTime2 && capTime1 > capTime2.Add(TimeIgnore) && index2 < cap2.Count || index1 == cap1.Count) { lockType = 1; } if (capTime2 > capTime1 && capTime2 > capTime1.Add(TimeIgnore) && index1 < cap1.Count || index2 == cap2.Count) { lockType = 2; } if (lockType != 1) { st = cap1[index1++].Copy(); if (this.isRepeatHead || lockType == 2) { ct.Add(st); } } if (lockType != 2) { addText(ref st, cap2[index2]); ct.Add(st); index2++; } } return(ct.ToString()); }
public static Caption ParseSrt(string[] Buffer) { Caption cap=new Caption(); Section sec=new Section(); for (int i=0;i<Buffer.Length;i++) { if (Buffer[i]=="") continue; if (Buffer[i].IndexOf(Pub.SrtSymbol)>-1) { sec=ExtractSrtSection(Buffer[i]); cap.Add(sec); } else { try { int.Parse(Buffer[i]); } catch { if (sec.Items.Count==0) sec.StyleFormat=ExtractStyle(ref Buffer[i]); sec.Items.Add(Buffer[i]); } } } return cap; }
public static Caption ParseSrt(string[] Buffer) { Caption cap = new Caption(); Section sec = new Section(); for (int i = 0; i < Buffer.Length; i++) { if (Buffer[i] == "") { continue; } if (Buffer[i].IndexOf(Pub.SrtSymbol) > -1) { sec = ExtractSrtSection(Buffer[i]); cap.Add(sec); } else { try { int.Parse(Buffer[i]); } catch { if (sec.Items.Count == 0) { sec.StyleFormat = ExtractStyle(ref Buffer[i]); } sec.Items.Add(Buffer[i]); } } } return(cap); }
public static Caption ParseSsa(string[] Buffer) { Caption cap = new Caption(); for (int i = 0; i < Buffer.Length; i++) { if (Buffer[i].IndexOf(Pub.SsaSymbol) > -1) { cap.Add(ExtractSsaSection(Buffer[i])); } } return(cap); }
public static Caption ParseSsa(string[] Buffer) { Caption cap=new Caption(); for (int i=0;i<Buffer.Length;i++) { if (Buffer[i].IndexOf(Pub.SsaSymbol)>-1) cap.Add(ExtractSsaSection(Buffer[i])); } return cap; }
private string TimeMerge() { Caption ct=new Caption(); ct.AutoWrap=false; int index1,index2; int lockType;//0 no, 1 cap1, 2 cap2 lockType=index1=index2=0; DateTime capTime1=new DateTime(),capTime2=new DateTime(); while (index1<cap1.Count||index2<cap2.Count) { Section st=new Section(); if (lockType!=1&&index1<cap1.Count) capTime1=cap1[index1].GetBeginTime(); if (lockType!=2&&index2<cap2.Count) capTime2=cap2[index2].GetBeginTime(); lockType=0; if (capTime1>capTime2&&capTime1>capTime2.Add(TimeIgnore)&&index2<cap2.Count||index1==cap1.Count) lockType=1; if (capTime2>capTime1&&capTime2>capTime1.Add(TimeIgnore)&&index1<cap1.Count||index2==cap2.Count) lockType=2; if (lockType!=1) { st=cap1[index1++].Copy(); if (this.isRepeatHead||lockType==2) ct.Add(st); } if (lockType!=2) { addText(ref st,cap2[index2]); ct.Add(st); index2++; } } return ct.ToString(); }
private string BlockMerge() { Caption ct=new Caption(); ct.AutoWrap=false; int max=cap1.Count>cap2.Count?cap1.Count:cap2.Count; for (int i=0;i<max;i++) { Section st=new Section(); if (i<cap1.Count) { st=cap1[i].Copy(); if (this.isRepeatHead||i>=cap2.Count) ct.Add(st); } if (i<cap2.Count) { addText(ref st,cap2[i]); ct.Add(st); } } return ct.ToString(); }