private List<Syllable> SplitASS(string asstext, long sentence_start, long sentence_duration) { string[] table = asstext.Split(new char[] { '{' }); List<Syllable> list = new List<Syllable>(); long start = 0; foreach (string s in table) { if (s.Length > 0) { string asss = s.StartsWith("\\k") == true ? s.Replace("\\k", "") : s; string[] table2 = asss.Split(new char[] { '}' }); long dur_centi = Convert.ToInt32(table2[0]); long dur_milli = dur_centi * 10; Syllable syl = new Syllable( table2[1], dur_milli, start + sentence_start, sentence_duration, sentence_start, this); list.Add(syl); start += dur_milli; } } return list; }
public SyllableTreeNode(Syllable syl) { _syl = syl; }
private void CompareAndUpdateSyllable(GridItem changed, object oldvalue, Syllable syl) { long S = syl.SyllableStart, E = syl.SyllableEnd; if (S.Equals(oldvalue) & changed.Label.Equals("Start time")) { syl.SyllableStart = (long)changed.Value; } if (E.Equals(oldvalue) & changed.Label.Equals("End time")) { syl.SyllableEnd = (long)changed.Value; } if (syl.GetAngleX(S).Equals(oldvalue) & changed.Label.Equals("Angle X at start")) { syl.SetAngleX(S, (int)changed.Value); } if (syl.GetAngleX(E).Equals(oldvalue) & changed.Label.Equals("Angle X at end")) { syl.SetAngleX(E, (int)changed.Value); } if (syl.GetAngleY(S).Equals(oldvalue) & changed.Label.Equals("Angle Y at start")) { syl.SetAngleY(S, (int)changed.Value); } if (syl.GetAngleY(E).Equals(oldvalue) & changed.Label.Equals("Angle Y at end")) { syl.SetAngleY(E, (int)changed.Value); } if (syl.GetAngleZ(S).Equals(oldvalue) & changed.Label.Equals("Angle Z at start")) { syl.SetAngleZ(S, (int)changed.Value); } if (syl.GetAngleZ(E).Equals(oldvalue) & changed.Label.Equals("Angle Z at end")) { syl.SetAngleZ(E, (int)changed.Value); } if (syl.GetFrontColor(S).Equals(oldvalue) & changed.Label.Equals("Front color at start")) { syl.SetFrontColor(S, (Color)changed.Value); } if (syl.GetFrontColor(E).Equals(oldvalue) & changed.Label.Equals("Front color at end")) { syl.SetFrontColor(E, (Color)changed.Value); } if (syl.GetBackColor(S).Equals(oldvalue) & changed.Label.Equals("Back color at start")) { syl.SetBackColor(S, (Color)changed.Value); } if (syl.GetBackColor(E).Equals(oldvalue) & changed.Label.Equals("Back color at end")) { syl.SetBackColor(E, (Color)changed.Value); } if (syl.GetBorderColor(S).Equals(oldvalue) & changed.Label.Equals("Border color at start")) { syl.SetBorderColor(S, (Color)changed.Value); } if (syl.GetBorderColor(E).Equals(oldvalue) & changed.Label.Equals("Border color at end")) { syl.SetBorderColor(E, (Color)changed.Value); } if (syl.GetShadowColor(S).Equals(oldvalue) & changed.Label.Equals("Shadow color at start")) { syl.SetShadowColor(S, (Color)changed.Value); } if (syl.GetShadowColor(E).Equals(oldvalue) & changed.Label.Equals("Shadow color at end")) { syl.SetShadowColor(E, (Color)changed.Value); } if (syl.GetRelativePositionX(S).Equals(oldvalue) & changed.Label.Equals("Position X at start")) { syl.SetRelativePositionX(S, (float)changed.Value); } if (syl.GetRelativePositionX(E).Equals(oldvalue) & changed.Label.Equals("Position X at end")) { syl.SetRelativePositionX(E, (float)changed.Value); } if (syl.GetRelativePositionY(S).Equals(oldvalue) & changed.Label.Equals("Position Y at start")) { syl.SetRelativePositionY(S, (float)changed.Value); } if (syl.GetRelativePositionY(E).Equals(oldvalue) & changed.Label.Equals("Position Y at end")) { syl.SetRelativePositionY(E, (float)changed.Value); } if (syl.GetQuakeX(S).Equals(oldvalue) & changed.Label.Equals("Quake X at start")) { syl.SetQuakeX(S, (int)changed.Value); } if (syl.GetQuakeX(E).Equals(oldvalue) & changed.Label.Equals("Quake X at end")) { syl.SetQuakeX(E, (int)changed.Value); } if (syl.GetQuakeY(S).Equals(oldvalue) & changed.Label.Equals("Quake Y at start")) { syl.SetQuakeY(S, (int)changed.Value); } if (syl.GetQuakeY(E).Equals(oldvalue) & changed.Label.Equals("Quake Y at end")) { syl.SetQuakeY(E, (int)changed.Value); } if (syl.GetScaleX(S).Equals(oldvalue) & changed.Label.Equals("Scale X at start")) { syl.SetScaleX(S, (float)changed.Value); } if (syl.GetScaleX(E).Equals(oldvalue) & changed.Label.Equals("Scale X at end")) { syl.SetScaleX(E, (float)changed.Value); } if (syl.GetScaleY(S).Equals(oldvalue) & changed.Label.Equals("Scale Y at start")) { syl.SetScaleY(S, (float)changed.Value); } if (syl.GetScaleY(E).Equals(oldvalue) & changed.Label.Equals("Scale Y at end")) { syl.SetScaleY(E, (float)changed.Value); } if (syl.GetBorderWeight(S).Equals(oldvalue) & changed.Label.Equals("Border weight at start")) { syl.SetBorderWeight(S, (int)changed.Value); } if (syl.GetBorderWeight(E).Equals(oldvalue) & changed.Label.Equals("Border weight at end")) { syl.SetBorderWeight(E, (int)changed.Value); } if (syl.GetShadowDepth(S).Equals(oldvalue) & changed.Label.Equals("Shadow depth at start")) { syl.SetShadowDepth(S, (int)changed.Value); } if (syl.GetShadowDepth(E).Equals(oldvalue) & changed.Label.Equals("Shadow depth at end")) { syl.SetShadowDepth(E, (int)changed.Value); } //if (changed.Label.Equals("Path")) //{ // syl.SetPathTreeNode(PathTreeNode.GetFromString(avstn, changed.Value.ToString())); //} }