示例#1
0
 public static void TearDown()
 {
     if (cassiniServer != null)
     {
         cassiniServer.Stop();
         cassiniServer = null;
     }
 }
示例#2
0
        private void Start()
        {
            _appPath = appDirTextBox.Text;
            if (_appPath.Length == 0 || !Directory.Exists(_appPath))
            {
                ShowError("Invalid Application Directory");
                appDirTextBox.SelectAll();
                appDirTextBox.Focus();
                return;
            }

            _portString = portTextBox.Text;
            int portNumber = -1;

            try {
                portNumber = Int32.Parse(_portString);
            }
            catch {
            }
            if (portNumber <= 0)
            {
                ShowError("Invalid Port");
                portTextBox.SelectAll();
                portTextBox.Focus();
                return;
            }

            _virtRoot = vrootTextBox.Text;
            if (_virtRoot.Length == 0 || !_virtRoot.StartsWith("/"))
            {
                ShowError("Invalid Virtual Root");
                vrootTextBox.SelectAll();
                vrootTextBox.Focus();
                return;
            }

            try {
                _server = new Cassini.Server(portNumber, _virtRoot, _appPath);
                _server.Start();
            }
            catch {
                ShowError(
                    "Cassini Managed Web Server failed to start listening on port " + portNumber + ".\r\n" +
                    "Possible conflict with another Web Server on the same port.");
                portTextBox.SelectAll();
                portTextBox.Focus();
                return;
            }

            startButton.Enabled   = false;
            appDirTextBox.Enabled = false;
            portTextBox.Enabled   = false;
            vrootTextBox.Enabled  = false;
            browseLabel.Visible   = true;
            browseLink.Text       = GetLinkText();
            browseLink.Visible    = true;
            browseLink.Focus();
        }
示例#3
0
        private void Stop()
        {
            try {
                if (_server != null)
                {
                    _server.Stop();
                    _server = null;
                }
            }
            catch {
            }

            Close();
        }
示例#4
0
 private void StartServer()
 {
     try
     {
         txtServerPath.Text = serverPath;
         _server            = new Cassini.Server(port, virtRoot, serverPath);
         _server.Start();
         btnStart.Enabled = false;
         btnStop.Enabled  = true;
     }
     catch
     {
     }
 }
        public static void SetUp()
        {
            string testsBin = Path.GetDirectoryName(typeof(ConfigureWebResources).Assembly.Location);
            string webResourcesPath = Path.GetDirectoryName(Path.GetFullPath(testsBin));

            if (File.Exists(Path.Combine(webResourcesPath, "Web.config")))
            {
                Console.WriteLine("Starting Cassini on port {0} to host web resources in '{1}'.",
                    PortNumber, webResourcesPath);

                cassiniServer = new Cassini.Server(PortNumber, "/", webResourcesPath);
                cassiniServer.Start();
            }
            else
            {
                Console.WriteLine("Warning: Expected to find Web.config in '{0}' "
                    + "based on the location of the tests assembly but it was not there.\n"
                    + "Some tests may fail unless those resources are loaded in a web server at port {1}",
                    webResourcesPath, PortNumber);
            }
        }
示例#6
0
        public static void SetUp()
        {
            string testsBin         = Path.GetDirectoryName(typeof(ConfigureWebResources).Assembly.Location);
            string webResourcesPath = Path.GetDirectoryName(Path.GetFullPath(testsBin));

            if (File.Exists(Path.Combine(webResourcesPath, "Web.config")))
            {
                Console.WriteLine("Starting Cassini on port {0} to host web resources in '{1}'.",
                                  PortNumber, webResourcesPath);

                cassiniServer = new Cassini.Server(PortNumber, "/", webResourcesPath);
                cassiniServer.Start();
            }
            else
            {
                Console.WriteLine("Warning: Expected to find Web.config in '{0}' "
                                  + "based on the location of the tests assembly but it was not there.\n"
                                  + "Some tests may fail unless those resources are loaded in a web server at port {1}",
                                  webResourcesPath, PortNumber);
            }
        }
