public parseCtx(IEnumerable<XElement> enumEls) { lex lastSym; symbols.Enqueue(lastSym = new lex()); int actLxIdx = 0; XElement[] els = enumEls.ToArray(); Action<int> finishLex = i => lastSym.others = els.Skip(actLxIdx).Take(i - actLxIdx).Where(el => el.Name.LocalName != "img" && el.Name.LocalName != "br").ToArray(); for (int i = 0; i < els.Length; i++) { var el = els[i]; var cls = el.AttributeValue("class"); if (isTag.Contains(cls)) { finishLex(i); symbols.Enqueue(lastSym = new lex { cls = cls, content = el }); actLxIdx = i + 1; } } finishLex(els.Length); }
public virtual void processContent(lex lx) { foreach (var e in lx.content.Elements().ToArray()) if (e.Name.LocalName == "br") e.Remove(); if (lx.content.HasElements) xmlContent = lx.content; else content = LowUtils.crlfSpaces(lx.content.Value); }
public override void processContent(lex lx) { foreach (var e in lx.content.Elements().ToArray()) { if (e.AttributeValue("class") == "MLang") { LineIds line; switch (e.Value) { case "Chinese Simplified": line = LineIds.Chinese; break; case "Chinese Traditional": line = LineIds.Chinese_Mandarin; break; case "Portuguese Brazil": line = LineIds.Portuguese_Brazilian; break; case "Portuguese Portugal": line = LineIds.Portuguese; break; default: line = LowUtils.EnumParse<LineIds>(e.Value); break; } lang = CommonLib.LineIdToLang(line); } e.Remove(); } content = LowUtils.crlfSpaces(lx.content.Value); }