Exemplo n.º 1
0
        public void OpenFile(FileSessionParameters parameters)
        {
            if (_session != null)
            {
                // Another session is open.
                // Close the session first before opening this new one
                ShutdownSession();
            }

            var session = new FileSession(this, _resultSerializer, parameters);

            OpenSession(session);
        }
Exemplo n.º 2
0
        public FileSession(ISessionHandler resultHandler, IResultSerializer resultSerializer, FileSessionParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            if (string.IsNullOrWhiteSpace(parameters.FileName))
            {
                throw new ArgumentException(@"FileName is required.", nameof(parameters));
            }

            _watchFile   = parameters.Watch;
            _syncContext = SynchronizationContext.Current;

            _resultSerializer = resultSerializer;
            _sessionHandler   = resultHandler;

            Name = parameters.FileName;
        }