Exemplo n.º 1
0
        private IList <CincronMessage> LoadMessages()
        {
            var max = _log.MaxForeignID();

            if (max != null && max != "")
            {
                var expected = _log.OriginalMessageByForeignID(max);
                if (expected != null && expected != "")
                {
                    var maxParts = max.Split('-'); //year-month-day-hour-min-sec-fileoffset
                    int offset;
                    if (maxParts.Length >= 7 && int.TryParse(maxParts[6], out offset))
                    {
                        Log.Debug("Starting read at offset {offset} with message {msg}", offset, expected);
                        return(MessageParser.ExtractMessages(_msgFile, offset, expected, zone: null));
                    }
                }
            }

            Log.Debug("Starting reading message file from beginning");
            return(MessageParser.ExtractMessages(_msgFile, 0, "", zone: null));
        }