private VocabWritingPart MakeFuriganaPart(VocabEntity vocab, FuriganaPart furiganaPart) { VocabWritingPart part = new VocabWritingPart(); part.OriginalVocab = vocab; part.Furigana = furiganaPart.Value; part.Characters = new List<KanjiWritingCharacter>(); for (int i = furiganaPart.StartIndex; i <= furiganaPart.EndIndex; i++) { part.Characters.Add(MakeCharacter(vocab, vocab.KanjiWriting[i])); } return part; }
private List<FuriganaPart> CutFurigana(string furigana) { List<FuriganaPart> output = new List<FuriganaPart>(); string[] parts = furigana.Split(';'); foreach (string part in parts) { FuriganaPart f = new FuriganaPart(); string[] bodySplit = part.Split(':'); f.Value = bodySplit[1]; string[] indexSplit = bodySplit[0].Split('-'); f.StartIndex = ParsingHelper.ForceInt(indexSplit[0]); if (indexSplit.Count() == 1) { f.EndIndex = f.StartIndex; } else { f.EndIndex = ParsingHelper.ForceInt(indexSplit[1]); } output.Add(f); } return output; }