示例#1
0
        public Task <CheckPointConfiguration> ReadCheckPoint(string fileName)
        {
            string isourceContent = null;

            if (File.Exists(fileName))
            {
                using (StreamReader readtext = new StreamReader(fileName))
                {
                    isourceContent = readtext.ReadToEnd();
                }
            }
            else
            {
                return(Task.FromResult(new CheckPointConfiguration
                {
                    LastSequence = 1,
                }));
            }

            var checkpointing = MessageConverter.DeSerialize <CheckPointConfiguration>(isourceContent);

            if (checkpointing != null)
            {
                _logger.LogInformation($"Reading checkpoint to {fileName}, Last sequence count : {checkpointing.LastSequence}");
            }
            else
            {
                checkpointing = new CheckPointConfiguration {
                    LastSequence = 1, LastUpdate = DateTime.Now
                }
            };

            return(Task.FromResult(checkpointing));
        }
    }
示例#2
0
        public static TResult SendMessageToServer <TResult, TRequest>(TRequest message)
        {
            var serializedMessage = MessageConverter.Serialize(message);
            var result            = SendMessageToServer(serializedMessage);

            return(MessageConverter.DeSerialize <TResult>(result));
        }