示例#7
0
 private void btnStartServer_Click(object sender, EventArgs e)
 {
     button1_Click(sender, e);
       toolStripStatusLabel1.Text = "Starting webserver... This might take several seconds...";
       Update();
       webServer = new Cassini.Server((int)nudPort.Value, "/", Application.StartupPath+"\\htdocs");
       webServer.Start();
       linkLabel1.Text="http://"+Environment.MachineName+":"+nudPort.Value.ToString();
       linkLabel1.Visible = true;
       linkLabel2.Text = "http://" + Environment.MachineName + ":" + nudPort.Value.ToString()+"/TvServiceWebServices.asmx";
       linkLabel2.Visible = true;
       toolStripStatusLabel1.Text = "WebServer started.";
 }
示例#8
0
 private void btnStopServer_Click(object sender, EventArgs e)
 {
     webServer.Stop();
       webServer = null;
       linkLabel1.Visible = false;
       linkLabel2.Visible = false;
       toolStripStatusLabel1.Text = "WebServer stopped.";
 }
        private void Stop()
        {
            try {
                if (_server != null) {
                    _server.Stop();
                    _server = null;
                }
            }
            catch {
            }

            Close();
        }
示例#10
0
        private void Start()
        {
            _appPath = appDirTextBox.Text;
            if (_appPath.Length == 0 || !Directory.Exists(_appPath)) {
                ShowError("Invalid Application Directory");
                appDirTextBox.SelectAll();
                appDirTextBox.Focus();
                return;
            }

            _portString = portTextBox.Text;
            int portNumber = -1;
            try {
                portNumber = Int32.Parse(_portString);
            }
            catch {
            }
            if (portNumber <= 0) {
                ShowError("Invalid Port");
                portTextBox.SelectAll();
                portTextBox.Focus();
                return;
            }

            _virtRoot = vrootTextBox.Text;
            if (_virtRoot.Length == 0 || !_virtRoot.StartsWith("/")) {
                ShowError("Invalid Virtual Root");
                vrootTextBox.SelectAll();
                vrootTextBox.Focus();
                return;
            }

            try {
                _server = new Cassini.Server(portNumber, _virtRoot, _appPath);
                _server.Start();
            }
            catch {
                ShowError(
                    "Cassini Managed Web Server failed to start listening on port " + portNumber + ".\r\n" +
                    "Possible conflict with another Web Server on the same port.");
                portTextBox.SelectAll();
                portTextBox.Focus();
                return;
            }

            startButton.Enabled = false;
            appDirTextBox.Enabled = false;
            portTextBox.Enabled = false;
            vrootTextBox.Enabled = false;
            browseLabel.Visible = true;
            browseLink.Text = GetLinkText();
            browseLink.Visible = true;
            browseLink.Focus();
        }
