Example #1
0
        protected BaseFindInFiles(string directory, string[] include, string[] exclude)
        {
            m_directory = directory;
            m_include = include;
            m_exclude = exclude;

            Boss boss = ObjectModel.Create("TextEditorPlugin");
            m_encoding = boss.Get<ITextEncoding>();

            boss = ObjectModel.Create("Application");
            m_transcript = boss.Get<ITranscript>();
        }
 public SubtitleEncoder(ILibraryManager libraryManager, ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IJsonSerializer json, IHttpClient httpClient, IMediaSourceManager mediaSourceManager, IProcessFactory processFactory, ITextEncoding textEncoding)
 {
     _libraryManager = libraryManager;
     _logger         = logger;
     _appPaths       = appPaths;
     _fileSystem     = fileSystem;
     _mediaEncoder   = mediaEncoder;
     _json           = json;
     _httpClient     = httpClient;
     _processFactory = processFactory;
     _textEncoding   = textEncoding;
 }
Example #3
0
        public EndPointListener(HttpListener listener, IPAddress addr, int port, bool secure, X509Certificate cert, ILogger logger, ICryptoProvider cryptoProvider, ISocketFactory socketFactory, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding, IFileSystem fileSystem, IEnvironmentInfo environment)
        {
            this.listener        = listener;
            _logger              = logger;
            _cryptoProvider      = cryptoProvider;
            _socketFactory       = socketFactory;
            _memoryStreamFactory = memoryStreamFactory;
            _textEncoding        = textEncoding;
            _fileSystem          = fileSystem;
            _environment         = environment;

            this.secure = secure;
            this.cert   = cert;

            _enableDualMode = addr.Equals(IPAddress.IPv6Any);
            endpoint        = new IPEndPoint(addr, port);

            prefixes     = new Dictionary <ListenerPrefix, HttpListener>();
            unregistered = new Dictionary <HttpConnection, HttpConnection>();

            CreateSocket();
        }
Example #4
0
 public WebSocketSharpListener(ILogger logger, ICertificate certificate, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding, INetworkManager networkManager, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, IStreamFactory streamFactory, bool enableDualMode, Func <HttpListenerContext, IHttpRequest> httpRequestFactory, IFileSystem fileSystem)
 {
     _logger               = logger;
     _certificate          = certificate;
     _memoryStreamProvider = memoryStreamProvider;
     _textEncoding         = textEncoding;
     _networkManager       = networkManager;
     _socketFactory        = socketFactory;
     _cryptoProvider       = cryptoProvider;
     _streamFactory        = streamFactory;
     _enableDualMode       = enableDualMode;
     _httpRequestFactory   = httpRequestFactory;
     _fileSystem           = fileSystem;
 }
        public WebSocketSharpListener(ILogger logger, X509Certificate certificate, IStreamHelper streamHelper, ITextEncoding textEncoding, INetworkManager networkManager, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, bool enableDualMode, IFileSystem fileSystem, IEnvironmentInfo environment)
        {
            _logger         = logger;
            _certificate    = certificate;
            _streamHelper   = streamHelper;
            _textEncoding   = textEncoding;
            _networkManager = networkManager;
            _socketFactory  = socketFactory;
            _cryptoProvider = cryptoProvider;
            _enableDualMode = enableDualMode;
            _fileSystem     = fileSystem;
            _environment    = environment;

            _disposeCancellationToken = _disposeCancellationTokenSource.Token;
        }
Example #6
0
        public HttpListenerHost(IServerApplicationHost applicationHost,
                                ILogger logger,
                                IServerConfigurationManager config,
                                string serviceName,
                                string defaultRedirectPath, INetworkManager networkManager, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, IEnvironmentInfo environment, X509Certificate certificate, Func <Type, Func <string, object> > funcParseFn, bool enableDualModeSockets, IFileSystem fileSystem)
        {
            Instance = this;

            _appHost               = applicationHost;
            DefaultRedirectPath    = defaultRedirectPath;
            _networkManager        = networkManager;
            _memoryStreamProvider  = memoryStreamProvider;
            _textEncoding          = textEncoding;
            _socketFactory         = socketFactory;
            _cryptoProvider        = cryptoProvider;
            _jsonSerializer        = jsonSerializer;
            _xmlSerializer         = xmlSerializer;
            _environment           = environment;
            _certificate           = certificate;
            _funcParseFn           = funcParseFn;
            _enableDualModeSockets = enableDualModeSockets;
            _fileSystem            = fileSystem;
            _config = config;

            _logger = logger;

            RequestFilters  = new Action <IRequest, IResponse, object>[] { };
            ResponseFilters = new Action <IRequest, IResponse, object>[] { };
        }
