Exemplo n.º 1
0
 public ArchiveContentProvider(WebServer server, P2pProxyDevice device)
 {
     server.AddRouteUrl("/archive/", SendResponse, HttpMethod.Get);
     server.AddRouteUrl("/archive/play", Play, HttpMethod.Get);
     server.AddRouteUrl("/archive/play", SendHead, HttpMethod.Head);
     server.AddRouteUrl("/archive/channels", GetChannelsRequest, HttpMethod.Get);
     _device = device;
     
 }
Exemplo n.º 2
0
 public ChannelContentProvider(WebServer server, P2pProxyDevice device)
 {
     server.AddRouteUrl(PLAYLIST_PATH, SendResponse, HttpMethod.Get);
     server.AddRouteUrl(PLAY_PATH, Play, HttpMethod.Get);
     server.AddRouteUrl(PLAY_PATH, SendHead, HttpMethod.Head);
     server.AddRouteUrl(FAVOURITE_ADD, AddFavouriteRequest, HttpMethod.Get);
     server.AddRouteUrl(FAVOURITE_DEL, DelFavouriteRequest, HttpMethod.Get);
     _device = device;
     
 }
Exemplo n.º 3
0
 public RecordContentProvider(WebServer server, P2pProxyDevice device)
 {
     server.AddRouteUrl(PLAYLIST_PATH, SendResponse, HttpMethod.Get);
     server.AddRouteUrl(ADD_PATH, AddRequest, HttpMethod.Get);
     server.AddRouteUrl(DEL_PATH, DelRequest, HttpMethod.Get);
     server.AddRouteUrl(STOP_PATH, StopRequest, HttpMethod.Get);
     server.AddRouteUrl(API_PATH, AllRequest, HttpMethod.Get);
     server.AddRouteUrl(PLAY_PATH, Play, HttpMethod.Get);
     _device = device;
 }
Exemplo n.º 4
0
        public void Start()
        {
            if (AlwaysRunning())
            {
                OnNotifyed("Программа уже запущена", TypeMessage.Critical);
                Thread.Sleep(4);
                Process.GetCurrentProcess().Close();
                Process.GetCurrentProcess().Kill();
                IsWorking = false;
                return;
            }
            Log.Write("Start P2pProxy", TypeMessage.Info);
            var port = MySettings.GetSetting("web", "port", 8081);

            Log.Write("[P2pProxy] Запуск Веб-сервера", TypeMessage.Info);
            try
            {
                _web = new WebServer(Convert.ToUInt16(port));
                _web.AddRouteUrl("/help", HelpRequest, HttpMethod.Get);
                _web.Start();
                IsWorking = true;
            }
            catch
            {
                IsWorking = false;
                OnNotifyed("Порт закрыт. Дальнейшая работа программы не возможна", TypeMessage.Critical);
            }

            Device = new P2pProxyDevice(_web, this);
            Device.Start();
            Login();
                
            try
            {
                Broadcaster = new VlcBroadcaster(_web);
            }
            catch (Exception)
            {

                OnNotifyed("Не удалось запустить VLC-сервер. Дальнейшая работа программы не возможна", TypeMessage.Error);
                IsWorking = false;
                return;
            }

        }