示例#11
0
文件: YAPS.cs 项目: bietiekay/YAPS
        static void Main(String[] args)
        {
            #region ConsoleOutputLogger
            ConsoleOutputLogger.verbose = true;
            ConsoleOutputLogger.writeLogfile = true;
            #endregion

            #region Logo
            ConsoleOutputLogger.WriteLine("Yet Another Proxy Server: UDP Multicast to TCP Unicast Proxy "+System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            ConsoleOutputLogger.WriteLine("(C) 2006-2008 Stephanie Götz, Daniel Kirstenpfad and the APS Team - http://www.technology-ninja.com");
            //ConsoleOutputLogger.verbose = false;
            #endregion

            #region Data
            HttpServer httpServer;
            Cassini.Server CassiniServer;
            VCRScheduler vcrScheduler;
            XBMCSyncProcessor SyncProcessor;
            int port = 80;
            string docRoot = ".";
            httpServer = new HttpServer(docRoot, port);
            vcrScheduler = new VCRScheduler(httpServer);
            vcrScheduler.Settings = new Settings();
            httpServer.Settings = vcrScheduler.Settings;
            SyncProcessor = new XBMCSyncProcessor(httpServer);
            #endregion

            #region Load the Settings...
            SettingsProcessor Configuration = new SettingsProcessor(".\\settings\\YAPS.Recordings.dat", ".\\settings\\YAPS.DoneRecordings.dat", ".\\settings\\YAPS.Categories.dat", ".\\settings\\YAPS.Settings.dat", ".\\settings\\YAPS.Authentification.dat", ".\\settings\\YAPS.StationIDs.dat", vcrScheduler, httpServer);

            Configuration.LoadSettingsXML();
            // tell the processors that we exist...
            vcrScheduler.Configuration = Configuration;
            httpServer.Configuration = Configuration;

            //Configuration.LoadSettingsXML();

            Configuration.SaveSettings();
            #endregion

            #region channelmappinginit
            /*
            ChannelAndStationMapper.Add(5, "ZDFtheaterkanal", "/images/channels/zdftheater.png", 10, "239.255.2.5", "505");
            ChannelAndStationMapper.Add(6, "3Sat", "/images/channels/3sat.png", 28007, "239.255.2.6", "506");
            ChannelAndStationMapper.Add(39, "KIKA", "/images/channels/kika.png", 28008, "239.255.2.39", "5039");

            ChannelAndStationMapper.Add(10, "ZDF", "/images/channels/zdf.png", 28006, "239.255.2.10", "5010");
            ChannelAndStationMapper.Add(11, "ZDFdokukanal", "/images/channels/zdfdoku.png", 28014, "239.255.2.11", "5011");
            ChannelAndStationMapper.Add(11, "ZDFinfokanal", "/images/channels/zdfinfo.png", 28011, "239.255.2.12", "5012");
            ChannelAndStationMapper.Add(13, "Sat1", "/images/channels/sat1.png", 46, "239.255.2.13", "5013");
            ChannelAndStationMapper.Add(14, "ProSieben", "/images/channels/pro7.png", 898, "239.255.2.14", "5014");
            ChannelAndStationMapper.Add(15, "Kabel1", "/images/channels/kabel1.png", 899, "239.255.2.15", "5015");
            ChannelAndStationMapper.Add(16, "DSF", "/images/channels/dsf.png", 900, "239.255.2.16", "5016");
            ChannelAndStationMapper.Add(17, "N24", "/images/channels/n24.png", 47, "239.255.2.17", "5017");
            ChannelAndStationMapper.Add(18, "RTL", "/images/channels/rtl.png", 12003, "239.255.2.18", "5018");
            ChannelAndStationMapper.Add(19, "RTL2", "/images/channels/rtl2.png", 12020, "239.255.2.19", "5019");
            ChannelAndStationMapper.Add(20, "VOX", "/images/channels/vox.png", 12060, "239.255.2.20", "5020");
            ChannelAndStationMapper.Add(21, "ntv", "/images/channels/ntv.png", 12090, "239.255.2.21", "5021");
            ChannelAndStationMapper.Add(22, "SuperRTL", "/images/channels/superrtl.png", 12040, "239.255.2.22", "5022");
            ChannelAndStationMapper.Add(23, "ARD", "/images/channels/ard.png", 28106, "239.255.2.23", "5023");
            ChannelAndStationMapper.Add(24, "arte", "/images/channels/arte.png", 1, "239.255.2.24", "5024");
            ChannelAndStationMapper.Add(25, "BR", "/images/channels/br.png", 2, "239.255.2.25", "5025");
            ChannelAndStationMapper.Add(26, "BR-Alpha", "/images/channels/br-alpha.png", 28112, "239.255.2.26", "5026");
            ChannelAndStationMapper.Add(27, "HR", "/images/channels/hr.png", 28108, "239.255.2.27", "5027");
            ChannelAndStationMapper.Add(28, "Phoenix", "/images/channels/phoenix.png", 28114, "239.255.2.28", "5028");
            ChannelAndStationMapper.Add(29, "SWR BW", "/images/channels/swr.png", 3, "239.255.2.29", "5029");
            ChannelAndStationMapper.Add(30, "WDR", "/images/channels/wdr.png", 28395, "239.255.2.30", "5030");
            ChannelAndStationMapper.Add(31, "Tele5", "/images/channels/tele5.png", 4, "239.255.2.31", "5031");
            Configuration.SaveSettings();*/
            #endregion

            #region Authentification
            //AuthentificationUser aUser;
            //AuthentificationEntry aEntry;

            // pre configured allowed clients
            /*
            aUser = HTTPAuthProcessor.AddUser("BtK");
            aEntry = new AuthentificationEntry();
            aEntry.accessingIP = "127.0.0.1";
            aEntry.isAdministrator = true;
            aUser.AuthEntry.Add(aEntry);
            */
            #endregion

            #region Starting up...
                #region internal HTTP Server
                ConsoleOutputLogger.WriteLine("Starting internal HTTP Server...");
                Thread http_server_thread = new Thread(new ThreadStart(httpServer.listen));
                http_server_thread.Start();
                #endregion

                #region Cassini HTTP Server
                ConsoleOutputLogger.WriteLine("Starting Cassini HTTP Server...");
                CassiniServer = new Cassini.Server(httpServer.Settings.Cassini_Port, httpServer.Settings.Cassini_VirtualDirectory, httpServer.Settings.Cassini_Root_Directory);
                CassiniServer.Start();
                #endregion

                #region WCF Services
                if (httpServer.Settings.WCFService_Enabled)
                {
                ServiceHost YAPSServiceHost = new ServiceHost(typeof(YAPS.WCF.YAPSService), new Uri[1] { new Uri(httpServer.Settings.WCFServiceURL) });
                ConsoleOutputLogger.WriteLine("Starting YAPS WCF Service ...");
                WSHttpBinding binding = new WSHttpBinding();
                YAPSServiceHost.AddServiceEndpoint(typeof(YAPS.WCF.IYAPSService), binding, httpServer.Settings.WCFServiceURL);
                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                YAPSServiceHost.Description.Behaviors.Add(smb);
                YAPSServiceHost.AddServiceEndpoint(typeof(IMetadataExchange), binding, httpServer.Settings.WCFServiceURL+"/mex");
                YAPSServiceHost.Open();
                }
                #endregion

                #region XBMC Sync
                ConsoleOutputLogger.WriteLine("Starting XBMC Sync Processor...");
                Thread xbmc_syncprocessor_thread = new Thread(new ThreadStart(SyncProcessor.SyncProcessor));
                xbmc_syncprocessor_thread.Start();
                #endregion

                #region VCR
                ConsoleOutputLogger.WriteLine("Starting VCR Scheduler...");
                Thread vcr_scheduler_thread = new Thread(new ThreadStart(vcrScheduler.RecordingScheduler));
                vcr_scheduler_thread.Start();
                #endregion

                #region EPG
                multicastedEPGProcessor EPG_Processor = new multicastedEPGProcessor(httpServer);

                EPG_Processor.MulticastEPGSources = httpServer.Settings.MulticastEPGSources;

                EPG_Processor.setupDone();

                Thread epg_processor_thread = new Thread(new ThreadStart(EPG_Processor.EPGProcessor));
                epg_processor_thread.Start();
                #endregion

                #region SAP / SDP
                if (httpServer.Settings.SAP_Enabled)
                {
                    SAPProcessor sapProcessor = new SAPProcessor(httpServer.Settings.SAP_IPAdress, httpServer.Settings.SAP_Port);

                    Thread sap_processor_thread = new Thread(new ThreadStart(sapProcessor.SAPProcessorThread));

                    sap_processor_thread.Start();
                }
                #endregion
            #endregion
        }
 public static void TearDown()
 {
     if (cassiniServer != null)
     {
         cassiniServer.Stop();
         cassiniServer = null;
     }
 }
示例#13
0
 private void StopPlugin()
 {
     if (webServer != null)
       {
     Log.Info("plugin: MPWebServices stop");
     webServer.Stop();
     webServer = null;
       }
 }
示例#14
0
        private void StartPlugin()
        {
            Log.Info("MPWebServices: start");
              if (!Settings.LoadSettings())
              {
            Log.Error("MPWebServices: settings are invalid. Can't start web server!!!");
            return;
              }

              CheckUpdateDll("DirectShowLib.dll");
              CheckUpdateDll("TvControl.dll");
              CheckUpdateDll("TvDatabase.dll");
              CheckUpdateDll("TvLibrary.Interfaces.dll");

              Log.Info("MPWebServices: Starting web server...");
              try
              {
            webServer = new Cassini.Server(Settings.httpPort, "/", Settings.baseDir + "\\MPWebServices\\htdocs");
            webServer.Start();
              }
              catch (Exception ex)
              {
            Log.Error("MPWebServices: Exception raised while trying to start webserver. " + ex.Message);
            webServer = null;
            return;
              }
              Log.Info("MPWebServices: web server started.");
        }