Example #7
0
        public static async Task <HttpConnection> Create(ILogger logger, Socket sock, EndPointListener epl, bool secure, X509Certificate cert, ICryptoProvider cryptoProvider, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding, IFileSystem fileSystem, IEnvironmentInfo environment)
        {
            var connection = new HttpConnection(logger, sock, epl, secure, cert, cryptoProvider, memoryStreamFactory, textEncoding, fileSystem, environment);

            await connection.InitStream().ConfigureAwait(false);

            return(connection);
        }
Example #8
0
        public static async Task <HttpConnection> Create(ILogger logger, IAcceptSocket sock, EndPointListener epl, bool secure, ICertificate cert, ICryptoProvider cryptoProvider, IStreamFactory streamFactory, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding)
        {
            var connection = new HttpConnection(logger, sock, epl, secure, cert, cryptoProvider, streamFactory, memoryStreamFactory, textEncoding);

            await connection.InitStream().ConfigureAwait(false);

            return(connection);
        }
Example #9
0
        public BDROM(
            string path, IFileSystem fileSystem, ITextEncoding textEncoding)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

            _fileSystem = fileSystem;
            //
            // Locate BDMV directories.
            //

            DirectoryBDMV =
                GetDirectoryBDMV(path);

            if (DirectoryBDMV == null)
            {
                throw new Exception("Unable to locate BD structure.");
            }

            DirectoryRoot =
                _fileSystem.GetDirectoryInfo(_fileSystem.GetDirectoryName(DirectoryBDMV.FullName));
            DirectoryBDJO =
                GetDirectory("BDJO", DirectoryBDMV, 0);
            DirectoryCLIPINF =
                GetDirectory("CLIPINF", DirectoryBDMV, 0);
            DirectoryPLAYLIST =
                GetDirectory("PLAYLIST", DirectoryBDMV, 0);
            DirectorySNP =
                GetDirectory("SNP", DirectoryRoot, 0);
            DirectorySTREAM =
                GetDirectory("STREAM", DirectoryBDMV, 0);
            DirectorySSIF =
                GetDirectory("SSIF", DirectorySTREAM, 0);

            if (DirectoryCLIPINF == null ||
                DirectoryPLAYLIST == null)
            {
                throw new Exception("Unable to locate BD structure.");
            }

            //
            // Initialize basic disc properties.
            //

            VolumeLabel = GetVolumeLabel(DirectoryRoot);
            Size        = (ulong)GetDirectorySize(DirectoryRoot);

            if (null != GetDirectory("BDSVM", DirectoryRoot, 0))
            {
                IsBDPlus = true;
            }
            if (null != GetDirectory("SLYVM", DirectoryRoot, 0))
            {
                IsBDPlus = true;
            }
            if (null != GetDirectory("ANYVM", DirectoryRoot, 0))
            {
                IsBDPlus = true;
            }

            if (DirectoryBDJO != null &&
                _fileSystem.GetFilePaths(DirectoryBDJO.FullName).Any())
            {
                IsBDJava = true;
            }

            if (DirectorySNP != null &&
                GetFilePaths(DirectorySNP.FullName, ".mnv").Any())
            {
                IsPSP = true;
            }

            if (DirectorySSIF != null &&
                _fileSystem.GetFilePaths(DirectorySSIF.FullName).Any())
            {
                Is3D = true;
            }

            if (_fileSystem.FileExists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
            {
                IsDBOX = true;
            }

            //
            // Initialize file lists.
            //

            if (DirectoryPLAYLIST != null)
            {
                FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray();
                foreach (FileSystemMetadata file in files)
                {
                    PlaylistFiles.Add(
                        file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding));
                }
            }

            if (DirectorySTREAM != null)
            {
                FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray();
                foreach (FileSystemMetadata file in files)
                {
                    StreamFiles.Add(
                        file.Name.ToUpper(), new TSStreamFile(file, _fileSystem));
                }
            }

            if (DirectoryCLIPINF != null)
            {
                FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray();
                foreach (FileSystemMetadata file in files)
                {
                    StreamClipFiles.Add(
                        file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding));
                }
            }

            if (DirectorySSIF != null)
            {
                FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray();
                foreach (FileSystemMetadata file in files)
                {
                    InterleavedFiles.Add(
                        file.Name.ToUpper(), new TSInterleavedFile(file));
                }
            }
        }
Example #10
0
        public EndPointListener(HttpListener listener, IpAddressInfo addr, int port, bool secure, ICertificate cert, ILogger logger, ICryptoProvider cryptoProvider, IStreamFactory streamFactory, ISocketFactory socketFactory, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding)
        {
            this.listener        = listener;
            _logger              = logger;
            _cryptoProvider      = cryptoProvider;
            _streamFactory       = streamFactory;
            _socketFactory       = socketFactory;
            _memoryStreamFactory = memoryStreamFactory;
            _textEncoding        = textEncoding;

            this.secure = secure;
            this.cert   = cert;

            _enableDualMode = addr.Equals(IpAddressInfo.IPv6Any);
            endpoint        = new IpEndPointInfo(addr, port);

            prefixes     = new Dictionary <ListenerPrefix, HttpListener>();
            unregistered = new Dictionary <HttpConnection, HttpConnection>();

            CreateSocket();
        }
