public override void ExtractFromDoc(string text) { string[] textLines = text.Split(new char[] {'\n'}); if(!textLines[0].Trim(' ').StartsWith("<ac") || textLines[textLines.Length - 1].Trim(' ') != "/>") { throw new FormatException(); } for(int i = 1; i < textLines.Length - 1; i++) { string currentLine = textLines[i].Trim(); if(currentLine.StartsWith("<cm")) { string commentText = currentLine; int indentCount = 1; while (currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; commentText += "\n" + currentLine; if (currentLine.Contains('<')) { indentCount++; } if (currentLine.Contains('>')) { indentCount--; } } CommentModel newComment = new CommentModel(commentText); SubParagraphs[Lines.Count] = newComment; } else { LineModel newLine = new LineModel(currentLine); Lines.Add(newLine); } } }
public override void ExtractFromDoc(string text) { string[] textLines = text.Split(new char[] { '\n' }); if (!textLines[0].Trim(' ').StartsWith("<cm") || textLines[textLines.Length - 1].Trim(' ') != "/>") { throw new FormatException(); } // TODO Extract Date and Author for (int i = 1; i < textLines.Length - 1; i++) { string currentLine = textLines[i].Trim(); LineModel newLine = new LineModel(currentLine); Lines.Add(newLine); } }
public override void ExtractFromDoc(string text) { string[] textLines = text.Split(new char[] { '\n' }); if (!textLines[0].Trim(' ').StartsWith("<ac") || textLines[textLines.Length - 1].Trim(' ') != "/>") { throw new FormatException(); } // Extract DIS_TERAS_GECE for (int i = 1; i < textLines.Length - 1; i++) { string currentLine = textLines[i].Trim(); if (currentLine.StartsWith("<ac")) { string actionText = currentLine; int indentCount = 1; while (currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; actionText += "\n" + currentLine; if (currentLine.Contains('<')) { indentCount++; } if (currentLine.Contains('>')) { indentCount--; } } ActionModel newAction = new ActionModel(actionText); SubParagraphs[Lines.Count] = newAction; } else if (currentLine.StartsWith("<di")) { string dialogText = currentLine; int indentCount = 1; while (currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; dialogText += "\n" + currentLine; if (currentLine.Contains('<')) { indentCount++; } if (currentLine.Contains('>')) { indentCount--; } } DialogModel newDialog = new DialogModel(dialogText); SubParagraphs[Lines.Count] = newDialog; } else { LineModel newLine = new LineModel(currentLine); Lines.Add(newLine); } } }
public override void ExtractFromDoc(string text) { string[] textLines = text.Split(new char[] { '\n' }); if(!textLines[0].Trim(' ').StartsWith("<ac") || textLines[textLines.Length - 1].Trim(' ') != "/>") { throw new FormatException(); } // Extract DIS_TERAS_GECE for(int i = 1; i < textLines.Length - 1; i++) { string currentLine = textLines[i].Trim(); if(currentLine.StartsWith("<ac")) { string actionText = currentLine; int indentCount = 1; while(currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; actionText += "\n" + currentLine; if(currentLine.Contains('<')) { indentCount++; } if(currentLine.Contains('>')) { indentCount--; } } ActionModel newAction = new ActionModel(actionText); SubParagraphs[Lines.Count] = newAction; } else if(currentLine.StartsWith("<di")) { string dialogText = currentLine; int indentCount = 1; while(currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; dialogText += "\n" + currentLine; if(currentLine.Contains('<')) { indentCount++; } if(currentLine.Contains('>')) { indentCount--; } } DialogModel newDialog = new DialogModel(dialogText); SubParagraphs[Lines.Count] = newDialog; } else { LineModel newLine = new LineModel(currentLine); Lines.Add(newLine); } } }
public override void ExtractFromDoc(string text) { string[] textLines = text.Split(new char[] { '\n' }); if (!textLines[0].Trim(' ').StartsWith("<di") || textLines[textLines.Length - 1].Trim(' ') != "/>") { throw new FormatException(); } // TODO Extract Character for (int i = 1; i < textLines.Length - 1; i++) { string currentLine = textLines[i].Trim(); if (currentLine.StartsWith("<cm")) { string commentText = currentLine; int indentCount = 1; while (currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; commentText += "\n" + currentLine; if (currentLine.Contains('<')) { indentCount++; } if (currentLine.Contains('>')) { indentCount--; } } CommentModel newComment = new CommentModel(commentText); SubParagraphs[Lines.Count] = newComment; } else if (currentLine.Trim().StartsWith("<pa")) { if (i != 1) { throw new FormatException(); } string paraphraseText = currentLine; int indentCount = 1; while (currentLine != "/>" && indentCount != 0) { i++; currentLine = textLines[i]; paraphraseText += "\n" + currentLine; if (currentLine.Contains('<')) { indentCount++; } if (currentLine.Contains('>')) { indentCount--; } } ParaphraseModel newParaphrase = new ParaphraseModel(paraphraseText); SubParagraphs[Lines.Count] = newParaphrase; } else { LineModel newLine = new LineModel(currentLine); Lines.Add(newLine); } } }