private void Write(StreamReader aReader, StreamWriter aWriter, RCFileContent aRcFileContent) { var stringLines = SortStringLinesAfterId(aRcFileContent); var iterator = stringLines.GetEnumerator(); bool hasNext = iterator.MoveNext(); while (!aReader.EndOfStream) { string line = aReader.ReadLine(); List <string> lineElements = ParseUtility.BuildListOfStringsFromReadLine(line, Parse.kSplitResourceElementsChars); int numberPositionsToSkip = hasNext ? NumberPositionToSkip(aRcFileContent, iterator) : 0; while (numberPositionsToSkip-- > 0) { hasNext = iterator.MoveNext(); } if (LineRepresentString(lineElements.Count, hasNext) == false || !ParseUtility.TransformToDecimal(lineElements[2], out int stringId)) { aWriter.WriteLine(line); } else if (CheckForAddedStrings(aWriter, iterator, line, stringId, aRcFileContent)) { hasNext = iterator.MoveNext(); } } }
public List <KeyValuePair <string, string> > SortByIdValue() { var elements = mHeaderElements.ToList(); elements.Sort((pair1, pair2) => { ParseUtility.TransformToDecimal(pair1.Value, out int id1); ParseUtility.TransformToDecimal(pair2.Value, out int id2); return(id1.CompareTo(id2)); }); return(elements); }
private void ReadStringTableContent(RCFileContent aRcFileContent, StreamReader aReadFile, int aStringTableOrder) { string readLine = string.Empty; while ((readLine = aReadFile.ReadLine()) != TagConstants.kTagEnd) { string line = readLine; string stringValue = string.Empty; List <string> lineElements = ParseUtility.BuildListOfStringsFromReadLine(readLine, new char[] { ' ' }); if (lineElements.Count == 0) { continue; } ExtractStringValueLine(aReadFile, lineElements, ref stringValue, ref line); BuildStringValue(ref line, ref stringValue, aReadFile); stringValue = new EscapeSequences().Escape(stringValue); SaveData(aRcFileContent, lineElements[0], stringValue, line, aStringTableOrder); } }