Example #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WebSocketConnection" /> class.
        /// </summary>
        /// <param name="socket">The socket.</param>
        /// <param name="remoteEndPoint">The remote end point.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="logger">The logger.</param>
        /// <exception cref="System.ArgumentNullException">socket</exception>
        public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding)
        {
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }
            if (string.IsNullOrEmpty(remoteEndPoint))
            {
                throw new ArgumentNullException("remoteEndPoint");
            }
            if (jsonSerializer == null)
            {
                throw new ArgumentNullException("jsonSerializer");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            Id = Guid.NewGuid();
            _jsonSerializer        = jsonSerializer;
            _socket                = socket;
            _socket.OnReceiveBytes = OnReceiveInternal;
            _socket.OnReceive      = OnReceiveInternal;
            RemoteEndPoint         = remoteEndPoint;
            _logger                = logger;
            _memoryStreamProvider  = memoryStreamProvider;
            _textEncoding          = textEncoding;

            socket.Closed += socket_Closed;
        }
Example #12
0
 public HttpListener(ILogger logger, X509Certificate certificate, ICryptoProvider cryptoProvider, ISocketFactory socketFactory, INetworkManager networkManager, ITextEncoding textEncoding, IStreamHelper streamHelper, IFileSystem fileSystem, IEnvironmentInfo environmentInfo)
     : this(logger, cryptoProvider, socketFactory, networkManager, textEncoding, streamHelper, fileSystem, environmentInfo)
 {
     _certificate = certificate;
 }
Example #13
0
 internal HttpListenerContext(HttpConnection cnc, ILogger logger, ICryptoProvider cryptoProvider, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding, IFileSystem fileSystem)
 {
     this.cnc             = cnc;
     _cryptoProvider      = cryptoProvider;
     _memoryStreamFactory = memoryStreamFactory;
     _textEncoding        = textEncoding;
     request  = new HttpListenerRequest(this, _textEncoding);
     response = new HttpListenerResponse(this, logger, _textEncoding, fileSystem);
 }
Example #14
0
 public BdInfoExaminer(IFileSystem fileSystem, ITextEncoding textEncoding)
 {
     _fileSystem   = fileSystem;
     _textEncoding = textEncoding;
 }
Example #15
0
 public HttpListener(ILogger logger, ICryptoProvider cryptoProvider, ISocketFactory socketFactory, INetworkManager networkManager, ITextEncoding textEncoding, IMemoryStreamFactory memoryStreamFactory, IFileSystem fileSystem, IEnvironmentInfo environmentInfo)
 {
     _logger             = logger;
     CryptoProvider      = cryptoProvider;
     SocketFactory       = socketFactory;
     NetworkManager      = networkManager;
     TextEncoding        = textEncoding;
     MemoryStreamFactory = memoryStreamFactory;
     FileSystem          = fileSystem;
     EnvironmentInfo     = environmentInfo;
     prefixes            = new HttpListenerPrefixCollection(logger, this);
     registry            = new Dictionary <HttpListenerContext, HttpListenerContext>();
     connections         = new Dictionary <HttpConnection, HttpConnection>();
     auth_schemes        = AuthenticationSchemes.Anonymous;
 }
Example #16
0
 private HttpConnection(ILogger logger, Socket socket, EndPointListener epl, bool secure, X509Certificate cert, ICryptoProvider cryptoProvider, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding, IFileSystem fileSystem, IEnvironmentInfo environment)
 {
     _logger              = logger;
     this._socket         = socket;
     this._epl            = epl;
     this.secure          = secure;
     this.cert            = cert;
     _cryptoProvider      = cryptoProvider;
     _memoryStreamFactory = memoryStreamFactory;
     _textEncoding        = textEncoding;
     _fileSystem          = fileSystem;
     _environment         = environment;
 }
Example #17
0
 private HttpConnection(ILogger logger, IAcceptSocket sock, EndPointListener epl, bool secure, ICertificate cert, ICryptoProvider cryptoProvider, IStreamFactory streamFactory, IMemoryStreamFactory memoryStreamFactory, ITextEncoding textEncoding)
 {
     _logger              = logger;
     this.sock            = sock;
     this.epl             = epl;
     this.secure          = secure;
     this.cert            = cert;
     _cryptoProvider      = cryptoProvider;
     _memoryStreamFactory = memoryStreamFactory;
     _textEncoding        = textEncoding;
     _streamFactory       = streamFactory;
 }